@artisan-commerce/analytics-rn 0.3.0-canary.162 → 0.3.0-canary.164

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.
Files changed (2) hide show
  1. package/dist/bundle.mjs +17 -3
  2. package/package.json +6 -6
package/dist/bundle.mjs CHANGED
@@ -51,7 +51,7 @@ const _State = class {
51
51
  let State$1 = _State;
52
52
  State$1._instance = null;
53
53
 
54
- var version = "0.3.0-canary.162";
54
+ var version = "0.3.0-canary.164";
55
55
  var packageJSON = {
56
56
  version: version};
57
57
 
@@ -791,6 +791,20 @@ const getModifiersNames = (product) => {
791
791
  const variants = modifiers == null ? void 0 : modifiers.flatMap((question) => question.answers.filter((answer) => answer.amount > 0).map((answer) => answer.name));
792
792
  return variants;
793
793
  };
794
+ const getProductListName = (categoryName) => {
795
+ if (categoryName == null ? void 0 : categoryName.includes("COUPON"))
796
+ return "coupon_menu";
797
+ if (categoryName == null ? void 0 : categoryName.includes("HOME"))
798
+ return "home_product";
799
+ return "product_menu";
800
+ };
801
+ const getProductAddedFrom = (addedFrom) => {
802
+ if (addedFrom === "up_sell_modal")
803
+ return "upsell_recommendation";
804
+ if (addedFrom == null ? void 0 : addedFrom.includes("add_prod"))
805
+ return "menu";
806
+ return addedFrom != null ? addedFrom : "";
807
+ };
794
808
  const toItemProduct = (product, cart, item_category2) => {
795
809
  var _a, _b, _c;
796
810
  const { categories, addedFrom, additionalInfo } = product;
@@ -799,7 +813,7 @@ const toItemProduct = (product, cart, item_category2) => {
799
813
  const { netPrice } = getProductTotals(product);
800
814
  const productModifiers = getModifiersNames(product);
801
815
  const benefits = (_a = cart == null ? void 0 : cart.benefits) != null ? _a : [];
802
- const source = addedFrom === "up_sell_modal" ? "upsell_recommendation" : addedFrom;
816
+ const source = getProductAddedFrom(addedFrom);
803
817
  const benefit = benefits == null ? void 0 : benefits.find((benefit2) => {
804
818
  var _a2, _b2, _c2, _d;
805
819
  return ((_b2 = (_a2 = benefit2 == null ? void 0 : benefit2.reward) == null ? void 0 : _a2.attributes) == null ? void 0 : _b2.new_product_id) || ((_d = (_c2 = benefit2 == null ? void 0 : benefit2.reward) == null ? void 0 : _c2.attributes) == null ? void 0 : _d.item_id) === (additionalInfo == null ? void 0 : additionalInfo.externalId);
@@ -815,7 +829,7 @@ const toItemProduct = (product, cart, item_category2) => {
815
829
  quantity: product.amount,
816
830
  item_revenue_in_usd: netPrice,
817
831
  item_revenue: netPrice,
818
- item_list_name: (categoryName == null ? void 0 : categoryName.includes("COUPON")) ? "coupon_menu" : "product_menu",
832
+ item_list_name: getProductListName(categoryName),
819
833
  item_category3: (categoryName == null ? void 0 : categoryName.includes("PRODUCT PROMOTION")) ? "push_in_app" : ""
820
834
  };
821
835
  if (categoryId)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@artisan-commerce/analytics-rn",
3
3
  "description": "Artisn commerce analytics react native library",
4
- "version": "0.3.0-canary.162",
4
+ "version": "0.3.0-canary.164",
5
5
  "type": "module",
6
6
  "main": "./dist/bundle.mjs",
7
7
  "module": "./dist/bundle.mjs",
@@ -36,10 +36,10 @@
36
36
  "snake-case": "^3.0.4"
37
37
  },
38
38
  "devDependencies": {
39
- "@artisan-commerce/products": "0.9.0-canary.108",
40
- "@artisan-commerce/shopping-cart-core": "0.12.0-canary.146",
41
- "@artisan-commerce/state": "0.3.0-canary.57",
42
- "@artisan-commerce/types": "0.14.0-canary.85",
39
+ "@artisan-commerce/products": "0.9.0-canary.110",
40
+ "@artisan-commerce/shopping-cart-core": "0.12.0-canary.148",
41
+ "@artisan-commerce/state": "0.3.0-canary.59",
42
+ "@artisan-commerce/types": "0.14.0-canary.87",
43
43
  "@babel/core": "^7.13.15",
44
44
  "@babel/preset-env": "^7.10.4",
45
45
  "@babel/preset-react": "^7.10.4",
@@ -84,5 +84,5 @@
84
84
  }
85
85
  }
86
86
  },
87
- "gitHead": "3302349ec6be09ba7ec7d82c61bef1e0d35dec3d"
87
+ "gitHead": "252305499d465ee4d374f22b1a8576cc54d2e157"
88
88
  }