@azzas/azzas-tracker-web 2.0.0-preview.4 → 2.0.0-preview.5
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 +53 -19
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.global.js +53 -19
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +53 -19
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +61 -19
- package/package.json +1 -1
package/dist/mod.cjs
CHANGED
|
@@ -1357,9 +1357,9 @@ var legacyGetters = {
|
|
|
1357
1357
|
// src/params/adapters/meta/index.ts
|
|
1358
1358
|
var metaAdapters = {
|
|
1359
1359
|
user_info: getUserInfo,
|
|
1360
|
-
brand: (context) => {
|
|
1361
|
-
|
|
1362
|
-
},
|
|
1360
|
+
// brand: (context: MetaBrandContext) => {
|
|
1361
|
+
// return context.meta.brand || null;
|
|
1362
|
+
// },
|
|
1363
1363
|
content_type: (context) => {
|
|
1364
1364
|
return context.meta.content_type || null;
|
|
1365
1365
|
},
|
|
@@ -1439,6 +1439,37 @@ var getItemCategory22 = (item) => {
|
|
|
1439
1439
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1440
1440
|
return capitalize(deepest);
|
|
1441
1441
|
};
|
|
1442
|
+
var BRAND_CODES2 = {
|
|
1443
|
+
farm: "farmrio",
|
|
1444
|
+
"farm etc": "farmetc",
|
|
1445
|
+
"farm rio": "farmrio"
|
|
1446
|
+
};
|
|
1447
|
+
function getBrandCode2(brand) {
|
|
1448
|
+
if (!brand) return null;
|
|
1449
|
+
const standardized = brand.toLowerCase().trim();
|
|
1450
|
+
return BRAND_CODES2[standardized] || null;
|
|
1451
|
+
}
|
|
1452
|
+
function normalizeBrand2(input) {
|
|
1453
|
+
var _a;
|
|
1454
|
+
let brandStrings = [];
|
|
1455
|
+
if (Array.isArray(input) && input.every((item) => typeof item === "string")) {
|
|
1456
|
+
brandStrings = input;
|
|
1457
|
+
} else if (Array.isArray(input)) {
|
|
1458
|
+
brandStrings = input.map((item) => {
|
|
1459
|
+
var _a2;
|
|
1460
|
+
return ((_a2 = item.additionalInfo) == null ? void 0 : _a2.brandName) || item.brand;
|
|
1461
|
+
});
|
|
1462
|
+
} else if (typeof input === "object" && input !== null && "brand" in input) {
|
|
1463
|
+
brandStrings = [((_a = input.additionalInfo) == null ? void 0 : _a.brandName) || input.brand];
|
|
1464
|
+
} else if (typeof input === "string") {
|
|
1465
|
+
return getBrandCode2(input);
|
|
1466
|
+
} else {
|
|
1467
|
+
return null;
|
|
1468
|
+
}
|
|
1469
|
+
const brandCodes = brandStrings.map(getBrandCode2).filter((code) => code !== null);
|
|
1470
|
+
const uniqueSortedCodes = [...new Set(brandCodes)].sort();
|
|
1471
|
+
return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join("_") : null;
|
|
1472
|
+
}
|
|
1442
1473
|
|
|
1443
1474
|
// src/params/adapters/deco/index.ts
|
|
1444
1475
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
@@ -1481,13 +1512,16 @@ var decoAdapter = {
|
|
|
1481
1512
|
}
|
|
1482
1513
|
return null;
|
|
1483
1514
|
},
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1515
|
+
brand: (context) => {
|
|
1516
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1517
|
+
if (context == null ? void 0 : context.products) {
|
|
1518
|
+
return normalizeBrand2(context.products.map((p) => {
|
|
1519
|
+
var _a;
|
|
1520
|
+
return (_a = p == null ? void 0 : p.brand) == null ? void 0 : _a.name;
|
|
1521
|
+
}));
|
|
1522
|
+
}
|
|
1523
|
+
return null;
|
|
1524
|
+
},
|
|
1491
1525
|
line_items: (context) => {
|
|
1492
1526
|
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
1493
1527
|
if (context == null ? void 0 : context.products) {
|
|
@@ -1591,13 +1625,13 @@ var orderFormAdapter = {
|
|
|
1591
1625
|
}
|
|
1592
1626
|
return null;
|
|
1593
1627
|
},
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1628
|
+
brand: (context) => {
|
|
1629
|
+
var _a;
|
|
1630
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1631
|
+
if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
|
|
1632
|
+
const brands = getOrderFormItems(context.orderForm).map((item) => item.additionalInfo.brandName);
|
|
1633
|
+
return normalizeBrand2(brands);
|
|
1634
|
+
},
|
|
1601
1635
|
line_items: (context) => {
|
|
1602
1636
|
var _a;
|
|
1603
1637
|
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
@@ -1953,10 +1987,10 @@ var pickupAdapter = {
|
|
|
1953
1987
|
shippings: (context) => {
|
|
1954
1988
|
if (context.shippings) {
|
|
1955
1989
|
return context.shippings.map((s) => {
|
|
1956
|
-
var _a
|
|
1990
|
+
var _a;
|
|
1957
1991
|
return {
|
|
1958
1992
|
line_items: (_a = s.line_items) != null ? _a : "",
|
|
1959
|
-
shipping:
|
|
1993
|
+
shipping: s.price / 100,
|
|
1960
1994
|
shipping_tier: getShippingTier(s),
|
|
1961
1995
|
delivery_time: getDeliveryTime(s)
|
|
1962
1996
|
};
|