@azzas/azzas-tracker-web 1.0.84 → 1.0.85
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 +54 -30
- 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 +54 -30
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +54 -30
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +115 -91
- package/package.json +38 -38
package/dist/mod.vtex.global.js
CHANGED
|
@@ -707,59 +707,6 @@ var AzzasTracker = function() {
|
|
|
707
707
|
return null;
|
|
708
708
|
}
|
|
709
709
|
};
|
|
710
|
-
var itemsFromOrderForm = // src/params/resolvers/items/fromOrderForm.ts
|
|
711
|
-
function itemsFromOrderForm(context) {
|
|
712
|
-
return _async_to_generator(function() {
|
|
713
|
-
var _context_orderForm, items;
|
|
714
|
-
return _ts_generator(this, function(_state) {
|
|
715
|
-
switch(_state.label){
|
|
716
|
-
case 0:
|
|
717
|
-
items = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items) || [];
|
|
718
|
-
if (!items.length) return [
|
|
719
|
-
2,
|
|
720
|
-
[]
|
|
721
|
-
];
|
|
722
|
-
return [
|
|
723
|
-
4,
|
|
724
|
-
Promise.all(items.map(function(item) {
|
|
725
|
-
return _async_to_generator(function() {
|
|
726
|
-
var _item_additionalInfo, _item_additionalInfo1, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _tmp;
|
|
727
|
-
return _ts_generator(this, function(_state) {
|
|
728
|
-
switch(_state.label){
|
|
729
|
-
case 0:
|
|
730
|
-
_tmp = {
|
|
731
|
-
item_id: item.productId,
|
|
732
|
-
item_category2: getItemCategory2(item),
|
|
733
|
-
item_category4: getItemCategory4(item),
|
|
734
|
-
item_shipping_tier: getItemShippingTier(context.orderForm, item),
|
|
735
|
-
price: parseFloat(((item === null || item === void 0 ? void 0 : item.price) / 100).toFixed(2)) || 0,
|
|
736
|
-
quantity: item.quantity || 1,
|
|
737
|
-
item_ref: item.refId || null,
|
|
738
|
-
item_brand: normalizeBrand((_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) || ((_item_additionalInfo1 = item.additionalInfo) === null || _item_additionalInfo1 === void 0 ? void 0 : _item_additionalInfo1.brandName) || null
|
|
739
|
-
};
|
|
740
|
-
return [
|
|
741
|
-
4,
|
|
742
|
-
getItemSku(item)
|
|
743
|
-
];
|
|
744
|
-
case 1:
|
|
745
|
-
return [
|
|
746
|
-
2,
|
|
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
|
-
];
|
|
749
|
-
}
|
|
750
|
-
});
|
|
751
|
-
})();
|
|
752
|
-
}))
|
|
753
|
-
];
|
|
754
|
-
case 1:
|
|
755
|
-
return [
|
|
756
|
-
2,
|
|
757
|
-
_state.sent()
|
|
758
|
-
];
|
|
759
|
-
}
|
|
760
|
-
});
|
|
761
|
-
})();
|
|
762
|
-
};
|
|
763
710
|
var getStorage = function getStorage() {
|
|
764
711
|
try {
|
|
765
712
|
if (typeof window === "undefined" || !window.localStorage) return null;
|
|
@@ -846,6 +793,16 @@ var AzzasTracker = function() {
|
|
|
846
793
|
storage.setItem(CART_LIST_HISTORY_KEY, JSON.stringify(history));
|
|
847
794
|
} catch (unused) {}
|
|
848
795
|
};
|
|
796
|
+
var getLatestItemListNameById = function getLatestItemListNameById(history) {
|
|
797
|
+
var byId = /* @__PURE__ */ new Map();
|
|
798
|
+
for(var index = history.length - 1; index >= 0; index -= 1){
|
|
799
|
+
var entry = history[index];
|
|
800
|
+
if (!byId.has(entry.item_id)) {
|
|
801
|
+
byId.set(entry.item_id, entry.item_list_name);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
return byId;
|
|
805
|
+
};
|
|
849
806
|
var saveSelectedItem = function saveSelectedItem(productId, listName) {
|
|
850
807
|
if (productId == null || !listName) return;
|
|
851
808
|
var payload = {
|
|
@@ -896,6 +853,19 @@ var AzzasTracker = function() {
|
|
|
896
853
|
});
|
|
897
854
|
writeCartHistory(history);
|
|
898
855
|
};
|
|
856
|
+
var getCartHistoryItemListNameMap = function getCartHistoryItemListNameMap() {
|
|
857
|
+
var history = readCartHistory();
|
|
858
|
+
if (!history.length) return null;
|
|
859
|
+
return getLatestItemListNameById(history);
|
|
860
|
+
};
|
|
861
|
+
var resolveItemListNameFromCartHistory = function resolveItemListNameFromCartHistory(item) {
|
|
862
|
+
var cartHistoryMap = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : null;
|
|
863
|
+
var itemId = resolveIdFromUnknownItem(item);
|
|
864
|
+
var map = cartHistoryMap !== null && cartHistoryMap !== void 0 ? cartHistoryMap : getCartHistoryItemListNameMap();
|
|
865
|
+
if (!itemId) return void 0;
|
|
866
|
+
var resolved = map === null || map === void 0 ? void 0 : map.get(itemId);
|
|
867
|
+
return resolved;
|
|
868
|
+
};
|
|
899
869
|
var pickSelectedItemFromResolvedItems = function pickSelectedItemFromResolvedItems(items, source) {
|
|
900
870
|
if (!Array.isArray(items) || items.length === 0) return null;
|
|
901
871
|
if (typeof (source === null || source === void 0 ? void 0 : source.index) === "number") {
|
|
@@ -915,6 +885,60 @@ var AzzasTracker = function() {
|
|
|
915
885
|
var listName = (_ref = (_ref1 = (_ref2 = selectedItem === null || selectedItem === void 0 ? void 0 : selectedItem.item_list_name) !== null && _ref2 !== void 0 ? _ref2 : source === null || source === void 0 ? void 0 : source.itemListName) !== null && _ref1 !== void 0 ? _ref1 : source === null || source === void 0 ? void 0 : source.item_list_name) !== null && _ref !== void 0 ? _ref : null;
|
|
916
886
|
saveSelectedItem(productId, listName);
|
|
917
887
|
};
|
|
888
|
+
var itemsFromOrderForm = // src/params/resolvers/items/fromOrderForm.ts
|
|
889
|
+
function itemsFromOrderForm(context) {
|
|
890
|
+
return _async_to_generator(function() {
|
|
891
|
+
var _context_orderForm, items, cartHistoryMap;
|
|
892
|
+
return _ts_generator(this, function(_state) {
|
|
893
|
+
switch(_state.label){
|
|
894
|
+
case 0:
|
|
895
|
+
items = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items) || [];
|
|
896
|
+
cartHistoryMap = getCartHistoryItemListNameMap();
|
|
897
|
+
if (!items.length) return [
|
|
898
|
+
2,
|
|
899
|
+
[]
|
|
900
|
+
];
|
|
901
|
+
return [
|
|
902
|
+
4,
|
|
903
|
+
Promise.all(items.map(function(item) {
|
|
904
|
+
return _async_to_generator(function() {
|
|
905
|
+
var _resolveItemListNameFromCartHistory, _item_additionalInfo, _item_additionalInfo1, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _tmp;
|
|
906
|
+
return _ts_generator(this, function(_state) {
|
|
907
|
+
switch(_state.label){
|
|
908
|
+
case 0:
|
|
909
|
+
_tmp = {
|
|
910
|
+
item_id: item.productId,
|
|
911
|
+
item_category2: getItemCategory2(item),
|
|
912
|
+
item_category4: getItemCategory4(item),
|
|
913
|
+
item_shipping_tier: getItemShippingTier(context.orderForm, item),
|
|
914
|
+
price: parseFloat(((item === null || item === void 0 ? void 0 : item.price) / 100).toFixed(2)) || 0,
|
|
915
|
+
quantity: item.quantity || 1,
|
|
916
|
+
item_ref: item.refId || null,
|
|
917
|
+
item_brand: normalizeBrand((_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) || ((_item_additionalInfo1 = item.additionalInfo) === null || _item_additionalInfo1 === void 0 ? void 0 : _item_additionalInfo1.brandName) || null
|
|
918
|
+
};
|
|
919
|
+
return [
|
|
920
|
+
4,
|
|
921
|
+
getItemSku(item)
|
|
922
|
+
];
|
|
923
|
+
case 1:
|
|
924
|
+
return [
|
|
925
|
+
2,
|
|
926
|
+
(_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.item_list_name = (_resolveItemListNameFromCartHistory = resolveItemListNameFromCartHistory(item, cartHistoryMap)) !== null && _resolveItemListNameFromCartHistory !== void 0 ? _resolveItemListNameFromCartHistory : null, _tmp)
|
|
927
|
+
];
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
})();
|
|
931
|
+
}))
|
|
932
|
+
];
|
|
933
|
+
case 1:
|
|
934
|
+
return [
|
|
935
|
+
2,
|
|
936
|
+
_state.sent()
|
|
937
|
+
];
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
})();
|
|
941
|
+
};
|
|
918
942
|
var itemsFromItem = // src/params/resolvers/items/fromItem.ts
|
|
919
943
|
function itemsFromItem(context, event) {
|
|
920
944
|
return _async_to_generator(function() {
|
|
@@ -1281,20 +1305,20 @@ var AzzasTracker = function() {
|
|
|
1281
1305
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1282
1306
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1283
1307
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1284
|
-
var __export = function(target, all) {
|
|
1308
|
+
var __export = function __export(target, all) {
|
|
1285
1309
|
for(var name in all)__defProp(target, name, {
|
|
1286
1310
|
get: all[name],
|
|
1287
1311
|
enumerable: true
|
|
1288
1312
|
});
|
|
1289
1313
|
};
|
|
1290
|
-
var __copyProps = function(to, from, except, desc) {
|
|
1314
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
1291
1315
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
1292
1316
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1293
1317
|
try {
|
|
1294
1318
|
var _loop = function() {
|
|
1295
1319
|
var key = _step.value;
|
|
1296
1320
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1297
|
-
get: function() {
|
|
1321
|
+
get: function get() {
|
|
1298
1322
|
return from[key];
|
|
1299
1323
|
},
|
|
1300
1324
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -1318,7 +1342,7 @@ var AzzasTracker = function() {
|
|
|
1318
1342
|
}
|
|
1319
1343
|
return to;
|
|
1320
1344
|
};
|
|
1321
|
-
var __toCommonJS = function(mod) {
|
|
1345
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
1322
1346
|
return __copyProps(__defProp({}, "__esModule", {
|
|
1323
1347
|
value: true
|
|
1324
1348
|
}), mod);
|
|
@@ -1326,13 +1350,13 @@ var AzzasTracker = function() {
|
|
|
1326
1350
|
// src/index.ts
|
|
1327
1351
|
var src_exports = {};
|
|
1328
1352
|
__export(src_exports, {
|
|
1329
|
-
EVENTS: function() {
|
|
1353
|
+
EVENTS: function EVENTS1() {
|
|
1330
1354
|
return EVENTS;
|
|
1331
1355
|
},
|
|
1332
|
-
default: function() {
|
|
1356
|
+
default: function _default() {
|
|
1333
1357
|
return src_default;
|
|
1334
1358
|
},
|
|
1335
|
-
trackWebEvent: function() {
|
|
1359
|
+
trackWebEvent: function trackWebEvent1() {
|
|
1336
1360
|
return trackWebEvent;
|
|
1337
1361
|
}
|
|
1338
1362
|
});
|
|
@@ -1783,16 +1807,16 @@ var AzzasTracker = function() {
|
|
|
1783
1807
|
"cart\xE3o"
|
|
1784
1808
|
]
|
|
1785
1809
|
];
|
|
1786
|
-
var toNum = function(val) {
|
|
1810
|
+
var toNum = function toNum(val) {
|
|
1787
1811
|
return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
|
|
1788
1812
|
};
|
|
1789
|
-
var setLocalStorage = function(key, value) {
|
|
1813
|
+
var setLocalStorage = function setLocalStorage(key, value) {
|
|
1790
1814
|
localStorage.setItem(key, value);
|
|
1791
1815
|
};
|
|
1792
|
-
var getLocalStorage = function(key) {
|
|
1816
|
+
var getLocalStorage = function getLocalStorage(key) {
|
|
1793
1817
|
return localStorage.getItem(key);
|
|
1794
1818
|
};
|
|
1795
|
-
var documentToHash = function(document2) {
|
|
1819
|
+
var documentToHash = function documentToHash(document2) {
|
|
1796
1820
|
return _async_to_generator(function() {
|
|
1797
1821
|
var encoder, data, hashBuffer, hashArray;
|
|
1798
1822
|
return _ts_generator(this, function(_state) {
|
|
@@ -1837,7 +1861,7 @@ var AzzasTracker = function() {
|
|
|
1837
1861
|
brand: getBrand,
|
|
1838
1862
|
items: getItems,
|
|
1839
1863
|
payment_type: getPaymentType,
|
|
1840
|
-
user_info: function(context, eventName) {
|
|
1864
|
+
user_info: function user_info(context, eventName) {
|
|
1841
1865
|
return _async_to_generator(function() {
|
|
1842
1866
|
var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, res, cpfFromStorage, hashedDocument, _;
|
|
1843
1867
|
return _ts_generator(this, function(_state) {
|
|
@@ -1968,13 +1992,13 @@ var AzzasTracker = function() {
|
|
|
1968
1992
|
});
|
|
1969
1993
|
})();
|
|
1970
1994
|
},
|
|
1971
|
-
content_type: function(context, eventName) {
|
|
1995
|
+
content_type: function content_type(context, eventName) {
|
|
1972
1996
|
return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
|
|
1973
1997
|
},
|
|
1974
|
-
region: function(context, eventName) {
|
|
1998
|
+
region: function region(context, eventName) {
|
|
1975
1999
|
return context.region || null;
|
|
1976
2000
|
},
|
|
1977
|
-
line_items: function(context, eventName) {
|
|
2001
|
+
line_items: function line_items(context, eventName) {
|
|
1978
2002
|
if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
|
|
1979
2003
|
if (context === null || context === void 0 ? void 0 : context.item) {
|
|
1980
2004
|
return [
|
|
@@ -1990,7 +2014,7 @@ var AzzasTracker = function() {
|
|
|
1990
2014
|
return item.productId;
|
|
1991
2015
|
}).join(",");
|
|
1992
2016
|
},
|
|
1993
|
-
currency: function(context, eventName) {
|
|
2017
|
+
currency: function currency(context, eventName) {
|
|
1994
2018
|
var _context_orderForm_storePreferencesData, _context_orderForm;
|
|
1995
2019
|
if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
|
|
1996
2020
|
if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
|
|
@@ -2000,12 +2024,12 @@ var AzzasTracker = function() {
|
|
|
2000
2024
|
}
|
|
2001
2025
|
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;
|
|
2002
2026
|
},
|
|
2003
|
-
value: function(context, eventName) {
|
|
2027
|
+
value: function value(context, eventName) {
|
|
2004
2028
|
var _context_item, _context_orderForm;
|
|
2005
2029
|
if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
|
|
2006
2030
|
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;
|
|
2007
2031
|
},
|
|
2008
|
-
total_discount: function(context, eventName) {
|
|
2032
|
+
total_discount: function total_discount(context, eventName) {
|
|
2009
2033
|
var _context_orderForm, _context_orderForm1;
|
|
2010
2034
|
if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
|
|
2011
2035
|
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) || [];
|
|
@@ -2019,7 +2043,7 @@ var AzzasTracker = function() {
|
|
|
2019
2043
|
});
|
|
2020
2044
|
return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
|
|
2021
2045
|
},
|
|
2022
|
-
subtotal: function(context, eventName) {
|
|
2046
|
+
subtotal: function subtotal(context, eventName) {
|
|
2023
2047
|
var _context_orderForm, _context_orderForm1;
|
|
2024
2048
|
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) || [];
|
|
2025
2049
|
var subtotal = totalsList.filter(function(t) {
|
|
@@ -2029,7 +2053,7 @@ var AzzasTracker = function() {
|
|
|
2029
2053
|
}, 0) / 100 || 0;
|
|
2030
2054
|
return subtotal;
|
|
2031
2055
|
},
|
|
2032
|
-
coupon_message: function(context, eventName) {
|
|
2056
|
+
coupon_message: function coupon_message(context, eventName) {
|
|
2033
2057
|
var _context_orderForm;
|
|
2034
2058
|
if (context.couponMessage) return context.couponMessage;
|
|
2035
2059
|
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
@@ -2042,44 +2066,44 @@ var AzzasTracker = function() {
|
|
|
2042
2066
|
return msg.text;
|
|
2043
2067
|
}).join(" | ");
|
|
2044
2068
|
},
|
|
2045
|
-
seller_cod_name: function(context, eventName) {
|
|
2069
|
+
seller_cod_name: function seller_cod_name(context, eventName) {
|
|
2046
2070
|
return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
|
|
2047
2071
|
},
|
|
2048
|
-
coupon: function(context, eventName) {
|
|
2072
|
+
coupon: function coupon(context, eventName) {
|
|
2049
2073
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
2050
2074
|
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;
|
|
2051
2075
|
},
|
|
2052
|
-
pre_filled: function(context, eventName) {
|
|
2076
|
+
pre_filled: function pre_filled(context, eventName) {
|
|
2053
2077
|
return !!context.preFilled;
|
|
2054
2078
|
},
|
|
2055
|
-
search_term: function(context, eventName) {
|
|
2079
|
+
search_term: function search_term(context, eventName) {
|
|
2056
2080
|
return context.searchTerm || null;
|
|
2057
2081
|
},
|
|
2058
|
-
search_found: function(context, eventName) {
|
|
2082
|
+
search_found: function search_found(context, eventName) {
|
|
2059
2083
|
return !!context.searchFound;
|
|
2060
2084
|
},
|
|
2061
|
-
search_quantity: function(context, eventName) {
|
|
2085
|
+
search_quantity: function search_quantity(context, eventName) {
|
|
2062
2086
|
return context.searchQuantity || 0;
|
|
2063
2087
|
},
|
|
2064
|
-
promotion_name: function(context, eventName) {
|
|
2088
|
+
promotion_name: function promotion_name(context, eventName) {
|
|
2065
2089
|
return context.promotionName || null;
|
|
2066
2090
|
},
|
|
2067
|
-
creative_name: function(context, eventName) {
|
|
2091
|
+
creative_name: function creative_name(context, eventName) {
|
|
2068
2092
|
return context.creativeName || null;
|
|
2069
2093
|
},
|
|
2070
|
-
creative_slot: function(context, eventName) {
|
|
2094
|
+
creative_slot: function creative_slot(context, eventName) {
|
|
2071
2095
|
return context.creativeSlot || null;
|
|
2072
2096
|
},
|
|
2073
|
-
zipcode: function(context, eventName) {
|
|
2097
|
+
zipcode: function zipcode(context, eventName) {
|
|
2074
2098
|
return context.zipCode || null;
|
|
2075
2099
|
},
|
|
2076
|
-
size: function(context, eventName) {
|
|
2100
|
+
size: function size(context, eventName) {
|
|
2077
2101
|
return context.size || null;
|
|
2078
2102
|
},
|
|
2079
|
-
item_ref: function(context, eventName) {
|
|
2103
|
+
item_ref: function item_ref(context, eventName) {
|
|
2080
2104
|
return context.itemRef || null;
|
|
2081
2105
|
},
|
|
2082
|
-
flag_pickup: function(context, eventName) {
|
|
2106
|
+
flag_pickup: function flag_pickup(context, eventName) {
|
|
2083
2107
|
var _orderForm_shippingData;
|
|
2084
2108
|
var orderForm = context.orderForm;
|
|
2085
2109
|
if (!orderForm) return null;
|
|
@@ -2092,7 +2116,7 @@ var AzzasTracker = function() {
|
|
|
2092
2116
|
});
|
|
2093
2117
|
return hasPickup;
|
|
2094
2118
|
},
|
|
2095
|
-
shippings: function(context, eventName) {
|
|
2119
|
+
shippings: function shippings(context, eventName) {
|
|
2096
2120
|
var orderForm = context.orderForm;
|
|
2097
2121
|
if (!orderForm) return null;
|
|
2098
2122
|
var groupShipping = {};
|
|
@@ -2156,7 +2180,7 @@ var AzzasTracker = function() {
|
|
|
2156
2180
|
});
|
|
2157
2181
|
return shippings || null;
|
|
2158
2182
|
},
|
|
2159
|
-
shipping: function(context, eventName) {
|
|
2183
|
+
shipping: function shipping(context, eventName) {
|
|
2160
2184
|
var _ref;
|
|
2161
2185
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2162
2186
|
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 : [];
|
|
@@ -2169,7 +2193,7 @@ var AzzasTracker = function() {
|
|
|
2169
2193
|
return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
|
|
2170
2194
|
}, 0);
|
|
2171
2195
|
},
|
|
2172
|
-
shipping_tier: function(context, eventName) {
|
|
2196
|
+
shipping_tier: function shipping_tier(context, eventName) {
|
|
2173
2197
|
var _ref;
|
|
2174
2198
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2175
2199
|
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 : [];
|
|
@@ -2204,11 +2228,11 @@ var AzzasTracker = function() {
|
|
|
2204
2228
|
}).filter(Boolean).join(", ");
|
|
2205
2229
|
return shippingTier || null;
|
|
2206
2230
|
},
|
|
2207
|
-
transaction_id: function(context, eventName) {
|
|
2231
|
+
transaction_id: function transaction_id(context, eventName) {
|
|
2208
2232
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
2209
2233
|
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;
|
|
2210
2234
|
},
|
|
2211
|
-
available_grid: function(context, eventName) {
|
|
2235
|
+
available_grid: function available_grid(context, eventName) {
|
|
2212
2236
|
return context.availableGrid || null;
|
|
2213
2237
|
}
|
|
2214
2238
|
};
|
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.85",
|
|
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
|
+
}
|