@azzas/azzas-tracker-web 2.0.0-preview.17 → 2.0.0-preview.19
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.
- package/dist/mod.cjs +17 -15
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +1 -0
- package/dist/mod.d.ts +1 -0
- package/dist/mod.global.js +17 -15
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +17 -15
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +20 -14
- package/package.json +1 -1
package/dist/mod.vtex.global.js
CHANGED
|
@@ -2911,8 +2911,14 @@ var AzzasTracker = function() {
|
|
|
2911
2911
|
// src/params/adapters/orderForm/utils.ts
|
|
2912
2912
|
var getOrderFormItems = function(orderForm) {
|
|
2913
2913
|
var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
|
|
2914
|
+
var isMultipleRemove = orderForm === null || orderForm === void 0 ? void 0 : orderForm.multipleRemove;
|
|
2914
2915
|
return idSelected ? orderForm.items.filter(function(item) {
|
|
2915
2916
|
return item.id === idSelected;
|
|
2917
|
+
}).map(function(i) {
|
|
2918
|
+
if (isMultipleRemove) return i;
|
|
2919
|
+
return _object_spread_props(_object_spread({}, i), {
|
|
2920
|
+
quantity: 1
|
|
2921
|
+
});
|
|
2916
2922
|
}) : orderForm.items;
|
|
2917
2923
|
};
|
|
2918
2924
|
var getItemCategory6 = function(item) {
|
|
@@ -2936,11 +2942,15 @@ var AzzasTracker = function() {
|
|
|
2936
2942
|
return capitalize(deepest);
|
|
2937
2943
|
};
|
|
2938
2944
|
var getPaymentType2 = function(context) {
|
|
2939
|
-
var _context_orderForm_paymentData, _context_orderForm_paymentData1, _system_name;
|
|
2945
|
+
var _context_orderForm_paymentData, _context_orderForm_paymentData1, _context_orderForm_paymentData2, _system_name;
|
|
2940
2946
|
if (context.payment_type) return context.payment_type;
|
|
2941
2947
|
if (!context.orderForm) return null;
|
|
2942
|
-
var
|
|
2943
|
-
|
|
2948
|
+
var giftCards = ((_context_orderForm_paymentData = context.orderForm.paymentData) === null || _context_orderForm_paymentData === void 0 ? void 0 : _context_orderForm_paymentData.giftCards) || [];
|
|
2949
|
+
if (giftCards.some(function(g) {
|
|
2950
|
+
return g === null || g === void 0 ? void 0 : g.inUse;
|
|
2951
|
+
})) return "vale";
|
|
2952
|
+
var payments = ((_context_orderForm_paymentData1 = context.orderForm.paymentData) === null || _context_orderForm_paymentData1 === void 0 ? void 0 : _context_orderForm_paymentData1.payments) || [];
|
|
2953
|
+
var systems = ((_context_orderForm_paymentData2 = context.orderForm.paymentData) === null || _context_orderForm_paymentData2 === void 0 ? void 0 : _context_orderForm_paymentData2.paymentSystems) || [];
|
|
2944
2954
|
if (!payments.length || !systems.length) return null;
|
|
2945
2955
|
var selectedPayment = payments.find(function(p) {
|
|
2946
2956
|
return p === null || p === void 0 ? void 0 : p.paymentSystem;
|
|
@@ -2970,7 +2980,7 @@ var AzzasTracker = function() {
|
|
|
2970
2980
|
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
2981
|
item_brand: (_ref2 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2972
2982
|
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.
|
|
2983
|
+
price: (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100,
|
|
2974
2984
|
discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
|
|
2975
2985
|
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
2986
|
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 +3024,7 @@ var AzzasTracker = function() {
|
|
|
3014
3024
|
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
3015
3025
|
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
3026
|
return getOrderFormItems(context.orderForm).map(function(item) {
|
|
3017
|
-
return (item === null || item === void 0 ? void 0 : item.
|
|
3027
|
+
return (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100 * item.quantity;
|
|
3018
3028
|
}).filter(function(price) {
|
|
3019
3029
|
return price !== void 0;
|
|
3020
3030
|
}).reduce(function(sum, price) {
|
|
@@ -3023,18 +3033,14 @@ var AzzasTracker = function() {
|
|
|
3023
3033
|
},
|
|
3024
3034
|
payment_type: getPaymentType2,
|
|
3025
3035
|
total_discount: function(context) {
|
|
3026
|
-
var _context_orderForm, _context_orderForm1;
|
|
3036
|
+
var _context_orderForm, _context_orderForm1, _totalizers_find;
|
|
3027
3037
|
if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
|
|
3028
3038
|
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
|
|
3030
|
-
var
|
|
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) {
|
|
3039
|
+
var totalizers = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers;
|
|
3040
|
+
var productDiscount = ((_totalizers_find = totalizers.find(function(t) {
|
|
3035
3041
|
return t.id === "Discounts";
|
|
3036
|
-
});
|
|
3037
|
-
return Math.abs(
|
|
3042
|
+
})) === null || _totalizers_find === void 0 ? void 0 : _totalizers_find.value) || 0;
|
|
3043
|
+
return Math.abs(productDiscount) / 100 || null;
|
|
3038
3044
|
},
|
|
3039
3045
|
subtotal: function(context) {
|
|
3040
3046
|
var _context_orderForm, _context_orderForm1;
|