@djust-b2b/djust-front-sdk 2.1.0 → 2.2.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.
Files changed (61) hide show
  1. package/lib/index.d.ts +25 -23
  2. package/lib/index.js +2 -2
  3. package/lib/interfaces/index.d.ts +0 -1
  4. package/lib/interfaces/index.js +0 -1
  5. package/lib/interfaces/models/attribute.d.ts +12 -2
  6. package/lib/interfaces/models/custom-field.d.ts +4 -0
  7. package/lib/interfaces/models/customer-account.d.ts +1 -0
  8. package/lib/interfaces/models/offer.d.ts +9 -0
  9. package/lib/interfaces/models/payment.d.ts +1 -0
  10. package/lib/services/attributes/definitions.d.ts +27 -0
  11. package/lib/services/attributes/index.d.ts +32 -0
  12. package/lib/services/attributes/index.js +49 -0
  13. package/lib/services/auth/__mocks__/auth.mocks.d.ts +248 -0
  14. package/lib/services/auth/__mocks__/auth.mocks.js +220 -0
  15. package/lib/services/auth/definitions.d.ts +39 -0
  16. package/lib/services/auth/definitions.requests.d.ts +4 -0
  17. package/lib/services/auth/index.d.ts +58 -3
  18. package/lib/services/auth/index.js +72 -2
  19. package/lib/services/cart/index.js +1 -0
  20. package/lib/services/custom-field/definitions.d.ts +6 -0
  21. package/lib/services/custom-field/index.d.ts +40 -2
  22. package/lib/services/custom-field/index.js +50 -3
  23. package/lib/services/customer-account/definitions.d.ts +15 -2
  24. package/lib/services/customer-account/index.d.ts +47 -5
  25. package/lib/services/customer-account/index.js +68 -5
  26. package/lib/services/customer-user/definitions.d.ts +2 -0
  27. package/lib/services/customer-user/index.d.ts +1 -1
  28. package/lib/services/customer-user/index.js +4 -1
  29. package/lib/services/incident/definitions.d.ts +15 -0
  30. package/lib/services/incident/index.d.ts +81 -2
  31. package/lib/services/incident/index.js +116 -1
  32. package/lib/services/logistic-order/definitions.d.ts +15 -4
  33. package/lib/services/logistic-order/index.d.ts +19 -10
  34. package/lib/services/logistic-order/index.js +40 -17
  35. package/lib/services/navigation-category/definitions.d.ts +7 -0
  36. package/lib/services/navigation-category/index.d.ts +33 -1
  37. package/lib/services/navigation-category/index.js +40 -0
  38. package/lib/services/offer-inventories/index.js +3 -3
  39. package/lib/services/offer-prices/__mocks__/offer-prices.mocks.d.ts +108 -0
  40. package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +200 -0
  41. package/lib/services/offer-prices/definitions.d.ts +23 -0
  42. package/lib/services/offer-prices/index.d.ts +35 -0
  43. package/lib/services/offer-prices/index.js +52 -0
  44. package/lib/services/payment/index.js +1 -1
  45. package/lib/services/product/definitions.d.ts +5 -0
  46. package/lib/services/product/index.d.ts +6 -29
  47. package/lib/services/product/index.js +8 -42
  48. package/lib/services/product-variant/definitions.d.ts +27 -0
  49. package/lib/services/product-variant/index.d.ts +30 -1
  50. package/lib/services/product-variant/index.js +40 -0
  51. package/lib/services/supplier/__mocks__/supplier-mocks.d.ts +48 -0
  52. package/lib/services/supplier/__mocks__/supplier-mocks.js +167 -0
  53. package/lib/services/supplier/definitions.d.ts +3 -3
  54. package/lib/services/supplier/index.js +0 -2
  55. package/package.json +4 -3
  56. package/lib/interfaces/models/buying-list.d.ts +0 -16
  57. package/lib/services/buying-list/definitions.d.ts +0 -43
  58. package/lib/services/buying-list/index.d.ts +0 -33
  59. package/lib/services/buying-list/index.js +0 -104
  60. /package/lib/services/{buying-list → attributes}/definitions.js +0 -0
  61. /package/lib/{interfaces/models/buying-list.js → services/offer-prices/definitions.js} +0 -0
