@djust-b2b/djust-front-sdk 1.17.2 → 1.18.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.
package/lib/index.d.ts CHANGED
@@ -25,6 +25,7 @@ export declare const DjustSDK: {
25
25
  getIncident({ incidentId, idType, }: import("./services/incident/definitions").getIncidentParameters): Promise<import("./services/incident/definitions").getIncidentResponse>;
26
26
  createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentResponse>;
27
27
  createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: import("./services/incident/definitions").createOrderLogisticLineIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticLineIncidentResponse>;
28
+ createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentThreadParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentThreadResponse>;
28
29
  getCommercialOrders({ locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
29
30
  createCommercialOrder({ nbPreviewLines, channel, customFields, locale, origin, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
30
31
  getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
@@ -28,3 +28,9 @@ export interface IncidentCreatedDto {
28
28
  externalId: string;
29
29
  incidentId: string;
30
30
  }
31
+ export interface IncidentThreadDto {
32
+ messageExternalId: string;
33
+ messageId: string;
34
+ threadExternalId: string;
35
+ threadId: string;
36
+ }
@@ -101,6 +101,7 @@ async function createCommercialOrder({ nbPreviewLines, channel, customFields, lo
101
101
  channel,
102
102
  customFields,
103
103
  locale,
104
+ origin,
104
105
  originId,
105
106
  paymentInfo,
106
107
  }),
@@ -1,4 +1,4 @@
1
- import { IncidentDto, IncidentStatus, IncidentIdType, IncidentLogisticOrder, IncidentCreatedDto } from "../../interfaces/models/incident";
1
+ import { IncidentDto, IncidentStatus, IncidentIdType, IncidentLogisticOrder, IncidentCreatedDto, IncidentThreadDto } from "../../interfaces/models/incident";
2
2
  import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
3
3
  /**
4
4
  * Request parameters type definitions
@@ -37,6 +37,18 @@ export interface createOrderLogisticLineIncidentParameters {
37
37
  }[];
38
38
  reasonCode: string[];
39
39
  }
40
+ export interface createOrderLogisticIncidentThreadParameters {
41
+ logisticOrderId: string;
42
+ incidentId: string;
43
+ idType: IncidentIdType;
44
+ customField: {
45
+ customFieldValues: CustomFieldValueRequest[];
46
+ idType: IncidentIdType;
47
+ };
48
+ name: string;
49
+ message: string;
50
+ reasonCode: string[];
51
+ }
40
52
  /**
41
53
  * Request response type definitions
42
54
  */
@@ -48,3 +60,5 @@ export interface createOrderLogisticIncidentResponse extends IncidentCreatedDto
48
60
  }
49
61
  export interface createOrderLogisticLineIncidentResponse extends IncidentCreatedDto {
50
62
  }
63
+ export interface createOrderLogisticIncidentThreadResponse extends IncidentThreadDto {
64
+ }
@@ -1,4 +1,4 @@
1
- import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getIncidentsResponse, getIncidentResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse } from "./definitions";
1
+ import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getIncidentsResponse, getIncidentResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse, createOrderLogisticIncidentThreadParameters, createOrderLogisticIncidentThreadResponse } from "./definitions";
2
2
  /**
3
3
  * 🚚 Retrieves a list of incidents based on various filter criteria.
4
4
  *
@@ -139,3 +139,46 @@ export declare function createOrderLogisticIncident({ logisticOrderId, idType, c
139
139
  * @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
140
140
  */
141
141
  export declare function createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: createOrderLogisticLineIncidentParameters): Promise<createOrderLogisticLineIncidentResponse>;
142
+ /**
143
+ * 🚚 Creates a new incident thread for a specific logistic order on specific lines.
144
+ *
145
+ * This function allows the creation of a thread related to an incident for one or more lines within a logistic order.
146
+ * The `logisticOrderId`, `incidentId`, `customField`, `reasonCode` and `message` are required parameters.
147
+ * The `idType` is used for specifying additional information about the thread.
148
+ *
149
+ * 🛠 **Endpoint**: `POST /v2/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}/threads [ORDER-106]`
150
+ *
151
+ * | Parameter | Type | Required | Description |
152
+ * |--------------------|-------------------------------------|------------|----------------------------------------------------------|
153
+ * | `logisticOrderId` | `string` | ✅ | The ID of the logistic order on which the incident happened. |
154
+ * | `incidentId` | `string` | ✅ | The ID of the incident for which thread is created. |
155
+ * | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
156
+ * | `name` | `string` | ❌ | The name of the created thread. |
157
+ * | `message` | `string` | ✅ | The message of the created thread. |
158
+ * | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: string}[]` | ✅ | An array of objects describing the custom field values to add to the thread. |
159
+ * | `reasonCode` | `string[]` | ✅ | The reason codes for the incident related to the thread (e.g., `["PRODUCT_DEFECT"]`). |
160
+ *
161
+ * 📤 **Returns**:
162
+ * A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
163
+ * containing the `threadId` and `threadExternalId`, and the `messageId` and `messageExternalId` of the created thread.
164
+ *
165
+ * 🛠 **Example usage**:
166
+ * ```ts
167
+ * const incident = await createOrderLogisticLineIncident({
168
+ * logisticOrderId: "12345",
169
+ * incidentId: "6789",
170
+ * idType: "EXTERNAL_ID",
171
+ * customField: [
172
+ * { customFieldValues: [], idType: "DJUST_ID" }
173
+ * ],
174
+ * reasonCode: ["PRODUCT_DEFECT"],
175
+ * name: "thread1",
176
+ * message: "Message related to thread1"
177
+ * });
178
+ * ```
179
+ *
180
+ * @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the thread.
181
+ * @throws {Error} If `logisticOrderId`, `incidentId`, `customField`, `reasonCode` or `message` is missing.
182
+ * @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created thread's details.
183
+ */
184
+ export declare function createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }: createOrderLogisticIncidentThreadParameters): Promise<createOrderLogisticIncidentThreadResponse>;
@@ -4,6 +4,7 @@ exports.getIncidents = getIncidents;
4
4
  exports.getIncident = getIncident;
