@djust-b2b/djust-front-sdk 2.16.1 → 2.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.ts CHANGED
@@ -35,7 +35,7 @@ export declare const DjustSDK: {
35
35
  createOrderLogisticIncidentThread({ logisticOrderId, incidentId, idType, customField, message, name, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentThreadParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentThreadResponse>;
36
36
  createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }: import("./services/incident/definitions").createIncidentParameters): Promise<import("./services/incident/definitions").createIncidentResponse>;
37
37
  getCommercialOrders({ locale, nbPreviewLines, page, size, sort, connectedUserOnly, customerAccountIds, sourceTypes, isValidated, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
38
- getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersV2Parameters): Promise<import("./interfaces").GetCommercialOrdersV2Response>;
38
+ getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, cf, }: import("./interfaces").GetCommercialOrdersV2Parameters): Promise<import("./interfaces").GetCommercialOrdersV2Response>;
39
39
  createCommercialOrder({ nbPreviewLines, channel, customFields, locale, origin, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
40
40
  createCommercialOrderV2({ customFieldIdType, customFields, isFull, sourceId, sourceType, }: import("./interfaces").CreateCommercialOrderV2Parameters): Promise<import("./interfaces").CreateCommercialOrderV2Response>;
41
41
  getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
@@ -101,7 +101,7 @@ export declare const DjustSDK: {
101
101
  createMasterQuote({ description, name, }: import("./interfaces").CreateMasterQuoteParameters): Promise<import("./interfaces").CreateMasterQuoteResponse>;
102
102
  deleteMasterQuote({ masterQuoteId, }: import("./interfaces").DeleteMasterQuoteParameters): Promise<void>;
103
103
  getMasterQuote({ masterQuoteId, }: import("./interfaces").GetMasterQuoteParameters): Promise<import("./interfaces").GetMasterQuoteResponse>;
104
- updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, }: import("./interfaces").UpdateMasterQuoteParameters): Promise<import("./interfaces").UpdateMasterQuoteResponse>;
104
+ updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, idType, }: import("./interfaces").UpdateMasterQuoteParameters): Promise<import("./interfaces").UpdateMasterQuoteResponse>;
105
105
  createSupplierQuotes({ billingAddressId, createSupplierQuoteRequests, masterQuoteId, supplierQuoteUrl, }: import("./interfaces").CreateSupplierQuotesParameters): Promise<import("./interfaces").CreateSupplierQuotesResponse>;
106
106
  getSupplierQuote({ supplierQuoteId, }: import("./interfaces").GetSupplierQuoteParameters): Promise<import("./interfaces").GetSupplierQuoteResponse>;
107
107
  acceptSupplierQuote({ supplierQuoteId, }: import("./interfaces").AcceptSupplierQuoteParameters): Promise<import("./interfaces").AcceptSupplierQuoteResponse>;
@@ -28,6 +28,7 @@ export interface GetCommercialOrdersV2Parameters {
28
28
  sourceIds?: string[];
29
29
  isValidated?: boolean;
30
30
  nbPreviewLines?: number;
31
+ cf?: string[];
31
32
  }
