@djust-b2b/djust-front-sdk 2.1.0 → 2.2.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 +25 -23
- package/lib/index.js +2 -2
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/interfaces/index.js +0 -1
- 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/index.d.ts +32 -0
- package/lib/services/attributes/index.js +49 -0
- package/lib/services/auth/__mocks__/auth.mocks.d.ts +248 -0
- package/lib/services/auth/__mocks__/auth.mocks.js +220 -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 +40 -2
- package/lib/services/custom-field/index.js +50 -3
- 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 +15 -0
- package/lib/services/incident/index.d.ts +81 -2
- package/lib/services/incident/index.js +116 -1
- 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/__mocks__/offer-prices.mocks.d.ts +108 -0
- package/lib/services/offer-prices/__mocks__/offer-prices.mocks.js +200 -0
- package/lib/services/offer-prices/definitions.d.ts +23 -0
- package/lib/services/offer-prices/index.d.ts +35 -0
- package/lib/services/offer-prices/index.js +52 -0
- package/lib/services/payment/index.js +1 -1
- 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/lib/services/supplier/__mocks__/supplier-mocks.d.ts +48 -0
- package/lib/services/supplier/__mocks__/supplier-mocks.js +167 -0
- package/lib/services/supplier/definitions.d.ts +3 -3
- package/lib/services/supplier/index.js +0 -2
- package/package.json +4 -3
- package/lib/interfaces/models/buying-list.d.ts +0 -16
- package/lib/services/buying-list/definitions.d.ts +0 -43
- package/lib/services/buying-list/index.d.ts +0 -33
- package/lib/services/buying-list/index.js +0 -104
- /package/lib/services/{buying-list → attributes}/definitions.js +0 -0
- /package/lib/{interfaces/models/buying-list.js → services/offer-prices/definitions.js} +0 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Mocks centralisés pour les tests du module offer-prices
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.mockHttpErrors = exports.mockErrors = exports.mockResponses = exports.mockOrder = exports.mockPageableObject = exports.mockParameters = exports.mockOfferPrices = exports.mockPriceRanges = exports.mockProductPrices = void 0;
|
|
7
|
+
// Mock data pour les prix de produits
|
|
8
|
+
exports.mockProductPrices = {
|
|
9
|
+
standard: {
|
|
10
|
+
itemPrice: 10.5,
|
|
11
|
+
unitPrice: 2.1,
|
|
12
|
+
itemPriceTTC: 12.6,
|
|
13
|
+
unitPriceTTC: 2.52,
|
|
14
|
+
},
|
|
15
|
+
discounted: {
|
|
16
|
+
itemPrice: 8.4,
|
|
17
|
+
unitPrice: 1.68,
|
|
18
|
+
itemPriceTTC: 10.08,
|
|
19
|
+
unitPriceTTC: 2.02,
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
// Mock data pour les gammes de prix
|
|
23
|
+
exports.mockPriceRanges = {
|
|
24
|
+
single: [
|
|
25
|
+
{
|
|
26
|
+
quantity: 1,
|
|
27
|
+
price: exports.mockProductPrices.standard,
|
|
28
|
+
discountPrice: exports.mockProductPrices.standard,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
multiple: [
|
|
32
|
+
{
|
|
33
|
+
quantity: 1,
|
|
34
|
+
price: exports.mockProductPrices.standard,
|
|
35
|
+
discountPrice: exports.mockProductPrices.standard,
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
quantity: 10,
|
|
39
|
+
price: exports.mockProductPrices.standard,
|
|
40
|
+
discountPrice: exports.mockProductPrices.discounted,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
quantity: 50,
|
|
44
|
+
price: exports.mockProductPrices.standard,
|
|
45
|
+
discountPrice: {
|
|
46
|
+
itemPrice: 7.35,
|
|
47
|
+
unitPrice: 1.47,
|
|
48
|
+
itemPriceTTC: 8.82,
|
|
49
|
+
unitPriceTTC: 1.76,
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
// Mock data pour les prix d'offres
|
|
55
|
+
exports.mockOfferPrices = [
|
|
56
|
+
{
|
|
57
|
+
id: "offer_price_1",
|
|
58
|
+
externalId: "ext_offer_price_1",
|
|
59
|
+
type: "PUBLIC",
|
|
60
|
+
itemPerPack: 5,
|
|
61
|
+
customerAccountExternalId: "",
|
|
62
|
+
customerTagExternalId: "",
|
|
63
|
+
priceRanges: exports.mockPriceRanges.single,
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: "offer_price_2",
|
|
67
|
+
externalId: "ext_offer_price_2",
|
|
68
|
+
type: "GROUP",
|
|
69
|
+
itemPerPack: 10,
|
|
70
|
+
customerAccountExternalId: "",
|
|
71
|
+
customerTagExternalId: "tag_123",
|
|
72
|
+
priceRanges: exports.mockPriceRanges.multiple,
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "offer_price_3",
|
|
76
|
+
externalId: "ext_offer_price_3",
|
|
77
|
+
type: "ACCOUNT",
|
|
78
|
+
itemPerPack: 1,
|
|
79
|
+
customerAccountExternalId: "account_456",
|
|
80
|
+
customerTagExternalId: "",
|
|
81
|
+
priceRanges: exports.mockPriceRanges.single,
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
// Mock data pour les paramètres de test
|
|
85
|
+
exports.mockParameters = {
|
|
86
|
+
getPaginatedOfferPrices: {
|
|
87
|
+
valid: {
|
|
88
|
+
offerInventoryExternalId: "inventory_123",
|
|
89
|
+
},
|
|
90
|
+
withPagination: {
|
|
91
|
+
offerInventoryExternalId: "inventory_123",
|
|
92
|
+
page: 0,
|
|
93
|
+
size: 20,
|
|
94
|
+
},
|
|
95
|
+
withSorting: {
|
|
96
|
+
offerInventoryExternalId: "inventory_123",
|
|
97
|
+
page: 1,
|
|
98
|
+
size: 10,
|
|
99
|
+
sort: "createdAt,desc",
|
|
100
|
+
},
|
|
101
|
+
missingRequired: {
|
|
102
|
+
page: 0,
|
|
103
|
+
size: 20,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
// Mock data pour les objets de pagination
|
|
108
|
+
exports.mockPageableObject = {
|
|
109
|
+
offset: 0,
|
|
110
|
+
pageNumber: 0,
|
|
111
|
+
pageSize: 20,
|
|
112
|
+
paged: true,
|
|
113
|
+
sort: [],
|
|
114
|
+
unpaged: false,
|
|
115
|
+
};
|
|
116
|
+
exports.mockOrder = {
|
|
117
|
+
ascending: false,
|
|
118
|
+
descending: true,
|
|
119
|
+
direction: "DESC",
|
|
120
|
+
ignoreCase: false,
|
|
121
|
+
nullHandling: "NATIVE",
|
|
122
|
+
property: "createdAt",
|
|
123
|
+
};
|
|
124
|
+
// Mock Headers pour les tests
|
|
125
|
+
function createMockHeaders() {
|
|
126
|
+
const headers = new Headers();
|
|
127
|
+
headers.append("Content-Type", "application/json");
|
|
128
|
+
headers.append("dj-client", "test-client");
|
|
129
|
+
headers.append("dj-api-key", "test-api-key");
|
|
130
|
+
return headers;
|
|
131
|
+
}
|
|
132
|
+
// Mock data pour les réponses d'API
|
|
133
|
+
exports.mockResponses = {
|
|
134
|
+
getPaginatedOfferPrices: {
|
|
135
|
+
success: {
|
|
136
|
+
data: {
|
|
137
|
+
content: exports.mockOfferPrices,
|
|
138
|
+
empty: false,
|
|
139
|
+
first: true,
|
|
140
|
+
last: false,
|
|
141
|
+
number: 0,
|
|
142
|
+
numberOfElements: 3,
|
|
143
|
+
pageable: exports.mockPageableObject,
|
|
144
|
+
size: 20,
|
|
145
|
+
sort: [exports.mockOrder],
|
|
146
|
+
totalElements: 15,
|
|
147
|
+
},
|
|
148
|
+
headers: createMockHeaders(),
|
|
149
|
+
status: 200,
|
|
150
|
+
},
|
|
151
|
+
empty: {
|
|
152
|
+
data: {
|
|
153
|
+
content: [],
|
|
154
|
+
empty: true,
|
|
155
|
+
first: true,
|
|
156
|
+
last: true,
|
|
157
|
+
number: 0,
|
|
158
|
+
numberOfElements: 0,
|
|
159
|
+
pageable: exports.mockPageableObject,
|
|
160
|
+
size: 20,
|
|
161
|
+
sort: [],
|
|
162
|
+
totalElements: 0,
|
|
163
|
+
},
|
|
164
|
+
headers: createMockHeaders(),
|
|
165
|
+
status: 200,
|
|
166
|
+
},
|
|
167
|
+
singleItem: {
|
|
168
|
+
data: {
|
|
169
|
+
content: [exports.mockOfferPrices[0]],
|
|
170
|
+
empty: false,
|
|
171
|
+
first: true,
|
|
172
|
+
last: true,
|
|
173
|
+
number: 0,
|
|
174
|
+
numberOfElements: 1,
|
|
175
|
+
pageable: exports.mockPageableObject,
|
|
176
|
+
size: 20,
|
|
177
|
+
sort: [],
|
|
178
|
+
totalElements: 1,
|
|
179
|
+
},
|
|
180
|
+
headers: createMockHeaders(),
|
|
181
|
+
status: 200,
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
// Mock data pour les erreurs
|
|
186
|
+
exports.mockErrors = {
|
|
187
|
+
networkError: new Error("Network error"),
|
|
188
|
+
unauthorized: new Error("Unauthorized"),
|
|
189
|
+
badRequest: new Error("Bad request"),
|
|
190
|
+
notFound: new Error("Not found"),
|
|
191
|
+
serverError: new Error("Internal server error"),
|
|
192
|
+
missingParameter: new Error("Missing required parameter: offerInventoryExternalId"),
|
|
193
|
+
};
|
|
194
|
+
// Mock data pour les cas d'erreur HTTP
|
|
195
|
+
exports.mockHttpErrors = {
|
|
196
|
+
400: { status: 400, message: "Bad Request" },
|
|
197
|
+
401: { status: 401, message: "Unauthorized" },
|
|
198
|
+
404: { status: 404, message: "Not Found" },
|
|
199
|
+
500: { status: 500, message: "Internal Server Error" },
|
|
200
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Order, PageableObject } from "../../interfaces/models/common";
|
|
2
|
+
import { OfferPrice } from "../../interfaces/models/offer";
|
|
3
|
+
/**
|
|
4
|
+
* Requests parameters type definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface GetPaginatedOfferPricesParameters {
|
|
7
|
+
page?: number;
|
|
8
|
+
size?: number;
|
|
9
|
+
sort?: string;
|
|
10
|
+
offerInventoryExternalId?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface GetOfferPricesResponse {
|
|
13
|
+
content: OfferPrice[];
|
|
14
|
+
empty: boolean;
|
|
15
|
+
first: boolean;
|
|
16
|
+
last: boolean;
|
|
17
|
+
number: number;
|
|
18
|
+
numberOfElements: number;
|
|
19
|
+
pageable: PageableObject;
|
|
20
|
+
size: number;
|
|
21
|
+
sort: Order[];
|
|
22
|
+
totalElements: number;
|
|
23
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { GetPaginatedOfferPricesParameters, GetOfferPricesResponse } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* 📄 Gets paginated offer prices.
|
|
4
|
+
*
|
|
5
|
+
* This function retrieves paginated offer prices with filtering by offer inventory external ID.
|
|
6
|
+
* The `offerInventoryExternalId` parameter is mandatory and validated before the request is executed.
|
|
7
|
+
*
|
|
8
|
+
* 🛠 **Endpoint**: `GET /v1/shop/offer-prices` [OFFER-PRICE-550]
|
|
9
|
+
*
|
|
10
|
+
* | Parameter | Type | Required | Description |
|
|
11
|
+
* |---------------------|----------|----------|------------------------------------------------|
|
|
12
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
13
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
14
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
15
|
+
* | `offerInventoryExternalId`| `string` | ✅ | The external ID of the offer inventory. |
|
|
16
|
+
*
|
|
17
|
+
* 📤 **Returns**:
|
|
18
|
+
* A `Promise` resolving to a `GetOfferPricesResponse` containing the paginated offer prices.
|
|
19
|
+
*
|
|
20
|
+
* 🛠 **Example usage**:
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const prices = await getPaginatedOfferPrices({
|
|
23
|
+
* offerInventoryExternalId: "offer123",
|
|
24
|
+
* page: 0,
|
|
25
|
+
* size: 20,
|
|
26
|
+
* sort: "createdAt,desc",
|
|
27
|
+
* });
|
|
28
|
+
* console.log(prices);
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* @param {GetPaginatedOfferPricesParameters} params - The parameters for the request
|
|
32
|
+
* @throws {Error} If `offerInventoryExternalId` is missing
|
|
33
|
+
* @returns {Promise<GetOfferPricesResponse>} A promise resolving to the response containing the paginated offer prices
|
|
34
|
+
*/
|
|
35
|
+
export declare function getPaginatedOfferPrices({ page, size, sort, offerInventoryExternalId, }: GetPaginatedOfferPricesParameters): Promise<GetOfferPricesResponse>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPaginatedOfferPrices = getPaginatedOfferPrices;
|
|
4
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
5
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
6
|
+
/**
|
|
7
|
+
* 📄 Gets paginated offer prices.
|
|
8
|
+
*
|
|
9
|
+
* This function retrieves paginated offer prices with filtering by offer inventory external ID.
|
|
10
|
+
* The `offerInventoryExternalId` parameter is mandatory and validated before the request is executed.
|
|
11
|
+
*
|
|
12
|
+
* 🛠 **Endpoint**: `GET /v1/shop/offer-prices` [OFFER-PRICE-550]
|
|
13
|
+
*
|
|
14
|
+
* | Parameter | Type | Required | Description |
|
|
15
|
+
* |---------------------|----------|----------|------------------------------------------------|
|
|
16
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
17
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
18
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
19
|
+
* | `offerInventoryExternalId`| `string` | ✅ | The external ID of the offer inventory. |
|
|
20
|
+
*
|
|
21
|
+
* 📤 **Returns**:
|
|
22
|
+
* A `Promise` resolving to a `GetOfferPricesResponse` containing the paginated offer prices.
|
|
23
|
+
*
|
|
24
|
+
* 🛠 **Example usage**:
|
|
25
|
+
* ```typescript
|
|
26
|
+
* const prices = await getPaginatedOfferPrices({
|
|
27
|
+
* offerInventoryExternalId: "offer123",
|
|
28
|
+
* page: 0,
|
|
29
|
+
* size: 20,
|
|
30
|
+
* sort: "createdAt,desc",
|
|
31
|
+
* });
|
|
32
|
+
* console.log(prices);
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param {GetPaginatedOfferPricesParameters} params - The parameters for the request
|
|
36
|
+
* @throws {Error} If `offerInventoryExternalId` is missing
|
|
37
|
+
* @returns {Promise<GetOfferPricesResponse>} A promise resolving to the response containing the paginated offer prices
|
|
38
|
+
*/
|
|
39
|
+
async function getPaginatedOfferPrices({ page, size, sort, offerInventoryExternalId, }) {
|
|
40
|
+
(0, parameters_validation_1.required)({ offerInventoryExternalId });
|
|
41
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: `/v1/shop/offer-prices`,
|
|
44
|
+
params: {
|
|
45
|
+
offerInventoryExternalId,
|
|
46
|
+
page,
|
|
47
|
+
size,
|
|
48
|
+
sort,
|
|
49
|
+
},
|
|
50
|
+
});
|
|
51
|
+
return data;
|
|
52
|
+
}
|
|
@@ -155,7 +155,7 @@ async function getPaymentMethods({ reference, countryCode, referenceType, locale
|
|
|
155
155
|
(0, parameters_validation_1.required)({ reference });
|
|
156
156
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
157
157
|
method: "GET",
|
|
158
|
-
path: `/v1/shop/payments/methods`,
|
|
158
|
+
path: `/v1/shop/payments/payments-methods`,
|
|
159
159
|
params: {
|
|
160
160
|
reference,
|
|
161
161
|
countryCode,
|
|
@@ -36,6 +36,9 @@ export interface GetProductsListParameters {
|
|
|
36
36
|
customFields?: string[];
|
|
37
37
|
offerUpdatedTime?: string;
|
|
38
38
|
productUpdatedTime?: string;
|
|
39
|
+
withFacets?: string;
|
|
40
|
+
priceMin?: number;
|
|
41
|
+
priceMax?: number;
|
|
39
42
|
};
|
|
40
43
|
pageable?: PageableParameters;
|
|
41
44
|
}
|
|
@@ -57,6 +60,7 @@ export interface GetProductOffersParameters {
|
|
|
57
60
|
productIdType: string;
|
|
58
61
|
locale?: string;
|
|
59
62
|
currency?: string;
|
|
63
|
+
withoutPrice?: boolean;
|
|
60
64
|
}
|
|
61
65
|
export interface GetProductVariantsListParameters {
|
|
62
66
|
productSku: string;
|
|
@@ -83,6 +87,7 @@ export interface GetProductVariantOffersParameters {
|
|
|
83
87
|
productIdentifier: string;
|
|
84
88
|
productIdType: string;
|
|
85
89
|
currency?: string;
|
|
90
|
+
withoutPrice?: boolean;
|
|
86
91
|
}
|
|
87
92
|
export interface GetRelatedProductsParameters {
|
|
88
93
|
productIdentifier: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse,
|
|
1
|
+
import { CreateProductReviewParameters, CreateProductReviewResponse, GetProductOffersParameters, GetProductOffersResponse, GetProductParameters, GetProductReviewsParameters, GetProductReviewsResponse, GetProductStatReviewsParameters, GetProductStatReviewsResponse, GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantOffersParameters, GetProductVariantOffersResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, 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
|
*
|
|
@@ -57,32 +57,6 @@ export declare function autoCompleteSearchProducts({ input, locale, currency, pa
|
|
|
57
57
|
* ```
|
|
58
58
|
*/
|
|
59
59
|
export declare function getProductsList({ locale, filters, pageable, }: GetProductsListParameters): Promise<GetProductsListResponse>;
|
|
60
|
-
/**
|
|
61
|
-
* 📄 Fetches product variants by product SKU.
|
|
62
|
-
*
|
|
63
|
-
* 🛠 **Endpoint**: `GET /v1/shop/product-variants`
|
|
64
|
-
*
|
|
65
|
-
* | Parameter | Type | Required | Description |
|
|
66
|
-
* |-----------------|--------------|----------|--------------------------------------------|
|
|
67
|
-
* | `productSku` | `string` | ✅ | The SKU of the product. |
|
|
68
|
-
* | `locale` | `string` | ❌ | The locale for product variants. |
|
|
69
|
-
* | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
70
|
-
* | `pageable.size` | `number` | ❌ | The number of items per page. |
|
|
71
|
-
*
|
|
72
|
-
* 📤 **Returns**:
|
|
73
|
-
* A `Promise` resolving to a `GetProductVariantsListResponse` containing the product variants.
|
|
74
|
-
*
|
|
75
|
-
* 🛠 **Example usage**:
|
|
76
|
-
* ```typescript
|
|
77
|
-
* const variants = await getProductVariantsList({
|
|
78
|
-
* productSku: 'sku123',
|
|
79
|
-
* locale: 'en-US',
|
|
80
|
-
* pageable: { page: 0, size: 10 },
|
|
81
|
-
* });
|
|
82
|
-
* console.log(variants);
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export declare function getProductVariantsList({ productSku, locale, pageable, }: GetProductVariantsListParameters): Promise<GetProductVariantsListResponse>;
|
|
86
60
|
/**
|
|
87
61
|
* 📄 Fetches offers for a specific product variant.
|
|
88
62
|
*
|
|
@@ -132,7 +106,7 @@ export declare function getProductVariantsList({ productSku, locale, pageable, }
|
|
|
132
106
|
* }
|
|
133
107
|
* ```
|
|
134
108
|
*/
|
|
135
|
-
export declare function getProductVariantOffers({ productIdentifier, productIdType, currency, }: GetProductVariantOffersParameters): Promise<GetProductVariantOffersResponse>;
|
|
109
|
+
export declare function getProductVariantOffers({ productIdentifier, productIdType, currency, withoutPrice, }: GetProductVariantOffersParameters): Promise<GetProductVariantOffersResponse>;
|
|
136
110
|
/**
|
|
137
111
|
* 📄 Fetches suppliers associated with a product variant.
|
|
138
112
|
*
|
|
@@ -186,6 +160,8 @@ export declare function getProductVariantSuppliers({ productVariantId, }: GetPro
|
|
|
186
160
|
*/
|
|
187
161
|
export declare function getProduct({ productIdentifier, productIdType, locale, }: GetProductParameters): Promise<GetProductsListResponse>;
|
|
188
162
|
/**
|
|
163
|
+
* @deprecated
|
|
164
|
+
*
|
|
189
165
|
* 📄 Fetches product offers by SKU, ID, or external ID.
|
|
190
166
|
*
|
|
191
167
|
* 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/offers`
|
|
@@ -208,8 +184,9 @@ export declare function getProduct({ productIdentifier, productIdType, locale, }
|
|
|
208
184
|
* });
|
|
209
185
|
* console.log(offers);
|
|
210
186
|
* ```
|
|
187
|
+
* SWAGGER [PRODUCT-502]
|
|
211
188
|
*/
|
|
212
|
-
export declare function getProductOffers({ productIdentifier, productIdType, locale, currency, }: GetProductOffersParameters): Promise<GetProductOffersResponse>;
|
|
189
|
+
export declare function getProductOffers({ productIdentifier, productIdType, locale, currency, withoutPrice, }: GetProductOffersParameters): Promise<GetProductOffersResponse>;
|
|
213
190
|
/**
|
|
214
191
|
* 📄 Fetches related products for a specific product.
|
|
215
192
|
*
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.autoCompleteSearchProducts = autoCompleteSearchProducts;
|
|
4
4
|
exports.getProductsList = getProductsList;
|
|
5
|
-
exports.getProductVariantsList = getProductVariantsList;
|
|
6
5
|
exports.getProductVariantOffers = getProductVariantOffers;
|
|
7
6
|
exports.getProductVariantSuppliers = getProductVariantSuppliers;
|
|
8
7
|
exports.getProduct = getProduct;
|
|
@@ -60,6 +59,7 @@ async function autoCompleteSearchProducts({ input, locale, currency, pageable, a
|
|
|
60
59
|
productTags,
|
|
61
60
|
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
62
61
|
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
62
|
+
sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
|
|
63
63
|
},
|
|
64
64
|
});
|
|
65
65
|
return data;
|
|
@@ -104,45 +104,6 @@ async function getProductsList({ locale, filters, pageable, }) {
|
|
|
104
104
|
});
|
|
105
105
|
return data;
|
|
106
106
|
}
|
|
107
|
-
/**
|
|
108
|
-
* 📄 Fetches product variants by product SKU.
|
|
109
|
-
*
|
|
110
|
-
* 🛠 **Endpoint**: `GET /v1/shop/product-variants`
|
|
111
|
-
*
|
|
112
|
-
* | Parameter | Type | Required | Description |
|
|
113
|
-
* |-----------------|--------------|----------|--------------------------------------------|
|
|
114
|
-
* | `productSku` | `string` | ✅ | The SKU of the product. |
|
|
115
|
-
* | `locale` | `string` | ❌ | The locale for product variants. |
|
|
116
|
-
* | `pageable.page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
117
|
-
* | `pageable.size` | `number` | ❌ | The number of items per page. |
|
|
118
|
-
*
|
|
119
|
-
* 📤 **Returns**:
|
|
120
|
-
* A `Promise` resolving to a `GetProductVariantsListResponse` containing the product variants.
|
|
121
|
-
*
|
|
122
|
-
* 🛠 **Example usage**:
|
|
123
|
-
* ```typescript
|
|
124
|
-
* const variants = await getProductVariantsList({
|
|
125
|
-
* productSku: 'sku123',
|
|
126
|
-
* locale: 'en-US',
|
|
127
|
-
* pageable: { page: 0, size: 10 },
|
|
128
|
-
* });
|
|
129
|
-
* console.log(variants);
|
|
130
|
-
* ```
|
|
131
|
-
*/
|
|
132
|
-
async function getProductVariantsList({ productSku, locale, pageable, }) {
|
|
133
|
-
(0, parameters_validation_1.required)({ productSku });
|
|
134
|
-
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
135
|
-
method: "GET",
|
|
136
|
-
path: `/v1/shop/product-variants`,
|
|
137
|
-
params: {
|
|
138
|
-
productSku,
|
|
139
|
-
locale,
|
|
140
|
-
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
141
|
-
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
return data;
|
|
145
|
-
}
|
|
146
107
|
/**
|
|
147
108
|
* 📄 Fetches offers for a specific product variant.
|
|
148
109
|
*
|
|
@@ -192,7 +153,7 @@ async function getProductVariantsList({ productSku, locale, pageable, }) {
|
|
|
192
153
|
* }
|
|
193
154
|
* ```
|
|
194
155
|
*/
|
|
195
|
-
async function getProductVariantOffers({ productIdentifier, productIdType, currency, }) {
|
|
156
|
+
async function getProductVariantOffers({ productIdentifier, productIdType, currency, withoutPrice, }) {
|
|
196
157
|
(0, parameters_validation_1.required)({ productIdentifier, productIdType });
|
|
197
158
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
198
159
|
method: "GET",
|
|
@@ -200,6 +161,7 @@ async function getProductVariantOffers({ productIdentifier, productIdType, curre
|
|
|
200
161
|
params: {
|
|
201
162
|
productIdType,
|
|
202
163
|
currency,
|
|
164
|
+
withoutPrice,
|
|
203
165
|
},
|
|
204
166
|
});
|
|
205
167
|
return data;
|
|
@@ -275,6 +237,8 @@ async function getProduct({ productIdentifier, productIdType, locale, }) {
|
|
|
275
237
|
return data;
|
|
276
238
|
}
|
|
277
239
|
/**
|
|
240
|
+
* @deprecated
|
|
241
|
+
*
|
|
278
242
|
* 📄 Fetches product offers by SKU, ID, or external ID.
|
|
279
243
|
*
|
|
280
244
|
* 🛠 **Endpoint**: `GET /v1/shop/products/{productIdentifier}/offers`
|
|
@@ -297,8 +261,9 @@ async function getProduct({ productIdentifier, productIdType, locale, }) {
|
|
|
297
261
|
* });
|
|
298
262
|
* console.log(offers);
|
|
299
263
|
* ```
|
|
264
|
+
* SWAGGER [PRODUCT-502]
|
|
300
265
|
*/
|
|
301
|
-
async function getProductOffers({ productIdentifier, productIdType, locale, currency, }) {
|
|
266
|
+
async function getProductOffers({ productIdentifier, productIdType, locale, currency, withoutPrice, }) {
|
|
302
267
|
(0, parameters_validation_1.required)({ productIdentifier, productIdType });
|
|
303
268
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
304
269
|
method: "GET",
|
|
@@ -307,6 +272,7 @@ async function getProductOffers({ productIdentifier, productIdType, locale, curr
|
|
|
307
272
|
productIdType,
|
|
308
273
|
locale,
|
|
309
274
|
currency,
|
|
275
|
+
withoutPrice,
|
|
310
276
|
},
|
|
311
277
|
});
|
|
312
278
|
return data;
|
|
@@ -141,4 +141,31 @@ export interface GetProductPaginatedOffersResponse {
|
|
|
141
141
|
totalElements: number;
|
|
142
142
|
totalPages: number;
|
|
143
143
|
}
|
|
144
|
+
export interface GetProductVariantParameters {
|
|
145
|
+
productVariantId: string;
|
|
146
|
+
locale?: string;
|
|
147
|
+
}
|
|
148
|
+
export interface ProductVariantPictureUrl {
|
|
149
|
+
formatType: string;
|
|
150
|
+
heightInPx: number;
|
|
151
|
+
sizeType: string;
|
|
152
|
+
url: string;
|
|
153
|
+
widthInPx: number;
|
|
154
|
+
}
|
|
155
|
+
export interface ProductVariantPicture {
|
|
156
|
+
isMain: boolean;
|
|
157
|
+
urls: ProductVariantPictureUrl[];
|
|
158
|
+
}
|
|
159
|
+
export interface GetProductVariantResponse {
|
|
160
|
+
description: string;
|
|
161
|
+
ean: string;
|
|
162
|
+
externalId: string;
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
productExternalId: string;
|
|
166
|
+
skuProduct: string;
|
|
167
|
+
skuVariant: string;
|
|
168
|
+
status: string;
|
|
169
|
+
variantPictures: ProductVariantPicture[];
|
|
170
|
+
}
|
|
144
171
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
|
|
1
|
+
import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantParameters, GetProductVariantResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
|
|
2
2
|
/**
|
|
3
3
|
* 📄 Fetches a paginated list of product variants.
|
|
4
4
|
*
|
|
@@ -91,3 +91,32 @@ export declare function getProductVariantSuppliers({ productVariantId, }: GetPro
|
|
|
91
91
|
* @returns {Promise<GetProductVariantAttributesResponse>} A promise resolving to the product variant attributes response.
|
|
92
92
|
*/
|
|
93
93
|
export declare function getProductVariantAttributes({ productIdentifier, productIdType, locale, }: GetProductVariantAttributesParameters): Promise<GetProductVariantAttributesResponse>;
|
|
94
|
+
/**
|
|
95
|
+
* 📄 Fetches details of a specific product variant.
|
|
96
|
+
*
|
|
97
|
+
* This function retrieves detailed information about a product variant identified by its ID.
|
|
98
|
+
*
|
|
99
|
+
* 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}`
|
|
100
|
+
*
|
|
101
|
+
* | Parameter | Type | Required | Description |
|
|
102
|
+
* |---------------------|--------------|----------|-------------------------------------------------|
|
|
103
|
+
* | `productVariantId` | `string` | ✅ | The ID of the product variant to fetch. |
|
|
104
|
+
* | `locale` | `string` | ❌ | The locale for localized data (e.g., `en-US`). |
|
|
105
|
+
*
|
|
106
|
+
* 📤 **Returns**:
|
|
107
|
+
* A `Promise` resolving to a `GetProductVariantResponse` object, containing the product variant details.
|
|
108
|
+
*
|
|
109
|
+
* 🛠 **Example usage**:
|
|
110
|
+
* ```typescript
|
|
111
|
+
* const variant = await getProductVariant({
|
|
112
|
+
* productVariantId: 'variant123',
|
|
113
|
+
* locale: 'fr-FR',
|
|
114
|
+
* });
|
|
115
|
+
* console.log(variant);
|
|
116
|
+
* ```
|
|
117
|
+
*
|
|
118
|
+
* @param {GetProductVariantParameters} params - The parameters for fetching the product variant.
|
|
119
|
+
* @throws {Error} If `productVariantId` is missing.
|
|
120
|
+
* @returns {Promise<GetProductVariantResponse>} A promise resolving to the product variant response.
|
|
121
|
+
*/
|
|
122
|
+
export declare function getProductVariant({ productVariantId, locale, }: GetProductVariantParameters): Promise<GetProductVariantResponse>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getProductVariantsList = getProductVariantsList;
|
|
4
4
|
exports.getProductVariantSuppliers = getProductVariantSuppliers;
|
|
5
5
|
exports.getProductVariantAttributes = getProductVariantAttributes;
|
|
6
|
+
exports.getProductVariant = getProductVariant;
|
|
6
7
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
7
8
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
8
9
|
/**
|
|
@@ -129,3 +130,42 @@ async function getProductVariantAttributes({ productIdentifier, productIdType, l
|
|
|
129
130
|
});
|
|
130
131
|
return data;
|
|
131
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* 📄 Fetches details of a specific product variant.
|
|
135
|
+
*
|
|
136
|
+
* This function retrieves detailed information about a product variant identified by its ID.
|
|
137
|
+
*
|
|
138
|
+
* 🛠 **Endpoint**: `GET /v1/shop/product-variants/{productVariantId}`
|
|
139
|
+
*
|
|
140
|
+
* | Parameter | Type | Required | Description |
|
|
141
|
+
* |---------------------|--------------|----------|-------------------------------------------------|
|
|
142
|
+
* | `productVariantId` | `string` | ✅ | The ID of the product variant to fetch. |
|
|
143
|
+
* | `locale` | `string` | ❌ | The locale for localized data (e.g., `en-US`). |
|
|
144
|
+
*
|
|
145
|
+
* 📤 **Returns**:
|
|
146
|
+
* A `Promise` resolving to a `GetProductVariantResponse` object, containing the product variant details.
|
|
147
|
+
*
|
|
148
|
+
* 🛠 **Example usage**:
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const variant = await getProductVariant({
|
|
151
|
+
* productVariantId: 'variant123',
|
|
152
|
+
* locale: 'fr-FR',
|
|
153
|
+
* });
|
|
154
|
+
* console.log(variant);
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
157
|
+
* @param {GetProductVariantParameters} params - The parameters for fetching the product variant.
|
|
158
|
+
* @throws {Error} If `productVariantId` is missing.
|
|
159
|
+
* @returns {Promise<GetProductVariantResponse>} A promise resolving to the product variant response.
|
|
160
|
+
*/
|
|
161
|
+
async function getProductVariant({ productVariantId, locale, }) {
|
|
162
|
+
(0, parameters_validation_1.required)({ productVariantId });
|
|
163
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
164
|
+
method: "GET",
|
|
165
|
+
path: `/v1/shop/product-variants/${productVariantId}`,
|
|
166
|
+
params: {
|
|
167
|
+
locale,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
return data;
|
|
171
|
+
}
|