@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.
@@ -17,7 +17,35 @@ exports.getProductPaginatedOffers = getProductPaginatedOffers;
17
17
  const parameters_validation_1 = require("../../helpers/parameters-validation");
18
18
  const fetch_instance_1 = require("../../settings/fetch-instance");
19
19
  /**
20
- * Search product with text expression for search and autocomplete
20
+ * 📄 Search products with a text expression for search and autocomplete.
21
+ *
22
+ * This function provides product search and autocomplete capabilities.
23
+ *
24
+ * 🛠 **Endpoint**: `GET /v2/shop/autocomplete`
25
+ *
26
+ * | Parameter | Type | Required | Description |
27
+ * |-----------------|--------------|----------|---------------------------------------------|
28
+ * | `input` | `string` | ✅ | The text expression to search for. |
29
+ * | `locale` | `string` | ✅ | The locale for the search. |
30
+ * | `currency` | `string` | ✅ | The currency for price formatting. |
31
+ * | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
32
+ * | `pageable.size` | `number` | ❌ | The number of items per page. |
33
+ * | `aggregation` | `boolean` | ❌ | Whether to include aggregation data. |
34
+ * | `productTags` | `string[]` | ❌ | Filters by product tags. |
35
+ *
36
+ * 📤 **Returns**:
37
+ * A `Promise` resolving to a `SearchProductsResponse` containing the matched products.
38
+ *
39
+ * 🛠 **Example usage**:
40
+ * ```typescript
41
+ * const products = await autoCompleteSearchProducts({
42
+ * input: 'laptop',
43
+ * locale: 'en-US',
44
+ * currency: 'USD',
45
+ * pageable: { page: 0, size: 10 },
46
+ * });
47
+ * console.log(products);
48
+ * ```
21
49
  */
22
50
  async function autoCompleteSearchProducts({ input, locale, currency, pageable, aggregation, productTags, }) {
23
51
  (0, parameters_validation_1.required)({ input, locale, currency });
@@ -32,13 +60,34 @@ async function autoCompleteSearchProducts({ input, locale, currency, pageable, a
32
60
  productTags,
33
61
  page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
34
62
  size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
35
- sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
36
63
  },
37
64
  });
38
65
  return data;
39
66
  }
40
67
  /**
41
- * Get thumbnails of a product regrouping product, stat reviews, attributs and bestOffer
68
+ * 📄 Fetches a list of products with thumbnails, reviews, attributes, and best offers.
69
+ *
70
+ * 🛠 **Endpoint**: `GET /v2/shop/search`
71
+ *
72
+ * | Parameter | Type | Required | Description |
73
+ * |-----------------|--------------|----------|---------------------------------------------|
74
+ * | `locale` | `string` | ✅ | The locale for product data. |
75
+ * | `filters` | `object` | ❌ | Filters for narrowing down search results. |
76
+ * | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
77
+ * | `pageable.size` | `number` | ❌ | The number of items per page. |
78
+ *
79
+ * 📤 **Returns**:
80
+ * A `Promise` resolving to a `GetProductsListResponse` containing the products and their metadata.
81
+ *
82
+ * 🛠 **Example usage**:
83
+ * ```typescript
84
+ * const products = await getProductsList({
85
+ * locale: 'en-US',
86
+ * filters: { category: 'electronics' },
87
+ * pageable: { page: 1, size: 20 },
88
+ * });
89
+ * console.log(products);
90
+ * ```
42
91
  */
43
92
  async function getProductsList({ locale, filters, pageable, }) {
44
93
  (0, parameters_validation_1.required)({ locale });
@@ -50,13 +99,34 @@ async function getProductsList({ locale, filters, pageable, }) {
50
99
  locale,
51
100
  page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
52
101
  size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
53
- sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
54
102
  },
55
103
  });
56
104
  return data;
57
105
  }
