@azzas/azzas-tracker-web 2.0.0-preview.17 → 2.0.0-preview.18

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.
@@ -2970,7 +2970,7 @@ var AzzasTracker = function() {
2970
2970
  index: (_ref1 = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.index) !== null && _ref1 !== void 0 ? _ref1 : index + 1,
2971
2971
  item_brand: (_ref2 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref2 !== void 0 ? _ref2 : null,
2972
2972
  item_name: (_ref3 = item === null || item === void 0 ? void 0 : item.name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) !== null && _ref3 !== void 0 ? _ref3 : null,
2973
- price: (item === null || item === void 0 ? void 0 : item.price) / 100,
2973
+ price: (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100,
2974
2974
  discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
2975
2975
  item_variant: (_ref4 = 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__split_pop = _item_skuName_split_.split("_").pop()) === null || _item_skuName_split__split_pop === void 0 ? void 0 : _item_skuName_split__split_pop.trim()) !== null && _ref4 !== void 0 ? _ref4 : null,
2976
2976
  item_variant2: (_ref5 = 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()) !== null && _ref5 !== void 0 ? _ref5 : null,
@@ -3014,7 +3014,7 @@ var AzzasTracker = function() {
3014
3014
  if (context === null || context === void 0 ? void 0 : context.value) return context.value;
3015
3015
  if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3016
3016
  return getOrderFormItems(context.orderForm).map(function(item) {
3017
- return (item === null || item === void 0 ? void 0 : item.price) / 100 * item.quantity;
3017
+ return (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100 * item.quantity;
3018
3018
  }).filter(function(price) {
3019
3019
  return price !== void 0;
3020
3020
  }).reduce(function(sum, price) {
@@ -3023,18 +3023,14 @@ var AzzasTracker = function() {
3023
3023
  },
3024
3024
  payment_type: getPaymentType2,
3025
3025
  total_discount: function(context) {
3026
- var _context_orderForm, _context_orderForm1;
3026
+ var _context_orderForm, _context_orderForm1, _totalizers_find;
3027
3027
  if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
3028
3028
  if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
3029
- var totalsList = ((_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers) || [];
3030
- var totalDiscount = getOrderFormItems(context.orderForm).reduce(function(acc, item) {
3031
- var unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);
3032
- return acc + unitDiscount * item.quantity;
3033
- }, 0);
3034
- var discounts = totalsList.find(function(t) {
3029
+ var totalizers = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers;
3030
+ var productDiscount = ((_totalizers_find = totalizers.find(function(t) {
3035
3031
  return t.id === "Discounts";
3036
- });
3037
- return Math.abs(((discounts === null || discounts === void 0 ? void 0 : discounts.value) || 0) + totalDiscount) / 100 || null;
3032
+ })) === null || _totalizers_find === void 0 ? void 0 : _totalizers_find.value) || 0;
3033
+ return Math.abs(productDiscount) / 100 || null;
3038
3034
  },
3039
3035
  subtotal: function(context) {
3040
3036
  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.0-preview.17",
3
+ "version": "2.0.0-preview.18",
4
4
  "type": "module",
5
5
  "main": "./dist/mod.cjs",
6
6
  "module": "./dist/mod.js",