32
33
  export interface GetOrderCommercialLinesParameters {
33
34
  commercialOrderId: string;
@@ -47,20 +47,28 @@ export declare function getCommercialOrders({ locale, nbPreviewLines, page, size
47
47
  * This function retrieves all commercial orders (Version 2). The parameter locale is mandatory and validated
48
48
  * before the request is executed.
49
49
  *
50
- * 🛠 **Endpoint**: `GET /v2/shop/commercial-orders [ORDER-560-v2]`
50
+ * 🛠 **Endpoint**: `GET /v2/shop/commercial-orders [ORDER-560]`
51
51
  *
52
52
  * | Parameter | Type | Required | Description |
53
53
  * |------------------------|---------------------|----------|------------------------------------------|
54
54
  * | `page` | `number` | ❌ | The page number to retrieve. |
55
55
  * | `size` | `number` | ❌ | The number of items per page. |
56
- * | `sort` | `string[]` | ❌ | The sort to apply to the results. |
57
- * | `locale` | `string` | ✅ | The locale in which to return the commercial order. |
56
+ * | `sort` | `string[]` | ❌ | The sort to apply to the results. Format: `field:direction` (e.g., `["createdAt:desc", "reference:asc"]`). Supported fields: `createdAt`, `validatedAt`, `updatedAt`, `sourceType`, `sourceId`, `reference`. |
57
+ * | `locale` | `string` | ✅ | The locale (IETF BCP 47) in which to return the commercial order. |
58
58
  * | `connectedUserOnly` | `boolean` | ❌ | Filter to show only orders for the connected user. |
59
59
  * | `customerAccountIds` | `string[]` | ❌ | Filter by customer account IDs. |
60
60
  * | `sourceTypes` | `string[]` | ❌ | Filter by source types. |
61
61
  * | `sourceIds` | `string[]` | ❌ | Filter by source IDs. |
62
62
  * | `isValidated` | `boolean` | ❌ | Filter by validation status. |
63
63
  * | `nbPreviewLines` | `number` | ❌ | The number of lines to display in the commercial order. |
64
+ * | `cf` | `string[]` | ❌ | Custom field filtering. Format: `<CF_EXTERNAL_ID>|<CF_VALUE>`. AND between different CF external IDs; OR between multiple values of the same CF. |
65
+ *
66
+ * **Filters**: AND between different keys; OR between values of the same key.
67
+ * Unknown or malformed values are silently ignored; empty lists mean no filter.
68
+ *
69
+ * **Sorting**: Multiple criteria supported (comma-separated). Default: `createdAt:desc` then `reference:asc` as tie-breaker.
70
+ * Invalid/malformed sort entries are silently ignored. When sorting by reference, collation is case-insensitive and locale-aware.
71
+ * Null values are always placed last, regardless of sort direction.
64
72
  *
65
73
  * 📤 **Returns**:
66
74
  * A `Promise` resolving to a single `GetCommercialOrdersV2Response` object representing the page of commercial orders.
@@ -71,8 +79,9 @@ export declare function getCommercialOrders({ locale, nbPreviewLines, page, size
71
79
  * locale: "fr",
72
80
  * page: 0,
73
81
  * size: 20,
74
- * sort: ["createdAt,desc"],
75
- * connectedUserOnly: true
82
+ * sort: ["createdAt:desc", "reference:asc"],
83
+ * connectedUserOnly: true,
84
+ * cf: ["customField1|value1", "customField1|value2", "customField2|value3"]
76
85
  * });
77
86
  * ```
78
87
  *
@@ -80,7 +89,7 @@ export declare function getCommercialOrders({ locale, nbPreviewLines, page, size
80
89
  * @throws {Error} If `locale` is missing.
81
90
  * @returns {Promise<GetCommercialOrdersV2Response>} A promise resolving to the response containing page object.
82
91
  */
83
- export declare function getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, }: GetCommercialOrdersV2Parameters): Promise<GetCommercialOrdersV2Response>;
92
+ export declare function getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, cf, }: GetCommercialOrdersV2Parameters): Promise<GetCommercialOrdersV2Response>;
84
93
  /**
85
94
  * 🚚 Creates commercial orders.
86
95
  *
@@ -89,20 +89,28 @@ async function getCommercialOrders({ locale, nbPreviewLines, page, size, sort, c
89
89
  * This function retrieves all commercial orders (Version 2). The parameter locale is mandatory and validated
90
90
  * before the request is executed.
91
91
  *
92
- * 🛠 **Endpoint**: `GET /v2/shop/commercial-orders [ORDER-560-v2]`
92
+ * 🛠 **Endpoint**: `GET /v2/shop/commercial-orders [ORDER-560]`
93
93
  *
94
94
  * | Parameter | Type | Required | Description |
95
95
  * |------------------------|---------------------|----------|------------------------------------------|
96
96
  * | `page` | `number` | ❌ | The page number to retrieve. |
97
97
  * | `size` | `number` | ❌ | The number of items per page. |
98
- * | `sort` | `string[]` | ❌ | The sort to apply to the results. |
99
- * | `locale` | `string` | ✅ | The locale in which to return the commercial order. |
98
+ * | `sort` | `string[]` | ❌ | The sort to apply to the results. Format: `field:direction` (e.g., `["createdAt:desc", "reference:asc"]`). Supported fields: `createdAt`, `validatedAt`, `updatedAt`, `sourceType`, `sourceId`, `reference`. |
99
+ * | `locale` | `string` | ✅ | The locale (IETF BCP 47) in which to return the commercial order. |
100
100
  * | `connectedUserOnly` | `boolean` | ❌ | Filter to show only orders for the connected user. |
101
101
  * | `customerAccountIds` | `string[]` | ❌ | Filter by customer account IDs. |
102
102
  * | `sourceTypes` | `string[]` | ❌ | Filter by source types. |
103
103
  * | `sourceIds` | `string[]` | ❌ | Filter by source IDs. |
104
104
  * | `isValidated` | `boolean` | ❌ | Filter by validation status. |
105
105
  * | `nbPreviewLines` | `number` | ❌ | The number of lines to display in the commercial order. |
106
+ * | `cf` | `string[]` | ❌ | Custom field filtering. Format: `<CF_EXTERNAL_ID>|<CF_VALUE>`. AND between different CF external IDs; OR between multiple values of the same CF. |
107
+ *
108
+ * **Filters**: AND between different keys; OR between values of the same key.
109
+ * Unknown or malformed values are silently ignored; empty lists mean no filter.
110
+ *
111
+ * **Sorting**: Multiple criteria supported (comma-separated). Default: `createdAt:desc` then `reference:asc` as tie-breaker.
112
+ * Invalid/malformed sort entries are silently ignored. When sorting by reference, collation is case-insensitive and locale-aware.
113
+ * Null values are always placed last, regardless of sort direction.
106
114
  *
107
115
  * 📤 **Returns**:
108
116
  * A `Promise` resolving to a single `GetCommercialOrdersV2Response` object representing the page of commercial orders.
@@ -113,8 +121,9 @@ async function getCommercialOrders({ locale, nbPreviewLines, page, size, sort, c
113
121
  * locale: "fr",
114
122
  * page: 0,
115
123
  * size: 20,
116
- * sort: ["createdAt,desc"],
117
- * connectedUserOnly: true
124
+ * sort: ["createdAt:desc", "reference:asc"],
125
+ * connectedUserOnly: true,
126
+ * cf: ["customField1|value1", "customField1|value2", "customField2|value3"]
118
127
  * });
119
128
  * ```
120
129
  *
@@ -122,7 +131,7 @@ async function getCommercialOrders({ locale, nbPreviewLines, page, size, sort, c
122
131
  * @throws {Error} If `locale` is missing.
123
132
  * @returns {Promise<GetCommercialOrdersV2Response>} A promise resolving to the response containing page object.
124
133
  */
125
- async function getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, }) {
134
+ async function getCommercialOrdersV2({ page, size, sort, locale, connectedUserOnly, customerAccountIds, sourceTypes, sourceIds, isValidated, nbPreviewLines, cf, }) {
126
135
  (0, parameters_validation_1.required)({ locale });
127
136
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
128
137
  method: "GET",
@@ -138,6 +147,7 @@ async function getCommercialOrdersV2({ page, size, sort, locale, connectedUserOn
138
147
  sourceIds,
139
148
  isValidated,
140
149
  nbPreviewLines,
150
+ cf,
141
151
  },
142
152
  });
143
153
  return data;
@@ -1,6 +1,6 @@
1
1
  import { MasterQuote, PageMasterQuote, SupplierQuoteDto, SupplierQuoteIdType } from "../../interfaces/models/quote";
2
2
  import { OrderCommercialDto } from "../../interfaces/models/order";
3
- import { PageableParameters } from "../../interfaces/models/common";
3
+ import { IdType, PageableParameters } from "../../interfaces/models/common";
4
4
  import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
5
5
  /**
6
6
  * Request parameters type definitions
@@ -30,6 +30,8 @@ export interface UpdateMasterQuoteParameters {
30
30
  quantity: number;
31
31
  }[];
32
32
  masterQuoteDetailsToRemove: string[];
33
+ /** Type des productVariantId dans masterQuoteDetailsToAdd (ex. EXTERNAL_ID pour utiliser des externalId). */
34
+ idType?: IdType;
33
35
  }
34
36
  export interface CreateSupplierQuotesParameters {
35
37
  billingAddressId?: string;
@@ -129,6 +129,7 @@ export declare function getMasterQuote({ masterQuoteId, }: GetMasterQuoteParamet
129
129
  * | `customFieldValues` | `{ customFieldId: string; customFieldValue?: string; }[]` | ❌ | Custom field values to update for the master quote. |
130
130
  * | `masterQuoteDetailsToAdd` | `{ productVariantId: string; quantity: number; }[]` | ❌ | Details to add to the master quote. |
131
131
  * | `masterQuoteDetailsToRemove` | `string[]` | ❌ | IDs of details to remove from the master quote. |
132
+ * | `idType` | `"DJUST_ID" \| "EXTERNAL_ID"` | ❌ | Query param: type for productVariantId and customField id. Default BUSINESS_ID (Swagger: DJUST_ID). |
132
133
  *
133
134
  * 📤 **Returns**:
134
135
  * A `Promise` resolving to an `UpdateMasterQuoteResponse` object, which contains the updated details of the master quote.
@@ -149,7 +150,7 @@ export declare function getMasterQuote({ masterQuoteId, }: GetMasterQuoteParamet
149
150
  * @throws {Error} If `masterQuoteId` is missing.
150
151
  * @returns {Promise<UpdateMasterQuoteResponse>} A promise resolving to the updated details of the master quote.
151
152
  */
152
- export declare function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, }: UpdateMasterQuoteParameters): Promise<UpdateMasterQuoteResponse>;
153
+ export declare function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, idType, }: UpdateMasterQuoteParameters): Promise<UpdateMasterQuoteResponse>;
153
154
  /**
154
155
  * ✏️ Creates supplier quotes.
155
156
  *
@@ -180,6 +180,7 @@ async function getMasterQuote({ masterQuoteId, }) {
180
180
  * | `customFieldValues` | `{ customFieldId: string; customFieldValue?: string; }[]` | ❌ | Custom field values to update for the master quote. |
181
181
  * | `masterQuoteDetailsToAdd` | `{ productVariantId: string; quantity: number; }[]` | ❌ | Details to add to the master quote. |
182
182
  * | `masterQuoteDetailsToRemove` | `string[]` | ❌ | IDs of details to remove from the master quote. |
183
+ * | `idType` | `"DJUST_ID" \| "EXTERNAL_ID"` | ❌ | Query param: type for productVariantId and customField id. Default BUSINESS_ID (Swagger: DJUST_ID). |
183
184
  *
184
185
  * 📤 **Returns**:
185
186
  * A `Promise` resolving to an `UpdateMasterQuoteResponse` object, which contains the updated details of the master quote.
@@ -200,11 +201,12 @@ async function getMasterQuote({ masterQuoteId, }) {
200
201
  * @throws {Error} If `masterQuoteId` is missing.
201
202
  * @returns {Promise<UpdateMasterQuoteResponse>} A promise resolving to the updated details of the master quote.
202
203
  */
203
- async function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, }) {
204
+ async function updateMasterQuote({ masterQuoteId, customFieldValues, masterQuoteDetailsToAdd, masterQuoteDetailsToRemove, idType, }) {
204
205
  (0, parameters_validation_1.required)({ masterQuoteId });
205
206
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
206
207
  method: "PUT",
207
208
  path: `/v1/shop/master-quotes/${masterQuoteId}`,
209
+ params: idType ? { idType } : {},
208
210
  body: JSON.stringify({
209
211
  masterQuoteDetailsToAdd,
210
212
  masterQuoteDetailsToRemove,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "2.16.1",
3
+ "version": "2.17.1",
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",