@djust-b2b/djust-front-sdk 2.1.0 → 2.1.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 +21 -15
- package/lib/interfaces/models/attribute.d.ts +12 -2
- package/lib/interfaces/models/custom-field.d.ts +4 -0
- package/lib/interfaces/models/customer-account.d.ts +1 -0
- package/lib/interfaces/models/offer.d.ts +9 -0
- package/lib/interfaces/models/payment.d.ts +1 -0
- package/lib/services/attributes/definitions.d.ts +27 -0
- package/lib/services/attributes/definitions.js +2 -0
- package/lib/services/attributes/index.d.ts +32 -0
- package/lib/services/attributes/index.js +49 -0
- package/lib/services/auth/definitions.d.ts +39 -0
- package/lib/services/auth/definitions.requests.d.ts +4 -0
- package/lib/services/auth/index.d.ts +58 -3
- package/lib/services/auth/index.js +72 -2
- package/lib/services/cart/index.js +1 -0
- package/lib/services/custom-field/definitions.d.ts +6 -0
- package/lib/services/custom-field/index.d.ts +38 -1
- package/lib/services/custom-field/index.js +48 -2
- package/lib/services/customer-account/definitions.d.ts +15 -2
- package/lib/services/customer-account/index.d.ts +47 -5
- package/lib/services/customer-account/index.js +68 -5
- package/lib/services/customer-user/definitions.d.ts +2 -0
- package/lib/services/customer-user/index.d.ts +1 -1
- package/lib/services/customer-user/index.js +4 -1
- package/lib/services/incident/definitions.d.ts +14 -0
- package/lib/services/incident/index.d.ts +40 -1
- package/lib/services/incident/index.js +56 -0
- package/lib/services/logistic-order/definitions.d.ts +15 -4
- package/lib/services/logistic-order/index.d.ts +19 -10
- package/lib/services/logistic-order/index.js +40 -17
- package/lib/services/navigation-category/definitions.d.ts +7 -0
- package/lib/services/navigation-category/index.d.ts +33 -1
- package/lib/services/navigation-category/index.js +40 -0
- package/lib/services/offer-inventories/index.js +3 -3
- package/lib/services/offer-prices/definitions.d.ts +23 -0
- package/lib/services/offer-prices/definitions.js +2 -0
- package/lib/services/offer-prices/index.d.ts +35 -0
- package/lib/services/offer-prices/index.js +52 -0
- package/lib/services/product/definitions.d.ts +5 -0
- package/lib/services/product/index.d.ts +6 -29
- package/lib/services/product/index.js +8 -42
- package/lib/services/product-variant/definitions.d.ts +27 -0
- package/lib/services/product-variant/index.d.ts +30 -1
- package/lib/services/product-variant/index.js +40 -0
- package/package.json +1 -1
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getCustomFields = getCustomFields;
|
|
4
4
|
exports.postMediaCustomField = postMediaCustomField;
|
|
5
|
+
exports.getMediaUrl = getMediaUrl;
|
|
5
6
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
6
7
|
/**
|
|
7
8
|
* 📋 Retrieves custom fields.
|
|
@@ -41,7 +42,7 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
|
41
42
|
async function getCustomFields(params) {
|
|
42
43
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
43
44
|
method: "GET",
|
|
44
|
-
path: `/
|
|
45
|
+
path: `/v1/shop/custom-fields`,
|
|
45
46
|
params,
|
|
46
47
|
});
|
|
47
48
|
return data;
|
|
@@ -88,8 +89,53 @@ async function postMediaCustomField(params) {
|
|
|
88
89
|
const { id, customFieldIdType, sealedTarget, fileName, fileSize } = params;
|
|
89
90
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
90
91
|
method: "POST",
|
|
91
|
-
path: `/
|
|
92
|
+
path: `/v1/shop/custom-fields/${id}/media`,
|
|
92
93
|
params: { customFieldIdType, sealedTarget, fileName, fileSize },
|
|
93
94
|
});
|
|
94
95
|
return data;
|
|
95
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* 🎥 Gets the media URL for a custom field.
|
|
99
|
+
*
|
|
100
|
+
* @deprecated This endpoint is deprecated in the API and should not be used for new implementations.
|
|
101
|
+
*
|
|
102
|
+
* This function retrieves the media URL associated with a specific custom field.
|
|
103
|
+
*
|
|
104
|
+
* 🛠 **Endpoint**: `GET /v1/shop/custom-fields/{id}/media`
|
|
105
|
+
*
|
|
106
|
+
* | **Parameter** | **Type** | **Required** | **Description** |
|
|
107
|
+
* |-----------------------|------------|--------------|----------------------------------------------------------------------|
|
|
108
|
+
* | `id` | `string` | ✅ | The ID of the custom field associated with the media. |
|
|
109
|
+
* | `customFieldIdType` | `string` | | The type of the custom field identifier (BUSINESS_ID, EXTERNAL_ID). |
|
|
110
|
+
* | `sealedTarget` | `string` | | The sealed target type. |
|
|
111
|
+
* | `fileUrl` | `string` | ✅ | The URL of the file to retrieve. |
|
|
112
|
+
*
|
|
113
|
+
* 📤 **Returns**:
|
|
114
|
+
* A `Promise<string>` containing the media URL.
|
|
115
|
+
*
|
|
116
|
+
* 🛠 **Example Usage**:
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const mediaUrl = await getMediaUrl({
|
|
119
|
+
* id: 'field1',
|
|
120
|
+
* customFieldIdType: 'EXTERNAL_ID',
|
|
121
|
+
* fileUrl: 'https://example.com/image.jpg',
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* @param {GetMediaUrlParameters} params - The parameters for retrieving a media URL:
|
|
126
|
+
* - `id` - The ID of the custom field.
|
|
127
|
+
* - `customFieldIdType` (optional) - The type of the custom field identifier.
|
|
128
|
+
* - `sealedTarget` (optional) - The sealed target type.
|
|
129
|
+
* - `fileUrl` - The URL of the file to retrieve.
|
|
130
|
+
*
|
|
131
|
+
* @returns {Promise<string>} - The media URL.
|
|
132
|
+
*/
|
|
133
|
+
async function getMediaUrl(params) {
|
|
134
|
+
const { id, ...queryParams } = params;
|
|
135
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
136
|
+
method: "GET",
|
|
137
|
+
path: `/v1/shop/custom-fields/${id}/media`,
|
|
138
|
+
params: queryParams,
|
|
139
|
+
});
|
|
140
|
+
return data;
|
|
141
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
1
|
+
import { CustomFieldValueRequest, PageCustomFieldSearch } from "../../interfaces/models/custom-field";
|
|
2
2
|
import { PageOrderLogisticDto } from "../../interfaces/models/order";
|
|
3
3
|
import { AddressDto, CreateAddressRequest, UpdateAddressRequest } from "../../interfaces/models/address";
|
|
4
4
|
import { Order, PageableObject, PageableParameters } from "../../interfaces/models/common";
|
|
5
|
-
import { CreateObjectCustomerAccountRequest, CustomerAccountDto, LegalUserDto } from "../../interfaces/models/customer-account";
|
|
5
|
+
import { AccountCustomFieldsIdType, CreateObjectCustomerAccountRequest, CustomerAccountDto, LegalUserDto } from "../../interfaces/models/customer-account";
|
|
6
6
|
import { CustomerOrganisationDto, CustomerOrganisationStatus } from "../../interfaces/models/customer-organisation";
|
|
7
7
|
import { CivilityType, CreateCustomerUserRequest, PageCustomerUser, PageCustomerUserDto } from "../../interfaces/models/customer-user";
|
|
8
8
|
export interface CreateCustomerAccountParameters {
|
|
@@ -50,6 +50,12 @@ export interface UpdateCustomerAccountAddressParameters extends UpdateAddressReq
|
|
|
50
50
|
export interface GetCustomerAccountOrdersParameters {
|
|
51
51
|
pageable: PageableParameters;
|
|
52
52
|
locale: string;
|
|
53
|
+
nbPreviewLines?: number;
|
|
54
|
+
logisticOrderStatuses?: string[];
|
|
55
|
+
/**
|
|
56
|
+
* @deprecated
|
|
57
|
+
*/
|
|
58
|
+
orderLogisticStatusType: string;
|
|
53
59
|
}
|
|
54
60
|
export interface GetCustomerAccountUsersParameters {
|
|
55
61
|
pageable: PageableParameters;
|
|
@@ -78,6 +84,11 @@ export interface UpdateCustomerAccountOrganisationAddressParameters extends Upda
|
|
|
78
84
|
organisationId: string;
|
|
79
85
|
addressId: string;
|
|
80
86
|
}
|
|
87
|
+
export interface GetCustomerAccountCustomFieldsParameters {
|
|
88
|
+
customFieldIds: string[];
|
|
89
|
+
idType: AccountCustomFieldsIdType;
|
|
90
|
+
pageable: PageableParameters;
|
|
91
|
+
}
|
|
81
92
|
export interface GetCustomerAccountOrganisationOrdersParameters {
|
|
82
93
|
organisationId: string;
|
|
83
94
|
pageable: PageableParameters;
|
|
@@ -125,6 +136,8 @@ export interface CreateCustomerAccountAddressResponse extends AddressDto {
|
|
|
125
136
|
}
|
|
126
137
|
export interface UpdateCustomerAccountAddressResponse extends AddressDto {
|
|
127
138
|
}
|
|
139
|
+
export interface GetCustomerAccountCustomFieldsResponse extends PageCustomFieldSearch {
|
|
140
|
+
}
|
|
128
141
|
export interface GetCustomerAccountOrdersResponse extends PageOrderLogisticDto {
|
|
129
142
|
}
|
|
130
143
|
export interface GetCustomerAccountUsersResponse extends PageCustomerUser {
|
|
@@ -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 {
|
|
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`
|
|
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
|
-
* | `
|
|
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(
|
|
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 {
|
|
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`
|
|
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
|
-
* | `
|
|
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(
|
|
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:
|
|
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
|
}
|
|
@@ -49,6 +49,20 @@ export interface createOrderLogisticIncidentThreadParameters {
|
|
|
49
49
|
message: string;
|
|
50
50
|
reasonCode: string;
|
|
51
51
|
}
|
|
52
|
+
export interface createIncidentParameters {
|
|
53
|
+
customField?: {
|
|
54
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
55
|
+
idType: IncidentIdType;
|
|
56
|
+
};
|
|
57
|
+
externalId?: string;
|
|
58
|
+
logisticOrderId?: string;
|
|
59
|
+
reasonCodes: string[];
|
|
60
|
+
idType?: IncidentIdType;
|
|
61
|
+
}
|
|
62
|
+
export interface createIncidentResponse {
|
|
63
|
+
externalId: string;
|
|
64
|
+
incidentId: string;
|
|
65
|
+
}
|
|
52
66
|
/**
|
|
53
67
|
* Request response type definitions
|
|
54
68
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
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
|
*
|
|
@@ -182,3 +182,42 @@ 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>;
|
|
@@ -5,6 +5,7 @@ exports.getIncident = getIncident;
|
|
|
5
5
|
exports.createOrderLogisticIncident = createOrderLogisticIncident;
|
|
6
6
|
exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
|
|
7
7
|
exports.createOrderLogisticIncidentThread = createOrderLogisticIncidentThread;
|
|
8
|
+
exports.createIncident = createIncident;
|
|
8
9
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
9
10
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
10
11
|
/**
|
|
@@ -262,3 +263,58 @@ async function createOrderLogisticIncidentThread({ logisticOrderId, incidentId,
|
|
|
262
263
|
});
|
|
263
264
|
return data;
|
|
264
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* 🚚 Creates a new incident.
|
|
268
|
+
*
|
|
269
|
+
* This function allows the creation of a new incident with various parameters such as custom fields,
|
|
270
|
+
* external ID, logistic order ID, and reason codes.
|
|
271
|
+
*
|
|
272
|
+
* 🛠 **Endpoint**: `POST /v1/shop/incidents [ORDER-560]`
|
|
273
|
+
*
|
|
274
|
+
* | Parameter | Type | Required | Description |
|
|
275
|
+
* |------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
276
|
+
* | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
|
|
277
|
+
* | `externalId` | `string` | ❌ | An external identifier for the incident. |
|
|
278
|
+
* | `logisticOrderId`| `string` | ❌ | The ID of the logistic order associated with the incident. |
|
|
279
|
+
* | `reasonCodes` | `string[]` | ✅ | The reason codes for the incident. |
|
|
280
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID). |
|
|
281
|
+
*
|
|
282
|
+
* 📤 **Returns**:
|
|
283
|
+
* A `Promise<createIncidentResponse>` containing the details of the created incident.
|
|
284
|
+
*
|
|
285
|
+
* 🛠 **Example usage**:
|
|
286
|
+
* ```ts
|
|
287
|
+
* const createdIncident = await createIncident({
|
|
288
|
+
* customField: {
|
|
289
|
+
* customFieldValues: [
|
|
290
|
+
* { customFieldId: "field1", customFieldValue: "value1" }
|
|
291
|
+
* ],
|
|
292
|
+
* idType: "DJUST_ID"
|
|
293
|
+
* },
|
|
294
|
+
* externalId: "EXT-123",
|
|
295
|
+
* logisticOrderId: "order-789",
|
|
296
|
+
* reasonCodes: ["DAMAGED_PRODUCT", "WRONG_QUANTITY"],
|
|
297
|
+
* });
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* @param {createIncidentParameters} params - The parameters for creating the incident.
|
|
301
|
+
* @throws {Error} If the required `reasonCodes` parameter is missing.
|
|
302
|
+
* @returns {Promise<createIncidentResponse>} A promise that resolves to the created incident details.
|
|
303
|
+
*/
|
|
304
|
+
async function createIncident({ customField, externalId, logisticOrderId, reasonCodes, idType, }) {
|
|
305
|
+
(0, parameters_validation_1.required)({ reasonCodes });
|
|
306
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
307
|
+
method: "POST",
|
|
308
|
+
path: `/v1/shop/incidents`,
|
|
309
|
+
params: {
|
|
310
|
+
idType,
|
|
311
|
+
},
|
|
312
|
+
body: JSON.stringify({
|
|
313
|
+
customField,
|
|
314
|
+
externalId,
|
|
315
|
+
logisticOrderId,
|
|
316
|
+
reasonCodes,
|
|
317
|
+
}),
|
|
318
|
+
});
|
|
319
|
+
return data;
|
|
320
|
+
}
|
|
@@ -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
|
|
276
|
+
export interface UpdateThreadMessageParams {
|
|
266
277
|
messageId: string;
|
|
267
278
|
customFieldValues: CustomFieldValueRequest[];
|
|
268
|
-
idType
|
|
279
|
+
idType?: IdType;
|
|
269
280
|
}
|
|
270
|
-
export interface UpdateLogisticOrderIncidentThreadMessageParams extends GetLogisticOrderIncidentThreadParams,
|
|
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,
|
|
291
|
+
export interface UpdateLogisticOrderThreadMessageParams extends GetLogisticOrderThreadParams, UpdateThreadMessageParams {
|
|
281
292
|
}
|