@djust-b2b/djust-front-sdk 1.15.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.
@@ -1,9 +1,4 @@
1
1
  "use strict";
2
- /**
3
- * @packageDocumentation
4
- *
5
- * @document documents/customer-user.md
6
- */
7
2
  Object.defineProperty(exports, "__esModule", { value: true });
8
3
  exports.getAuthenticatedUser = getAuthenticatedUser;
9
4
  exports.createCustomerUser = createCustomerUser;
@@ -15,19 +10,27 @@ exports.sendCustomerUserActivationRequest = sendCustomerUserActivationRequest;
15
10
  const parameters_validation_1 = require("../../helpers/parameters-validation");
16
11
  const fetch_instance_1 = require("../../settings/fetch-instance");
17
12
  /**
18
- * APICODE(USER-500)
13
+ * 🚚 **Retrieve Authenticated User**
14
+ *
15
+ * **APICODE(USER-500)**
19
16
  * Retrieves the authenticated user.
20
17
  *
21
18
  * This function sends a request to obtain the details of the currently authenticated user.
22
19
  *
23
- * @returns {Promise<any>} - The data of the authenticated user.
20
+ * 🛠 **Endpoint**: `GET /v1/authenticated-user`
21
+ *
22
+ * | Parameter | Type | Required | Description |
23
+ * |-----------|--------|----------|---------------------------|
24
+ * | N/A | N/A | N/A | This function does not require any parameters. |
24
25
  *
25
- * @example
26
- * #### input
27
- * ```typescript
26
+ * 📤 **Returns**:
27
+ * A `Promise` resolving to an object containing the authenticated user's data.
28
+ *
29
+ * 🛠 **Example usage**:
30
+ * ```ts
28
31
  * const user = await getAuthenticatedUser();
29
32
  * ```
30
- * #### output
33
+ * #### Output
31
34
  * ```json
32
35
  * {
33
36
  * "id": "user1",
@@ -43,57 +46,36 @@ async function getAuthenticatedUser() {
43
46
  return data;
44
47
  }
45
48
  /**
46
- * APICODE(USER-100)
49
+ * 🚚 **Create Customer User**
50
+ *
51
+ * **APICODE(USER-100)**
47
52
  * Creates a customer user.
48
53
  *
49
54
  * This function sends a request to create a new customer user with the specified parameters.
50
55
  *
51
- * @param {CreateCustomerUserParameters} params - The parameters for creating the user, including:
52
- * #### email - `string` | <strong style={{ color: 'red' }}>required</strong>
53
- *
54
- * The email address of the user.
55
- * #### password - `string` | <strong style={{ color: 'red' }}>required</strong>
56
- *
57
- * The password of the user.
58
- * #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
59
- *
60
- * The first name of the user.
61
- * #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
62
- *
63
- * The last name of the user.
64
- * #### groups - `string[]` | <strong style={{ color: 'red' }}>required</strong>
65
- *
66
- * The groups to which the user belongs.
67
- * #### activationUrl - `string`
68
- *
69
- * The URL for user activation.
70
- * #### civility - `string`
71
- *
72
- * The civility of the user (e.g., Mr., Ms.).
73
- * #### customFieldValues - `object`
74
- *
75
- * Custom fields for additional user information.
76
- * #### externalId - `string`
77
- *
78
- * An external identifier for the user.
79
- * #### status - `string`
80
- *
81
- * The status of the user (e.g., active, inactive).
82
- * #### mainOrganisationId - `string`
83
- *
84
- * The ID of the main organization associated with the user.
85
- * #### organisations - `string[]`
86
- *
87
- * The list of organizations associated with the user.
88
- * #### phone - `string`
89
- *
90
- * The phone number of the user.
91
- *
92
- * @returns {Promise<CreateCustomerUserResponse>} - The data of the created user.
93
- *
94
- * @example
95
- * #### input
96
- * ```typescript
56
+ * 🛠 **Endpoint**: `POST /v1/shop/customer-users`
57
+ *
58
+ * | Parameter | Type | Required | Description |
59
+ * |--------------------|--------|----------|--------------------------------------------------|
60
+ * | `email` | string | ✅ | The email address of the user. |
61
+ * | `password` | string | ✅ | The password of the user. |
62
+ * | `firstName` | string | ✅ | The first name of the user. |
63
+ * | `lastName` | string | ✅ | The last name of the user. |
64
+ * | `groups` | string[] | ✅ | The groups to which the user belongs. |
65
+ * | `activationUrl` | string | ❌ | The URL for user activation. |
66
+ * | `civility` | string | ❌ | The civility of the user (e.g., Mr., Ms.). |
67
+ * | `customFieldValues`| object | ❌ | Custom fields for additional user information. |
68
+ * | `externalId` | string | ❌ | An external identifier for the user. |
69
+ * | `status` | string | ❌ | The status of the user (e.g., active, inactive). |
70
+ * | `mainOrganisationId`| string | ❌ | The ID of the main organization associated with the user. |
71
+ * | `organisations` | string[] | ❌ | The list of organizations associated with the user. |
72
+ * | `phone` | string | ❌ | The phone number of the user. |
73
+ *
74
+ * 📤 **Returns**:
75
+ * A `Promise` resolving to an object containing the created user's data.
76
+ *
77
+ * 🛠 **Example usage**:
78
+ * ```ts
97
79
  * const newUser = await createCustomerUser({
98
80
  * email: 'user@example.com',
99
81
  * password: 'securePassword',
@@ -110,7 +92,7 @@ async function getAuthenticatedUser() {
110
92
  * phone: '123-456-7890'
111
93
  * });
112
94
  * ```
113
- * #### output
95
+ * #### Output
114
96
  * ```json
115
97
  * {
116
98
  * "id": "user1",
@@ -143,33 +125,28 @@ async function createCustomerUser(params) {
143
125
  return data;
144
126
  }
145
127
  /**
146
- * APICODE(USER-201)
128
+ * 🚚 **Update Customer User**
129
+ *
130
+ * **APICODE(USER-201)**
147
131
  * Updates a customer user.
148
132
  *
149
133
  * This function sends a request to update the details of an existing customer user.
150
134
  *
151
- * @param {UpdateCustomerUserParameters} params - The parameters for updating the user, including:
152
- * #### firstName - `string` | <strong style={{ color: 'red' }}>required</strong>
153
- *
154
- * The first name of the user.
155
- * #### lastName - `string` | <strong style={{ color: 'red' }}>required</strong>
156
- *
157
- * The last name of the user.
158
- * #### civility - `string`
159
- *
160
- * The civility of the user (e.g., Mr., Ms.).
161
- * #### phone - `string`
162
- *
163
- * The phone number of the user.
164
- * #### customFieldValues - `object`
135
+ * 🛠 **Endpoint**: `PUT /v1/shop/customer-users`
165
136
  *
166
- * Custom fields for additional user information.
137
+ * | Parameter | Type | Required | Description |
138
+ * |--------------------|--------|----------|--------------------------------------------------|
139
+ * | `firstName` | string | ✅ | The first name of the user. |
140
+ * | `lastName` | string | ✅ | The last name of the user. |
141
+ * | `civility` | string | ❌ | The civility of the user (e.g., Mr., Ms.). |
142
+ * | `phone` | string | ❌ | The phone number of the user. |
143
+ * | `customFieldValues`| object | ❌ | Custom fields for additional user information. |
167
144
  *
168
- * @returns {Promise<UpdateCustomerUserResponse>} - The data of the updated user.
145
+ * 📤 **Returns**:
146
+ * A `Promise` resolving to an object containing the updated user's data.
169
147
  *
170
- * @example
171
- * #### input
172
- * ```typescript
148
+ * 🛠 **Example usage**:
149
+ * ```ts
173
150
  * const updatedUser = await updateCustomerUser({
174
151
  * firstName: 'John',
175
152
  * lastName: 'Doe',
@@ -178,7 +155,7 @@ async function createCustomerUser(params) {
178
155
  * customFieldValues: {}
179
156
  * });
180
157
  * ```
181
- * #### output
158
+ * #### Output
182
159
  * ```json
183
160
  * {
184
161
  * "detail": "User updated successfully"
@@ -201,24 +178,27 @@ async function updateCustomerUser({ civility, firstName, lastName, phone, custom
201
178
  return data;
202
179
  }
203
180
  /**
204
- * APICODE(USER-200)
181
+ * 🚚 **Activate Customer User**
182
+ *
183
+ * **APICODE(USER-200)**
205
184
  * Activates a customer user.
206
185
  *
207
186
  * This function sends a request to activate a customer user with a specified token.
208
187
  *
209
- * @param {ActivateCustomerUserParameters} params - The parameters for activating the user, including:
210
- * #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
188
+ * 🛠 **Endpoint**: `POST /v1/shop/customer-users/activate`
211
189
  *
212
- * The activation token of the user.
190
+ * | Parameter | Type | Required | Description |
191
+ * |-----------|--------|----------|--------------------------------------------------|
192
+ * | `token` | string | ✅ | The activation token of the user. |
213
193
  *
214
- * @returns {Promise<void>} - A promise that resolves when the user is activated.
194
+ * 📤 **Returns**:
195
+ * A `Promise` resolving when the user is activated.
215
196
  *
216
- * @example
217
- * #### input
218
- * ```typescript
197
+ * 🛠 **Example usage**:
198
+ * ```ts
219
199
  * await activateCustomerUser({ token: 'activationToken' });
220
200
  * ```
221
- * #### output
201
+ * #### Output
222
202
  * ```json
223
203
  * {
224
204
  * "detail": "User activated successfully"
@@ -237,30 +217,27 @@ async function activateCustomerUser(params) {
237
217
  });
238
218
  }
239
219
  /**
240
- * APICODE(USER-501)
220
+ * 🚚 **Retrieve Customer User Addresses**
221
+ *
222
+ * **APICODE(USER-501)**
241
223
  * Retrieves customer user addresses.
242
224
  *
243
225
  * This function sends a request to obtain the addresses associated with a customer user.
244
226
  *
245
- * @param {GetCustomerUserAddressesParameters} params - The parameters for retrieving the addresses, including:
246
- * #### shipping - `boolean`
247
- *
248
- * Indicates whether to retrieve shipping addresses.
249
- * #### billing - `boolean`
250
- *
251
- * Indicates whether to retrieve billing addresses.
252
- * #### account - `string`
253
- *
254
- * The ID of the account for which to retrieve addresses.
255
- * #### organisationIds - `string[]`
227
+ * 🛠 **Endpoint**: `GET /v1/shop/customer-users/addresses`
256
228
  *
257
- * An array of organization IDs to filter the addresses.
229
+ * | Parameter | Type | Required | Description |
230
+ * |------------------|---------|----------|-----------------------------------------------|
231
+ * | `shipping` | boolean | ✅ | Indicates whether to retrieve shipping addresses. |
232
+ * | `billing` | boolean | ✅ | Indicates whether to retrieve billing addresses. |
233
+ * | `account` | string | ✅ | The ID of the account for which to retrieve addresses. |
234
+ * | `organisationIds`| string[]| ❌ | An array of organization IDs to filter the addresses. |
258
235
  *
259
- * @returns {Promise<void>} - The addresses of the customer user.
236
+ * 📤 **Returns**:
237
+ * A `Promise` resolving to the list of addresses associated with the customer user.
260
238
  *
261
- * @example
262
- * #### input
263
- * ```typescript
239
+ * 🛠 **Example usage**:
240
+ * ```ts
264
241
  * const addresses = await getCustomerUserAddresses({
265
242
  * shipping: true,
266
243
  * billing: false,
@@ -268,7 +245,7 @@ async function activateCustomerUser(params) {
268
245
  * organisationIds: ['org1', 'org2']
269
246
  * });
270
247
  * ```
271
- * #### output
248
+ * #### Output
272
249
  * ```json
273
250
  * {
274
251
  * "addresses": [
@@ -294,19 +271,23 @@ async function getCustomerUserAddresses({ shipping, billing, account, organisati
294
271
  return data;
295
272
  }
296
273
  /**
297
- * APICODE(USER-502)
274
+ * 🚚 **Retrieve Customer User Organisations**
275
+ *
276
+ * **APICODE(USER-502)**
298
277
  * Retrieves customer user organisations.
299
278
  *
300
279
  * This function sends a request to obtain the organisations associated with a customer user.
301
280
  *
302
- * @returns {Promise<GetCustomerUserOrganisationsResponse>} - The organisations of the customer user.
281
+ * 🛠 **Endpoint**: `GET /v1/shop/customer-users/organisations`
282
+ *
283
+ * 📤 **Returns**:
284
+ * A `Promise` resolving to the list of organisations associated with the customer user.
303
285
  *
304
- * @example
305
- * #### input
306
- * ```typescript
286
+ * 🛠 **Example usage**:
287
+ * ```ts
307
288
  * const organisations = await getCustomerUserOrganisations();
308
289
  * ```
309
- * #### output
290
+ * #### Output
310
291
  * ```json
311
292
  * {
312
293
  * "organisations": [
@@ -330,30 +311,31 @@ async function getCustomerUserOrganisations() {
330
311
  return data;
331
312
  }
332
313
  /**
333
- * APICODE(USER-203)
314
+ * 🚚 **Send Customer User Activation Request**
315
+ *
316
+ * **APICODE(USER-203)**
334
317
  * Sends a customer user activation request.
335
318
  *
336
319
  * This function sends a request to resend an activation request to a customer user.
337
320
  *
338
- * @param {SendCustomerUserActivationRequestParameters} params - The parameters for sending the request, including:
339
- * #### token - `string` | <strong style={{ color: 'red' }}>required</strong>
340
- *
341
- * The activation token of the user.
342
- * #### redirectUrl - `string`
321
+ * 🛠 **Endpoint**: `POST /v1/shop/customer-users/resend-activation-request`
343
322
  *
344
- * The URL to redirect the user after activation.
323
+ * | Parameter | Type | Required | Description |
324
+ * |-------------|--------|----------|--------------------------------------------------|
325
+ * | `token` | string | ✅ | The activation token of the user. |
326
+ * | `redirectUrl`| string | ❌ | The URL to redirect the user after activation. |
345
327
  *
346
- * @returns {Promise<void>} - A promise that resolves when the request is sent.
328
+ * 📤 **Returns**:
329
+ * A `Promise` resolving when the request is sent.
347
330
  *
348
- * @example
349
- * #### input
350
- * ```typescript
331
+ * 🛠 **Example usage**:
332
+ * ```ts
351
333
  * await sendCustomerUserActivationRequest({
352
334
  * token: 'activationToken',
353
335
  * redirectUrl: 'http://example.com/redirect'
354
336
  * });
355
337
  * ```
356
- * #### output
338
+ * #### Output
357
339
  * ```json
358
340
  * {
359
341
  * "detail": "Activation request sent successfully"
@@ -1,132 +1,81 @@
1
1
  import { GetNavigationCategoriesParameters, GetNavigationCategoriesResponse, GetNavigationCategoryBreadcrumbsParameters, GetNavigationCategoryBreadcrumbsResponse, GetNavigationCategoryParameters, GetNavigationCategoryResponse } from "./definitions";
2
2
  /**
3
- * ## Get all navigation categories
4
- * ### APICODE(NAVCAT-550)
5
- * @returns {Promise<GetNavigationCategoriesResponse>} - The response with the navigation categories
6
- *
7
- * @example
8
- * ### input
9
- * ```typescript
10
- * const response = await getNavigationCategories({ locale: 'string' });
3
+ * 📄 Gets all navigation categories.
4
+ *
5
+ * Retrieves a list of all navigation categories available for the shop.
6
+ *
7
+ * 🛠 **Endpoint**: `GET /v1/shop/navigation-category/online`
8
+ *
9
+ * | Parameter | Type | Required | Description |
10
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
11
+ * | `locale` | `string` | ✅ | Locale of the navigation categories to fetch. |
12
+ *
13
+ * 📤 **Returns**:
14
+ * A `Promise<GetNavigationCategoriesResponse>` containing a list of navigation categories.
15
+ *
16
+ * 🛠 **Example usage**:
17
+ * ```ts
18
+ * const categories = await getNavigationCategories({
19
+ * locale: 'en-US',
20
+ * });
21
+ *
22
+ * console.log(categories);
11
23
  * ```
12
- * ### output
13
- * Response - <strong style={{ color: 'green' }}>200</strong> - OK
14
- * ```json
15
- * [
16
- * {
17
- * "active": true,
18
- * "childrenCategories": [
19
- * string
20
- * ],
21
- * "customFieldValues": [
22
- * {
23
- * "customField": {
24
- * "externalId": "string",
25
- * "id": "string",
26
- * "name": {
27
- * "additionalProp1": "string",
28
- * "additionalProp2": "string",
29
- * "additionalProp3": "string"
30
- * },
31
- * "type": "LONG_TEXT"
32
- * },
33
- * "value": {}
34
- * }
35
- * ],
36
- * "externalId": "string",
37
- * "id": "string",
38
- * "name": "string"
39
- * }
40
- * ]
41
24
  */
