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

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.
@@ -2171,13 +2171,15 @@ var AzzasTracker = function() {
2171
2171
  "checkout": "https://secure.offpremium.com.br"
2172
2172
  },
2173
2173
  "carolbassi": {
2174
- "store": "https://carolbassi.myvtex.com"
2174
+ "store": "https://carolbassi.myvtex.com",
2175
+ "checkout": "https://secure.carolbassi.com.br"
2175
2176
  },
2176
2177
  "bynv": {
2177
2178
  "store": "https://bynv.myvtex.com"
2178
2179
  },
2179
2180
  "lojafabula": {
2180
- "store": "https://lojafabula.myvtex.com"
2181
+ "store": "https://lojafabula.myvtex.com",
2182
+ "checkout": "https://secure.lojafabula.com.br"
2181
2183
  }
2182
2184
  };
2183
2185
  // src/params/legacy/index.ts
@@ -3149,14 +3151,20 @@ var AzzasTracker = function() {
3149
3151
  },
3150
3152
  payment_type: getPaymentType2,
3151
3153
  total_discount: function(context) {
3152
- var _context_orderForm, _context_orderForm1, _totalizers_find;
3154
+ var _ref;
3155
+ var _orderForm_totalizers_find, _orderForm_totalizers;
3153
3156
  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;
3157
+ var orderForm = context === null || context === void 0 ? void 0 : context.orderForm;
3158
+ var items = orderForm === null || orderForm === void 0 ? void 0 : orderForm.items;
3159
+ if (!(items === null || items === void 0 ? void 0 : items.length) || typeof (orderForm === null || orderForm === void 0 ? void 0 : orderForm.value) !== "number") return null;
3160
+ var itemsFullValue = items.reduce(function(acc, item) {
3161
+ return acc + item.listPrice * item.quantity;
3162
+ }, 0);
3163
+ 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) {
3164
+ return t.id === "Shipping";
3165
+ })) === null || _orderForm_totalizers_find === void 0 ? void 0 : _orderForm_totalizers_find.value) !== null && _ref !== void 0 ? _ref : 0;
3166
+ var derived = itemsFullValue + shipping - orderForm.value;
3167
+ return derived > 0 ? derived / 100 : null;
3160
3168
  },
3161
3169
  subtotal: function(context) {
3162
3170
  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.1",
4
4
  "type": "module",
5
5
  "main": "./dist/mod.cjs",
6
6
  "module": "./dist/mod.js",