@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
@@ -1,5 +1,5 @@
1
1
  import { DjustConfig, PageableParameters } from "../../interfaces/models/common";
2
- import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse, GetCustomerAccountResponseV2 } from "./definitions";
2
+ import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressResponse, CreateCustomerAccountOrganisationParameters, CreateCustomerAccountOrganisationResponse, CreateCustomerAccountParameters, CreateCustomerAccountResponse, DeleteCustomerAccountAddressParameters, DeleteCustomerAccountOrganisationAddressParameters, GetCustomerAccountAddressesParameters, GetCustomerAccountAddressesResponse, GetCustomerAccountOrdersParameters, GetCustomerAccountOrdersResponse, GetCustomerAccountOrganisationAddressesParameters, GetCustomerAccountOrganisationAddressesResponse, GetCustomerAccountOrganisationOrdersParameters, GetCustomerAccountOrganisationOrdersResponse, GetCustomerAccountOrganisationResponse, GetCustomerAccountOrganisationUsersParameters, GetCustomerAccountOrganisationUsersResponse, GetCustomerAccountResponse, GetCustomerAccountUsersParameters, GetCustomerAccountUsersResponse, UpdateCustomerAccountAddressParameters, UpdateCustomerAccountAddressResponse, UpdateCustomerAccountOrganisationAddressParameters, UpdateCustomerAccountOrganisationAddressResponse, UpdateCustomerAccountOrganisationParameters, UpdateCustomerAccountOrganisationResponse, UpdateCustomerAccountOrganisationUserParameters, UpdateCustomerAccountOrganisationUserResponse, UpdateCustomerAccountParameters, UpdateCustomerAccountResponse, GetCustomerAccountResponseV2, GetCustomerAccountCustomFieldsResponse, GetCustomerAccountCustomFieldsParameters } from "./definitions";
3
3
  /**
4
4
  * 📄 Get customer account details.
5
5
  *
@@ -37,7 +37,7 @@ export declare function getCustomerAccount(config?: DjustConfig): Promise<GetCus
37
37
  * });
38
38
  * ```
39
39
  *
40
- * @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer accounts:
40
+ * @param {GetCustomerAccountParametersV2} params - The parameters for fetching customer accounts:
41
41
  * - `pageable` - Pagination parameters.
42
42
  *
43
43
  * @returns {Promise<GetCustomerAccountResponseV2>} - The response containing the customer accounts.
@@ -286,6 +286,32 @@ export declare function deleteCustomerAccountAddress({ addressId, ...config }: D
286
286
  * ```
287
287
  */
288
288
  export declare function updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, ...config }: UpdateCustomerAccountAddressParameters & DjustConfig): Promise<UpdateCustomerAccountAddressResponse>;
