pim-import 6.2.0 → 6.2.2
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.
|
@@ -546,14 +546,14 @@
|
|
|
546
546
|
"type": "string"
|
|
547
547
|
},
|
|
548
548
|
{
|
|
549
|
-
"key": "
|
|
549
|
+
"key": "cordLength",
|
|
550
550
|
"parent": "physical",
|
|
551
551
|
"icon": false,
|
|
552
552
|
"dictionary": "",
|
|
553
553
|
"type": "string"
|
|
554
554
|
},
|
|
555
555
|
{
|
|
556
|
-
"key": "
|
|
556
|
+
"key": "cordLength_us",
|
|
557
557
|
"parent": "physical",
|
|
558
558
|
"icon": false,
|
|
559
559
|
"dictionary": "",
|
|
@@ -889,7 +889,7 @@
|
|
|
889
889
|
"type": "string"
|
|
890
890
|
},
|
|
891
891
|
{
|
|
892
|
-
"key": "
|
|
892
|
+
"key": "canopyDimension_us",
|
|
893
893
|
"parent": "physical",
|
|
894
894
|
"icon": false,
|
|
895
895
|
"dictionary": "",
|
|
@@ -17,7 +17,20 @@ const publishEntry = async (entryId, type) => {
|
|
|
17
17
|
};
|
|
18
18
|
const publishTopicProduct = async (productEntry) => {
|
|
19
19
|
const pageId = (0, products_1.getProductPageIdByCode)(productEntry.sys.id);
|
|
20
|
-
await
|
|
20
|
+
let pageEntry = await (0, contentful_1.getEntryByID)(pageId, "page");
|
|
21
|
+
if (!pageEntry) {
|
|
22
|
+
(0, logs_1.log)(`Page entry not found for product ${productEntry.sys.id}`, "WARN");
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const redirectToPageId = pageEntry.fields.redirectTo?.en?.sys?.id;
|
|
26
|
+
if (pageEntry.isDraft()) {
|
|
27
|
+
if (redirectToPageId === pageId) {
|
|
28
|
+
pageEntry.fields.redirectTo = {};
|
|
29
|
+
pageEntry.update();
|
|
30
|
+
(0, logs_1.log)(`Removed redirectTo from page ${pageId} for product ${productEntry.sys.id}`);
|
|
31
|
+
}
|
|
32
|
+
await publishEntry(pageId, "page");
|
|
33
|
+
}
|
|
21
34
|
await productEntry.publish();
|
|
22
35
|
};
|
|
23
36
|
exports.publishTopicProduct = publishTopicProduct;
|
|
@@ -114,9 +114,9 @@ const isTermsToAdd = async (productDetails, catalog) => {
|
|
|
114
114
|
(0, logs_1.log)(`No models found`);
|
|
115
115
|
}
|
|
116
116
|
const subModelsFieldKey = "subModels" + (0, utils_1.capitalizeFirstLetter)(catalog);
|
|
117
|
-
if (productDetails.
|
|
118
|
-
for (const
|
|
119
|
-
const subModelCode =
|
|
117
|
+
if (productDetails.subModels) {
|
|
118
|
+
for (const subModel of productDetails.subModels) {
|
|
119
|
+
const subModelCode = subModel.code;
|
|
120
120
|
if (subModelCode) {
|
|
121
121
|
(0, logs_1.log)(`Get subModel entry with id ${subModelCode}`);
|
|
122
122
|
const subModelEntry = await (0, contentful_1.getEntryByID)(subModelCode, "topicSubModel", "sys");
|
|
@@ -134,7 +134,7 @@ const isTermsToAdd = async (productDetails, catalog) => {
|
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
136
|
else {
|
|
137
|
-
(0, logs_1.log)(`No
|
|
137
|
+
(0, logs_1.log)(`No subModels found`);
|
|
138
138
|
}
|
|
139
139
|
productEntry = await productEntry.update();
|
|
140
140
|
if (productEntry.isPublished()) {
|
|
@@ -550,9 +550,9 @@ const getProductData = async (productEntry, productDetails) => {
|
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
const subModelsFieldKey = "subModels" + (0, utils_1.capitalizeFirstLetter)(catalog);
|
|
553
|
-
if (productDetails?.
|
|
554
|
-
(0, logs_1.log)(`Set ${productDetails.
|
|
555
|
-
const subModelsCodes = productDetails.
|
|
553
|
+
if (productDetails?.subModels) {
|
|
554
|
+
(0, logs_1.log)(`Set ${productDetails.subModels.length} subModels relations`);
|
|
555
|
+
const subModelsCodes = productDetails.subModels.map((subModel) => {
|
|
556
556
|
return subModel.code;
|
|
557
557
|
});
|
|
558
558
|
const topicSubModelEntries = await (0, contentful_1.getAllEntriesByCodes)(subModelsCodes, "topicSubModel", "sys,fields.catalog");
|
|
@@ -71,7 +71,7 @@ export interface ProductDetails {
|
|
|
71
71
|
priceLists?: null[] | null;
|
|
72
72
|
markets?: GenericData[] | null;
|
|
73
73
|
models?: ModelsEntityOrParentModel[] | null;
|
|
74
|
-
|
|
74
|
+
subModels?: SubmodelsEntity[] | null;
|
|
75
75
|
productionSite: GenericData;
|
|
76
76
|
certification: Certification;
|
|
77
77
|
marking: Marking;
|
|
@@ -250,7 +250,7 @@ export interface Physical {
|
|
|
250
250
|
preCabled?: null;
|
|
251
251
|
plugTypes?: null;
|
|
252
252
|
diameterDecor?: null;
|
|
253
|
-
|
|
253
|
+
cordLength?: null;
|
|
254
254
|
h2oStop?: null;
|
|
255
255
|
cuttableField?: null;
|
|
256
256
|
shapes?: GenericData[] | null;
|