@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.
@@ -1,56 +1,57 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getOrderLogisticIncidents = getOrderLogisticIncidents;
4
- exports.getOrderLogisticIncident = getOrderLogisticIncident;
5
- exports.getOrderLogisticLineIncidents = getOrderLogisticLineIncidents;
3
+ exports.getIncidents = getIncidents;
4
+ exports.getIncident = getIncident;
6
5
  exports.createOrderLogisticIncident = createOrderLogisticIncident;
7
6
  exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
8
- exports.getCustomerAccountIncidents = getCustomerAccountIncidents;
9
7
  const parameters_validation_1 = require("../../helpers/parameters-validation");
10
8
  const fetch_instance_1 = require("../../settings/fetch-instance");
11
9
  /**
12
- * 🚚 Fetches logistic order incidents.
10
+ * 🚚 Retrieves a list of incidents based on various filter criteria.
13
11
  *
14
- * This function retrieves a paginated list of incidents for a specific logistic order,
15
- * filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
16
- * and validated before the request is executed.
12
+ * This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
17
13
  *
18
- * 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-557]`
14
+ * 🛠 **Endpoint**: `GET /v1/shop/incidents [ORDER-559]`
19
15
  *
20
- * | Parameter | Type | Required | Description |
21
- * |-------------------|---------------------------------|------------|------------------------------------------|
22
- * | `logisticOrderId` | `string` | | The ID of the logistic order to fetch incidents for. |
23
- * | `status` | `IncidentStatus[]` | | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
24
- * | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
25
- * | `page` | `number` | | The page number for pagination. |
26
- * | `size` | `number` | ❌ | The number of results per page. |
27
- * | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
16
+ * | Parameter | Type | Required | Description |
17
+ * |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
18
+ * | `customerAccountIds` | `string[]` | | List of customer account IDs to filter incidents by. |
19
+ * | `linkedType` | `string` | | Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
20
+ * | `ids` | `string[]` | ❌ | Specific incident IDs to retrieve. |
21
+ * | `status` | `IncidentStatus[]`| | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
22
+ * | `idType` | `IncidentIdType` | ❌ | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
23
+ * | `page` | `number` | ❌ | Page number for paginated results (starting at 0). |
24
+ * | `size` | `number` | ❌ | Number of incidents per page. |
25
+ * | `sort` | `string[]` | ❌ | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
28
26
  *
29
27
  * 📤 **Returns**:
30
- * A `Promise` resolving to an array of `IncidentDto` objects representing the incidents.
28
+ * A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
31
29
  *
32
30
  * 🛠 **Example usage**:
33
31
  * ```ts
34
- * const incidents = await getOrderLogisticIncidents({
35
- * logisticOrderId: "12345",
36
- * status: ["OPEN", "CLOSED"],
37
- * idType: "EXTERNAL_ID",
38
- * page: 1,
32
+ * const incidents = await getIncidents({
33
+ * customerAccountIds: ["acc123", "acc456"],
34
+ * linkedType: "ORDER",
35
+ * status: ["OPEN", "ON_GOING"],
36
+ * page: 0,
39
37
  * size: 10,
40
38
  * sort: ["createdAt,desc"],
41
39
  * });
42
40
  * ```
43
41
  *
44
- * @param {getOrderLogisticIncidentsParameters} params - The parameters for the request.
45
- * @throws {Error} If `logisticOrderId` is missing.
46
- * @returns {Promise<getOrderLogisticIncidentsResponse>} A promise resolving to the response containing the incidents.
42
+ * @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
43
+ * @throws {Error} If the required `linkedType` is missing.
44
+ * @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
47
45
  */