58
106
  /**
59
- * Get a paginated list of a product's variants
107
+ * 📄 Fetches product variants by product SKU.
108
+ *
109
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants`
110
+ *
111
+ * | Parameter | Type | Required | Description |
112
+ * |-----------------|--------------|----------|--------------------------------------------|
113
+ * | `productSku` | `string` | ✅ | The SKU of the product. |
114
+ * | `locale` | `string` | ❌ | The locale for product variants. |
115
+ * | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
116
+ * | `pageable.size` | `number` | ❌ | The number of items per page. |
117
+ *
118
+ * 📤 **Returns**:
119
+ * A `Promise` resolving to a `GetProductVariantsListResponse` containing the product variants.
120
+ *
121
+ * 🛠 **Example usage**:
122
+ * ```typescript
123
+ * const variants = await getProductVariantsList({
124
+ * productSku: 'sku123',
125
+ * locale: 'en-US',
126
+ * pageable: { page: 0, size: 10 },
127
+ * });
128
+ * console.log(variants);
129
+ * ```
60
130
  */
61
131
  async function getProductVariantsList({ productSku, locale, pageable, }) {
62
132
  (0, parameters_validation_1.required)({ productSku });
@@ -68,13 +138,58 @@ async function getProductVariantsList({ productSku, locale, pageable, }) {
68
138
  locale,
69
139
  page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
70
140
  size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
71
- sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
72
141
  },
73
142
  });
74
143
  return data;
75
144
  }
76
145
  /**
77
- * Get List offers of a product variant by sku, id or externalId
146
+ * 📄 Fetches offers for a specific product variant.
147
+ *
148
+ * Retrieves the list of offers available for a product variant identified by SKU, ID, or external ID.
149
+ *
150
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productIdentifier}/offers`
151
+ *
152
+ * | Parameter | Type | Required | Description |
153
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
154
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product variant (e.g., SKU, ID). |
155
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
156
+ * | `currency` | `string` | ✅ | Currency in which offers should be returned (e.g., `"USD"`). |
157
+ *
158
+ * 📤 **Returns**:
159
+ * A `Promise<GetProductVariantOffersResponse>` containing a list of offers for the product variant.
160
+ *
161
+ * 🛠 **Example usage**:
162
+ * ```ts
163
+ * const offers = await getProductVariantOffers({
164
+ * productIdentifier: 'sku123',
165
+ * productIdType: 'sku',
166
+ * currency: 'USD',
167
+ * });
168
+ *
169
+ * console.log(offers);
170
+ * ```
171
+ *
172
+ * **Example Response**:
173
+ * ```json
174
+ * {
175
+ * "offers": [
176
+ * {
177
+ * "id": "offer1",
178
+ * "price": 19.99,
179
+ * "currency": "USD",
180
+ * "availability": "In Stock",
181
+ * "seller": "Seller A"
182
+ * },
183
+ * {
184
+ * "id": "offer2",
185
+ * "price": 17.99,
186
+ * "currency": "USD",
187
+ * "availability": "Limited Stock",
188
+ * "seller": "Seller B"
189
+ * }
190
+ * ]
191
+ * }
192
+ * ```
78
193
  */
