@azzas/azzas-tracker-web 1.0.85 → 1.0.86

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.
@@ -538,10 +538,6 @@ var AzzasTracker = function() {
538
538
  };
539
539
  var getItemCategory = function getItemCategory(item) {
540
540
  var strategies = [
541
- function() {
542
- var _item_productCategories;
543
- return (item === null || item === void 0 ? void 0 : (_item_productCategories = item.productCategories) === null || _item_productCategories === void 0 ? void 0 : _item_productCategories["39"]) === "BAZAR" ? "Sale" : "Cole\xE7\xE3o";
544
- },
545
541
  function() {
546
542
  return item === null || item === void 0 ? void 0 : item.item_category;
547
543
  },
@@ -551,6 +547,10 @@ var AzzasTracker = function() {
551
547
  function() {
552
548
  return item === null || item === void 0 ? void 0 : item.categories[0];
553
549
  },
550
+ function() {
551
+ var _item_productCategories;
552
+ return (item === null || item === void 0 ? void 0 : (_item_productCategories = item.productCategories) === null || _item_productCategories === void 0 ? void 0 : _item_productCategories["39"]) === "BAZAR" ? "Sale" : "Cole\xE7\xE3o";
553
+ },
554
554
  function() {
555
555
  var _item_itemOffered_breadcrumbList, _item_itemOffered;
556
556
  var breadcrumb = item === null || item === void 0 ? void 0 : (_item_itemOffered = item.itemOffered) === null || _item_itemOffered === void 0 ? void 0 : (_item_itemOffered_breadcrumbList = _item_itemOffered.breadcrumbList) === null || _item_itemOffered_breadcrumbList === void 0 ? void 0 : _item_itemOffered_breadcrumbList.itemListElement;
@@ -570,7 +570,7 @@ var AzzasTracker = function() {
570
570
  var getValue = _step.value;
571
571
  var value = getValue();
572
572
  if (value !== null && value !== void 0) {
573
- return value;
573
+ return value.toLowerCase();
574
574
  }
575
575
  }
576
576
  } catch (err) {
@@ -1305,20 +1305,20 @@ var AzzasTracker = function() {
1305
1305
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1306
1306
  var __getOwnPropNames = Object.getOwnPropertyNames;
1307
1307
  var __hasOwnProp = Object.prototype.hasOwnProperty;
1308
- var __export = function __export(target, all) {
1308
+ var __export = function(target, all) {
1309
1309
  for(var name in all)__defProp(target, name, {
1310
1310
  get: all[name],
1311
1311
  enumerable: true
1312
1312
  });
1313
1313
  };
1314
- var __copyProps = function __copyProps(to, from, except, desc) {
1314
+ var __copyProps = function(to, from, except, desc) {
1315
1315
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1316
1316
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1317
1317
  try {
1318
1318
  var _loop = function() {
1319
1319
  var key = _step.value;
1320
1320
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
1321
- get: function get() {
1321
+ get: function() {
1322
1322
  return from[key];
1323
1323
  },
1324
1324
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -1342,7 +1342,7 @@ var AzzasTracker = function() {
1342
1342
  }
1343
1343
  return to;
1344
1344
  };
1345
- var __toCommonJS = function __toCommonJS(mod) {
1345
+ var __toCommonJS = function(mod) {
1346
1346
  return __copyProps(__defProp({}, "__esModule", {
1347
1347
  value: true
1348
1348
  }), mod);
@@ -1350,13 +1350,13 @@ var AzzasTracker = function() {
1350
1350
  // src/index.ts
1351
1351
  var src_exports = {};
1352
1352
  __export(src_exports, {
1353
- EVENTS: function EVENTS1() {
1353
+ EVENTS: function() {
1354
1354
  return EVENTS;
1355
1355
  },
1356
- default: function _default() {
1356
+ default: function() {
1357
1357
  return src_default;
1358
1358
  },
1359
- trackWebEvent: function trackWebEvent1() {
1359
+ trackWebEvent: function() {
1360
1360
  return trackWebEvent;
1361
1361
  }
1362
1362
  });
@@ -1807,16 +1807,16 @@ var AzzasTracker = function() {
1807
1807
  "cart\xE3o"
1808
1808
  ]
1809
1809
  ];
1810
- var toNum = function toNum(val) {
1810
+ var toNum = function(val) {
1811
1811
  return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
1812
1812
  };
1813
- var setLocalStorage = function setLocalStorage(key, value) {
1813
+ var setLocalStorage = function(key, value) {
1814
1814
  localStorage.setItem(key, value);
1815
1815
  };
1816
- var getLocalStorage = function getLocalStorage(key) {
1816
+ var getLocalStorage = function(key) {
1817
1817
  return localStorage.getItem(key);
1818
1818
  };
1819
- var documentToHash = function documentToHash(document2) {
1819
+ var documentToHash = function(document2) {
1820
1820
  return _async_to_generator(function() {
1821
1821
  var encoder, data, hashBuffer, hashArray;
1822
1822
  return _ts_generator(this, function(_state) {
@@ -1861,7 +1861,7 @@ var AzzasTracker = function() {
1861
1861
  brand: getBrand,
1862
1862
  items: getItems,
1863
1863
  payment_type: getPaymentType,
1864
- user_info: function user_info(context, eventName) {
1864
+ user_info: function(context, eventName) {
1865
1865
  return _async_to_generator(function() {
1866
1866
  var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, res, cpfFromStorage, hashedDocument, _;
1867
1867
  return _ts_generator(this, function(_state) {
@@ -1992,13 +1992,13 @@ var AzzasTracker = function() {
1992
1992
  });
1993
1993
  })();
1994
1994
  },
1995
- content_type: function content_type(context, eventName) {
1995
+ content_type: function(context, eventName) {
1996
1996
  return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
1997
1997
  },
1998
- region: function region(context, eventName) {
1998
+ region: function(context, eventName) {
1999
1999
  return context.region || null;
2000
2000
  },
2001
- line_items: function line_items(context, eventName) {
2001
+ line_items: function(context, eventName) {
2002
2002
  if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
2003
2003
  if (context === null || context === void 0 ? void 0 : context.item) {
2004
2004
  return [
@@ -2014,7 +2014,7 @@ var AzzasTracker = function() {
2014
2014
  return item.productId;
2015
2015
  }).join(",");
2016
2016
  },
2017
- currency: function currency(context, eventName) {
2017
+ currency: function(context, eventName) {
2018
2018
  var _context_orderForm_storePreferencesData, _context_orderForm;
2019
2019
  if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
2020
2020
  if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
@@ -2024,12 +2024,12 @@ var AzzasTracker = function() {
2024
2024
  }
2025
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;
2026
2026
  },
2027
- value: function value(context, eventName) {
2027
+ value: function(context, eventName) {
2028
2028
  var _context_item, _context_orderForm;
2029
2029
  if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
2030
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;
2031
2031
  },
2032
- total_discount: function total_discount(context, eventName) {
2032
+ total_discount: function(context, eventName) {
2033
2033
  var _context_orderForm, _context_orderForm1;
2034
2034
  if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
2035
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) || [];
@@ -2043,7 +2043,7 @@ var AzzasTracker = function() {
2043
2043
  });
2044
2044
  return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
2045
2045
  },
2046
- subtotal: function subtotal(context, eventName) {
2046
+ subtotal: function(context, eventName) {
2047
2047
  var _context_orderForm, _context_orderForm1;
2048
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) || [];
2049
2049
  var subtotal = totalsList.filter(function(t) {
@@ -2053,7 +2053,7 @@ var AzzasTracker = function() {
2053
2053
  }, 0) / 100 || 0;
2054
2054
  return subtotal;
2055
2055
  },
2056
- coupon_message: function coupon_message(context, eventName) {
2056
+ coupon_message: function(context, eventName) {
2057
2057
  var _context_orderForm;
2058
2058
  if (context.couponMessage) return context.couponMessage;
2059
2059
  var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
@@ -2066,44 +2066,44 @@ var AzzasTracker = function() {
2066
2066
  return msg.text;
2067
2067
  }).join(" | ");
2068
2068
  },
2069
- seller_cod_name: function seller_cod_name(context, eventName) {
2069
+ seller_cod_name: function(context, eventName) {
2070
2070
  return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
2071
2071
  },
2072
- coupon: function coupon(context, eventName) {
2072
+ coupon: function(context, eventName) {
2073
2073
  var _context_orderForm_marketingData, _context_orderForm;
2074
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;
2075
2075
  },
2076
- pre_filled: function pre_filled(context, eventName) {
2076
+ pre_filled: function(context, eventName) {
2077
2077
  return !!context.preFilled;
2078
2078
  },
2079
- search_term: function search_term(context, eventName) {
2079
+ search_term: function(context, eventName) {
2080
2080
  return context.searchTerm || null;
2081
2081
  },
2082
- search_found: function search_found(context, eventName) {
2082
+ search_found: function(context, eventName) {
2083
2083
  return !!context.searchFound;
2084
2084
  },
2085
- search_quantity: function search_quantity(context, eventName) {
2085
+ search_quantity: function(context, eventName) {
2086
2086
  return context.searchQuantity || 0;
2087
2087
  },
2088
- promotion_name: function promotion_name(context, eventName) {
2088
+ promotion_name: function(context, eventName) {
2089
2089
  return context.promotionName || null;
2090
2090
  },
2091
- creative_name: function creative_name(context, eventName) {
2091
+ creative_name: function(context, eventName) {
2092
2092
  return context.creativeName || null;
2093
2093
  },
2094
- creative_slot: function creative_slot(context, eventName) {
2094
+ creative_slot: function(context, eventName) {
2095
2095
  return context.creativeSlot || null;
2096
2096
  },
2097
- zipcode: function zipcode(context, eventName) {
2097
+ zipcode: function(context, eventName) {
2098
2098
  return context.zipCode || null;
2099
2099
  },
2100
- size: function size(context, eventName) {
2100
+ size: function(context, eventName) {
2101
2101
  return context.size || null;
2102
2102
  },
2103
- item_ref: function item_ref(context, eventName) {
2103
+ item_ref: function(context, eventName) {
2104
2104
  return context.itemRef || null;
2105
2105
  },
2106
- flag_pickup: function flag_pickup(context, eventName) {
2106
+ flag_pickup: function(context, eventName) {
2107
2107
  var _orderForm_shippingData;
2108
2108
  var orderForm = context.orderForm;
2109
2109
  if (!orderForm) return null;
@@ -2116,7 +2116,7 @@ var AzzasTracker = function() {
2116
2116
  });
2117
2117
  return hasPickup;
2118
2118
  },
2119
- shippings: function shippings(context, eventName) {
2119
+ shippings: function(context, eventName) {
2120
2120
  var orderForm = context.orderForm;
2121
2121
  if (!orderForm) return null;
2122
2122
  var groupShipping = {};
@@ -2180,7 +2180,7 @@ var AzzasTracker = function() {
2180
2180
  });
2181
2181
  return shippings || null;
2182
2182
  },
2183
- shipping: function shipping(context, eventName) {
2183
+ shipping: function(context, eventName) {
2184
2184
  var _ref;
2185
2185
  var _context_orderForm_shippingData, _context_orderForm;
2186
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 : [];
@@ -2193,7 +2193,7 @@ var AzzasTracker = function() {
2193
2193
  return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
2194
2194
  }, 0);
2195
2195
  },
2196
- shipping_tier: function shipping_tier(context, eventName) {
2196
+ shipping_tier: function(context, eventName) {
2197
2197
  var _ref;
2198
2198
  var _context_orderForm_shippingData, _context_orderForm;
2199
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 : [];
@@ -2228,11 +2228,11 @@ var AzzasTracker = function() {
2228
2228
  }).filter(Boolean).join(", ");
2229
2229
  return shippingTier || null;
2230
2230
  },
2231
- transaction_id: function transaction_id(context, eventName) {
2231
+ transaction_id: function(context, eventName) {
2232
2232
  var _context_orderForm_orderGroup, _context_orderForm;
2233
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;
2234
2234
  },
2235
- available_grid: function available_grid(context, eventName) {
2235
+ available_grid: function(context, eventName) {
2236
2236
  return context.availableGrid || null;
2237
2237
  }
2238
2238
  };
package/package.json CHANGED
@@ -1,38 +1,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
- }
1
+ {
2
+ "name": "@azzas/azzas-tracker-web",
3
+ "version": "1.0.86",
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
+ }