289
+ /**
290
+ * 📋 Get customer account custom fields.
291
+ *
292
+ * This function retrieves custom fields for a customer account.
293
+ *
294
+ * 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields` [ACCOUNT-554]
295
+ *
296
+ * | **Parameter** | **Type** | **Required** | **Description** |
297
+ * |----------------------|------------|--------------|---------------------------------------------------------------------------|
298
+ * | `customFieldIds` | `string[]` | ❌ | The array of custom fields IDs to retrieve. |
299
+ * | `idType` | `AccountCustomFieldsIdType` | ❌ | The type of custom field ID to use to retrieve them (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
300
+ * | `pageable` | `object` | ❌ | The pagination parameters to retrieve paginated results. |
301
+ *
302
+ * 📤 **Returns**:
303
+ * A `Promise<GetCustomerAccountCustomFieldsResponse>` containing the custom fields.
304
+ *
305
+ * 🛠 **Example Usage**:
306
+ * ```typescript
307
+ * const customFields = await getCustomerAccountCustomFields({
308
+ * customFieldIds: ['customField1', 'customField2'],
309
+ * idType: 'EXTERNAL_ID',
310
+ * pageable: { page: 1, size: 10 },
311
+ * });
312
+ * ```
313
+ */
314
+ export declare function getCustomerAccountCustomFields({ customFieldIds, idType, pageable, }: GetCustomerAccountCustomFieldsParameters): Promise<GetCustomerAccountCustomFieldsResponse>;
289
315
  /**
290
316
  * 📋 Retrieves orders for a customer account.
291
317
  *
@@ -297,7 +323,10 @@ export declare function updateCustomerAccountAddress({ addressId, additionalAddr
297
323
  * |----------------------|------------|--------------|---------------------------------------------------------------------------|
298
324
  * | `pageable` | `object` | ✅ | The pagination parameters to retrieve paginated results. |
299
325
  * | `locale` | `string` | ✅ | The locale to be used for the response. |
300
- * | `includeInactive` | `boolean` | ❌ | Whether to include inactive orders in the response. |
326
+ * | `nbPreviewLines` | `number` | ❌ | The number of order lines to retrieve by orders. |
327
+ * | `logisticOrderStatuses`| `string[]`| ❌ | The statuses of the orders to retrieve. |
328
+ * | `orderLogisticStatusType`| `string`| ❌ | The statuses of the orders to retrieve (deprecated). |
329
+ * | `includeInactive` | `boolean` | ❌ | Whether to include inactive orders in the response. |
301
330
  * | `limit` | `number` | ❌ | The maximum number of orders to return. |
302
331
  * | `offset` | `number` | ❌ | The number of orders to skip before starting to collect results. |
303
332
  *
@@ -309,12 +338,17 @@ export declare function updateCustomerAccountAddress({ addressId, additionalAddr
309
338
  * const orders = await getCustomerAccountOrders({
310
339
  * pageable: { page: 1, size: 10 },
311
340
  * locale: 'en',
341
+ * nbPreviewLines: 10,
342
+ * logisticOrderStatuses: ["ORDER_CREATED", "WAITING_CUSTOMER_APPROVAL"],
312
343
  * });
313
344
  * ```
314
345
  *
315
346
  * @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer account orders:
316
347
  * - `pageable` - Pagination parameters.
317
348
  * - `locale` - The locale for the response.
349
+ * - `nbPreviewLines` (optional) - Number of order lines to put in the response.
350
+ * - `logisticOrderStatuses` (optional) - Statuses of the orders to retrieve.
351
+ * - `orderLogisticStatusType` (deprecated) - Statuses of the orders to retrieve.
318
352
  * - `includeInactive` (optional) - Whether to include inactive orders.
319
353
  * - `limit` (optional) - The maximum number of orders to return.
320
354
  * - `offset` (optional) - The number of orders to skip before collecting results.
@@ -419,16 +453,24 @@ export declare function updateCustomerAccountOrganisation(params: UpdateCustomer
419
453
  *
420
454
  * ### **Endpoint**: `GET /v1/shop/customer-accounts/organisations`
421
455
  *
456
+ * | **Parameter** | **Type** | **Required** | **Description** |
457
+ * |-------------------|------------|--------------|-------------------------------------------------------------|
458
+ * | `pageable` | `object` | ❌ | Object containing pagination details: `page`, `size`, `sort`. |
459
+ *
422
460
  * ### **Returns**:
423
461
  * A `Promise<GetCustomerAccountOrganisationResponse>` containing the list of customer account organisations.
424
462
  *
425
463
  * ### **Example Usage**:
426
464
  * ```typescript
427
- * const response = await getCustomerAccountOrganisations();
465
+ * const response = await getCustomerAccountOrganisations({
466
+ * pageable: { page: 0, size: 20 }
467
+ * });
428
468
  * console.log(response);
429
469
  * ```
430
470
  */