48
- async function getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }) {
49
- (0, parameters_validation_1.required)({ logisticOrderId });
46
+ async function getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }) {
47
+ (0, parameters_validation_1.required)({ linkedType });
50
48
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
51
49
  method: "GET",
52
- path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents`,
50
+ path: `/v1/shop/incidents`,
53
51
  params: {
52
+ customerAccountIds,
53
+ linkedType,
54
+ ids,
54
55
  status,
55
56
  idType,
56
57
  page,
@@ -61,101 +62,43 @@ async function getOrderLogisticIncidents({ logisticOrderId, status, idType, page
61
62
  return data;
62
63
  }
63
64
  /**
64
- * 🚚 Fetches a specific logistic order incident.
65
+ * 🚚 Retrieves details of a specific incident.
65
66
  *
66
- * This function retrieves a specific incident for a logistic order, identified by both
67
- * the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
68
- * before the request is executed.
67
+ * This function fetches detailed information about an incident identified by its ID, with an optional ID type for filtering.
69
68
  *
70
- * 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/{incidentId} [ORDER-503]`
69
+ * 🛠 **Endpoint**: `GET /v1/shop/incidents/{incidentId} [ORDER-503]`
71
70
  *
72
- * | Parameter | Type | Required | Description |
73
- * |-------------------|---------------------------------|------------|------------------------------------------|
74
- * | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch the incident for. |
75
- * | `incidentId` | `string` | | The ID of the specific incident to fetch. |
76
- * | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
71
+ * | Parameter | Type | Required | Description |
72
+ * |--------------|-------------------|----------|------------------------------------------------------------------|
73
+ * | `incidentId` | `string` | ✅ | The unique identifier of the incident to retrieve. |
74
+ * | `idType` | `IncidentIdType` | | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID) for the incident. |
77
75
  *
78
76
  * 📤 **Returns**:
79
- * A `Promise` resolving to a single `getOrderLogisticIncidentResponse` object representing the incident.
77
+ * A `Promise<getIncidentResponse>` containing the details of the specified incident.
80
78
  *
81
79
  * 🛠 **Example usage**:
82
80
  * ```ts
83
- * const incident = await getOrderLogisticIncident({
84
- * logisticOrderId: "12345",
85
- * incidentId: "incident_1",
81
+ * const incident = await getIncident({
82
+ * incidentId: "incident123",
86
83
  * idType: "EXTERNAL_ID",
87
84
  * });
88
85
  * ```
89
86
  *
90
- * @param {getOrderLogisticIncidentParameters} params - The parameters for the request.
91
- * @throws {Error} If `logisticOrderId` or `incidentId` is missing.
92
- * @returns {Promise<getOrderLogisticIncidentResponse>} A promise resolving to the response containing the incident.
87
+ * @param {getIncidentParameters} params - The parameters for identifying the incident.
88
+ * @throws {Error} If the required `incidentId` is missing.
89
+ * @returns {Promise<getIncidentResponse>} A promise that resolves to the incident details.
93
90
  */
