@nuskin/ns-shop 7.2.2 → 7.2.3-mdigi-2491.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-shop",
3
- "version": "7.2.2",
3
+ "version": "7.2.3-mdigi-2491.2",
4
4
  "description": "The description that will amaze and astound your audience when they read it",
5
5
  "main": "src/shop.js",
6
6
  "scripts": {
package/src/cart/cart.js CHANGED
@@ -1329,8 +1329,16 @@ export default function Cart(cartData) {
1329
1329
  const customPayloadMetadata = storage.metadata.CUSTOM_EVENT_PAYLOAD;
1330
1330
  let customPayload = storage.getItem(customPayloadMetadata);
1331
1331
  if (customPayload) {
1332
- if (customPayload.constructor === {}.constructor) {
1333
- Object.assign(json, customPayload);
1332
+ if (customPayload.catalogAddToCart) {
1333
+ delete customPayload.catalogAddToCart;
1334
+ const product = json.ecommerce.add && json.ecommerce.add.products && json.ecommerce.add.products[0];
1335
+ if (product) {
1336
+ Object.assign(product, customPayload);
1337
+ }
1338
+ } else {
1339
+ if (customPayload.constructor === {}.constructor) {
1340
+ Object.assign(json, customPayload);
1341
+ }
1334
1342
  }
1335
1343
  storage.removeItem(customPayloadMetadata);
1336
1344
  }
@@ -497,14 +497,14 @@ const populateCategory = (salesOrder) => {
497
497
  } else if (util.getSponsorId()) {
498
498
  // affiliates don't use a subdomain. So if we have a sponsor and it isn't a pitch then we consider it a storefront
499
499
  salesOrder.Category = "STOREFRONT";
500
- } else if(utmInfo?.utm_medium){
500
+ } else if (utmInfo?.utm_medium) {
501
501
  if (utmInfo?.utm_medium.includes('paidsearch')) {
502
502
  salesOrder.Category = 'PAIDSEARCH';
503
503
  } else if (utmInfo?.utm_medium.includes('paidsocial')) {
504
504
  salesOrder.Category = 'PAIDAD';
505
505
  } else {
506
506
  salesOrder.Category = 'WEB';
507
- }
507
+ }
508
508
  } else {
509
509
  salesOrder.Category = 'WEB';
510
510
  }