@@ -0,0 +1,220 @@
1
+ "use strict";
2
+ /**
3
+ * Mocks centralisés pour les tests du module auth
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.mockHttpErrors = exports.mockErrors = exports.mockResponses = exports.mockParameters = exports.mockAuthResponses = exports.mockUsers = exports.mockTokens = void 0;
7
+ // Mock data pour les tokens
8
+ exports.mockTokens = {
9
+ validToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
10
+ invalidToken: "invalid_token_123",
11
+ refreshToken: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c",
12
+ resetPasswordToken: "reset_password_token_123",
13
+ };
14
+ // Mock data pour les utilisateurs
15
+ exports.mockUsers = {
16
+ validUser: {
17
+ username: "test@example.com",
18
+ password: "password123",
19
+ },
20
+ invalidUser: {
21
+ username: "invalid@example.com",
22
+ password: "wrongpassword",
23
+ },
24
+ };
25
+ // Mock data pour les réponses d'authentification
26
+ exports.mockAuthResponses = {
27
+ loginSuccess: {
28
+ token: {
29
+ accessToken: "new_access_token_123",
30
+ expireAt: 1735689600000, // 2025-01-01
31
+ refreshToken: "new_refresh_token_123",
32
+ },
33
+ user: {
34
+ id: "user_123",
35
+ },
36
+ },
37
+ refreshTokenSuccess: {
38
+ token: {
39
+ accessToken: "refreshed_access_token_456",
40
+ expireAt: 1735689600000, // 2025-01-01
41
+ refreshToken: "new_refresh_token_456",
42
+ },
43
+ user: {
44
+ id: "user_123",
45
+ },
46
+ },
47
+ };
48
+ // Mock data pour les paramètres de test
49
+ exports.mockParameters = {
50
+ isTokenValid: {
51
+ valid: { token: exports.mockTokens.validToken },
52
+ invalid: { token: exports.mockTokens.invalidToken },
53
+ },
54
+ refreshToken: {
55
+ valid: { refreshToken: exports.mockTokens.refreshToken },
56
+ },
57
+ resetPassword: {
58
+ valid: {
59
+ newPassword: "newSecurePassword2025!",
60
+ resetPasswordToken: exports.mockTokens.resetPasswordToken,
61
+ },
62
+ },
63
+ sendResetPasswordEmail: {
64
+ valid: { email: "user@example.com" },
65
+ invalid: { email: "invalid-email" },
66
+ },
67
+ login: {
68
+ valid: {
69
+ username: exports.mockUsers.validUser.username,
70
+ password: exports.mockUsers.validUser.password,
71
+ },
72
+ withUserFalse: {
73
+ username: exports.mockUsers.validUser.username,
74
+ password: exports.mockUsers.validUser.password,
75
+ withUser: false,
76
+ },
77
+ invalid: {
78
+ username: exports.mockUsers.invalidUser.username,
79
+ password: exports.mockUsers.invalidUser.password,
80
+ },
81
+ },
82
+ getStore: {
83
+ valid: { storeId: "store_123" },
84
+ },
85
+ };
86
+ // Mock Headers pour les tests
87
+ const createMockHeaders = () => {
88
+ const headers = new Headers();
89
+ headers.append("Content-Type", "application/json");
90
+ headers.append("dj-client", "test-client");
91
+ headers.append("dj-api-key", "test-api-key");
92
+ return headers;
93
+ };
94
+ // Mock data pour les réponses des endpoints
95
+ exports.mockResponses = {
96
+ isTokenValid: {
97
+ success: {
98
+ data: true,
99
+ headers: createMockHeaders(),
100
+ status: 200,
101
+ },
102
+ failure: {
103
+ data: false,
104
+ headers: createMockHeaders(),
105
+ status: 200,
106
+ },
107
+ },
108
+ refreshToken: {
109
+ success: {
110
+ data: exports.mockAuthResponses.refreshTokenSuccess,
111
+ headers: createMockHeaders(),
112
+ status: 200,
113
+ },
114
+ },
115
+ resetPassword: {
116
+ success: {
117
+ data: undefined,
118
+ headers: createMockHeaders(),
119
+ status: 200,
120
+ },
121
+ },
122
+ sendResetPasswordEmail: {
123
+ success: {
124
+ data: undefined,
125
+ headers: createMockHeaders(),
126
+ status: 200,
127
+ },
128
+ },
129
+ login: {
130
+ success: {
131
+ data: exports.mockAuthResponses.loginSuccess,
132
+ headers: createMockHeaders(),
133
+ status: 200,
134
+ },
135
+ withUserFalse: {
136
+ data: exports.mockAuthResponses.loginSuccess,
137
+ headers: createMockHeaders(),
138
+ status: 200,
139
+ },
140
+ },
141
+ logout: {
142
+ success: {
143
+ data: undefined,
144
+ headers: createMockHeaders(),
145
+ status: 200,
146
+ },
147
+ },
148
+ getSettings: {
149
+ success: {
150
+ data: {
151
+ manualAccountCheck: true,
152
+ },
153
+ headers: createMockHeaders(),
154
+ status: 200,
155
+ },
156
+ },
157
+ getStore: {
158
+ success: {
159
+ data: {
160
+ active: true,
161
+ customFieldValues: [
162
+ {
163
+ customField: {
164
+ externalId: "field_1",
165
+ externalSource: "manual",
166
+ faceted: false,
167
+ id: "cf_1",
168
+ indexable: true,
169
+ mandatory: false,
170
+ name: { fr: "Champ personnalisé", en: "Custom field" },
171
+ role: "store",
172
+ sealedTarget: "store",
173
+ searchable: true,
174
+ sortable: true,
175
+ status: "active",
176
+ },
177
+ value: { fr: "Valeur test", en: "Test value" },
178
+ },
179
+ ],
180
+ description: "Description du magasin",
181
+ externalId: "store_ext_123",
182
+ id: "store_123",
183
+ name: "Mon Magasin",
184
+ storeLocales: [
185
+ {
186
+ active: true,
187
+ code: "fr",
188
+ id: "locale_fr",
189
+ label: "Français",
190
+ main: true,
191
+ },
192
+ {
193
+ active: true,
194
+ code: "en",
195
+ id: "locale_en",
196
+ label: "English",
197
+ main: false,
198
+ },
199
+ ],
200
+ },
201
+ headers: createMockHeaders(),
202
+ status: 200,
203
+ },
204
+ },
205
+ };
206
+ // Mock data pour les erreurs
207
+ exports.mockErrors = {
208
+ networkError: new Error("Network error"),
209
+ unauthorized: new Error("Unauthorized"),
210
+ badRequest: new Error("Bad request"),
211
+ notFound: new Error("Not found"),
212
+ serverError: new Error("Internal server error"),
213
+ };
214
+ // Mock data pour les cas d'erreur HTTP
215
+ exports.mockHttpErrors = {
216
+ 400: { status: 400, message: "Bad Request" },
217
+ 401: { status: 401, message: "Unauthorized" },
218
+ 404: { status: 404, message: "Not Found" },
219
+ 500: { status: 500, message: "Internal Server Error" },
220
+ };
@@ -20,6 +20,9 @@ export interface LoginParameters {
20
20
  username: string;
21
21
  password: string;
22
22
  }
23
+ export interface SettingsResponse {
24
+ manualAccountCheck: boolean;
25
+ }
23
26
  /**
24
27
  * Response type definitions
25
28
  */
