pim-import 5.3.0 → 5.4.1
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/algolia/families.js
CHANGED
|
@@ -80,6 +80,7 @@ const getProductFields = async (topicFamily, destination = "PROFESSIONAL_GLOBAL"
|
|
|
80
80
|
let productFields = {};
|
|
81
81
|
productFields.availableTo = [];
|
|
82
82
|
productFields.totalProducts = topicProductEntries.length;
|
|
83
|
+
productFields.certificationFilters = [];
|
|
83
84
|
productFields.certifiedFilters = [];
|
|
84
85
|
for (const topicProduct of topicProductEntries) {
|
|
85
86
|
if (topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode]) {
|
|
@@ -125,7 +126,12 @@ const getProductFields = async (topicFamily, destination = "PROFESSIONAL_GLOBAL"
|
|
|
125
126
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "certifications");
|
|
126
127
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "locations");
|
|
127
128
|
(0, logs_1.log)(`Get certificationFilters details...`);
|
|
128
|
-
productFields.certificationFilters =
|
|
129
|
+
productFields.certificationFilters = [
|
|
130
|
+
...new Set([
|
|
131
|
+
...productFields.certificationFilters,
|
|
132
|
+
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
133
|
+
]),
|
|
134
|
+
];
|
|
129
135
|
(0, logs_1.log)(`Get certifiedFilters details...`);
|
|
130
136
|
productFields.certifiedFilters = [
|
|
131
137
|
...new Set([
|
package/dist/algolia/models.js
CHANGED
|
@@ -74,6 +74,7 @@ const getObject = async (topicModel) => {
|
|
|
74
74
|
productFields.availableTo = [];
|
|
75
75
|
if (catalogId) {
|
|
76
76
|
const topicProducts = await (0, contentful_cda_1.getAllEntries)("topicProduct", "sys,fields.productFields", `fields.models${(0, utils_1.capitalizeFirstLetter)(catalogId)}.sys.id[in]`, topicModelWithFields.sys.id);
|
|
77
|
+
productFields.certificationFilters = [];
|
|
77
78
|
productFields.certifiedFilters = [];
|
|
78
79
|
topicProducts.forEach((topicProduct) => {
|
|
79
80
|
const pimDetails = topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode];
|
|
@@ -105,7 +106,12 @@ const getObject = async (topicModel) => {
|
|
|
105
106
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "cri", "photometric");
|
|
106
107
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "powerSupplyType", "electrical");
|
|
107
108
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipRating", "marking");
|
|
108
|
-
productFields.certificationFilters =
|
|
109
|
+
productFields.certificationFilters = [
|
|
110
|
+
...new Set([
|
|
111
|
+
...productFields.certificationFilters,
|
|
112
|
+
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
113
|
+
]),
|
|
114
|
+
];
|
|
109
115
|
productFields.certifiedFilters = [
|
|
110
116
|
...new Set([
|
|
111
117
|
...productFields.certifiedFilters,
|
|
@@ -76,6 +76,7 @@ const getProductFields = async (topicSubFamily, destination = "PROFESSIONAL_GLOB
|
|
|
76
76
|
for (const destination of allDestinations) {
|
|
77
77
|
productFields.totalProducts[destination] = topicProductEntries.filter((topicProductEntry) => topicProductEntry?.fields?.productFields?.[defaultEnvironmentLocaleCode]?.destinations?.find((productDestination) => productDestination.code === destination)).length;
|
|
78
78
|
}
|
|
79
|
+
productFields.certificationFilters = [];
|
|
79
80
|
productFields.certifiedFilters = [];
|
|
80
81
|
for (const topicProduct of topicProductEntries) {
|
|
81
82
|
if (topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode]) {
|
|
@@ -123,7 +124,12 @@ const getProductFields = async (topicSubFamily, destination = "PROFESSIONAL_GLOB
|
|
|
123
124
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipCategory", "marking");
|
|
124
125
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipRating", "marking");
|
|
125
126
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "markings", "marking");
|
|
126
|
-
productFields.certificationFilters =
|
|
127
|
+
productFields.certificationFilters = [
|
|
128
|
+
...new Set([
|
|
129
|
+
...productFields.certificationFilters,
|
|
130
|
+
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
131
|
+
]),
|
|
132
|
+
];
|
|
127
133
|
productFields.certifiedFilters = [
|
|
128
134
|
...new Set([
|
|
129
135
|
...productFields.certifiedFilters,
|
|
@@ -227,6 +227,14 @@ const importDictionaryFields = async (offset = 0, limit = -1) => {
|
|
|
227
227
|
}
|
|
228
228
|
(0, logs_1.log)(`Add certifications to data`);
|
|
229
229
|
data.certifications = certifications;
|
|
230
|
+
(0, logs_1.log)("Create certifiedFilters");
|
|
231
|
+
let certifiedFilters = [];
|
|
232
|
+
const pimCertified = data.certified;
|
|
233
|
+
for (const [, values] of Object.entries(pimCertified)) {
|
|
234
|
+
certifiedFilters = certifiedFilters.concat(values);
|
|
235
|
+
}
|
|
236
|
+
(0, logs_1.log)(`Add certifiedFilters to data`);
|
|
237
|
+
data.certifiedFilters = certifiedFilters.filter((item, index, arr) => arr.findIndex((obj) => obj.code === item.code) === index);
|
|
230
238
|
(0, logs_1.log)("Create catalogs");
|
|
231
239
|
data.catalogs = pimDictionaryData.Catalog;
|
|
232
240
|
}
|