@djust-b2b/djust-front-sdk 1.19.0 → 1.19.2
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 +2 -2
- package/lib/interfaces/models/cart.d.ts +3 -4
- package/lib/interfaces/models/product.d.ts +16 -0
- package/lib/services/cart/definitions.d.ts +18 -11
- package/lib/services/cart/index.d.ts +15 -6
- package/lib/services/cart/index.js +15 -6
- package/lib/services/product/index.d.ts +2 -2
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -89,7 +89,7 @@ export declare const DjustSDK: {
|
|
|
89
89
|
getProductVariantSuppliers({ productVariantId, }: import("./interfaces").GetProductVariantSuppliersParameters): Promise<import("./interfaces").GetProductVariantSuppliersResponse>;
|
|
90
90
|
getProduct({ productIdentifier, productIdType, locale, }: import("./interfaces").GetProductParameters): Promise<import("./interfaces").GetProductsListResponse>;
|
|
91
91
|
getProductOffers({ productIdentifier, productIdType, locale, currency, }: import("./interfaces").GetProductOffersParameters): Promise<import("./interfaces").GetProductOffersResponse>;
|
|
92
|
-
getRelatedProducts({ productIdentifier, productIdType, locale, currency, pageable, }: import("./interfaces").GetRelatedProductsParameters): Promise<import("./interfaces").
|
|
92
|
+
getRelatedProducts({ productIdentifier, productIdType, locale, currency, pageable, }: import("./interfaces").GetRelatedProductsParameters): Promise<import("./interfaces").GetRelatedProductsResponse>;
|
|
93
93
|
getProductReviews({ productIdentifier, productIdType, }: import("./interfaces").GetProductReviewsParameters): Promise<import("./interfaces").GetProductReviewsResponse>;
|
|
94
94
|
getProductStatReviews({ productIdentifier, productIdType, }: import("./interfaces").GetProductStatReviewsParameters): Promise<import("./interfaces").GetProductStatReviewsResponse>;
|
|
95
95
|
getProductVariantAttributes({ productIdentifier, productIdType, locale, }: import("./interfaces").GetProductVariantAttributesParameters): Promise<import("./interfaces").GetProductVariantAttributesResponse>;
|
|
@@ -126,7 +126,7 @@ export declare const DjustSDK: {
|
|
|
126
126
|
updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }: import("./interfaces").UpdateCustomerAccountOrganisationUserParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationUserResponse>;
|
|
127
127
|
deleteCarts(): Promise<import("./interfaces").DeleteCartsResponse>;
|
|
128
128
|
getCarts(params: import("./interfaces").GetCartsParameters): Promise<import("./interfaces").GetCartsResponse>;
|
|
129
|
-
createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").
|
|
129
|
+
createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").CreateCartResponse>;
|
|
130
130
|
deleteCart(params: import("./interfaces").DeleteCartParameters): Promise<void>;
|
|
131
131
|
getCart(params: import("./interfaces").GetCartParameters): Promise<import("./interfaces").GetCartResponse>;
|
|
132
132
|
updateCart(params: import("./interfaces").UpdateCartParameters): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { OfferDto } from "./offer";
|
|
2
|
-
import {
|
|
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:
|
|
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 {};
|
|
@@ -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:
|
|
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
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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<
|
|
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` | `
|
|
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: [
|
|
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` | `
|
|
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` | `
|
|
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` | `
|
|
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: [
|
|
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` | `
|
|
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` | `
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse, GetProductsListParameters, GetProductsListResponse, GetRelatedProductsParameters, AutoCompleteSearchProductsParameters, SearchProductsResponse, UpdateProductReviewParameters, UpdateProductReviewResponse, GetProductPaginatedOffersParameters, GetProductPaginatedOffersResponse } from "./definitions";
|
|
1
|
+
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse, GetProductsListParameters, GetProductsListResponse, GetRelatedProductsParameters, AutoCompleteSearchProductsParameters, SearchProductsResponse, UpdateProductReviewParameters, UpdateProductReviewResponse, GetProductPaginatedOffersParameters, GetProductPaginatedOffersResponse, GetRelatedProductsResponse } from "./definitions";
|
|
2
2
|
/**
|
|
3
3
|
* 📄 Search products with a text expression for search and autocomplete.
|
|
4
4
|
*
|
|
@@ -241,7 +241,7 @@ export declare function getProductOffers({ productIdentifier, productIdType, loc
|
|
|
241
241
|
* console.log(relatedProducts);
|
|
242
242
|
* ```
|
|
243
243
|
*/
|
|
244
|
-
export declare function getRelatedProducts({ productIdentifier, productIdType, locale, currency, pageable, }: GetRelatedProductsParameters): Promise<
|
|
244
|
+
export declare function getRelatedProducts({ productIdentifier, productIdType, locale, currency, pageable, }: GetRelatedProductsParameters): Promise<GetRelatedProductsResponse>;
|
|
245
245
|
/**
|
|
246
246
|
* 📄 Fetches reviews for a specific product.
|
|
247
247
|
*
|