@azzas/azzas-tracker-web 2.0.1-preview.1 → 2.0.2-preview.0

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.
@@ -2090,6 +2090,7 @@ var AzzasTracker = function() {
2090
2090
  "M",
2091
2091
  "G",
2092
2092
  "GG",
2093
+ "GGG",
2093
2094
  "XG",
2094
2095
  "XGG",
2095
2096
  "EG",
@@ -2109,7 +2110,8 @@ var AzzasTracker = function() {
2109
2110
  "P",
2110
2111
  "M",
2111
2112
  "G",
2112
- "GG"
2113
+ "GG",
2114
+ "GGG"
2113
2115
  ]
2114
2116
  };
2115
2117
  var detectSizeType = function(sizes) {
@@ -2171,13 +2173,15 @@ var AzzasTracker = function() {
2171
2173
  "checkout": "https://secure.offpremium.com.br"
2172
2174
  },
2173
2175
  "carolbassi": {
2174
- "store": "https://carolbassi.myvtex.com"
2176
+ "store": "https://carolbassi.myvtex.com",
2177
+ "checkout": "https://secure.carolbassi.com.br"
2175
2178
  },
2176
2179
  "bynv": {
2177
2180
  "store": "https://bynv.myvtex.com"
2178
2181
  },
2179
2182
  "lojafabula": {
2180
- "store": "https://lojafabula.myvtex.com"
2183
+ "store": "https://lojafabula.myvtex.com",
2184
+ "checkout": "https://secure.lojafabula.com.br"
2181
2185
  }
2182
2186
  };
2183
2187
  // src/params/legacy/index.ts
@@ -2730,16 +2734,12 @@ var AzzasTracker = function() {
2730
2734
  available_grid: function(context) {
2731
2735
  if (context === null || context === void 0 ? void 0 : context.available_grid) return context.available_grid;
2732
2736
  if (context === null || context === void 0 ? void 0 : context.products) {
2733
- var sizes = context.products.filter(function(product) {
2734
- var _product_offers_offers, _product_offers;
2735
- return (_product_offers = product.offers) === null || _product_offers === void 0 ? void 0 : (_product_offers_offers = _product_offers.offers) === null || _product_offers_offers === void 0 ? void 0 : _product_offers_offers.some(function(o) {
2736
- return o.availability === "https://schema.org/InStock";
2737
- });
2738
- }).map(function(product) {
2739
- var _product_name;
2740
- return (_product_name = product.name) === null || _product_name === void 0 ? void 0 : _product_name.split(" - ")[1];
2741
- }).filter(function(name) {
2742
- return Boolean(name);
2737
+ var sizes = context.products.flatMap(function(p) {
2738
+ var _ref;
2739
+ var _p_isVariantOf_skuVariants_availableVariations_Tamanho, _p_isVariantOf_skuVariants_availableVariations, _p_isVariantOf_skuVariants, _p_isVariantOf;
2740
+ return (_ref = p === null || p === void 0 ? void 0 : (_p_isVariantOf = p.isVariantOf) === null || _p_isVariantOf === void 0 ? void 0 : (_p_isVariantOf_skuVariants = _p_isVariantOf.skuVariants) === null || _p_isVariantOf_skuVariants === void 0 ? void 0 : (_p_isVariantOf_skuVariants_availableVariations = _p_isVariantOf_skuVariants.availableVariations) === null || _p_isVariantOf_skuVariants_availableVariations === void 0 ? void 0 : (_p_isVariantOf_skuVariants_availableVariations_Tamanho = _p_isVariantOf_skuVariants_availableVariations.Tamanho) === null || _p_isVariantOf_skuVariants_availableVariations_Tamanho === void 0 ? void 0 : _p_isVariantOf_skuVariants_availableVariations_Tamanho.map(function(size) {
2741
+ return size.value;
2742
+ })) !== null && _ref !== void 0 ? _ref : [];
2743
2743
  });
2744
2744
  var result = sortSizes(sizes).join(",").trim();
2745
2745
  return result || null;
@@ -3149,14 +3149,20 @@ var AzzasTracker = function() {
3149
3149
  },
3150
3150
  payment_type: getPaymentType2,
3151
3151
  total_discount: function(context) {
3152
- var _context_orderForm, _context_orderForm1, _totalizers_find;
3152
+ var _ref;
3153
+ var _orderForm_totalizers_find, _orderForm_totalizers;
3153
3154
  if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
3154
- if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3155
- var totalizers = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers;
3156
- var productDiscount = ((_totalizers_find = totalizers.find(function(t) {
3157
- return t.id === "Discounts";
3158
- })) === null || _totalizers_find === void 0 ? void 0 : _totalizers_find.value) || 0;
3159
- return Math.abs(productDiscount) / 100 || null;
3155
+ var orderForm = context === null || context === void 0 ? void 0 : context.orderForm;
3156
+ var items = orderForm === null || orderForm === void 0 ? void 0 : orderForm.items;
3157
+ if (!(items === null || items === void 0 ? void 0 : items.length) || typeof (orderForm === null || orderForm === void 0 ? void 0 : orderForm.value) !== "number") return null;
3158
+ var itemsFullValue = items.reduce(function(acc, item) {
3159
+ return acc + item.listPrice * item.quantity;
3160
+ }, 0);
3161
+ var shipping = (_ref = orderForm === null || orderForm === void 0 ? void 0 : (_orderForm_totalizers = orderForm.totalizers) === null || _orderForm_totalizers === void 0 ? void 0 : (_orderForm_totalizers_find = _orderForm_totalizers.find(function(t) {
3162
+ return t.id === "Shipping";
3163
+ })) === null || _orderForm_totalizers_find === void 0 ? void 0 : _orderForm_totalizers_find.value) !== null && _ref !== void 0 ? _ref : 0;
3164
+ var derived = itemsFullValue + shipping - orderForm.value;
3165
+ return derived > 0 ? derived / 100 : null;
3160
3166
  },
3161
3167
  subtotal: function(context) {
3162
3168
  var _context_orderForm, _context_orderForm1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azzas/azzas-tracker-web",
3
- "version": "2.0.1-preview.1",
3
+ "version": "2.0.2-preview.0",
4
4
  "type": "module",
5
5
  "main": "./dist/mod.cjs",
6
6
  "module": "./dist/mod.js",