@softwear/latestcollectioncore 1.0.37 → 1.0.39
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.
|
@@ -42,7 +42,7 @@ function default_1(brands, strategy) {
|
|
|
42
42
|
});
|
|
43
43
|
return maps;
|
|
44
44
|
};
|
|
45
|
-
const
|
|
45
|
+
const indexedByBrandPropertyMapping = brands.reduce((acc, item) => {
|
|
46
46
|
if (!acc[item.id])
|
|
47
47
|
acc[item.id] = {};
|
|
48
48
|
Object.assign(acc[item.id], indexFn(item.propertyMapping));
|
|
@@ -50,8 +50,8 @@ function default_1(brands, strategy) {
|
|
|
50
50
|
}, {});
|
|
51
51
|
if (strategy == "clean")
|
|
52
52
|
return function (sku) {
|
|
53
|
-
const brand = (0, index_1.hashBrand)(sku.brand);
|
|
54
|
-
const mapping =
|
|
53
|
+
const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
|
|
54
|
+
const mapping = indexedByBrandPropertyMapping[brand];
|
|
55
55
|
mappingPairs.forEach((pair) => {
|
|
56
56
|
var _a;
|
|
57
57
|
const from = sku[pair.from] || "";
|
|
@@ -62,8 +62,8 @@ function default_1(brands, strategy) {
|
|
|
62
62
|
return sku;
|
|
63
63
|
};
|
|
64
64
|
return function (sku) {
|
|
65
|
-
const brand = (0, index_1.hashBrand)(sku.brand);
|
|
66
|
-
const mapping =
|
|
65
|
+
const brand = sku.BRANDHASH || (0, index_1.hashBrand)(sku.brand);
|
|
66
|
+
const mapping = indexedByBrandPropertyMapping[brand];
|
|
67
67
|
mappingPairs.forEach((pair) => {
|
|
68
68
|
var _a;
|
|
69
69
|
if (sku[pair.to])
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -50,7 +50,7 @@ export default function (
|
|
|
50
50
|
});
|
|
51
51
|
return maps;
|
|
52
52
|
};
|
|
53
|
-
const
|
|
53
|
+
const indexedByBrandPropertyMapping = brands.reduce((acc, item) => {
|
|
54
54
|
if (!acc[item.id]) acc[item.id] = {};
|
|
55
55
|
Object.assign(acc[item.id], indexFn(item.propertyMapping));
|
|
56
56
|
return acc;
|
|
@@ -58,8 +58,8 @@ export default function (
|
|
|
58
58
|
|
|
59
59
|
if (strategy == "clean")
|
|
60
60
|
return function (sku: SkuI): SkuI {
|
|
61
|
-
const brand = hashBrand(sku.brand);
|
|
62
|
-
const mapping =
|
|
61
|
+
const brand = sku.BRANDHASH || hashBrand(sku.brand);
|
|
62
|
+
const mapping = indexedByBrandPropertyMapping[brand];
|
|
63
63
|
mappingPairs.forEach((pair) => {
|
|
64
64
|
const from = sku[pair.from] || "";
|
|
65
65
|
const to = mapping?.[pair.category]?.[from];
|
|
@@ -68,8 +68,8 @@ export default function (
|
|
|
68
68
|
return sku;
|
|
69
69
|
};
|
|
70
70
|
return function (sku: SkuI): SkuI {
|
|
71
|
-
const brand = hashBrand(sku.brand);
|
|
72
|
-
const mapping =
|
|
71
|
+
const brand = sku.BRANDHASH || hashBrand(sku.brand);
|
|
72
|
+
const mapping = indexedByBrandPropertyMapping[brand];
|
|
73
73
|
mappingPairs.forEach((pair) => {
|
|
74
74
|
if (sku[pair.to]) return; // Do not replace sku-level-user-supplied values
|
|
75
75
|
const from = sku[pair.from] || ""; // || "" allows mapping 'from nothing'. Useful to assign constants like Gender for single-gender-brands
|