@artisan-commerce/analytics-rn 0.3.0-canary.122 → 0.3.0-canary.123
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 +12 -7
- package/dist/bundle.mjs +25 -17
- package/package.json +6 -6
package/dist/bundle.d.ts
CHANGED
|
@@ -167,23 +167,28 @@ interface GoogleAnalyticsCustomEventParams {
|
|
|
167
167
|
[key: string]: any;
|
|
168
168
|
}
|
|
169
169
|
declare namespace Gtag {
|
|
170
|
-
type Currency = string | number;
|
|
171
170
|
interface Item {
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
item_id: string;
|
|
172
|
+
item_name: string;
|
|
173
|
+
affiliation?: string;
|
|
174
|
+
coupon?: string;
|
|
174
175
|
creative_name?: string;
|
|
175
176
|
creative_slot?: string;
|
|
176
|
-
|
|
177
|
+
discount?: number;
|
|
177
178
|
index?: number;
|
|
178
179
|
item_brand?: string;
|
|
179
180
|
item_category?: string;
|
|
180
|
-
|
|
181
|
+
item_category2?: string;
|
|
182
|
+
item_category3?: string;
|
|
183
|
+
item_category4?: string;
|
|
184
|
+
item_category5?: string;
|
|
181
185
|
item_list_id?: string;
|
|
182
186
|
item_list_name?: string;
|
|
183
|
-
item_name?: string;
|
|
184
187
|
item_variant?: string;
|
|
185
188
|
location_id?: string;
|
|
186
|
-
price?:
|
|
189
|
+
price?: number;
|
|
190
|
+
promotion_id?: string;
|
|
191
|
+
promotion_name?: string;
|
|
187
192
|
quantity?: number;
|
|
188
193
|
}
|
|
189
194
|
}
|
package/dist/bundle.mjs
CHANGED
|
@@ -53,7 +53,7 @@ State$1._instance = null;
|
|
|
53
53
|
|
|
54
54
|
var name = "@artisan-commerce/analytics-rn";
|
|
55
55
|
var description = "Artisn commerce analytics react native library";
|
|
56
|
-
var version = "0.3.0-canary.
|
|
56
|
+
var version = "0.3.0-canary.123";
|
|
57
57
|
var type = "module";
|
|
58
58
|
var main = "./dist/bundle.mjs";
|
|
59
59
|
var module = "./dist/bundle.mjs";
|
|
@@ -88,10 +88,10 @@ var dependencies = {
|
|
|
88
88
|
"snake-case": "^3.0.4"
|
|
89
89
|
};
|
|
90
90
|
var devDependencies = {
|
|
91
|
-
"@artisan-commerce/products": "0.9.0-canary.
|
|
92
|
-
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.
|
|
93
|
-
"@artisan-commerce/state": "0.3.0-canary.
|
|
94
|
-
"@artisan-commerce/types": "0.14.0-canary.
|
|
91
|
+
"@artisan-commerce/products": "0.9.0-canary.72",
|
|
92
|
+
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.108",
|
|
93
|
+
"@artisan-commerce/state": "0.3.0-canary.21",
|
|
94
|
+
"@artisan-commerce/types": "0.14.0-canary.49",
|
|
95
95
|
"@babel/core": "^7.13.15",
|
|
96
96
|
"@babel/preset-env": "^7.10.4",
|
|
97
97
|
"@babel/preset-react": "^7.10.4",
|
|
@@ -136,7 +136,7 @@ var nx = {
|
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
};
|
|
139
|
-
var gitHead = "
|
|
139
|
+
var gitHead = "98e0239c60db3d4644252e78de08e6a902f5904b";
|
|
140
140
|
var packageJSON = {
|
|
141
141
|
name: name,
|
|
142
142
|
description: description,
|
|
@@ -843,20 +843,28 @@ const getProductContentForConversionAPI = (product) => {
|
|
|
843
843
|
const facebookItem = { id, item_price: netPrice };
|
|
844
844
|
return JSON.stringify(facebookItem);
|
|
845
845
|
};
|
|
846
|
-
const mapProductsToGoogleItems = (shoppingCart
|
|
846
|
+
const mapProductsToGoogleItems = (shoppingCart) => {
|
|
847
847
|
const products = getShoppingCartProducts(shoppingCart);
|
|
848
|
-
return products.map((product) => mapProductToGoogleItem(product
|
|
848
|
+
return products.map((product) => mapProductToGoogleItem(product));
|
|
849
849
|
};
|
|
850
|
-
const mapProductToGoogleItem = (product
|
|
850
|
+
const mapProductToGoogleItem = (product) => {
|
|
851
851
|
const totals = getProductTotals(product);
|
|
852
|
-
const { productId, name, amount } = product;
|
|
853
|
-
|
|
852
|
+
const { productId, name, amount, categories, addedFrom } = product;
|
|
853
|
+
const [category] = categories != null ? categories : [];
|
|
854
|
+
const { categoryId, name: categoryName } = category != null ? category : {};
|
|
855
|
+
const item = {
|
|
854
856
|
item_id: productId,
|
|
855
857
|
item_name: name,
|
|
856
858
|
quantity: amount,
|
|
857
|
-
price: totals.netPrice
|
|
858
|
-
currency
|
|
859
|
+
price: totals.netPrice
|
|
859
860
|
};
|
|
861
|
+
if (categoryId)
|
|
862
|
+
item.item_list_id = `${categoryId}`;
|
|
863
|
+
if (categoryName)
|
|
864
|
+
item.item_category = categoryName;
|
|
865
|
+
if (addedFrom)
|
|
866
|
+
item.item_category2 = addedFrom;
|
|
867
|
+
return item;
|
|
860
868
|
};
|
|
861
869
|
const transformArrayParam = (param) => {
|
|
862
870
|
return param.join(",");
|
|
@@ -3664,7 +3672,7 @@ const initiateCheckout$2 = (provider, params) => {
|
|
|
3664
3672
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
3665
3673
|
const { total, totalPoints } = getShoppingCartTotal(shoppingCart);
|
|
3666
3674
|
analytics().logEvent("begin_checkout", __spreadValues$33(__spreadValues$33({
|
|
3667
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
3675
|
+
items: mapProductsToGoogleItems(shoppingCart),
|
|
3668
3676
|
value: total,
|
|
3669
3677
|
points: totalPoints != null ? totalPoints : 0
|
|
3670
3678
|
}, transformedParams), transformedMeta));
|
|
@@ -10500,7 +10508,7 @@ const purchaseSuccess$2 = (provider, params) => {
|
|
|
10500
10508
|
const { meta } = State().state;
|
|
10501
10509
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
10502
10510
|
analytics().logEvent("purchase", __spreadValues$12(__spreadValues$12({
|
|
10503
|
-
items: mapProductsToGoogleItems(shoppingCart
|
|
10511
|
+
items: mapProductsToGoogleItems(shoppingCart),
|
|
10504
10512
|
value: total,
|
|
10505
10513
|
points: totalPoints != null ? totalPoints : 0,
|
|
10506
10514
|
transaction_id: orderId,
|
|
@@ -11319,7 +11327,7 @@ const addProductToCart$2 = (provider, params) => {
|
|
|
11319
11327
|
const totalPoints = finalPriceCategory === "POINTS" ? netPrice : 0;
|
|
11320
11328
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
11321
11329
|
analytics().logEvent("add_to_cart", __spreadValues$P(__spreadValues$P({
|
|
11322
|
-
items: [mapProductToGoogleItem(product
|
|
11330
|
+
items: [mapProductToGoogleItem(product)],
|
|
11323
11331
|
value: totalPrice,
|
|
11324
11332
|
points: totalPoints
|
|
11325
11333
|
}, transformedParams), transformedMeta));
|
|
@@ -11531,7 +11539,7 @@ const addProductToWishlist$2 = (provider, params) => {
|
|
|
11531
11539
|
const totalPoints = finalPriceCategory === "POINTS" ? netPrice : 0;
|
|
11532
11540
|
const transformedMeta = eventParamsToSnakeCase(meta);
|
|
11533
11541
|
analytics().logEvent("add_to_wishlist", __spreadValues$M(__spreadValues$M({
|
|
11534
|
-
items: [mapProductToGoogleItem(product
|
|
11542
|
+
items: [mapProductToGoogleItem(product)],
|
|
11535
11543
|
value: totalPrice,
|
|
11536
11544
|
points: totalPoints
|
|
11537
11545
|
}, transformedParams), transformedMeta));
|
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.123",
|
|
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.72",
|
|
40
|
+
"@artisan-commerce/shopping-cart-core": "0.12.0-canary.108",
|
|
41
|
+
"@artisan-commerce/state": "0.3.0-canary.21",
|
|
42
|
+
"@artisan-commerce/types": "0.14.0-canary.49",
|
|
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": "98e0239c60db3d4644252e78de08e6a902f5904b"
|
|
88
88
|
}
|