42
25
  export declare function getNavigationCategories({ locale, }: GetNavigationCategoriesParameters): Promise<GetNavigationCategoriesResponse>;
43
26
  /**
44
- * ## Get navigation category
45
- * ### APICODE(NAVCAT-501)
46
- * @param {GetNavigationCategoryParameters} params - The parameters for the function
47
- * #### locale - `string` | <strong style={{ color: 'red' }}>required</strong>
48
- * #### idType - `string` | <strong style={{ color: 'red' }}>required</strong>
49
- * #### navigationCategoryId - `string` | <strong style={{ color: 'red' }}>required</strong>
50
- *
51
- * @returns {Promise<GetNavigationCategoryResponse>} - The response with the navigation category
52
- *
53
- * @example
54
- * ### input
55
- * ```typescript
56
- * const response = await getNavigationCategory({ locale: 'string', idType: 'string', navigationCategoryId: 'string' });
27
+ * 📄 Gets a specific navigation category.
28
+ *
29
+ * Retrieves a specific navigation category based on its ID.
30
+ *
31
+ * 🛠 **Endpoint**: `GET /v1/shop/navigation-category/{navigationCategoryId}`
32
+ *
33
+ * | Parameter | Type | Required | Description |
34
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
35
+ * | `locale` | `string` | ✅ | Locale of the navigation category. |
36
+ * | `idType` | `string` | ✅ | Type of the ID used to identify the category (e.g., `id`, `slug`). |
37
+ * | `navigationCategoryId`| `string` | ✅ | ID of the navigation category to fetch. |
38
+ *
39
+ * 📤 **Returns**:
40
+ * A `Promise<GetNavigationCategoryResponse>` containing the specific navigation category.
41
+ *
42
+ * 🛠 **Example usage**:
43
+ * ```ts
44
+ * const category = await getNavigationCategory({
45
+ * locale: 'en-US',
46
+ * idType: 'id',
47
+ * navigationCategoryId: '123',
48
+ * });
49
+ *
50
+ * console.log(category);
57
51
  * ```
58
- * ### output
59
- * Response - <strong style={{ color: 'green' }}>200</strong> - OK
60
- * ```json
61
- * {
62
- * "active": true,
63
- * "childrenCategories": [
64
- * string
65
- * ],
66
- * "customFieldValues": [
67
- * {
68
- * "customField": {
69
- * "externalId": "string",
70
- * "id": "string",
71
- * "name": {
72
- * "additionalProp1": "string",
73
- * "additionalProp2": "string",
74
- * "additionalProp3": "string"
75
- * },
76
- * "type": "LONG_TEXT"
77
- * },
78
- * "value": {}
79
- * }
80
- * ],
81
- * "externalId": "string",
82
- * "id": "string",
83
- * "name": "string",
84
- * }
85
52
  */