94
- async function getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }) {
95
- (0, parameters_validation_1.required)({ logisticOrderId, incidentId });
91
+ async function getIncident({ incidentId, idType, }) {
92
+ (0, parameters_validation_1.required)({ incidentId });
96
93
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
97
94
  method: "GET",
98
- path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}`,
95
+ path: `/v1/shop/incidents/${incidentId}`,
99
96
  params: {
100
97
  idType,
101
98
  },
102
99
  });
103
100
  return data;
104
101
  }
105
- /**
106
- * 🚚 Fetches incidents for a specific line of a logistic order.
107
- *
108
- * This function retrieves a list of incidents for a specific line in a logistic order,
109
- * filtered by status and other parameters. The `logisticOrderId` and `lineId` parameters
110
- * are mandatory and validated before the request is executed.
111
- *
112
- * 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/lines/{lineId} [ORDER-559]`
113
- *
114
- * | Parameter | Type | Required | Description |
115
- * |-------------------|---------------------------------|------------|------------------------------------------|
116
- * | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
117
- * | `lineId` | `string` | ✅ | The ID of the line in the logistic order to fetch incidents for. |
118
- * | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
119
- * | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
120
- * | `page` | `number` | ❌ | The page number for pagination. |
121
- * | `size` | `number` | ❌ | The number of results per page. |
122
- * | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
123
- *
124
- * 📤 **Returns**:
125
- * A `Promise` resolving to an array of `getOrderLogisticLineIncidentsResponse` objects representing the incidents.
126
- *
127
- * 🛠 **Example usage**:
128
- * ```ts
129
- * const incidents = await getOrderLogisticLineIncidents({
130
- * logisticOrderId: "12345",
131
- * lineId: "line_1",
132
- * status: ["OPEN"],
133
- * idType: "EXTERNAL_ID",
134
- * page: 1,
135
- * size: 10,
136
- * sort: ["createdAt,desc"],
137
- * });
138
- * ```
139
- *
140
- * @param {getOrderLogisticLineIncidentsParameters} params - The parameters for the request.
141
- * @throws {Error} If `logisticOrderId` or `lineId` is missing.
142
- * @returns {Promise<getOrderLogisticLineIncidentsResponse>} A promise resolving to the response containing the incidents.
143
- */
144
- async function getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }) {
145
- (0, parameters_validation_1.required)({ logisticOrderId, lineId });
146
- const { data } = await (0, fetch_instance_1.enhancedFetch)({
147
- method: "GET",
148
- path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/lines/${lineId}`,
149
- params: {
150
- status,
151
- idType,
152
- page,
153
- size,
154
- sort,
155
- },
156
- });
157
- return data;
158
- }
159
102
  /**
160
103
  * 🚚 Creates a new incident for a specific logistic order.
161
104
  *
@@ -259,53 +202,3 @@ async function createOrderLogisticLineIncident({ logisticOrderId, idType, custom
259
202
  });
260
203
  return data;
261
204
  }
262
- /**
263
- * 🧑‍💼 Fetches incidents for a specific customer account.
264
- *
265
- * This function retrieves incidents associated with a particular customer account,
266
- * using parameters such as `status`, `page`, `size`, and `sort` to filter and paginate the results.
267
- * The `customerAccountId` is a mandatory parameter and is validated before making the request.
268
- *
269
- * 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/{customerAccountId}/incidents [ACCOUNT-551]`
270
- *
271
- * | Parameter | Type | Required | Description |
272
- * |-------------------|---------------------------------|------------|------------------------------------------|
273
- * | `customerAccountId`| `string` | ✅ | The ID of the customer account for which incidents are to be fetched. |
274
- * | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents by (e.g., `["OPEN"]`). |
275
- * | `page` | `number` | ❌ | The page number for pagination. |
276
- * | `size` | `number` | ❌ | The number of results per page. |
277
- * | `sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
278
- *
279
- * 📤 **Returns**:
280
- * A `Promise` resolving to an array of `getCustomerAccountIncidentsResponse` objects,
281
- * representing the incidents for the given customer account.
282
- *
283
- * 🛠 **Example usage**:
284
- * ```ts
285
- * const incidents = await getCustomerAccountIncidents({
286
- * customerAccountId: "98765",
287
- * status: ["OPEN"],
288
- * page: 1,
289
- * size: 10,
290
- * sort: ["createdAt,desc"],
291
- * });
292
- * ```
293
- *
294
- * @param {getCustomerAccountIncidentsParameters} params - The parameters for the request.
295
- * @throws {Error} If `customerAccountId` is missing.
296
- * @returns {Promise<getCustomerAccountIncidentsResponse>} A promise resolving to the incidents response.
297
- */
298
- async function getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }) {
299
- (0, parameters_validation_1.required)({ customerAccountId });
300
- const { data } = await (0, fetch_instance_1.enhancedFetch)({
301
- method: "GET",
302
- path: `/v1/shop/customer-accounts/${customerAccountId}/incidents`,
303
- params: {
304
- status,
305
- page,
306
- size,
307
- sort,
308
- },
309
- });
310
- return data;
311
- }
@@ -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>;