79
194
  async function getProductVariantOffers({ productIdentifier, productIdType, currency, }) {
80
195
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -89,7 +204,27 @@ async function getProductVariantOffers({ productIdentifier, productIdType, curre
89
204
  return data;
90
205
  }
91
206
  /**
92
- * Get suppliers of a product variant
207
+ * 📄 Fetches suppliers associated with a product variant.
208
+ *
209
+ * Retrieves a list of suppliers for a given product variant.
210
+ *
211
+ * 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}/suppliers`
212
+ *
213
+ * | Parameter | Type | Required | Description |
214
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
215
+ * | `productVariantId` | `string` | ✅ | ID of the product variant. |
216
+ *
217
+ * 📤 **Returns**:
218
+ * A `Promise<GetProductVariantSuppliersResponse>` containing the list of suppliers.
219
+ *
220
+ * 🛠 **Example usage**:
221
+ * ```ts
222
+ * const suppliers = await getProductVariantSuppliers({
223
+ * productVariantId: 'variant123',
224
+ * });
225
+ *
226
+ * console.log(suppliers);
227
+ * ```
93
228
  */
94
229
  async function getProductVariantSuppliers({ productVariantId, }) {
95
230
  (0, parameters_validation_1.required)({ productVariantId });
@@ -100,7 +235,31 @@ async function getProductVariantSuppliers({ productVariantId, }) {
100
235
  return data;
101
236
  }
102
237
  /**
103
- * Get a product by sku, id or externalId
238
+ * 📄 Fetches details for a specific product.
239
+ *
240
+ * Retrieves information about a product identified by SKU, ID, or external ID.
241
+ *
242
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}`
243
+ *
244
+ * | Parameter | Type | Required | Description |
245
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
246
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product (e.g., SKU, ID). |
247
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
248
+ * | `locale` | `string` | ✅ | Locale for the product details (e.g., `"en_US"`). |
249
+ *
250
+ * 📤 **Returns**:
251
+ * A `Promise<GetProductsListResponse>` containing the product details.
252
+ *
253
+ * 🛠 **Example usage**:
254
+ * ```ts
255
+ * const product = await getProduct({
256
+ * productIdentifier: 'sku123',
257
+ * productIdType: 'sku',
258
+ * locale: 'en_US',
259
+ * });
260
+ *
261
+ * console.log(product);
262
+ * ```
104
263
  */
105
264
  async function getProduct({ productIdentifier, productIdType, locale, }) {
106
265
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -115,7 +274,28 @@ async function getProduct({ productIdentifier, productIdType, locale, }) {
115
274
  return data;
116
275
  }
117
276
  /**
118
- * Get offers of a product by sku, id or externalId
277
+ * 📄 Fetches product offers by SKU, ID, or external ID.
278
+ *
279
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/offers`
280
+ *
281
+ * | Parameter | Type | Required | Description |
282
+ * |---------------------|--------------|----------|-------------------------------------------------|
283
+ * | `productIdentifier` | `string` | ✅ | The unique identifier of the product. |
284
+ * | `productIdType` | `string` | ✅ | The type of the identifier (`sku`, `id`, etc.).|
285
+ * | `currency` | `string` | ✅ | The currency for the offer details. |
286
+ *
287
+ * 📤 **Returns**:
288
+ * A `Promise` resolving to a `GetProductVariantOffersResponse` containing the offers.
289
+ *
290
+ * 🛠 **Example usage**:
291
+ * ```typescript
292
+ * const offers = await getProductVariantOffers({
293
+ * productIdentifier: 'sku123',
294
+ * productIdType: 'sku',
295
+ * currency: 'USD',
296
+ * });
297
+ * console.log(offers);
298
+ * ```
119
299
  */
120
300
  async function getProductOffers({ productIdentifier, productIdType, locale, currency, }) {
121
301
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -131,7 +311,35 @@ async function getProductOffers({ productIdentifier, productIdType, locale, curr
131
311
  return data;
132
312
  }
133
313
  /**
134
- * Get related products of a product by sku, id or externalId
314
+ * 📄 Fetches related products for a specific product.
315
+ *
316
+ * Retrieves a paginated list of related products identified by SKU, ID, or external ID.
317
+ *
318
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/related-products`
319
+ *
320
+ * | Parameter | Type | Required | Description |
321
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
322
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product (e.g., SKU, ID). |
323
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
324
+ * | `locale` | `string` | ✅ | Locale for the related products (e.g., `"en_US"`). |
325
+ * | `currency` | `string` | ✅ | Currency for the related products (e.g., `"USD"`). |
326
+ * | `pageable` | `object` | ❌ | Pagination details: `page`, `size`, `sort`. |
327
+ *
328
+ * 📤 **Returns**:
329
+ * A `Promise<GetRelatedProductsParameters>` containing related products.
330
+ *
331
+ * 🛠 **Example usage**:
332
+ * ```ts
333
+ * const relatedProducts = await getRelatedProducts({
334
+ * productIdentifier: 'sku123',
335
+ * productIdType: 'sku',
336
+ * locale: 'en_US',
337
+ * currency: 'USD',
338
+ * pageable: { page: 1, size: 10 },
339
+ * });
340
+ *
341
+ * console.log(relatedProducts);
342
+ * ```
135
343
  */
136
344
  async function getRelatedProducts({ productIdentifier, productIdType, locale, currency, pageable, }) {
137
345
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -150,7 +358,29 @@ async function getRelatedProducts({ productIdentifier, productIdType, locale, cu
150
358
  return data;
151
359
  }
152
360
  /**
153
- * Get reviews of a product by sku, id or externalId
361
+ * 📄 Fetches reviews for a specific product.
362
+ *
363
+ * Retrieves a list of reviews for a product identified by SKU, ID, or external ID.
364
+ *
365
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/reviews`
366
+ *
367
+ * | Parameter | Type | Required | Description |
368
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
369
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product (e.g., SKU, ID). |
370
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
371
+ *
372
+ * 📤 **Returns**:
373
+ * A `Promise<GetProductReviewsResponse>` containing the reviews.
374
+ *
375
+ * 🛠 **Example usage**:
376
+ * ```ts
377
+ * const reviews = await getProductReviews({
378
+ * productIdentifier: 'sku123',
379
+ * productIdType: 'sku',
380
+ * });
381
+ *
382
+ * console.log(reviews);
383
+ * ```
154
384
  */
155
385
  async function getProductReviews({ productIdentifier, productIdType, }) {
156
386
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -164,7 +394,29 @@ async function getProductReviews({ productIdentifier, productIdType, }) {
164
394
  return data;
165
395
  }
166
396
  /**
167
- * Get stat reviews of a product by sku, id or externalId
397
+ * 📄 Fetches statistical review data for a specific product.
398
+ *
399
+ * Retrieves aggregate review statistics for a product identified by SKU, ID, or external ID.
400
+ *
401
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/stat-reviews`
402
+ *
403
+ * | Parameter | Type | Required | Description |
404
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
405
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product (e.g., SKU, ID). |
406
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
407
+ *
408
+ * 📤 **Returns**:
409
+ * A `Promise<GetProductStatReviewsResponse>` containing review statistics.
410
+ *
411
+ * 🛠 **Example usage**:
412
+ * ```ts
413
+ * const stats = await getProductStatReviews({
414
+ * productIdentifier: 'sku123',
415
+ * productIdType: 'sku',
416
+ * });
417
+ *
418
+ * console.log(stats);
419
+ * ```
168
420
  */
169
421
  async function getProductStatReviews({ productIdentifier, productIdType, }) {
170
422
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -178,7 +430,31 @@ async function getProductStatReviews({ productIdentifier, productIdType, }) {
178
430
  return data;
179
431
  }
180
432
  /**
181
- * Get attributes of a product variant by sku, id or externalId
433
+ * 📄 Fetches attributes for a product variant.
434
+ *
435
+ * Retrieves attributes for a product variant identified by SKU, ID, or external ID.
436
+ *
437
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/variant-attributes`
438
+ *
439
+ * | Parameter | Type | Required | Description |
440
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
441
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product variant (e.g., SKU, ID). |
442
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
443
+ * | `locale` | `string` | ✅ | Locale for the attributes (e.g., `"en_US"`). |
444
+ *
445
+ * 📤 **Returns**:
446
+ * A `Promise<GetProductVariantAttributesResponse>` containing variant attributes.
447
+ *
448
+ * 🛠 **Example usage**:
449
+ * ```ts
450
+ * const attributes = await getProductVariantAttributes({
451
+ * productIdentifier: 'sku123',
452
+ * productIdType: 'sku',
453
+ * locale: 'en_US',
454
+ * });
455
+ *
456
+ * console.log(attributes);
457
+ * ```
182
458
  */
183
459
  async function getProductVariantAttributes({ productIdentifier, productIdType, locale, }) {
184
460
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });
@@ -193,7 +469,31 @@ async function getProductVariantAttributes({ productIdentifier, productIdType, l
193
469
  return data;
194
470
  }
195
471
  /**
196
- * Create a review for a product
472
+ * 📄 Creates a review for a product.
473
+ *
474
+ * Submits a review for a specific product based on its SKU.
475
+ *
476
+ * 🛠 **Endpoint**: `POST /v1/shop/reviews`
477
+ *
478
+ * | Parameter | Type | Required | Description |
479
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
480
+ * | `message` | `string` | ✅ | Review content. |
481
+ * | `productSku` | `string` | ✅ | SKU of the product to review. |
482
+ * | `rating` | `number` | ✅ | Rating (e.g., 1 to 5). |
483
+ *
484
+ * 📤 **Returns**:
485
+ * A `Promise<CreateProductReviewResponse>` indicating the result of the operation.
486
+ *
487
+ * 🛠 **Example usage**:
488
+ * ```ts
489
+ * const review = await createProductReview({
490
+ * message: 'Great product!',
491
+ * productSku: 'sku123',
492
+ * rating: 5,
493
+ * });
494
+ *
495
+ * console.log(review);
496
+ * ```
197
497
  */
198
498
  async function createProductReview({ message, productSku, rating, }) {
199
499
  (0, parameters_validation_1.required)({ message, productSku, rating });
@@ -209,7 +509,31 @@ async function createProductReview({ message, productSku, rating, }) {
209
509
  return data;
210
510
  }
211
511
  /**
212
- * Update a review for a product
512
+ * 📄 Updates an existing review for a product.
513
+ *
514
+ * Modifies the content and/or rating of an existing review for a specific product.
515
+ *
516
+ * 🛠 **Endpoint**: `PUT /v1/shop/reviews/{productReviewId}`
517
+ *
518
+ * | Parameter | Type | Required | Description |
519
+ * |-----------------------|-------------------------------|------------|---------------------------------------------------------------|
520
+ * | `productReviewId` | `string` | ✅ | ID of the review to update. |
521
+ * | `message` | `string` | ✅ | New review content. |
522
+ * | `rating` | `number` | ✅ | New rating (e.g., 1 to 5). |
523
+ *
524
+ * 📤 **Returns**:
525
+ * A `Promise<UpdateProductReviewResponse>` indicating the result of the operation.
526
+ *
527
+ * 🛠 **Example usage**:
528
+ * ```ts
529
+ * const updatedReview = await updateProductReview({
530
+ * productReviewId: 'review123',
531
+ * message: 'Updated my thoughts, still a great product!',
532
+ * rating: 4,
533
+ * });
534
+ *
535
+ * console.log(updatedReview);
536
+ * ```
213
537
  */
214
538
  async function updateProductReview({ productReviewId, message, rating, }) {
215
539
  (0, parameters_validation_1.required)({ productReviewId, message, rating });
@@ -224,7 +548,32 @@ async function updateProductReview({ productReviewId, message, rating, }) {
224
548
  return data;
225
549
  }
226
550
  /**
227
- * Get paginated offers of a product by sku, id or externalId
551
+ * 📄 Fetches paginated offers for a product.
552
+ *
553
+ * Retrieves offers for a product identified by SKU, ID, or external ID, with pagination support.
554
+ *
555
+ * 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/paginated-offers`
556
+ *
557
+ * | Parameter | Type | Required | Description |
558
+ * |-----------------------|-------------|------------|---------------------------------------------------------------|
559
+ * | `productIdentifier` | `string` | ✅ | Unique identifier for the product (e.g., SKU, ID). |
560
+ * | `productIdType` | `string` | ✅ | The type of identifier: `"sku"`, `"id"`, or `"externalId"`. |
561
+ * | `currency` | `string` | ✅ | Currency for the offers (e.g., `"USD"`). |
562
+ * | `locale` | `string` | ✅ | Locale for the offers (e.g., `"en_US"`). |
563
+ * | `withoutPrices` | `boolean` | ❌ | Whether to exclude prices from the response. |
564
+ * | `pageable` | `object` | ❌ | Pagination details: `page`, `size`, `sort`. |
565
+ *
566
+ * 📤 **Returns**:
567
+ * A `Promise<GetProductPaginatedOffersResponse>` containing paginated offers.
568
+ *
569
+ * 🛠 **Example usage**:
570
+ * ```ts
571
+ * const offers = await getProductPaginatedOffers({
572
+ * productIdentifier: 'sku123',
573
+ * productIdType: 'sku',
574
+ * currency: 'USD',
575
+ * locale: 'en_US',
576
+ * pageable: { page: 1, size
228
577
  */
229
578
  async function getProductPaginatedOffers({ productIdentifier, productIdType, currency, locale, withoutPrices, pageable, }) {
230
579
  (0, parameters_validation_1.required)({ productIdentifier, productIdType });