@djust-b2b/djust-front-sdk 1.14.0 → 1.15.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.
package/lib/index.d.ts CHANGED
@@ -21,12 +21,10 @@ export declare const DjustSDK: {
21
21
  storeId?: string;
22
22
  storeViewId?: string;
23
23
  }>) => void;
24
- getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentsResponse>;
25
- getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }: import("./services/incident/definitions").getOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentResponse>;
26
- getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticLineIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticLineIncidentsResponse>;
24
+ getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }: import("./services/incident/definitions").getIncidentsParameters): Promise<import("./services/incident/definitions").getIncidentsResponse>;
25
+ getIncident({ incidentId, idType, }: import("./services/incident/definitions").getIncidentParameters): Promise<import("./services/incident/definitions").getIncidentResponse>;
27
26
  createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentResponse>;
28
27
  createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: import("./services/incident/definitions").createOrderLogisticLineIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticLineIncidentResponse>;
29
- getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }: import("./services/incident/definitions").getCustomerAccountIncidentsParameters): Promise<import("./services/incident/definitions").getCustomerAccountIncidentsResponse>;
30
28
  getCommercialOrders({ locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
31
29
  createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
32
30
  getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
@@ -144,11 +142,11 @@ export declare const DjustSDK: {
144
142
  deleteBuyingList({ buyingListId, }: import("./interfaces").DeleteBuyingListParameters): Promise<void>;
145
143
  deleteBuyingListItems({ buyingListId, itemIds, }: import("./interfaces").DeleteBuyingListItemsParameters): Promise<void>;
146
144
  updateBuyingListOwner({ buyingListId, newOwnerEmail, }: import("./interfaces").UpdateBuyingListOwnerParameters): Promise<void>;
147
- isTokenValid({ token, }: import("./interfaces").IsTokenValidParameters): Promise<boolean>;
148
- refreshToken({ refreshToken, }: import("./interfaces").RefreshTokenParameters): Promise<import("./interfaces").RefreshTokenResponse>;
149
- resetPassword({ newPassword, resetPasswordToken, }: import("./interfaces").ResetPasswordParameters): Promise<void>;
150
- sendResetPasswordEmail({ email, }: import("./interfaces").SendResetPasswordEmailParameters): Promise<void>;
151
- login({ username, password, }: import("./interfaces").LoginParameters): Promise<import("./interfaces").LoginResponse>;
145
+ isTokenValid({ token, }: import("./services/auth/definitions.requests").IsTokenValidParameters): Promise<boolean>;
146
+ refreshToken({ refreshToken, }: import("./services/auth/definitions.requests").RefreshTokenParameters): Promise<import("./interfaces").RefreshTokenResponse>;
147
+ resetPassword({ newPassword, resetPasswordToken, }: import("./services/auth/definitions.requests").ResetPasswordParameters): Promise<void>;
148
+ sendResetPasswordEmail({ email, }: import("./services/auth/definitions.requests").SendResetPasswordEmailParameters): Promise<void>;
149
+ login({ username, password, }: import("./services/auth/definitions.requests").LoginParameters): Promise<import("./interfaces").LoginResponse>;
152
150
  logout(): Promise<void>;
153
151
  };
154
152
  export * from "./interfaces";
@@ -1,6 +1,7 @@
1
1
  import { CustomFieldValueObject } from "./custom-field";
2
2
  export type IncidentStatus = "OPEN" | "ON_GOING" | "CLOSED";
3
3
  export type IncidentIdType = "DJUST_ID" | "EXTERNAL_ID";
4
+ export type IncidentLinkedType = "ORDER" | "ORDER_LINES";
4
5
  export interface IncidentLogisticOrder {
5
6
  id: string;
6
7
  externalId: string;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Request parameters type definitions
3
+ */
4
+ export interface IsTokenValidParameters {
5
+ token: string;
6
+ }
7
+ export interface RefreshTokenParameters {
8
+ refreshToken: string;
9
+ }
10
+ export interface ResetPasswordParameters {
11
+ newPassword: string;
12
+ resetPasswordToken: string;
13
+ }
14
+ export interface SendResetPasswordEmailParameters {
15
+ email: string;
16
+ redirectUrl: string;
17
+ }
18
+ export interface LoginParameters {
19
+ username: string;
20
+ password: string;
21
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,11 +1,21 @@
1
1
  /**
2
- * @packageDocumentation
2
+ * # Auth Service
3
3
  *
4
- * @document documents/auth.md
4
+ * This module provides all functionalities related to user authentication and authorization.
5
+ *
6
+ * ## Features:
7
+ * - Validate tokens
8
+ * - Refresh tokens
9
+ * - Reset user passwords
10
+ * - Manage user login and logout
11
+ * - Send password reset emails
12
+ *
13
+ * Each function is described with its input parameters, output responses, and example usages.
5
14
  */
6
- import { IsTokenValidParameters, LoginParameters, LoginResponse, RefreshTokenParameters, RefreshTokenResponse, ResetPasswordParameters, SendResetPasswordEmailParameters } from "./definitions";
15
+ import { LoginResponse, RefreshTokenResponse } from "./definitions";
16
+ import { IsTokenValidParameters, LoginParameters, RefreshTokenParameters, ResetPasswordParameters, SendResetPasswordEmailParameters } from "./definitions.requests";
7
17
  /**
8
- * CART ENDPOINT
18
+ * AUTH ENDPOINT
9
19
  */
10
20
  /**
11
21
  * ##R eturns true if the token is valid and not expired, false otherwise
@@ -1,8 +1,17 @@
1
1
  "use strict";
2
2
  /**
3
- * @packageDocumentation
3
+ * # Auth Service
4
4
  *
5
- * @document documents/auth.md
5
+ * This module provides all functionalities related to user authentication and authorization.
6
+ *
7
+ * ## Features:
8
+ * - Validate tokens
9
+ * - Refresh tokens
10
+ * - Reset user passwords
11
+ * - Manage user login and logout
12
+ * - Send password reset emails
13
+ *
14
+ * Each function is described with its input parameters, output responses, and example usages.
6
15
  */
7
16
  Object.defineProperty(exports, "__esModule", { value: true });
8
17
  exports.isTokenValid = isTokenValid;
@@ -14,7 +23,7 @@ exports.logout = logout;
14
23
  const parameters_validation_1 = require("../../helpers/parameters-validation");
15
24
  const fetch_instance_1 = require("../../settings/fetch-instance");
16
25
  /**
17
- * CART ENDPOINT
26
+ * AUTH ENDPOINT
18
27
  */
19
28
  /**
20
29
  * ##R eturns true if the token is valid and not expired, false otherwise
@@ -1,8 +1,3 @@
1
- /**
2
- * @packageDocumentation
3
- *
4
- * @document documents/cart.md
5
- */
6
1
  import { CreateCartParameters, DeleteCartsResponse, DeleteCartParameters, GetCartParameters, GetCartResponse, GetCartsParameters, GetCartsResponse, UpdateCartParameters, InitializeOrdersFromCartParameters, GetCartLinesParameters, DeleteCartLinesResponse, DeleteCartLinesParameters, GetCartLinesResponse, UpdateCartLinesResponse, UpdateCartLinesParameters, UpdateCartLinesByVariantParameters, UpdateCartLinesByVariantResponse } from "./definitions";
7
2
  /**
8
3
  * CART ENDPOINT
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * @packageDocumentation
4
- *
5
- * @document documents/cart.md
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.deleteCarts = deleteCarts;
9
4
  exports.getCarts = getCarts;
@@ -0,0 +1,100 @@
1
+ import { Order, PageableObject } from "../../interfaces/models/common";
2
+ declare enum SealedTarget {
3
+ OFFER = 0,
4
+ ACCOUNT = 1,
5
+ NAVIGATION_CATEGORY = 2,
6
+ SUPPLIER = 3,
7
+ CUSTOMER_USER = 4,
8
+ CUSTOMER_ORGANISATION = 5,
9
+ ORDER_LOGISTIC = 6,
10
+ ORDER_COMMERCIAL = 7,
11
+ ORDER_LOGISTIC_LINE = 8,
12
+ QUOTE = 9,
13
+ QUOTE_LINE = 10,
14
+ ORDER_INCIDENT = 11,
15
+ THREAD_MESSAGE = 12
16
+ }
17
+ declare enum ExternalSource {
18
+ MIRAKL = 0,
19
+ CLIENT = 1,
20
+ NOT_DEFINED = 2,
21
+ EXTERN = 3,
22
+ SYSTEM = 4
23
+ }
24
+ declare enum CustomFieldRole {
25
+ PRODUCT_TAX_RATE = 0,
26
+ SHIPPING_TAX_RATE = 1,
27
+ SHIPPING_TAX_CODE = 2,
28
+ PRODUCT_TAX_CODE = 3,
29
+ ORDERS_MANAGED_INTERNALLY = 4,
30
+ OFFER_VALIDITY_START_DATE = 5,
31
+ OFFER_VALIDITY_END_DATE = 6,
32
+ AUTOMATIC_ORDER_VALIDATION = 7
33
+ }
34
+ declare enum CustomFieldStatus {
35
+ ACTIVE = 0,
36
+ INACTIVE = 1
37
+ }
38
+ declare enum CustomFieldType {
39
+ LONG_TEXT = 0,
40
+ TEXT = 1,
41
+ NUMBER = 2,
42
+ METRIC = 3,
43
+ DATE = 4,
44
+ LIST_TEXT = 5,
45
+ LIST_METRIC = 6,
46
+ LIST_NUMBER = 7,
47
+ BOOLEAN = 8,
48
+ MEDIA = 9
49
+ }
50
+ declare enum CustomFieldIdType {
51
+ BUSINESS_ID = 0,
52
+ EXTERNAL_ID = 1
53
+ }
54
+ interface CustomFieldDto {
55
+ externalId: string;
56
+ externalSource: ExternalSource;
57
+ faceted?: boolean;
58
+ id?: string;
59
+ indexable?: boolean;
60
+ mandatory: boolean;
61
+ name: string;
62
+ role?: CustomFieldRole;
63
+ sealedTarget: boolean;
64
+ searchable?: boolean;
65
+ sortable?: boolean;
66
+ status: CustomFieldStatus;
67
+ type?: CustomFieldType;
68
+ }
69
+ export interface GetCustomFieldParameters {
70
+ sealedTarget: SealedTarget;
71
+ status?: CustomFieldStatus;
72
+ type?: CustomFieldType;
73
+ searchCriteria?: string;
74
+ searchable?: boolean;
75
+ sortable?: boolean;
76
+ page?: number;
77
+ size?: number;
78
+ sort?: string[];
79
+ }
80
+ export interface GetCustomFieldResponse {
81
+ content: CustomFieldDto[];
82
+ empty?: boolean;
83
+ first?: boolean;
84
+ last?: boolean;
85
+ number?: number;
86
+ numberOfElements?: number;
87
+ pageable?: PageableObject;
88
+ size?: number;
89
+ sort?: Order[];
90
+ totalElemets?: number;
91
+ totalPages?: number;
92
+ }
93
+ export interface PostMediaCustomFieldParameters {
94
+ id: string;
95
+ customFieldIdType?: CustomFieldIdType;
96
+ sealedTarget?: SealedTarget;
97
+ fileName: string;
98
+ fileSize: number;
99
+ }
100
+ export {};
@@ -0,0 +1,60 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var SealedTarget;
4
+ (function (SealedTarget) {
5
+ SealedTarget[SealedTarget["OFFER"] = 0] = "OFFER";
6
+ SealedTarget[SealedTarget["ACCOUNT"] = 1] = "ACCOUNT";
7
+ SealedTarget[SealedTarget["NAVIGATION_CATEGORY"] = 2] = "NAVIGATION_CATEGORY";
8
+ SealedTarget[SealedTarget["SUPPLIER"] = 3] = "SUPPLIER";
9
+ SealedTarget[SealedTarget["CUSTOMER_USER"] = 4] = "CUSTOMER_USER";
10
+ SealedTarget[SealedTarget["CUSTOMER_ORGANISATION"] = 5] = "CUSTOMER_ORGANISATION";
11
+ SealedTarget[SealedTarget["ORDER_LOGISTIC"] = 6] = "ORDER_LOGISTIC";
12
+ SealedTarget[SealedTarget["ORDER_COMMERCIAL"] = 7] = "ORDER_COMMERCIAL";
13
+ SealedTarget[SealedTarget["ORDER_LOGISTIC_LINE"] = 8] = "ORDER_LOGISTIC_LINE";
14
+ SealedTarget[SealedTarget["QUOTE"] = 9] = "QUOTE";
15
+ SealedTarget[SealedTarget["QUOTE_LINE"] = 10] = "QUOTE_LINE";
16
+ SealedTarget[SealedTarget["ORDER_INCIDENT"] = 11] = "ORDER_INCIDENT";
17
+ SealedTarget[SealedTarget["THREAD_MESSAGE"] = 12] = "THREAD_MESSAGE";
18
+ })(SealedTarget || (SealedTarget = {}));
19
+ var ExternalSource;
20
+ (function (ExternalSource) {
21
+ ExternalSource[ExternalSource["MIRAKL"] = 0] = "MIRAKL";
22
+ ExternalSource[ExternalSource["CLIENT"] = 1] = "CLIENT";
23
+ ExternalSource[ExternalSource["NOT_DEFINED"] = 2] = "NOT_DEFINED";
24
+ ExternalSource[ExternalSource["EXTERN"] = 3] = "EXTERN";
25
+ ExternalSource[ExternalSource["SYSTEM"] = 4] = "SYSTEM";
26
+ })(ExternalSource || (ExternalSource = {}));
27
+ var CustomFieldRole;
28
+ (function (CustomFieldRole) {
29
+ CustomFieldRole[CustomFieldRole["PRODUCT_TAX_RATE"] = 0] = "PRODUCT_TAX_RATE";
30
+ CustomFieldRole[CustomFieldRole["SHIPPING_TAX_RATE"] = 1] = "SHIPPING_TAX_RATE";
31
+ CustomFieldRole[CustomFieldRole["SHIPPING_TAX_CODE"] = 2] = "SHIPPING_TAX_CODE";
32
+ CustomFieldRole[CustomFieldRole["PRODUCT_TAX_CODE"] = 3] = "PRODUCT_TAX_CODE";
33
+ CustomFieldRole[CustomFieldRole["ORDERS_MANAGED_INTERNALLY"] = 4] = "ORDERS_MANAGED_INTERNALLY";
34
+ CustomFieldRole[CustomFieldRole["OFFER_VALIDITY_START_DATE"] = 5] = "OFFER_VALIDITY_START_DATE";
35
+ CustomFieldRole[CustomFieldRole["OFFER_VALIDITY_END_DATE"] = 6] = "OFFER_VALIDITY_END_DATE";
36
+ CustomFieldRole[CustomFieldRole["AUTOMATIC_ORDER_VALIDATION"] = 7] = "AUTOMATIC_ORDER_VALIDATION";
37
+ })(CustomFieldRole || (CustomFieldRole = {}));
38
+ var CustomFieldStatus;
39
+ (function (CustomFieldStatus) {
40
+ CustomFieldStatus[CustomFieldStatus["ACTIVE"] = 0] = "ACTIVE";
41
+ CustomFieldStatus[CustomFieldStatus["INACTIVE"] = 1] = "INACTIVE";
42
+ })(CustomFieldStatus || (CustomFieldStatus = {}));
43
+ var CustomFieldType;
44
+ (function (CustomFieldType) {
45
+ CustomFieldType[CustomFieldType["LONG_TEXT"] = 0] = "LONG_TEXT";
46
+ CustomFieldType[CustomFieldType["TEXT"] = 1] = "TEXT";
47
+ CustomFieldType[CustomFieldType["NUMBER"] = 2] = "NUMBER";
48
+ CustomFieldType[CustomFieldType["METRIC"] = 3] = "METRIC";
49
+ CustomFieldType[CustomFieldType["DATE"] = 4] = "DATE";
50
+ CustomFieldType[CustomFieldType["LIST_TEXT"] = 5] = "LIST_TEXT";
51
+ CustomFieldType[CustomFieldType["LIST_METRIC"] = 6] = "LIST_METRIC";
52
+ CustomFieldType[CustomFieldType["LIST_NUMBER"] = 7] = "LIST_NUMBER";
53
+ CustomFieldType[CustomFieldType["BOOLEAN"] = 8] = "BOOLEAN";
54
+ CustomFieldType[CustomFieldType["MEDIA"] = 9] = "MEDIA";
55
+ })(CustomFieldType || (CustomFieldType = {}));
56
+ var CustomFieldIdType;
57
+ (function (CustomFieldIdType) {
58
+ CustomFieldIdType[CustomFieldIdType["BUSINESS_ID"] = 0] = "BUSINESS_ID";
59
+ CustomFieldIdType[CustomFieldIdType["EXTERNAL_ID"] = 1] = "EXTERNAL_ID";
60
+ })(CustomFieldIdType || (CustomFieldIdType = {}));
@@ -0,0 +1,116 @@
1
+ import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomFieldParameters } from "./definitions";
2
+ /**
3
+ * APICODE(listPaginatedCustomFields)
4
+ * Retrieves custom fields.
5
+ *
6
+ * This function allows fetching custom fields based on the provided parameters.
7
+ *
8
+ * @param {GetCustomFieldParameters} params - The parameters for retrieving custom fields, including:
9
+ * #### fieldType - `string` | <strong style={{ color: 'red' }}>required</strong>
10
+ *
11
+ * The type of the custom field to retrieve.
12
+ * #### includeInactive - `boolean`
13
+ *
14
+ * Whether to include inactive custom fields in the response.
15
+ * #### limit - `number`
16
+ *
17
+ * The maximum number of custom fields to return.
18
+ * #### offset - `number`
19
+ *
20
+ * The number of custom fields to skip before starting to collect the result set.
21
+ *
22
+ * @returns {Promise<GetCustomFieldResponse>} - An object containing the retrieved custom fields.
23
+ *
24
+ * @example
25
+ * #### input
26
+ * ```typescript
27
+ * const customFields = await getCustomFields({ fieldType: 'text', includeInactive: false });
28
+ * ```
29
+ #### output
30
+ * ```json
31
+ * {
32
+ * "content": [
33
+ * {
34
+ * "externalId": "field1",
35
+ * "externalSource": "MIRAKL",
36
+ * "faceted": true,
37
+ * "id": "field1",
38
+ * "indexable": true,
39
+ * "mandatory": true,
40
+ * "name": "Field 1",
41
+ * "role": "PRODUCT_TAX_RATE",
42
+ * "sealedTarget": true,
43
+ * "searchable": true,
44
+ * "sortable": true,
45
+ * "status": "ACTIVE",
46
+ * "type": "TEXT"
47
+ * },
48
+ * {
49
+ * "externalId": "field2",
50
+ * "externalSource": "CLIENT",
51
+ * "faceted": false,
52
+ * "id": "field2",
53
+ * "indexable": false,
54
+ * "mandatory": false,
55
+ * "name": "Field 2",
56
+ * "role": "SHIPPING_TAX_CODE",
57
+ * "sealedTarget": false,
58
+ * "searchable": false,
59
+ * "sortable": false,
60
+ * "status": "INACTIVE",
61
+ * "type": "LONG_TEXT"
62
+ * }
63
+ * ],
64
+ * "empty": false,
65
+ * "first": true,
66
+ * "last": false,
67
+ * "number": 0,
68
+ * "numberOfElements": 2,
69
+ * "pageable": {
70
+ * "page": 0,
71
+ * "size": 10,
72
+ * "sort": []
73
+ * },
74
+ * "size": 10,
75
+ * "sort": [],
76
+ * "totalElemets": 2,
77
+ * "totalPages": 1
78
+ * }
79
+ * ```
80
+ */
81
+ export declare function getCustomFields(params: GetCustomFieldParameters): Promise<GetCustomFieldResponse>;
82
+ /**
83
+ * APICODE(postMediaCustomField)
84
+ * Publishes a media custom field.
85
+ *
86
+ * This function allows publishing a media file associated with a specific custom field.
87
+ *
88
+ * @param {PostMediaCustomFieldParameters} params - The parameters for publishing the media field, including:
89
+ * #### id - `string` | **required**
90
+ * The identifier of the custom field to which the media is associated.
91
+ * #### customFieldIdType - `string` | **required**
92
+ * The type of the custom field identifier (e.g., 'externalId').
93
+ * #### sealedTarget - `boolean`
94
+ * Indicates whether the media should be sealed.
95
+ * #### fileName - `string` | **required**
96
+ * The name of the media file being uploaded.
97
+ * #### fileSize - `number` | **required**
98
+ * The size of the media file in bytes.
99
+ *
100
+ * @returns {Promise<string>} - A promise that resolves to the URL where the media can be posted.
101
+ *
102
+ * @example
103
+ * #### input
104
+ * ```typescript
105
+ * const mediaId = await postMediaCustomField(
106
+ * {
107
+ * id: 'field1',
108
+ * customFieldIdType: 'externalId',
109
+ * sealedTarget: true,
110
+ * fileName: 'image.jpg',
111
+ * fileSize: 2048
112
+ * }
113
+ * );
114
+ * ```
115
+ */
116
+ export declare function postMediaCustomField(params: PostMediaCustomFieldParameters): Promise<string>;
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCustomFields = getCustomFields;
4
+ exports.postMediaCustomField = postMediaCustomField;
5
+ const fetch_instance_1 = require("../../settings/fetch-instance");
6
+ /**
7
+ * APICODE(listPaginatedCustomFields)
8
+ * Retrieves custom fields.
9
+ *
10
+ * This function allows fetching custom fields based on the provided parameters.
11
+ *
12
+ * @param {GetCustomFieldParameters} params - The parameters for retrieving custom fields, including:
13
+ * #### fieldType - `string` | <strong style={{ color: 'red' }}>required</strong>
14
+ *
15
+ * The type of the custom field to retrieve.
16
+ * #### includeInactive - `boolean`
17
+ *
18
+ * Whether to include inactive custom fields in the response.
19
+ * #### limit - `number`
20
+ *
21
+ * The maximum number of custom fields to return.
22
+ * #### offset - `number`
23
+ *
24
+ * The number of custom fields to skip before starting to collect the result set.
25
+ *
26
+ * @returns {Promise<GetCustomFieldResponse>} - An object containing the retrieved custom fields.
27
+ *
28
+ * @example
29
+ * #### input
30
+ * ```typescript
31
+ * const customFields = await getCustomFields({ fieldType: 'text', includeInactive: false });
32
+ * ```
33
+ #### output
34
+ * ```json
35
+ * {
36
+ * "content": [
37
+ * {
38
+ * "externalId": "field1",
39
+ * "externalSource": "MIRAKL",
40
+ * "faceted": true,
41
+ * "id": "field1",
42
+ * "indexable": true,
43
+ * "mandatory": true,
44
+ * "name": "Field 1",
45
+ * "role": "PRODUCT_TAX_RATE",
46
+ * "sealedTarget": true,
47
+ * "searchable": true,
48
+ * "sortable": true,
49
+ * "status": "ACTIVE",
50
+ * "type": "TEXT"
51
+ * },
52
+ * {
53
+ * "externalId": "field2",
54
+ * "externalSource": "CLIENT",
55
+ * "faceted": false,
56
+ * "id": "field2",
57
+ * "indexable": false,
58
+ * "mandatory": false,
59
+ * "name": "Field 2",
60
+ * "role": "SHIPPING_TAX_CODE",
61
+ * "sealedTarget": false,
62
+ * "searchable": false,
63
+ * "sortable": false,
64
+ * "status": "INACTIVE",
65
+ * "type": "LONG_TEXT"
66
+ * }
67
+ * ],
68
+ * "empty": false,
69
+ * "first": true,
70
+ * "last": false,
71
+ * "number": 0,
72
+ * "numberOfElements": 2,
73
+ * "pageable": {
74
+ * "page": 0,
75
+ * "size": 10,
76
+ * "sort": []
77
+ * },
78
+ * "size": 10,
79
+ * "sort": [],
80
+ * "totalElemets": 2,
81
+ * "totalPages": 1
82
+ * }
83
+ * ```
84
+ */
85
+ async function getCustomFields(params) {
86
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
87
+ method: "GET",
88
+ path: `/v2/shop/custom-fields`,
89
+ params,
90
+ });
91
+ return data;
92
+ }
93
+ /**
94
+ * APICODE(postMediaCustomField)
95
+ * Publishes a media custom field.
96
+ *
97
+ * This function allows publishing a media file associated with a specific custom field.
98
+ *
99
+ * @param {PostMediaCustomFieldParameters} params - The parameters for publishing the media field, including:
100
+ * #### id - `string` | **required**
101
+ * The identifier of the custom field to which the media is associated.
102
+ * #### customFieldIdType - `string` | **required**
103
+ * The type of the custom field identifier (e.g., 'externalId').
104
+ * #### sealedTarget - `boolean`
105
+ * Indicates whether the media should be sealed.
106
+ * #### fileName - `string` | **required**
107
+ * The name of the media file being uploaded.
108
+ * #### fileSize - `number` | **required**
109
+ * The size of the media file in bytes.
110
+ *
111
+ * @returns {Promise<string>} - A promise that resolves to the URL where the media can be posted.
112
+ *
113
+ * @example
114
+ * #### input
115
+ * ```typescript
116
+ * const mediaId = await postMediaCustomField(
117
+ * {
118
+ * id: 'field1',
119
+ * customFieldIdType: 'externalId',
120
+ * sealedTarget: true,
121
+ * fileName: 'image.jpg',
122
+ * fileSize: 2048
123
+ * }
124
+ * );
125
+ * ```
126
+ */
127
+ async function postMediaCustomField(params) {
128
+ const { id, customFieldIdType, sealedTarget, fileName, fileSize } = params;
129
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
130
+ method: "POST",
131
+ path: `/v2/shop/custom-fields/${id}/media`,
132
+ params: { customFieldIdType, sealedTarget, fileName, fileSize },
133
+ });
134
+ return data;
135
+ }