@nuskin/ns-shop 7.2.3-mdigi-2491.1 → 7.2.3-mdigi-2491.3

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.3-mdigi-2491.1",
3
+ "version": "7.2.3-mdigi-2491.3",
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
  }
@@ -396,11 +396,7 @@ async function addProductToCart(options) {
396
396
  qtyRedeemWithPoints: options.qtyRedeemWithPoints,
397
397
  loyaltyPointsUsed: options.loyaltyPointsUsed,
398
398
  replace: options.replace,
399
- activeEvents: activeEvents,
400
- brand: options.brand,
401
- category: options.category,
402
- itemType: options.item_type,
403
- variant: options.variant
399
+ activeEvents: activeEvents
404
400
  });
405
401
 
406
402
  const item = itemKey ? cart.getItemByKey(itemKey) : null;
@@ -470,11 +466,7 @@ async function addSkuToCart(options) {
470
466
  isBusinessPortfolio: options.isBusinessPortfolio,
471
467
  redeem: options.redeem,
472
468
  isPitchCart: isPitchCart,
473
- referrer: options.referrer,
474
- brand: options.brand,
475
- category: options.category,
476
- itemType: options.item_type,
477
- variant: options.variant
469
+ referrer: options.referrer
478
470
  });
479
471
 
480
472
  retVal = {
@@ -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){
501
- if (utmInfo?.utm_medium.includes('paidsearch')) {
500
+ } else if (utmInfo && utmInfo.utm_medium) {
501
+ if (utmInfo.utm_medium.includes('paidsearch')) {
502
502
  salesOrder.Category = 'PAIDSEARCH';
503
- } else if (utmInfo?.utm_medium.includes('paidsocial')) {
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
  }
@@ -1040,12 +1040,14 @@ const populateSalesOrder = (action, adr) => {
1040
1040
  if (user && user.isGuest) {
1041
1041
  addToCustomList(salesOrder.Custom, "FLAG", "GUEST", "TRUE");
1042
1042
  }
1043
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_SOURCE", utmInfo?.utm_source);
1044
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_MEDIUM", utmInfo?.utm_medium);
1045
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN", utmInfo?.utm_campaign);
1046
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN_ID", utmInfo?.utm_id);
1047
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_CONTENT", utmInfo?.utm_content);
1048
- addToCustomList(salesOrder.Custom, "FLAG", "UTM_TERM", utmInfo?.utm_term);
1043
+ if (utmInfo) {
1044
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_SOURCE", utmInfo.utm_source);
1045
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_MEDIUM", utmInfo.utm_medium);
1046
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN", utmInfo.utm_campaign);
1047
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN_ID", utmInfo.utm_id);
1048
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CONTENT", utmInfo.utm_content);
1049
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_TERM", utmInfo.utm_term);
1050
+ }
1049
1051
  const microsite = getCachedConfigField('microsite');
1050
1052
  if (microsite) {
1051
1053
  salesOrder.Reason = "CUSTOM";