431
- export declare function getCustomerAccountOrganisations(config?: DjustConfig): Promise<GetCustomerAccountOrganisationResponse>;
471
+ export declare function getCustomerAccountOrganisations(params?: {
472
+ pageable?: PageableParameters;
473
+ } & DjustConfig): Promise<GetCustomerAccountOrganisationResponse>;
432
474
  /**
433
475
  * ## Get addresses from a customer account organisation
434
476
  *
@@ -8,6 +8,7 @@ exports.getCustomerAccountAddresses = getCustomerAccountAddresses;
8
8
  exports.createCustomerAccountAddress = createCustomerAccountAddress;
9
9
  exports.deleteCustomerAccountAddress = deleteCustomerAccountAddress;
10
10
  exports.updateCustomerAccountAddress = updateCustomerAccountAddress;
11
+ exports.getCustomerAccountCustomFields = getCustomerAccountCustomFields;
11
12
  exports.getCustomerAccountOrders = getCustomerAccountOrders;
12
13
  exports.getCustomerAccountUsers = getCustomerAccountUsers;
13
14
  exports.createCustomerAccountOrganisation = createCustomerAccountOrganisation;
@@ -65,7 +66,7 @@ async function getCustomerAccount(config) {
65
66
  * });
66
67
  * ```
67
68
  *
68
- * @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer accounts:
69
+ * @param {GetCustomerAccountParametersV2} params - The parameters for fetching customer accounts:
69
70
  * - `pageable` - Pagination parameters.
70
71
  *
71
72
  * @returns {Promise<GetCustomerAccountResponseV2>} - The response containing the customer accounts.
@@ -413,6 +414,45 @@ async function updateCustomerAccountAddress({ addressId, additionalAddress, addr
413
414
  });
414
415
  return data;
415
416
  }
417
+ /**
418
+ * 📋 Get customer account custom fields.
419
+ *
420
+ * This function retrieves custom fields for a customer account.
421
+ *
422
+ * 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/custom-fields` [ACCOUNT-554]
423
+ *
424
+ * | **Parameter** | **Type** | **Required** | **Description** |
425
+ * |----------------------|------------|--------------|---------------------------------------------------------------------------|
426
+ * | `customFieldIds` | `string[]` | ❌ | The array of custom fields IDs to retrieve. |
427
+ * | `idType` | `AccountCustomFieldsIdType` | ❌ | The type of custom field ID to use to retrieve them (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
428
+ * | `pageable` | `object` | ❌ | The pagination parameters to retrieve paginated results. |
429
+ *
430
+ * 📤 **Returns**:
431
+ * A `Promise<GetCustomerAccountCustomFieldsResponse>` containing the custom fields.
432
+ *
433
+ * 🛠 **Example Usage**:
434
+ * ```typescript
435
+ * const customFields = await getCustomerAccountCustomFields({
436
+ * customFieldIds: ['customField1', 'customField2'],
437
+ * idType: 'EXTERNAL_ID',
438
+ * pageable: { page: 1, size: 10 },
439
+ * });
440
+ * ```
441
+ */
442
+ async function getCustomerAccountCustomFields({ customFieldIds, idType, pageable, }) {
443
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
444
+ method: "GET",
445
+ path: "/v1/shop/customer-accounts/custom-fields",
446
+ params: {
447
+ customFieldIds,
448
+ idType,
449
+ page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
450
+ size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
451
+ sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
452
+ },
453
+ });
454
+ return data;
455
+ }
416
456
  /**
417
457
  * 📋 Retrieves orders for a customer account.
418
458
  *
@@ -424,7 +464,10 @@ async function updateCustomerAccountAddress({ addressId, additionalAddress, addr
424
464
  * |----------------------|------------|--------------|---------------------------------------------------------------------------|
425
465
  * | `pageable` | `object` | ✅ | The pagination parameters to retrieve paginated results. |
426
466
  * | `locale` | `string` | ✅ | The locale to be used for the response. |
427
- * | `includeInactive` | `boolean` | ❌ | Whether to include inactive orders in the response. |
467
+ * | `nbPreviewLines` | `number` | ❌ | The number of order lines to retrieve by orders. |
468
+ * | `logisticOrderStatuses`| `string[]`| ❌ | The statuses of the orders to retrieve. |
469
+ * | `orderLogisticStatusType`| `string`| ❌ | The statuses of the orders to retrieve (deprecated). |
470
+ * | `includeInactive` | `boolean` | ❌ | Whether to include inactive orders in the response. |
428
471
  * | `limit` | `number` | ❌ | The maximum number of orders to return. |
429
472
  * | `offset` | `number` | ❌ | The number of orders to skip before starting to collect results. |
430
473
  *
@@ -436,12 +479,17 @@ async function updateCustomerAccountAddress({ addressId, additionalAddress, addr
436
479
  * const orders = await getCustomerAccountOrders({
437
480
  * pageable: { page: 1, size: 10 },
438
481
  * locale: 'en',
482
+ * nbPreviewLines: 10,
483
+ * logisticOrderStatuses: ["ORDER_CREATED", "WAITING_CUSTOMER_APPROVAL"],
439
484
  * });
440
485
  * ```
441
486
  *
442
487
  * @param {GetCustomerAccountOrdersParameters} params - The parameters for fetching customer account orders:
443
488
  * - `pageable` - Pagination parameters.
444
489
  * - `locale` - The locale for the response.
490
+ * - `nbPreviewLines` (optional) - Number of order lines to put in the response.
491
+ * - `logisticOrderStatuses` (optional) - Statuses of the orders to retrieve.
492
+ * - `orderLogisticStatusType` (deprecated) - Statuses of the orders to retrieve.
445
493
  * - `includeInactive` (optional) - Whether to include inactive orders.
446
494
  * - `limit` (optional) - The maximum number of orders to return.
447
495
  * - `offset` (optional) - The number of orders to skip before collecting results.
@@ -458,6 +506,8 @@ async function getCustomerAccountOrders(params) {
458
506
  size: (_b = params.pageable) === null || _b === void 0 ? void 0 : _b.size,
459
507
  sort: (_c = params.pageable) === null || _c === void 0 ? void 0 : _c.sort,
460
508
  locale: params.locale,
509
+ nbPreviewLines: params.nbPreviewLines,
510
+ logisticOrderStatuses: params.logisticOrderStatuses,
461
511
  },
462
512
  });
463
513
  return data;
@@ -592,20 +642,32 @@ async function updateCustomerAccountOrganisation(params) {
592
642
  *
593
643
  * ### **Endpoint**: `GET /v1/shop/customer-accounts/organisations`
594
644
  *
645
+ * | **Parameter** | **Type** | **Required** | **Description** |
646
+ * |-------------------|------------|--------------|-------------------------------------------------------------|
647
+ * | `pageable` | `object` | ❌ | Object containing pagination details: `page`, `size`, `sort`. |
648
+ *
595
649
  * ### **Returns**:
596
650
  * A `Promise<GetCustomerAccountOrganisationResponse>` containing the list of customer account organisations.
597
651
  *
598
652
  * ### **Example Usage**:
599
653
  * ```typescript
600
- * const response = await getCustomerAccountOrganisations();
654
+ * const response = await getCustomerAccountOrganisations({
655
+ * pageable: { page: 0, size: 20 }
656
+ * });
601
657
  * console.log(response);
602
658
  * ```
603
659
  */
