@djust-b2b/djust-front-sdk 1.19.1 → 1.20.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
@@ -9,6 +9,7 @@ export declare const DjustSDK: {
9
9
  accessToken?: string;
10
10
  storeId?: string;
11
11
  storeViewId?: string;
12
+ customerAccountId?: string;
12
13
  }) => void;
13
14
  updateConfiguration: (newConfig: Partial<{
14
15
  baseUrl: string;
@@ -20,6 +21,7 @@ export declare const DjustSDK: {
20
21
  accessToken?: string;
21
22
  storeId?: string;
22
23
  storeViewId?: string;
24
+ customerAccountId?: string;
23
25
  }>) => void;
24
26
  getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }: import("./services/incident/definitions").getIncidentsParameters): Promise<import("./services/incident/definitions").getIncidentsResponse>;
25
27
  getIncident({ incidentId, idType, }: import("./services/incident/definitions").getIncidentParameters): Promise<import("./services/incident/definitions").getIncidentResponse>;
@@ -106,27 +108,27 @@ export declare const DjustSDK: {
106
108
  getCustomerUserAddresses({ shipping, billing, account, organisationIds, }: import("./interfaces").GetCustomerUserAddressesParameters): Promise<void>;
107
109
  getCustomerUserOrganisations(): Promise<import("./interfaces").GetCustomerUserOrganisationsResponse>;
108
110
  sendCustomerUserActivationRequest({ redirectUrl, token, }: import("./interfaces").SendCustomerUserActivationRequestParameters): Promise<void>;
109
- getCustomerAccount(): Promise<import("./interfaces").GetCustomerAccountResponse>;
110
- createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, }: import("./interfaces").CreateCustomerAccountParameters): Promise<import("./interfaces").CreateCustomerAccountResponse>;
111
- updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, }: import("./interfaces").UpdateCustomerAccountParameters): Promise<import("./interfaces").UpdateCustomerAccountResponse>;
112
- getCustomerAccountAddresses({ shipping, billing, }: import("./interfaces").GetCustomerAccountAddressesParameters): Promise<import("./interfaces").GetCustomerAccountAddressesResponse>;
113
- createCustomerAccountAddress({ additionalAddress, address, billing, city, company, country, externalId, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").CreateCustomerAccountAddressParameters): Promise<import("./interfaces").CreateCustomerAccountAddressResponse>;
114
- deleteCustomerAccountAddress({ addressId, }: import("./interfaces").DeleteCustomerAccountAddressParameters): Promise<void>;
115
- updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").UpdateCustomerAccountAddressParameters): Promise<import("./interfaces").UpdateCustomerAccountAddressResponse>;
116
- getCustomerAccountOrders(params: import("./interfaces").GetCustomerAccountOrdersParameters): Promise<import("./interfaces").GetCustomerAccountOrdersResponse>;
117
- getCustomerAccountUsers({ pageable, }: import("./interfaces").GetCustomerAccountUsersParameters): Promise<import("./interfaces").GetCustomerAccountUsersResponse>;
118
- createCustomerAccountOrganisation({ externalId, name, parentId, }: import("./interfaces").CreateCustomerAccountOrganisationParameters): Promise<import("./interfaces").CreateCustomerAccountOrganisationResponse>;
119
- updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }: import("./interfaces").UpdateCustomerAccountOrganisationParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationResponse>;
120
- getCustomerAccountOrganisations(): Promise<import("./interfaces").GetCustomerAccountOrganisationResponse>;
121
- getCustomerAccountOrganisationAddresses({ organisationId, }: import("./interfaces").GetCustomerAccountOrganisationAddressesParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationAddressesResponse>;
122
- deleteCustomerAccountOrganisationAddress({ organisationId, addressId, }: import("./interfaces").DeleteCustomerAccountOrganisationAddressParameters): Promise<void>;
123
- updateCustomerAccountOrganisationAddress({ organisationId, addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: import("./interfaces").UpdateCustomerAccountOrganisationAddressParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationAddressResponse>;
124
- getCustomerAccountOrganisationOrders({ organisationId, pageable, locale, }: import("./interfaces").GetCustomerAccountOrganisationOrdersParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationOrdersResponse>;
125
- getCustomerAccountOrganisationUsers({ organisationId, pageable, }: import("./interfaces").GetCustomerAccountOrganisationUsersParameters): Promise<import("./interfaces").GetCustomerAccountOrganisationUsersResponse>;
126
- updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }: import("./interfaces").UpdateCustomerAccountOrganisationUserParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationUserResponse>;
111
+ getCustomerAccount(config?: import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountResponse>;
112
+ createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, ...config }: import("./interfaces").CreateCustomerAccountParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").CreateCustomerAccountResponse>;
113
+ updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, ...config }: import("./interfaces").UpdateCustomerAccountParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").UpdateCustomerAccountResponse>;
114
+ getCustomerAccountAddresses(params: import("./interfaces").GetCustomerAccountAddressesParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountAddressesResponse>;
115
+ createCustomerAccountAddress(params: import("./interfaces").CreateCustomerAccountAddressParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").CreateCustomerAccountAddressResponse>;
116
+ deleteCustomerAccountAddress({ addressId, ...config }: import("./interfaces").DeleteCustomerAccountAddressParameters & import("./interfaces/models/common").DjustConfig): Promise<void>;
117
+ updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, ...config }: import("./interfaces").UpdateCustomerAccountAddressParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").UpdateCustomerAccountAddressResponse>;
118
+ getCustomerAccountOrders(params: import("./interfaces").GetCustomerAccountOrdersParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountOrdersResponse>;
119
+ getCustomerAccountUsers(params: import("./interfaces").GetCustomerAccountUsersParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountUsersResponse>;
120
+ createCustomerAccountOrganisation(params: import("./interfaces").CreateCustomerAccountOrganisationParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").CreateCustomerAccountOrganisationResponse>;
121
+ updateCustomerAccountOrganisation(params: import("./interfaces").UpdateCustomerAccountOrganisationParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").UpdateCustomerAccountOrganisationResponse>;
122
+ getCustomerAccountOrganisations(config?: import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountOrganisationResponse>;
123
+ getCustomerAccountOrganisationAddresses(params: import("./interfaces").GetCustomerAccountOrganisationAddressesParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountOrganisationAddressesResponse>;
124
+ deleteCustomerAccountOrganisationAddress(params: import("./interfaces").DeleteCustomerAccountOrganisationAddressParameters & import("./interfaces/models/common").DjustConfig): Promise<void>;
125
+ updateCustomerAccountOrganisationAddress(params: import("./interfaces").UpdateCustomerAccountOrganisationAddressParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").UpdateCustomerAccountOrganisationAddressResponse>;
126
+ getCustomerAccountOrganisationOrders(params: import("./interfaces").GetCustomerAccountOrganisationOrdersParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountOrganisationOrdersResponse>;
127
+ getCustomerAccountOrganisationUsers(params: import("./interfaces").GetCustomerAccountOrganisationUsersParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").GetCustomerAccountOrganisationUsersResponse>;
128
+ updateCustomerAccountOrganisationUser(params: import("./interfaces").UpdateCustomerAccountOrganisationUserParameters & import("./interfaces/models/common").DjustConfig): Promise<import("./interfaces").UpdateCustomerAccountOrganisationUserResponse>;
127
129
  deleteCarts(): Promise<import("./interfaces").DeleteCartsResponse>;
128
130
  getCarts(params: import("./interfaces").GetCartsParameters): Promise<import("./interfaces").GetCartsResponse>;
129
- createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").GetCartResponse>;
131
+ createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").CreateCartResponse>;
130
132
  deleteCart(params: import("./interfaces").DeleteCartParameters): Promise<void>;
131
133
  getCart(params: import("./interfaces").GetCartParameters): Promise<import("./interfaces").GetCartResponse>;
132
134
  updateCart(params: import("./interfaces").UpdateCartParameters): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { OfferDto } from "./offer";
2
- import { ProductVariantResponse } from "./product";
2
+ import { ProductVariantDTO } from "./product";
3
3
  import { SupplierAggregationDto, SupplierSimpleView } from "./supplier";
4
4
  import { Currency } from "./common";
5
5
  import { PriceDto } from "./price";
@@ -37,12 +37,12 @@ export interface CartLineDto {
37
37
  blockedLineInformation: BlockedLineInformationDto[];
38
38
  createdAt: string;
39
39
  offer: OfferDto;
40
- productVariant: ProductVariantResponse;
40
+ productVariant: ProductVariantDTO;
41
41
  quantity: number;
42
42
  supplier: SupplierSimpleView;
43
43
  updatedAt: string;
44
44
  }
45
- interface BlockedLineInformationDto {
45
+ export interface BlockedLineInformationDto {
46
46
  code: string;
47
47
  detail: string;
48
48
  }
@@ -60,4 +60,3 @@ export interface PageCartLineDto {
60
60
  sort: string[];
61
61
  totalElement: number;
62
62
  }
63
- export {};
@@ -48,4 +48,9 @@ export interface DjustApiException {
48
48
  detail: string;
49
49
  code: string;
50
50
  }
51
+ export interface DjustConfig {
52
+ customerAccountId?: string;
53
+ storeId?: string;
54
+ storeViewId?: string;
55
+ }
51
56
  export {};
@@ -77,6 +77,22 @@ export interface ProductVariantResponse {
77
77
  skuVariant: string;
78
78
  status: ProductStatus;
79
79
  }
80
+ export interface ProductVariantDTO {
81
+ brand: string;
82
+ id: string;
83
+ imageLink: string;
84
+ mainProductBusinessId: string;
85
+ name: string;
86
+ sku: string;
87
+ skuProduct: string;
88
+ status: ProductStatus;
89
+ variantAttributesValues: VariantAttributesValuesDTO[];
90
+ }
91
+ export interface VariantAttributesValuesDTO {
92
+ id: string;
93
+ name: string;
94
+ value: string;
95
+ }
80
96
  interface ProductVariantAttributeValueResponse {
81
97
  attribute: ProductVariantAttribute;
82
98
  attributeValue: AttributeValue;
@@ -19,10 +19,12 @@ export interface DeleteCartParameters {
19
19
  }
20
20
  export interface CreateCartParameters {
21
21
  name: string;
22
+ type: string;
22
23
  }
23
24
  export interface UpdateCartParameters {
24
25
  cartId: string;
25
26
  name: string;
27
+ type: string;
26
28
  }
27
29
  export interface InitializeOrdersFromCartParameters {
28
30
  cartId: string;
@@ -37,23 +39,28 @@ export interface GetCartLinesParameters {
37
39
  }
38
40
  export interface DeleteCartLinesParameters {
39
41
  cartId: string;
40
- lineIdsToDelete: string[];
42
+ lineIdsToDelete: FoOfferToDelete[];
43
+ }
44
+ export interface FoOfferToDelete {
45
+ offerPriceId: string;
41
46
  }
42
47
  export interface UpdateCartLinesParameters {
43
48
  cartId: string;
44
- linesToUpdate: {
45
- offerPriceId: string;
46
- quantity: number;
47
- updateAction: UpdateCartLineType;
48
- }[];
49
+ linesToUpdate: FoCartLineToAdd[];
50
+ }
51
+ export interface FoCartLineToAdd {
52
+ offerPriceId: string;
53
+ quantity?: number;
54
+ updateAction: UpdateCartLineType;
49
55
  }
50
56
  export interface UpdateCartLinesByVariantParameters {
51
57
  cartId: string;
52
- linesToUpdate: {
53
- productVariantId: string;
54
- quantity: number;
55
- updateAction: UpdateCartLineType;
56
- }[];
58
+ linesToUpdate: FoCartLineToAddByVariant[];
59
+ }
60
+ export interface FoCartLineToAddByVariant {
61
+ productVariantId: string;
62
+ quantity?: number;
63
+ updateAction: UpdateCartLineType;
57
64
  }
58
65
  /**
59
66
  * Response type definitions
@@ -1,4 +1,4 @@
1
- import { CreateCartParameters, DeleteCartsResponse, DeleteCartParameters, GetCartParameters, GetCartResponse, GetCartsParameters, GetCartsResponse, UpdateCartParameters, InitializeOrdersFromCartParameters, GetCartLinesParameters, DeleteCartLinesResponse, DeleteCartLinesParameters, GetCartLinesResponse, UpdateCartLinesResponse, UpdateCartLinesParameters, UpdateCartLinesByVariantParameters, UpdateCartLinesByVariantResponse } from "./definitions";
1
+ import { CreateCartParameters, DeleteCartsResponse, DeleteCartParameters, GetCartParameters, GetCartResponse, GetCartsParameters, GetCartsResponse, UpdateCartParameters, InitializeOrdersFromCartParameters, GetCartLinesParameters, DeleteCartLinesResponse, DeleteCartLinesParameters, GetCartLinesResponse, UpdateCartLinesResponse, UpdateCartLinesParameters, UpdateCartLinesByVariantParameters, UpdateCartLinesByVariantResponse, CreateCartResponse } from "./definitions";
2
2
  /**
3
3
  * CART ENDPOINT
4
4
  */
@@ -75,7 +75,7 @@ export declare function getCarts(params: GetCartsParameters): Promise<GetCartsRe
75
75
  *
76
76
  * @returns {Promise<GetCartResponse>} - A promise that resolves when the cart is created.
77
77
  */
78
- export declare function createCart(params: CreateCartParameters): Promise<GetCartResponse>;
78
+ export declare function createCart(params: CreateCartParameters): Promise<CreateCartResponse>;
79
79
  /**
80
80
  * 🗑️ Deletes a specific cart.
81
81
  *
@@ -141,6 +141,7 @@ export declare function getCart(params: GetCartParameters): Promise<GetCartRespo
141
141
  * |------------|----------|------------|---------------------------------------|
142
142
  * | `cartId` | `string` | ✅ | The ID of the cart to update. |
143
143
  * | `name` | `string` | ✅ | The new name of the cart. |
144
+ * | `type` | `string` | ❌ | The new name of the cart. |
144
145
  *
145
146
  * 📤 **Returns**:
146
147
  * A `Promise<void>` that resolves when the cart is successfully updated.
@@ -153,6 +154,7 @@ export declare function getCart(params: GetCartParameters): Promise<GetCartRespo
153
154
  * @param {UpdateCartParameters} params - The parameters for updating the cart:
154
155
  * - `cartId` - The ID of the cart to update.
155
156
  * - `name` - The new name of the cart.
157
+ * - `type` - The type of the cart.
156
158
  *
157
159
  * @returns {Promise<void>} - A promise that resolves when the update is successful.
158
160
  */
@@ -192,7 +194,7 @@ export declare function initializeOrdersFromCart(params: InitializeOrdersFromCar
192
194
  * | Parameter | Type | Required | Description |
193
195
  * |--------------------|------------|------------|--------------------------------------|
194
196
  * | `cartId` | `string` | ✅ | The ID of the cart. |
195
- * | `lineIdsToDelete` | `string[]` | ✅ | The IDs of the lines to delete. |
197
+ * | `lineIdsToDelete` | `FoOfferToDelete[]` | ✅ | The IDs of the lines to delete. |
196
198
  *
197
199
  * 📤 **Returns**:
198
200
  * A `Promise<DeleteCartLinesResponse>` containing details about the deleted lines.
@@ -201,7 +203,14 @@ export declare function initializeOrdersFromCart(params: InitializeOrdersFromCar
201
203
  * ```ts
202
204
  * const response = await deleteCartLines({
203
205
  * cartId: 'cart1',
204
- * lineIdsToDelete: ['line1', 'line2']
206
+ * lineIdsToDelete: [
207
+ * {
208
+ * offerPriceId: 'line1'
209
+ * },
210
+ * {
211
+ * offerPriceId: 'line2'
212
+ * },
213
+ * ]
205
214
  * });
206
215
  * ```
207
216
  *
@@ -263,7 +272,7 @@ export declare function getCartLines(params: GetCartLinesParameters): Promise<Ge
263
272
  * | Parameter | Type | Required | Description |
264
273
  * |-------------------|------------|------------|----------------------------------------|
265
274
  * | `cartId` | `string` | ✅ | The ID of the cart. |
266
- * | `linesToUpdate` | `object[]` | ✅ | Details of the lines to update. |
275
+ * | `linesToUpdate` | `FoCartLineToAdd[]` | ✅ | Details of the lines to update. |
267
276
  *
268
277
  * 📤 **Returns**:
269
278
  * A `Promise<UpdateCartLinesResponse>` containing the updated lines' information.
@@ -295,7 +304,7 @@ export declare function updateCartLines(params: UpdateCartLinesParameters): Prom
295
304
  * | Parameter | Type | Required | Description |
296
305
  * |-------------------|------------|------------|----------------------------------------|
297
306
  * | `cartId` | `string` | ✅ | The ID of the cart. |
298
- * | `linesToUpdate` | `object[]` | ✅ | Details of the lines to update. |
307
+ * | `linesToUpdate` | `FoCartLineToAddByVariant[]` | ✅ | Details of the lines to update. |
299
308
  *
300
309
  * 📤 **Returns**:
301
310
  * A `Promise<UpdateCartLinesByVariantResponse>` containing the updated lines' information.
@@ -206,6 +206,7 @@ async function getCart(params) {
206
206
  * |------------|----------|------------|---------------------------------------|
207
207
  * | `cartId` | `string` | ✅ | The ID of the cart to update. |
208
208
  * | `name` | `string` | ✅ | The new name of the cart. |
209
+ * | `type` | `string` | ❌ | The new name of the cart. |
209
210
  *
210
211
  * 📤 **Returns**:
211
212
  * A `Promise<void>` that resolves when the cart is successfully updated.
@@ -218,17 +219,18 @@ async function getCart(params) {
218
219
  * @param {UpdateCartParameters} params - The parameters for updating the cart:
219
220
  * - `cartId` - The ID of the cart to update.
220
221
  * - `name` - The new name of the cart.
222
+ * - `type` - The type of the cart.
221
223
  *
222
224
  * @returns {Promise<void>} - A promise that resolves when the update is successful.
223
225
  */
224
226
  async function updateCart(params) {
225
- const { cartId, name } = params;
227
+ const { cartId, name, type } = params;
226
228
  // Ensure required parameters are present
227
229
  (0, parameters_validation_1.required)({ cartId, name });
228
230
  (0, fetch_instance_1.enhancedFetch)({
229
231
  method: "PUT",
230
232
  path: `/v2/shop/carts/${cartId}`,
231
- body: JSON.stringify({ name }),
233
+ body: JSON.stringify({ name, type }),
232
234
  });
233
235
  }
234
236
  /**
@@ -275,7 +277,7 @@ async function initializeOrdersFromCart(params) {
275
277
  * | Parameter | Type | Required | Description |
276
278
  * |--------------------|------------|------------|--------------------------------------|
277
279
  * | `cartId` | `string` | ✅ | The ID of the cart. |
278
- * | `lineIdsToDelete` | `string[]` | ✅ | The IDs of the lines to delete. |
280
+ * | `lineIdsToDelete` | `FoOfferToDelete[]` | ✅ | The IDs of the lines to delete. |
279
281
  *
280
282
  * 📤 **Returns**:
281
283
  * A `Promise<DeleteCartLinesResponse>` containing details about the deleted lines.
@@ -284,7 +286,14 @@ async function initializeOrdersFromCart(params) {
284
286
  * ```ts
285
287
  * const response = await deleteCartLines({
286
288
  * cartId: 'cart1',
287
- * lineIdsToDelete: ['line1', 'line2']
289
+ * lineIdsToDelete: [
290
+ * {
291
+ * offerPriceId: 'line1'
292
+ * },
293
+ * {
294
+ * offerPriceId: 'line2'
295
+ * },
296
+ * ]
288
297
  * });
289
298
  * ```
290
299
  *
@@ -375,7 +384,7 @@ async function getCartLines(params) {
375
384
  * | Parameter | Type | Required | Description |
376
385
  * |-------------------|------------|------------|----------------------------------------|
377
386
  * | `cartId` | `string` | ✅ | The ID of the cart. |
378
- * | `linesToUpdate` | `object[]` | ✅ | Details of the lines to update. |
387
+ * | `linesToUpdate` | `FoCartLineToAdd[]` | ✅ | Details of the lines to update. |
379
388
  *
380
389
  * 📤 **Returns**:
381
390
  * A `Promise<UpdateCartLinesResponse>` containing the updated lines' information.
@@ -417,7 +426,7 @@ async function updateCartLines(params) {
417
426
  * | Parameter | Type | Required | Description |
418
427
  * |-------------------|------------|------------|----------------------------------------|
419
428
  * | `cartId` | `string` | ✅ | The ID of the cart. |
420
- * | `linesToUpdate` | `object[]` | ✅ | Details of the lines to update. |
429
+ * | `linesToUpdate` | `FoCartLineToAddByVariant[]` | ✅ | Details of the lines to update. |
421
430
  *
422
431
  * 📤 **Returns**:
423
432
  * A `Promise<UpdateCartLinesByVariantResponse>` containing the updated lines' information.
@@ -1,3 +1,4 @@
1
+ import { DjustConfig } from "../../interfaces/models/common";
1
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 } from "./definitions";
2
3
  /**
3
4
  * 📄 Get customer account details.
@@ -15,7 +16,7 @@ import { CreateCustomerAccountAddressParameters, CreateCustomerAccountAddressRes
15
16
  * console.log(response);
16
17
  * ```
17
18
  */
18
- export declare function getCustomerAccount(): Promise<GetCustomerAccountResponse>;
19
+ export declare function getCustomerAccount(config?: DjustConfig): Promise<GetCustomerAccountResponse>;
19
20
  /**
20
21
  * 📄 Creates a new customer account.
21
22
  *
@@ -108,7 +109,7 @@ export declare function getCustomerAccount(): Promise<GetCustomerAccountResponse
108
109
  * });
109
110
  * ```
110
111
  */
111
- export declare function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, }: CreateCustomerAccountParameters): Promise<CreateCustomerAccountResponse>;
112
+ export declare function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, ...config }: CreateCustomerAccountParameters & DjustConfig): Promise<CreateCustomerAccountResponse>;
112
113
  /**
113
114
  * 📄 Update customer account details.
114
115
  *
@@ -122,7 +123,7 @@ export declare function createCustomerAccount({ createAddressRequests, createCus
122
123
  * console.log(response);
123
124
  * ```
124
125
  */
125
- export declare function updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, }: UpdateCustomerAccountParameters): Promise<UpdateCustomerAccountResponse>;
126
+ export declare function updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, ...config }: UpdateCustomerAccountParameters & DjustConfig): Promise<UpdateCustomerAccountResponse>;
126
127
  /**
127
128
  * 📄 Get customer account's addresses.
128
129
  *
@@ -144,7 +145,7 @@ export declare function updateCustomerAccount({ accountManager, businessRegistra
144
145
  * console.log(response);
145
146
  * ```
146
147
  */
147
- export declare function getCustomerAccountAddresses({ shipping, billing, }: GetCustomerAccountAddressesParameters): Promise<GetCustomerAccountAddressesResponse>;
148
+ export declare function getCustomerAccountAddresses(params: GetCustomerAccountAddressesParameters & DjustConfig): Promise<GetCustomerAccountAddressesResponse>;
148
149
  /**
149
150
  * 📄 Create an address for a customer account.
150
151
  *
@@ -191,7 +192,7 @@ export declare function getCustomerAccountAddresses({ shipping, billing, }: GetC
191
192
  * console.log(response);
192
193
  * ```
193
194
  */
194
- export declare function createCustomerAccountAddress({ additionalAddress, address, billing, city, company, country, externalId, fullName, label, phone, shipping, state, zipcode, }: CreateCustomerAccountAddressParameters): Promise<CreateCustomerAccountAddressResponse>;
195
+ export declare function createCustomerAccountAddress(params: CreateCustomerAccountAddressParameters & DjustConfig): Promise<CreateCustomerAccountAddressResponse>;
195
196
  /**
196
197
  * 🗑️ Delete an address from a customer account.
197
198
  *
@@ -211,7 +212,7 @@ export declare function createCustomerAccountAddress({ additionalAddress, addres
211
212
  * console.log(response); // No content response
212
213
  * ```
213
214
  */
214
- export declare function deleteCustomerAccountAddress({ addressId, }: DeleteCustomerAccountAddressParameters): Promise<void>;
215
+ export declare function deleteCustomerAccountAddress({ addressId, ...config }: DeleteCustomerAccountAddressParameters & DjustConfig): Promise<void>;
215
216
  /**
216
217
  * ✏️ Update an address for a customer account.
217
218
  *
@@ -258,7 +259,7 @@ export declare function deleteCustomerAccountAddress({ addressId, }: DeleteCusto
258
259
  * console.log(response); // Updated address details
259
260
  * ```
260
261
  */
261
- export declare function updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: UpdateCustomerAccountAddressParameters): Promise<UpdateCustomerAccountAddressResponse>;
262
+ export declare function updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, ...config }: UpdateCustomerAccountAddressParameters & DjustConfig): Promise<UpdateCustomerAccountAddressResponse>;
262
263
  /**
263
264
  * 📋 Retrieves orders for a customer account.
264
265
  *
@@ -294,7 +295,7 @@ export declare function updateCustomerAccountAddress({ addressId, additionalAddr
294
295
  *
295
296
  * @returns {Promise<GetCustomerAccountOrdersResponse>} - The response containing the customer account orders.
296
297
  */
297
- export declare function getCustomerAccountOrders(params: GetCustomerAccountOrdersParameters): Promise<GetCustomerAccountOrdersResponse>;
298
+ export declare function getCustomerAccountOrders(params: GetCustomerAccountOrdersParameters & DjustConfig): Promise<GetCustomerAccountOrdersResponse>;
298
299
  /**
299
300
  * ## Retrieve Customer Account Users
300
301
  *
@@ -320,7 +321,7 @@ export declare function getCustomerAccountOrders(params: GetCustomerAccountOrder
320
321
  * });
321
322
  * ```
322
323
  */
323
- export declare function getCustomerAccountUsers({ pageable, }: GetCustomerAccountUsersParameters): Promise<GetCustomerAccountUsersResponse>;
324
+ export declare function getCustomerAccountUsers(params: GetCustomerAccountUsersParameters & DjustConfig): Promise<GetCustomerAccountUsersResponse>;
324
325
  /**
325
326
  * ## Create a Customer Account's Organisation
326
327
  *
@@ -348,7 +349,7 @@ export declare function getCustomerAccountUsers({ pageable, }: GetCustomerAccoun
348
349
  * });
349
350
  * ```
350
351
  */
351
- export declare function createCustomerAccountOrganisation({ externalId, name, parentId, }: CreateCustomerAccountOrganisationParameters): Promise<CreateCustomerAccountOrganisationResponse>;
352
+ export declare function createCustomerAccountOrganisation(params: CreateCustomerAccountOrganisationParameters & DjustConfig): Promise<CreateCustomerAccountOrganisationResponse>;
352
353
  /**
353
354
  * ## Update a customer account's organisation
354
355
  *
@@ -380,7 +381,7 @@ export declare function createCustomerAccountOrganisation({ externalId, name, pa
380
381
  * console.log(response);
381
382
  * ```
382
383
  */
383
- export declare function updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }: UpdateCustomerAccountOrganisationParameters): Promise<UpdateCustomerAccountOrganisationResponse>;
384
+ export declare function updateCustomerAccountOrganisation(params: UpdateCustomerAccountOrganisationParameters & DjustConfig): Promise<UpdateCustomerAccountOrganisationResponse>;
384
385
  /**
385
386
  * @deprecated
386
387
  * ## Get organisations from customer account
@@ -400,7 +401,7 @@ export declare function updateCustomerAccountOrganisation({ organisationId, name
400
401
  * console.log(response);
401
402
  * ```
402
403
  */
403
- export declare function getCustomerAccountOrganisations(): Promise<GetCustomerAccountOrganisationResponse>;
404
+ export declare function getCustomerAccountOrganisations(config?: DjustConfig): Promise<GetCustomerAccountOrganisationResponse>;
404
405
  /**
405
406
  * ## Get addresses from a customer account organisation
406
407
  *
@@ -423,7 +424,7 @@ export declare function getCustomerAccountOrganisations(): Promise<GetCustomerAc
423
424
  * console.log(addresses);
424
425
  * ```
425
426
  */
426
- export declare function getCustomerAccountOrganisationAddresses({ organisationId, }: GetCustomerAccountOrganisationAddressesParameters): Promise<GetCustomerAccountOrganisationAddressesResponse>;
427
+ export declare function getCustomerAccountOrganisationAddresses(params: GetCustomerAccountOrganisationAddressesParameters & DjustConfig): Promise<GetCustomerAccountOrganisationAddressesResponse>;
427
428
  /**
428
429
  * ## Delete an address from a customer account organisation
429
430
  *
@@ -450,7 +451,7 @@ export declare function getCustomerAccountOrganisationAddresses({ organisationId
450
451
  * console.log('Address deleted successfully.');
451
452
  * ```
452
453
  */
453
- export declare function deleteCustomerAccountOrganisationAddress({ organisationId, addressId, }: DeleteCustomerAccountOrganisationAddressParameters): Promise<void>;
454
+ export declare function deleteCustomerAccountOrganisationAddress(params: DeleteCustomerAccountOrganisationAddressParameters & DjustConfig): Promise<void>;
454
455
  /**
455
456
  * ## Update an address from a customer account organisation
456
457
  *
@@ -502,7 +503,7 @@ export declare function deleteCustomerAccountOrganisationAddress({ organisationI
502
503
  * console.log(response);
503
504
  * ```
504
505
  */
505
- export declare function updateCustomerAccountOrganisationAddress({ organisationId, addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }: UpdateCustomerAccountOrganisationAddressParameters): Promise<UpdateCustomerAccountOrganisationAddressResponse>;
506
+ export declare function updateCustomerAccountOrganisationAddress(params: UpdateCustomerAccountOrganisationAddressParameters & DjustConfig): Promise<UpdateCustomerAccountOrganisationAddressResponse>;
506
507
  /**
507
508
  * ## Get orders from a customer account organisation
508
509
  *
@@ -532,7 +533,7 @@ export declare function updateCustomerAccountOrganisationAddress({ organisationI
532
533
  * console.log(response);
533
534
  * ```
534
535
  */
535
- export declare function getCustomerAccountOrganisationOrders({ organisationId, pageable, locale, }: GetCustomerAccountOrganisationOrdersParameters): Promise<GetCustomerAccountOrganisationOrdersResponse>;
536
+ export declare function getCustomerAccountOrganisationOrders(params: GetCustomerAccountOrganisationOrdersParameters & DjustConfig): Promise<GetCustomerAccountOrganisationOrdersResponse>;
536
537
  /**
537
538
  * ## Get users from a customer account organisation
538
539
  *
@@ -560,7 +561,7 @@ export declare function getCustomerAccountOrganisationOrders({ organisationId, p
560
561
  * console.log(response);
561
562
  * ```
562
563
  */
563
- export declare function getCustomerAccountOrganisationUsers({ organisationId, pageable, }: GetCustomerAccountOrganisationUsersParameters): Promise<GetCustomerAccountOrganisationUsersResponse>;
564
+ export declare function getCustomerAccountOrganisationUsers(params: GetCustomerAccountOrganisationUsersParameters & DjustConfig): Promise<GetCustomerAccountOrganisationUsersResponse>;
564
565
  /**
565
566
  * ## Update a customer account organisation user
566
567
  *
@@ -603,4 +604,4 @@ export declare function getCustomerAccountOrganisationUsers({ organisationId, pa
603
604
  * console.log(response);
604
605
  * ```
605
606
  */
606
- export declare function updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }: UpdateCustomerAccountOrganisationUserParameters): Promise<UpdateCustomerAccountOrganisationUserResponse>;
607
+ export declare function updateCustomerAccountOrganisationUser(params: UpdateCustomerAccountOrganisationUserParameters & DjustConfig): Promise<UpdateCustomerAccountOrganisationUserResponse>;
@@ -36,10 +36,11 @@ const fetch_instance_1 = require("../../settings/fetch-instance");
36
36
  * console.log(response);
37
37
  * ```
38
38
  */
39
- async function getCustomerAccount() {
39
+ async function getCustomerAccount(config) {
40
40
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
41
41
  method: "GET",
42
- path: `/v1/shop/customer-accounts`,
42
+ path: "/v1/shop/customer-accounts",
43
+ params: config,
43
44
  });
44
45
  return data;
45
46
  }
@@ -135,7 +136,7 @@ async function getCustomerAccount() {
135
136
  * });
136
137
  * ```
137
138
  */
138
- async function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, }) {
139
+ async function createCustomerAccount({ createAddressRequests, createCustomerUserRequest, createObjectCustomerAccountRequest, customFieldValues, customerTagList, fromFO, legalUser, ...config }) {
139
140
  (0, parameters_validation_1.required)({
140
141
  createAddressRequests,
141
142
  createCustomerUserRequest,
@@ -147,7 +148,8 @@ async function createCustomerAccount({ createAddressRequests, createCustomerUser
147
148
  });
148
149
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
149
150
  method: "POST",
150
- path: `/v1/shop/customer-accounts`,
151
+ path: "/v1/shop/customer-accounts",
152
+ params: config,
151
153
  body: JSON.stringify({
152
154
  createAddressRequests,
153
155
  createCustomerUserRequest,
@@ -173,10 +175,11 @@ async function createCustomerAccount({ createAddressRequests, createCustomerUser
173
175
  * console.log(response);
174
176
  * ```
175
177
  */
176
- async function updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, }) {
178
+ async function updateCustomerAccount({ accountManager, businessRegistrationNumber, companyRegistrationName, customFieldValues, customerTagList, legalUser, name, vatNumber, website, ...config }) {
177
179
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
178
180
  method: "PUT",
179
- path: `/v1/shop/customer-accounts`,
181
+ path: "/v1/shop/customer-accounts",
182
+ params: config,
180
183
  body: JSON.stringify({
181
184
  accountManager,
182
185
  businessRegistrationNumber,
@@ -212,14 +215,11 @@ async function updateCustomerAccount({ accountManager, businessRegistrationNumbe
212
215
  * console.log(response);
213
216
  * ```
214
217
  */
215
- async function getCustomerAccountAddresses({ shipping, billing, }) {
218
+ async function getCustomerAccountAddresses(params) {
216
219
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
217
220
  method: "GET",
218
- path: `/v1/shop/customer-accounts/addresses`,
219
- params: {
220
- shipping,
221
- billing,
222
- },
221
+ path: "/v1/shop/customer-accounts/addresses",
222
+ params,
223
223
  });
224
224
  return data;
225
225
  }
@@ -269,26 +269,13 @@ async function getCustomerAccountAddresses({ shipping, billing, }) {
269
269
  * console.log(response);
270
270
  * ```
271
271
  */
272
- async function createCustomerAccountAddress({ additionalAddress, address, billing, city, company, country, externalId, fullName, label, phone, shipping, state, zipcode, }) {
273
- (0, parameters_validation_1.required)({ address, city, country, fullName, zipcode });
272
+ async function createCustomerAccountAddress(params) {
273
+ (0, parameters_validation_1.required)(params);
274
274
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
275
275
  method: "POST",
276
- path: `/v1/shop/customer-accounts/addresses`,
277
- params: {
278
- additionalAddress,
279
- address,
280
- billing,
281
- city,
282
- company,
283
- country,
284
- externalId,
285
- fullName,
286
- label,
287
- phone,
288
- shipping,
289
- state,
290
- zipcode,
291
- },
276
+ path: "/v1/shop/customer-accounts/addresses",
277
+ params,
278
+ body: JSON.stringify(params),
292
279
  });
293
280
  return data;
294
281
  }
@@ -311,11 +298,12 @@ async function createCustomerAccountAddress({ additionalAddress, address, billin
311
298
  * console.log(response); // No content response
312
299
  * ```
313
300
  */
314
- async function deleteCustomerAccountAddress({ addressId, }) {
301
+ async function deleteCustomerAccountAddress({ addressId, ...config }) {
315
302
  (0, parameters_validation_1.required)({ addressId });
316
- (0, fetch_instance_1.enhancedFetch)({
303
+ await (0, fetch_instance_1.enhancedFetch)({
317
304
  method: "DELETE",
318
305
  path: `/v1/shop/customer-accounts/addresses/${addressId}`,
306
+ params: config,
319
307
  });
320
308
  }
321
309
  /**
@@ -364,11 +352,12 @@ async function deleteCustomerAccountAddress({ addressId, }) {
364
352
  * console.log(response); // Updated address details
365
353
  * ```
366
354
  */
367
- async function updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }) {
355
+ async function updateCustomerAccountAddress({ addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, ...config }) {
368
356
  (0, parameters_validation_1.required)({ addressId });
369
357
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
370
358
  method: "PUT",
371
359
  path: `/v1/shop/customer-accounts/addresses/${addressId}`,
360
+ params: config,
372
361
  body: JSON.stringify({
373
362
  additionalAddress,
374
363
  address,
@@ -454,16 +443,12 @@ async function getCustomerAccountOrders(params) {
454
443
  * });
455
444
  * ```
456
445
  */
457
- async function getCustomerAccountUsers({ pageable, }) {
458
- (0, parameters_validation_1.required)({ pageable });
446
+ async function getCustomerAccountUsers(params) {
447
+ (0, parameters_validation_1.required)({ pageable: params.pageable });
459
448
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
460
449
  method: "GET",
461
450
  path: `/v1/shop/customer-accounts/users`,
462
- params: {
463
- page: pageable.page,
464
- size: pageable.size,
465
- sort: pageable.sort,
466
- },
451
+ params,
467
452
  });
468
453
  return data;
469
454
  }
@@ -494,16 +479,13 @@ async function getCustomerAccountUsers({ pageable, }) {
494
479
  * });
495
480
  * ```
496
481
  */
497
- async function createCustomerAccountOrganisation({ externalId, name, parentId, }) {
498
- (0, parameters_validation_1.required)({ externalId, name });
482
+ async function createCustomerAccountOrganisation(params) {
483
+ (0, parameters_validation_1.required)({ externalId: params.externalId, name: params.name });
499
484
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
500
485
  method: "POST",
501
486
  path: `/v1/shop/customer-accounts/organisations`,
502
- body: JSON.stringify({
503
- externalId,
504
- name,
505
- parentId,
506
- }),
487
+ params,
488
+ body: JSON.stringify(params),
507
489
  });
508
490
  return data;
509
491
  }
@@ -538,16 +520,13 @@ async function createCustomerAccountOrganisation({ externalId, name, parentId, }
538
520
  * console.log(response);
539
521
  * ```
540
522
  */
541
- async function updateCustomerAccountOrganisation({ organisationId, name, parentId, status, }) {
542
- (0, parameters_validation_1.required)({ organisationId });
523
+ async function updateCustomerAccountOrganisation(params) {
524
+ (0, parameters_validation_1.required)({ organisationId: params.organisationId });
543
525
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
544
526
  method: "PUT",
545
- path: `/v1/shop/customer-accounts/organisations/${organisationId}`,
546
- body: JSON.stringify({
547
- name,
548
- parentId,
549
- status,
550
- }),
527
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}`,
528
+ params,
529
+ body: JSON.stringify(params),
551
530
  });
552
531
  return data;
553
532
  }
@@ -570,10 +549,11 @@ async function updateCustomerAccountOrganisation({ organisationId, name, parentI
570
549
  * console.log(response);
571
550
  * ```
572
551
  */
573
- async function getCustomerAccountOrganisations() {
552
+ async function getCustomerAccountOrganisations(config) {
574
553
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
575
554
  method: "GET",
576
555
  path: `/v1/shop/customer-accounts/organisations`,
556
+ params: config,
577
557
  });
578
558
  return data;
579
559
  }
@@ -599,11 +579,12 @@ async function getCustomerAccountOrganisations() {
599
579
  * console.log(addresses);
600
580
  * ```
601
581
  */
602
- async function getCustomerAccountOrganisationAddresses({ organisationId, }) {
603
- (0, parameters_validation_1.required)({ organisationId });
582
+ async function getCustomerAccountOrganisationAddresses(params) {
583
+ (0, parameters_validation_1.required)({ organisationId: params.organisationId });
604
584
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
605
585
  method: "GET",
606
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/addresses`,
586
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/addresses`,
587
+ params,
607
588
  });
608
589
  return data;
609
590
  }
@@ -633,11 +614,15 @@ async function getCustomerAccountOrganisationAddresses({ organisationId, }) {
633
614
  * console.log('Address deleted successfully.');
634
615
  * ```
635
616
  */
636
- async function deleteCustomerAccountOrganisationAddress({ organisationId, addressId, }) {
637
- (0, parameters_validation_1.required)({ organisationId, addressId });
617
+ async function deleteCustomerAccountOrganisationAddress(params) {
618
+ (0, parameters_validation_1.required)({
619
+ organisationId: params.organisationId,
620
+ addressId: params.addressId,
621
+ });
638
622
  await (0, fetch_instance_1.enhancedFetch)({
639
623
  method: "DELETE",
640
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/addresses/${addressId}`,
624
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/addresses/${params.addressId}`,
625
+ params,
641
626
  });
642
627
  }
643
628
  /**
@@ -691,25 +676,16 @@ async function deleteCustomerAccountOrganisationAddress({ organisationId, addres
691
676
  * console.log(response);
692
677
  * ```
693
678
  */
694
- async function updateCustomerAccountOrganisationAddress({ organisationId, addressId, additionalAddress, address, billing, city, company, country, fullName, label, phone, shipping, state, zipcode, }) {
695
- (0, parameters_validation_1.required)({ organisationId, addressId });
679
+ async function updateCustomerAccountOrganisationAddress(params) {
680
+ (0, parameters_validation_1.required)({
681
+ organisationId: params.organisationId,
682
+ addressId: params.addressId,
683
+ });
696
684
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
697
685
  method: "PUT",
698
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/addresses/${addressId}`,
699
- body: JSON.stringify({
700
- additionalAddress,
701
- address,
702
- billing,
703
- city,
704
- company,
705
- country,
706
- fullName,
707
- label,
708
- phone,
709
- shipping,
710
- state,
711
- zipcode,
712
- }),
686
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/addresses/${params.addressId}`,
687
+ params,
688
+ body: JSON.stringify(params),
713
689
  });
714
690
  return data;
715
691
  }
@@ -742,18 +718,16 @@ async function updateCustomerAccountOrganisationAddress({ organisationId, addres
742
718
  * console.log(response);
743
719
  * ```
744
720
  */
745
- async function getCustomerAccountOrganisationOrders({ organisationId, pageable, locale, }) {
746
- (0, parameters_validation_1.required)({ organisationId, pageable, locale });
721
+ async function getCustomerAccountOrganisationOrders(params) {
722
+ (0, parameters_validation_1.required)({
723
+ organisationId: params.organisationId,
724
+ pageable: params.pageable,
725
+ locale: params.locale,
726
+ });
747
727
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
748
728
  method: "GET",
749
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/orders`,
750
- params: {
751
- pageable,
752
- locale,
753
- page: pageable.page,
754
- size: pageable.size,
755
- sort: pageable.sort,
756
- },
729
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/orders`,
730
+ params,
757
731
  });
758
732
  return data;
759
733
  }
@@ -784,17 +758,15 @@ async function getCustomerAccountOrganisationOrders({ organisationId, pageable,
784
758
  * console.log(response);
785
759
  * ```
786
760
  */
787
- async function getCustomerAccountOrganisationUsers({ organisationId, pageable, }) {
788
- (0, parameters_validation_1.required)({ organisationId, pageable });
761
+ async function getCustomerAccountOrganisationUsers(params) {
762
+ (0, parameters_validation_1.required)({
763
+ organisationId: params.organisationId,
764
+ pageable: params.pageable,
765
+ });
789
766
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
790
767
  method: "GET",
791
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/users`,
792
- params: {
793
- pageable,
794
- page: pageable.page,
795
- size: pageable.size,
796
- sort: pageable.sort,
797
- },
768
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/users`,
769
+ params,
798
770
  });
799
771
  return data;
800
772
  }
@@ -840,18 +812,16 @@ async function getCustomerAccountOrganisationUsers({ organisationId, pageable, }
840
812
  * console.log(response);
841
813
  * ```
842
814
  */
843
- async function updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }) {
844
- (0, parameters_validation_1.required)({ organisationId, customerUserId });
815
+ async function updateCustomerAccountOrganisationUser(params) {
816
+ (0, parameters_validation_1.required)({
817
+ organisationId: params.organisationId,
818
+ customerUserId: params.customerUserId,
819
+ });
845
820
  const { data } = await (0, fetch_instance_1.enhancedFetch)({
846
821
  method: "PUT",
847
- path: `/v1/shop/customer-accounts/organisations/${organisationId}/users/${customerUserId}`,
848
- body: JSON.stringify({
849
- firstName,
850
- lastName,
851
- civility,
852
- customFieldValues,
853
- phone,
854
- }),
822
+ path: `/v1/shop/customer-accounts/organisations/${params.organisationId}/users/${params.customerUserId}`,
823
+ params,
824
+ body: JSON.stringify(params),
855
825
  });
856
826
  return data;
857
827
  }
@@ -1,3 +1,4 @@
1
+ import { DjustConfig } from "../interfaces/models/common";
1
2
  type ClientConfig = {
2
3
  baseUrl: string;
3
4
  clientId: string;
@@ -8,13 +9,14 @@ type ClientConfig = {
8
9
  accessToken?: string;
9
10
  storeId?: string;
10
11
  storeViewId?: string;
12
+ customerAccountId?: string;
11
13
  };
12
14
  export declare const initialize: (initConfig: ClientConfig) => void;
13
15
  export declare const updateConfiguration: (newConfig: Partial<ClientConfig>) => void;
14
16
  export declare const enhancedFetch: <T = any>({ path, method, params, body, }: RequestInit & {
15
17
  method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
16
18
  path: string;
17
- params?: Record<string, any>;
19
+ params?: Record<string, any> & DjustConfig;
18
20
  }) => Promise<{
19
21
  data: T;
20
22
  headers: Headers;
@@ -60,12 +60,12 @@ const serializeParams = (params, useRepeat) => {
60
60
  }
61
61
  return qs.stringify(params, { arrayFormat: "bracket", skipNull: true });
62
62
  };
63
- const enhancedFetch = async ({ path, method, params, body, }) => {
64
- var _a, _b, _c;
63
+ const enhancedFetch = async ({ path, method, params = {}, body, }) => {
64
+ var _a, _b, _c, _d, _e, _f;
65
65
  if (!isClientInitialized(clientConfig)) {
66
66
  throw new Error('[Djust SDK] SDK not initialized. Provide both client ID and API key via the "initialize" method.');
67
67
  }
68
- const { clientId, apiKey, accessToken, locale, headers, storeId, storeViewId, } = clientConfig;
68
+ const { clientId, apiKey, accessToken, locale, headers } = clientConfig;
69
69
  const requestHeaders = new Headers({
70
70
  "dj-client": clientId,
71
71
  "dj-api-key": apiKey,
@@ -81,6 +81,13 @@ const enhancedFetch = async ({ path, method, params, body, }) => {
81
81
  requestHeaders.append("Authorization", `Bearer ${accessToken}`);
82
82
  if (locale)
83
83
  requestHeaders.append("locale", locale);
84
+ // Use provided params or fallback to clientConfig defaults
85
+ const customerAccountId = (_a = params.customerAccountId) !== null && _a !== void 0 ? _a : clientConfig.customerAccountId;
86
+ const storeId = (_b = params.storeId) !== null && _b !== void 0 ? _b : clientConfig.storeId;
87
+ const storeViewId = (_c = params.storeViewId) !== null && _c !== void 0 ? _c : clientConfig.storeViewId;
88
+ // Add headers dynamically if they exist
89
+ if (customerAccountId)
90
+ requestHeaders.append("customer-account-id", customerAccountId);
84
91
  if (storeId)
85
92
  requestHeaders.append("dj-store", storeId);
86
93
  if (storeViewId)
@@ -105,17 +112,17 @@ const enhancedFetch = async ({ path, method, params, body, }) => {
105
112
  const errorMessage = await response.text();
106
113
  throw new Error(`[Djust SDK] HTTP error ${status}: ${errorMessage}`);
107
114
  }
108
- const isJsonResponse = (_a = headers
109
- .get("content-type")) === null || _a === void 0 ? void 0 : _a.includes("application/json");
115
+ const isJsonResponse = (_d = headers
116
+ .get("content-type")) === null || _d === void 0 ? void 0 : _d.includes("application/json");
110
117
  // Additional check: ensure the response has content before attempting to parse JSON
111
118
  const responseText = await response.text();
112
119
  const data = isJsonResponse && responseText
113
120
  ? JSON.parse(responseText)
114
121
  : {};
115
122
  // Check if response data contains new accessToken and update configuration
116
- if (data && ((_b = data === null || data === void 0 ? void 0 : data.token) === null || _b === void 0 ? void 0 : _b.accessToken)) {
123
+ if (data && ((_e = data === null || data === void 0 ? void 0 : data.token) === null || _e === void 0 ? void 0 : _e.accessToken)) {
117
124
  (0, exports.updateConfiguration)({
118
- accessToken: (_c = data === null || data === void 0 ? void 0 : data.token) === null || _c === void 0 ? void 0 : _c.accessToken,
125
+ accessToken: (_f = data === null || data === void 0 ? void 0 : data.token) === null || _f === void 0 ? void 0 : _f.accessToken,
119
126
  });
120
127
  }
121
128
  return { data, headers, status };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djust-b2b/djust-front-sdk",
3
- "version": "1.19.1",
3
+ "version": "1.20.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",