Skip to content

refactor(core): abstract cart creation and addition logic#2126

Merged
chanceaclark merged 1 commit into
canaryfrom
abstract-cart
Mar 21, 2025
Merged

refactor(core): abstract cart creation and addition logic#2126
chanceaclark merged 1 commit into
canaryfrom
abstract-cart

Conversation

@chanceaclark

@chanceaclark chanceaclark commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

What/Why?

Abstracts the cart creation and addition logic to handle some shared logic across add to cart server actions.

Testing

Screen.Recording.2025-03-21.at.14.34.09.mov
Screen.Recording.2025-03-21.at.14.54.47.mov

@vercel

vercel Bot commented Mar 21, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 8:01pm
catalyst-canary ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 21, 2025 8:01pm
3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
catalyst-au ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2025 8:01pm
catalyst-soul ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2025 8:01pm
catalyst-uk ⬜️ Ignored (Inspect) Visit Preview Mar 21, 2025 8:01pm

@changeset-bot

changeset-bot Bot commented Mar 21, 2025

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5f29a3e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread core/lib/cart/index.ts Outdated
@chanceaclark
chanceaclark enabled auto-merge March 21, 2025 20:01
@chanceaclark
chanceaclark added this pull request to the merge queue Mar 21, 2025
Merged via the queue into canary with commit 6aef70b Mar 21, 2025
@chanceaclark
chanceaclark deleted the abstract-cart branch March 21, 2025 20:04
@github-actions

Copy link
Copy Markdown
Contributor

⚡️🏠 Lighthouse report

Lighthouse ran against https://catalyst-canary-cpvcjp0rz-bigcommerce-platform.vercel.app

🖥️ Desktop

We ran Lighthouse against the changes on a desktop and produced this report. Here's the summary:

Category Score
🟢 Performance 99
🟢 Accessibility 92
🟠 Best practices 78
🟠 SEO 82

📱 Mobile

We ran Lighthouse against the changes on a mobile and produced this report. Here's the summary:

Category Score
🟠 Performance 83
🟢 Accessibility 92
🟠 Best practices 78
🟠 SEO 85