604
- async function getCustomerAccountOrganisations(config) {
660
+ async function getCustomerAccountOrganisations(params) {
661
+ var _a, _b, _c;
605
662
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
606
663
  method: "GET",
607
664
  path: `/v1/shop/customer-accounts/organisations`,
608
- params: config,
665
+ params: {
666
+ ...params,
667
+ page: (_a = params === null || params === void 0 ? void 0 : params.pageable) === null || _a === void 0 ? void 0 : _a.page,
668
+ size: (_b = params === null || params === void 0 ? void 0 : params.pageable) === null || _b === void 0 ? void 0 : _b.size,
669
+ sort: (_c = params === null || params === void 0 ? void 0 : params.pageable) === null || _c === void 0 ? void 0 : _c.sort,
670
+ },
609
671
  });
610
672
  return data;
611
673
  }
@@ -785,6 +847,7 @@ async function getCustomerAccountOrganisationOrders(params) {
785
847
  size: (_b = params.pageable) === null || _b === void 0 ? void 0 : _b.size,
786
848
  sort: (_c = params.pageable) === null || _c === void 0 ? void 0 : _c.sort,
787
849
  locale: params.locale,
850
+ nbPreviewLines: params.nbPreviewLines,
788
851
  },
789
852
  });
790
853
  return data;
@@ -3,6 +3,7 @@ import { CivilityType, UserInfoDto, UserStatus } from "../../interfaces/models/c
3
3
  import { CustomerOrganisationDto } from "../../interfaces/models/customer-organisation";
4
4
  import { AddressDto } from "../../interfaces/models/address";
5
5
  import { AccountIdType } from "../../interfaces/models/customer-account";
6
+ import { IdType } from "../../interfaces/models/common";
6
7
  /**
7
8
  * Requests parameters type definitions
8
9
  */
@@ -43,6 +44,7 @@ export interface SendCustomerUserActivationRequestParameters {
43
44
  }