5
5
  exports.createOrderLogisticIncident = createOrderLogisticIncident;
6
6
  exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
7
+ exports.createOrderLogisticIncidentThread = createOrderLogisticIncidentThread;
7
8
  const parameters_validation_1 = require("../../helpers/parameters-validation");
8
9
  const fetch_instance_1 = require("../../settings/fetch-instance");
9
10
  /**
@@ -202,3 +203,62 @@ async function createOrderLogisticLineIncident({ logisticOrderId, idType, custom
202
203
  });
203
204
  return data;
204
205
  }
206
+ /**
207
+ * 🚚 Creates a new incident thread for a specific logistic order on specific lines.
208
+ *
209
+ * This function allows the creation of a thread related to an incident for one or more lines within a logistic order.
210
+ * The `logisticOrderId`, `incidentId`, `customField`, `reasonCode` and `message` are required parameters.
211
+ * The `idType` is used for specifying additional information about the thread.
212
+ *
213
+ * 🛠 **Endpoint**: `POST /v2/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}/threads [ORDER-106]`
214
+ *
215
+ * | Parameter | Type | Required | Description |
216
+ * |--------------------|-------------------------------------|------------|----------------------------------------------------------|
217
+ * | `logisticOrderId` | `string` | ✅ | The ID of the logistic order on which the incident happened. |
218
+ * | `incidentId` | `string` | ✅ | The ID of the incident for which thread is created. |
219
+ * | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
220
+ * | `name` | `string` | ❌ | The name of the created thread. |
221
+ * | `message` | `string` | ✅ | The message of the created thread. |
222
+ * | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: string}[]` | ✅ | An array of objects describing the custom field values to add to the thread. |
223
+ * | `reasonCode` | `string[]` | ✅ | The reason codes for the incident related to the thread (e.g., `["PRODUCT_DEFECT"]`). |
224
+ *
225
+ * 📤 **Returns**:
226
+ * A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
227
+ * containing the `threadId` and `threadExternalId`, and the `messageId` and `messageExternalId` of the created thread.
228
+ *
229
+ * 🛠 **Example usage**:
230
+ * ```ts
231
+ * const incident = await createOrderLogisticLineIncident({
232
+ * logisticOrderId: "12345",
233
+ * incidentId: "6789",
234
+ * idType: "EXTERNAL_ID",
235
+ * customField: [
236
+ * { customFieldValues: [], idType: "DJUST_ID" }
237
+ * ],
238
+ * reasonCode: ["PRODUCT_DEFECT"],
239
+ * name: "thread1",
240
+ * message: "Message related to thread1"
241
+ * });
242
+ * ```
243
+ *
244
+ * @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the thread.
245
+ * @throws {Error} If `logisticOrderId`, `incidentId`, `customField`, `reasonCode` or `message` is missing.
246
+ * @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created thread's details.
247
+ */
248
+ async function createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }) {
249
+ (0, parameters_validation_1.required)({ logisticOrderId, incidentId, reasonCode, message, name });
250
+ const { data } = await (0, fetch_instance_1.enhancedFetch)({
251
+ method: "POST",
252
+ path: `/v2/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}/threads`,
253
+ params: {
254
+ idType,
255
+ },
256
+ body: JSON.stringify({
257
+ customField,
258
+ message,
259
+ name,
260
+ reasonCode,
261
+ }),
262
+ });
263
+ return data;
264
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "DJUST Front SDK is a versatile JavaScript Software Development Kit (SDK) ",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",