@azzas/azzas-tracker-web 2.0.0-preview.3 → 2.0.0-preview.4
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 +14 -9
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.global.js +14 -9
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +14 -9
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +15 -8
- package/package.json +1 -1
package/dist/mod.global.js
CHANGED
|
@@ -1439,9 +1439,6 @@ var AzzasTracker = (() => {
|
|
|
1439
1439
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1440
1440
|
return capitalize(deepest);
|
|
1441
1441
|
};
|
|
1442
|
-
function getItemShippingTier2() {
|
|
1443
|
-
return null;
|
|
1444
|
-
}
|
|
1445
1442
|
|
|
1446
1443
|
// src/params/adapters/deco/index.ts
|
|
1447
1444
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
@@ -1469,7 +1466,7 @@ var AzzasTracker = (() => {
|
|
|
1469
1466
|
// cor
|
|
1470
1467
|
item_variant2: (_o = (_n = item == null ? void 0 : item.name) == null ? void 0 : _n.split(" - ")[1]) != null ? _o : null,
|
|
1471
1468
|
// tamanho
|
|
1472
|
-
item_shipping_tier:
|
|
1469
|
+
item_shipping_tier: "",
|
|
1473
1470
|
item_ref: (_s = (_r = (_q = (_p = item.additionalProperty) == null ? void 0 : _p.find((i) => i.name === "RefId")) == null ? void 0 : _q.value) == null ? void 0 : _r.replace(/_\d+$/, "")) != null ? _s : null,
|
|
1474
1471
|
item_category: (_t = getItemCategory3(item)) != null ? _t : null,
|
|
1475
1472
|
item_category2: (_u = getItemCategory22(item)) != null ? _u : null,
|
|
@@ -1549,6 +1546,14 @@ var AzzasTracker = (() => {
|
|
|
1549
1546
|
const deepest = (_b = validHierarchy[validHierarchy.length - 1]) != null ? _b : "";
|
|
1550
1547
|
return capitalize(deepest);
|
|
1551
1548
|
};
|
|
1549
|
+
function getItemShippingTier2(orderForm, item) {
|
|
1550
|
+
var _a, _b, _c, _d;
|
|
1551
|
+
const info = (_b = (_a = orderForm == null ? void 0 : orderForm.shippingData) == null ? void 0 : _a.logisticsInfo) == null ? void 0 : _b.find(
|
|
1552
|
+
(li) => li.itemId === item.id
|
|
1553
|
+
);
|
|
1554
|
+
const selectedSla = (_c = info == null ? void 0 : info.slas) == null ? void 0 : _c.find((sla) => sla.id === info.selectedSla);
|
|
1555
|
+
return ((_d = selectedSla == null ? void 0 : selectedSla.pickupStoreInfo) == null ? void 0 : _d.friendlyName) ? `retirada em loja: ${selectedSla.pickupStoreInfo.friendlyName}` : (selectedSla == null ? void 0 : selectedSla.name) ? `Receba em casa: ${selectedSla.name}` : null;
|
|
1556
|
+
}
|
|
1552
1557
|
var getOrderFormItems = (orderForm) => {
|
|
1553
1558
|
const idSelected = orderForm == null ? void 0 : orderForm.selected;
|
|
1554
1559
|
return idSelected ? orderForm.items.filter((item) => item.id === idSelected) : orderForm.items;
|
|
@@ -1571,7 +1576,7 @@ var AzzasTracker = (() => {
|
|
|
1571
1576
|
discount: ((item == null ? void 0 : item.listPrice) - (item == null ? void 0 : item.sellingPrice)) / 100,
|
|
1572
1577
|
item_variant: (_k = (_j = (_i = (_h = item == null ? void 0 : item.skuName) == null ? void 0 : _h.split(" - ")[0]) == null ? void 0 : _i.split("_").pop()) == null ? void 0 : _j.trim()) != null ? _k : null,
|
|
1573
1578
|
item_variant2: (_n = (_m = (_l = item == null ? void 0 : item.skuName) == null ? void 0 : _l.split(" - ")[1]) == null ? void 0 : _m.trim()) != null ? _n : null,
|
|
1574
|
-
item_shipping_tier:
|
|
1579
|
+
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
1575
1580
|
item_ref: (item == null ? void 0 : item.productRefId) || (item == null ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
1576
1581
|
item_category: (_o = getItemCategory5(item)) != null ? _o : null,
|
|
1577
1582
|
item_category2: (_p = getItemCategory23(item)) != null ? _p : null,
|
|
@@ -1608,10 +1613,10 @@ var AzzasTracker = (() => {
|
|
|
1608
1613
|
payment_type: getPaymentType,
|
|
1609
1614
|
total_discount: (context) => {
|
|
1610
1615
|
var _a, _b;
|
|
1611
|
-
if (context == null ? void 0 : context.
|
|
1612
|
-
|
|
1613
|
-
const
|
|
1614
|
-
const totalDiscount =
|
|
1616
|
+
if (context == null ? void 0 : context.total_discount) return context.total_discount;
|
|
1617
|
+
if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
|
|
1618
|
+
const totalsList = ((_b = context.orderForm) == null ? void 0 : _b.totalizers) || [];
|
|
1619
|
+
const totalDiscount = getOrderFormItems(context.orderForm).reduce((acc, item) => {
|
|
1615
1620
|
const unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);
|
|
1616
1621
|
return acc + unitDiscount * item.quantity;
|
|
1617
1622
|
}, 0);
|