pim-import 5.8.1 → 5.10.0
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.d.ts +2 -0
- package/dist/algolia/families.js +3 -0
- package/dist/algolia/products.js +10 -1
- package/dist/algolia/subFamilies.d.ts +1 -0
- package/dist/algolia/subFamilies.js +4 -0
- package/dist/pim/methods/bulkPublish.d.ts +1 -1
- package/dist/pim/methods/bulkPublish.js +6 -3
- package/dist/pim/methods/products.js +12 -6
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@ export type AlgoliaFamilyRecord = {
|
|
|
20
20
|
categories: TopicDetailsResponse[];
|
|
21
21
|
productFields: TopicProductFieldsResponse[];
|
|
22
22
|
productFieldsUs: TopicProductFieldsResponse[];
|
|
23
|
+
productFieldsCn: TopicProductFieldsResponse[];
|
|
23
24
|
isNew: boolean;
|
|
24
25
|
priority: number;
|
|
25
26
|
destinations?: string[];
|
|
@@ -53,6 +54,7 @@ export declare const reindexFamily: (topicFamilyEntryId: string) => Promise<{
|
|
|
53
54
|
categories: TopicDetailsResponse[];
|
|
54
55
|
productFields: TopicProductFieldsResponse[];
|
|
55
56
|
productFieldsUs: TopicProductFieldsResponse[];
|
|
57
|
+
productFieldsCn: TopicProductFieldsResponse[];
|
|
56
58
|
isNew: boolean;
|
|
57
59
|
priority: number;
|
|
58
60
|
destinations?: string[] | undefined;
|
package/dist/algolia/families.js
CHANGED
|
@@ -156,6 +156,8 @@ const getObject = async (topicFamily) => {
|
|
|
156
156
|
const productFields = await getProductFields(topicFamily);
|
|
157
157
|
(0, logs_1.log)(`Get productFieldsUs details...`);
|
|
158
158
|
const productFieldsUs = await getProductFields(topicFamily, "PROFESSIONAL_US");
|
|
159
|
+
(0, logs_1.log)(`Get productFieldsCn details...`);
|
|
160
|
+
const productFieldsCn = await getProductFields(topicFamily, "PROFESSIONAL_CHINA");
|
|
159
161
|
const isNew = topicFamilyWithFields?.fields?.isNew?.[defaultEnvironmentLocaleCode] ||
|
|
160
162
|
false;
|
|
161
163
|
(0, logs_1.log)(`Get thumbnail imgix details...`);
|
|
@@ -191,6 +193,7 @@ const getObject = async (topicFamily) => {
|
|
|
191
193
|
categories,
|
|
192
194
|
productFields,
|
|
193
195
|
productFieldsUs,
|
|
196
|
+
productFieldsCn,
|
|
194
197
|
priority,
|
|
195
198
|
isNew,
|
|
196
199
|
destinations: topicFamilyWithFields?.fields?.destinations?.[defaultEnvironmentLocaleCode] || [],
|
package/dist/algolia/products.js
CHANGED
|
@@ -24,7 +24,11 @@ const triggerPDFGenerator = async (topicProductId, multipleDestinations = false)
|
|
|
24
24
|
let destinationsData = [];
|
|
25
25
|
if (multipleDestinations) {
|
|
26
26
|
destinationsData = topicProduct.fields.destinations[defaultEnvironmentLocaleCode]
|
|
27
|
-
.filter((destination) => [
|
|
27
|
+
.filter((destination) => [
|
|
28
|
+
"PROFESSIONAL_GLOBAL",
|
|
29
|
+
"PROFESSIONAL_US",
|
|
30
|
+
"PROFESSIONAL_CHINA",
|
|
31
|
+
].includes(destination))
|
|
28
32
|
.map((destination) => {
|
|
29
33
|
switch (destination) {
|
|
30
34
|
case "PROFESSIONAL_US":
|
|
@@ -32,6 +36,11 @@ const triggerPDFGenerator = async (topicProductId, multipleDestinations = false)
|
|
|
32
36
|
locale: "en-US",
|
|
33
37
|
country: "us",
|
|
34
38
|
};
|
|
39
|
+
case "PROFESSIONAL_CHINA":
|
|
40
|
+
return {
|
|
41
|
+
locale: "zh",
|
|
42
|
+
country: "cn",
|
|
43
|
+
};
|
|
35
44
|
default:
|
|
36
45
|
return defaultData;
|
|
37
46
|
}
|
|
@@ -27,6 +27,7 @@ export declare const reindexSubFamily: (topicSubFamilyEntryId: string) => Promis
|
|
|
27
27
|
categories: import("../types").TopicDetailsResponse[];
|
|
28
28
|
productFields: import("../types").TopicProductFieldsResponse[];
|
|
29
29
|
productFieldsUs: import("../types").TopicProductFieldsResponse[];
|
|
30
|
+
productFieldsCn: import("../types").TopicProductFieldsResponse[];
|
|
30
31
|
isNew: boolean;
|
|
31
32
|
priority: number;
|
|
32
33
|
destinations?: string[] | undefined;
|
|
@@ -75,6 +75,7 @@ const getProductFields = async (topicSubFamily, destination = "PROFESSIONAL_GLOB
|
|
|
75
75
|
productFields.totalProducts = {};
|
|
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
|
+
(0, logs_1.log)(`Total products for destination ${destination}: ${productFields.totalProducts[destination]}`);
|
|
78
79
|
}
|
|
79
80
|
productFields.certifiedFilters = [];
|
|
80
81
|
for (const topicProduct of topicProductEntries) {
|
|
@@ -163,6 +164,8 @@ const getObject = async (topicSubFamily) => {
|
|
|
163
164
|
const productFields = await getProductFields(topicSubFamilyWithFields);
|
|
164
165
|
(0, logs_1.log)(`Get productFieldsUs details...`);
|
|
165
166
|
const productFieldsUs = await getProductFields(topicSubFamilyWithFields, "PROFESSIONAL_US");
|
|
167
|
+
(0, logs_1.log)(`Get productFieldsCn details...`);
|
|
168
|
+
const productFieldsCn = await getProductFields(topicSubFamilyWithFields, "PROFESSIONAL_CHINA");
|
|
166
169
|
const isNew = topicSubFamilyWithFields?.fields?.isNew?.[defaultEnvironmentLocaleCode] ||
|
|
167
170
|
false;
|
|
168
171
|
(0, logs_1.log)(`Get thumbnail imgix details...`);
|
|
@@ -229,6 +232,7 @@ const getObject = async (topicSubFamily) => {
|
|
|
229
232
|
parentFamily,
|
|
230
233
|
productFields,
|
|
231
234
|
productFieldsUs,
|
|
235
|
+
productFieldsCn,
|
|
232
236
|
priority,
|
|
233
237
|
isNew,
|
|
234
238
|
destinations: topicSubFamilyWithFields?.fields?.destinations?.[defaultEnvironmentLocaleCode] || [],
|
|
@@ -3,7 +3,7 @@ import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
|
3
3
|
export declare const publishTopicProduct: (productEntry: Entry) => Promise<void>;
|
|
4
4
|
export declare const publishAllProductDrafts: (filters: {
|
|
5
5
|
catalog?: AvailableCatalogs;
|
|
6
|
-
|
|
6
|
+
destination?: string;
|
|
7
7
|
}, limit?: number) => Promise<{
|
|
8
8
|
completed: boolean;
|
|
9
9
|
total: number;
|
|
@@ -22,7 +22,7 @@ const publishTopicProduct = async (productEntry) => {
|
|
|
22
22
|
};
|
|
23
23
|
exports.publishTopicProduct = publishTopicProduct;
|
|
24
24
|
const publishAllProductDrafts = async (filters, limit = 100) => {
|
|
25
|
-
let logMsg = `publishAllProductDrafts
|
|
25
|
+
let logMsg = `publishAllProductDrafts limit: ${limit} filters: ${JSON.stringify(filters)}`;
|
|
26
26
|
(0, logs_1.log)(logMsg);
|
|
27
27
|
if (logs_1.serverUtils) {
|
|
28
28
|
logs_1.serverUtils.log(logMsg);
|
|
@@ -41,8 +41,8 @@ const publishAllProductDrafts = async (filters, limit = 100) => {
|
|
|
41
41
|
if (filters?.catalog) {
|
|
42
42
|
opts["fields.catalogs.sys.id"] = filters.catalog;
|
|
43
43
|
}
|
|
44
|
-
if (filters?.
|
|
45
|
-
opts["fields.
|
|
44
|
+
if (filters?.destination) {
|
|
45
|
+
opts["fields.destinations[in]"] = filters.destination;
|
|
46
46
|
}
|
|
47
47
|
const { items, total } = await env.getEntries(opts);
|
|
48
48
|
let count = 0;
|
|
@@ -52,6 +52,9 @@ const publishAllProductDrafts = async (filters, limit = 100) => {
|
|
|
52
52
|
if (logs_1.serverUtils) {
|
|
53
53
|
logs_1.serverUtils.log(logMsg);
|
|
54
54
|
}
|
|
55
|
+
if (item.fields.destinations[defEnvLocaleCode]?.length > 1) {
|
|
56
|
+
console.log(item.sys.id, item.fields.destinations[defEnvLocaleCode]);
|
|
57
|
+
}
|
|
55
58
|
if (["0000000-TEST"].includes(item.sys.id)) {
|
|
56
59
|
logMsg = `Skip product test ${item.sys.id}`;
|
|
57
60
|
}
|
|
@@ -1509,16 +1509,22 @@ const generateTechSpecPdf = async (topicProductId, country = "global", locale =
|
|
|
1509
1509
|
const fileName = (pageSlug.length >= 170
|
|
1510
1510
|
? `tech-spec-${topicProductId}`
|
|
1511
1511
|
: `tech-spec-${pageSlug}`) + `_${country}-${locale}`;
|
|
1512
|
-
let baseUrl =
|
|
1512
|
+
let baseUrl = country === "cn"
|
|
1513
|
+
? process.env.FPI_TECH_SPEC_BASE_URL_CN ?? ""
|
|
1514
|
+
: process.env.FPI_TECH_SPEC_BASE_URL ?? "";
|
|
1513
1515
|
if (!baseUrl) {
|
|
1514
|
-
(0, logs_1.log)(`FPI_TECH_SPEC_BASE_URL process env not found`, "ERROR");
|
|
1516
|
+
(0, logs_1.log)(`FPI_TECH_SPEC_BASE_URL process env not found for country ${country}`, "ERROR");
|
|
1515
1517
|
}
|
|
1516
1518
|
baseUrl = baseUrl.replace(/\/?(\?|#|$)/, "/$1");
|
|
1517
|
-
let footerBaseUrl =
|
|
1518
|
-
process.env.
|
|
1519
|
-
|
|
1519
|
+
let footerBaseUrl = country === "cn"
|
|
1520
|
+
? process.env.FPI_TECH_SPEC_FOOTER_BASE_URL_CN ??
|
|
1521
|
+
process.env.FPI_TECH_SPEC_BASE_URL_CN ??
|
|
1522
|
+
""
|
|
1523
|
+
: process.env.FPI_TECH_SPEC_FOOTER_BASE_URL ??
|
|
1524
|
+
process.env.FPI_TECH_SPEC_BASE_URL ??
|
|
1525
|
+
"";
|
|
1520
1526
|
if (!footerBaseUrl) {
|
|
1521
|
-
(0, logs_1.log)(`FPI_TECH_SPEC_FOOTER_BASE_URL process env not found`, "ERROR");
|
|
1527
|
+
(0, logs_1.log)(`FPI_TECH_SPEC_FOOTER_BASE_URL process env not found for country ${country}`, "ERROR");
|
|
1522
1528
|
}
|
|
1523
1529
|
footerBaseUrl = footerBaseUrl.replace(/\/?(\?|#|$)/, "/$1");
|
|
1524
1530
|
const layoutUrl = `${baseUrl}${locale}/${country}/tech-spec/${pageSlug}/v-${version}/`;
|