@azzas/azzas-tracker-web 1.0.71 → 1.0.73

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.
@@ -462,13 +462,58 @@ var AzzasTracker = function() {
462
462
  })();
463
463
  };
464
464
  var getDiscount = function getDiscount(item) {
465
- return item.discount || item.discount === 0 ? item.discount : parseFloat(Math.max(item.listPrice - item.sellingPrice, 0).toFixed(2)) / 100 || 0;
465
+ var strategies = [
466
+ // 1. listPrice - sellingPrice
467
+ function() {
468
+ if ((item === null || item === void 0 ? void 0 : item.listPrice) != null && (item === null || item === void 0 ? void 0 : item.sellingPrice) != null) {
469
+ var diff = Math.max(item.listPrice - item.sellingPrice, 0);
470
+ return diff ? parseFloat((diff / 100).toFixed(2)) : 0;
471
+ }
472
+ return null;
473
+ },
474
+ // 2. listPrice - price
475
+ function() {
476
+ if ((item === null || item === void 0 ? void 0 : item.listPrice) != null && (item === null || item === void 0 ? void 0 : item.price) != null) {
477
+ return Math.max(item.listPrice - item.price, 0);
478
+ }
479
+ return null;
480
+ },
481
+ // 3. desconto calculado.
482
+ function() {
483
+ return (item === null || item === void 0 ? void 0 : item.discount) || (item === null || item === void 0 ? void 0 : item.discount) === 0 ? item.discount : null;
484
+ }
485
+ ];
486
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
487
+ try {
488
+ for(var _iterator = strategies[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
489
+ var getValue = _step.value;
490
+ var value = getValue();
491
+ if (value !== null && value !== void 0) {
492
+ return value;
493
+ }
494
+ }
495
+ } catch (err) {
496
+ _didIteratorError = true;
497
+ _iteratorError = err;
498
+ } finally{
499
+ try {
500
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
501
+ _iterator.return();
502
+ }
503
+ } finally{
504
+ if (_didIteratorError) {
505
+ throw _iteratorError;
506
+ }
507
+ }
508
+ }
509
+ return 0;
466
510
  };
