pim-import 6.12.0 → 6.13.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.
|
@@ -4,6 +4,11 @@ export type pageResponse = {
|
|
|
4
4
|
type: string;
|
|
5
5
|
details?: {};
|
|
6
6
|
} | null;
|
|
7
|
+
type downloadButton = {
|
|
8
|
+
key: string;
|
|
9
|
+
to: string;
|
|
10
|
+
downloadType: string;
|
|
11
|
+
};
|
|
7
12
|
export type AlgoliaFamilyRecord = {
|
|
8
13
|
objectID: string;
|
|
9
14
|
names: CfLocalizedEntryField;
|
|
@@ -23,6 +28,7 @@ export type AlgoliaFamilyRecord = {
|
|
|
23
28
|
productFieldsCn: TopicProductFieldsResponse[];
|
|
24
29
|
isNew: boolean;
|
|
25
30
|
priority: number;
|
|
31
|
+
downloadButtons?: downloadButton[];
|
|
26
32
|
destinations?: string[];
|
|
27
33
|
lastSyncDate: string;
|
|
28
34
|
};
|
|
@@ -61,8 +67,10 @@ export declare const reindexFamily: (topicFamilyEntryId: string) => Promise<{
|
|
|
61
67
|
productFieldsCn: TopicProductFieldsResponse[];
|
|
62
68
|
isNew: boolean;
|
|
63
69
|
priority: number;
|
|
70
|
+
downloadButtons?: downloadButton[] | undefined;
|
|
64
71
|
destinations?: string[] | undefined;
|
|
65
72
|
lastSyncDate: string;
|
|
66
73
|
taskID: number;
|
|
67
74
|
}>;
|
|
68
75
|
export declare const removeFamilyObject: (objectId: string) => Promise<void>;
|
|
76
|
+
export {};
|
|
@@ -34,6 +34,11 @@ export declare const reindexSubFamily: (topicSubFamilyEntryId: string) => Promis
|
|
|
34
34
|
productFieldsCn: import("../types").TopicProductFieldsResponse[];
|
|
35
35
|
isNew: boolean;
|
|
36
36
|
priority: number;
|
|
37
|
+
downloadButtons?: {
|
|
38
|
+
key: string;
|
|
39
|
+
to: string;
|
|
40
|
+
downloadType: string;
|
|
41
|
+
}[] | undefined;
|
|
37
42
|
destinations?: string[] | undefined;
|
|
38
43
|
lastSyncDate: string;
|
|
39
44
|
taskID: number;
|
|
@@ -143,6 +143,38 @@ const getProductFields = async (topicSubFamily, destination = "PROFESSIONAL_GLOB
|
|
|
143
143
|
const isObjectToDelete = (object, defaultEnvironmentLocaleCode) => {
|
|
144
144
|
return (!object?.productFields || !object?.slugs?.[defaultEnvironmentLocaleCode]);
|
|
145
145
|
};
|
|
146
|
+
const getDownloadButtons = (topicSubFamily, defaultEnvironmentLocaleCode) => {
|
|
147
|
+
const downloadButtons = [];
|
|
148
|
+
const topicSubFamilyFields = topicSubFamily?.fields;
|
|
149
|
+
if (topicSubFamilyFields?.leaflet?.[defaultEnvironmentLocaleCode]?.fields
|
|
150
|
+
?.file?.[defaultEnvironmentLocaleCode]?.url) {
|
|
151
|
+
downloadButtons.push({
|
|
152
|
+
key: "leaflet",
|
|
153
|
+
to: topicSubFamilyFields.leaflet?.[defaultEnvironmentLocaleCode]?.fields
|
|
154
|
+
?.file?.[defaultEnvironmentLocaleCode]?.url,
|
|
155
|
+
downloadType: "pdf",
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
if (topicSubFamilyFields?.datasheet?.[defaultEnvironmentLocaleCode]?.fields
|
|
159
|
+
?.file?.[defaultEnvironmentLocaleCode]?.url) {
|
|
160
|
+
downloadButtons.push({
|
|
161
|
+
key: "datasheet",
|
|
162
|
+
to: topicSubFamilyFields.datasheet?.[defaultEnvironmentLocaleCode]?.fields
|
|
163
|
+
?.file?.[defaultEnvironmentLocaleCode]?.url,
|
|
164
|
+
downloadType: "pdf",
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
if (topicSubFamilyFields?.specsheet_us?.[defaultEnvironmentLocaleCode]?.fields
|
|
168
|
+
?.file?.[defaultEnvironmentLocaleCode]?.url) {
|
|
169
|
+
downloadButtons.push({
|
|
170
|
+
key: "specsheet_us",
|
|
171
|
+
to: topicSubFamilyFields.specsheet_us?.[defaultEnvironmentLocaleCode]
|
|
172
|
+
?.fields?.file?.[defaultEnvironmentLocaleCode]?.url,
|
|
173
|
+
downloadType: "pdf",
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
return downloadButtons;
|
|
177
|
+
};
|
|
146
178
|
const getObject = async (topicSubFamily) => {
|
|
147
179
|
const defaultEnvironmentLocaleCode = await (0, contentful_cda_1.getEnvironmentDefaultLocaleCode)();
|
|
148
180
|
(0, logs_1.log)(`Get details of the ${topicSubFamily.sys.id} topicSubFamily`);
|
|
@@ -215,6 +247,8 @@ const getObject = async (topicSubFamily) => {
|
|
|
215
247
|
}
|
|
216
248
|
(0, logs_1.log)(`Get priority details...`);
|
|
217
249
|
const priority = topicSubFamilyWithFields?.fields?.priority?.[defaultEnvironmentLocaleCode] || 0;
|
|
250
|
+
(0, logs_1.log)(`Get download buttons details...`);
|
|
251
|
+
const downloadButtons = getDownloadButtons(topicSubFamilyWithFields, defaultEnvironmentLocaleCode);
|
|
218
252
|
const record = {
|
|
219
253
|
objectID: topicSubFamilyWithFields.sys.id,
|
|
220
254
|
names: await (0, utils_1.getAllTranslations)(topicSubFamilyWithFields?.fields?.name || {}),
|
|
@@ -235,6 +269,7 @@ const getObject = async (topicSubFamily) => {
|
|
|
235
269
|
productFieldsCn,
|
|
236
270
|
priority,
|
|
237
271
|
isNew,
|
|
272
|
+
downloadButtons,
|
|
238
273
|
destinations: topicSubFamilyWithFields?.fields?.destinations?.[defaultEnvironmentLocaleCode] || [],
|
|
239
274
|
lastSyncDate: (0, utils_1.getLocalISOTime)(),
|
|
240
275
|
};
|
package/dist/pim/endpoints.js
CHANGED