44
45
  export interface UpdateSpecificCustomerUserParameters {
45
46
  userToUpdateId: string;
47
+ idType?: IdType;
46
48
  civility: CivilityType;
47
49
  customFieldValues?: CustomFieldValueRequest[];
48
50
  firstName: string;
@@ -314,7 +314,7 @@ export declare function sendCustomerUserActivationRequest({ redirectUrl, token,
314
314
  * }
315
315
  * ```
316
316
  */
317
- export declare function updateSpecificCustomerUser({ userToUpdateId, civility, firstName, lastName, phone, groups, customFieldValues, }: UpdateSpecificCustomerUserParameters): Promise<void>;
317
+ export declare function updateSpecificCustomerUser({ userToUpdateId, civility, firstName, lastName, phone, groups, customFieldValues, idType, }: UpdateSpecificCustomerUserParameters): Promise<void>;
318
318
  /**
319
319
  * 🚚 **Remove Accounts from User**
320
320
  *
@@ -408,7 +408,7 @@ async function sendCustomerUserActivationRequest({ redirectUrl, token, }) {
408
408
  * }
409
409
  * ```
410
410
  */
411
- async function updateSpecificCustomerUser({ userToUpdateId, civility, firstName, lastName, phone, groups, customFieldValues, }) {
411
+ async function updateSpecificCustomerUser({ userToUpdateId, civility, firstName, lastName, phone, groups, customFieldValues, idType, }) {
412
412
  (0, parameters_validation_1.required)({ userToUpdateId, civility, firstName, lastName });
413
413
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
414
414
  method: "PUT",
@@ -421,6 +421,9 @@ async function updateSpecificCustomerUser({ userToUpdateId, civility, firstName,
421
421
  groups,
422
422
  customFieldValues,
423
423
  }),
424
+ params: {
425
+ idType,
426
+ },
424
427
  });
425
428
  return data;
426
429
  }
@@ -12,6 +12,7 @@ export interface getIncidentsParameters {
12
12
  page: number;
13
13
  size: number;
14
14
  sort: String[];
15
+ supplierIds?: String[];
15
16
  }
16
17
  export interface getIncidentParameters {
17
18
  incidentId: string;
@@ -49,6 +50,20 @@ export interface createOrderLogisticIncidentThreadParameters {
49
50
  message: string;
50
51
  reasonCode: string;
51
52
  }
53
+ export interface createIncidentParameters {
54
+ customField?: {
55
+ customFieldValues: CustomFieldValueRequest[];
56
+ idType: IncidentIdType;
57
+ };
58
+ externalId?: string;
59
+ logisticOrderId?: string;
60
+ reasonCodes: string[];
61
+ idType?: IncidentIdType;
62
+ }
63
+ export interface createIncidentResponse {
64
+ externalId: string;
65
+ incidentId: string;
66
+ }
52
67
  /**
53
68
  * Request response type definitions
54
69
  */
@@ -1,10 +1,10 @@
1
- import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getIncidentsResponse, getIncidentResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse, createOrderLogisticIncidentThreadParameters, createOrderLogisticIncidentThreadResponse } from "./definitions";
1
+ import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getIncidentsResponse, getIncidentResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse, createOrderLogisticIncidentThreadParameters, createOrderLogisticIncidentThreadResponse, createIncidentParameters, createIncidentResponse } from "./definitions";
2
2
  /**
3
3
  * 🚚 Retrieves a list of incidents based on various filter criteria.
4
4
  *
5
5
  * This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
6
6
  *
7
- * 🛠 **Endpoint**: `GET /v1/shop/incidents [ORDER-559]`
7
+ * 🛠 **Endpoint**: `GET /v1/shop/incidents`
8
8
  *
9
9
  * | Parameter | Type | Required | Description |
10
10
  * |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
@@ -182,3 +182,82 @@ export declare function createOrderLogisticLineIncident({ logisticOrderId, idTyp
182
182
  * @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created thread's details.
183
183
  */
184
184
  export declare function createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }: createOrderLogisticIncidentThreadParameters): Promise<createOrderLogisticIncidentThreadResponse>;
