pim-import 4.3.2 → 4.4.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/downloads.js +2 -2
- package/dist/algolia/downloads.js.map +1 -1
- package/dist/algolia/families.js +2 -2
- package/dist/algolia/families.js.map +1 -1
- package/dist/algolia/models.js +5 -5
- package/dist/algolia/models.js.map +1 -1
- package/dist/algolia/news.js +3 -3
- package/dist/algolia/news.js.map +1 -1
- package/dist/algolia/pressRelease.js +3 -3
- package/dist/algolia/pressRelease.js.map +1 -1
- package/dist/algolia/pressReview.js +1 -1
- package/dist/algolia/pressReview.js.map +1 -1
- package/dist/algolia/products.js +20 -20
- package/dist/algolia/products.js.map +1 -1
- package/dist/algolia/projects.js +1 -1
- package/dist/algolia/projects.js.map +1 -1
- package/dist/algolia/stories.js +8 -10
- package/dist/algolia/stories.js.map +1 -1
- package/dist/algolia/subFamilies.js +5 -5
- package/dist/algolia/subFamilies.js.map +1 -1
- package/dist/algolia/subModels.js +6 -6
- package/dist/algolia/subModels.js.map +1 -1
- package/dist/libs/contentful-cda.js +6 -11
- package/dist/libs/contentful-cda.js.map +1 -1
- package/dist/libs/contentful.js +13 -19
- package/dist/libs/contentful.js.map +1 -1
- package/dist/libs/imgix.js +3 -3
- package/dist/libs/imgix.js.map +1 -1
- package/dist/utils.js +11 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/algolia/downloads.ts +1 -3
- package/src/algolia/families.ts +2 -4
- package/src/algolia/models.ts +4 -7
- package/src/algolia/news.ts +10 -4
- package/src/algolia/pressRelease.ts +11 -4
- package/src/algolia/pressReview.ts +8 -2
- package/src/algolia/products.ts +9 -26
- package/src/algolia/projects.ts +6 -2
- package/src/algolia/stories.ts +21 -12
- package/src/algolia/subFamilies.ts +9 -9
- package/src/algolia/subModels.ts +10 -10
- package/src/libs/contentful-cda.ts +17 -15
- package/src/libs/contentful.ts +15 -24
- package/src/libs/imgix.ts +6 -4
- package/src/utils.ts +22 -0
- package/types/libs/contentful-cda.d.ts +1 -1
- package/types/libs/contentful.d.ts +1 -1
- package/types/utils.d.ts +1 -0
package/src/libs/imgix.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import axios from "@atoms-studio/axios";
|
|
10
10
|
import https from "https";
|
|
11
11
|
import mime from "mime-types";
|
|
12
|
-
import { basename } from "../utils";
|
|
12
|
+
import { basename, getAllTranslations } from "../utils";
|
|
13
13
|
|
|
14
14
|
let imgix: ImgixAPI;
|
|
15
15
|
export const getImgix = () => {
|
|
@@ -204,9 +204,11 @@ export const getWrapperImgixFields = async (wrapperImgixId: string) => {
|
|
|
204
204
|
focalPoint:
|
|
205
205
|
wrapperImgix?.fields?.focalPoint?.[defaultEnvironmentLocaleCode]
|
|
206
206
|
?.focalPoint || {},
|
|
207
|
-
altText: wrapperImgix?.fields?.altText || {},
|
|
208
|
-
caption: wrapperImgix?.fields?.caption || {},
|
|
209
|
-
hoverTitle:
|
|
207
|
+
altText: await getAllTranslations(wrapperImgix?.fields?.altText || {}),
|
|
208
|
+
caption: await getAllTranslations(wrapperImgix?.fields?.caption || {}),
|
|
209
|
+
hoverTitle: await getAllTranslations(
|
|
210
|
+
wrapperImgix?.fields?.hoverTitle || {}
|
|
211
|
+
),
|
|
210
212
|
forceHoverTitle:
|
|
211
213
|
!!wrapperImgix?.fields?.forceHoverTitle?.[defaultEnvironmentLocaleCode],
|
|
212
214
|
};
|
package/src/utils.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
} from "./types";
|
|
9
9
|
import { AssetsEntity } from "./resources/ProductDetails";
|
|
10
10
|
import { log } from "./libs/logs";
|
|
11
|
+
import { cfLocales, getEnvironmentDefaultLocaleCode } from "./libs/contentful";
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Merge two objects
|
|
@@ -326,3 +327,24 @@ export const replaceAll = (original: string, from: string, to: string) => {
|
|
|
326
327
|
const regExp = new RegExp(from, "g");
|
|
327
328
|
return original.replace(regExp, to);
|
|
328
329
|
};
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Get all locale translations
|
|
333
|
+
*
|
|
334
|
+
*
|
|
335
|
+
* @param {object} values
|
|
336
|
+
*
|
|
337
|
+
* @example getAllTranslations({en:foo}) => {en:foo, it: foo, de: foo...}
|
|
338
|
+
*
|
|
339
|
+
* @returns
|
|
340
|
+
*/
|
|
341
|
+
export const getAllTranslations = async (values: any) => {
|
|
342
|
+
const defaultLocale = await getEnvironmentDefaultLocaleCode();
|
|
343
|
+
|
|
344
|
+
const newValue: any = {};
|
|
345
|
+
for (const locale of cfLocales) {
|
|
346
|
+
newValue[locale] = values?.[locale] || values[defaultLocale] || "";
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
return keysToLowerCase(newValue);
|
|
350
|
+
};
|
|
@@ -8,7 +8,7 @@ export declare const getEntryByID: (entryID: string, contentTypeId: string, sele
|
|
|
8
8
|
export declare const getAllEntries: (contentType: string, select?: string | undefined, filterKey?: string | undefined, filterValue?: string | undefined, limit?: number, otherFilters?: OtherFilters[] | undefined, include?: number) => Promise<Entry[]>;
|
|
9
9
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFieldsWithoutLocaleKey>;
|
|
10
10
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
|
11
|
-
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string,
|
|
11
|
+
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
12
12
|
export declare const getSubFamilySlugDetails: (topicSubFamily: Entry) => Promise<{
|
|
13
13
|
catalogPageSlugs: any;
|
|
14
14
|
familyPageSlugs: any;
|
|
@@ -47,7 +47,7 @@ export declare const deleteEntries: (contentType: string, catalogCode?: Availabl
|
|
|
47
47
|
export declare const addToRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean, resetOldValues?: boolean, linkType?: "Asset" | "Entry") => Promise<Entry>;
|
|
48
48
|
export declare const removeFromRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean) => Promise<any>;
|
|
49
49
|
export declare const addFieldValue: (entry: Entry | any, fieldKey: string, fieldValue: any, manyReferences?: boolean) => Promise<any>;
|
|
50
|
-
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string,
|
|
50
|
+
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
51
51
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFields>;
|
|
52
52
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
|
53
53
|
export declare const getDictionaryJson: () => Promise<any>;
|
package/types/utils.d.ts
CHANGED
|
@@ -17,3 +17,4 @@ export declare const capitalizeFirstLetter: (text: string) => string;
|
|
|
17
17
|
export declare const keysToLowerCase: (obj: any, includeNestedKeys?: boolean) => any;
|
|
18
18
|
export declare const addProductFieldValueCodesByPimDetails: (pimDetails: any, productFields: any, fieldKey: string, fieldParentKey?: string | undefined) => string[];
|
|
19
19
|
export declare const replaceAll: (original: string, from: string, to: string) => string;
|
|
20
|
+
export declare const getAllTranslations: (values: any) => Promise<any>;
|