@azzas/azzas-tracker-web 2.0.0-preview.9 → 2.0.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.
- package/dist/mod.cjs +199 -75
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +147 -14
- package/dist/mod.d.ts +147 -14
- package/dist/mod.global.js +199 -75
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +199 -75
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +233 -82
- package/package.json +1 -1
package/dist/mod.vtex.global.js
CHANGED
|
@@ -1156,17 +1156,17 @@ var AzzasTracker = function() {
|
|
|
1156
1156
|
};
|
|
1157
1157
|
var getUserInfo = function getUserInfo(context) {
|
|
1158
1158
|
return _async_to_generator(function() {
|
|
1159
|
-
var
|
|
1159
|
+
var _context_meta_user_info, _context_meta, _PROD_DOMAINS_context_meta_user_info_account, _context_meta_user_info1, _context_meta1, _context_meta_user_info2, _context_meta2, _context_meta_user_info3, _context_meta3, domain, _context_meta_user_info4, _context_meta4, _res_customer_document, _res_customer, api, response, _context_meta_user_info5, _context_meta5, _context_meta_user_info_manuallyInfo, _context_meta_user_info6, _context_meta6, _context_meta_user_info7, _context_meta7, _context_meta_user_info8, _context_meta8, _context_meta_user_info9, _context_meta9, _ref, cpf, birthDate, phone, firstName, lastName, email, email_optin, document3, hashedDocument2, res, document2, hashedDocument, _, _context_meta_user_info10, _context_meta10, _context_meta_user_info_manuallyInfo1, _context_meta_user_info11, _context_meta11, _context_meta_user_info12, _context_meta12, _context_meta_user_info13, _context_meta13, _context_meta_user_info14, _context_meta14, _ref1, cpf1, birthDate1, phone1, firstName1, lastName1, email1, email_optin1, document21, hashedDocument1;
|
|
1160
1160
|
return _ts_generator(this, function(_state) {
|
|
1161
1161
|
switch(_state.label){
|
|
1162
1162
|
case 0:
|
|
1163
|
-
domain = (
|
|
1163
|
+
domain = (_PROD_DOMAINS_context_meta_user_info_account = PROD_DOMAINS[context === null || context === void 0 ? void 0 : (_context_meta1 = context.meta) === null || _context_meta1 === void 0 ? void 0 : (_context_meta_user_info1 = _context_meta1.user_info) === null || _context_meta_user_info1 === void 0 ? void 0 : _context_meta_user_info1.account]) === null || _PROD_DOMAINS_context_meta_user_info_account === void 0 ? void 0 : _PROD_DOMAINS_context_meta_user_info_account[context === null || context === void 0 ? void 0 : (_context_meta = context.meta) === null || _context_meta === void 0 ? void 0 : (_context_meta_user_info = _context_meta.user_info) === null || _context_meta_user_info === void 0 ? void 0 : _context_meta_user_info.platform];
|
|
1164
1164
|
if (!domain) return [
|
|
1165
1165
|
2,
|
|
1166
1166
|
{
|
|
1167
1167
|
customer: {
|
|
1168
|
-
email: context.userEmail,
|
|
1169
|
-
id: context === null || context === void 0 ? void 0 : context.userId
|
|
1168
|
+
email: context === null || context === void 0 ? void 0 : (_context_meta2 = context.meta) === null || _context_meta2 === void 0 ? void 0 : (_context_meta_user_info2 = _context_meta2.user_info) === null || _context_meta_user_info2 === void 0 ? void 0 : _context_meta_user_info2.userEmail,
|
|
1169
|
+
id: context === null || context === void 0 ? void 0 : (_context_meta3 = context.meta) === null || _context_meta3 === void 0 ? void 0 : (_context_meta_user_info3 = _context_meta3.user_info) === null || _context_meta_user_info3 === void 0 ? void 0 : _context_meta_user_info3.userId
|
|
1170
1170
|
},
|
|
1171
1171
|
address: null
|
|
1172
1172
|
}
|
|
@@ -1185,7 +1185,7 @@ var AzzasTracker = function() {
|
|
|
1185
1185
|
fetch(api, {
|
|
1186
1186
|
method: "POST",
|
|
1187
1187
|
body: JSON.stringify({
|
|
1188
|
-
email: context.userEmail
|
|
1188
|
+
email: context === null || context === void 0 ? void 0 : (_context_meta4 = context.meta) === null || _context_meta4 === void 0 ? void 0 : (_context_meta_user_info4 = _context_meta4.user_info) === null || _context_meta_user_info4 === void 0 ? void 0 : _context_meta_user_info4.userEmail
|
|
1189
1189
|
})
|
|
1190
1190
|
})
|
|
1191
1191
|
];
|
|
@@ -1195,11 +1195,11 @@ var AzzasTracker = function() {
|
|
|
1195
1195
|
3,
|
|
1196
1196
|
5
|
|
1197
1197
|
];
|
|
1198
|
-
if (!((context === null || context === void 0 ? void 0 : context.manuallyInfo) && ((
|
|
1198
|
+
if (!((context === null || context === void 0 ? void 0 : (_context_meta5 = context.meta) === null || _context_meta5 === void 0 ? void 0 : (_context_meta_user_info5 = _context_meta5.user_info) === null || _context_meta_user_info5 === void 0 ? void 0 : _context_meta_user_info5.manuallyInfo) && (context === null || context === void 0 ? void 0 : (_context_meta6 = context.meta) === null || _context_meta6 === void 0 ? void 0 : (_context_meta_user_info6 = _context_meta6.user_info) === null || _context_meta_user_info6 === void 0 ? void 0 : (_context_meta_user_info_manuallyInfo = _context_meta_user_info6.manuallyInfo) === null || _context_meta_user_info_manuallyInfo === void 0 ? void 0 : _context_meta_user_info_manuallyInfo.cpf))) return [
|
|
1199
1199
|
3,
|
|
1200
1200
|
4
|
|
1201
1201
|
];
|
|
1202
|
-
|
|
1202
|
+
_ref = context === null || context === void 0 ? void 0 : (_context_meta9 = context.meta) === null || _context_meta9 === void 0 ? void 0 : (_context_meta_user_info9 = _context_meta9.user_info) === null || _context_meta_user_info9 === void 0 ? void 0 : _context_meta_user_info9.manuallyInfo, cpf = _ref.cpf, birthDate = _ref.birthDate, phone = _ref.phone, firstName = _ref.firstName, lastName = _ref.lastName, email = _ref.email, email_optin = _ref.email_optin;
|
|
1203
1203
|
document3 = cpf === null || cpf === void 0 ? void 0 : cpf.replace(/\D/g, "");
|
|
1204
1204
|
return [
|
|
1205
1205
|
4,
|
|
@@ -1229,8 +1229,8 @@ var AzzasTracker = function() {
|
|
|
1229
1229
|
2,
|
|
1230
1230
|
{
|
|
1231
1231
|
customer: {
|
|
1232
|
-
email: context.userEmail,
|
|
1233
|
-
id: context === null || context === void 0 ? void 0 : context.userId
|
|
1232
|
+
email: context === null || context === void 0 ? void 0 : (_context_meta7 = context.meta) === null || _context_meta7 === void 0 ? void 0 : (_context_meta_user_info7 = _context_meta7.user_info) === null || _context_meta_user_info7 === void 0 ? void 0 : _context_meta_user_info7.userEmail,
|
|
1233
|
+
id: context === null || context === void 0 ? void 0 : (_context_meta8 = context.meta) === null || _context_meta8 === void 0 ? void 0 : (_context_meta_user_info8 = _context_meta8.user_info) === null || _context_meta_user_info8 === void 0 ? void 0 : _context_meta_user_info8.userId
|
|
1234
1234
|
},
|
|
1235
1235
|
address: null
|
|
1236
1236
|
}
|
|
@@ -1260,11 +1260,11 @@ var AzzasTracker = function() {
|
|
|
1260
1260
|
];
|
|
1261
1261
|
case 8:
|
|
1262
1262
|
_ = _state.sent();
|
|
1263
|
-
if (!((context === null || context === void 0 ? void 0 : context.manuallyInfo) && ((
|
|
1263
|
+
if (!((context === null || context === void 0 ? void 0 : (_context_meta10 = context.meta) === null || _context_meta10 === void 0 ? void 0 : (_context_meta_user_info10 = _context_meta10.user_info) === null || _context_meta_user_info10 === void 0 ? void 0 : _context_meta_user_info10.manuallyInfo) && (context === null || context === void 0 ? void 0 : (_context_meta11 = context.meta) === null || _context_meta11 === void 0 ? void 0 : (_context_meta_user_info11 = _context_meta11.user_info) === null || _context_meta_user_info11 === void 0 ? void 0 : (_context_meta_user_info_manuallyInfo1 = _context_meta_user_info11.manuallyInfo) === null || _context_meta_user_info_manuallyInfo1 === void 0 ? void 0 : _context_meta_user_info_manuallyInfo1.cpf))) return [
|
|
1264
1264
|
3,
|
|
1265
1265
|
10
|
|
1266
1266
|
];
|
|
1267
|
-
|
|
1267
|
+
_ref1 = context === null || context === void 0 ? void 0 : (_context_meta14 = context.meta) === null || _context_meta14 === void 0 ? void 0 : (_context_meta_user_info14 = _context_meta14.user_info) === null || _context_meta_user_info14 === void 0 ? void 0 : _context_meta_user_info14.manuallyInfo, cpf1 = _ref1.cpf, birthDate1 = _ref1.birthDate, phone1 = _ref1.phone, firstName1 = _ref1.firstName, lastName1 = _ref1.lastName, email1 = _ref1.email, email_optin1 = _ref1.email_optin;
|
|
1268
1268
|
document21 = cpf1 === null || cpf1 === void 0 ? void 0 : cpf1.replace(/\D/g, "");
|
|
1269
1269
|
return [
|
|
1270
1270
|
4,
|
|
@@ -1294,8 +1294,8 @@ var AzzasTracker = function() {
|
|
|
1294
1294
|
2,
|
|
1295
1295
|
{
|
|
1296
1296
|
customer: {
|
|
1297
|
-
email: context.userEmail,
|
|
1298
|
-
id: context === null || context === void 0 ? void 0 : context.userId
|
|
1297
|
+
email: context === null || context === void 0 ? void 0 : (_context_meta12 = context.meta) === null || _context_meta12 === void 0 ? void 0 : (_context_meta_user_info12 = _context_meta12.user_info) === null || _context_meta_user_info12 === void 0 ? void 0 : _context_meta_user_info12.userEmail,
|
|
1298
|
+
id: context === null || context === void 0 ? void 0 : (_context_meta13 = context.meta) === null || _context_meta13 === void 0 ? void 0 : (_context_meta_user_info13 = _context_meta13.user_info) === null || _context_meta_user_info13 === void 0 ? void 0 : _context_meta_user_info13.userId
|
|
1299
1299
|
},
|
|
1300
1300
|
address: null
|
|
1301
1301
|
}
|
|
@@ -1933,7 +1933,6 @@ var AzzasTracker = function() {
|
|
|
1933
1933
|
],
|
|
1934
1934
|
requiredParams: [
|
|
1935
1935
|
"brand",
|
|
1936
|
-
"line_items",
|
|
1937
1936
|
"size",
|
|
1938
1937
|
"item_ref"
|
|
1939
1938
|
]
|
|
@@ -2437,8 +2436,13 @@ var AzzasTracker = function() {
|
|
|
2437
2436
|
}
|
|
2438
2437
|
};
|
|
2439
2438
|
// src/params/adapters/meta/index.ts
|
|
2440
|
-
var
|
|
2439
|
+
var metaAdapter = {
|
|
2441
2440
|
user_info: getUserInfo,
|
|
2441
|
+
brand: function(context, config2) {
|
|
2442
|
+
if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
|
|
2443
|
+
if (context === null || context === void 0 ? void 0 : context.meta.brand) return context.meta.brand;
|
|
2444
|
+
return null;
|
|
2445
|
+
},
|
|
2442
2446
|
content_type: function(context) {
|
|
2443
2447
|
return context.meta.content_type || null;
|
|
2444
2448
|
},
|
|
@@ -2460,7 +2464,7 @@ var AzzasTracker = function() {
|
|
|
2460
2464
|
return context.meta.search_term || null;
|
|
2461
2465
|
},
|
|
2462
2466
|
search_found: function(context) {
|
|
2463
|
-
return context.meta.search_found ||
|
|
2467
|
+
return context.meta.search_found || false;
|
|
2464
2468
|
},
|
|
2465
2469
|
search_quantity: function(context) {
|
|
2466
2470
|
return context.meta.search_quantity || 0;
|
|
@@ -2475,13 +2479,13 @@ var AzzasTracker = function() {
|
|
|
2475
2479
|
return context.meta.creative_slot || null;
|
|
2476
2480
|
},
|
|
2477
2481
|
item_ref: function(context) {
|
|
2478
|
-
return context.
|
|
2482
|
+
return context.meta.item_ref || null;
|
|
2479
2483
|
},
|
|
2480
2484
|
method: function(context) {
|
|
2481
|
-
return context.method || null;
|
|
2485
|
+
return context.meta.method || null;
|
|
2482
2486
|
},
|
|
2483
2487
|
type: function(context) {
|
|
2484
|
-
return context.type || null;
|
|
2488
|
+
return context.meta.type || null;
|
|
2485
2489
|
},
|
|
2486
2490
|
color: function(context) {
|
|
2487
2491
|
return context.meta.color || null;
|
|
@@ -2529,7 +2533,7 @@ var AzzasTracker = function() {
|
|
|
2529
2533
|
// src/params/adapters/deco/index.ts
|
|
2530
2534
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
2531
2535
|
var LIST_PRICE_SCHEMA = "https://schema.org/ListPrice";
|
|
2532
|
-
var decoAdapter = _object_spread_props(_object_spread({},
|
|
2536
|
+
var decoAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
2533
2537
|
// global adapters
|
|
2534
2538
|
items: function(context) {
|
|
2535
2539
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
@@ -2587,7 +2591,7 @@ var AzzasTracker = function() {
|
|
|
2587
2591
|
return item === null || item === void 0 ? void 0 : item.inProductGroupWithID;
|
|
2588
2592
|
}).filter(function(id) {
|
|
2589
2593
|
return Boolean(id);
|
|
2590
|
-
});
|
|
2594
|
+
}).join();
|
|
2591
2595
|
}
|
|
2592
2596
|
return null;
|
|
2593
2597
|
},
|
|
@@ -2629,8 +2633,123 @@ var AzzasTracker = function() {
|
|
|
2629
2633
|
return null;
|
|
2630
2634
|
}
|
|
2631
2635
|
});
|
|
2632
|
-
// src/params/adapters/
|
|
2636
|
+
// src/params/adapters/reserva/utils.ts
|
|
2633
2637
|
var getItemCategory5 = function(item) {
|
|
2638
|
+
var _item_similarItems_, _item_similarItems, _categories_join_match;
|
|
2639
|
+
var categories = item === null || item === void 0 ? void 0 : (_item_similarItems = item.similarItems) === null || _item_similarItems === void 0 ? void 0 : (_item_similarItems_ = _item_similarItems[0]) === null || _item_similarItems_ === void 0 ? void 0 : _item_similarItems_.categories;
|
|
2640
|
+
if (!(categories === null || categories === void 0 ? void 0 : categories.length)) return "Cole\xE7\xE3o";
|
|
2641
|
+
var match = (_categories_join_match = categories.join(" ").match(/outlet|bazar|sale/i)) === null || _categories_join_match === void 0 ? void 0 : _categories_join_match[0].toLowerCase();
|
|
2642
|
+
return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
|
|
2643
|
+
};
|
|
2644
|
+
var getItemCategory23 = function(item) {
|
|
2645
|
+
var _ref, _validHierarchy_;
|
|
2646
|
+
var _item_similarItems_, _item_similarItems;
|
|
2647
|
+
var AVOID_CATEGORIES = /^(outlet|bazar|sale|coleção)$/i;
|
|
2648
|
+
var categories = (_ref = item === null || item === void 0 ? void 0 : (_item_similarItems = item.similarItems) === null || _item_similarItems === void 0 ? void 0 : (_item_similarItems_ = _item_similarItems[0]) === null || _item_similarItems_ === void 0 ? void 0 : _item_similarItems_.categories) !== null && _ref !== void 0 ? _ref : [];
|
|
2649
|
+
var validHierarchy = categories.filter(function(c) {
|
|
2650
|
+
return c && !AVOID_CATEGORIES.test(c);
|
|
2651
|
+
});
|
|
2652
|
+
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2653
|
+
return capitalize(deepest);
|
|
2654
|
+
};
|
|
2655
|
+
// src/params/adapters/reserva/index.ts
|
|
2656
|
+
var reservaAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
2657
|
+
// global adapters
|
|
2658
|
+
items: function(context) {
|
|
2659
|
+
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2660
|
+
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2661
|
+
return context.products.map(function(item) {
|
|
2662
|
+
var _ref, _ref1, _item_isVariantOf_name, _ref2, _ref3, _getItemCategory5, _getItemCategory23, _ref4, _ref5, _ref6, _resizeVtexImage2, _ref7, _ref8;
|
|
2663
|
+
var _item_offers_offers, _item_offers, _item_additionalProperty_find_value, _item_additionalProperty_find, _item_additionalProperty, _item_brand_name, _item_brand, _item_offers1, _item_offers2, _item_name_split_, _item_name, _item_name1, _item_seo, _item_image, _item_offers_offers__seller, _item_offers_offers_, _item_offers_offers1, _item_offers3;
|
|
2664
|
+
var COLOR_REGEX = /^[^_]+_/;
|
|
2665
|
+
var listPrice = item === null || item === void 0 ? void 0 : (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : (_item_offers_offers = _item_offers.offers) === null || _item_offers_offers === void 0 ? void 0 : _item_offers_offers[0].listPrice;
|
|
2666
|
+
var refIdValue = (_item_additionalProperty = item.additionalProperty) === null || _item_additionalProperty === void 0 ? void 0 : (_item_additionalProperty_find = _item_additionalProperty.find(function(i) {
|
|
2667
|
+
return i.name === "RefId";
|
|
2668
|
+
})) === null || _item_additionalProperty_find === void 0 ? void 0 : (_item_additionalProperty_find_value = _item_additionalProperty_find.value) === null || _item_additionalProperty_find_value === void 0 ? void 0 : _item_additionalProperty_find_value.replace(/_\d+$/, "");
|
|
2669
|
+
return {
|
|
2670
|
+
quantity: 1,
|
|
2671
|
+
index: (_ref = item === null || item === void 0 ? void 0 : item.index) !== null && _ref !== void 0 ? _ref : 0,
|
|
2672
|
+
item_brand: (_ref1 = (_item_brand = item.brand) === null || _item_brand === void 0 ? void 0 : (_item_brand_name = _item_brand.name) === null || _item_brand_name === void 0 ? void 0 : _item_brand_name.toLowerCase()) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
2673
|
+
item_name: (_item_isVariantOf_name = item.isVariantOf.name) !== null && _item_isVariantOf_name !== void 0 ? _item_isVariantOf_name : null,
|
|
2674
|
+
price: (_ref2 = (_item_offers1 = item.offers) === null || _item_offers1 === void 0 ? void 0 : _item_offers1.lowPrice) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2675
|
+
discount: Math.round((Number(listPrice) - Number(item === null || item === void 0 ? void 0 : (_item_offers2 = item.offers) === null || _item_offers2 === void 0 ? void 0 : _item_offers2.lowPrice)) * 100) / 100,
|
|
2676
|
+
item_variant: (item === null || item === void 0 ? void 0 : (_item_name = item.name) === null || _item_name === void 0 ? void 0 : (_item_name_split_ = _item_name.split(" - ")[0]) === null || _item_name_split_ === void 0 ? void 0 : _item_name_split_.replace(COLOR_REGEX, "").replace(/_/g, " ")) || null,
|
|
2677
|
+
// cor
|
|
2678
|
+
item_variant2: (_ref3 = item === null || item === void 0 ? void 0 : (_item_name1 = item.name) === null || _item_name1 === void 0 ? void 0 : _item_name1.split(" - ")[1]) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
2679
|
+
// tamanho
|
|
2680
|
+
item_shipping_tier: "",
|
|
2681
|
+
item_ref: refIdValue !== null && refIdValue !== void 0 ? refIdValue : null,
|
|
2682
|
+
item_category: (_getItemCategory5 = getItemCategory5(item)) !== null && _getItemCategory5 !== void 0 ? _getItemCategory5 : null,
|
|
2683
|
+
item_category2: (_getItemCategory23 = getItemCategory23(item)) !== null && _getItemCategory23 !== void 0 ? _getItemCategory23 : null,
|
|
2684
|
+
item_id: (_ref4 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2685
|
+
item_sku: (_ref5 = item === null || item === void 0 ? void 0 : item.sku) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
2686
|
+
item_url: (_ref6 = item === null || item === void 0 ? void 0 : (_item_seo = item.seo) === null || _item_seo === void 0 ? void 0 : _item_seo.canonical) !== null && _ref6 !== void 0 ? _ref6 : null,
|
|
2687
|
+
image_url: (_resizeVtexImage2 = resizeVtexImage2(item === null || item === void 0 ? void 0 : (_item_image = item.image) === null || _item_image === void 0 ? void 0 : _item_image[0].url)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
2688
|
+
seller_id: (_ref7 = (_item_offers3 = item.offers) === null || _item_offers3 === void 0 ? void 0 : (_item_offers_offers1 = _item_offers3.offers) === null || _item_offers_offers1 === void 0 ? void 0 : (_item_offers_offers_ = _item_offers_offers1[0]) === null || _item_offers_offers_ === void 0 ? void 0 : (_item_offers_offers__seller = _item_offers_offers_.seller) === null || _item_offers_offers__seller === void 0 ? void 0 : _item_offers_offers__seller.identifier) !== null && _ref7 !== void 0 ? _ref7 : null,
|
|
2689
|
+
item_list_name: (_ref8 = item === null || item === void 0 ? void 0 : item.item_list_name) !== null && _ref8 !== void 0 ? _ref8 : null
|
|
2690
|
+
};
|
|
2691
|
+
});
|
|
2692
|
+
}
|
|
2693
|
+
return null;
|
|
2694
|
+
},
|
|
2695
|
+
brand: function(context, config2) {
|
|
2696
|
+
if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
|
|
2697
|
+
if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
|
|
2698
|
+
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2699
|
+
return normalizeBrand2(context.products.map(function(p) {
|
|
2700
|
+
var _p_brand;
|
|
2701
|
+
return p === null || p === void 0 ? void 0 : (_p_brand = p.brand) === null || _p_brand === void 0 ? void 0 : _p_brand.name;
|
|
2702
|
+
}));
|
|
2703
|
+
}
|
|
2704
|
+
return null;
|
|
2705
|
+
},
|
|
2706
|
+
line_items: function(context) {
|
|
2707
|
+
if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
|
|
2708
|
+
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2709
|
+
return context.products.map(function(item) {
|
|
2710
|
+
return item === null || item === void 0 ? void 0 : item.id;
|
|
2711
|
+
}).filter(function(id) {
|
|
2712
|
+
return Boolean(id);
|
|
2713
|
+
}).join();
|
|
2714
|
+
}
|
|
2715
|
+
return null;
|
|
2716
|
+
},
|
|
2717
|
+
value: function(context) {
|
|
2718
|
+
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
2719
|
+
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2720
|
+
return context.products.map(function(item) {
|
|
2721
|
+
var _item_offers;
|
|
2722
|
+
return (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : _item_offers.lowPrice;
|
|
2723
|
+
}).filter(function(price) {
|
|
2724
|
+
return price !== void 0;
|
|
2725
|
+
}).reduce(function(sum, price) {
|
|
2726
|
+
return sum + price;
|
|
2727
|
+
}, 0);
|
|
2728
|
+
}
|
|
2729
|
+
return null;
|
|
2730
|
+
},
|
|
2731
|
+
available_grid: function(context) {
|
|
2732
|
+
if (context === null || context === void 0 ? void 0 : context.available_grid) return context.available_grid;
|
|
2733
|
+
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2734
|
+
var sizes = context.products.filter(function(product) {
|
|
2735
|
+
var _product_offers_offers, _product_offers;
|
|
2736
|
+
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) {
|
|
2737
|
+
return o.availability === "https://schema.org/InStock";
|
|
2738
|
+
});
|
|
2739
|
+
}).map(function(product) {
|
|
2740
|
+
var _product_name;
|
|
2741
|
+
return (_product_name = product.name) === null || _product_name === void 0 ? void 0 : _product_name.split(" - ")[1];
|
|
2742
|
+
}).filter(function(name) {
|
|
2743
|
+
return Boolean(name);
|
|
2744
|
+
});
|
|
2745
|
+
var result = sortSizes(sizes).join(",").trim();
|
|
2746
|
+
return result || null;
|
|
2747
|
+
}
|
|
2748
|
+
return null;
|
|
2749
|
+
}
|
|
2750
|
+
});
|
|
2751
|
+
// src/params/adapters/headless/utils.ts
|
|
2752
|
+
var getItemCategory6 = function(item) {
|
|
2634
2753
|
var keywords = [
|
|
2635
2754
|
"outlet",
|
|
2636
2755
|
"bazar",
|
|
@@ -2647,7 +2766,7 @@ var AzzasTracker = function() {
|
|
|
2647
2766
|
}
|
|
2648
2767
|
return "Cole\xE7\xE3o";
|
|
2649
2768
|
};
|
|
2650
|
-
var
|
|
2769
|
+
var getItemCategory24 = function(item) {
|
|
2651
2770
|
var _ref, _reverse_find;
|
|
2652
2771
|
var _item_categories;
|
|
2653
2772
|
var avoidList = /outlet|bazar|sale/i;
|
|
@@ -2664,7 +2783,7 @@ var AzzasTracker = function() {
|
|
|
2664
2783
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2665
2784
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2666
2785
|
return context.products.map(function(item) {
|
|
2667
|
-
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference,
|
|
2786
|
+
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference, _getItemCategory24, _ref3, _ref4, _item_link, _resizeVtexImage2, _ref5, _item_item_list_name;
|
|
2668
2787
|
var _item_items__sellers, _item_items__sellers1, _item_items__name, _item_items_, _item_items__name1, _item_items_1, _item_items, _item_items__images, _item_items1, _item_items__sellers2, _item_items_2, _item_items2;
|
|
2669
2788
|
var listPrice = item === null || item === void 0 ? void 0 : (_item_items__sellers = item.items[0].sellers) === null || _item_items__sellers === void 0 ? void 0 : _item_items__sellers[0].commertialOffer.ListPrice;
|
|
2670
2789
|
var price = item === null || item === void 0 ? void 0 : (_item_items__sellers1 = item.items[0].sellers) === null || _item_items__sellers1 === void 0 ? void 0 : _item_items__sellers1[0].commertialOffer.Price;
|
|
@@ -2680,8 +2799,8 @@ var AzzasTracker = function() {
|
|
|
2680
2799
|
item_variant2: (_ref2 = (_item_items_1 = item.items[0]) === null || _item_items_1 === void 0 ? void 0 : (_item_items__name1 = _item_items_1.name) === null || _item_items__name1 === void 0 ? void 0 : _item_items__name1.split(" - ")[1]) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2681
2800
|
item_ref: (_item_productReference = item.productReference) !== null && _item_productReference !== void 0 ? _item_productReference : null,
|
|
2682
2801
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
2683
|
-
item_category:
|
|
2684
|
-
item_category2: (
|
|
2802
|
+
item_category: getItemCategory6(item),
|
|
2803
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
2685
2804
|
item_id: (_ref3 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
2686
2805
|
item_sku: (_ref4 = (_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items[0].itemId) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2687
2806
|
item_url: (_item_link = item.link) !== null && _item_link !== void 0 ? _item_link : null,
|
|
@@ -2715,7 +2834,7 @@ var AzzasTracker = function() {
|
|
|
2715
2834
|
return item.productId;
|
|
2716
2835
|
}).filter(function(id) {
|
|
2717
2836
|
return Boolean(id);
|
|
2718
|
-
});
|
|
2837
|
+
}).join();
|
|
2719
2838
|
}
|
|
2720
2839
|
return null;
|
|
2721
2840
|
},
|
|
@@ -2736,7 +2855,7 @@ var AzzasTracker = function() {
|
|
|
2736
2855
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2737
2856
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2738
2857
|
return context.products.map(function(item) {
|
|
2739
|
-
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty,
|
|
2858
|
+
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty, _getItemCategory24, _item_isVariantOf_productGroupID, _item_sku, _resizeVtexImage2, _ref3, _item_item_list_name;
|
|
2740
2859
|
var _item_isVariantOf_hasVariant, _item_isVariantOf, _find, _item_image, _item_offers_offers_find_seller, _item_offers_offers_find, _item_offers_offers, _item_offers;
|
|
2741
2860
|
var listPrice = item.offers.highPrice;
|
|
2742
2861
|
var price = item.offers.lowPrice;
|
|
@@ -2754,8 +2873,8 @@ var AzzasTracker = function() {
|
|
|
2754
2873
|
})) === null || _find === void 0 ? void 0 : _find.value) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2755
2874
|
item_ref: null,
|
|
2756
2875
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
2757
|
-
item_category:
|
|
2758
|
-
item_category2: (
|
|
2876
|
+
item_category: getItemCategory6(item),
|
|
2877
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
2759
2878
|
item_id: (_item_isVariantOf_productGroupID = item.isVariantOf.productGroupID) !== null && _item_isVariantOf_productGroupID !== void 0 ? _item_isVariantOf_productGroupID : null,
|
|
2760
2879
|
item_sku: (_item_sku = item.sku) !== null && _item_sku !== void 0 ? _item_sku : null,
|
|
2761
2880
|
item_url: null,
|
|
@@ -2790,7 +2909,7 @@ var AzzasTracker = function() {
|
|
|
2790
2909
|
return item.id;
|
|
2791
2910
|
}).filter(function(id) {
|
|
2792
2911
|
return Boolean(id);
|
|
2793
|
-
});
|
|
2912
|
+
}).join();
|
|
2794
2913
|
}
|
|
2795
2914
|
return null;
|
|
2796
2915
|
},
|
|
@@ -2806,7 +2925,7 @@ var AzzasTracker = function() {
|
|
|
2806
2925
|
}
|
|
2807
2926
|
};
|
|
2808
2927
|
// src/params/adapters/headless/index.ts
|
|
2809
|
-
var headlessAdapter = _object_spread_props(_object_spread({},
|
|
2928
|
+
var headlessAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
2810
2929
|
// global adapters
|
|
2811
2930
|
brand: function(context, config2) {
|
|
2812
2931
|
if (context.zone === "PDP") {
|
|
@@ -2875,7 +2994,7 @@ var AzzasTracker = function() {
|
|
|
2875
2994
|
return isNaN(days) ? 0 : days;
|
|
2876
2995
|
};
|
|
2877
2996
|
// src/params/adapters/pickup/index.ts
|
|
2878
|
-
var pickupAdapter = _object_spread_props(_object_spread({},
|
|
2997
|
+
var pickupAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
2879
2998
|
flag_pickup: function(context) {
|
|
2880
2999
|
var _ref;
|
|
2881
3000
|
return (_ref = context === null || context === void 0 ? void 0 : context.flag_pickup) !== null && _ref !== void 0 ? _ref : null;
|
|
@@ -2905,7 +3024,19 @@ var AzzasTracker = function() {
|
|
|
2905
3024
|
}
|
|
2906
3025
|
});
|
|
2907
3026
|
// src/params/adapters/orderForm/utils.ts
|
|
2908
|
-
var
|
|
3027
|
+
var getOrderFormItems = function(orderForm) {
|
|
3028
|
+
var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
|
|
3029
|
+
var isMultipleRemove = orderForm === null || orderForm === void 0 ? void 0 : orderForm.multipleRemove;
|
|
3030
|
+
return idSelected ? orderForm.items.filter(function(item) {
|
|
3031
|
+
return item.id === idSelected;
|
|
3032
|
+
}).map(function(i) {
|
|
3033
|
+
if (isMultipleRemove) return i;
|
|
3034
|
+
return _object_spread_props(_object_spread({}, i), {
|
|
3035
|
+
quantity: 1
|
|
3036
|
+
});
|
|
3037
|
+
}) : orderForm.items;
|
|
3038
|
+
};
|
|
3039
|
+
var getItemCategory7 = function(item) {
|
|
2909
3040
|
var _text_match;
|
|
2910
3041
|
var categories = item === null || item === void 0 ? void 0 : item.productCategories;
|
|
2911
3042
|
if (!categories) return "Cole\xE7\xE3o";
|
|
@@ -2913,7 +3044,7 @@ var AzzasTracker = function() {
|
|
|
2913
3044
|
var match = (_text_match = text.match(/outlet|bazar|sale/i)) === null || _text_match === void 0 ? void 0 : _text_match[0].toLowerCase();
|
|
2914
3045
|
return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
|
|
2915
3046
|
};
|
|
2916
|
-
var
|
|
3047
|
+
var getItemCategory25 = function(item) {
|
|
2917
3048
|
var _ref, _validHierarchy_;
|
|
2918
3049
|
var AVOID_CATEGORIES = /outlet|bazar|sale/i;
|
|
2919
3050
|
var categories = Object.values((_ref = item === null || item === void 0 ? void 0 : item.productCategories) !== null && _ref !== void 0 ? _ref : {});
|
|
@@ -2925,39 +3056,61 @@ var AzzasTracker = function() {
|
|
|
2925
3056
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2926
3057
|
return capitalize(deepest);
|
|
2927
3058
|
};
|
|
2928
|
-
var
|
|
2929
|
-
var
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
3059
|
+
var getPaymentType2 = function(context) {
|
|
3060
|
+
var _context_orderForm_paymentData, _context_orderForm_paymentData1, _context_orderForm_paymentData2, _system_name;
|
|
3061
|
+
if (context.payment_type) return context.payment_type;
|
|
3062
|
+
if (!context.orderForm) return null;
|
|
3063
|
+
var giftCards = ((_context_orderForm_paymentData = context.orderForm.paymentData) === null || _context_orderForm_paymentData === void 0 ? void 0 : _context_orderForm_paymentData.giftCards) || [];
|
|
3064
|
+
if (giftCards.some(function(g) {
|
|
3065
|
+
return g === null || g === void 0 ? void 0 : g.inUse;
|
|
3066
|
+
})) return "vale";
|
|
3067
|
+
var payments = ((_context_orderForm_paymentData1 = context.orderForm.paymentData) === null || _context_orderForm_paymentData1 === void 0 ? void 0 : _context_orderForm_paymentData1.payments) || [];
|
|
3068
|
+
var systems = ((_context_orderForm_paymentData2 = context.orderForm.paymentData) === null || _context_orderForm_paymentData2 === void 0 ? void 0 : _context_orderForm_paymentData2.paymentSystems) || [];
|
|
3069
|
+
if (!payments.length || !systems.length) return null;
|
|
3070
|
+
var selectedPayment = payments.find(function(p) {
|
|
3071
|
+
return p === null || p === void 0 ? void 0 : p.paymentSystem;
|
|
3072
|
+
}) || payments[0];
|
|
3073
|
+
var id = String((selectedPayment === null || selectedPayment === void 0 ? void 0 : selectedPayment.paymentSystem) || "").trim();
|
|
3074
|
+
if (!id) return null;
|
|
3075
|
+
var system = systems.find(function(s) {
|
|
3076
|
+
return String(s.id) === id;
|
|
3077
|
+
});
|
|
3078
|
+
var name = (system === null || system === void 0 ? void 0 : (_system_name = system.name) === null || _system_name === void 0 ? void 0 : _system_name.toLowerCase()) || "";
|
|
3079
|
+
var match = paymentTypeMap.find(function(param) {
|
|
3080
|
+
var _param = _sliced_to_array(param, 1), key = _param[0];
|
|
3081
|
+
return name.includes(key);
|
|
3082
|
+
});
|
|
3083
|
+
return match ? match[1] : null;
|
|
2933
3084
|
};
|
|
2934
3085
|
// src/params/adapters/orderForm/index.ts
|
|
2935
|
-
var orderFormAdapter = _object_spread_props(_object_spread({},
|
|
3086
|
+
var orderFormAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
2936
3087
|
items: function(context) {
|
|
2937
3088
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2938
3089
|
if ((context === null || context === void 0 ? void 0 : context.orderForm) && (context === null || context === void 0 ? void 0 : context.orderForm.items)) {
|
|
2939
3090
|
return getOrderFormItems(context.orderForm).map(function(item, index) {
|
|
2940
|
-
var _ref, _ref1, _ref2, _ref3,
|
|
2941
|
-
var
|
|
3091
|
+
var _ref, _ref1, _ref2, _ref3, _getItemCategory7, _getItemCategory25, _ref4, _ref5, _item_detailUrl, _resizeVtexImage2, _ref6, _ref7;
|
|
3092
|
+
var _item_skuName_split__split_pop, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _context_orderForm, _item_additionalInfo, _context_orderForm1;
|
|
3093
|
+
var color = context.brand === "carolbassi" ? null : 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();
|
|
3094
|
+
var size = context.brand === "carolbassi" ? item === null || item === void 0 ? void 0 : item.skuName : 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();
|
|
2942
3095
|
return {
|
|
2943
3096
|
quantity: (_ref = item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref !== void 0 ? _ref : 1,
|
|
2944
|
-
index: (_ref1 =
|
|
2945
|
-
item_brand: (
|
|
2946
|
-
item_name: (
|
|
2947
|
-
price: (item === null || item === void 0 ? void 0 : item.
|
|
3097
|
+
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,
|
|
3098
|
+
item_brand: (_ref2 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
3099
|
+
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,
|
|
3100
|
+
price: (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100,
|
|
2948
3101
|
discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
|
|
2949
|
-
item_variant:
|
|
2950
|
-
item_variant2:
|
|
3102
|
+
item_variant: color !== null && color !== void 0 ? color : null,
|
|
3103
|
+
item_variant2: size !== null && size !== void 0 ? size : null,
|
|
2951
3104
|
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
2952
3105
|
item_ref: (item === null || item === void 0 ? void 0 : item.productRefId) || (item === null || item === void 0 ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
2953
|
-
item_category: (
|
|
2954
|
-
item_category2: (
|
|
2955
|
-
item_id: (
|
|
2956
|
-
item_sku: (
|
|
3106
|
+
item_category: (_getItemCategory7 = getItemCategory7(item)) !== null && _getItemCategory7 !== void 0 ? _getItemCategory7 : null,
|
|
3107
|
+
item_category2: (_getItemCategory25 = getItemCategory25(item)) !== null && _getItemCategory25 !== void 0 ? _getItemCategory25 : null,
|
|
3108
|
+
item_id: (_ref4 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
3109
|
+
item_sku: (_ref5 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
2957
3110
|
item_url: (_item_detailUrl = item.detailUrl) !== null && _item_detailUrl !== void 0 ? _item_detailUrl : null,
|
|
2958
3111
|
image_url: (_resizeVtexImage2 = resizeVtexImage2(item.imageUrl)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
2959
|
-
seller_id: (
|
|
2960
|
-
item_list_name: (
|
|
3112
|
+
seller_id: (_ref6 = item === null || item === void 0 ? void 0 : item.seller) !== null && _ref6 !== void 0 ? _ref6 : null,
|
|
3113
|
+
item_list_name: (_ref7 = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.item_list_name) !== null && _ref7 !== void 0 ? _ref7 : null
|
|
2961
3114
|
};
|
|
2962
3115
|
});
|
|
2963
3116
|
}
|
|
@@ -2981,34 +3134,30 @@ var AzzasTracker = function() {
|
|
|
2981
3134
|
return item === null || item === void 0 ? void 0 : item.productId;
|
|
2982
3135
|
}).filter(function(id) {
|
|
2983
3136
|
return Boolean(id);
|
|
2984
|
-
});
|
|
3137
|
+
}).join();
|
|
2985
3138
|
},
|
|
2986
3139
|
value: function(context) {
|
|
2987
3140
|
var _context_orderForm;
|
|
2988
3141
|
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
2989
3142
|
if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
|
|
2990
3143
|
return getOrderFormItems(context.orderForm).map(function(item) {
|
|
2991
|
-
return (item === null || item === void 0 ? void 0 : item.
|
|
3144
|
+
return (item === null || item === void 0 ? void 0 : item.sellingPrice) / 100 * item.quantity;
|
|
2992
3145
|
}).filter(function(price) {
|
|
2993
3146
|
return price !== void 0;
|
|
2994
3147
|
}).reduce(function(sum, price) {
|
|
2995
3148
|
return sum + price;
|
|
2996
3149
|
}, 0);
|
|
2997
3150
|
},
|
|
2998
|
-
payment_type:
|
|
3151
|
+
payment_type: getPaymentType2,
|
|
2999
3152
|
total_discount: function(context) {
|
|
3000
|
-
var _context_orderForm, _context_orderForm1;
|
|
3153
|
+
var _context_orderForm, _context_orderForm1, _totalizers_find;
|
|
3001
3154
|
if (context === null || context === void 0 ? void 0 : context.total_discount) return context.total_discount;
|
|
3002
3155
|
if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
|
|
3003
|
-
var
|
|
3004
|
-
var
|
|
3005
|
-
var unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);
|
|
3006
|
-
return acc + unitDiscount * item.quantity;
|
|
3007
|
-
}, 0);
|
|
3008
|
-
var discounts = totalsList.find(function(t) {
|
|
3156
|
+
var totalizers = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.totalizers;
|
|
3157
|
+
var productDiscount = ((_totalizers_find = totalizers.find(function(t) {
|
|
3009
3158
|
return t.id === "Discounts";
|
|
3010
|
-
});
|
|
3011
|
-
return Math.abs(
|
|
3159
|
+
})) === null || _totalizers_find === void 0 ? void 0 : _totalizers_find.value) || 0;
|
|
3160
|
+
return Math.abs(productDiscount) / 100 || null;
|
|
3012
3161
|
},
|
|
3013
3162
|
subtotal: function(context) {
|
|
3014
3163
|
var _context_orderForm, _context_orderForm1;
|
|
@@ -3020,19 +3169,6 @@ var AzzasTracker = function() {
|
|
|
3020
3169
|
}, 0) / 100 || 0;
|
|
3021
3170
|
return subtotal;
|
|
3022
3171
|
},
|
|
3023
|
-
coupon_message: function(context) {
|
|
3024
|
-
var _context_orderForm;
|
|
3025
|
-
if (context.couponMessage) return context.couponMessage;
|
|
3026
|
-
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
3027
|
-
if (messages.length === 0) return null;
|
|
3028
|
-
var couponMessages = messages.filter(function(msg) {
|
|
3029
|
-
return msg.text.toLowerCase().includes("cupom");
|
|
3030
|
-
});
|
|
3031
|
-
if (couponMessages.length === 0) return null;
|
|
3032
|
-
return couponMessages.map(function(msg) {
|
|
3033
|
-
return msg.text;
|
|
3034
|
-
}).join(" | ");
|
|
3035
|
-
},
|
|
3036
3172
|
zipcode: function(context) {
|
|
3037
3173
|
var _context_meta_zipcode;
|
|
3038
3174
|
return (_context_meta_zipcode = context.meta.zipcode) !== null && _context_meta_zipcode !== void 0 ? _context_meta_zipcode : null;
|
|
@@ -3085,7 +3221,7 @@ var AzzasTracker = function() {
|
|
|
3085
3221
|
return sla.id === item.selectedSla;
|
|
3086
3222
|
});
|
|
3087
3223
|
return total + ((_ref = selected === null || selected === void 0 ? void 0 : selected.price) !== null && _ref !== void 0 ? _ref : 0);
|
|
3088
|
-
}, 0);
|
|
3224
|
+
}, 0) / 100;
|
|
3089
3225
|
},
|
|
3090
3226
|
shipping_tier: function(context) {
|
|
3091
3227
|
var _ref;
|
|
@@ -3126,6 +3262,19 @@ var AzzasTracker = function() {
|
|
|
3126
3262
|
var _context_orderForm_orderGroup, _context_orderForm;
|
|
3127
3263
|
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;
|
|
3128
3264
|
},
|
|
3265
|
+
coupon_message: function(context) {
|
|
3266
|
+
var _context_orderForm;
|
|
3267
|
+
if (context.couponMessage) return context.couponMessage;
|
|
3268
|
+
var messages = ((_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.messages) || [];
|
|
3269
|
+
if (messages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
3270
|
+
var couponMessages = messages.filter(function(msg) {
|
|
3271
|
+
return msg.text.toLowerCase().includes("cupom");
|
|
3272
|
+
});
|
|
3273
|
+
if (couponMessages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
3274
|
+
return couponMessages.map(function(msg) {
|
|
3275
|
+
return msg.text;
|
|
3276
|
+
}).join(" | ");
|
|
3277
|
+
},
|
|
3129
3278
|
coupon: function(context) {
|
|
3130
3279
|
var _context_orderForm_marketingData, _context_orderForm;
|
|
3131
3280
|
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;
|
|
@@ -3137,9 +3286,11 @@ var AzzasTracker = function() {
|
|
|
3137
3286
|
// src/formatter.ts
|
|
3138
3287
|
var adapters = {
|
|
3139
3288
|
DECO: decoAdapter,
|
|
3289
|
+
RESERVA: reservaAdapter,
|
|
3140
3290
|
HEADLESS: headlessAdapter,
|
|
3141
3291
|
PICKUP: pickupAdapter,
|
|
3142
|
-
ORDERFORM: orderFormAdapter
|
|
3292
|
+
ORDERFORM: orderFormAdapter,
|
|
3293
|
+
META: metaAdapter
|
|
3143
3294
|
};
|
|
3144
3295
|
// src/index.ts
|
|
3145
3296
|
var config = {
|