185
+ /**
186
+ * 🚚 Creates a new incident.
187
+ *
188
+ * This function allows the creation of a new incident with various parameters such as custom fields,
189
+ * external ID, logistic order ID, and reason codes.
190
+ *
191
+ * 🛠 **Endpoint**: `POST /v1/shop/incidents [ORDER-560]`
192
+ *
193
+ * | Parameter | Type | Required | Description |
194
+ * |------------------|-------------------------------------|------------|----------------------------------------------------------|
195
+ * | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
196
+ * | `externalId` | `string` | ❌ | An external identifier for the incident. |
197
+ * | `logisticOrderId`| `string` | ❌ | The ID of the logistic order associated with the incident. |
198
+ * | `reasonCodes` | `string[]` | ✅ | The reason codes for the incident. |
199
+ * | `idType` | `IncidentIdType` | ❌ | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID). |
200
+ *
201
+ * 📤 **Returns**:
202
+ * A `Promise<createIncidentResponse>` containing the details of the created incident.
203
+ *
204
+ * 🛠 **Example usage**:
205
+ * ```ts
206
+ * const createdIncident = await createIncident({
207
+ * customField: {
208
+ * customFieldValues: [
209
+ * { customFieldId: "field1", customFieldValue: "value1" }
210
+ * ],
211
+ * idType: "DJUST_ID"
212
+ * },
213
+ * externalId: "EXT-123",
214
+ * logisticOrderId: "order-789",
215
+ * reasonCodes: ["DAMAGED_PRODUCT", "WRONG_QUANTITY"],
216
+ * });
217
+ * ```
218
+ *
219
+ * @param {createIncidentParameters} params - The parameters for creating the incident.
220
+ * @throws {Error} If the required `reasonCodes` parameter is missing.
221
+ * @returns {Promise<createIncidentResponse>} A promise that resolves to the created incident details.
222
+ */
223
+ export declare function createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }: createIncidentParameters): Promise<createIncidentResponse>;
224
+ /**
225
+ * 🚚 Retrieves a list of incidents based on various filter criteria.
226
+ *
227
+ * This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, supplier IDs, status, and sorting preferences.
228
+ *
229
+ * 🛠 **Endpoint**: `GET /v2/shop/incidents` [ORDER-559]
230
+ *
231
+ * | Parameter | Type | Required | Description |
232
+ * |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
233
+ * | `customerAccountIds` | `string[]` | ❌ | List of customer account IDs to filter incidents by. |
234
+ * | `linkedType` | `string` | ✅ | Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
235
+ * | `ids` | `string[]` | ❌ | Specific incident IDs to retrieve. |
236
+ * | `status` | `IncidentStatus[]`| ❌ | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
237
+ * | `idType` | `IncidentIdType` | ❌ | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
238
+ * | `page` | `number` | ❌ | Page number for paginated results (starting at 0). |
239
+ * | `size` | `number` | ❌ | Number of incidents per page. |
240
+ * | `sort` | `string[]` | ❌ | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
241
+ * | `supplierIds` | `string[]` | ❌ | List of supplier IDs to filter incidents by. |
242
+ *
243
+ * 📤 **Returns**:
244
+ * A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
245
+ *
246
+ * 🛠 **Example usage**:
247
+ * ```ts
248
+ * const incidents = await getIncidentsV2({
249
+ * customerAccountIds: ["acc123", "acc456"],
250
+ * linkedType: "ORDER",
251
+ * status: ["OPEN", "ON_GOING"],
252
+ * supplierIds: ["supplier1", "supplier2"],
253
+ * page: 0,
254
+ * size: 10,
255
+ * sort: ["createdAt,desc"],
256
+ * });
257
+ * ```
258
+ *
259
+ * @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
260
+ * @throws {Error} If the required `linkedType` is missing.
261
+ * @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
262
+ */
263
+ export declare function getIncidentsV2({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, supplierIds, }: getIncidentsParameters): Promise<getIncidentsResponse>;
@@ -5,6 +5,8 @@ exports.getIncident = getIncident;
5
5
  exports.createOrderLogisticIncident = createOrderLogisticIncident;
6
6
  exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
7
7
  exports.createOrderLogisticIncidentThread = createOrderLogisticIncidentThread;
8
+ exports.createIncident = createIncident;
9
+ exports.getIncidentsV2 = getIncidentsV2;
8
10
  const parameters_validation_1 = require("../../helpers/parameters-validation");
9
11
  const fetch_instance_1 = require("../../settings/fetch-instance");