@@ -27,3 +30,39 @@ export interface RefreshTokenResponse extends AuthenticationResponseDto {
27
30
  }
28
31
  export interface LoginResponse extends AuthenticationResponseDto {
29
32
  }
33
+ export interface StoreLocale {
34
+ active: boolean;
35
+ code: string;
36
+ id: string;
37
+ label: string;
38
+ main: boolean;
39
+ }
40
+ export interface CustomField {
41
+ externalId: string;
42
+ externalSource: string;
43
+ faceted: boolean;
44
+ id: string;
45
+ indexable: boolean;
46
+ mandatory: boolean;
47
+ name: {
48
+ [key: string]: string;
49
+ };
50
+ role: string;
51
+ sealedTarget: string;
52
+ searchable: boolean;
53
+ sortable: boolean;
54
+ status: string;
55
+ }
56
+ export interface CustomFieldValue {
57
+ customField: CustomField;
58
+ value: Record<string, unknown>;
59
+ }
60
+ export interface Store {
61
+ active: boolean;
62
+ customFieldValues: CustomFieldValue[];
63
+ description: string;
64
+ externalId: string;
65
+ id: string;
66
+ name: string;
67
+ storeLocales: StoreLocale[];
68
+ }
@@ -17,4 +17,8 @@ export interface SendResetPasswordEmailParameters {
17
17
  export interface LoginParameters {
18
18
  username: string;
19
19
  password: string;
20
+ withUser?: boolean;
21
+ }
22
+ export interface GetStoreParameters {
23
+ storeId: string;
20
24
  }
@@ -12,8 +12,8 @@
12
12
  *
13
13
  * Each function is described with its input parameters, output responses, and example usages.
14
14
  */
15
- import { LoginResponse, RefreshTokenResponse } from "./definitions";
16
- import { IsTokenValidParameters, LoginParameters, RefreshTokenParameters, ResetPasswordParameters, SendResetPasswordEmailParameters } from "./definitions.requests";
15
+ import { LoginResponse, RefreshTokenResponse, SettingsResponse, Store } from "./definitions";
16
+ import { IsTokenValidParameters, LoginParameters, RefreshTokenParameters, ResetPasswordParameters, SendResetPasswordEmailParameters, GetStoreParameters } from "./definitions.requests";
17
17
  /**
18
18
  * 🔐 Validates if a token is still active and unexpired.
19
19
  *
@@ -132,6 +132,7 @@ export declare function sendResetPasswordEmail({ email, }: SendResetPasswordEmai
132
132
  * |-------------|----------|----------|--------------------------------------|
133
133
  * | `username` | `string` | ✅ | The username of the user to log in. |
134
134
  * | `password` | `string` | ✅ | The password of the user to log in. |
135
+ * | `withUser` | `boolean`| ❌ | Whether to include user details in the response. Default: `true` |
135
136
  *
136
137
  * 📤 **Returns**:
137
138
  * A `Promise<LoginResponse>` that resolves to the user's login information, including:
@@ -150,7 +151,7 @@ export declare function sendResetPasswordEmail({ email, }: SendResetPasswordEmai
150
151
  * @throws {Error} If the required parameters `username` or `password` are missing.
151
152
  * @returns {Promise<LoginResponse>} Resolves to an object containing the user's login information.
152
153
  */
153
- export declare function login({ username, password, }: LoginParameters): Promise<LoginResponse>;
154
+ export declare function login({ username, password, withUser, }: LoginParameters): Promise<LoginResponse>;
154
155
  /**
155
156
  * 🚪 Logs out the user.
156
157
  *
@@ -174,3 +175,57 @@ export declare function login({ username, password, }: LoginParameters): Promise
174
175
  * @returns {Promise<void>} Resolves when the logout is successful.
175
176
  */
176
177
  export declare function logout(): Promise<void>;
178
+ /**
179
+ * ⚙️ Récupère les paramètres globaux du shop.
180
+ *
181
+ * Cette fonction permet d'obtenir les paramètres de configuration du shop.
182
+ *
183
+ * 🛠 **Endpoint**: `GET /v1/shop/settings` [SETTINGS-500]
184
+ *
185
+ * 📤 **Returns**:
186
+ * A `Promise<SettingsResponse>` contenant les paramètres du shop, notamment:
187
+ * - `manualAccountCheck` (boolean): Indique si la vérification manuelle des comptes est activée.
188
+ *
189
+ * 🛠 **Example usage**:
190
+ * ```ts
191
+ * const settings = await getSettings();
192
+ * console.log(settings.manualAccountCheck); // true
193
+ * ```
194
+ *
195
+ * @returns {Promise<SettingsResponse>} Une promesse qui résout avec les paramètres du shop.
196
+ */
197
+ export declare function getSettings(): Promise<SettingsResponse>;
198
+ /**
199
+ * 🏪 Récupère les informations d'un magasin spécifique.
200
+ *
201
+ * Cette fonction permet d'obtenir les détails d'un magasin à partir de son identifiant.
202
+ *
203
+ * 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}` [STORE-500]
204
+ *
205
+ * | Parameter | Type | Required | Description |
206
+ * |------------|----------|----------|--------------------------------------|
207
+ * | `storeId` | `string` | ✅ | L'identifiant unique du magasin. |
208
+ *
209
+ * 📤 **Returns**:
210
+ * A `Promise<Store>` contenant les informations détaillées du magasin, notamment:
211
+ * - `active`: État d'activation du magasin
212
+ * - `customFieldValues`: Valeurs des champs personnalisés
213
+ * - `description`: Description du magasin
214
+ * - `externalId`: Identifiant externe
215
+ * - `id`: Identifiant interne
216
+ * - `name`: Nom du magasin
217
+ * - `storeLocales`: Informations de localisation
218
+ *
219
+ * 🛠 **Example usage**:
220
+ * ```ts
221
+ * const store = await getStore({
222
+ * storeId: "123e4567-e89b-12d3-a456-426614174000"
223
+ * });
224
+ * console.log(store.name); // "Mon Magasin"
225
+ * ```
226
+ *
227
+ * @param {GetStoreParameters} params - Les paramètres pour récupérer le magasin.
228
+ * @throws {Error} Si le paramètre `storeId` est manquant.
229
+ * @returns {Promise<Store>} Une promesse qui résout avec les informations du magasin.
230
+ */
231
+ export declare function getStore({ storeId, }: GetStoreParameters): Promise<Store>;
@@ -20,6 +20,8 @@ exports.resetPassword = resetPassword;
20
20
  exports.sendResetPasswordEmail = sendResetPasswordEmail;
21
21
  exports.login = login;
22
22
  exports.logout = logout;
23
+ exports.getSettings = getSettings;
24
+ exports.getStore = getStore;
23
25
  const parameters_validation_1 = require("../../helpers/parameters-validation");
24
26
  const fetch_instance_1 = require("../../settings/fetch-instance");
25
27
  /**
@@ -179,6 +181,7 @@ async function sendResetPasswordEmail({ email, }) {
179
181
  * |-------------|----------|----------|--------------------------------------|
180
182
  * | `username` | `string` | ✅ | The username of the user to log in. |
181
183
  * | `password` | `string` | ✅ | The password of the user to log in. |
184
+ * | `withUser` | `boolean`| ❌ | Whether to include user details in the response. Default: `true` |
182
185
  *
183
186
  * 📤 **Returns**:
184
187
  * A `Promise<LoginResponse>` that resolves to the user's login information, including:
@@ -197,11 +200,11 @@ async function sendResetPasswordEmail({ email, }) {
197
200
  * @throws {Error} If the required parameters `username` or `password` are missing.
198
201
  * @returns {Promise<LoginResponse>} Resolves to an object containing the user's login information.
199
202
  */
200
- async function login({ username, password, }) {
203
+ async function login({ username, password, withUser = true, }) {
201
204
  (0, parameters_validation_1.required)({ username, password });
202
205
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
203
206
  method: "POST",
204
- path: `/auth/token?withUser=true`,
207
+ path: `/auth/token?withUser=${withUser}`,
205
208
  body: JSON.stringify({
206
209
  username,
207
210
  password,
@@ -237,3 +240,70 @@ async function logout() {
237
240
  path: `/auth/revoke-token`,
238
241
  });
239
242
  }
243
+ /**
244
+ * ⚙️ Récupère les paramètres globaux du shop.
245
+ *
246
+ * Cette fonction permet d'obtenir les paramètres de configuration du shop.
247
+ *
248
+ * 🛠 **Endpoint**: `GET /v1/shop/settings` [SETTINGS-500]
249
+ *
250
+ * 📤 **Returns**:
251
+ * A `Promise<SettingsResponse>` contenant les paramètres du shop, notamment:
252
+ * - `manualAccountCheck` (boolean): Indique si la vérification manuelle des comptes est activée.
253
+ *
254
+ * 🛠 **Example usage**:
255
+ * ```ts
256
+ * const settings = await getSettings();
257
+ * console.log(settings.manualAccountCheck); // true
258
+ * ```
259
+ *
260
+ * @returns {Promise<SettingsResponse>} Une promesse qui résout avec les paramètres du shop.
261
+ */
262
+ async function getSettings() {
263
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
264
+ method: "GET",
265
+ path: `/v1/shop/settings`,
266
+ });
267
+ return data;
268
+ }
269
+ /**
270
+ * 🏪 Récupère les informations d'un magasin spécifique.
271
+ *
272
+ * Cette fonction permet d'obtenir les détails d'un magasin à partir de son identifiant.
273
+ *
274
+ * 🛠 **Endpoint**: `GET /v1/shop/stores/{storeId}` [STORE-500]
275
+ *
276
+ * | Parameter | Type | Required | Description |
277
+ * |------------|----------|----------|--------------------------------------|
278
+ * | `storeId` | `string` | ✅ | L'identifiant unique du magasin. |
279
+ *
280
+ * 📤 **Returns**:
281
+ * A `Promise<Store>` contenant les informations détaillées du magasin, notamment:
282
+ * - `active`: État d'activation du magasin
283
+ * - `customFieldValues`: Valeurs des champs personnalisés
284
+ * - `description`: Description du magasin
285
+ * - `externalId`: Identifiant externe
286
+ * - `id`: Identifiant interne
287
+ * - `name`: Nom du magasin
288
+ * - `storeLocales`: Informations de localisation
289
+ *
290
+ * 🛠 **Example usage**:
291
+ * ```ts
292
+ * const store = await getStore({
293
+ * storeId: "123e4567-e89b-12d3-a456-426614174000"
294
+ * });
295
+ * console.log(store.name); // "Mon Magasin"
296
+ * ```
297
+ *
298
+ * @param {GetStoreParameters} params - Les paramètres pour récupérer le magasin.
299
+ * @throws {Error} Si le paramètre `storeId` est manquant.
300
+ * @returns {Promise<Store>} Une promesse qui résout avec les informations du magasin.
301
+ */
302
+ async function getStore({ storeId, }) {
303
+ (0, parameters_validation_1.required)({ storeId });
304
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
305
+ method: "GET",
306
+ path: `/v1/shop/stores/${storeId}`,
307
+ });
308
+ return data;
309
+ }
@@ -80,6 +80,7 @@ async function getCarts(params) {
80
80
  currency,
81
81
  page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
82
82
  size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
83
+ sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
83
84
  status: Array.isArray(status) ? status.join(",") : status,
84
85
  type: Array.isArray(type) ? type.join(",") : type,
85
86
  },