86
53
  export declare function getNavigationCategory({ locale, idType, navigationCategoryId, }: GetNavigationCategoryParameters): Promise<GetNavigationCategoryResponse>;
87
54
  /**
88
- * ## Get navigation category breadcrumbs
89
- * ### APICODE(NAVCAT-502)
90
- * @param {GetNavigationCategoryBreadcrumbsParameters} params - The parameters for the function
91
- * #### locale - `string` | <strong style={{ color: 'red' }}>required</strong>
92
- * #### idType - `string` | <strong style={{ color: 'red' }}>required</strong>
93
- * #### navigationCategoryId - `string` | <strong style={{ color: 'red' }}>required</strong>
94
- *
95
- * @returns {Promise<GetNavigationCategoryBreadcrumbsResponse>} - The response with the navigation category breadcrumbs
96
- *
97
- * @example
98
- * ### input
99
- * ```typescript
100
- * const response = await getNavigationCategoryBreadcrumbs({ locale: 'string', idType: 'string', navigationCategoryId: 'string' });
55
+ * 📄 Gets breadcrumbs for a specific navigation category.
56
+ *
57
+ * Retrieves the breadcrumb trail for a specific navigation category, showing its hierarchy.
58
+ *
59
+ * 🛠 **Endpoint**: `GET /v1/shop/navigation-category/{navigationCategoryId}/breadcrumb`
60
+ *
61
+ * | Parameter | Type | Required | Description |
62
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
63
+ * | `locale` | `string` | ✅ | Locale of the navigation category breadcrumbs. |
64
+ * | `idType` | `string` | ✅ | Type of the ID used to identify the category (e.g., `id`, `slug`). |
65
+ * | `navigationCategoryId`| `string` | ✅ | ID of the navigation category to fetch breadcrumbs for. |
66
+ *
67
+ * 📤 **Returns**:
68
+ * A `Promise<GetNavigationCategoryBreadcrumbsResponse>` containing the breadcrumb trail for the navigation category.
69
+ *
70
+ * 🛠 **Example usage**:
71
+ * ```ts
72
+ * const breadcrumbs = await getNavigationCategoryBreadcrumbs({
73
+ * locale: 'en-US',
74
+ * idType: 'id',
75
+ * navigationCategoryId: '123',
76
+ * });
77
+ *
78
+ * console.log(breadcrumbs);
101
79
  * ```
102
- * ### output
103
- * Response - <strong style={{ color: 'green' }}>200</strong> - OK
104
- * ```json
105
- * [
106
- * {
107
- * "active": true,
108
- * "childrenCategories": [
109
- * string
110
- * ],
111
- * "customFieldValues": [
112
- * {
113
- * "customField": {
114
- * "externalId": "string",
115
- * "id": "string",
116
- * "name": {
117
- * "additionalProp1": "string",
118
- * "additionalProp2": "string",
119
- * "additionalProp3": "string"
120
- * },
121
- * "type": "LONG_TEXT"
122
- * },
123
- * "value": {}
124
- * }
125
- * ],
126
- * "externalId": "string",
127
- * "id": "string",
128
- * "name": "string",
129
- * "parent": "string"
130
- * }
131
80
  */
132
81
  export declare function getNavigationCategoryBreadcrumbs({ locale, idType, navigationCategoryId, }: GetNavigationCategoryBreadcrumbsParameters): Promise<GetNavigationCategoryBreadcrumbsResponse>;