10
12
  /**
@@ -12,7 +14,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
12
14
  *
13
15
  * This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
14
16
  *
15
- * 🛠 **Endpoint**: `GET /v1/shop/incidents [ORDER-559]`
17
+ * 🛠 **Endpoint**: `GET /v1/shop/incidents`
16
18
  *
17
19
  * | Parameter | Type | Required | Description |
18
20
  * |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
@@ -262,3 +264,116 @@ async function createOrderLogisticIncidentThread({ logisticOrderId, incidentId,
262
264
  });
263
265
  return data;
264
266
  }
267
+ /**
268
+ * 🚚 Creates a new incident.
269
+ *
270
+ * This function allows the creation of a new incident with various parameters such as custom fields,
271
+ * external ID, logistic order ID, and reason codes.
272
+ *
273
+ * 🛠 **Endpoint**: `POST /v1/shop/incidents [ORDER-560]`
274
+ *
275
+ * | Parameter | Type | Required | Description |
276
+ * |------------------|-------------------------------------|------------|----------------------------------------------------------|
277
+ * | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
278
+ * | `externalId` | `string` | ❌ | An external identifier for the incident. |
279
+ * | `logisticOrderId`| `string` | ❌ | The ID of the logistic order associated with the incident. |
280
+ * | `reasonCodes` | `string[]` | ✅ | The reason codes for the incident. |
281
+ * | `idType` | `IncidentIdType` | ❌ | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID). |
282
+ *
283
+ * 📤 **Returns**:
284
+ * A `Promise<createIncidentResponse>` containing the details of the created incident.
285
+ *
286
+ * 🛠 **Example usage**:
287
+ * ```ts
288
+ * const createdIncident = await createIncident({
289
+ * customField: {
290
+ * customFieldValues: [
291
+ * { customFieldId: "field1", customFieldValue: "value1" }
292
+ * ],
293
+ * idType: "DJUST_ID"
294
+ * },
295
+ * externalId: "EXT-123",
296
+ * logisticOrderId: "order-789",
297
+ * reasonCodes: ["DAMAGED_PRODUCT", "WRONG_QUANTITY"],
298
+ * });
299
+ * ```
300
+ *
301
+ * @param {createIncidentParameters} params - The parameters for creating the incident.
302
+ * @throws {Error} If the required `reasonCodes` parameter is missing.
303
+ * @returns {Promise<createIncidentResponse>} A promise that resolves to the created incident details.
304
+ */
305
+ async function createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }) {
306
+ (0, parameters_validation_1.required)({ reasonCodes });
307
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
308
+ method: "POST",
309
+ path: `/v1/shop/incidents`,
310
+ params: {
311
+ idType,
312
+ },
313
+ body: JSON.stringify({
314
+ customField,
315
+ externalId,
316
+ logisticOrderId,
317
+ reasonCodes,
318
+ }),
319
+ });
320
+ return data;
321
+ }
322
+ /**
323
+ * 🚚 Retrieves a list of incidents based on various filter criteria.
324
+ *
325
+ * This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, supplier IDs, status, and sorting preferences.
326
+ *
327
+ * 🛠 **Endpoint**: `GET /v2/shop/incidents` [ORDER-559]
328
+ *
329
+ * | Parameter | Type | Required | Description |
330
+ * |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
331
+ * | `customerAccountIds` | `string[]` | ❌ | List of customer account IDs to filter incidents by. |
332
+ * | `linkedType` | `string` | ✅ | Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
333
+ * | `ids` | `string[]` | ❌ | Specific incident IDs to retrieve. |
334
+ * | `status` | `IncidentStatus[]`| ❌ | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
335
+ * | `idType` | `IncidentIdType` | ❌ | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
336
+ * | `page` | `number` | ❌ | Page number for paginated results (starting at 0). |
337
+ * | `size` | `number` | ❌ | Number of incidents per page. |
338
+ * | `sort` | `string[]` | ❌ | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
339
+ * | `supplierIds` | `string[]` | ❌ | List of supplier IDs to filter incidents by. |
340
+ *
341
+ * 📤 **Returns**:
342
+ * A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
343
+ *
344
+ * 🛠 **Example usage**:
345
+ * ```ts
346
+ * const incidents = await getIncidentsV2({
347
+ * customerAccountIds: ["acc123", "acc456"],
348
+ * linkedType: "ORDER",
349
+ * status: ["OPEN", "ON_GOING"],
350
+ * supplierIds: ["supplier1", "supplier2"],
351
+ * page: 0,
352
+ * size: 10,
353
+ * sort: ["createdAt,desc"],
354
+ * });
355
+ * ```
356
+ *
357
+ * @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
358
+ * @throws {Error} If the required `linkedType` is missing.
359
+ * @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
360
+ */
361
+ async function getIncidentsV2({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, supplierIds, }) {
362
+ (0, parameters_validation_1.required)({ linkedType });
363
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
364
+ method: "GET",
365
+ path: `/v2/shop/incidents`,
366
+ params: {
367
+ customerAccountIds,
368
+ linkedType,
369
+ ids,
370
+ status,
371
+ idType,
372
+ page,
373
+ size,
374
+ sort,
375
+ supplierIds,
376
+ },
377
+ });
378
+ return data;
379
+ }
@@ -16,6 +16,11 @@ export interface GetLogisticOrdersParameters {
16
16
  page?: number;
17
17
  size?: number;
18
18
  sort?: string[];
19
+ suppliersIds?: string[];
20
+ creationDateFrom?: string;
21
+ creationDateTo?: string;
22
+ updateDateFrom?: string;
23
+ updateDateTo?: string;
19
24
  }
