pim-import 5.8.0 → 5.8.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 +0 -18
- package/dist/algolia/models.js +0 -7
- package/dist/algolia/products.js +0 -7
- package/dist/algolia/subFamilies.js +0 -11
- package/dist/utils.d.ts +0 -1
- package/dist/utils.js +1 -35
- package/package.json +1 -1
package/dist/algolia/families.js
CHANGED
|
@@ -80,7 +80,6 @@ const getProductFields = async (topicFamily, destination = "PROFESSIONAL_GLOBAL"
|
|
|
80
80
|
let productFields = {};
|
|
81
81
|
productFields.availableTo = [];
|
|
82
82
|
productFields.totalProducts = topicProductEntries.length;
|
|
83
|
-
productFields.certificationFilters = [];
|
|
84
83
|
productFields.certifiedFilters = [];
|
|
85
84
|
for (const topicProduct of topicProductEntries) {
|
|
86
85
|
if (topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode]) {
|
|
@@ -125,13 +124,6 @@ const getProductFields = async (topicFamily, destination = "PROFESSIONAL_GLOBAL"
|
|
|
125
124
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "shapes", "physical");
|
|
126
125
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "certifications");
|
|
127
126
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "locations");
|
|
128
|
-
(0, logs_1.log)(`Get certificationFilters details...`);
|
|
129
|
-
productFields.certificationFilters = [
|
|
130
|
-
...new Set([
|
|
131
|
-
...productFields.certificationFilters,
|
|
132
|
-
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
133
|
-
]),
|
|
134
|
-
];
|
|
135
127
|
(0, logs_1.log)(`Get certifiedFilters details...`);
|
|
136
128
|
productFields.certifiedFilters = [
|
|
137
129
|
...new Set([
|
|
@@ -139,16 +131,6 @@ const getProductFields = async (topicFamily, destination = "PROFESSIONAL_GLOBAL"
|
|
|
139
131
|
...(0, utils_1.getCertifiedFilters)(pimDetails),
|
|
140
132
|
]),
|
|
141
133
|
];
|
|
142
|
-
(0, logs_1.log)(`Get filterableCertifications details...`);
|
|
143
|
-
const filterableCertificationsFields = ["enec", "ul", "certificates"];
|
|
144
|
-
for (const filterableCertificationsField of filterableCertificationsFields) {
|
|
145
|
-
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, filterableCertificationsField, "certification", "filterableCertifications", false);
|
|
146
|
-
}
|
|
147
|
-
if (!productFields?.filterableCertifications) {
|
|
148
|
-
productFields.filterableCertifications = {};
|
|
149
|
-
}
|
|
150
|
-
productFields.filterableCertifications.enecCertified =
|
|
151
|
-
!!pimDetails.certification?.enecCertified;
|
|
152
134
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "destinations");
|
|
153
135
|
}
|
|
154
136
|
}
|
package/dist/algolia/models.js
CHANGED
|
@@ -74,7 +74,6 @@ 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 = [];
|
|
78
77
|
productFields.certifiedFilters = [];
|
|
79
78
|
topicProducts.forEach((topicProduct) => {
|
|
80
79
|
const pimDetails = topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode];
|
|
@@ -106,12 +105,6 @@ const getObject = async (topicModel) => {
|
|
|
106
105
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "cri", "photometric");
|
|
107
106
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "powerSupplyType", "electrical");
|
|
108
107
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipRating", "marking");
|
|
109
|
-
productFields.certificationFilters = [
|
|
110
|
-
...new Set([
|
|
111
|
-
...productFields.certificationFilters,
|
|
112
|
-
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
113
|
-
]),
|
|
114
|
-
];
|
|
115
108
|
productFields.certifiedFilters = [
|
|
116
109
|
...new Set([
|
|
117
110
|
...productFields.certifiedFilters,
|
package/dist/algolia/products.js
CHANGED
|
@@ -171,15 +171,8 @@ const getObject = async (topicProduct) => {
|
|
|
171
171
|
if (productFields.marking?.markings?.length) {
|
|
172
172
|
productFields.certificationIcons = productFields.certificationIcons.concat(productFields.marking.markings);
|
|
173
173
|
}
|
|
174
|
-
(0, logs_1.log)(`Get certificationFilters details...`);
|
|
175
|
-
productFields.certificationFilters = (0, utils_1.getCertificationFilters)(topicProductWithFields?.fields?.productFields?.[defaultEnvironmentLocaleCode]);
|
|
176
174
|
(0, logs_1.log)(`Get certifiedFilters details...`);
|
|
177
175
|
productFields.certifiedFilters = (0, utils_1.getCertifiedFilters)(topicProductWithFields?.fields?.productFields?.[defaultEnvironmentLocaleCode]);
|
|
178
|
-
(0, logs_1.log)(`Get filterableCertifications details...`);
|
|
179
|
-
const filterableCertificationsFields = ["enec", "ul", "certificates"];
|
|
180
|
-
for (const filterableCertificationsField of filterableCertificationsFields) {
|
|
181
|
-
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(topicProductWithFields.fields.productFields?.[defaultEnvironmentLocaleCode], productFields, filterableCertificationsField, "certification", "filterableCertifications", false, true);
|
|
182
|
-
}
|
|
183
176
|
if (!productFields?.certification) {
|
|
184
177
|
productFields.certification = {};
|
|
185
178
|
}
|
|
@@ -76,7 +76,6 @@ 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 = [];
|
|
80
79
|
productFields.certifiedFilters = [];
|
|
81
80
|
for (const topicProduct of topicProductEntries) {
|
|
82
81
|
if (topicProduct?.fields?.productFields?.[defaultEnvironmentLocaleCode]) {
|
|
@@ -124,22 +123,12 @@ const getProductFields = async (topicSubFamily, destination = "PROFESSIONAL_GLOB
|
|
|
124
123
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipCategory", "marking");
|
|
125
124
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "ipRating", "marking");
|
|
126
125
|
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, "markings", "marking");
|
|
127
|
-
productFields.certificationFilters = [
|
|
128
|
-
...new Set([
|
|
129
|
-
...productFields.certificationFilters,
|
|
130
|
-
...(0, utils_1.getCertificationFilters)(pimDetails),
|
|
131
|
-
]),
|
|
132
|
-
];
|
|
133
126
|
productFields.certifiedFilters = [
|
|
134
127
|
...new Set([
|
|
135
128
|
...productFields.certifiedFilters,
|
|
136
129
|
...(0, utils_1.getCertifiedFilters)(pimDetails),
|
|
137
130
|
]),
|
|
138
131
|
];
|
|
139
|
-
const filterableCertificationsFields = ["enec", "ul", "certificates"];
|
|
140
|
-
for (const filterableCertificationsField of filterableCertificationsFields) {
|
|
141
|
-
productFields = (0, utils_1.addProductFieldValueCodesByPimDetails)(pimDetails, productFields, filterableCertificationsField, "certification", "filterableCertifications", false, true);
|
|
142
|
-
}
|
|
143
132
|
if (!productFields?.certification) {
|
|
144
133
|
productFields.certification = {};
|
|
145
134
|
}
|
package/dist/utils.d.ts
CHANGED
|
@@ -19,5 +19,4 @@ export declare const addProductFieldValueCodesByPimDetails: (pimDetails: any, pr
|
|
|
19
19
|
export declare const replaceAll: (original: string, from: string, to: string) => string;
|
|
20
20
|
export declare const getAllTranslations: (values: any) => Promise<any>;
|
|
21
21
|
export declare const truncateString: (string: string, limit: number) => string;
|
|
22
|
-
export declare const getCertificationFilters: (productFields: any) => any;
|
|
23
22
|
export declare const getCertifiedFilters: (productFields: any) => any[];
|
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getCertifiedFilters = exports.
|
|
3
|
+
exports.getCertifiedFilters = exports.truncateString = exports.getAllTranslations = exports.replaceAll = exports.addProductFieldValueCodesByPimDetails = exports.keysToLowerCase = exports.capitalizeFirstLetter = exports.getLocalISOTime = exports.doChunk = exports.sanitizeValue = exports.getUnwantedValues = exports.getPimTranslations = exports.getLocale = exports.pimLocaleMap = exports.stringToSlug = exports.secondBetweenTwoDate = exports.basename = exports.getBaseURL = exports.sleep = exports.mergeObjects = void 0;
|
|
4
4
|
const logs_1 = require("./libs/logs");
|
|
5
5
|
const contentful_1 = require("./libs/contentful");
|
|
6
6
|
const mergeObjects = (objA, objB) => {
|
|
@@ -291,40 +291,6 @@ const truncateString = (string, limit) => {
|
|
|
291
291
|
: string.slice(0, limit - separator.length) + "...";
|
|
292
292
|
};
|
|
293
293
|
exports.truncateString = truncateString;
|
|
294
|
-
const getCertificationFilters = (productFields) => {
|
|
295
|
-
let certificationFilters = [];
|
|
296
|
-
certificationFilters =
|
|
297
|
-
productFields?.certification?.certificates?.map((c) => c.code) || [];
|
|
298
|
-
const availableCertificationCodes = [
|
|
299
|
-
"CM1",
|
|
300
|
-
"CM2",
|
|
301
|
-
"CM3",
|
|
302
|
-
"CM4",
|
|
303
|
-
"CM5",
|
|
304
|
-
"CM6",
|
|
305
|
-
"CM7",
|
|
306
|
-
"CM8",
|
|
307
|
-
"CM9",
|
|
308
|
-
"CM10",
|
|
309
|
-
"CM11",
|
|
310
|
-
"CM12",
|
|
311
|
-
"CM13",
|
|
312
|
-
"CM14",
|
|
313
|
-
"CM15",
|
|
314
|
-
"CM16",
|
|
315
|
-
"CM17",
|
|
316
|
-
"CM18",
|
|
317
|
-
];
|
|
318
|
-
certificationFilters = certificationFilters?.filter((code) => availableCertificationCodes.includes(code));
|
|
319
|
-
if (productFields?.certification?.enecCertified?.state === true)
|
|
320
|
-
certificationFilters.push(productFields.certification.enecCertified.label?.value_en ||
|
|
321
|
-
productFields.certification.enecCertified.label);
|
|
322
|
-
if (productFields?.certification?.ulCertified?.state === true)
|
|
323
|
-
certificationFilters.push(productFields.certification.ulCertified.label?.value_en ||
|
|
324
|
-
productFields.certification.ulCertified.label);
|
|
325
|
-
return certificationFilters;
|
|
326
|
-
};
|
|
327
|
-
exports.getCertificationFilters = getCertificationFilters;
|
|
328
294
|
const getCertifiedFilters = (productFields) => {
|
|
329
295
|
return productFields?.certified
|
|
330
296
|
? Object.values(productFields?.certified)
|