@artisan-commerce/analytics-web 0.2.0-canary.154 → 0.2.0-canary.156
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/dist/bundle.cjs +17 -3
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.d.ts +0 -2
- package/dist/bundle.mjs +17 -3
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.umd.js +17 -3
- package/dist/bundle.umd.js.map +1 -1
- package/package.json +6 -6
package/dist/bundle.cjs
CHANGED
|
@@ -50,7 +50,7 @@ const _State = class {
|
|
|
50
50
|
let State$1 = _State;
|
|
51
51
|
State$1._instance = null;
|
|
52
52
|
|
|
53
|
-
var version = "0.2.0-canary.
|
|
53
|
+
var version = "0.2.0-canary.156";
|
|
54
54
|
var packageJSON = {
|
|
55
55
|
version: version};
|
|
56
56
|
|
|
@@ -911,6 +911,20 @@ const getModifiersNames = (product) => {
|
|
|
911
911
|
const variants = modifiers == null ? void 0 : modifiers.flatMap((question) => question.answers.filter((answer) => answer.amount > 0).map((answer) => answer.name));
|
|
912
912
|
return variants;
|
|
913
913
|
};
|
|
914
|
+
const getProductListName = (categoryName) => {
|
|
915
|
+
if (categoryName == null ? void 0 : categoryName.includes("COUPON"))
|
|
916
|
+
return "coupon_menu";
|
|
917
|
+
if (categoryName == null ? void 0 : categoryName.includes("HOME"))
|
|
918
|
+
return "home_product";
|
|
919
|
+
return "product_menu";
|
|
920
|
+
};
|
|
921
|
+
const getProductAddedFrom = (addedFrom) => {
|
|
922
|
+
if (addedFrom === "up_sell_modal")
|
|
923
|
+
return "upsell_recommendation";
|
|
924
|
+
if (addedFrom == null ? void 0 : addedFrom.includes("add_prod"))
|
|
925
|
+
return "menu";
|
|
926
|
+
return addedFrom != null ? addedFrom : "";
|
|
927
|
+
};
|
|
914
928
|
const toItemProduct = (product, cart, item_category2) => {
|
|
915
929
|
var _a, _b, _c;
|
|
916
930
|
const { categories, addedFrom, additionalInfo } = product;
|
|
@@ -919,7 +933,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
919
933
|
const { netPrice } = products.getProductTotals(product);
|
|
920
934
|
const productModifiers = getModifiersNames(product);
|
|
921
935
|
const benefits = (_a = cart == null ? void 0 : cart.benefits) != null ? _a : [];
|
|
922
|
-
const source = addedFrom
|
|
936
|
+
const source = getProductAddedFrom(addedFrom);
|
|
923
937
|
const benefit = benefits == null ? void 0 : benefits.find((benefit2) => {
|
|
924
938
|
var _a2, _b2, _c2, _d;
|
|
925
939
|
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);
|
|
@@ -935,7 +949,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
935
949
|
quantity: product.amount,
|
|
936
950
|
item_revenue_in_usd: netPrice,
|
|
937
951
|
item_revenue: netPrice,
|
|
938
|
-
item_list_name: (categoryName
|
|
952
|
+
item_list_name: getProductListName(categoryName)
|
|
939
953
|
};
|
|
940
954
|
if (categoryId)
|
|
941
955
|
item.item_list_id = categoryId;
|