@nuskin/ns-shop 7.5.5 → 7.6.0-mdigi-280.1

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.5.5",
3
+ "version": "7.6.0-mdigi-280.1",
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": {
@@ -6,8 +6,10 @@ import {getCachedConfigField} from '@nuskin/configuration-sdk';
6
6
  import {UserService} from "@nuskin/ns-account";
7
7
  import PaymentAdapter from '../payment/PaymentAdapter';
8
8
  import pickupUtil from '../shipping/pickupUtil';
9
+ import { storage } from "@nuskin/ns-util";
9
10
 
10
11
  let splitLineItems = [];
12
+ const utmInfo = storage.getItem(storage.metadata.UTM_INFO) || {};
11
13
  const addToCustomList = (customList, type, key, value) => {
12
14
  if (value) {
13
15
  let found = false;
@@ -495,6 +497,10 @@ const populateCategory = (salesOrder) => {
495
497
  } else if (util.getSponsorId()) {
496
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
497
499
  salesOrder.Category = "STOREFRONT";
500
+ } else if (utmInfo.utm_medium && utmInfo.utm_medium.includes('paidsearch')) {
501
+ salesOrder.Category = 'PAIDSEARCH';
502
+ } else if (utmInfo.utm_medium && utmInfo.utm_medium.includes('paidsocial')) {
503
+ salesOrder.Category = 'PAIDAD';
498
504
  } else {
499
505
  salesOrder.Category = 'WEB';
500
506
  }
@@ -1033,6 +1039,12 @@ const populateSalesOrder = (action, adr) => {
1033
1039
  if (user && user.isGuest) {
1034
1040
  addToCustomList(salesOrder.Custom, "FLAG", "GUEST", "TRUE");
1035
1041
  }
1042
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_SOURCE", utmInfo.utm_source);
1043
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_MEDIUM", utmInfo.utm_medium);
1044
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN", utmInfo.utm_campaign);
1045
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN_ID", utmInfo.utm_id);
1046
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CONTENT", utmInfo.utm_content);
1047
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_TERM", utmInfo.utm_term);
1036
1048
  const microsite = getCachedConfigField('microsite');
1037
1049
  if (microsite) {
1038
1050
  salesOrder.Reason = "CUSTOM";