@@ -97,4 +97,10 @@ export interface PostMediaCustomFieldParameters {
97
97
  fileName: string;
98
98
  fileSize: number;
99
99
  }
100
+ export interface GetMediaUrlParameters {
101
+ id: string;
102
+ customFieldIdType?: CustomFieldIdType;
103
+ sealedTarget?: SealedTarget;
104
+ fileUrl: string;
105
+ }
100
106
  export {};
@@ -1,10 +1,10 @@
1
- import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomFieldParameters } from "./definitions";
1
+ import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomFieldParameters, GetMediaUrlParameters } from "./definitions";
2
2
  /**
3
3
  * 📋 Retrieves custom fields.
4
4
  *
5
5
  * This function fetches custom fields based on the provided parameters.
6
6
  *
7
- * 🛠 **Endpoint**: `GET /v2/shop/custom-fields`
7
+ * 🛠 **Endpoint**: `GET /v1/shop/custom-fields`
8
8
  *
9
9
  * | **Parameter** | **Type** | **Required** | **Description** |
10
10
  * |----------------------|------------|--------------|---------------------------------------------------------------------------|
@@ -12,6 +12,7 @@ import type { GetCustomFieldParameters, GetCustomFieldResponse, PostMediaCustomF
12
12
  * | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
13
13
  * | `limit` | `number` | | The maximum number of custom fields to return. |
14
14
  * | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
15
+ * | `sealedTarget` | `string` | | Indicates whether the media should be sealed. |
15
16
  *
16
17
  * 📤 **Returns**:
17
18
  * A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
@@ -74,3 +75,40 @@ export declare function getCustomFields(params: GetCustomFieldParameters): Promi
74
75
  * @returns {Promise<string>} - The URL for uploading the media file.
75
76
  */
