@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.
- package/dist/bundle.cjs +21 -13
- package/dist/bundle.cjs.map +1 -1
- package/dist/bundle.d.ts +5 -5
- package/dist/bundle.mjs +21 -13
- package/dist/bundle.mjs.map +1 -1
- package/dist/bundle.umd.js +21 -13
- package/dist/bundle.umd.js.map +1 -1
- package/package.json +6 -6
package/dist/bundle.d.ts
CHANGED
|
@@ -2142,7 +2142,7 @@ interface PurchaseSuccessCommonParams {
|
|
|
2142
2142
|
/** The order shopping cart */
|
|
2143
2143
|
shoppingCart?: ShoppingCart;
|
|
2144
2144
|
/** The selected payment type (e.g. Cash, Card) */
|
|
2145
|
-
|
|
2145
|
+
selectedPaymentType: PaymentType;
|
|
2146
2146
|
/** The workflow name (e.g. Delivery) */
|
|
2147
2147
|
fulfillmentType: Workflow;
|
|
2148
2148
|
/** If paying with card the card provider (e.g. visa) */
|
|
@@ -2858,12 +2858,12 @@ interface SetPaymentInfoParams$1 extends SegmentCommonEventParams, SegmentCustom
|
|
|
2858
2858
|
* @interface SetPaymentInfoCommonParams
|
|
2859
2859
|
* @since 0.1.0
|
|
2860
2860
|
* @property {number} orderTotal The total cost of the order
|
|
2861
|
-
* @property {PaymentType}
|
|
2861
|
+
* @property {PaymentType} selectedPaymentType The new set payment type (e.g. Cash)
|
|
2862
2862
|
* @property {string} cardType If paying with card, the card provider (e.g. visa)
|
|
2863
2863
|
*/
|
|
2864
2864
|
interface SetPaymentInfoCommonParams {
|
|
2865
2865
|
orderTotal: number;
|
|
2866
|
-
|
|
2866
|
+
selectedPaymentType: PaymentType;
|
|
2867
2867
|
cardType?: string;
|
|
2868
2868
|
}
|
|
2869
2869
|
/**
|
|
@@ -3691,7 +3691,7 @@ interface SelectPromotionParams extends GoogleAnalyticsCommonEventParams, Google
|
|
|
3691
3691
|
promotionName?: string;
|
|
3692
3692
|
creativeName?: string;
|
|
3693
3693
|
creativeSlot?: string;
|
|
3694
|
-
originalItem?:
|
|
3694
|
+
originalItem?: string;
|
|
3695
3695
|
}
|
|
3696
3696
|
|
|
3697
3697
|
/**
|
|
@@ -3707,7 +3707,7 @@ interface ViewPromotionParams extends GoogleAnalyticsCommonEventParams, GoogleAn
|
|
|
3707
3707
|
promotionName?: string;
|
|
3708
3708
|
creativeName?: string;
|
|
3709
3709
|
creativeSlot?: string;
|
|
3710
|
-
originalItem?:
|
|
3710
|
+
originalItem?: string;
|
|
3711
3711
|
}
|
|
3712
3712
|
|
|
3713
3713
|
/**
|
package/dist/bundle.mjs
CHANGED
|
@@ -48,7 +48,7 @@ const _State = class {
|
|
|
48
48
|
let State$1 = _State;
|
|
49
49
|
State$1._instance = null;
|
|
50
50
|
|
|
51
|
-
var version = "0.2.0-canary.
|
|
51
|
+
var version = "0.2.0-canary.157";
|
|
52
52
|
var packageJSON = {
|
|
53
53
|
version: version};
|
|
54
54
|
|
|
@@ -909,6 +909,22 @@ const getModifiersNames = (product) => {
|
|
|
909
909
|
const variants = modifiers == null ? void 0 : modifiers.flatMap((question) => question.answers.filter((answer) => answer.amount > 0).map((answer) => answer.name));
|
|
910
910
|
return variants;
|
|
911
911
|
};
|
|
912
|
+
const getProductListName = (categoryName) => {
|
|
913
|
+
if (categoryName == null ? void 0 : categoryName.includes("COUPON"))
|
|
914
|
+
return "coupon_menu";
|
|
915
|
+
if (categoryName == null ? void 0 : categoryName.includes("HOME"))
|
|
916
|
+
return "home_product";
|
|
917
|
+
if (categoryName == null ? void 0 : categoryName.includes("REWARDS"))
|
|
918
|
+
return "rewards_menu";
|
|
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
|
+
};
|
|
912
928
|
const toItemProduct = (product, cart, item_category2) => {
|
|
913
929
|
var _a, _b, _c;
|
|
914
930
|
const { categories, addedFrom, additionalInfo } = product;
|
|
@@ -917,7 +933,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
917
933
|
const { netPrice } = getProductTotals(product);
|
|
918
934
|
const productModifiers = getModifiersNames(product);
|
|
919
935
|
const benefits = (_a = cart == null ? void 0 : cart.benefits) != null ? _a : [];
|
|
920
|
-
const source = addedFrom
|
|
936
|
+
const source = getProductAddedFrom(addedFrom);
|
|
921
937
|
const benefit = benefits == null ? void 0 : benefits.find((benefit2) => {
|
|
922
938
|
var _a2, _b2, _c2, _d;
|
|
923
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);
|
|
@@ -933,7 +949,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
933
949
|
quantity: product.amount,
|
|
934
950
|
item_revenue_in_usd: netPrice,
|
|
935
951
|
item_revenue: netPrice,
|
|
936
|
-
item_list_name: (categoryName
|
|
952
|
+
item_list_name: getProductListName(categoryName)
|
|
937
953
|
};
|
|
938
954
|
if (categoryId)
|
|
939
955
|
item.item_list_id = categoryId;
|
|
@@ -3702,17 +3718,9 @@ const initiateCheckout$2 = (provider, params) => {
|
|
|
3702
3718
|
const totals = getShoppingCartTotal(shoppingCart);
|
|
3703
3719
|
const { total, totalPoints, shippingCost, totalTaxes } = totals;
|
|
3704
3720
|
const items = toItems("initiateCheckout", params);
|
|
3705
|
-
const products = getShoppingCartProducts(shoppingCart);
|
|
3706
|
-
const totalItems = products.reduce((acc, product) => acc + product.amount, 0);
|
|
3707
3721
|
const extraParams = {
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
purchase_revenue: total,
|
|
3711
|
-
shipping_value_in_usd: shippingCost,
|
|
3712
|
-
shipping_value: shippingCost,
|
|
3713
|
-
tax_value_in_usd: totalTaxes,
|
|
3714
|
-
tax_value: totalTaxes,
|
|
3715
|
-
unique_items: items == null ? void 0 : items.length
|
|
3722
|
+
shipping: shippingCost,
|
|
3723
|
+
tax: totalTaxes
|
|
3716
3724
|
};
|
|
3717
3725
|
gtag("event", "begin_checkout", __spreadProps$24(__spreadValues$3f(__spreadValues$3f(__spreadValues$3f({
|
|
3718
3726
|
send_to: trackingId,
|