@azzas/azzas-tracker-web 2.0.0-preview.2 → 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.d.cts +446 -0
- package/dist/mod.d.ts +446 -0
- 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.js
CHANGED
|
@@ -1411,9 +1411,6 @@ var getItemCategory22 = (item) => {
|
|
|
1411
1411
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1412
1412
|
return capitalize(deepest);
|
|
1413
1413
|
};
|
|
1414
|
-
function getItemShippingTier2() {
|
|
1415
|
-
return null;
|
|
1416
|
-
}
|
|
1417
1414
|
|
|
1418
1415
|
// src/params/adapters/deco/index.ts
|
|
1419
1416
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
@@ -1441,7 +1438,7 @@ var decoAdapter = {
|
|
|
1441
1438
|
// cor
|
|
1442
1439
|
item_variant2: (_o = (_n = item == null ? void 0 : item.name) == null ? void 0 : _n.split(" - ")[1]) != null ? _o : null,
|
|
1443
1440
|
// tamanho
|
|
1444
|
-
item_shipping_tier:
|
|
1441
|
+
item_shipping_tier: "",
|
|
1445
1442
|
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,
|
|
1446
1443
|
item_category: (_t = getItemCategory3(item)) != null ? _t : null,
|
|
1447
1444
|
item_category2: (_u = getItemCategory22(item)) != null ? _u : null,
|
|
@@ -1521,6 +1518,14 @@ var getItemCategory23 = (item) => {
|
|
|
1521
1518
|
const deepest = (_b = validHierarchy[validHierarchy.length - 1]) != null ? _b : "";
|
|
1522
1519
|
return capitalize(deepest);
|
|
1523
1520
|
};
|
|
1521
|
+
function getItemShippingTier2(orderForm, item) {
|
|
1522
|
+
var _a, _b, _c, _d;
|
|
1523
|
+
const info = (_b = (_a = orderForm == null ? void 0 : orderForm.shippingData) == null ? void 0 : _a.logisticsInfo) == null ? void 0 : _b.find(
|
|
1524
|
+
(li) => li.itemId === item.id
|
|
1525
|
+
);
|
|
1526
|
+
const selectedSla = (_c = info == null ? void 0 : info.slas) == null ? void 0 : _c.find((sla) => sla.id === info.selectedSla);
|
|
1527
|
+
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;
|
|
1528
|
+
}
|
|
1524
1529
|
var getOrderFormItems = (orderForm) => {
|
|
1525
1530
|
const idSelected = orderForm == null ? void 0 : orderForm.selected;
|
|
1526
1531
|
return idSelected ? orderForm.items.filter((item) => item.id === idSelected) : orderForm.items;
|
|
@@ -1543,7 +1548,7 @@ var orderFormAdapter = {
|
|
|
1543
1548
|
discount: ((item == null ? void 0 : item.listPrice) - (item == null ? void 0 : item.sellingPrice)) / 100,
|
|
1544
1549
|
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,
|
|
1545
1550
|
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,
|
|
1546
|
-
item_shipping_tier:
|
|
1551
|
+
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
1547
1552
|
item_ref: (item == null ? void 0 : item.productRefId) || (item == null ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
1548
1553
|
item_category: (_o = getItemCategory5(item)) != null ? _o : null,
|
|
1549
1554
|
item_category2: (_p = getItemCategory23(item)) != null ? _p : null,
|
|
@@ -1580,10 +1585,10 @@ var orderFormAdapter = {
|
|
|
1580
1585
|
payment_type: getPaymentType,
|
|
1581
1586
|
total_discount: (context) => {
|
|
1582
1587
|
var _a, _b;
|
|
1583
|
-
if (context == null ? void 0 : context.
|
|
1584
|
-
|
|
1585
|
-
const
|
|
1586
|
-
const totalDiscount =
|
|
1588
|
+
if (context == null ? void 0 : context.total_discount) return context.total_discount;
|
|
1589
|
+
if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
|
|
1590
|
+
const totalsList = ((_b = context.orderForm) == null ? void 0 : _b.totalizers) || [];
|
|
1591
|
+
const totalDiscount = getOrderFormItems(context.orderForm).reduce((acc, item) => {
|
|
1587
1592
|
const unitDiscount = Math.max(0, item.listPrice - item.sellingPrice);
|
|
1588
1593
|
return acc + unitDiscount * item.quantity;
|
|
1589
1594
|
}, 0);
|