migueloller added a commit that referenced this pull request Mar 31, 2025
* fix: switching locales redirects user to the home page (#1990)

* chore: add demo section to readme (#1996)

* Update translations (#1993)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* feat: manage locales when creating storefronts from the CLI (#1986)

* feat: manage locales

* Add changeset

---------

Co-authored-by: Nathan Booker <nathan.booker@bigcommerce.com>

* feat: add default Tailwind typography styles (#2007)

* Update translations (#2004)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* fix(core): handle registration errors in form (#2006)

* chore(release): publish create-catalyst CLI (#2015)

* chore: remove scoped version bump

* chore(release): publish create-catalyst CLI

* feat: add es-419 to list of allowed locale for selecting (#2017)

* feat(cli): scaffold package (#2010)

* fix(core): show coupon discounts as a separate summary item (#2084)

* fix(core): show coupon discounts as a separate summary item

* fix: typo in changeset

* feat(core): add shipping options to checkout (#1997)

* feat(core): add shipping options to checkout

* fix: capitalization of Edit

* fix: bump vibes

* fix: update vibes

* fix: remove else and early return

* refactor: simplify logic by using a Set for countries

* fix: hide forms visually

* fix: add no shipping options message

* fix: remove reduce and use Set, remove let variable

* fix: split mutations

* fix: disable complexity rule for Cart

* Update translations (#2104)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* refactor: update signin behavior to use different providers (#2103)

* refactor: update signin behavior to use different providers

* chore: add additional folders to lint task

* feat: Sync Button and DynamicForm with VIBES (#2110)

* feat(core): add compare functionality to PLP (#2060)

* feat(core): migrate compare page to use soul

* feat: hide compare checkbox dynamically

* feat: pass in comparable products

* fix: add optimistic items

* feat: add optimistic to remove

* feat: add optimistic to checkbox

* fix: sort when added

* fix: sort groups and use link to compare

* fix: bump vibes components, fix button

* fix: remove unused primitves breadcrumbs component

* fix: sync vibes components

* fix: wrap transitions and call optimistic before setParam

* fix: validate with zod variables are correct

* fix: expose remove label

* fix: await setParam

* fix: translate remove label:

* fix: use parser and loader for compare

* feat: alert when max compare limit is set, disable checkboxes

* feat: Sync ProductCard and WishlistItemCard with VIBES (#2112)

* feat: Sync Breadcrumbs (#2117)

* feat: Add Wishlist VIBES components (#2118)

* chore(security): add documentation around CSRF checks (#2114)

* fix: set the trustHost value with an env var

* chore(core): documentation around CSRF checks within next-auth

* feat: Add wishlist translations, transformers, and core components (#2119)

* fix(core): revert to ids search param in compare page (#2125)

* feat(client): add errorPolicy option to GQL requests (#2124)

* feat: add anonymous session with cart tracking (#2111)

* refactor(core): abstract cart creation and addition logic (#2126)

* feat: Add wishlist modals, actions, and visibility switch (#2120)

* Bump next to address CVE (#2132)

* feat: Add wishlist modal defs, share button, and action dropdown menu (#2121)

* chore: update pnpm to 10.6.5 (#2135)

* Update translations (#2133)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>
Co-authored-by: Jorge Moya <jorge.moya@bigcommerce.com>

* chore: update node to version 22 (#2136)

* chore: remove invalid changeset (#2139)

* feat: Add wishlist pages (#2122)

* fix(core): ignore errors in orders and render products without links (#2141)

* fix: add `Streamable.from` to avoid eager promises (#2143)

* feat: add Streamable.from

* fix: use Streamable.from instead of eager promises

* chore: update dependencies to latest minors (#2142)

* feat: group 1 update for Soul form components (#2130)

* feat(core): add store hash meta tag (#2147)

* fix: dedupe default image in PDP (#2162)

* feat: group 2 update for Soul form components (#2160)

* fix: remove unused components (#2163)

---------

Co-authored-by: Aleksey Gurtovoy <agurtovoy@acm.org>
Co-authored-by: Chancellor Clark <chancellor.clark@bigcommerce.com>
Co-authored-by: bc-svc-local <102379007+bc-svc-local@users.noreply.github.com>
Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>
Co-authored-by: Roman Krasinskyi <49246595+RomanKrasinskyi@users.noreply.github.com>
Co-authored-by: Nathan Booker <nathan.booker@bigcommerce.com>
Co-authored-by: Hunter Garrett <hunter@hunterbecton.com>
Co-authored-by: Jorge Moya <jorge.moya@bigcommerce.com>
Co-authored-by: Daniel Almaguer <daniel.almaguer@bigcommerce.com>
Co-authored-by: Jordan Arldt <jordan.arldt@bigcommerce.com>
Co-authored-by: Nathan Booker <bookernath@users.noreply.github.com>
chanceaclark added a commit that referenced this pull request Apr 18, 2025
* fix: switching locales redirects user to the home page (#1990)

* chore: add demo section to readme (#1996)

* Update translations (#1993)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* feat: manage locales when creating storefronts from the CLI (#1986)

* feat: manage locales

* Add changeset

---------

Co-authored-by: Nathan Booker <nathan.booker@bigcommerce.com>

* feat: add default Tailwind typography styles (#2007)

* Update translations (#2004)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* fix(core): handle registration errors in form (#2006)

* chore(release): publish create-catalyst CLI (#2015)

* chore: remove scoped version bump

* chore(release): publish create-catalyst CLI

* feat: add es-419 to list of allowed locale for selecting (#2017)

* feat(cli): scaffold package (#2010)

* fix(core): show coupon discounts as a separate summary item (#2084)

* fix(core): show coupon discounts as a separate summary item

* fix: typo in changeset

* feat(core): add shipping options to checkout (#1997)

* feat(core): add shipping options to checkout

* fix: capitalization of Edit

* fix: bump vibes

* fix: update vibes

* fix: remove else and early return

* refactor: simplify logic by using a Set for countries

* fix: hide forms visually

* fix: add no shipping options message

* fix: remove reduce and use Set, remove let variable

* fix: split mutations

* fix: disable complexity rule for Cart

* Update translations (#2104)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>

* refactor: update signin behavior to use different providers (#2103)

* refactor: update signin behavior to use different providers

* chore: add additional folders to lint task

* feat: Sync Button and DynamicForm with VIBES (#2110)

* feat(core): add compare functionality to PLP (#2060)

* feat(core): migrate compare page to use soul

* feat: hide compare checkbox dynamically

* feat: pass in comparable products

* fix: add optimistic items

* feat: add optimistic to remove

* feat: add optimistic to checkbox

* fix: sort when added

* fix: sort groups and use link to compare

* fix: bump vibes components, fix button

* fix: remove unused primitves breadcrumbs component

* fix: sync vibes components

* fix: wrap transitions and call optimistic before setParam

* fix: validate with zod variables are correct

* fix: expose remove label

* fix: await setParam

* fix: translate remove label:

* fix: use parser and loader for compare

* feat: alert when max compare limit is set, disable checkboxes

* feat: Sync ProductCard and WishlistItemCard with VIBES (#2112)

* feat: Sync Breadcrumbs (#2117)

* feat: Add Wishlist VIBES components (#2118)

* chore(security): add documentation around CSRF checks (#2114)

* fix: set the trustHost value with an env var

* chore(core): documentation around CSRF checks within next-auth

* feat: Add wishlist translations, transformers, and core components (#2119)

* fix(core): revert to ids search param in compare page (#2125)

* feat(client): add errorPolicy option to GQL requests (#2124)

* feat: add anonymous session with cart tracking (#2111)

* refactor(core): abstract cart creation and addition logic (#2126)

* feat: Add wishlist modals, actions, and visibility switch (#2120)

* Bump next to address CVE (#2132)

* feat: Add wishlist modal defs, share button, and action dropdown menu (#2121)

* chore: update pnpm to 10.6.5 (#2135)

* Update translations (#2133)

* feat(other): LOCAL-1444 delivery translation

* chore(core): create translations patch

---------

Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>
Co-authored-by: Jorge Moya <jorge.moya@bigcommerce.com>

* chore: update node to version 22 (#2136)

* chore: remove invalid changeset (#2139)

* feat: Add wishlist pages (#2122)

* fix(core): ignore errors in orders and render products without links (#2141)

* fix: add `Streamable.from` to avoid eager promises (#2143)

* feat: add Streamable.from

* fix: use Streamable.from instead of eager promises

* chore: update dependencies to latest minors (#2142)

* feat: group 1 update for Soul form components (#2130)

* feat(core): add store hash meta tag (#2147)

* fix: dedupe default image in PDP (#2162)

* feat: group 2 update for Soul form components (#2160)

* fix: remove unused components (#2163)

---------

Co-authored-by: Aleksey Gurtovoy <agurtovoy@acm.org>
Co-authored-by: Chancellor Clark <chancellor.clark@bigcommerce.com>
Co-authored-by: bc-svc-local <102379007+bc-svc-local@users.noreply.github.com>
Co-authored-by: bc-svc-local <bc-svc-local@users.noreply.github.com>
Co-authored-by: Roman Krasinskyi <49246595+RomanKrasinskyi@users.noreply.github.com>
Co-authored-by: Nathan Booker <nathan.booker@bigcommerce.com>
Co-authored-by: Hunter Garrett <hunter@hunterbecton.com>
Co-authored-by: Jorge Moya <jorge.moya@bigcommerce.com>
Co-authored-by: Daniel Almaguer <daniel.almaguer@bigcommerce.com>
Co-authored-by: Jordan Arldt <jordan.arldt@bigcommerce.com>
Co-authored-by: Nathan Booker <bookernath@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants