@azzas/azzas-tracker-web 1.0.81 → 1.0.83
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/README.md +130 -130
- package/dist/mod.cjs +37 -21
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +0 -0
- package/dist/mod.d.ts +0 -0
- package/dist/mod.global.js +37 -21
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +37 -21
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +71 -55
- package/package.json +38 -38
package/dist/mod.vtex.global.js
CHANGED
|
@@ -723,7 +723,7 @@ var AzzasTracker = function() {
|
|
|
723
723
|
4,
|
|
724
724
|
Promise.all(items.map(function(item) {
|
|
725
725
|
return _async_to_generator(function() {
|
|
726
|
-
var _item_additionalInfo, _item_additionalInfo1,
|
|
726
|
+
var _item_additionalInfo, _item_additionalInfo1, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _tmp;
|
|
727
727
|
return _ts_generator(this, function(_state) {
|
|
728
728
|
switch(_state.label){
|
|
729
729
|
case 0:
|
|
@@ -744,7 +744,7 @@ var AzzasTracker = function() {
|
|
|
744
744
|
case 1:
|
|
745
745
|
return [
|
|
746
746
|
2,
|
|
747
|
-
(_tmp.item_sku = _state.sent() ||
|
|
747
|
+
(_tmp.item_sku = _state.sent() || null, _tmp.item_name = (item === null || item === void 0 ? void 0 : item.name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) || item.name || null, _tmp.item_category = getItemCategory(item) || null, _tmp.item_variant = (item === null || item === void 0 ? void 0 : (_item_skuName = item.skuName) === null || _item_skuName === void 0 ? void 0 : (_item_skuName_split_ = _item_skuName.split(" - ")[0]) === null || _item_skuName_split_ === void 0 ? void 0 : _item_skuName_split_.trim()) || "", _tmp.item_variant2 = (item === null || item === void 0 ? void 0 : (_item_skuName1 = item.skuName) === null || _item_skuName1 === void 0 ? void 0 : (_item_skuName_split_1 = _item_skuName1.split(" - ")[1]) === null || _item_skuName_split_1 === void 0 ? void 0 : _item_skuName_split_1.trim()) || "", _tmp.item_url = "https://www.farmrio.com.br".concat(item.detailUrl) || null, _tmp.discount = getDiscount(item), _tmp.image_url = resizeVtexImage(item === null || item === void 0 ? void 0 : item.image) || resizeVtexImage(item === null || item === void 0 ? void 0 : item.imageUrl) || null, _tmp)
|
|
748
748
|
];
|
|
749
749
|
}
|
|
750
750
|
});
|
|
@@ -783,7 +783,22 @@ var AzzasTracker = function() {
|
|
|
783
783
|
var isStoredItemMemory = function isStoredItemMemory(value) {
|
|
784
784
|
if (!value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return false;
|
|
785
785
|
var candidate = value;
|
|
786
|
-
return typeof candidate.
|
|
786
|
+
return typeof candidate.item_id === "string" && typeof candidate.item_list_name === "string" && typeof candidate.timestamp === "number";
|
|
787
|
+
};
|
|
788
|
+
var normalizeStoredItemMemory = function normalizeStoredItemMemory(value) {
|
|
789
|
+
if (!value || (typeof value === "undefined" ? "undefined" : _type_of(value)) !== "object") return null;
|
|
790
|
+
var candidate = value;
|
|
791
|
+
var itemId = candidate.item_id;
|
|
792
|
+
var itemListName = candidate.item_list_name;
|
|
793
|
+
var timestamp = candidate.timestamp;
|
|
794
|
+
if (typeof itemId !== "string" || typeof itemListName !== "string" || typeof timestamp !== "number") {
|
|
795
|
+
return null;
|
|
796
|
+
}
|
|
797
|
+
return {
|
|
798
|
+
item_id: itemId,
|
|
799
|
+
item_list_name: itemListName,
|
|
800
|
+
timestamp: timestamp
|
|
801
|
+
};
|
|
787
802
|
};
|
|
788
803
|
var resolveIdFromUnknownItem = function resolveIdFromUnknownItem(item) {
|
|
789
804
|
var _ref, _ref1, _ref2, _ref3, _ref4;
|
|
@@ -798,7 +813,8 @@ var AzzasTracker = function() {
|
|
|
798
813
|
if (!storage) return null;
|
|
799
814
|
try {
|
|
800
815
|
var parsed = parseJSON(storage.getItem(key));
|
|
801
|
-
|
|
816
|
+
var normalized = normalizeStoredItemMemory(parsed);
|
|
817
|
+
return normalized && isStoredItemMemory(normalized) ? normalized : null;
|
|
802
818
|
} catch (unused) {
|
|
803
819
|
return null;
|
|
804
820
|
}
|
|
@@ -817,7 +833,7 @@ var AzzasTracker = function() {
|
|
|
817
833
|
var parsed = parseJSON(storage.getItem(CART_LIST_HISTORY_KEY));
|
|
818
834
|
if (!Array.isArray(parsed)) return [];
|
|
819
835
|
return parsed.filter(function(entry) {
|
|
820
|
-
return !!entry && (typeof entry === "undefined" ? "undefined" : _type_of(entry)) === "object" && typeof entry.
|
|
836
|
+
return !!entry && (typeof entry === "undefined" ? "undefined" : _type_of(entry)) === "object" && typeof entry.item_id === "string" && typeof entry.item_list_name === "string";
|
|
821
837
|
});
|
|
822
838
|
} catch (unused) {
|
|
823
839
|
return [];
|
|
@@ -833,8 +849,8 @@ var AzzasTracker = function() {
|
|
|
833
849
|
var saveSelectedItem = function saveSelectedItem(productId, listName) {
|
|
834
850
|
if (productId == null || !listName) return;
|
|
835
851
|
var payload = {
|
|
836
|
-
|
|
837
|
-
|
|
852
|
+
item_id: String(productId),
|
|
853
|
+
item_list_name: String(listName),
|
|
838
854
|
timestamp: Date.now()
|
|
839
855
|
};
|
|
840
856
|
writeStoredItem(LAST_SELECTED_ITEM_KEY, payload);
|
|
@@ -842,8 +858,8 @@ var AzzasTracker = function() {
|
|
|
842
858
|
var saveViewedItem = function saveViewedItem(productId, listName) {
|
|
843
859
|
if (productId == null) return;
|
|
844
860
|
var payload = {
|
|
845
|
-
|
|
846
|
-
|
|
861
|
+
item_id: String(productId),
|
|
862
|
+
item_list_name: String(listName !== null && listName !== void 0 ? listName : "PDP"),
|
|
847
863
|
timestamp: Date.now()
|
|
848
864
|
};
|
|
849
865
|
writeStoredItem(STORAGE_VIEWED, payload);
|
|
@@ -858,16 +874,16 @@ var AzzasTracker = function() {
|
|
|
858
874
|
if (!currentItemId) return "PDP";
|
|
859
875
|
var selectedItem = readStoredItem(LAST_SELECTED_ITEM_KEY);
|
|
860
876
|
if (!selectedItem) return "PDP";
|
|
861
|
-
if (selectedItem.
|
|
862
|
-
return selectedItem.
|
|
877
|
+
if (selectedItem.item_id === currentItemId && isFreshTimestamp(selectedItem.timestamp)) {
|
|
878
|
+
return selectedItem.item_list_name;
|
|
863
879
|
}
|
|
864
880
|
return "PDP";
|
|
865
881
|
}
|
|
866
882
|
if (currentListName !== "PDP" && currentListName !== null) return currentListName;
|
|
867
883
|
if (!currentItemId) return currentListName;
|
|
868
884
|
var viewedItem = readStoredItem(STORAGE_VIEWED);
|
|
869
|
-
if (viewedItem && viewedItem.
|
|
870
|
-
return viewedItem.
|
|
885
|
+
if (viewedItem && viewedItem.item_id === currentItemId && isFreshTimestamp(viewedItem.timestamp)) {
|
|
886
|
+
return viewedItem.item_list_name;
|
|
871
887
|
}
|
|
872
888
|
return currentListName === "PDP" ? "PDP" : null;
|
|
873
889
|
};
|
|
@@ -875,8 +891,8 @@ var AzzasTracker = function() {
|
|
|
875
891
|
if (productId == null) return;
|
|
876
892
|
var history = readCartHistory();
|
|
877
893
|
history.push({
|
|
878
|
-
|
|
879
|
-
|
|
894
|
+
item_id: String(productId),
|
|
895
|
+
item_list_name: listName ? String(listName) : "PDP"
|
|
880
896
|
});
|
|
881
897
|
writeCartHistory(history);
|
|
882
898
|
};
|
|
@@ -902,7 +918,7 @@ var AzzasTracker = function() {
|
|
|
902
918
|
var itemsFromItem = // src/params/resolvers/items/fromItem.ts
|
|
903
919
|
function itemsFromItem(context, event) {
|
|
904
920
|
return _async_to_generator(function() {
|
|
905
|
-
var _item_additionalProperty, _item_itemOffered, _item_itemOffered1, _item_additionalInfo, _item_brand, _item_itemOffered_brand, _item_itemOffered2, _item_itemOffered3, _item_name, _item_item_name, _item_itemOffered_isVariantOf_name, _item_itemOffered_isVariantOf, _item_itemOffered4, _item_itemAttributes, _split_pop, _this, item, orderForm, itemListName, resolvedListName, resolvedItemId, _tmp, _tmp1;
|
|
921
|
+
var _item_additionalProperty, _item_itemOffered, _item_itemOffered1, _item_additionalInfo, _item_brand, _item_itemOffered_brand, _item_itemOffered2, _item_itemOffered3, _item_name, _item_name1, _item_item_name, _item_itemOffered_isVariantOf_name, _item_itemOffered_isVariantOf, _item_itemOffered4, _item_itemAttributes, _split_pop, _this, item, orderForm, itemListName, resolvedListName, resolvedItemId, _tmp, _tmp1;
|
|
906
922
|
return _ts_generator(this, function(_state) {
|
|
907
923
|
switch(_state.label){
|
|
908
924
|
case 0:
|
|
@@ -945,7 +961,7 @@ var AzzasTracker = function() {
|
|
|
945
961
|
return [
|
|
946
962
|
2,
|
|
947
963
|
[
|
|
948
|
-
(_tmp.item_sku = _tmp1 || null, _tmp.item_name = (item === null || item === void 0 ? void 0 : (_item_name = item.name) === null || _item_name === void 0 ? void 0 : _item_name.split(" - ").shift()) || (item === null || item === void 0 ? void 0 : (_item_item_name = item.item_name) === null || _item_item_name === void 0 ? void 0 : _item_item_name.split(" - ").shift()) || (item === null || item === void 0 ? void 0 : (_item_itemOffered4 = item.itemOffered) === null || _item_itemOffered4 === void 0 ? void 0 : (_item_itemOffered_isVariantOf = _item_itemOffered4.isVariantOf) === null || _item_itemOffered_isVariantOf === void 0 ? void 0 : (_item_itemOffered_isVariantOf_name = _item_itemOffered_isVariantOf.name) === null || _item_itemOffered_isVariantOf_name === void 0 ? void 0 : _item_itemOffered_isVariantOf_name.split(" - ").shift()) || null, _tmp.item_category = getItemCategory(item) || null, _tmp.item_variant = ((item === null || item === void 0 ? void 0 : item.skuName) || (item === null || item === void 0 ? void 0 : item.item_variant) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.itemOffered.name)).split(/[-/]/)[0].trim() || null, _tmp.item_variant2 = (item === null || item === void 0 ? void 0 : item.size) || (item === null || item === void 0 ? void 0 : (_item_itemAttributes = item.itemAttributes) === null || _item_itemAttributes === void 0 ? void 0 : _item_itemAttributes.size) || ((_this = (item === null || item === void 0 ? void 0 : item.skuName) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.itemOffered.name)) === null || _this === void 0 ? void 0 : (_split_pop = _this.split(/[-/]/).pop()) === null || _split_pop === void 0 ? void 0 : _split_pop.trim()) || null, _tmp.discount = getDiscount(item), _tmp.item_list_name = resolvedListName, _tmp.item_url = (item === null || item === void 0 ? void 0 : item.item_url) || null, _tmp.// add_to_cart dito
|
|
964
|
+
(_tmp.item_sku = _tmp1 || null, _tmp.item_name = (item === null || item === void 0 ? void 0 : (_item_name = item.name) === null || _item_name === void 0 ? void 0 : _item_name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) || (item === null || item === void 0 ? void 0 : (_item_name1 = item.name) === null || _item_name1 === void 0 ? void 0 : _item_name1.split(" - ").shift()) || (item === null || item === void 0 ? void 0 : (_item_item_name = item.item_name) === null || _item_item_name === void 0 ? void 0 : _item_item_name.split(" - ").shift()) || (item === null || item === void 0 ? void 0 : (_item_itemOffered4 = item.itemOffered) === null || _item_itemOffered4 === void 0 ? void 0 : (_item_itemOffered_isVariantOf = _item_itemOffered4.isVariantOf) === null || _item_itemOffered_isVariantOf === void 0 ? void 0 : (_item_itemOffered_isVariantOf_name = _item_itemOffered_isVariantOf.name) === null || _item_itemOffered_isVariantOf_name === void 0 ? void 0 : _item_itemOffered_isVariantOf_name.split(" - ").shift()) || null, _tmp.item_category = getItemCategory(item) || null, _tmp.item_variant = ((item === null || item === void 0 ? void 0 : item.skuName) || (item === null || item === void 0 ? void 0 : item.item_variant) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.itemOffered.name)).split(/[-/]/)[0].trim() || null, _tmp.item_variant2 = (item === null || item === void 0 ? void 0 : item.size) || (item === null || item === void 0 ? void 0 : (_item_itemAttributes = item.itemAttributes) === null || _item_itemAttributes === void 0 ? void 0 : _item_itemAttributes.size) || ((_this = (item === null || item === void 0 ? void 0 : item.skuName) || (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.itemOffered.name)) === null || _this === void 0 ? void 0 : (_split_pop = _this.split(/[-/]/).pop()) === null || _split_pop === void 0 ? void 0 : _split_pop.trim()) || null, _tmp.discount = getDiscount(item), _tmp.item_list_name = resolvedListName, _tmp.item_url = (item === null || item === void 0 ? void 0 : item.item_url) || null, _tmp.// add_to_cart dito
|
|
949
965
|
image_url = resizeVtexImage(item === null || item === void 0 ? void 0 : item.image) || resizeVtexImage(item === null || item === void 0 ? void 0 : item.imageUrl) || null, _tmp)
|
|
950
966
|
]
|
|
951
967
|
];
|
|
@@ -1263,20 +1279,20 @@ var AzzasTracker = function() {
|
|
|
1263
1279
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1264
1280
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1265
1281
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1266
|
-
var __export = function
|
|
1282
|
+
var __export = function(target, all) {
|
|
1267
1283
|
for(var name in all)__defProp(target, name, {
|
|
1268
1284
|
get: all[name],
|
|
1269
1285
|
enumerable: true
|
|
1270
1286
|
});
|
|
1271
1287
|
};
|
|
1272
|
-
var __copyProps = function
|
|
1288
|
+
var __copyProps = function(to, from, except, desc) {
|
|
1273
1289
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
1274
1290
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1275
1291
|
try {
|
|
1276
1292
|
var _loop = function() {
|
|
1277
1293
|
var key = _step.value;
|
|
1278
1294
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1279
|
-
get: function
|
|
1295
|
+
get: function() {
|
|
1280
1296
|
return from[key];
|
|
1281
1297
|
},
|
|
1282
1298
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -1300,7 +1316,7 @@ var AzzasTracker = function() {
|
|
|
1300
1316
|
}
|
|
1301
1317
|
return to;
|
|
1302
1318
|
};
|
|
1303
|
-
var __toCommonJS = function
|
|
1319
|
+
var __toCommonJS = function(mod) {
|
|
1304
1320
|
return __copyProps(__defProp({}, "__esModule", {
|
|
1305
1321
|
value: true
|
|
1306
1322
|
}), mod);
|
|
@@ -1308,13 +1324,13 @@ var AzzasTracker = function() {
|
|
|
1308
1324
|
// src/index.ts
|
|
1309
1325
|
var src_exports = {};
|
|
1310
1326
|
__export(src_exports, {
|
|
1311
|
-
EVENTS: function
|
|
1327
|
+
EVENTS: function() {
|
|
1312
1328
|
return EVENTS;
|
|
1313
1329
|
},
|
|
1314
|
-
default: function
|
|
1330
|
+
default: function() {
|
|
1315
1331
|
return src_default;
|
|
1316
1332
|
},
|
|
1317
|
-
trackWebEvent: function
|
|
1333
|
+
trackWebEvent: function() {
|
|
1318
1334
|
return trackWebEvent;
|
|
1319
1335
|
}
|
|
1320
1336
|
});
|
|
@@ -1765,16 +1781,16 @@ var AzzasTracker = function() {
|
|
|
1765
1781
|
"cart\xE3o"
|
|
1766
1782
|
]
|
|
1767
1783
|
];
|
|
1768
|
-
var toNum = function
|
|
1784
|
+
var toNum = function(val) {
|
|
1769
1785
|
return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
|
|
1770
1786
|
};
|
|
1771
|
-
var setLocalStorage = function
|
|
1787
|
+
var setLocalStorage = function(key, value) {
|
|
1772
1788
|
localStorage.setItem(key, value);
|
|
1773
1789
|
};
|
|
1774
|
-
var getLocalStorage = function
|
|
1790
|
+
var getLocalStorage = function(key) {
|
|
1775
1791
|
return localStorage.getItem(key);
|
|
1776
1792
|
};
|
|
1777
|
-
var documentToHash = function
|
|
1793
|
+
var documentToHash = function(document2) {
|
|
1778
1794
|
return _async_to_generator(function() {
|
|
1779
1795
|
var encoder, data, hashBuffer, hashArray;
|
|
1780
1796
|
return _ts_generator(this, function(_state) {
|
|
@@ -1819,7 +1835,7 @@ var AzzasTracker = function() {
|
|
|
1819
1835
|
brand: getBrand,
|
|
1820
1836
|
items: getItems,
|
|
1821
1837
|
payment_type: getPaymentType,
|
|
1822
|
-
user_info: function
|
|
1838
|
+
user_info: function(context, eventName) {
|
|
1823
1839
|
return _async_to_generator(function() {
|
|
1824
1840
|
var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, res, cpfFromStorage, hashedDocument, _;
|
|
1825
1841
|
return _ts_generator(this, function(_state) {
|
|
@@ -1950,13 +1966,13 @@ var AzzasTracker = function() {
|
|
|
1950
1966
|
});
|
|
1951
1967
|
})();
|
|
1952
1968
|
},
|
|
1953
|
-
content_type: function
|
|
1969
|
+
content_type: function(context, eventName) {
|
|
1954
1970
|
return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
|
|
1955
1971
|
},
|
|
1956
|
-
region: function
|
|
1972
|
+
region: function(context, eventName) {
|
|
1957
1973
|
return context.region || null;
|
|
1958
1974
|
},
|
|
1959
|
-
line_items: function
|
|
1975
|
+
line_items: function(context, eventName) {
|
|
1960
1976
|
if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
|
|
1961
1977
|
if (context === null || context === void 0 ? void 0 : context.item) {
|
|
1962
1978
|
return [
|
|
@@ -1972,7 +1988,7 @@ var AzzasTracker = function() {
|
|
|
1972
1988
|
return item.productId;
|
|
1973
1989
|
}).join(",");
|
|
1974
1990
|
},
|
|
1975
|
-
currency: function
|
|
1991
|
+
currency: function(context, eventName) {
|
|
1976
1992
|
var _context_orderForm_storePreferencesData, _context_orderForm;
|
|
1977
1993
|
if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
|
|
1978
1994
|
if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
|
|
@@ -1982,12 +1998,12 @@ var AzzasTracker = function() {
|
|
|
1982
1998
|
}
|
|
1983
1999
|
return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_storePreferencesData = _context_orderForm.storePreferencesData) === null || _context_orderForm_storePreferencesData === void 0 ? void 0 : _context_orderForm_storePreferencesData.currencyCode) || null;
|
|
1984
2000
|
},
|
|
1985
|
-
value: function
|
|
2001
|
+
value: function(context, eventName) {
|
|
1986
2002
|
var _context_item, _context_orderForm;
|
|
1987
2003
|
if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
|
|
1988
2004
|
return context.item ? toNum((_context_item = context.item) === null || _context_item === void 0 ? void 0 : _context_item.price) : ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.value) != null ? context.orderForm.value / 100 : null;
|
|
1989
2005
|
},
|
|
1990
|
-
total_discount: function
|
|
2006
|
+
total_discount: function(context, eventName) {
|
|
1991
2007
|
var _context_orderForm, _context_orderForm1;
|
|
1992
2008
|
if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
|
|
1993
2009
|
var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
|
|
@@ -2001,7 +2017,7 @@ var AzzasTracker = function() {
|
|
|
2001
2017
|
});
|
|
2002
2018
|
return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
|
|
2003
2019
|
},
|
|
2004
|
-
subtotal: function
|
|
2020
|
+
subtotal: function(context, eventName) {
|
|
2005
2021
|
var _context_orderForm, _context_orderForm1;
|
|
2006
2022
|
var totalsList = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.totalizers) || ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totals) || [];
|
|
2007
2023
|
var subtotal = totalsList.filter(function(t) {
|
|
@@ -2011,7 +2027,7 @@ var AzzasTracker = function() {
|
|
|
2011
2027
|
}, 0) / 100 || 0;
|
|
2012
2028
|
return subtotal;
|
|
2013
2029
|
},
|
|
2014
|
-
coupon_message: function
|
|
2030
|
+
coupon_message: function(context, eventName) {
|
|
2015
2031
|
var _context_orderForm;
|
|
2016
2032
|
if (context.couponMessage) return context.couponMessage;
|
|
2017
2033
|
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
@@ -2024,44 +2040,44 @@ var AzzasTracker = function() {
|
|
|
2024
2040
|
return msg.text;
|
|
2025
2041
|
}).join(" | ");
|
|
2026
2042
|
},
|
|
2027
|
-
seller_cod_name: function
|
|
2043
|
+
seller_cod_name: function(context, eventName) {
|
|
2028
2044
|
return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
|
|
2029
2045
|
},
|
|
2030
|
-
coupon: function
|
|
2046
|
+
coupon: function(context, eventName) {
|
|
2031
2047
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
2032
2048
|
return context.appliedCoupon || (context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_marketingData = _context_orderForm.marketingData) === null || _context_orderForm_marketingData === void 0 ? void 0 : _context_orderForm_marketingData.coupon) || null;
|
|
2033
2049
|
},
|
|
2034
|
-
pre_filled: function
|
|
2050
|
+
pre_filled: function(context, eventName) {
|
|
2035
2051
|
return !!context.preFilled;
|
|
2036
2052
|
},
|
|
2037
|
-
search_term: function
|
|
2053
|
+
search_term: function(context, eventName) {
|
|
2038
2054
|
return context.searchTerm || null;
|
|
2039
2055
|
},
|
|
2040
|
-
search_found: function
|
|
2056
|
+
search_found: function(context, eventName) {
|
|
2041
2057
|
return !!context.searchFound;
|
|
2042
2058
|
},
|
|
2043
|
-
search_quantity: function
|
|
2059
|
+
search_quantity: function(context, eventName) {
|
|
2044
2060
|
return context.searchQuantity || 0;
|
|
2045
2061
|
},
|
|
2046
|
-
promotion_name: function
|
|
2062
|
+
promotion_name: function(context, eventName) {
|
|
2047
2063
|
return context.promotionName || null;
|
|
2048
2064
|
},
|
|
2049
|
-
creative_name: function
|
|
2065
|
+
creative_name: function(context, eventName) {
|
|
2050
2066
|
return context.creativeName || null;
|
|
2051
2067
|
},
|
|
2052
|
-
creative_slot: function
|
|
2068
|
+
creative_slot: function(context, eventName) {
|
|
2053
2069
|
return context.creativeSlot || null;
|
|
2054
2070
|
},
|
|
2055
|
-
zipcode: function
|
|
2071
|
+
zipcode: function(context, eventName) {
|
|
2056
2072
|
return context.zipCode || null;
|
|
2057
2073
|
},
|
|
2058
|
-
size: function
|
|
2074
|
+
size: function(context, eventName) {
|
|
2059
2075
|
return context.size || null;
|
|
2060
2076
|
},
|
|
2061
|
-
item_ref: function
|
|
2077
|
+
item_ref: function(context, eventName) {
|
|
2062
2078
|
return context.itemRef || null;
|
|
2063
2079
|
},
|
|
2064
|
-
flag_pickup: function
|
|
2080
|
+
flag_pickup: function(context, eventName) {
|
|
2065
2081
|
var _orderForm_shippingData;
|
|
2066
2082
|
var orderForm = context.orderForm;
|
|
2067
2083
|
if (!orderForm) return null;
|
|
@@ -2074,7 +2090,7 @@ var AzzasTracker = function() {
|
|
|
2074
2090
|
});
|
|
2075
2091
|
return hasPickup;
|
|
2076
2092
|
},
|
|
2077
|
-
shippings: function
|
|
2093
|
+
shippings: function(context, eventName) {
|
|
2078
2094
|
var orderForm = context.orderForm;
|
|
2079
2095
|
if (!orderForm) return null;
|
|
2080
2096
|
var groupShipping = {};
|
|
@@ -2138,7 +2154,7 @@ var AzzasTracker = function() {
|
|
|
2138
2154
|
});
|
|
2139
2155
|
return shippings || null;
|
|
2140
2156
|
},
|
|
2141
|
-
shipping: function
|
|
2157
|
+
shipping: function(context, eventName) {
|
|
2142
2158
|
var _ref;
|
|
2143
2159
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2144
2160
|
var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
|
|
@@ -2151,7 +2167,7 @@ var AzzasTracker = function() {
|
|
|
2151
2167
|
return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
|
|
2152
2168
|
}, 0);
|
|
2153
2169
|
},
|
|
2154
|
-
shipping_tier: function
|
|
2170
|
+
shipping_tier: function(context, eventName) {
|
|
2155
2171
|
var _ref;
|
|
2156
2172
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2157
2173
|
var logistics = (_ref = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_shippingData = _context_orderForm.shippingData) === null || _context_orderForm_shippingData === void 0 ? void 0 : _context_orderForm_shippingData.logisticsInfo) !== null && _ref !== void 0 ? _ref : [];
|
|
@@ -2186,11 +2202,11 @@ var AzzasTracker = function() {
|
|
|
2186
2202
|
}).filter(Boolean).join(", ");
|
|
2187
2203
|
return shippingTier || null;
|
|
2188
2204
|
},
|
|
2189
|
-
transaction_id: function
|
|
2205
|
+
transaction_id: function(context, eventName) {
|
|
2190
2206
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
2191
2207
|
return ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_orderGroup = _context_orderForm.orderGroup) === null || _context_orderForm_orderGroup === void 0 ? void 0 : _context_orderForm_orderGroup.toString()) || null;
|
|
2192
2208
|
},
|
|
2193
|
-
available_grid: function
|
|
2209
|
+
available_grid: function(context, eventName) {
|
|
2194
2210
|
return context.availableGrid || null;
|
|
2195
2211
|
}
|
|
2196
2212
|
};
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@azzas/azzas-tracker-web",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"type": "module",
|
|
5
|
-
"main": "./dist/mod.cjs",
|
|
6
|
-
"module": "./dist/mod.js",
|
|
7
|
-
"types": "./dist/mod.d.ts",
|
|
8
|
-
"unpkg": "./dist/mod.global.js",
|
|
9
|
-
"jsdelivr": "./dist/mod.global.js",
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"import": "./dist/mod.js",
|
|
13
|
-
"require": "./dist/mod.cjs",
|
|
14
|
-
"default": "./dist/legacy/mod.cjs"
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"files": [
|
|
18
|
-
"dist"
|
|
19
|
-
],
|
|
20
|
-
"scripts": {
|
|
21
|
-
"build": "tsup",
|
|
22
|
-
"prepublishOnly": "npm run build",
|
|
23
|
-
"release:homolog": "npm run build && npm version prepatch --preid=beta && npm publish --tag beta --access public",
|
|
24
|
-
"release:prod": "npm run build && npm version patch && npm publish --access public",
|
|
25
|
-
"pack:copy": "node -e \"const v=require('./package.json').version,e=require('child_process').execSync;e('npm pack',{stdio:'inherit'});e('tar -xzf azzas-azzas-tracker-web-'+v+'.tgz',{stdio:'inherit'})\"",
|
|
26
|
-
"start:deno": "deno run --allow-net --allow-read https://deno.land/std@0.207.0/http/file_server.ts ./package",
|
|
27
|
-
"dev:deno": "npm run build && npm run pack:copy && npm run start:deno",
|
|
28
|
-
"dev:npm": "npm run build -- --watch"
|
|
29
|
-
},
|
|
30
|
-
"publishConfig": {
|
|
31
|
-
"access": "public"
|
|
32
|
-
},
|
|
33
|
-
"devDependencies": {
|
|
34
|
-
"@swc/core": "^1.15.7",
|
|
35
|
-
"tsup": "^8.5.0",
|
|
36
|
-
"typescript": "^5.9.2"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@azzas/azzas-tracker-web",
|
|
3
|
+
"version": "1.0.83",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/mod.cjs",
|
|
6
|
+
"module": "./dist/mod.js",
|
|
7
|
+
"types": "./dist/mod.d.ts",
|
|
8
|
+
"unpkg": "./dist/mod.global.js",
|
|
9
|
+
"jsdelivr": "./dist/mod.global.js",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./dist/mod.js",
|
|
13
|
+
"require": "./dist/mod.cjs",
|
|
14
|
+
"default": "./dist/legacy/mod.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
|
+
"release:homolog": "npm run build && npm version prepatch --preid=beta && npm publish --tag beta --access public",
|
|
24
|
+
"release:prod": "npm run build && npm version patch && npm publish --access public",
|
|
25
|
+
"pack:copy": "node -e \"const v=require('./package.json').version,e=require('child_process').execSync;e('npm pack',{stdio:'inherit'});e('tar -xzf azzas-azzas-tracker-web-'+v+'.tgz',{stdio:'inherit'})\"",
|
|
26
|
+
"start:deno": "deno run --allow-net --allow-read https://deno.land/std@0.207.0/http/file_server.ts ./package",
|
|
27
|
+
"dev:deno": "npm run build && npm run pack:copy && npm run start:deno",
|
|
28
|
+
"dev:npm": "npm run build -- --watch"
|
|
29
|
+
},
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@swc/core": "^1.15.7",
|
|
35
|
+
"tsup": "^8.5.0",
|
|
36
|
+
"typescript": "^5.9.2"
|
|
37
|
+
}
|
|
38
|
+
}
|