@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 indexedPropertyMapping = brands.reduce((acc, item) => {
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 = indexedPropertyMapping[brand];
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 = indexedPropertyMapping[brand];
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
@@ -128,6 +128,7 @@ interface SkuI {
128
128
  quickPick?: number;
129
129
  gln?: string;
130
130
  set?: string;
131
+ erpSource?: string;
131
132
  }
132
133
  interface MarkedSkuI extends SkuI {
133
134
  source?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@ export default function (
50
50
  });
51
51
  return maps;
52
52
  };
53
- const indexedPropertyMapping = brands.reduce((acc, item) => {
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 = indexedPropertyMapping[brand];
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 = indexedPropertyMapping[brand];
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
package/src/types.ts CHANGED
@@ -136,6 +136,7 @@ interface SkuI {
136
136
  quickPick?: number;
137
137
  gln?: string;
138
138
  set?: string;
139
+ erpSource?: string;
139
140
  }
140
141
 
141
142
  interface MarkedSkuI extends SkuI {