pim-import 4.6.0 → 4.8.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/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/libs/contentful-cda.js +6 -3
- package/dist/libs/contentful-cda.js.map +1 -1
- package/dist/libs/contentful.js +1 -31
- package/dist/libs/contentful.js.map +1 -1
- package/dist/pim/methods/designers.js +62 -0
- package/dist/pim/methods/designers.js.map +1 -0
- package/dist/pim/methods/dictionary.js +7 -0
- package/dist/pim/methods/dictionary.js.map +1 -1
- package/dist/pim/methods/families.js +2 -1
- package/dist/pim/methods/families.js.map +1 -1
- package/dist/pim/methods/products.js +9 -4
- package/dist/pim/methods/products.js.map +1 -1
- package/dist/pim/methods/subfamilies.js +2 -1
- package/dist/pim/methods/subfamilies.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/libs/contentful-cda.ts +7 -3
- package/src/libs/contentful.ts +0 -60
- package/src/pim/methods/designers.ts +128 -0
- package/src/pim/methods/dictionary.ts +7 -0
- package/src/pim/methods/families.ts +1 -1
- package/src/pim/methods/products.ts +11 -4
- package/src/pim/methods/subfamilies.ts +1 -1
- package/src/resources/ProductDetails.ts +1 -0
- package/types/index.d.ts +1 -0
- package/types/libs/contentful.d.ts +0 -3
- package/types/pim/methods/designers.d.ts +6 -0
- package/types/resources/ProductDetails.d.ts +1 -0
|
@@ -31,7 +31,6 @@ import {
|
|
|
31
31
|
getDictionaryJson,
|
|
32
32
|
getAllEntries,
|
|
33
33
|
archiveEntry,
|
|
34
|
-
addDesignerData,
|
|
35
34
|
} from "../../libs/contentful";
|
|
36
35
|
import type {
|
|
37
36
|
Entry,
|
|
@@ -64,6 +63,7 @@ import {
|
|
|
64
63
|
} from "../../libs/imgix";
|
|
65
64
|
import { generatePDFByUrl } from "../../libs/pdf";
|
|
66
65
|
import { reindexProduct } from "../../algolia/products";
|
|
66
|
+
import { addDesignerData } from "./designers";
|
|
67
67
|
|
|
68
68
|
export type AvailableProductStatus =
|
|
69
69
|
| "To be review"
|
|
@@ -1280,15 +1280,22 @@ export const importProduct = async (
|
|
|
1280
1280
|
}
|
|
1281
1281
|
|
|
1282
1282
|
if (
|
|
1283
|
-
productDetails.visibleToWeb === true ||
|
|
1284
|
-
|
|
1283
|
+
(productDetails.visibleToWeb === true ||
|
|
1284
|
+
productDetails.code === "0000000-TEST") &&
|
|
1285
|
+
productDetails.destinations?.filter((item) =>
|
|
1286
|
+
item.code.includes("PROFESSIONAL_")
|
|
1287
|
+
).length
|
|
1285
1288
|
) {
|
|
1286
1289
|
await addProduct(productDetails);
|
|
1287
1290
|
return true;
|
|
1288
1291
|
} else {
|
|
1289
1292
|
await notVisibleToWebProduct(productDetails.code);
|
|
1293
|
+
const destinations = productDetails.destinations
|
|
1294
|
+
?.map((item) => item.code)
|
|
1295
|
+
.join(", ");
|
|
1296
|
+
|
|
1290
1297
|
log(
|
|
1291
|
-
`Product not to be imported: ${productDetails.code} - visibleToWeb = ${productDetails.visibleToWeb}`
|
|
1298
|
+
`Product not to be imported: ${productDetails.code} - visibleToWeb = ${productDetails.visibleToWeb} - destinations = [${destinations}]`
|
|
1292
1299
|
);
|
|
1293
1300
|
return false;
|
|
1294
1301
|
}
|
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
cfLocales,
|
|
10
10
|
addToRelationFields,
|
|
11
11
|
addFieldValue,
|
|
12
|
-
addDesignerData,
|
|
13
12
|
} from "../../libs/contentful";
|
|
14
13
|
import { log, serverUtils } from "../../libs/logs";
|
|
15
14
|
import type {
|
|
@@ -37,6 +36,7 @@ import {
|
|
|
37
36
|
} from "../../types";
|
|
38
37
|
import { updateSubFamiliesRelToEntry, getCategoryTopicCode } from "./catalogs";
|
|
39
38
|
import { pageResponse } from "../../algolia/families";
|
|
39
|
+
import { addDesignerData } from "./designers";
|
|
40
40
|
|
|
41
41
|
const getComponentModelPagesData = async (
|
|
42
42
|
componentID: string,
|
package/types/index.d.ts
CHANGED
|
@@ -28,3 +28,4 @@ export { getStaticDailyProducts, getLatestProducts } from "./pim/endpoints";
|
|
|
28
28
|
export { log, setServerUtils, setLogId, setLogPath, setLogFilename, getLogFolder, } from "./libs/logs";
|
|
29
29
|
export { removeRecordsByStatus } from "./algolia/clean";
|
|
30
30
|
export { generatePDFByUrl } from "./libs/pdf";
|
|
31
|
+
export { importDesigners, importDesigner } from "./pim/methods/designers";
|
|
@@ -2,7 +2,6 @@ import type { Entry, CreateEntryProps, EntryProps } from "contentful-management/
|
|
|
2
2
|
import type { QueryOptions } from "contentful-management/dist/typings/common-types";
|
|
3
3
|
import { Environment, Locale, CreateAssetProps } from "contentful-management/types";
|
|
4
4
|
import { ContentfulLocale, AvailableCatalogs, TopicDetailsResponse, AssetPropFields, OtherFilters, WrapperImageFields } from "../types";
|
|
5
|
-
import { GenericData } from "../resources/ProductDetails";
|
|
6
5
|
export declare type Config = {
|
|
7
6
|
accessToken: string;
|
|
8
7
|
spaceId: string;
|
|
@@ -56,6 +55,4 @@ export declare const getDictionaryLocaleValue: (locale: string, fieldKey: string
|
|
|
56
55
|
export declare const getTopicPage: (topicId: string, select?: string) => Promise<Entry>;
|
|
57
56
|
export declare const createWrapperImgix: (id: string, data: WrapperImageFields) => Promise<Entry>;
|
|
58
57
|
export declare const archiveEntry: (entry: Entry, isProduct?: boolean) => Promise<Entry>;
|
|
59
|
-
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps<import("contentful-management/types").KeyValueMap>>;
|
|
60
|
-
export declare const addDesignerData: (data: any, designer: GenericData, manyReferences?: boolean) => Promise<any>;
|
|
61
58
|
export declare const getEntries: (opts: QueryOptions) => Promise<import("contentful-management/dist/typings/common-types").Collection<import("contentful-management/dist/typings/entities/entry").Entry, EntryProps<Record<string, any>>>>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Entry, CreateEntryProps } from "contentful-management/dist/typings/entities/entry";
|
|
2
|
+
import { GenericData } from "../../resources/ProductDetails";
|
|
3
|
+
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps<import("contentful-management/types").KeyValueMap>>;
|
|
4
|
+
export declare const addDesignerData: (data: any, designer: GenericData, manyReferences?: boolean) => Promise<any>;
|
|
5
|
+
export declare const importDesigner: (designer: GenericData, skipUpdate?: boolean) => Promise<Entry>;
|
|
6
|
+
export declare const importDesigners: () => Promise<void>;
|