@softwear/latestcollectioncore 1.0.16 → 1.0.18

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.
@@ -27,7 +27,7 @@ function default_1(brands) {
27
27
  const indexedPropertyMapping = brands.reduce((acc, item) => {
28
28
  if (!acc[item.id])
29
29
  acc[item.id] = {};
30
- acc[item.id] = { ...acc[item.id], ...indexFn(item.propertyMapping) };
30
+ acc[item.id] = Object.assign(Object.assign({}, acc[item.id]), indexFn(item.propertyMapping));
31
31
  return acc;
32
32
  }, {});
33
33
  return function (sku) {
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  function default_1(activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting) {
4
+ var _a, _b, _c, _d, _e, _f;
4
5
  let allMappings = [];
5
- if (activeConfig?.products?.applyLatestCollectionMapping?.value)
6
+ if ((_b = (_a = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _a === void 0 ? void 0 : _a.applyLatestCollectionMapping) === null || _b === void 0 ? void 0 : _b.value)
6
7
  allMappings = metaBrandSetting;
7
- if (activeConfig?.products?.applyDataProviderMapping?.value)
8
+ if ((_d = (_c = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _c === void 0 ? void 0 : _c.applyDataProviderMapping) === null || _d === void 0 ? void 0 : _d.value)
8
9
  activeConfig.products.applyDataProviderMapping.value.forEach((provider) => {
9
- allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => ({ ...s, id: s.id.split(":")[0] })));
10
+ allMappings = allMappings.concat(dataProviderBrandSetting.filter((s) => s.dataProvider == provider).map((s) => (Object.assign(Object.assign({}, s), { id: s.id.split(":")[0] }))));
10
11
  });
11
- if (activeConfig?.products?.applyTenantMapping?.value)
12
+ if ((_f = (_e = activeConfig === null || activeConfig === void 0 ? void 0 : activeConfig.products) === null || _e === void 0 ? void 0 : _e.applyTenantMapping) === null || _f === void 0 ? void 0 : _f.value)
12
13
  allMappings = allMappings.concat(tenantBrandSetting);
13
14
  return allMappings;
14
15
  }
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { default as applyPropertyMapping } from "./applyPropertyMapping";
2
- export { default as applyPreferedPropertyMappings } from "./applyPreferedPropertyMappings";
3
1
  export { default as buildPropertyMappingFn } from "./buildPropertyMappingFn";
4
2
  export { default as ean13 } from "./ean13";
5
3
  export { default as deepCopy } from "./deepCopy";
package/dist/index.js CHANGED
@@ -17,11 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.hashBrand = exports.getPreferedPropertyMappings = exports.deepCopy = exports.ean13 = exports.buildPropertyMappingFn = exports.applyPreferedPropertyMappings = exports.applyPropertyMapping = void 0;
21
- var applyPropertyMapping_1 = require("./applyPropertyMapping");
22
- Object.defineProperty(exports, "applyPropertyMapping", { enumerable: true, get: function () { return __importDefault(applyPropertyMapping_1).default; } });
23
- var applyPreferedPropertyMappings_1 = require("./applyPreferedPropertyMappings");
24
- Object.defineProperty(exports, "applyPreferedPropertyMappings", { enumerable: true, get: function () { return __importDefault(applyPreferedPropertyMappings_1).default; } });
20
+ exports.hashBrand = exports.getPreferedPropertyMappings = exports.deepCopy = exports.ean13 = exports.buildPropertyMappingFn = void 0;
25
21
  var buildPropertyMappingFn_1 = require("./buildPropertyMappingFn");
26
22
  Object.defineProperty(exports, "buildPropertyMappingFn", { enumerable: true, get: function () { return __importDefault(buildPropertyMappingFn_1).default; } });
27
23
  var ean13_1 = require("./ean13");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softwear/latestcollectioncore",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "Core functions for LatestCollections applications",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,5 +1,3 @@
1
- export { default as applyPropertyMapping } from "./applyPropertyMapping"
2
- export { default as applyPreferedPropertyMappings } from "./applyPreferedPropertyMappings"
3
1
  export { default as buildPropertyMappingFn } from "./buildPropertyMappingFn"
4
2
  export { default as ean13 } from "./ean13"
5
3
  export { default as deepCopy } from "./deepCopy"
@@ -1,6 +1,12 @@
1
- const { deepCopy, applyPreferedPropertyMappings } = require("../dist/index")
1
+ const { deepCopy, buildPropertyMappingFn, getPreferedPropertyMappings } = require("../dist/index")
2
2
  const { expect } = require("chai")
3
3
 
4
+ const applyPreferedPropertyMappings = function (skus, activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting) {
5
+ const allMappings = getPreferedPropertyMappings(activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting)
6
+ const mapper = buildPropertyMappingFn(allMappings)
7
+ return skus.map(mapper)
8
+ }
9
+
4
10
  const skus = [
5
11
  {
6
12
  id: "1234567890128",
@@ -1,6 +1,11 @@
1
- const { deepCopy, applyPropertyMapping } = require("../dist/index")
1
+ const { deepCopy, buildPropertyMappingFn } = require("../dist/index")
2
2
  const { expect } = require("chai")
3
3
 
4
+ const applyPropertyMapping = function (skus, brands) {
5
+ const mapper = buildPropertyMappingFn(brands)
6
+ return skus.map(mapper)
7
+ }
8
+
4
9
  const skus = [
5
10
  {
6
11
  id: "1234567890128",
package/tsconfig.json CHANGED
@@ -3,7 +3,7 @@
3
3
  /* Visit https://aka.ms/tsconfig.json to read more about this file */
4
4
  /* Basic Options */
5
5
  // "incremental": true, /* Enable incremental compilation */
6
- "target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
6
+ "target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
7
7
  "module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
8
8
  // "lib": [], /* Specify library files to be included in the compilation. */
9
9
  // "allowJs": true, /* Allow javascript files to be compiled. */
@@ -1,7 +0,0 @@
1
- import { buildPropertyMappingFn, getPreferedPropertyMappings } from "./index"
2
-
3
- export default function (skus, activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting) {
4
- const allMappings = getPreferedPropertyMappings(activeConfig, metaBrandSetting, dataProviderBrandSetting, tenantBrandSetting)
5
- const mapper = buildPropertyMappingFn(allMappings)
6
- return skus.map(mapper)
7
- }
@@ -1,6 +0,0 @@
1
- import { hashBrand, SkuI, MAPPING_CATEGORIES, buildPropertyMappingFn } from "./index"
2
-
3
- export default function (skus: Array<SkuI>, brands: Array<any>): Array<SkuI> {
4
- const mapper = buildPropertyMappingFn(brands)
5
- return skus.map(mapper)
6
- }