76
77
  export declare function postMediaCustomField(params: PostMediaCustomFieldParameters): Promise<string>;
78
+ /**
79
+ * 🎥 Gets the media URL for a custom field.
80
+ *
81
+ * @deprecated This endpoint is deprecated in the API and should not be used for new implementations.
82
+ *
83
+ * This function retrieves the media URL associated with a specific custom field.
84
+ *
85
+ * 🛠 **Endpoint**: `GET /v1/shop/custom-fields/{id}/media`
86
+ *
87
+ * | **Parameter** | **Type** | **Required** | **Description** |
88
+ * |-----------------------|------------|--------------|----------------------------------------------------------------------|
89
+ * | `id` | `string` | ✅ | The ID of the custom field associated with the media. |
90
+ * | `customFieldIdType` | `string` | | The type of the custom field identifier (BUSINESS_ID, EXTERNAL_ID). |
91
+ * | `sealedTarget` | `string` | | The sealed target type. |
92
+ * | `fileUrl` | `string` | ✅ | The URL of the file to retrieve. |
93
+ *
94
+ * 📤 **Returns**:
95
+ * A `Promise<string>` containing the media URL.
96
+ *
97
+ * 🛠 **Example Usage**:
98
+ * ```typescript
99
+ * const mediaUrl = await getMediaUrl({
100
+ * id: 'field1',
101
+ * customFieldIdType: 'EXTERNAL_ID',
102
+ * fileUrl: 'https://example.com/image.jpg',
103
+ * });
104
+ * ```
105
+ *
106
+ * @param {GetMediaUrlParameters} params - The parameters for retrieving a media URL:
107
+ * - `id` - The ID of the custom field.
108
+ * - `customFieldIdType` (optional) - The type of the custom field identifier.
109
+ * - `sealedTarget` (optional) - The sealed target type.
110
+ * - `fileUrl` - The URL of the file to retrieve.
111
+ *
112
+ * @returns {Promise<string>} - The media URL.
113
+ */
114
+ export declare function getMediaUrl(params: GetMediaUrlParameters): Promise<string>;
@@ -2,13 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getCustomFields = getCustomFields;
4
4
  exports.postMediaCustomField = postMediaCustomField;
