@djust-b2b/djust-front-sdk 1.10.2 → 1.11.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
@@ -114,17 +114,17 @@ export declare const DjustSDK: {
114
114
  getCustomerAccountOrganisationOrders({ organisationId, pageable, locale, }: import("./interfaces").GetCustomerAccountOrganisationOrdersParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationOrdersResponse>;
115
115
  getCustomerAccountOrganisationUsers({ organisationId, pageable, }: import("./interfaces").GetCustomerAccountOrganisationUsersParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationUsersResponse>;
116
116
  updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }: import("./interfaces").UpdateCustomerAccountOrganisationUserParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationUserResponse>;
117
- getCart({ cartId, currency, nbFirstLines, }: import("./interfaces").GetCartParameters): Promise<import("./interfaces").GetCartResponse>;
118
- getCarts({ currency, pageable, status, type, }: import("./interfaces").GetCartsParameters): Promise<import("./interfaces").GetCartsResponse>;
119
- deleteCart({ cartId, }: import("./interfaces").DeleteCartParameters): Promise<void>;
120
117
  deleteCarts(): Promise<import("./interfaces").DeleteCartsResponse>;
121
- createCart({ name, }: import("./interfaces").CreateCartParameters): Promise<void>;
122
- updateCart({ cartId, name, }: import("./interfaces").UpdateCartParameters): Promise<void>;
123
- initializeOrdersFromCart({ cartId, }: import("./interfaces").InitializeOrdersFromCartParameters): Promise<string>;
124
- getCartLines({ cartId, currency, pageable, supplierId, productVariantId, offerPriceId, }: import("./interfaces").GetCartLinesParameters): Promise<import("./interfaces").GetCartLinesResponse>;
125
- deleteCartLines({ cartId, lineIdsToDelete, }: import("./interfaces").DeleteCartLinesParameters): Promise<import("./interfaces").DeleteCartLinesResponse>;
126
- updateCartLines({ cartId, linesToUpdate, }: import("./interfaces").UpdateCartLinesParameters): Promise<import("./interfaces").UpdateCartLinesResponse>;
127
- updateCartLinesByVariant({ cartId, linesToUpdate, }: import("./interfaces").UpdateCartLinesByVariantParameters): Promise<import("./interfaces").UpdateCartLinesByVariantResponse>;
118
+ getCarts(params: import("./interfaces").GetCartsParameters): Promise<import("./interfaces").GetCartsResponse>;
119
+ createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").GetCartResponse>;
120
+ deleteCart(params: import("./interfaces").DeleteCartParameters): Promise<void>;
121
+ getCart(params: import("./interfaces").GetCartParameters): Promise<import("./interfaces").GetCartResponse>;
122
+ updateCart(params: import("./interfaces").UpdateCartParameters): Promise<void>;
123
+ initializeOrdersFromCart(params: import("./interfaces").InitializeOrdersFromCartParameters): Promise<string>;
124
+ deleteCartLines(params: import("./interfaces").DeleteCartLinesParameters): Promise<import("./interfaces").DeleteCartLinesResponse>;
125
+ getCartLines(params: import("./interfaces").GetCartLinesParameters): Promise<import("./interfaces").GetCartLinesResponse>;
126
+ updateCartLines(params: import("./interfaces").UpdateCartLinesParameters): Promise<import("./interfaces").UpdateCartLinesResponse>;
127
+ updateCartLinesByVariant(params: import("./interfaces").UpdateCartLinesByVariantParameters): Promise<import("./interfaces").UpdateCartLinesByVariantResponse>;
128
128
  getBuyingList({ buyingListId, locale, }: import("./interfaces").GetBuyingListParameters): Promise<import("./interfaces").GetBuyingListResponse>;
129
129
  getBuyingLists(): Promise<import("./interfaces").GetBuyingListsResponse>;
130
130
  createBuyingList({ name, }: import("./interfaces").CreateBuyingListParameters): Promise<import("./interfaces").CreateBuyingListResponse>;
@@ -1,66 +1,388 @@
1
+ /**
2
+ * @packageDocumentation
3
+ *
4
+ * @document documents/cart.md
5
+ */
1
6
  import { CreateCartParameters, DeleteCartsResponse, DeleteCartParameters, GetCartParameters, GetCartResponse, GetCartsParameters, GetCartsResponse, UpdateCartParameters, InitializeOrdersFromCartParameters, GetCartLinesParameters, DeleteCartLinesResponse, DeleteCartLinesParameters, GetCartLinesResponse, UpdateCartLinesResponse, UpdateCartLinesParameters, UpdateCartLinesByVariantParameters, UpdateCartLinesByVariantResponse } from "./definitions";
2
7
  /**
3
- * Get cart
4
- * @param {GetCartParameters} params - The parameters for getting a cart
5
- * @returns {Promise<GetCartResponse>} The response containing the cart data
8
+ * CART ENDPOINT
6
9
  */
7
- export declare function getCart({ cartId, currency, nbFirstLines, }: GetCartParameters): Promise<GetCartResponse>;
8
10
  /**
9
- * Get carts
10
- * @param {GetCartsParameters} params - The parameters for getting multiple carts
11
- * @returns {Promise<GetCartsResponse>} The response containing the carts data
11
+ * APICODE(cART135)
12
+ * Deletes all carts associated with the user.
13
+ *
14
+ * This function sends a request to delete all carts of the logged-in user.
15
+ *
16
+ * @returns {Promise<DeleteCartsResponse>} - An array of objects containing details about the deleted carts.
17
+ *
18
+ * @example
19
+ * #### input
20
+ * ```typescript
21
+ * const deletedCarts = await deleteCarts();
22
+ * ```
23
+ * #### output
24
+ * ```json
25
+ * [
26
+ * {
27
+ * "id": "cart1",
28
+ * "detail": "Deleted successfully"
29
+ * },
30
+ * {
31
+ * "id": "cart2",
32
+ * "detail": "Deleted successfully"
33
+ * }
34
+ * ]
35
+ * ```
12
36
  */
13
- export declare function getCarts({ currency, pageable, status, type, }: GetCartsParameters): Promise<GetCartsResponse>;
37
+ export declare function deleteCarts(): Promise<DeleteCartsResponse>;
14
38
  /**
15
- * Delete cart
16
- * @param {DeleteCartParameters} params - The parameters for deleting a cart
17
- * @returns {Promise<void>} A promise that resolves when the cart is deleted
39
+ * APICODE(cART550)
40
+ * Retrieves all active carts of the logged-in user.
41
+ *
42
+ * This function allows fetching the list of active carts based on the provided parameters.
43
+ *
44
+ * @param {GetCartsParameters} params - The parameters for retrieving the carts, including:
45
+ * #### currency - `string` | <strong style={{ color: 'red' }}>required</strong>
46
+ *
47
+ * The currency in which to display the carts.
48
+ * #### pageable - `object` | <strong style={{ color: 'red' }}>required</strong>
49
+ *
50
+ * The pagination parameters.
51
+ * #### status - `string[]` | <strong style={{ color: 'red' }}>required</strong>
52
+ *
53
+ * The status of the carts to retrieve.
54
+ * #### type - `string[]` | <strong style={{ color: 'red' }}>required</strong>
55
+ *
56
+ * The type of carts to retrieve.
57
+ *
58
+ * @returns {Promise<GetCartsResponse>} - An object containing the list of carts and pagination information.
59
+ *
60
+ * @example
61
+ * #### input
62
+ * ```typescript
63
+ * const carts = await getCarts({ currency: 'USD', pageable: { page: 1, size: 10 } });
64
+ * ```
65
+ * #### output
66
+ * ```json
67
+ * {
68
+ * carts: [
69
+ * {
70
+ * id: 'cart1',
71
+ * name: 'My Cart'
72
+ * },
73
+ * {
74
+ * id: 'cart2',
75
+ * name: 'Another Cart'
76
+ * }
77
+ * ],
78
+ * page: 1,
79
+ * size: 10,
80
+ * totalElement: 2
81
+ * }
82
+ * ```
18
83
  */
19
- export declare function deleteCart({ cartId, }: DeleteCartParameters): Promise<void>;
84
+ export declare function getCarts(params: GetCartsParameters): Promise<GetCartsResponse>;
20
85
  /**
21
- * Delete carts
22
- * @returns {Promise<DeleteCartsResponse>} The response containing the delete carts data
86
+ * APICODE(cART100)
87
+ * Creates a new cart.
88
+ *
89
+ * This function sends a request to create a new cart with the specified name.
90
+ *
91
+ * @param {CreateCartParameters} params - The parameters for creating the cart, including:
92
+ * #### name - `string` | <strong style={{ color: 'red' }}>required</strong>
93
+ *
94
+ * The name of the cart to create.
95
+ *
96
+ * @returns {Promise<GetCartResponse>} - A promise that resolves when the cart is created.
97
+ *
98
+ * @example
99
+ * #### input
100
+ * ```typescript
101
+ * await createCart({ name: 'New Cart' });
102
+ * ```
103
+ * #### output
104
+ * ```json
105
+ * {
106
+ * "message": "Cart created successfully"
107
+ * }
108
+ * ```
23
109
  */
24
- export declare function deleteCarts(): Promise<DeleteCartsResponse>;
110
+ export declare function createCart(params: CreateCartParameters): Promise<GetCartResponse>;
111
+ /**
112
+ * APICODE(cART300)
113
+ * Deletes a specific cart.
114
+ *
115
+ * This function sends a request to delete the cart identified by its ID.
116
+ *
117
+ * @param {DeleteCartParameters} params - The parameters to identify the cart to delete, including:
118
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
119
+ *
120
+ * The ID of the cart to delete.
121
+ *
122
+ * @returns {Promise<void>} - A promise that resolves when the cart is deleted.
123
+ *
124
+ * @example
125
+ * #### input
126
+ * ```typescript
127
+ * await deleteCart({ cartId: 'cart1' });
128
+ * ```
129
+ * #### output
130
+ * ```json
131
+ * {
132
+ * "message": "Cart deleted successfully"
133
+ * }
134
+ * ```
135
+ */
136
+ export declare function deleteCart(params: DeleteCartParameters): Promise<void>;
137
+ /**
138
+ * APICODE(cART500)
139
+ * Retrieves the details of a specific cart.
140
+ *
141
+ * This function allows fetching the information of a cart based on its ID.
142
+ *
143
+ * @param {GetCartParameters} params - The parameters for identifying the cart, including:
144
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
145
+ *
146
+ * The ID of the cart to retrieve.
147
+ * #### currency - `string` | <strong style={{ color: 'red' }}>required</strong>
148
+ *
149
+ * The currency in which to display the cart.
150
+ * #### nbFirstLines - `number[]`
151
+ *
152
+ * The number of lines to retrieve.
153
+ *
154
+ * @returns {Promise<GetCartResponse>} - An object containing the details of the cart.
155
+ *
156
+ * @example
157
+ * #### input
158
+ * ```typescript
159
+ * const cartDetails = await getCart({ cartId: 'cart1', currency: 'USD' });
160
+ * ```
161
+ * #### output
162
+ * ```json
163
+ * {
164
+ * "id": "cart1",
165
+ * "name": "My Cart",
166
+ * "totalPrice": 100,
167
+ * "lines": [
168
+ * {
169
+ * "productName": "Product A",
170
+ * "quantity": 2
171
+ * }
172
+ * ]
173
+ * }
174
+ * ```
175
+ */
176
+ export declare function getCart(params: GetCartParameters): Promise<GetCartResponse>;
25
177
  /**
26
- * Create cart
27
- * @param {CreateCartParameters} params - The parameters for creating a cart
28
- * @returns {Promise<void>} A promise that resolves when the cart is created
178
+ * APICODE(cART200)
179
+ * Updates an existing cart.
180
+ *
181
+ * This function sends a request to update the name of a cart identified by its ID.
182
+ *
183
+ * @param {UpdateCartParameters} params - The parameters for updating the cart, including:
184
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
185
+ *
186
+ * The ID of the cart to update.
187
+ * #### name - `string` | <strong style={{ color: 'red' }}>required</strong>
188
+ *
189
+ * The new name of the cart.
190
+ *
191
+ * @returns {Promise<void>} - A promise that resolves when the cart is updated.
192
+ *
193
+ * @example
194
+ * #### input
195
+ * ```typescript
196
+ * await updateCart({ cartId: 'cart1', name: 'Updated Cart Name' });
197
+ * ```
198
+ * #### output
199
+ * ```json
200
+ * {
201
+ * "message": "Cart updated successfully"
202
+ * }
203
+ * ```
29
204
  */
30
- export declare function createCart({ name, }: CreateCartParameters): Promise<void>;
205
+ export declare function updateCart(params: UpdateCartParameters): Promise<void>;
31
206
  /**
32
- * Update cart
33
- * @param {UpdateCartParameters} params - The parameters for updating a cart
34
- * @returns {Promise<void>} A promise that resolves when the cart is updated
207
+ * APICODE(cART101)
208
+ * Initializes orders from a cart.
209
+ *
210
+ * This function sends a request to initialize an order from a specified cart.
211
+ *
212
+ * @param {InitializeOrdersFromCartParameters} params - The parameters for initializing orders, including:
213
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
214
+ *
215
+ * The ID of the cart from which to initialize the order.
216
+ *
217
+ * @returns {Promise<string>} - The business ID of the commercial order if the initialization succeeds.
218
+ *
219
+ * @example
220
+ * #### input
221
+ * ```typescript
222
+ * const orderId = await initializeOrdersFromCart({ cartId: 'cart1' });
223
+ * ```
224
+ * #### output
225
+ * ```json
226
+ * {
227
+ * "orderId": "order123"
228
+ * }
229
+ * ```
35
230
  */
36
- export declare function updateCart({ cartId, name, }: UpdateCartParameters): Promise<void>;
231
+ export declare function initializeOrdersFromCart(params: InitializeOrdersFromCartParameters): Promise<string>;
37
232
  /**
38
- * Initialize orders from cart
39
- * @param {InitializeOrdersFromCartParameters} params - The parameters for initializing orders from a cart
40
- * @returns {Promise<string>} The response containing the order data
233
+ * CARTLINES ENDPOINT
41
234
  */
42
- export declare function initializeOrdersFromCart({ cartId, }: InitializeOrdersFromCartParameters): Promise<string>;
43
235
  /**
44
- * Get cart lines
45
- * @param {GetCartLinesParameters} params - The parameters for getting cart lines
46
- * @returns {Promise<GetCartLinesResponse>} The response containing the cart lines data
236
+ * APICODE(cART350)
237
+ * Deletes lines from a cart.
238
+ *
239
+ * This function sends a request to delete specific lines from a cart.
240
+ *
241
+ * @param {DeleteCartLinesParameters} params - The parameters for deleting lines from the cart, including:
242
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
243
+ *
244
+ * The ID of the cart.
245
+ * #### `lineIdsToDelete` - `string[]` | <strong style={{ color: 'red' }}>required</strong>
246
+ *
247
+ * The IDs of the lines to delete.
248
+ *
249
+ * @returns {Promise<DeleteCartLinesResponse>} - An object containing information about the deleted lines.
250
+ *
251
+ * @example
252
+ * #### input
253
+ * ```typescript
254
+ * const response = await deleteCartLines({ cartId: 'cart1', lineIdsToDelete: ['line1', 'line2'] });
255
+ * ```
256
+ * #### output
257
+ * ```json
258
+ * {
259
+ * "singleWarningReportDto": []
260
+ * }
261
+ * ```
47
262
  */
48
- export declare function getCartLines({ cartId, currency, pageable, supplierId, productVariantId, offerPriceId, }: GetCartLinesParameters): Promise<GetCartLinesResponse>;
263
+ export declare function deleteCartLines(params: DeleteCartLinesParameters): Promise<DeleteCartLinesResponse>;
49
264
  /**
50
- * Delete cart lines
51
- * @param {DeleteCartLinesParameters} params - The parameters for deleting cart lines
52
- * @returns {Promise<DeleteCartLinesResponse>} The response containing the delete cart lines data
265
+ * APICODE(cART551)
266
+ * Fetches the lines of a shopping cart based on the provided parameters.
267
+ *
268
+ * This function retrieves detailed information about the items (lines) in a shopping cart.
269
+ * It supports filtering by supplier, product variant, or offer price and handles pagination.
270
+ *
271
+ * @param {GetCartLinesParameters} params - The parameters for retrieving cart lines, including:
272
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
273
+ *
274
+ * The ID of the cart.
275
+ * #### currency - `string` | <strong style={{ color: 'red' }}>required</strong>
276
+ *
277
+ * The currency in which prices should be returned (e.g., "USD").
278
+ * #### pageable - `object` | <strong style={{ color: 'red' }}>required</strong>
279
+ *
280
+ * Pagination details, such as page number and size.
281
+ * #### supplierId - `string[]`
282
+ *
283
+ * Filter by a specific supplier's ID.
284
+ * #### productVariantId - `string[]`
285
+ *
286
+ * Filter by a specific product variant's ID.
287
+ * #### offerPriceId - `string[]`
288
+ *
289
+ * Filter by a specific offer price ID.
290
+ *
291
+ * @returns {Promise<GetCartLinesResponse>} - A promise resolving to the response containing cart lines information.
292
+ *
293
+ * @example
294
+ * #### input
295
+ * ```typescript
296
+ * const cartLines = await getCartLines({
297
+ * cartId: 'cart1',
298
+ * currency: 'USD',
299
+ * pageable: { page: 1, size: 10 },
300
+ * supplierId: ['supplier1'],
301
+ * productVariantId: ['variant1'],
302
+ * offerPriceId: ['offer1']
303
+ * });
304
+ * ```
305
+ * #### output
306
+ * ```json
307
+ * {
308
+ * "lines": [
309
+ * {
310
+ * "productName": "Product A",
311
+ * "quantity": 2,
312
+ * "price": 20
313
+ * }
314
+ * ],
315
+ * "totalItems": 1,
316
+ * "totalPages": 1
317
+ * }
318
+ * ```
53
319
  */
54
- export declare function deleteCartLines({ cartId, lineIdsToDelete, }: DeleteCartLinesParameters): Promise<DeleteCartLinesResponse>;
320
+ export declare function getCartLines(params: GetCartLinesParameters): Promise<GetCartLinesResponse>;
55
321
  /**
56
- * Update cart lines
57
- * @param {UpdateCartLinesParameters} params - The parameters for updating cart lines
58
- * @returns {Promise<UpdateCartLinesResponse>} The response containing the update cart lines data
322
+ * APICODE(cART150)
323
+ * Updates the lines of a cart.
324
+ *
325
+ * This function sends a request to update the lines of a specified cart.
326
+ *
327
+ * @param {UpdateCartLinesParameters} params - The parameters for updating the cart lines, including:
328
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
329
+ *
330
+ * The ID of the cart.
331
+ * #### `linesToUpdate` - `object[]` | <strong style={{ color: 'red' }}>required</strong>
332
+ *
333
+ * The lines to update with their details.
334
+ *
335
+ * @returns {Promise<UpdateCartLinesResponse>} - An object containing information about the updated lines.
336
+ *
337
+ * @example
338
+ * #### input
339
+ * ```typescript
340
+ * const response = await updateCartLines({
341
+ * cartId: 'cart1',
342
+ * linesToUpdate: [
343
+ * { offerPriceId: 'line1', quantity: 3, updateAction: 'update' }
344
+ * ],
345
+ * });
346
+ * ```
347
+ * #### output
348
+ * ```json
349
+ * {
350
+ * "singleWarningReportDto": []
351
+ * }
352
+ * ```
59
353
  */
60
- export declare function updateCartLines({ cartId, linesToUpdate, }: UpdateCartLinesParameters): Promise<UpdateCartLinesResponse>;
354
+ export declare function updateCartLines(params: UpdateCartLinesParameters): Promise<UpdateCartLinesResponse>;
61
355
  /**
62
- * Update cart lines by variant
63
- * @param {UpdateCartLinesByVariantParameters} params - The parameters for updating cart lines by variant
64
- * @returns {Promise<UpdateCartLinesByVariantResponse>} The response containing the update cart lines by variant data
356
+ * APICODE(cART151)
357
+ * Updates the lines of a cart by variant.
358
+ *
359
+ * This function sends a request to update the lines of a cart based on the product variant.
360
+ *
361
+ * @param {UpdateCartLinesByVariantParameters} params - The parameters for updating the cart lines by variant, including:
362
+ * #### cartId - `string` | <strong style={{ color: 'red' }}>required</strong>
363
+ *
364
+ * The ID of the cart.
365
+ * #### linesToUpdate - `object[]` | <strong style={{ color: 'red' }}>required</strong>
366
+ *
367
+ * The lines to update with their details.
368
+ *
369
+ * @returns {Promise<UpdateCartLinesByVariantResponse>} - An object containing information about the updated lines by variant.
370
+ *
371
+ * @example
372
+ * #### input
373
+ * ```typescript
374
+ * const response = await updateCartLinesByVariant({
375
+ * cartId: 'cart1',
376
+ * linesToUpdate: [
377
+ * { offerPriceId: 'variant1', quantity: 2, updateAction: 'update' }
378
+ * ],
379
+ * });
380
+ * ```
381
+ * #### output
382
+ * ```json
383
+ * {
384
+ * "singleWarningReportDto": []
385
+ * }
386
+ * ```
65
387
  */
66
- export declare function updateCartLinesByVariant({ cartId, linesToUpdate, }: UpdateCartLinesByVariantParameters): Promise<UpdateCartLinesByVariantResponse>;
388
+ export declare function updateCartLinesByVariant(params: UpdateCartLinesByVariantParameters): Promise<UpdateCartLinesByVariantResponse>;