@artisan-commerce/analytics-rn 0.3.0-canary.167 → 0.3.0-canary.168
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.d.ts +1 -1
- package/dist/bundle.mjs +21 -15
- package/package.json +6 -6
package/dist/bundle.d.ts
CHANGED
|
@@ -5728,7 +5728,7 @@ declare const events: {
|
|
|
5728
5728
|
*/
|
|
5729
5729
|
declare const updateActiveVendor: (vendor: Vendor | Vendor["id"] | -1 | undefined) => void;
|
|
5730
5730
|
|
|
5731
|
-
declare const toItemProduct: (product: CartProduct, cart?: ShoppingCart, item_category2?: string) => Gtag.Item[];
|
|
5731
|
+
declare const toItemProduct: (product: CartProduct, cart?: ShoppingCart, item_category2?: string, list?: string) => Gtag.Item[];
|
|
5732
5732
|
|
|
5733
5733
|
export { Gtag, Providers, events, initAnalytics, toItemProduct, updateActiveVendor };
|
|
5734
5734
|
export type { AnalyticsMeta, AuthProviderMethods, FacebookConversionsApiConfig, FacebookPixelCommonEventParams, FacebookPixelCustomEventParams, FacebookPixelProvider, FacebookPixelProviderConfig, GoogleAnalyticsCommonEventParams, GoogleAnalyticsCustomEventParams, GoogleAnalyticsProvider, GoogleAnalyticsProviderConfig, InitAnalyticsConfig, InitAnalyticsConfigMeta, SupportedProviders, UserProperties };
|
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.
|
|
54
|
+
var version = "0.3.0-canary.168";
|
|
55
55
|
var packageJSON = {
|
|
56
56
|
version: version};
|
|
57
57
|
|
|
@@ -791,13 +791,15 @@ 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) => {
|
|
794
|
+
const getProductListName = (categoryName, fromSearch) => {
|
|
795
795
|
if (categoryName == null ? void 0 : categoryName.includes("COUPON"))
|
|
796
796
|
return "coupon_menu";
|
|
797
797
|
if (categoryName == null ? void 0 : categoryName.includes("HOME"))
|
|
798
798
|
return "home_product";
|
|
799
799
|
if (categoryName == null ? void 0 : categoryName.includes("REWARDS"))
|
|
800
800
|
return "rewards_menu";
|
|
801
|
+
if (fromSearch)
|
|
802
|
+
return "product_search";
|
|
801
803
|
return "product_menu";
|
|
802
804
|
};
|
|
803
805
|
const getProductAddedFrom = (addedFrom) => {
|
|
@@ -807,9 +809,10 @@ const getProductAddedFrom = (addedFrom) => {
|
|
|
807
809
|
return "menu";
|
|
808
810
|
return addedFrom != null ? addedFrom : "";
|
|
809
811
|
};
|
|
810
|
-
const toItemProduct = (product, cart, item_category2) => {
|
|
812
|
+
const toItemProduct = (product, cart, item_category2, list) => {
|
|
811
813
|
var _a, _b, _c;
|
|
812
814
|
const { categories, addedFrom, additionalInfo } = product;
|
|
815
|
+
const { externalId, originalProduct, fromSearch } = additionalInfo != null ? additionalInfo : {};
|
|
813
816
|
const [category] = categories != null ? categories : [];
|
|
814
817
|
const { categoryId, name: categoryName } = category != null ? category : {};
|
|
815
818
|
const { netPrice } = getProductTotals(product);
|
|
@@ -818,7 +821,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
818
821
|
const source = getProductAddedFrom(addedFrom);
|
|
819
822
|
const benefit = benefits == null ? void 0 : benefits.find((benefit2) => {
|
|
820
823
|
var _a2, _b2, _c2, _d;
|
|
821
|
-
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) ===
|
|
824
|
+
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) === externalId;
|
|
822
825
|
});
|
|
823
826
|
const couponCode = (_c = (_b = benefit == null ? void 0 : benefit.reward) == null ? void 0 : _b.metadata) == null ? void 0 : _c.coupon_code;
|
|
824
827
|
const item = {
|
|
@@ -831,7 +834,7 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
831
834
|
quantity: product.amount,
|
|
832
835
|
item_revenue_in_usd: netPrice,
|
|
833
836
|
item_revenue: netPrice,
|
|
834
|
-
item_list_name: getProductListName(categoryName),
|
|
837
|
+
item_list_name: list != null ? list : getProductListName(categoryName, fromSearch),
|
|
835
838
|
item_category3: (categoryName == null ? void 0 : categoryName.includes("PRODUCT PROMOTION")) ? "push_in_app" : ""
|
|
836
839
|
};
|
|
837
840
|
if (categoryId)
|
|
@@ -840,6 +843,8 @@ const toItemProduct = (product, cart, item_category2) => {
|
|
|
840
843
|
item.item_variant = productModifiers.join(", ");
|
|
841
844
|
if (couponCode)
|
|
842
845
|
item.coupon = couponCode;
|
|
846
|
+
if (originalProduct)
|
|
847
|
+
item.original_item = originalProduct;
|
|
843
848
|
return [item];
|
|
844
849
|
};
|
|
845
850
|
const toItems = (type, params) => {
|
|
@@ -856,12 +861,12 @@ const toItems = (type, params) => {
|
|
|
856
861
|
];
|
|
857
862
|
}
|
|
858
863
|
case "addProductToCart": {
|
|
859
|
-
const { product, cart, item_category2 } = params;
|
|
860
|
-
return toItemProduct(product, cart, item_category2);
|
|
864
|
+
const { product, cart, item_category2, list } = params;
|
|
865
|
+
return toItemProduct(product, cart, item_category2, list);
|
|
861
866
|
}
|
|
862
867
|
case "viewProductDetails": {
|
|
863
|
-
const { product } = params;
|
|
864
|
-
return toItemProduct(product);
|
|
868
|
+
const { product, list } = params;
|
|
869
|
+
return toItemProduct(product, void 0, void 0, list);
|
|
865
870
|
}
|
|
866
871
|
case "purchaseSuccess": {
|
|
867
872
|
const { shoppingCart } = params;
|
|
@@ -3692,7 +3697,7 @@ var __objRest$3e = (source, exclude) => {
|
|
|
3692
3697
|
const initiateCheckout$2 = (provider, params) => {
|
|
3693
3698
|
const { userId: providerUserId } = provider;
|
|
3694
3699
|
const { currency: providerCurrency } = provider;
|
|
3695
|
-
const _a = params, { userId, shoppingCart, currency } = _a, rest = __objRest$3e(_a, ["userId", "shoppingCart", "currency"]);
|
|
3700
|
+
const _a = params, { userId, shoppingCart, currency, item_category2 } = _a, rest = __objRest$3e(_a, ["userId", "shoppingCart", "currency", "item_category2"]);
|
|
3696
3701
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
3697
3702
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
3698
3703
|
const enhancedParams = __spreadProps$29(__spreadValues$3f({}, rest), {
|
|
@@ -10597,7 +10602,7 @@ var __objRest$1a = (source, exclude) => {
|
|
|
10597
10602
|
};
|
|
10598
10603
|
const viewProductDetails$2 = (provider, params) => {
|
|
10599
10604
|
const { userId } = provider;
|
|
10600
|
-
const _a = params, { callback, product } = _a, rest = __objRest$1a(_a, ["callback", "product"]);
|
|
10605
|
+
const _a = params, { callback, product, list } = _a, rest = __objRest$1a(_a, ["callback", "product", "list"]);
|
|
10601
10606
|
const items = toItems("viewProductDetails", params);
|
|
10602
10607
|
const { netPrice } = getProductTotals(product);
|
|
10603
10608
|
const enhancedParams = __spreadProps$S(__spreadValues$1b({}, rest), { userId, items });
|
|
@@ -11975,10 +11980,11 @@ var __objRest$O = (source, exclude) => {
|
|
|
11975
11980
|
return target;
|
|
11976
11981
|
};
|
|
11977
11982
|
const addProductToCart$2 = (provider, params) => {
|
|
11978
|
-
var
|
|
11983
|
+
var _d;
|
|
11979
11984
|
const { userId: providerUserId, currency: providerCurrency } = provider;
|
|
11980
11985
|
const _a = params, { userId, currency, priceCategory } = _a, params2 = __objRest$O(_a, ["userId", "currency", "priceCategory"]);
|
|
11981
|
-
const _b = params2, { product, items: paramsItems, cart } = _b,
|
|
11986
|
+
const _b = params2, { product, items: paramsItems, list, cart } = _b, params3 = __objRest$O(_b, ["product", "items", "list", "cart"]);
|
|
11987
|
+
const _c = params3, { item_category2 } = _c, rest = __objRest$O(_c, ["item_category2"]);
|
|
11982
11988
|
const { id: cartId, name: cartName } = cart != null ? cart : {};
|
|
11983
11989
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
11984
11990
|
const selectedCurrency = currency != null ? currency : providerCurrency;
|
|
@@ -11991,7 +11997,7 @@ const addProductToCart$2 = (provider, params) => {
|
|
|
11991
11997
|
});
|
|
11992
11998
|
const { netPrice } = getProductTotals(product);
|
|
11993
11999
|
const { priceCategory: productPriceCategory } = product;
|
|
11994
|
-
const selectedPriceCategory = (
|
|
12000
|
+
const selectedPriceCategory = (_d = priceCategory != null ? priceCategory : productPriceCategory) != null ? _d : "NORMAL";
|
|
11995
12001
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
|
11996
12002
|
const { meta } = State().state;
|
|
11997
12003
|
const totalPrice = selectedPriceCategory === "NORMAL" ? netPrice : 0;
|
|
@@ -13391,7 +13397,7 @@ var __objRest$t = (source, exclude) => {
|
|
|
13391
13397
|
};
|
|
13392
13398
|
const viewCart$2 = (provider, params) => {
|
|
13393
13399
|
const { userId: providerUserId } = provider;
|
|
13394
|
-
const _a = params, { userId, shoppingCart } = _a, rest = __objRest$t(_a, ["userId", "shoppingCart"]);
|
|
13400
|
+
const _a = params, { userId, shoppingCart, item_category2 } = _a, rest = __objRest$t(_a, ["userId", "shoppingCart", "item_category2"]);
|
|
13395
13401
|
const selectedUserId = userId != null ? userId : providerUserId;
|
|
13396
13402
|
const enhancedParams = __spreadProps$h(__spreadValues$u({}, rest), { userId: selectedUserId });
|
|
13397
13403
|
const transformedParams = eventParamsToSnakeCase(enhancedParams);
|
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.
|
|
4
|
+
"version": "0.3.0-canary.168",
|
|
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.
|
|
40
|
-
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.
|
|
41
|
-
"@artisan-commerce/state": "0.3.0-canary.
|
|
42
|
-
"@artisan-commerce/types": "0.14.0-canary.
|
|
39
|
+
"@artisan-commerce/products": "0.9.0-canary.114",
|
|
40
|
+
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.152",
|
|
41
|
+
"@artisan-commerce/state": "0.3.0-canary.63",
|
|
42
|
+
"@artisan-commerce/types": "0.14.0-canary.91",
|
|
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": "
|
|
87
|
+
"gitHead": "6d38dcd0130085629875d1af668241f70df35ff7"
|
|
88
88
|
}
|