@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.js
CHANGED
|
@@ -1329,9 +1329,9 @@ var legacyGetters = {
|
|
|
1329
1329
|
// src/params/adapters/meta/index.ts
|
|
1330
1330
|
var metaAdapters = {
|
|
1331
1331
|
user_info: getUserInfo,
|
|
1332
|
-
brand: (context) => {
|
|
1333
|
-
|
|
1334
|
-
},
|
|
1332
|
+
// brand: (context: MetaBrandContext) => {
|
|
1333
|
+
// return context.meta.brand || null;
|
|
1334
|
+
// },
|
|
1335
1335
|
content_type: (context) => {
|
|
1336
1336
|
return context.meta.content_type || null;
|
|
1337
1337
|
},
|
|
@@ -1411,6 +1411,37 @@ var getItemCategory22 = (item) => {
|
|
|
1411
1411
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1412
1412
|
return capitalize(deepest);
|
|
1413
1413
|
};
|
|
1414
|
+
var BRAND_CODES2 = {
|
|
1415
|
+
farm: "farmrio",
|
|
1416
|
+
"farm etc": "farmetc",
|
|
1417
|
+
"farm rio": "farmrio"
|
|
1418
|
+
};
|
|
1419
|
+
function getBrandCode2(brand) {
|
|
1420
|
+
if (!brand) return null;
|
|
1421
|
+
const standardized = brand.toLowerCase().trim();
|
|
1422
|
+
return BRAND_CODES2[standardized] || null;
|
|
1423
|
+
}
|
|
1424
|
+
function normalizeBrand2(input) {
|
|
1425
|
+
var _a;
|
|
1426
|
+
let brandStrings = [];
|
|
1427
|
+
if (Array.isArray(input) && input.every((item) => typeof item === "string")) {
|
|
1428
|
+
brandStrings = input;
|
|
1429
|
+
} else if (Array.isArray(input)) {
|
|
1430
|
+
brandStrings = input.map((item) => {
|
|
1431
|
+
var _a2;
|
|
1432
|
+
return ((_a2 = item.additionalInfo) == null ? void 0 : _a2.brandName) || item.brand;
|
|
1433
|
+
});
|
|
1434
|
+
} else if (typeof input === "object" && input !== null && "brand" in input) {
|
|
1435
|
+
brandStrings = [((_a = input.additionalInfo) == null ? void 0 : _a.brandName) || input.brand];
|
|
1436
|
+
} else if (typeof input === "string") {
|
|
1437
|
+
return getBrandCode2(input);
|
|
1438
|
+
} else {
|
|
1439
|
+
return null;
|
|
1440
|
+
}
|
|
1441
|
+
const brandCodes = brandStrings.map(getBrandCode2).filter((code) => code !== null);
|
|
1442
|
+
const uniqueSortedCodes = [...new Set(brandCodes)].sort();
|
|
1443
|
+
return uniqueSortedCodes.length > 0 ? uniqueSortedCodes.join("_") : null;
|
|
1444
|
+
}
|
|
1414
1445
|
|
|
1415
1446
|
// src/params/adapters/deco/index.ts
|
|
1416
1447
|
var IN_STOCK_SCHEMA = "https://schema.org/InStock";
|
|
@@ -1453,13 +1484,16 @@ var decoAdapter = {
|
|
|
1453
1484
|
}
|
|
1454
1485
|
return null;
|
|
1455
1486
|
},
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1487
|
+
brand: (context) => {
|
|
1488
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1489
|
+
if (context == null ? void 0 : context.products) {
|
|
1490
|
+
return normalizeBrand2(context.products.map((p) => {
|
|
1491
|
+
var _a;
|
|
1492
|
+
return (_a = p == null ? void 0 : p.brand) == null ? void 0 : _a.name;
|
|
1493
|
+
}));
|
|
1494
|
+
}
|
|
1495
|
+
return null;
|
|
1496
|
+
},
|
|
1463
1497
|
line_items: (context) => {
|
|
1464
1498
|
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
1465
1499
|
if (context == null ? void 0 : context.products) {
|
|
@@ -1563,13 +1597,13 @@ var orderFormAdapter = {
|
|
|
1563
1597
|
}
|
|
1564
1598
|
return null;
|
|
1565
1599
|
},
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1600
|
+
brand: (context) => {
|
|
1601
|
+
var _a;
|
|
1602
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1603
|
+
if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
|
|
1604
|
+
const brands = getOrderFormItems(context.orderForm).map((item) => item.additionalInfo.brandName);
|
|
1605
|
+
return normalizeBrand2(brands);
|
|
1606
|
+
},
|
|
1573
1607
|
line_items: (context) => {
|
|
1574
1608
|
var _a;
|
|
1575
1609
|
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
@@ -1925,10 +1959,10 @@ var pickupAdapter = {
|
|
|
1925
1959
|
shippings: (context) => {
|
|
1926
1960
|
if (context.shippings) {
|
|
1927
1961
|
return context.shippings.map((s) => {
|
|
1928
|
-
var _a
|
|
1962
|
+
var _a;
|
|
1929
1963
|
return {
|
|
1930
1964
|
line_items: (_a = s.line_items) != null ? _a : "",
|
|
1931
|
-
shipping:
|
|
1965
|
+
shipping: s.price / 100,
|
|
1932
1966
|
shipping_tier: getShippingTier(s),
|
|
1933
1967
|
delivery_time: getDeliveryTime(s)
|
|
1934
1968
|
};
|