20
25
  export interface GetPaginatedLogisticOrdersParameters {
21
26
  page?: number;
@@ -43,12 +48,14 @@ export interface GetLogisticOrderCustomFieldsParameters {
43
48
  page?: number;
44
49
  size?: number;
45
50
  sort?: string;
51
+ idType?: IdType;
46
52
  }
47
53
  export interface GetLogisticOrderLineCustomFieldsParameters {
48
54
  customFieldIds?: string[];
49
55
  page?: number;
50
56
  size?: number;
51
57
  sort?: string;
58
+ idType?: IdType;
52
59
  }
53
60
  export interface GetLogisticOrderParameters {
54
61
  orderId: string;
@@ -215,10 +222,12 @@ export interface CreateLogisticOrderThreadResponseV2 extends CreateLogisticOrder
215
222
  export interface GetLogisticOrderThreadsParams {
216
223
  logisticOrderId: string;
217
224
  pageable: PageableParameters;
225
+ idType?: IdType;
218
226
  }
219
227
  export interface GetLogisticOrderThreadParams {
220
228
  logisticOrderId: string;
221
229
  threadId: string;
230
+ idType?: IdType;
222
231
  }
223
232
  export interface GetLogisticOrderThreadResponse extends OrderLogisticThreadResponse {
224
233
  }
@@ -246,6 +255,7 @@ export interface CreateLogisticOrderIncidentThreadsParams {
246
255
  message?: string;
247
256
  name?: string;
248
257
  reasonCode: string;
258
+ idType?: IdType;
249
259
  }
250
260
  export interface CreateLogisticOrderIncidentThreadsResponse extends CreateLogisticOrderThreadResponse {
251
261
  }
@@ -253,6 +263,7 @@ export interface GetLogisticOrderIncidentThreadParams {
253
263
  logisticOrderId: string;
254
264
  incidentId: string;
255
265
  threadId: string;
266
+ idType?: IdType;
256
267
  }
257
268
  export interface CreateThreadMessageParams {
258
269
  body?: string;
@@ -262,12 +273,12 @@ export interface CreateLogisticOrderThreadMessagesParams extends GetLogisticOrde
262
273
  }
263
274
  export interface CreateLogisticOrderIncidentThreadMessagesParams extends GetLogisticOrderIncidentThreadParams, CreateThreadMessageParams {
264
275
  }
265
- export interface UpdateTreadMessageParams {
276
+ export interface UpdateThreadMessageParams {
266
277
  messageId: string;
267
278
  customFieldValues: CustomFieldValueRequest[];
268
- idType: IdType;
279
+ idType?: IdType;
269
280
  }
270
- export interface UpdateLogisticOrderIncidentThreadMessageParams extends GetLogisticOrderIncidentThreadParams, UpdateTreadMessageParams {
281
+ export interface UpdateLogisticOrderIncidentThreadMessageParams extends GetLogisticOrderIncidentThreadParams, UpdateThreadMessageParams {
271
282
  }
272
283
  export interface GetLogisticOrderIncidentThreadResponse extends OrderLogisticThreadResponse {
273
284
  }
@@ -277,5 +288,5 @@ export interface CreateLogisticOrderThreadMessagesResponse {
277
288
  }
278
289
  export interface CreateLogisticOrderIncidentThreadMessagesResponse extends CreateLogisticOrderThreadMessagesResponse {
279
290
  }
280
- export interface UpdateLogisticOrderThreadMessageParams extends GetLogisticOrderThreadParams, UpdateTreadMessageParams {
291
+ export interface UpdateLogisticOrderThreadMessageParams extends GetLogisticOrderThreadParams, UpdateThreadMessageParams {
281
292
  }