@azzas/azzas-tracker-web 2.0.0-preview.1 → 2.0.0-preview.2
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 +123 -61
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.global.js +123 -61
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +123 -61
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +134 -86
- package/package.json +1 -1
package/dist/mod.vtex.global.js
CHANGED
|
@@ -1311,10 +1311,6 @@ var AzzasTracker = function() {
|
|
|
1311
1311
|
var getItemShippingTier2 = function getItemShippingTier2() {
|
|
1312
1312
|
return null;
|
|
1313
1313
|
};
|
|
1314
|
-
var resizeVtexImage3 = function resizeVtexImage3(url) {
|
|
1315
|
-
var width = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 500, height = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 500;
|
|
1316
|
-
return url === null || url === void 0 ? void 0 : url.replace(/(\/arquivos\/ids\/\d+)-\d+-\d+\//, "$1-".concat(width, "-").concat(height, "/"));
|
|
1317
|
-
};
|
|
1318
1314
|
var getParameters = function getParameters(context, eventName) {
|
|
1319
1315
|
return _async_to_generator(function() {
|
|
1320
1316
|
var _adapters_currentAdapter, eventConfig, currentAdapter, getters, entries;
|
|
@@ -2106,6 +2102,10 @@ var AzzasTracker = function() {
|
|
|
2106
2102
|
var capitalize = function(str) {
|
|
2107
2103
|
return str ? str[0].toUpperCase() + str.slice(1).toLowerCase() : "";
|
|
2108
2104
|
};
|
|
2105
|
+
var resizeVtexImage2 = function(url) {
|
|
2106
|
+
var width = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 500, height = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 500;
|
|
2107
|
+
return url === null || url === void 0 ? void 0 : url.replace(/(\/arquivos\/ids\/\d+)-\d+-\d+\//, "$1-".concat(width, "-").concat(height, "/"));
|
|
2108
|
+
};
|
|
2109
2109
|
// src/params/userInfo.ts
|
|
2110
2110
|
var PROD_DOMAINS = {
|
|
2111
2111
|
"animale": {
|
|
@@ -2479,10 +2479,6 @@ var AzzasTracker = function() {
|
|
|
2479
2479
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2480
2480
|
return capitalize(deepest);
|
|
2481
2481
|
};
|
|
2482
|
-
var resizeVtexImage2 = function(url) {
|
|
2483
|
-
var width = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 500, height = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 500;
|
|
2484
|
-
return url === null || url === void 0 ? void 0 : url.replace(/(\/arquivos\/ids\/\d+)-\d+-\d+\//, "$1-".concat(width, "-").concat(height, "/"));
|
|
2485
|
-
};
|
|
2486
2482
|
// src/params/adapters/deco/index.ts
|
|
2487
2483
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
2488
2484
|
var LIST_PRICE_SCHEMA = "https://schema.org/ListPrice";
|
|
@@ -2493,7 +2489,7 @@ var AzzasTracker = function() {
|
|
|
2493
2489
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2494
2490
|
return context.products.map(function(item) {
|
|
2495
2491
|
var _ref, _ref1, _item_alternateName, _ref2, _ref3, _ref4, _getItemCategory3, _getItemCategory22, _ref5, _item_sku, _item_url, _resizeVtexImage2, _ref6, _ref7;
|
|
2496
|
-
var _item_offers_offers__priceSpecification_find, _item_offers_offers, _item_offers, _item_brand_name, _item_brand, _item_offers1, _item_offers2, _item_name_split_, _item_name, _item_name1, _item_additionalProperty_find, _item_additionalProperty, _item_image, _item_offers_offers_, _item_offers_offers1, _item_offers3;
|
|
2492
|
+
var _item_offers_offers__priceSpecification_find, _item_offers_offers, _item_offers, _item_brand_name, _item_brand, _item_offers1, _item_offers2, _item_name_split_, _item_name, _item_name1, _item_additionalProperty_find_value, _item_additionalProperty_find, _item_additionalProperty, _item_image, _item_offers_offers_, _item_offers_offers1, _item_offers3;
|
|
2497
2493
|
var COLOR_REGEX = /^[^_]+_/;
|
|
2498
2494
|
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__priceSpecification_find = _item_offers_offers[0].priceSpecification.find(function(s) {
|
|
2499
2495
|
return s.priceType === LIST_PRICE_SCHEMA;
|
|
@@ -2504,7 +2500,7 @@ var AzzasTracker = function() {
|
|
|
2504
2500
|
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,
|
|
2505
2501
|
item_name: (_item_alternateName = item.alternateName) !== null && _item_alternateName !== void 0 ? _item_alternateName : null,
|
|
2506
2502
|
price: (_ref2 = (_item_offers1 = item.offers) === null || _item_offers1 === void 0 ? void 0 : _item_offers1.lowPrice) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2507
|
-
discount: Number(listPrice) - Number(item === null || item === void 0 ? void 0 : (_item_offers2 = item.offers) === null || _item_offers2 === void 0 ? void 0 : _item_offers2.lowPrice),
|
|
2503
|
+
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,
|
|
2508
2504
|
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,
|
|
2509
2505
|
// cor
|
|
2510
2506
|
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,
|
|
@@ -2512,7 +2508,7 @@ var AzzasTracker = function() {
|
|
|
2512
2508
|
item_shipping_tier: getItemShippingTier2(),
|
|
2513
2509
|
item_ref: (_ref4 = (_item_additionalProperty = item.additionalProperty) === null || _item_additionalProperty === void 0 ? void 0 : (_item_additionalProperty_find = _item_additionalProperty.find(function(i) {
|
|
2514
2510
|
return i.name === "RefId";
|
|
2515
|
-
})) === null || _item_additionalProperty_find === void 0 ? void 0 : _item_additionalProperty_find.value) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2511
|
+
})) === 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+$/, "")) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2516
2512
|
item_category: (_getItemCategory3 = getItemCategory3(item)) !== null && _getItemCategory3 !== void 0 ? _getItemCategory3 : null,
|
|
2517
2513
|
item_category2: (_getItemCategory22 = getItemCategory22(item)) !== null && _getItemCategory22 !== void 0 ? _getItemCategory22 : null,
|
|
2518
2514
|
item_id: (_ref5 = item === null || item === void 0 ? void 0 : item.inProductGroupWithID) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
@@ -2582,9 +2578,94 @@ var AzzasTracker = function() {
|
|
|
2582
2578
|
return null;
|
|
2583
2579
|
}
|
|
2584
2580
|
});
|
|
2581
|
+
// src/params/adapters/orderForm/utils.ts
|
|
2582
|
+
var getItemCategory5 = function(item) {
|
|
2583
|
+
var _text_match;
|
|
2584
|
+
var categories = item === null || item === void 0 ? void 0 : item.productCategories;
|
|
2585
|
+
if (!categories) return "Cole\xE7\xE3o";
|
|
2586
|
+
var text = Object.values(categories).join(" ");
|
|
2587
|
+
var match = (_text_match = text.match(/outlet|bazar|sale/i)) === null || _text_match === void 0 ? void 0 : _text_match[0].toLowerCase();
|
|
2588
|
+
return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
|
|
2589
|
+
};
|
|
2590
|
+
var getItemCategory23 = function(item) {
|
|
2591
|
+
var _ref, _validHierarchy_;
|
|
2592
|
+
var AVOID_CATEGORIES = /outlet|bazar|sale/i;
|
|
2593
|
+
var categories = Object.values((_ref = item === null || item === void 0 ? void 0 : item.productCategories) !== null && _ref !== void 0 ? _ref : {});
|
|
2594
|
+
var validHierarchy = categories.map(function(c) {
|
|
2595
|
+
return c.trim();
|
|
2596
|
+
}).filter(function(c) {
|
|
2597
|
+
return c && !AVOID_CATEGORIES.test(c);
|
|
2598
|
+
});
|
|
2599
|
+
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2600
|
+
return capitalize(deepest);
|
|
2601
|
+
};
|
|
2602
|
+
var getOrderFormItems = function(orderForm) {
|
|
2603
|
+
var idSelected = orderForm === null || orderForm === void 0 ? void 0 : orderForm.selected;
|
|
2604
|
+
return idSelected ? orderForm.items.filter(function(item) {
|
|
2605
|
+
return item.id === idSelected;
|
|
2606
|
+
}) : orderForm.items;
|
|
2607
|
+
};
|
|
2585
2608
|
// src/params/adapters/orderForm/index.ts
|
|
2586
|
-
var
|
|
2587
|
-
|
|
2609
|
+
var orderFormAdapter = _object_spread_props(_object_spread({}, metaAdapters), {
|
|
2610
|
+
items: function(context) {
|
|
2611
|
+
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2612
|
+
if ((context === null || context === void 0 ? void 0 : context.orderForm) && (context === null || context === void 0 ? void 0 : context.orderForm.items)) {
|
|
2613
|
+
return getOrderFormItems(context.orderForm).map(function(item, index) {
|
|
2614
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _getItemCategory5, _getItemCategory23, _ref7, _ref8, _item_detailUrl, _resizeVtexImage2, _ref9, _ref10;
|
|
2615
|
+
var _context_orderForm, _item_additionalInfo, _item_skuName_split__split_pop, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _context_orderForm1;
|
|
2616
|
+
return {
|
|
2617
|
+
quantity: (_ref = item === null || item === void 0 ? void 0 : item.quantity) !== null && _ref !== void 0 ? _ref : 1,
|
|
2618
|
+
index: (_ref1 = (_ref2 = context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.index) !== null && _ref2 !== void 0 ? _ref2 : index) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
2619
|
+
item_brand: (_ref3 = (_item_additionalInfo = item.additionalInfo) === null || _item_additionalInfo === void 0 ? void 0 : _item_additionalInfo.brandName) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
2620
|
+
item_name: (_ref4 = item === null || item === void 0 ? void 0 : item.name.replace(item === null || item === void 0 ? void 0 : item.skuName, "").trim()) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2621
|
+
price: (item === null || item === void 0 ? void 0 : item.price) / 100,
|
|
2622
|
+
discount: ((item === null || item === void 0 ? void 0 : item.listPrice) - (item === null || item === void 0 ? void 0 : item.sellingPrice)) / 100,
|
|
2623
|
+
item_variant: (_ref5 = 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 && _ref5 !== void 0 ? _ref5 : null,
|
|
2624
|
+
item_variant2: (_ref6 = 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 && _ref6 !== void 0 ? _ref6 : null,
|
|
2625
|
+
item_shipping_tier: "",
|
|
2626
|
+
item_ref: (item === null || item === void 0 ? void 0 : item.productRefId) || (item === null || item === void 0 ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
2627
|
+
item_category: (_getItemCategory5 = getItemCategory5(item)) !== null && _getItemCategory5 !== void 0 ? _getItemCategory5 : null,
|
|
2628
|
+
item_category2: (_getItemCategory23 = getItemCategory23(item)) !== null && _getItemCategory23 !== void 0 ? _getItemCategory23 : null,
|
|
2629
|
+
item_id: (_ref7 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref7 !== void 0 ? _ref7 : null,
|
|
2630
|
+
item_sku: (_ref8 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref8 !== void 0 ? _ref8 : null,
|
|
2631
|
+
item_url: (_item_detailUrl = item.detailUrl) !== null && _item_detailUrl !== void 0 ? _item_detailUrl : null,
|
|
2632
|
+
image_url: (_resizeVtexImage2 = resizeVtexImage2(item.imageUrl)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
2633
|
+
seller_id: (_ref9 = item === null || item === void 0 ? void 0 : item.seller) !== null && _ref9 !== void 0 ? _ref9 : null,
|
|
2634
|
+
item_list_name: (_ref10 = context === null || context === void 0 ? void 0 : (_context_orderForm1 = context.orderForm) === null || _context_orderForm1 === void 0 ? void 0 : _context_orderForm1.item_list_name) !== null && _ref10 !== void 0 ? _ref10 : null
|
|
2635
|
+
};
|
|
2636
|
+
});
|
|
2637
|
+
}
|
|
2638
|
+
return null;
|
|
2639
|
+
},
|
|
2640
|
+
// brand: (context: any) => {
|
|
2641
|
+
// if (context?.brand) return context.brand
|
|
2642
|
+
// if (context?.products) {
|
|
2643
|
+
// return context.products[0].brand?.name // tem que ajustar FARM por conta de FARM_ETC
|
|
2644
|
+
// }
|
|
2645
|
+
// return null
|
|
2646
|
+
// },
|
|
2647
|
+
line_items: function(context) {
|
|
2648
|
+
var _context_orderForm;
|
|
2649
|
+
if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
|
|
2650
|
+
if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
|
|
2651
|
+
return getOrderFormItems(context.orderForm).map(function(item) {
|
|
2652
|
+
return item === null || item === void 0 ? void 0 : item.productId;
|
|
2653
|
+
}).filter(function(id) {
|
|
2654
|
+
return Boolean(id);
|
|
2655
|
+
});
|
|
2656
|
+
},
|
|
2657
|
+
value: function(context) {
|
|
2658
|
+
var _context_orderForm;
|
|
2659
|
+
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
2660
|
+
if (!(context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : _context_orderForm.items)) return null;
|
|
2661
|
+
return getOrderFormItems(context.orderForm).map(function(item) {
|
|
2662
|
+
return (item === null || item === void 0 ? void 0 : item.price) / 100 * item.quantity;
|
|
2663
|
+
}).filter(function(price) {
|
|
2664
|
+
return price !== void 0;
|
|
2665
|
+
}).reduce(function(sum, price) {
|
|
2666
|
+
return sum + price;
|
|
2667
|
+
}, 0);
|
|
2668
|
+
},
|
|
2588
2669
|
payment_type: getPaymentType,
|
|
2589
2670
|
total_discount: function(context) {
|
|
2590
2671
|
var _context_orderForm, _context_orderForm1;
|
|
@@ -2623,6 +2704,10 @@ var AzzasTracker = function() {
|
|
|
2623
2704
|
return msg.text;
|
|
2624
2705
|
}).join(" | ");
|
|
2625
2706
|
},
|
|
2707
|
+
zipcode: function(context) {
|
|
2708
|
+
var _context_zipcode;
|
|
2709
|
+
return (_context_zipcode = context.zipcode) !== null && _context_zipcode !== void 0 ? _context_zipcode : null;
|
|
2710
|
+
},
|
|
2626
2711
|
flag_pickup: function(context) {
|
|
2627
2712
|
var _orderForm_shippingData;
|
|
2628
2713
|
var orderForm = context.orderForm;
|
|
@@ -2637,68 +2722,28 @@ var AzzasTracker = function() {
|
|
|
2637
2722
|
return hasPickup;
|
|
2638
2723
|
},
|
|
2639
2724
|
shippings: function(context) {
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
var
|
|
2643
|
-
|
|
2644
|
-
|
|
2645
|
-
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
if (!
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
line_items: []
|
|
2660
|
-
};
|
|
2661
|
-
}
|
|
2662
|
-
groupShipping[key].line_items.push(item.id);
|
|
2663
|
-
}
|
|
2664
|
-
} catch (err) {
|
|
2665
|
-
_didIteratorError1 = true;
|
|
2666
|
-
_iteratorError1 = err;
|
|
2667
|
-
} finally{
|
|
2668
|
-
try {
|
|
2669
|
-
if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
|
|
2670
|
-
_iterator1.return();
|
|
2671
|
-
}
|
|
2672
|
-
} finally{
|
|
2673
|
-
if (_didIteratorError1) {
|
|
2674
|
-
throw _iteratorError1;
|
|
2675
|
-
}
|
|
2676
|
-
}
|
|
2677
|
-
}
|
|
2678
|
-
}
|
|
2679
|
-
} catch (err) {
|
|
2680
|
-
_didIteratorError = true;
|
|
2681
|
-
_iteratorError = err;
|
|
2682
|
-
} finally{
|
|
2683
|
-
try {
|
|
2684
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2685
|
-
_iterator.return();
|
|
2686
|
-
}
|
|
2687
|
-
} finally{
|
|
2688
|
-
if (_didIteratorError) {
|
|
2689
|
-
throw _iteratorError;
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
}
|
|
2693
|
-
var shippings = Object.values(groupShipping).map(function(s) {
|
|
2694
|
-
return {
|
|
2695
|
-
shipping: s.shipping,
|
|
2696
|
-
shipping_tier: s.shipping_tier,
|
|
2697
|
-
delivery_time: s.delivery_time,
|
|
2725
|
+
if (!context.orderForm) return null;
|
|
2726
|
+
var _context_orderForm = context.orderForm, items = _context_orderForm.items, shippingData = _context_orderForm.shippingData;
|
|
2727
|
+
var acc = {};
|
|
2728
|
+
shippingData.logisticsInfo.forEach(function(param) {
|
|
2729
|
+
var itemIndex = param.itemIndex, slas = param.slas;
|
|
2730
|
+
var item = items[itemIndex];
|
|
2731
|
+
if (!item) return;
|
|
2732
|
+
slas.forEach(function(sla) {
|
|
2733
|
+
if (!acc[sla.name]) acc[sla.name] = {
|
|
2734
|
+
shipping_tier: sla.name,
|
|
2735
|
+
delivery_time: parseInt(sla.shippingEstimate),
|
|
2736
|
+
shipping: parseFloat((sla.price / 100).toFixed(1)),
|
|
2737
|
+
line_items: []
|
|
2738
|
+
};
|
|
2739
|
+
acc[sla.name].line_items.push(item.id);
|
|
2740
|
+
});
|
|
2741
|
+
});
|
|
2742
|
+
return Object.values(acc).map(function(s) {
|
|
2743
|
+
return _object_spread_props(_object_spread({}, s), {
|
|
2698
2744
|
line_items: s.line_items.join(",")
|
|
2699
|
-
};
|
|
2745
|
+
});
|
|
2700
2746
|
});
|
|
2701
|
-
return shippings || null;
|
|
2702
2747
|
},
|
|
2703
2748
|
shipping: function(context) {
|
|
2704
2749
|
var _ref;
|
|
@@ -2759,9 +2804,9 @@ var AzzasTracker = function() {
|
|
|
2759
2804
|
seller_cod_name: function(context) {
|
|
2760
2805
|
return context.appliedSellerCodName || (context === null || context === void 0 ? void 0 : context.orderForm.marketingData.utmiCampaign) || null;
|
|
2761
2806
|
}
|
|
2762
|
-
};
|
|
2807
|
+
});
|
|
2763
2808
|
// src/params/adapters/headless/utils.ts
|
|
2764
|
-
var
|
|
2809
|
+
var getItemCategory6 = function(item) {
|
|
2765
2810
|
var keywords = [
|
|
2766
2811
|
"outlet",
|
|
2767
2812
|
"bazar",
|
|
@@ -2778,7 +2823,7 @@ var AzzasTracker = function() {
|
|
|
2778
2823
|
}
|
|
2779
2824
|
return "Cole\xE7\xE3o";
|
|
2780
2825
|
};
|
|
2781
|
-
var
|
|
2826
|
+
var getItemCategory24 = function(item) {
|
|
2782
2827
|
var _ref, _reverse_find;
|
|
2783
2828
|
var _item_categories;
|
|
2784
2829
|
var avoidList = /outlet|bazar|sale/i;
|
|
@@ -2795,7 +2840,7 @@ var AzzasTracker = function() {
|
|
|
2795
2840
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2796
2841
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2797
2842
|
return context.products.map(function(item) {
|
|
2798
|
-
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference,
|
|
2843
|
+
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference, _getItemCategory24, _ref3, _ref4, _item_link, _resizeVtexImage2, _ref5, _item_item_list_name;
|
|
2799
2844
|
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;
|
|
2800
2845
|
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;
|
|
2801
2846
|
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;
|
|
@@ -2805,18 +2850,19 @@ var AzzasTracker = function() {
|
|
|
2805
2850
|
item_brand: (_item_brand = item.brand) !== null && _item_brand !== void 0 ? _item_brand : null,
|
|
2806
2851
|
item_name: (_item_productName = item.productName) !== null && _item_productName !== void 0 ? _item_productName : null,
|
|
2807
2852
|
price: price !== null && price !== void 0 ? price : null,
|
|
2853
|
+
item_shipping_tier: null,
|
|
2808
2854
|
discount: Number(listPrice) - Number(price),
|
|
2809
2855
|
item_variant: (_ref1 = (_item_items_ = item.items[0]) === null || _item_items_ === void 0 ? void 0 : (_item_items__name = _item_items_.name) === null || _item_items__name === void 0 ? void 0 : _item_items__name.split(" - ")[0]) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
2810
2856
|
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,
|
|
2811
2857
|
item_ref: (_item_productReference = item.productReference) !== null && _item_productReference !== void 0 ? _item_productReference : null,
|
|
2812
2858
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
2813
|
-
item_category:
|
|
2814
|
-
item_category2: (
|
|
2859
|
+
item_category: getItemCategory6(item),
|
|
2860
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
2815
2861
|
item_id: (_ref3 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
2816
2862
|
item_sku: (_ref4 = (_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items[0].itemId) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2817
2863
|
item_url: (_item_link = item.link) !== null && _item_link !== void 0 ? _item_link : null,
|
|
2818
2864
|
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
2819
|
-
image_url: (
|
|
2865
|
+
image_url: (_resizeVtexImage2 = resizeVtexImage2(item === null || item === void 0 ? void 0 : (_item_items1 = item.items) === null || _item_items1 === void 0 ? void 0 : (_item_items__images = _item_items1[0].images) === null || _item_items__images === void 0 ? void 0 : _item_items__images[0].imageUrl)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
2820
2866
|
seller_id: (_ref5 = (_item_items2 = item.items) === null || _item_items2 === void 0 ? void 0 : (_item_items_2 = _item_items2[0]) === null || _item_items_2 === void 0 ? void 0 : (_item_items__sellers2 = _item_items_2.sellers) === null || _item_items__sellers2 === void 0 ? void 0 : _item_items__sellers2[0].sellerId) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
2821
2867
|
item_list_name: (_item_item_list_name = item.item_list_name) !== null && _item_item_list_name !== void 0 ? _item_item_list_name : null
|
|
2822
2868
|
};
|
|
@@ -2865,7 +2911,7 @@ var AzzasTracker = function() {
|
|
|
2865
2911
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2866
2912
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2867
2913
|
return context.products.map(function(item) {
|
|
2868
|
-
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty,
|
|
2914
|
+
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty, _getItemCategory24, _item_isVariantOf_productGroupID, _item_sku, _resizeVtexImage2, _ref3, _item_item_list_name;
|
|
2869
2915
|
var _item_isVariantOf_hasVariant, _item_isVariantOf, _find, _item_image, _item_offers_offers_find_seller, _item_offers_offers_find, _item_offers_offers, _item_offers;
|
|
2870
2916
|
var listPrice = item.offers.highPrice;
|
|
2871
2917
|
var price = item.offers.lowPrice;
|
|
@@ -2875,6 +2921,7 @@ var AzzasTracker = function() {
|
|
|
2875
2921
|
item_brand: (_item_brand_name = item.brand.name) !== null && _item_brand_name !== void 0 ? _item_brand_name : null,
|
|
2876
2922
|
item_name: (_item_name = item.name) !== null && _item_name !== void 0 ? _item_name : null,
|
|
2877
2923
|
price: price !== null && price !== void 0 ? price : null,
|
|
2924
|
+
item_shipping_tier: null,
|
|
2878
2925
|
discount: Number(listPrice) - Number(price),
|
|
2879
2926
|
item_variant: (_ref1 = (_item_isVariantOf = item.isVariantOf) === null || _item_isVariantOf === void 0 ? void 0 : (_item_isVariantOf_hasVariant = _item_isVariantOf.hasVariant) === null || _item_isVariantOf_hasVariant === void 0 ? void 0 : _item_isVariantOf_hasVariant[0].name.split(" - ")[0]) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
2880
2927
|
item_variant2: (_ref2 = (_find = ((_item_additionalProperty = item.additionalProperty) !== null && _item_additionalProperty !== void 0 ? _item_additionalProperty : []).find(function(p) {
|
|
@@ -2882,13 +2929,13 @@ var AzzasTracker = function() {
|
|
|
2882
2929
|
})) === null || _find === void 0 ? void 0 : _find.value) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2883
2930
|
item_ref: null,
|
|
2884
2931
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
2885
|
-
item_category:
|
|
2886
|
-
item_category2: (
|
|
2932
|
+
item_category: getItemCategory6(item),
|
|
2933
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
2887
2934
|
item_id: (_item_isVariantOf_productGroupID = item.isVariantOf.productGroupID) !== null && _item_isVariantOf_productGroupID !== void 0 ? _item_isVariantOf_productGroupID : null,
|
|
2888
2935
|
item_sku: (_item_sku = item.sku) !== null && _item_sku !== void 0 ? _item_sku : null,
|
|
2889
2936
|
item_url: null,
|
|
2890
2937
|
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
2891
|
-
image_url: (
|
|
2938
|
+
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,
|
|
2892
2939
|
seller_id: (_ref3 = (_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_find = _item_offers_offers.find(function(o) {
|
|
2893
2940
|
return o.availability;
|
|
2894
2941
|
})) === null || _item_offers_offers_find === void 0 ? void 0 : (_item_offers_offers_find_seller = _item_offers_offers_find.seller) === null || _item_offers_offers_find_seller === void 0 ? void 0 : _item_offers_offers_find_seller.identifier) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
@@ -2933,7 +2980,7 @@ var AzzasTracker = function() {
|
|
|
2933
2980
|
}
|
|
2934
2981
|
};
|
|
2935
2982
|
// src/params/adapters/headless/index.ts
|
|
2936
|
-
var headlessAdapter = _object_spread_props(_object_spread({}, metaAdapters,
|
|
2983
|
+
var headlessAdapter = _object_spread_props(_object_spread({}, metaAdapters, orderFormAdapter), {
|
|
2937
2984
|
// orderForm adapters, confirmar se no storefront tem evento que usa essses params
|
|
2938
2985
|
brand: function(context) {
|
|
2939
2986
|
if (context.zone === "PDP") {
|
|
@@ -3030,7 +3077,8 @@ var AzzasTracker = function() {
|
|
|
3030
3077
|
var adapters = {
|
|
3031
3078
|
DECO: decoAdapter,
|
|
3032
3079
|
HEADLESS: headlessAdapter,
|
|
3033
|
-
PICKUP: pickupAdapter
|
|
3080
|
+
PICKUP: pickupAdapter,
|
|
3081
|
+
ORDERFORM: orderFormAdapter
|
|
3034
3082
|
};
|
|
3035
3083
|
var src_default = {
|
|
3036
3084
|
trackWebEvent: trackWebEvent,
|