5
+ exports.getMediaUrl = getMediaUrl;
5
6
  const fetch_instance_1 = require("../../settings/fetch-instance");
6
7
  /**
7
8
  * 📋 Retrieves custom fields.
8
9
  *
9
10
  * This function fetches custom fields based on the provided parameters.
10
11
  *
11
- * 🛠 **Endpoint**: `GET /v2/shop/custom-fields`
12
+ * 🛠 **Endpoint**: `GET /v1/shop/custom-fields`
12
13
  *
13
14
  * | **Parameter** | **Type** | **Required** | **Description** |
14
15
  * |----------------------|------------|--------------|---------------------------------------------------------------------------|
@@ -16,6 +17,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
16
17
  * | `includeInactive` | `boolean` | | Whether to include inactive custom fields in the response. |
17
18
  * | `limit` | `number` | | The maximum number of custom fields to return. |
18
19
  * | `offset` | `number` | | The number of custom fields to skip before starting to collect results. |
20
+ * | `sealedTarget` | `string` | | Indicates whether the media should be sealed. |
19
21
  *
20
22
  * 📤 **Returns**:
21
23
  * A `Promise<GetCustomFieldResponse>` containing the retrieved custom fields.
@@ -41,7 +43,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
41
43
  async function getCustomFields(params) {
42
44
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
43
45
  method: "GET",
44
- path: `/v2/shop/custom-fields`,
46
+ path: `/v1/shop/custom-fields`,
45
47
  params,
46
48
  });
47
49
  return data;
@@ -88,8 +90,53 @@ async function postMediaCustomField(params) {
88
90
  const { id, customFieldIdType, sealedTarget, fileName, fileSize } = params;
89
91
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
90
92
  method: "POST",
91
- path: `/v2/shop/custom-fields/${id}/media`,
93
+ path: `/v1/shop/custom-fields/${id}/media`,
92
94
  params: { customFieldIdType, sealedTarget, fileName, fileSize },
93
95
  });
94
96
  return data;
95
97
  }
98
+ /**
99
+ * 🎥 Gets the media URL for a custom field.
100
+ *
101
+ * @deprecated This endpoint is deprecated in the API and should not be used for new implementations.
102
+ *
103
+ * This function retrieves the media URL associated with a specific custom field.
104
+ *
105
+ * 🛠 **Endpoint**: `GET /v1/shop/custom-fields/{id}/media`
106
+ *
107
+ * | **Parameter** | **Type** | **Required** | **Description** |
108
+ * |-----------------------|------------|--------------|----------------------------------------------------------------------|
109
+ * | `id` | `string` | ✅ | The ID of the custom field associated with the media. |
110
+ * | `customFieldIdType` | `string` | | The type of the custom field identifier (BUSINESS_ID, EXTERNAL_ID). |
111
+ * | `sealedTarget` | `string` | | The sealed target type. |
112
+ * | `fileUrl` | `string` | ✅ | The URL of the file to retrieve. |
113
+ *
114
+ * 📤 **Returns**:
115
+ * A `Promise<string>` containing the media URL.
116
+ *
117
+ * 🛠 **Example Usage**:
118
+ * ```typescript
119
+ * const mediaUrl = await getMediaUrl({
120
+ * id: 'field1',
121
+ * customFieldIdType: 'EXTERNAL_ID',
122
+ * fileUrl: 'https://example.com/image.jpg',
123
+ * });
124
+ * ```
125
+ *
126
+ * @param {GetMediaUrlParameters} params - The parameters for retrieving a media URL:
127
+ * - `id` - The ID of the custom field.
128
+ * - `customFieldIdType` (optional) - The type of the custom field identifier.
129
+ * - `sealedTarget` (optional) - The sealed target type.
130
+ * - `fileUrl` - The URL of the file to retrieve.
131
+ *
132
+ * @returns {Promise<string>} - The media URL.
133
+ */
134
+ async function getMediaUrl(params) {
135
+ const { id, ...queryParams } = params;
136
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
137
+ method: "GET",
138
+ path: `/v1/shop/custom-fields/${id}/media`,
139
+ params: queryParams,
140
+ });
141
+ return data;
142
+ }
@@ -1,8 +1,8 @@
1
- import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
1
+ import { CustomFieldValueRequest, PageCustomFieldSearch } from "../../interfaces/models/custom-field";
2
2
  import { PageOrderLogisticDto } from "../../interfaces/models/order";