467
511
  var getItemCategory = function getItemCategory(item) {
468
512
  var strategies = [
469
513
  function() {
470
- var _item_productCategories;
471
- 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";
514
+ var stringCategories = ((item === null || item === void 0 ? void 0 : item.categories) || (item === null || item === void 0 ? void 0 : item.productCategories)).toString().toLowerCase();
515
+ var hasOutletSaleOrBazar = stringCategories.includes("outlet") || stringCategories.includes("sale") || stringCategories.includes("bazar");
516
+ return hasOutletSaleOrBazar ? (item === null || item === void 0 ? void 0 : item.brand) === "By NV" ? "Outlet" : "Sale" : "Cole\xE7\xE3o";
472
517
  },
473
518
  function() {
474
519
  return item === null || item === void 0 ? void 0 : item.item_category;
@@ -478,6 +523,18 @@ var AzzasTracker = function() {
478
523
  },
479
524
  function() {
480
525
  return item === null || item === void 0 ? void 0 : item.categories[0];
526
+ },
527
+ function() {
528
+ var _item_itemOffered_breadcrumbList, _item_itemOffered;
529
+ 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;
530
+ if (!Array.isArray(breadcrumb)) return null;
531
+ var level1 = breadcrumb.find(function(el) {
532
+ var path = el === null || el === void 0 ? void 0 : el.item;
533
+ if (!path) return false;
534
+ var parts = path.replace(/^\/|\/$/g, "").split("/");
535
+ return parts.length === 1;
536
+ });
537
+ return (level1 === null || level1 === void 0 ? void 0 : level1.name) || null;
481
538
  }
482
539
  ];
483
540
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -512,10 +569,8 @@ var AzzasTracker = function() {
512
569
  },
513
570
  // checkout select_item context
514
571
  function() {
515
- var _Object_values_pop;
516
- return (_Object_values_pop = Object.values((item === null || item === void 0 ? void 0 : item.categories) || {}).pop()) === null || _Object_values_pop === void 0 ? void 0 : _Object_values_pop.slice(1, -1).replace(/\//g, ",");
572
+ return Object.values((item === null || item === void 0 ? void 0 : item.categories) || {}).pop();
517
573
  },
518
- //
519
574
  function() {
520
575
  var _item_category_split__trim, _item_category_split_, _item_category_split, _item_category_split1, _item_category;
521
576
  return item === null || item === void 0 ? void 0 : (_item_category = item.category) === null || _item_category === void 0 ? void 0 : (_item_category_split1 = _item_category.split) === null || _item_category_split1 === void 0 ? void 0 : (_item_category_split = _item_category_split1.call(_item_category, ">")) === null || _item_category_split === void 0 ? void 0 : (_item_category_split_ = _item_category_split[1]) === null || _item_category_split_ === void 0 ? void 0 : (_item_category_split__trim = _item_category_split_.trim) === null || _item_category_split__trim === void 0 ? void 0 : _item_category_split__trim.call(_item_category_split_);
@@ -523,6 +578,10 @@ var AzzasTracker = function() {
523
578
  // deco select_item context
524
579
  function() {
525
580
  return item.item_category2;
581
+ },
582
+ // deco add_to_cart context PDP
583
+ function() {
584
+ return item === null || item === void 0 ? void 0 : item.subGrup;
526
585
  }
527
586
  ];
528
587
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
@@ -679,7 +738,7 @@ var AzzasTracker = function() {
679
738
  var itemsFromItem = // src/params/resolvers/items/fromItem.ts
680
739
  function itemsFromItem(context, event) {
681
740
  return _async_to_generator(function() {
682
- var _item_additionalProperty, _item_additionalInfo, _item_brand, _item_itemAttributes, _split_pop, _this, item, orderForm, itemListName, _tmp, _tmp1;
741
+ var _item_additionalProperty, _item_itemOffered, _item_itemOffered1, _item_additionalInfo, _item_brand, _item_itemOffered_brand, _item_itemOffered2, _item_itemOffered3, _item_itemOffered_isVariantOf, _item_itemOffered4, _item_itemAttributes, _split_pop, _this, item, orderForm, itemListName, _tmp, _tmp1;
683
742
  return _ts_generator(this, function(_state) {
684
743
  switch(_state.label){
685
744
  case 0:
@@ -687,17 +746,17 @@ var AzzasTracker = function() {
687
746
  _tmp = {
688
747
  index: typeof (item === null || item === void 0 ? void 0 : item.index) === "number" ? item.index : null,
689
748
  quantity: 1,
690
- item_id: (item === null || item === void 0 ? void 0 : item.productId) || (item === null || item === void 0 ? void 0 : item.item_group_id) || (item === null || item === void 0 ? void 0 : item.sku) || null,
749
+ item_id: (item === null || item === void 0 ? void 0 : item.productId) || (item === null || item === void 0 ? void 0 : item.item_group_id) || (item === null || item === void 0 ? void 0 : item.sku) || (item === null || item === void 0 ? void 0 : item.id) || null,
691
750
  item_category2: getItemCategory2(item),
692
751
  item_category4: getItemCategory4(item),
693
752
  item_shipping_tier: event === "REMOVE_FROM_CART" ? getItemShippingTier(orderForm, item) : null,
694
753
  price: (item === null || item === void 0 ? void 0 : item.listPrice) || (item === null || item === void 0 ? void 0 : item.price) || 0,
695
754
  item_ref: (item === null || item === void 0 ? void 0 : item.ref) || (item === null || item === void 0 ? void 0 : item.refId) || (item === null || item === void 0 ? void 0 : item.item_ref) || (item === null || item === void 0 ? void 0 : (_item_additionalProperty = item.additionalProperty) === null || _item_additionalProperty === void 0 ? void 0 : _item_additionalProperty.find(function(i) {
696
755
  return i.name === "RefId";
697
- }).value) || null,
698
- item_brand: (item === null || item === void 0 ? void 0 : (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) || (item === null || item === void 0 ? void 0 : item.item_brand) || (item === null || item === void 0 ? void 0 : (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : _item_brand.name) || null
756
+ }).value) || (item === null || item === void 0 ? void 0 : (_item_itemOffered1 = item.itemOffered) === null || _item_itemOffered1 === void 0 ? void 0 : _item_itemOffered1.gtin.substring(0, item === null || item === void 0 ? void 0 : (_item_itemOffered = item.itemOffered) === null || _item_itemOffered === void 0 ? void 0 : _item_itemOffered.gtin.lastIndexOf("_"))) || null,
757
+ item_brand: (item === null || item === void 0 ? void 0 : (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) || (item === null || item === void 0 ? void 0 : item.item_brand) || (item === null || item === void 0 ? void 0 : (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : _item_brand.name) || (item === null || item === void 0 ? void 0 : (_item_itemOffered2 = item.itemOffered) === null || _item_itemOffered2 === void 0 ? void 0 : (_item_itemOffered_brand = _item_itemOffered2.brand) === null || _item_itemOffered_brand === void 0 ? void 0 : _item_itemOffered_brand.name) || null
699
758
  };
700
- _tmp1 = (item === null || item === void 0 ? void 0 : item.sku) || (item === null || item === void 0 ? void 0 : item.id) || (item === null || item === void 0 ? void 0 : item.item_id);
759
+ _tmp1 = (item === null || item === void 0 ? void 0 : item.sku) || (item === null || item === void 0 ? void 0 : (_item_itemOffered3 = item.itemOffered) === null || _item_itemOffered3 === void 0 ? void 0 : _item_itemOffered3.sku) || (item === null || item === void 0 ? void 0 : item.item_id) || (item === null || item === void 0 ? void 0 : item.id);
701
760
  if (_tmp1) return [
702
761
  3,
703
762
  2
@@ -713,7 +772,7 @@ var AzzasTracker = function() {
713
772
  return [
714
773
  2,
715
774
  [
716
- (_tmp.item_sku = _tmp1 || null, _tmp.item_name = (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.item_name) || 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)).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)) === 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 = itemListName || null, _tmp.item_url = (item === null || item === void 0 ? void 0 : item.item_url) || null, _tmp)
775
+ (_tmp.item_sku = _tmp1 || null, _tmp.item_name = (item === null || item === void 0 ? void 0 : item.name) || (item === null || item === void 0 ? void 0 : item.item_name) || (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) || 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 = itemListName || null, _tmp.item_url = (item === null || item === void 0 ? void 0 : item.item_url) || null, _tmp)
717
776
  ]
718
777
  ];
719
778
  }
@@ -735,7 +794,7 @@ var AzzasTracker = function() {
735
794
  return i.name === "RefId";
736
795
  }).value) || null,
737
796
  index: typeof (context === null || context === void 0 ? void 0 : context.index) === "number" ? context.index : Number(item === null || item === void 0 ? void 0 : item.index),
738
- item_brand: item.isNotFarm ? item === null || item === void 0 ? void 0 : item.item_brand : normalizeBrand(item === null || item === void 0 ? void 0 : (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : _item_brand.name) || normalizeBrand(context.brand) || normalizeBrand(item === null || item === void 0 ? void 0 : item.item_brand) || null,
797
+ item_brand: (item === null || item === void 0 ? void 0 : item.item_brand) ? item.item_brand : item.isNotFarm ? item === null || item === void 0 ? void 0 : item.item_brand : normalizeBrand(item === null || item === void 0 ? void 0 : (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : _item_brand.name) || normalizeBrand(context.brand) || normalizeBrand(item === null || item === void 0 ? void 0 : item.item_brand) || null,
739
798
  item_name: (item === null || item === void 0 ? void 0 : (_item_productName = item.productName) === null || _item_productName === void 0 ? void 0 : _item_productName.split(" - ").shift()) || (item === null || item === void 0 ? void 0 : (_item_alternateName = item.alternateName) === null || _item_alternateName === void 0 ? void 0 : _item_alternateName.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_seo = item.seo) === null || _item_seo === void 0 ? void 0 : (_item_seo_title = _item_seo.title) === null || _item_seo_title === void 0 ? void 0 : _item_seo_title.split(" - ").shift()) || null,
740
799
  item_category: getItemCategory(item) || null,
741
800
  item_variant: (item === null || item === void 0 ? void 0 : (_item_name = item.name) === null || _item_name === void 0 ? void 0 : (_item_name_split = _item_name.split("-")) === null || _item_name_split === void 0 ? void 0 : _item_name_split[0].trim()) || (item === null || item === void 0 ? void 0 : item.item_variant) || (item === null || item === void 0 ? void 0 : (_item_productName1 = item.productName) === null || _item_productName1 === void 0 ? void 0 : (_item_productName_split = _item_productName1.split("-")) === null || _item_productName_split === void 0 ? void 0 : _item_productName_split[1].trim()) || null,
@@ -1015,20 +1074,20 @@ var AzzasTracker = function() {
1015
1074
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
1016
1075
  var __getOwnPropNames = Object.getOwnPropertyNames;
1017
1076
  var __hasOwnProp = Object.prototype.hasOwnProperty;
1018
- var __export = function __export(target, all) {
1077
+ var __export = function(target, all) {
1019
1078
  for(var name in all)__defProp(target, name, {
1020
1079
  get: all[name],
1021
1080
  enumerable: true
1022
1081
  });
1023
1082
  };
1024
- var __copyProps = function __copyProps(to, from, except, desc) {
1083
+ var __copyProps = function(to, from, except, desc) {
1025
1084
  if (from && (typeof from === "undefined" ? "undefined" : _type_of(from)) === "object" || typeof from === "function") {
1026
1085
  var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1027
1086
  try {
1028
1087
  var _loop = function() {
1029
1088
  var key = _step.value;
1030
1089
  if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
1031
- get: function get() {
1090
+ get: function() {
1032
1091
  return from[key];
1033
1092
  },
1034
1093
  enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
@@ -1052,7 +1111,7 @@ var AzzasTracker = function() {
1052
1111
  }
1053
1112
  return to;
1054
1113
  };
1055
- var __toCommonJS = function __toCommonJS(mod) {
1114
+ var __toCommonJS = function(mod) {
1056
1115
  return __copyProps(__defProp({}, "__esModule", {
1057
1116
  value: true
1058
1117
  }), mod);
@@ -1060,13 +1119,13 @@ var AzzasTracker = function() {
1060
1119
  // src/index.ts
1061
1120
  var src_exports = {};
1062
1121
  __export(src_exports, {
1063
- EVENTS: function EVENTS1() {
1122
+ EVENTS: function() {
1064
1123
  return EVENTS;
1065
1124
  },
1066
- default: function _default() {
1125
+ default: function() {
1067
1126
  return src_default;
1068
1127
  },
1069
- trackWebEvent: function trackWebEvent1() {
1128
+ trackWebEvent: function() {
1070
1129
  return trackWebEvent;
1071
1130
  }
1072
1131
  });
@@ -1517,7 +1576,7 @@ var AzzasTracker = function() {
1517
1576
  "cart\xE3o"
1518
1577
  ]
1519
1578
  ];
1520
- var toNum = function toNum(val) {
1579
+ var toNum = function(val) {
1521
1580
  return typeof val === "string" ? Number(val.replace(/[^\d,]/g, "").replace(",", ".")) : val;
1522
1581
  };
1523
1582
  // src/adapters/index.ts
@@ -1535,7 +1594,7 @@ var AzzasTracker = function() {
1535
1594
  brand: getBrand,
1536
1595
  items: getItems,
1537
1596
  payment_type: getPaymentType,
1538
- user_info: function user_info(context, eventName) {
1597
+ user_info: function(context, eventName) {
1539
1598
  return _async_to_generator(function() {
1540
1599
  var _PROD_DOMAINS_, PROD_DOMAINS, domain, api, response, _;
1541
1600
  return _ts_generator(this, function(_state) {
@@ -1634,13 +1693,13 @@ var AzzasTracker = function() {
1634
1693
  });
1635
1694
  })();
1636
1695
  },
1637
- content_type: function content_type(context, eventName) {
1696
+ content_type: function(context, eventName) {
1638
1697
  return "regiao".concat(":" + context.category).concat(context.subcategory ? ":" + context.subcategory : "").concat(":" + context.componentName) || null;
1639
1698
  },
1640
- region: function region(context, eventName) {
1699
+ region: function(context, eventName) {
1641
1700
  return context.region || null;
1642
1701
  },
1643
- line_items: function line_items(context, eventName) {
1702
+ line_items: function(context, eventName) {
1644
1703
  if (context === null || context === void 0 ? void 0 : context.lineItems) return context.lineItems;
1645
1704
  if (context === null || context === void 0 ? void 0 : context.item) {
1646
1705
  return [
@@ -1656,7 +1715,7 @@ var AzzasTracker = function() {
1656
1715
  return item.productId;
1657
1716
  }).join(",");
1658
1717
  },
1659
- currency: function currency(context, eventName) {
1718
+ currency: function(context, eventName) {
1660
1719
  var _context_orderForm_storePreferencesData, _context_orderForm;
1661
1720
  if (context === null || context === void 0 ? void 0 : context.currency) return context.currency;
1662
1721
  if (context === null || context === void 0 ? void 0 : context.bannerUrl) return "BRL";
@@ -1666,12 +1725,12 @@ var AzzasTracker = function() {
1666
1725
  }
1667
1726
  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;
1668
1727
  },
1669
- value: function value(context, eventName) {
1728
+ value: function(context, eventName) {
1670
1729
  var _context_item, _context_orderForm;
1671
1730
  if (context === null || context === void 0 ? void 0 : context.value) return toNum(context.value);
1672
1731
  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;
1673
1732
  },
1674
- total_discount: function total_discount(context, eventName) {
1733
+ total_discount: function(context, eventName) {
1675
1734
  var _context_orderForm, _context_orderForm1;
1676
1735
  if (context === null || context === void 0 ? void 0 : context.totalDiscount) return context.totalDiscount;
1677
1736
  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) || [];
@@ -1685,7 +1744,7 @@ var AzzasTracker = function() {
1685
1744
  });
1686
1745
  return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
1687
1746
  },
1688
- subtotal: function subtotal(context, eventName) {
1747
+ subtotal: function(context, eventName) {
1689
1748
  var _context_orderForm, _context_orderForm1;
1690
1749
  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) || [];
1691
1750
  var subtotal = totalsList.filter(function(t) {
@@ -1695,7 +1754,7 @@ var AzzasTracker = function() {
1695
1754
  }, 0) / 100 || 0;
1696
1755
  return subtotal;
1697
1756
  },
1698
- coupon_message: function coupon_message(context, eventName) {
1757
+ coupon_message: function(context, eventName) {
1699
1758
  var _context_orderForm;
1700
1759
  if (context.couponMessage) return context.couponMessage;
1701
1760
  var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
@@ -1708,44 +1767,44 @@ var AzzasTracker = function() {
1708
1767
  return msg.text;
1709
1768
  }).join(" | ");
1710
1769
  },
1711
- seller_cod_name: function seller_cod_name(context, eventName) {
1770
+ seller_cod_name: function(context, eventName) {
1712
1771
  return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
1713
1772
  },
1714
- coupon: function coupon(context, eventName) {
1773
+ coupon: function(context, eventName) {
1715
1774
  var _context_orderForm_marketingData, _context_orderForm;
1716
1775
  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;
1717
1776
  },
1718
- pre_filled: function pre_filled(context, eventName) {
1777
+ pre_filled: function(context, eventName) {
1719
1778
  return !!context.preFilled;
1720
1779
  },
1721
- search_term: function search_term(context, eventName) {
1780
+ search_term: function(context, eventName) {
1722
1781
  return context.searchTerm || null;
1723
1782
  },
1724
- search_found: function search_found(context, eventName) {
1783
+ search_found: function(context, eventName) {
1725
1784
  return !!context.searchFound;
1726
1785
  },
1727
- search_quantity: function search_quantity(context, eventName) {
1786
+ search_quantity: function(context, eventName) {
1728
1787
  return context.searchQuantity || 0;
1729
1788
  },
1730
- promotion_name: function promotion_name(context, eventName) {
1789
+ promotion_name: function(context, eventName) {
1731
1790
  return context.promotionName || null;
1732
1791
  },
1733
- creative_name: function creative_name(context, eventName) {
1792
+ creative_name: function(context, eventName) {
1734
1793
  return context.creativeName || null;
1735
1794
  },
1736
- creative_slot: function creative_slot(context, eventName) {
1795
+ creative_slot: function(context, eventName) {
1737
1796
  return context.creativeSlot || null;
1738
1797
  },
1739
- zipcode: function zipcode(context, eventName) {
1798
+ zipcode: function(context, eventName) {
1740
1799
  return context.zipCode || null;
1741
1800
  },
1742
- size: function size(context, eventName) {
1801
+ size: function(context, eventName) {
1743
1802
  return context.size || null;
1744
1803
  },
1745
- item_ref: function item_ref(context, eventName) {
1804
+ item_ref: function(context, eventName) {
1746
1805
  return context.itemRef || null;
1747
1806
  },
1748
- flag_pickup: function flag_pickup(context, eventName) {
1807
+ flag_pickup: function(context, eventName) {
1749
1808
  var _orderForm_shippingData;
1750
1809
  var orderForm = context.orderForm;
1751
1810
  if (!orderForm) return null;
@@ -1758,7 +1817,7 @@ var AzzasTracker = function() {
1758
1817
  });
1759
1818
  return hasPickup;
1760
1819
  },
1761
- shippings: function shippings(context, eventName) {
1820
+ shippings: function(context, eventName) {
1762
1821
  var orderForm = context.orderForm;
1763
1822
  if (!orderForm) return null;
1764
1823
  var groupShipping = {};
@@ -1822,7 +1881,7 @@ var AzzasTracker = function() {
1822
1881
  });
1823
1882
  return shippings || null;
1824
1883
  },
1825
- shipping: function shipping(context, eventName) {
1884
+ shipping: function(context, eventName) {
1826
1885
  var _ref;
1827
1886
  var _context_orderForm_shippingData, _context_orderForm;
1828
1887
  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 : [];
@@ -1835,7 +1894,7 @@ var AzzasTracker = function() {
1835
1894
  return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
1836
1895
  }, 0);
1837
1896
  },
1838
- shipping_tier: function shipping_tier(context, eventName) {
1897
+ shipping_tier: function(context, eventName) {
1839
1898
  var _ref;
1840
1899
  var _context_orderForm_shippingData, _context_orderForm;
1841
1900
  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 : [];
@@ -1870,11 +1929,11 @@ var AzzasTracker = function() {
1870
1929
  }).filter(Boolean).join(", ");
1871
1930
  return shippingTier || null;
1872
1931
  },
1873
- transaction_id: function transaction_id(context, eventName) {
1932
+ transaction_id: function(context, eventName) {
1874
1933
  var _context_orderForm_orderGroup, _context_orderForm;
1875
1934
  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;
1876
1935
  },
1877
- available_grid: function available_grid(context, eventName) {
1936
+ available_grid: function(context, eventName) {
1878
1937
  return context.availableGrid || null;
1879
1938
  }
1880
1939
  };
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
- {
2
- "name": "@azzas/azzas-tracker-web",
3
- "version": "1.0.71",
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": "VERSION=$(npm pkg get version | tr -d '\"') && npm pack && tar -xzf azzas-azzas-tracker-web-$VERSION.tgz",
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.73",
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": "VERSION=$(npm pkg get version | tr -d '\"') && npm pack && tar -xzf azzas-azzas-tracker-web-$VERSION.tgz",
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
+ }