@nuskin/ns-shop 7.1.9 → 7.2.0

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.1.9",
3
+ "version": "7.2.0",
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": {
@@ -30,6 +30,7 @@
30
30
  "@nuskin/nuskinjquery": "2.3.1",
31
31
  "@nuskin/order-model": "3.1.3",
32
32
  "@nuskin/product-lib": "2.2.1",
33
+ "@nuskin/ns-util": "4.7.0",
33
34
  "axios": "1.6.5",
34
35
  "decimal.js": "10.4.3",
35
36
  "jp-conversion": "0.0.7",
@@ -6,9 +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 = [];
11
-
12
+ const utmInfo = storage.getItem(storage.metadata.UTM_INFO);
12
13
  const addToCustomList = (customList, type, key, value) => {
13
14
  if (value) {
14
15
  let found = false;
@@ -479,6 +480,14 @@ const populateCategory = (salesOrder) => {
479
480
  } else if (util.getSponsorId()) {
480
481
  // affiliates don't use a subdomain. So if we have a sponsor and it isn't a pitch then we consider it a storefront
481
482
  salesOrder.Category = "STOREFRONT";
483
+ } else if(utmInfo?.utm_medium){
484
+ if (utmInfo?.utm_medium.includes('paidsearch')) {
485
+ salesOrder.Category = 'PAIDSEARCH';
486
+ } else if (utmInfo?.utm_medium.includes('paidsocial')) {
487
+ salesOrder.Category = 'PAIDAD';
488
+ } else {
489
+ salesOrder.Category = 'WEB';
490
+ }
482
491
  } else {
483
492
  salesOrder.Category = 'WEB';
484
493
  }
@@ -1014,6 +1023,12 @@ const populateSalesOrder = (action, adr) => {
1014
1023
  if (user && user.isGuest) {
1015
1024
  addToCustomList(salesOrder.Custom, "FLAG", "GUEST", "TRUE");
1016
1025
  }
1026
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_SOURCE", utmInfo?.utm_source);
1027
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_MEDIUM", utmInfo?.utm_medium);
1028
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN", utmInfo?.utm_campaign);
1029
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CAMPAIGN_ID", utmInfo?.utm_id);
1030
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_CONTENT", utmInfo?.utm_content);
1031
+ addToCustomList(salesOrder.Custom, "FLAG", "UTM_TERM", utmInfo?.utm_term);
1017
1032
  const microsite = getCachedConfigField('microsite');
1018
1033
  if (microsite) {
1019
1034
  salesOrder.Reason = "CUSTOM";