Merge standard products feature into develop @W-18912410#2697
Merge standard products feature into develop @W-18912410#2697sf-emmyzhang merged 90 commits intodevelopfrom
Conversation
* update handleAddToCart and validate orderability * remove bundle changes, template test, and project config * add fallback if no image * linting * add validateOrderability tests * reorganize tests * fix lint errors * update validateOrderability logic * add product-detail tests * fix modal image link * add modal tests * changelog * pr suggestions
Co-authored-by: Kevin He <kevin.he@salesforce.com> Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com>
Follow `plugin_einstein_api` implementation for event data creation.
Signed-off-by: sf-emmyzhang <emmyzhang@salesforce.com>
| } | ||
| try { | ||
| const itemsAdded = await addToCart(variant, quantity) | ||
| const itemsAdded = await addToCart([{product, variant, quantity}]) |
There was a problem hiding this comment.
hi, @sf-emmyzhang we just removed this change in #2729. Is there a benefit to adding it back?
There was a problem hiding this comment.
Product is part of standard product changes and is needed for standard products to work
There was a problem hiding this comment.
Hmm... before BOPIS or standard-product the product was added as a lambda in the parent container addToCart handler in pages/product-detail. And a childProduct was added in the parent for product sets and bundles. My worry is with this change back that bundles and sets will not work properly.
There was a problem hiding this comment.
Updated the code to account for both features (commit)
There was a problem hiding this comment.
nit: for the record I still don't think this change is needed nor advisable. We're changing the data contract between product-view and product-detail, which implies more merge work for custom implementations. There should be a good reason.
| ? (productSelectionValues) => | ||
| handleAddToCart( | ||
| productSelectionValues | ||
| ) |
There was a problem hiding this comment.
Guessing we don't want this change either as it would associate product sets with the parent instead of the child, no?
There was a problem hiding this comment.
@jeremy-jung1 Can you help explain this change? Is this related to the 400 error?
There was a problem hiding this comment.
Yes this was the fix for a 400 error that occurred when trying to add a standard product child item in a set to cart. The childProduct is passed in via the <ProductView/> component because it received the childProduct via the product prop and passes that in when calling addToCart.
Before the parameters passed into handleAddToCart was just (variant, quantity) which isn't the correct shape as how the function is used in ProductView.
|
There's a bug with adding to wishlist when you're initially a guest shopper. After logging in, we automatically tried to mutate/update the wishlist but ran into a js undefined error. What the expected result is:
Here's a video to reproduce the bug: Arc.2025-07-08.at.13.32.19.mp4 |
I followed these steps to repro, on my local but it seems to be working for me. Did you test on the standard product MRT env? It's possible that we need to deploy again. |
| childProductSelection[key].variant?.productId || | ||
| childProductSelection[key].product?.id |
There was a problem hiding this comment.
Non-blocking: I see a lot of places where we check for variant or standard products... it requires us to do this check in all places that need it.
In the future, it'd be great to normalize the product data in 1 place initially. For example, according to AI:
// At the boundary - normalize immediately
const normalizeProductSelection = (variant, product) => {
// Always return same shape, no matter what input look like
return {
id: variant?.productId || product?.id,
price: variant?.price || product?.price,
name: variant?.name || product?.name,
orderable: variant?.orderable || product?.inventory?.orderable,
stockLevel: variant?.stockLevel || product?.inventory?.stockLevel,
isStandardProduct: !variant,
isVariantProduct: !!variant,
originalVariant: variant,
originalProduct: product
}
}
// Now everywhere else in code - simple!
const addToCart = (normalizedProduct, quantity) => {
return {
productId: normalizedProduct.id, // No more conditionals!
price: normalizedProduct.price, // Simple!
quantity
}
}
// Validation becomes obvious
const validateOrderability = (normalizedProduct, quantity) => {
return normalizedProduct.orderable &&
quantity > 0 &&
quantity <= normalizedProduct.stockLevel
}
@sf-emmyzhang yes, I tested on the MRT environment listed in the PR description. |
625b68d to
2ed7ed8
Compare
Toast needs a string to show the message properly. If it just receives an Error Object, it will try to show that in DOM which causes a blank screen
vmarta
left a comment
There was a problem hiding this comment.
With the latest deployed env, I'm still seeing the issue with adding to wishlist as a guest user. Perhaps it's a race condition that I was able to run into consistently?
It's strange how the Welcome message does not have my name in it. Maybe it's related to the js undefined error somehow.
Arc.2025-07-09.at.11.18.57.mp4
But anyways, let's create a ticket (or however you'd like to track it).
Other than that, this PR looks good to me.
| - Update latest translations for all languages [#2616](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2616) | ||
| - Added support for Buy Online Pick up In Store (BOPIS) [#2646](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2646) | ||
| - Support standard product on PDP [#2518](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2518) | ||
| - Removed the "Edit" button from product cards of Standard Products [#2581](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2581) |
There was a problem hiding this comment.
Small knit, but maybe just put the last PR (this one) in the changelog, i dont think we ended up adding all the statements for the other features.
| - Verify einstein activity with standard product [#2650](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2650) | ||
| - Support standard product as a child item in sets [#2636](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2636) | ||
| - Load active data scripts on demand only [#2623](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2623) | ||
| - Refactor Add to Cart in PDP [#2664](https://github.com/SalesforceCommerceCloud/pwa-kit/pull/2664) |
There was a problem hiding this comment.
This PR did not make it in to develop, so this needs to be pulled
* Support standard product on PDP @W-12360908 (#2518) * update handleAddToCart and validate orderability * remove bundle changes, template test, and project config * add fallback if no image * linting * add validateOrderability tests * reorganize tests * fix lint errors * update validateOrderability logic * add product-detail tests * fix modal image link * add modal tests * changelog * pr suggestions * Handle SDK Client not initialized * Added tests for useResolvedClient * Handle missing SDK Client ShopperContext * ShopperCustomers - Handle SDK Client no init * ShopperExperience - Handle missing SDK Client * ShopperGiftCertificates - Handle missing SDK Client * ShopperLogin: Handle missing SDK client * ShopperOrders - Handle Missing SDK Client * ShopperProducts: Handle missing SDK Client * ShopperPromotions: Handle missing SDK client * ShopperSearch - Handle missing SDK Client * ShopperSEO: Handle missing SDK Client * ShopperStores: Handle missing SDK Client * Fix linting errors * Update useResolvedClient tests * Update changelog * Update changelog * Extract CLIENT_KEY literal to constnt * Remove additional hook for client validation * Fix linting * Add comments * rename apiClients variable to add clarity Co-authored-by: Kevin He <kevin.he@salesforce.com> Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> * update variable name for apiClients * Update sample query implementation in query.ts * Initial Commit Follow `plugin_einstein_api` implementation for event data creation. * Update CHANGELOG.md * Add some additional tests * PR Feedback * Fix bar reference to master.variantId * feat: cursor rules for unit tests * Update change log * Support standard product on PDP @W-12360908 (#2518) * update handleAddToCart and validate orderability * remove bundle changes, template test, and project config * add fallback if no image * linting * add validateOrderability tests * reorganize tests * fix lint errors * update validateOrderability logic * add product-detail tests * fix modal image link * add modal tests * changelog * pr suggestions * Resolve merge conflict * Update files with conflicts * omg so we're not adding these * merge develop into standard product feature branch (#2626) * Handle SDK Client not initialized * Added tests for useResolvedClient * Handle missing SDK Client ShopperContext * ShopperCustomers - Handle SDK Client no init * ShopperExperience - Handle missing SDK Client * ShopperGiftCertificates - Handle missing SDK Client * ShopperLogin: Handle missing SDK client * ShopperOrders - Handle Missing SDK Client * ShopperProducts: Handle missing SDK Client * ShopperPromotions: Handle missing SDK client * ShopperSearch - Handle missing SDK Client * ShopperSEO: Handle missing SDK Client * ShopperStores: Handle missing SDK Client * Fix linting errors * Update useResolvedClient tests * Update changelog * implemented the voiceover feature for the email confirmation modal on PWA kit. * Update changelog * Extract CLIENT_KEY literal to constnt * updated the chanege log file to point to current changes and saved changes to email confirmation modal code * linted the files and built translations * changed role and aria label tags to solve unsuccessful check issues * Implemented changes to create more successful checks after facing a testing Library ElementError: Found multiple elements with the text: /check your email/i * Linted my files * Remove additional hook for client validation * Fix linting * Add comments * rename apiClients variable to add clarity Co-authored-by: Kevin He <kevin.he@salesforce.com> Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> * update variable name for apiClients * linted more files to fix unsuccessful check error * linted more files to fix unsuccessful check error * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * taking off the visible focus outline around the modal border * Initial Commit Follow `plugin_einstein_api` implementation for event data creation. * Update CHANGELOG.md * Update CHANGELOG.md * Add some additional tests * PR Feedback * adding an a11y tag to changes made docuemented in the change log reading document * Fix bar reference to master.variantId * removed redundant aria label that repeating email confirmation title * mitigating the need for additional translations * feat: cursor rules for unit tests * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * Update change log * Fixing bad merge * Update sample query implementation in query.ts * [Fix E2E Tests] Improve E2E Test and Tracking Consent Banner Handling (@W-18764173@) (#2575) * Improve e2e tests and Tracking Consent banner handling * Clean up * More clean up * Remove spacing changes * PR Feedback * Remove comments * rules only * Update translations (#2616) * update translations * @W-18541294@ Private client proxy updates (#2608) * Ensure only requests to /shopper/auth/ are allowed by the SLAS private client proxy * Remove console.logs * Stop swallowing errors from SLAS * Update CHANGELOG.md * Fix login and logout * Remove console logs * Lint * Add and fix tests * Cleanup regex --------- Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> Signed-off-by: Ben Chypak <bchypak@mobify.com> Co-authored-by: Jainam Sheth <j.sheth@salesforce.com> Co-authored-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Co-authored-by: Larnelle Ankunda <lankunda@salesforce.com> Co-authored-by: Kevin He <kevin.he@salesforce.com> Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Co-authored-by: Ben Chypak <bchypak@salesforce.com> Co-authored-by: Ben Chypak <bchypak@mobify.com> Co-authored-by: Shailesh Zirpe <szirpe+sf@salesforce.com> Co-authored-by: Shailesh Zirpe <42553862+szirpesf@users.noreply.github.com> Co-authored-by: Adam Raya <adamraya@users.noreply.github.com> Co-authored-by: Alex Vuong <alex.vuong@salesforce.com> Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com> * @W-12360935 Modify the Product Card to support standard products (#2581) * remove 'edit'for std prd | Add unit tests * update changelog * lint fixes * show Edit button on bundleProducts * handle empty product bundles * better determination of if-standardProduct --------- Signed-off-by: sf-shikhar-prasoon <214730309+sf-shikhar-prasoon@users.noreply.github.com> * udpate changelog to resolve conflict * udpate changelog to resolve conflict 2 * udpate changelog to resolve conflict 3 * oops * Merge develop into standard-product-support (#2633) * Handle SDK Client not initialized * Added tests for useResolvedClient * Handle missing SDK Client ShopperContext * ShopperCustomers - Handle SDK Client no init * ShopperExperience - Handle missing SDK Client * ShopperGiftCertificates - Handle missing SDK Client * ShopperLogin: Handle missing SDK client * ShopperOrders - Handle Missing SDK Client * ShopperProducts: Handle missing SDK Client * ShopperPromotions: Handle missing SDK client * ShopperSearch - Handle missing SDK Client * ShopperSEO: Handle missing SDK Client * ShopperStores: Handle missing SDK Client * Fix linting errors * Update useResolvedClient tests * Update changelog * implemented the voiceover feature for the email confirmation modal on PWA kit. * Update changelog * Extract CLIENT_KEY literal to constnt * updated the chanege log file to point to current changes and saved changes to email confirmation modal code * linted the files and built translations * changed role and aria label tags to solve unsuccessful check issues * Implemented changes to create more successful checks after facing a testing Library ElementError: Found multiple elements with the text: /check your email/i * Linted my files * Remove additional hook for client validation * Fix linting * Add comments * rename apiClients variable to add clarity Co-authored-by: Kevin He <kevin.he@salesforce.com> Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> * update variable name for apiClients * linted more files to fix unsuccessful check error * linted more files to fix unsuccessful check error * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * taking off the visible focus outline around the modal border * Initial Commit Follow `plugin_einstein_api` implementation for event data creation. * Update CHANGELOG.md * Update CHANGELOG.md * Add some additional tests * PR Feedback * adding an a11y tag to changes made docuemented in the change log reading document * Fix bar reference to master.variantId * removed redundant aria label that repeating email confirmation title * mitigating the need for additional translations * feat: cursor rules for unit tests * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * Update packages/template-retail-react-app/CHANGELOG.md Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> * Update change log * Fixing bad merge * Update sample query implementation in query.ts * [Fix E2E Tests] Improve E2E Test and Tracking Consent Banner Handling (@W-18764173@) (#2575) * Improve e2e tests and Tracking Consent banner handling * Clean up * More clean up * Remove spacing changes * PR Feedback * Remove comments * rules only * Update translations (#2616) * update translations * @W-18541294@ Private client proxy updates (#2608) * Ensure only requests to /shopper/auth/ are allowed by the SLAS private client proxy * Remove console.logs * Stop swallowing errors from SLAS * Update CHANGELOG.md * Fix login and logout * Remove console logs * Lint * Add and fix tests * Cleanup regex * skip changelog --------- Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> Signed-off-by: Ben Chypak <bchypak@mobify.com> Co-authored-by: Jainam Sheth <j.sheth@salesforce.com> Co-authored-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Co-authored-by: Larnelle Ankunda <lankunda@salesforce.com> Co-authored-by: Kevin He <kevin.he@salesforce.com> Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Co-authored-by: Ben Chypak <bchypak@salesforce.com> Co-authored-by: Ben Chypak <bchypak@mobify.com> Co-authored-by: Shailesh Zirpe <szirpe+sf@salesforce.com> Co-authored-by: Shailesh Zirpe <42553862+szirpesf@users.noreply.github.com> Co-authored-by: Adam Raya <adamraya@users.noreply.github.com> Co-authored-by: Alex Vuong <alex.vuong@salesforce.com> Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com> * Support standard product as a child item in bundles @W-18790730 (#2574) * init commit * skip variation check for standard product * update modal logic * add product view test * add to cart modal test * add product detail test * update add to cart modal test * add product util test * update changelog * fix edit bundle * lint * Handle standard product shape in sendAddToCart * Update CHANGELOG.md * Support standard product as a child item in sets @W-18790730 (#2636) * fix adding set to cart * updae changelog * udpate util test * Add test * Lint tests * @W-18767088 refactor add to cart * @W-18767088 refactor add to cart * @W-18767088 fix lint errors * @W-18767088 do not move handleChildProductValidation * @W-12360935 2nd PR- fixing Edit button appearing briefly for standard products (#2649) * fix Edit button appearing briefly * fix tests * @W-18767088 utils rename * Revert CHANGELOG.md Signed-off-by: sf-emmyzhang <emmyzhang@salesforce.com> * increase bundle size for ci error * update use add to cart modal unit test * revert auto merge change * add image placeholder todo * rename bundleChildVariant * revert refactor work * add bundle test * lint * update test * lint * Handle out of stock for standard product * tests and linting * handle lack of type --------- Signed-off-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Signed-off-by: Larnelle Ankunda <lankunda@salesforce.com> Signed-off-by: Ben Chypak <bchypak@mobify.com> Signed-off-by: sf-shikhar-prasoon <214730309+sf-shikhar-prasoon@users.noreply.github.com> Signed-off-by: Kyle Wright <30636085+sf-kyle-wright@users.noreply.github.com> Signed-off-by: sf-emmyzhang <emmyzhang@salesforce.com> Co-authored-by: Jainam Sheth <j.sheth@salesforce.com> Co-authored-by: Jainam Sheth <99490559+shethj@users.noreply.github.com> Co-authored-by: Kevin He <kevin.he@salesforce.com> Co-authored-by: Ben Chypak <bchypak@salesforce.com> Co-authored-by: Shailesh Zirpe <szirpe+sf@salesforce.com> Co-authored-by: Larnelle Ankunda <lankunda@salesforce.com> Co-authored-by: Yuna Kim <84923642+yunakim714@users.noreply.github.com> Co-authored-by: Ben Chypak <bchypak@mobify.com> Co-authored-by: Shailesh Zirpe <42553862+szirpesf@users.noreply.github.com> Co-authored-by: Adam Raya <adamraya@users.noreply.github.com> Co-authored-by: Alex Vuong <alex.vuong@salesforce.com> Co-authored-by: vcua-mobify <47404250+vcua-mobify@users.noreply.github.com> Co-authored-by: sf-shikhar-prasoon <214730309+sf-shikhar-prasoon@users.noreply.github.com> Co-authored-by: Jang ho Jung <jangho.jung@salesforce.com> Co-authored-by: Kyle Wright <kyle.wright@salesforce.com> Co-authored-by: jeremy-jung1 <140001271+jeremy-jung1@users.noreply.github.com> Co-authored-by: Kyle Wright <30636085+sf-kyle-wright@users.noreply.github.com>
Description
This PR is merging all the standard product feature work into develop. See "How to Test-Drive This PR" below for all the relevant PRs
Types of Changes
Changes
How to Test-Drive This PR
MRT Env: https://cc-sharks-standard-product.mobify-storefront-staging.com
PRs included in this feature branch:
Test steps:
Happy path
Out of stock handling
Note: Adding an out of stock product in the wishlist, not limited to standard product, in the
developcode currently gives a "Something went wrong" error message. This behavior existed before and is not blocking for this PR.Checklists
General
Accessibility Compliance
You must check off all items in one of the follow two lists:
or...
Localization