@artisan-commerce/analytics-web 0.2.0-canary.155 → 0.2.0-canary.157

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.
@@ -50,7 +50,7 @@
50
50
  let State$1 = _State;
51
51
  State$1._instance = null;
52
52
 
53
- var version = "0.2.0-canary.154";
53
+ var version = "0.2.0-canary.157";
54
54
  var packageJSON = {
55
55
  version: version};
56
56
 
@@ -911,6 +911,22 @@ ${key}: ${value}`;
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
+ if (categoryName == null ? void 0 : categoryName.includes("REWARDS"))
920
+ return "rewards_menu";
921
+ return "product_menu";
922
+ };
923
+ const getProductAddedFrom = (addedFrom) => {
924
+ if (addedFrom === "up_sell_modal")
925
+ return "upsell_recommendation";
926
+ if (addedFrom == null ? void 0 : addedFrom.includes("add_prod"))
927
+ return "menu";
928
+ return addedFrom != null ? addedFrom : "";
929
+ };
914
930
  const toItemProduct = (product, cart, item_category2) => {
915
931
  var _a, _b, _c;
916
932
  const { categories, addedFrom, additionalInfo } = product;
@@ -919,7 +935,7 @@ ${key}: ${value}`;
919
935
  const { netPrice } = products.getProductTotals(product);
920
936
  const productModifiers = getModifiersNames(product);
921
937
  const benefits = (_a = cart == null ? void 0 : cart.benefits) != null ? _a : [];
922
- const source = addedFrom === "up_sell_modal" ? "upsell_recommendation" : addedFrom;
938
+ const source = getProductAddedFrom(addedFrom);
923
939
  const benefit = benefits == null ? void 0 : benefits.find((benefit2) => {
924
940
  var _a2, _b2, _c2, _d;
925
941
  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 +951,7 @@ ${key}: ${value}`;
935
951
  quantity: product.amount,
936
952
  item_revenue_in_usd: netPrice,
937
953
  item_revenue: netPrice,
938
- item_list_name: (categoryName == null ? void 0 : categoryName.includes("COUPON")) ? "coupon_menu" : "product_menu"
954
+ item_list_name: getProductListName(categoryName)
939
955
  };
940
956
  if (categoryId)
941
957
  item.item_list_id = categoryId;
@@ -3704,17 +3720,9 @@ ${key}: ${value}`;
3704
3720
  const totals = shoppingCartCore.getShoppingCartTotal(shoppingCart);
3705
3721
  const { total, totalPoints, shippingCost, totalTaxes } = totals;
3706
3722
  const items = toItems("initiateCheckout", params);
3707
- const products = shoppingCartCore.getShoppingCartProducts(shoppingCart);
3708
- const totalItems = products.reduce((acc, product) => acc + product.amount, 0);
3709
3723
  const extraParams = {
3710
- total_item_quantity: totalItems,
3711
- purchase_revenue_in_usd: total,
3712
- purchase_revenue: total,
3713
- shipping_value_in_usd: shippingCost,
3714
- shipping_value: shippingCost,
3715
- tax_value_in_usd: totalTaxes,
3716
- tax_value: totalTaxes,
3717
- unique_items: items == null ? void 0 : items.length
3724
+ shipping: shippingCost,
3725
+ tax: totalTaxes
3718
3726
  };
3719
3727
  gtag("event", "begin_checkout", __spreadProps$24(__spreadValues$3f(__spreadValues$3f(__spreadValues$3f({
3720
3728
  send_to: trackingId,