@azzas/azzas-tracker-web 1.0.83 → 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 +59 -33
- 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 +59 -33
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +59 -33
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +119 -93
- 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,10 +885,64 @@ 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() {
|
|
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,
|
|
945
|
+
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, _split_, _item_itemAttributes, _split_1, _this, item, orderForm, itemListName, resolvedListName, resolvedItemId, _tmp, _tmp1;
|
|
922
946
|
return _ts_generator(this, function(_state) {
|
|
923
947
|
switch(_state.label){
|
|
924
948
|
case 0:
|
|
@@ -961,7 +985,9 @@ var AzzasTracker = function() {
|
|
|
961
985
|
return [
|
|
962
986
|
2,
|
|
963
987
|
[
|
|
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
|
|
988
|
+
(_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?.skuName || item?.item_variant || item?.name || item?.itemOffered.name).split(/[-/]/)[0].trim() || null,
|
|
989
|
+
item_variant = ((_split_ = ((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]) === null || _split_ === void 0 ? void 0 : _split_.trim()) || null, _tmp.// item_variant2: item?.size || item?.itemAttributes?.size || (item?.skuName || item?.name || item?.itemOffered.name)?.split(/[-/]/).pop()?.trim() || null,
|
|
990
|
+
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_1 = _this.split(" - ")[1]) === null || _split_1 === void 0 ? void 0 : _split_1.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
|
|
965
991
|
image_url = resizeVtexImage(item === null || item === void 0 ? void 0 : item.image) || resizeVtexImage(item === null || item === void 0 ? void 0 : item.imageUrl) || null, _tmp)
|
|
966
992
|
]
|
|
967
993
|
];
|
|
@@ -1279,20 +1305,20 @@ var AzzasTracker = function() {
|
|
|
1279
1305
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
1280
1306
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
1281
1307
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
1282
|
-
var __export = function(target, all) {
|
|
1308
|
+
var __export = function __export(target, all) {
|
|
1283
1309
|
for(var name in all)__defProp(target, name, {
|
|
1284
1310
|
get: all[name],
|
|
1285
1311
|
enumerable: true
|
|
1286
1312
|
});
|
|
1287
1313
|
};
|
|
1288
|
-
var __copyProps = function(to, from, except, desc) {
|
|
1314
|
+
var __copyProps = function __copyProps(to, from, except, desc) {
|
|
1289
1315
|
if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
|
|
1290
1316
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
1291
1317
|
try {
|
|
1292
1318
|
var _loop = function() {
|
|
1293
1319
|
var key = _step.value;
|
|
1294
1320
|
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
1295
|
-
get: function() {
|
|
1321
|
+
get: function get() {
|
|
1296
1322
|
return from[key];
|
|
1297
1323
|
},
|
|
1298
1324
|
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
@@ -1316,7 +1342,7 @@ var AzzasTracker = function() {
|
|
|
1316
1342
|
}
|
|
1317
1343
|
return to;
|
|
1318
1344
|
};
|
|
1319
|
-
var __toCommonJS = function(mod) {
|
|
1345
|
+
var __toCommonJS = function __toCommonJS(mod) {
|
|
1320
1346
|
return __copyProps(__defProp({}, "__esModule", {
|
|
1321
1347
|
value: true
|
|
1322
1348
|
}), mod);
|
|
@@ -1324,13 +1350,13 @@ var AzzasTracker = function() {
|
|
|
1324
1350
|
// src/index.ts
|
|
1325
1351
|
var src_exports = {};
|
|
1326
1352
|
__export(src_exports, {
|
|
1327
|
-
EVENTS: function() {
|
|
1353
|
+
EVENTS: function EVENTS1() {
|
|
1328
1354
|
return EVENTS;
|
|
1329
1355
|
},
|
|
1330
|
-
default: function() {
|
|
1356
|
+
default: function _default() {
|
|
1331
1357
|
return src_default;
|
|
1332
1358
|
},
|
|
1333
|
-
trackWebEvent: function() {
|
|
1359
|
+
trackWebEvent: function trackWebEvent1() {
|
|
1334
1360
|
return trackWebEvent;
|
|
1335
1361
|
}
|
|
1336
1362
|
});
|
|
@@ -1781,16 +1807,16 @@ var AzzasTracker = function() {
|
|
|
1781
1807
|
"cart\xE3o"
|
|
1782
1808
|
]
|
|
1783
1809
|
];
|
|
1784
|
-
var toNum = function(val) {
|
|
1810
|
+
var toNum = function toNum(val) {
|
|
1785
1811
|
return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
|
|
1786
1812
|
};
|
|
1787
|
-
var setLocalStorage = function(key, value) {
|
|
1813
|
+
var setLocalStorage = function setLocalStorage(key, value) {
|
|
1788
1814
|
localStorage.setItem(key, value);
|
|
1789
1815
|
};
|
|
1790
|
-
var getLocalStorage = function(key) {
|
|
1816
|
+
var getLocalStorage = function getLocalStorage(key) {
|
|
1791
1817
|
return localStorage.getItem(key);
|
|
1792
1818
|
};
|
|
1793
|
-
var documentToHash = function(document2) {
|
|
1819
|
+
var documentToHash = function documentToHash(document2) {
|
|
1794
1820
|
return _async_to_generator(function() {
|
|
1795
1821
|
var encoder, data, hashBuffer, hashArray;
|
|
1796
1822
|
return _ts_generator(this, function(_state) {
|
|
@@ -1835,7 +1861,7 @@ var AzzasTracker = function() {
|
|
|
1835
1861
|
brand: getBrand,
|
|
1836
1862
|
items: getItems,
|
|
1837
1863
|
payment_type: getPaymentType,
|
|
1838
|
-
user_info: function(context, eventName) {
|
|
1864
|
+
user_info: function user_info(context, eventName) {
|
|
1839
1865
|
return _async_to_generator(function() {
|
|
1840
1866
|
var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, res, cpfFromStorage, hashedDocument, _;
|
|
1841
1867
|
return _ts_generator(this, function(_state) {
|
|
@@ -1966,13 +1992,13 @@ var AzzasTracker = function() {
|
|
|
1966
1992
|
});
|
|
1967
1993
|
})();
|
|
1968
1994
|
},
|
|
1969
|
-
content_type: function(context, eventName) {
|
|
1995
|
+
content_type: function content_type(context, eventName) {
|
|
1970
1996
|
return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
|
|
1971
1997
|
},
|
|
1972
|
-
region: function(context, eventName) {
|
|
1998
|
+
region: function region(context, eventName) {
|
|
1973
1999
|
return context.region || null;
|
|
1974
2000
|
},
|
|
1975
|
-
line_items: function(context, eventName) {
|
|
2001
|
+
line_items: function line_items(context, eventName) {
|
|
1976
2002
|
if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
|
|
1977
2003
|
if (context === null || context === void 0 ? void 0 : context.item) {
|
|
1978
2004
|
return [
|
|
@@ -1988,7 +2014,7 @@ var AzzasTracker = function() {
|
|
|
1988
2014
|
return item.productId;
|
|
1989
2015
|
}).join(",");
|
|
1990
2016
|
},
|
|
1991
|
-
currency: function(context, eventName) {
|
|
2017
|
+
currency: function currency(context, eventName) {
|
|
1992
2018
|
var _context_orderForm_storePreferencesData, _context_orderForm;
|
|
1993
2019
|
if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
|
|
1994
2020
|
if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
|
|
@@ -1998,12 +2024,12 @@ var AzzasTracker = function() {
|
|
|
1998
2024
|
}
|
|
1999
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;
|
|
2000
2026
|
},
|
|
2001
|
-
value: function(context, eventName) {
|
|
2027
|
+
value: function value(context, eventName) {
|
|
2002
2028
|
var _context_item, _context_orderForm;
|
|
2003
2029
|
if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
|
|
2004
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;
|
|
2005
2031
|
},
|
|
2006
|
-
total_discount: function(context, eventName) {
|
|
2032
|
+
total_discount: function total_discount(context, eventName) {
|
|
2007
2033
|
var _context_orderForm, _context_orderForm1;
|
|
2008
2034
|
if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
|
|
2009
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) || [];
|
|
@@ -2017,7 +2043,7 @@ var AzzasTracker = function() {
|
|
|
2017
2043
|
});
|
|
2018
2044
|
return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
|
|
2019
2045
|
},
|
|
2020
|
-
subtotal: function(context, eventName) {
|
|
2046
|
+
subtotal: function subtotal(context, eventName) {
|
|
2021
2047
|
var _context_orderForm, _context_orderForm1;
|
|
2022
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) || [];
|
|
2023
2049
|
var subtotal = totalsList.filter(function(t) {
|
|
@@ -2027,7 +2053,7 @@ var AzzasTracker = function() {
|
|
|
2027
2053
|
}, 0) / 100 || 0;
|
|
2028
2054
|
return subtotal;
|
|
2029
2055
|
},
|
|
2030
|
-
coupon_message: function(context, eventName) {
|
|
2056
|
+
coupon_message: function coupon_message(context, eventName) {
|
|
2031
2057
|
var _context_orderForm;
|
|
2032
2058
|
if (context.couponMessage) return context.couponMessage;
|
|
2033
2059
|
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
@@ -2040,44 +2066,44 @@ var AzzasTracker = function() {
|
|
|
2040
2066
|
return msg.text;
|
|
2041
2067
|
}).join(" | ");
|
|
2042
2068
|
},
|
|
2043
|
-
seller_cod_name: function(context, eventName) {
|
|
2069
|
+
seller_cod_name: function seller_cod_name(context, eventName) {
|
|
2044
2070
|
return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
|
|
2045
2071
|
},
|
|
2046
|
-
coupon: function(context, eventName) {
|
|
2072
|
+
coupon: function coupon(context, eventName) {
|
|
2047
2073
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
2048
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;
|
|
2049
2075
|
},
|
|
2050
|
-
pre_filled: function(context, eventName) {
|
|
2076
|
+
pre_filled: function pre_filled(context, eventName) {
|
|
2051
2077
|
return !!context.preFilled;
|
|
2052
2078
|
},
|
|
2053
|
-
search_term: function(context, eventName) {
|
|
2079
|
+
search_term: function search_term(context, eventName) {
|
|
2054
2080
|
return context.searchTerm || null;
|
|
2055
2081
|
},
|
|
2056
|
-
search_found: function(context, eventName) {
|
|
2082
|
+
search_found: function search_found(context, eventName) {
|
|
2057
2083
|
return !!context.searchFound;
|
|
2058
2084
|
},
|
|
2059
|
-
search_quantity: function(context, eventName) {
|
|
2085
|
+
search_quantity: function search_quantity(context, eventName) {
|
|
2060
2086
|
return context.searchQuantity || 0;
|
|
2061
2087
|
},
|
|
2062
|
-
promotion_name: function(context, eventName) {
|
|
2088
|
+
promotion_name: function promotion_name(context, eventName) {
|
|
2063
2089
|
return context.promotionName || null;
|
|
2064
2090
|
},
|
|
2065
|
-
creative_name: function(context, eventName) {
|
|
2091
|
+
creative_name: function creative_name(context, eventName) {
|
|
2066
2092
|
return context.creativeName || null;
|
|
2067
2093
|
},
|
|
2068
|
-
creative_slot: function(context, eventName) {
|
|
2094
|
+
creative_slot: function creative_slot(context, eventName) {
|
|
2069
2095
|
return context.creativeSlot || null;
|
|
2070
2096
|
},
|
|
2071
|
-
zipcode: function(context, eventName) {
|
|
2097
|
+
zipcode: function zipcode(context, eventName) {
|
|
2072
2098
|
return context.zipCode || null;
|
|
2073
2099
|
},
|
|
2074
|
-
size: function(context, eventName) {
|
|
2100
|
+
size: function size(context, eventName) {
|
|
2075
2101
|
return context.size || null;
|
|
2076
2102
|
},
|
|
2077
|
-
item_ref: function(context, eventName) {
|
|
2103
|
+
item_ref: function item_ref(context, eventName) {
|
|
2078
2104
|
return context.itemRef || null;
|
|
2079
2105
|
},
|
|
2080
|
-
flag_pickup: function(context, eventName) {
|
|
2106
|
+
flag_pickup: function flag_pickup(context, eventName) {
|
|
2081
2107
|
var _orderForm_shippingData;
|
|
2082
2108
|
var orderForm = context.orderForm;
|
|
2083
2109
|
if (!orderForm) return null;
|
|
@@ -2090,7 +2116,7 @@ var AzzasTracker = function() {
|
|
|
2090
2116
|
});
|
|
2091
2117
|
return hasPickup;
|
|
2092
2118
|
},
|
|
2093
|
-
shippings: function(context, eventName) {
|
|
2119
|
+
shippings: function shippings(context, eventName) {
|
|
2094
2120
|
var orderForm = context.orderForm;
|
|
2095
2121
|
if (!orderForm) return null;
|
|
2096
2122
|
var groupShipping = {};
|
|
@@ -2154,7 +2180,7 @@ var AzzasTracker = function() {
|
|
|
2154
2180
|
});
|
|
2155
2181
|
return shippings || null;
|
|
2156
2182
|
},
|
|
2157
|
-
shipping: function(context, eventName) {
|
|
2183
|
+
shipping: function shipping(context, eventName) {
|
|
2158
2184
|
var _ref;
|
|
2159
2185
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2160
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 : [];
|
|
@@ -2167,7 +2193,7 @@ var AzzasTracker = function() {
|
|
|
2167
2193
|
return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
|
|
2168
2194
|
}, 0);
|
|
2169
2195
|
},
|
|
2170
|
-
shipping_tier: function(context, eventName) {
|
|
2196
|
+
shipping_tier: function shipping_tier(context, eventName) {
|
|
2171
2197
|
var _ref;
|
|
2172
2198
|
var _context_orderForm_shippingData, _context_orderForm;
|
|
2173
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 : [];
|
|
@@ -2202,11 +2228,11 @@ var AzzasTracker = function() {
|
|
|
2202
2228
|
}).filter(Boolean).join(", ");
|
|
2203
2229
|
return shippingTier || null;
|
|
2204
2230
|
},
|
|
2205
|
-
transaction_id: function(context, eventName) {
|
|
2231
|
+
transaction_id: function transaction_id(context, eventName) {
|
|
2206
2232
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
2207
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;
|
|
2208
2234
|
},
|
|
2209
|
-
available_grid: function(context, eventName) {
|
|
2235
|
+
available_grid: function available_grid(context, eventName) {
|
|
2210
2236
|
return context.availableGrid || null;
|
|
2211
2237
|
}
|
|
2212
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
|
+
}
|