@azzas/azzas-tracker-web 2.0.0-preview.16 → 2.0.0-preview.17
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 +28 -15
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.global.js +28 -15
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +28 -15
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +41 -19
- package/package.json +1 -1
package/dist/mod.vtex.global.js
CHANGED
|
@@ -2909,6 +2909,12 @@ var AzzasTracker = function() {
|
|
|
2909
2909
|
}
|
|
2910
2910
|
});
|
|
2911
2911
|
// src/params/adapters/orderForm/utils.ts
|
|
2912
|
+
var getOrderFormItems = function(orderForm) {
|
|
2913
|
+
var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
|
|
2914
|
+
return idSelected ? orderForm.items.filter(function(item) {
|
|
2915
|
+
return item.id === idSelected;
|
|
2916
|
+
}) : orderForm.items;
|
|
2917
|
+
};
|
|
2912
2918
|
var getItemCategory6 = function(item) {
|
|
2913
2919
|
var _text_match;
|
|
2914
2920
|
var categories = item === null || item === void 0 ? void 0 : item.productCategories;
|
|
@@ -2929,11 +2935,27 @@ var AzzasTracker = function() {
|
|
|
2929
2935
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2930
2936
|
return capitalize(deepest);
|
|
2931
2937
|
};
|
|
2932
|
-
var
|
|
2933
|
-
var
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2938
|
+
var getPaymentType2 = function(context) {
|
|
2939
|
+
var _context_orderForm_paymentData, _context_orderForm_paymentData1, _system_name;
|
|
2940
|
+
if (context.payment_type) return context.payment_type;
|
|
2941
|
+
if (!context.orderForm) return null;
|
|
2942
|
+
var payments = ((_context_orderForm_paymentData = context.orderForm.paymentData) === null || _context_orderForm_paymentData === void 0 ? void 0 : _context_orderForm_paymentData.payments) || [];
|
|
2943
|
+
var systems = ((_context_orderForm_paymentData1 = context.orderForm.paymentData) === null || _context_orderForm_paymentData1 === void 0 ? void 0 : _context_orderForm_paymentData1.paymentSystems) || [];
|
|
2944
|
+
if (!payments.length || !systems.length) return null;
|
|
2945
|
+
var selectedPayment = payments.find(function(p) {
|
|
2946
|
+
return p === null || p === void 0 ? void 0 : p.paymentSystem;
|
|
2947
|
+
}) || payments[0];
|
|
2948
|
+
var id = String((selectedPayment === null || selectedPayment === void 0 ? void 0 : selectedPayment.paymentSystem) || "").trim();
|
|
2949
|
+
if (!id) return null;
|
|
2950
|
+
var system = systems.find(function(s) {
|
|
2951
|
+
return String(s.id) === id;
|
|
2952
|
+
});
|
|
2953
|
+
var name = (system === null || system === void 0 ? void 0 : (_system_name = system.name) === null || _system_name === void 0 ? void 0 : _system_name.toLowerCase()) || "";
|
|
2954
|
+
var match = paymentTypeMap.find(function(param) {
|
|
2955
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
2956
|
+
return name.includes(key);
|
|
2957
|
+
});
|
|
2958
|
+
return match ? match[1] : null;
|
|
2937
2959
|
};
|
|
2938
2960
|
// src/params/adapters/orderForm/index.ts
|
|
2939
2961
|
var orderFormAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
@@ -2999,7 +3021,7 @@ var AzzasTracker = function() {
|
|
|
2999
3021
|
return sum + price;
|
|
3000
3022
|
}, 0);
|
|
3001
3023
|
},
|
|
3002
|
-
payment_type:
|
|
3024
|
+
payment_type: getPaymentType2,
|
|
3003
3025
|
total_discount: function(context) {
|
|
3004
3026
|
var _context_orderForm, _context_orderForm1;
|
|
3005
3027
|
if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
|
|
@@ -3024,19 +3046,6 @@ var AzzasTracker = function() {
|
|
|
3024
3046
|
}, 0) / 100 || 0;
|
|
3025
3047
|
return subtotal;
|
|
3026
3048
|
},
|
|
3027
|
-
coupon_message: function(context) {
|
|
3028
|
-
var _context_orderForm;
|
|
3029
|
-
if (context.couponMessage) return context.couponMessage;
|
|
3030
|
-
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
3031
|
-
if (messages.length === 0) return null;
|
|
3032
|
-
var couponMessages = messages.filter(function(msg) {
|
|
3033
|
-
return msg.text.toLowerCase().includes("cupom");
|
|
3034
|
-
});
|
|
3035
|
-
if (couponMessages.length === 0) return null;
|
|
3036
|
-
return couponMessages.map(function(msg) {
|
|
3037
|
-
return msg.text;
|
|
3038
|
-
}).join(" | ");
|
|
3039
|
-
},
|
|
3040
3049
|
zipcode: function(context) {
|
|
3041
3050
|
var _context_meta_zipcode;
|
|
3042
3051
|
return (_context_meta_zipcode = context.meta.zipcode) !== null && _context_meta_zipcode !== void 0 ? _context_meta_zipcode : null;
|
|
@@ -3130,6 +3139,19 @@ var AzzasTracker = function() {
|
|
|
3130
3139
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
3131
3140
|
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;
|
|
3132
3141
|
},
|
|
3142
|
+
coupon_message: function(context) {
|
|
3143
|
+
var _context_orderForm;
|
|
3144
|
+
if (context.couponMessage) return context.couponMessage;
|
|
3145
|
+
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
3146
|
+
if (messages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
3147
|
+
var couponMessages = messages.filter(function(msg) {
|
|
3148
|
+
return msg.text.toLowerCase().includes("cupom");
|
|
3149
|
+
});
|
|
3150
|
+
if (couponMessages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
3151
|
+
return couponMessages.map(function(msg) {
|
|
3152
|
+
return msg.text;
|
|
3153
|
+
}).join(" | ");
|
|
3154
|
+
},
|
|
3133
3155
|
coupon: function(context) {
|
|
3134
3156
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
3135
3157
|
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;
|