3
3
  import { AddressDto, CreateAddressRequest, UpdateAddressRequest } from "../../interfaces/models/address";
4
4
  import { Order, PageableObject, PageableParameters } from "../../interfaces/models/common";
5
- import { CreateObjectCustomerAccountRequest, CustomerAccountDto, LegalUserDto } from "../../interfaces/models/customer-account";
5
+ import { AccountCustomFieldsIdType, CreateObjectCustomerAccountRequest, CustomerAccountDto, LegalUserDto } from "../../interfaces/models/customer-account";
6
6
  import { CustomerOrganisationDto, CustomerOrganisationStatus } from "../../interfaces/models/customer-organisation";
7
7
  import { CivilityType, CreateCustomerUserRequest, PageCustomerUser, PageCustomerUserDto } from "../../interfaces/models/customer-user";
8
8
  export interface CreateCustomerAccountParameters {
@@ -50,6 +50,12 @@ export interface UpdateCustomerAccountAddressParameters extends UpdateAddressReq
50
50
  export interface GetCustomerAccountOrdersParameters {
51
51
  pageable: PageableParameters;
52
52
  locale: string;
53
+ nbPreviewLines?: number;
54
+ logisticOrderStatuses?: string[];
55
+ /**
56
+ * @deprecated
57
+ */
58
+ orderLogisticStatusType: string;
53
59
  }
54
60
  export interface GetCustomerAccountUsersParameters {
55
61
  pageable: PageableParameters;
@@ -78,6 +84,11 @@ export interface UpdateCustomerAccountOrganisationAddressParameters extends Upda
78
84
  organisationId: string;
79
85
  addressId: string;
80
86
  }
87
+ export interface GetCustomerAccountCustomFieldsParameters {
88
+ customFieldIds: string[];
89
+ idType: AccountCustomFieldsIdType;
90
+ pageable: PageableParameters;
91
+ }
81
92
  export interface GetCustomerAccountOrganisationOrdersParameters {
82
93
  organisationId: string;
83
94
  pageable: PageableParameters;
@@ -125,6 +136,8 @@ export interface CreateCustomerAccountAddressResponse extends AddressDto {
125
136
  }
126
137
  export interface UpdateCustomerAccountAddressResponse extends AddressDto {
127
138
  }
139
+ export interface GetCustomerAccountCustomFieldsResponse extends PageCustomFieldSearch {
140
+ }
128
141
  export interface GetCustomerAccountOrdersResponse extends PageOrderLogisticDto {
129
142
  }
130
143
  export interface GetCustomerAccountUsersResponse extends PageCustomerUser {