@commercengine/storefront-sdk 0.3.0 → 0.3.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/dist/index.d.ts +90 -39
- package/dist/index.js +156 -127
- package/dist/lib/auth-utils.d.ts +16 -0
- package/dist/lib/auth-utils.js +38 -0
- package/dist/lib/auth.d.ts +105 -195
- package/dist/lib/auth.js +221 -653
- package/dist/lib/cart.d.ts +77 -80
- package/dist/lib/cart.js +183 -221
- package/dist/lib/catalog.d.ts +36 -69
- package/dist/lib/catalog.js +109 -118
- package/dist/lib/client.d.ts +37 -84
- package/dist/lib/client.js +148 -173
- package/dist/lib/customer.d.ts +87 -0
- package/dist/lib/customer.js +153 -0
- package/dist/lib/helper.d.ts +27 -0
- package/dist/lib/helper.js +40 -0
- package/dist/lib/jwt-utils.d.ts +75 -0
- package/dist/lib/jwt-utils.js +84 -0
- package/dist/lib/middleware.d.ts +83 -0
- package/dist/lib/middleware.js +248 -0
- package/dist/lib/order.d.ts +72 -0
- package/dist/lib/order.js +125 -0
- package/dist/lib/shipping.d.ts +14 -0
- package/dist/lib/shipping.js +17 -0
- package/dist/types/storefront-api-types.d.ts +359 -0
- package/dist/types/storefront-api-types.js +3 -0
- package/dist/types/storefront.d.ts +7976 -7369
- package/package.json +21 -12
package/dist/lib/cart.js
CHANGED
|
@@ -1,45 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CartClient = void 0;
|
|
4
|
-
const client_1 = require("./client");
|
|
1
|
+
import { StorefrontAPIClient } from "./client";
|
|
5
2
|
/**
|
|
6
3
|
* Client for interacting with cart endpoints
|
|
7
4
|
*/
|
|
8
|
-
class CartClient extends
|
|
9
|
-
constructor() {
|
|
10
|
-
super(...arguments);
|
|
11
|
-
this.clientStorage = null;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Set the client storage implementation to use for cart ID management
|
|
15
|
-
*
|
|
16
|
-
* @param storage - The client storage instance
|
|
17
|
-
*/
|
|
18
|
-
setClientStorage(storage) {
|
|
19
|
-
this.clientStorage = storage;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Get the stored cart ID
|
|
23
|
-
*
|
|
24
|
-
* @returns Promise that resolves to the cart ID or null if not found
|
|
25
|
-
*/
|
|
26
|
-
async getCartId() {
|
|
27
|
-
return this.clientStorage?.getCartId() ?? null;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Set the cart ID in storage
|
|
31
|
-
*
|
|
32
|
-
* @param cartId - The cart ID to store
|
|
33
|
-
*/
|
|
34
|
-
async setCartId(cartId) {
|
|
35
|
-
await this.clientStorage?.setCartId(cartId);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Clear the stored cart ID
|
|
39
|
-
*/
|
|
40
|
-
async clearCartId() {
|
|
41
|
-
await this.clientStorage?.clearCartId();
|
|
42
|
-
}
|
|
5
|
+
export class CartClient extends StorefrontAPIClient {
|
|
43
6
|
/**
|
|
44
7
|
* Create a new cart
|
|
45
8
|
*
|
|
@@ -47,119 +10,50 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
47
10
|
* @returns Promise with the created cart
|
|
48
11
|
*/
|
|
49
12
|
async createCart(payload) {
|
|
50
|
-
return this.executeRequest(
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
if (error) {
|
|
55
|
-
this.handleError(error);
|
|
56
|
-
}
|
|
57
|
-
// Store the cart ID
|
|
58
|
-
if (data?.content?.cart?.id) {
|
|
59
|
-
await this.setCartId(data.content.cart.id);
|
|
60
|
-
}
|
|
61
|
-
return data?.content;
|
|
62
|
-
});
|
|
13
|
+
return this.executeRequest(() => this.client.POST("/carts", {
|
|
14
|
+
body: payload,
|
|
15
|
+
}));
|
|
63
16
|
}
|
|
64
17
|
/**
|
|
65
18
|
* Get cart details - either by ID or using the stored cart ID
|
|
66
19
|
*
|
|
67
|
-
* @param cartId -
|
|
20
|
+
* @param cartId - The ID of the cart
|
|
68
21
|
* @returns Promise with cart details
|
|
69
|
-
* @throws Error if no cartId is provided and none is stored
|
|
70
22
|
*/
|
|
71
23
|
async getCart(cartId) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return this.executeRequest(async () => {
|
|
78
|
-
const { data, error } = await this.client.GET("/carts/{id}", {
|
|
79
|
-
params: {
|
|
80
|
-
path: { id },
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
if (error) {
|
|
84
|
-
this.handleError(error);
|
|
85
|
-
}
|
|
86
|
-
return data?.content;
|
|
87
|
-
});
|
|
24
|
+
return this.executeRequest(() => this.client.GET("/carts/{id}", {
|
|
25
|
+
params: {
|
|
26
|
+
path: cartId,
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
88
29
|
}
|
|
89
30
|
/**
|
|
90
31
|
* Delete a cart - either by ID or using the stored cart ID
|
|
91
32
|
*
|
|
92
|
-
* @param cartId -
|
|
33
|
+
* @param cartId - The ID of the cart
|
|
93
34
|
* @returns Promise that resolves when the cart is deleted
|
|
94
|
-
* @throws Error if no cartId is provided and none is stored
|
|
95
35
|
*/
|
|
96
36
|
async deleteCart(cartId) {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
return this.executeRequest(async () => {
|
|
103
|
-
const { error } = await this.client.DELETE("/carts/{id}", {
|
|
104
|
-
params: {
|
|
105
|
-
path: { id },
|
|
106
|
-
},
|
|
107
|
-
body: undefined,
|
|
108
|
-
});
|
|
109
|
-
if (error) {
|
|
110
|
-
this.handleError(error);
|
|
111
|
-
}
|
|
112
|
-
// Clear the stored cart ID if we deleted the current cart
|
|
113
|
-
const storedCartId = await this.getCartId();
|
|
114
|
-
if (cartId === undefined || cartId === storedCartId) {
|
|
115
|
-
await this.clearCartId();
|
|
116
|
-
}
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Add item to cart - either by specified ID or stored cart ID
|
|
121
|
-
* Will create a new cart if no cart ID is available
|
|
122
|
-
*
|
|
123
|
-
* @param item - The item to add to the cart
|
|
124
|
-
* @param cartId - Optional cart ID (if not provided, uses stored cart ID or creates a new cart)
|
|
125
|
-
* @returns Promise with updated or created cart
|
|
126
|
-
*/
|
|
127
|
-
async addItem(item, cartId) {
|
|
128
|
-
// Check if we have a cart ID (either provided or stored)
|
|
129
|
-
const id = cartId || (await this.getCartId());
|
|
130
|
-
// If we don't have a cart ID, create a new cart
|
|
131
|
-
if (!id) {
|
|
132
|
-
return this.createCart({ items: [item] });
|
|
133
|
-
}
|
|
134
|
-
// Otherwise update existing cart
|
|
135
|
-
return this.updateCartItem(id, item);
|
|
37
|
+
return this.executeRequest(() => this.client.DELETE("/carts/{id}", {
|
|
38
|
+
params: {
|
|
39
|
+
path: cartId,
|
|
40
|
+
},
|
|
41
|
+
}));
|
|
136
42
|
}
|
|
137
43
|
/**
|
|
138
44
|
* Update cart items (add, update quantity, remove)
|
|
139
45
|
*
|
|
140
|
-
* @param cartId - The
|
|
141
|
-
* @param
|
|
46
|
+
* @param cartId - The cart id
|
|
47
|
+
* @param body - The body of the request
|
|
142
48
|
* @returns Promise with updated cart
|
|
143
|
-
* @throws Error if no cartId is provided and none is stored
|
|
144
49
|
*/
|
|
145
|
-
async
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const { data, error } = await this.client.POST("/carts/{id}/items", {
|
|
153
|
-
params: {
|
|
154
|
-
path: { id },
|
|
155
|
-
},
|
|
156
|
-
body: item,
|
|
157
|
-
});
|
|
158
|
-
if (error) {
|
|
159
|
-
this.handleError(error);
|
|
160
|
-
}
|
|
161
|
-
return data?.content;
|
|
162
|
-
});
|
|
50
|
+
async addDeleteCartItem(cartId, body) {
|
|
51
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/items", {
|
|
52
|
+
params: {
|
|
53
|
+
path: cartId,
|
|
54
|
+
},
|
|
55
|
+
body: body,
|
|
56
|
+
}));
|
|
163
57
|
}
|
|
164
58
|
/**
|
|
165
59
|
* Get cart details by user ID
|
|
@@ -168,21 +62,11 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
168
62
|
* @returns Promise with cart details
|
|
169
63
|
*/
|
|
170
64
|
async getUserCart(userId) {
|
|
171
|
-
return this.executeRequest(
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
});
|
|
177
|
-
if (error) {
|
|
178
|
-
this.handleError(error);
|
|
179
|
-
}
|
|
180
|
-
// Store the cart ID if present
|
|
181
|
-
if (data?.content?.cart?.id) {
|
|
182
|
-
await this.setCartId(data.content.cart.id);
|
|
183
|
-
}
|
|
184
|
-
return data?.content;
|
|
185
|
-
});
|
|
65
|
+
return this.executeRequest(() => this.client.GET("/carts/users/{user_id}", {
|
|
66
|
+
params: {
|
|
67
|
+
path: userId,
|
|
68
|
+
},
|
|
69
|
+
}));
|
|
186
70
|
}
|
|
187
71
|
/**
|
|
188
72
|
* Delete a cart by user ID
|
|
@@ -191,19 +75,12 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
191
75
|
* @returns Promise that resolves when the cart is deleted
|
|
192
76
|
*/
|
|
193
77
|
async deleteUserCart(userId) {
|
|
194
|
-
return this.executeRequest(
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
});
|
|
201
|
-
if (error) {
|
|
202
|
-
this.handleError(error);
|
|
203
|
-
}
|
|
204
|
-
// Clear the stored cart ID since we deleted the user's cart
|
|
205
|
-
await this.clearCartId();
|
|
206
|
-
});
|
|
78
|
+
return this.executeRequest(() => this.client.DELETE("/carts/users/{user_id}", {
|
|
79
|
+
params: {
|
|
80
|
+
path: userId,
|
|
81
|
+
},
|
|
82
|
+
body: undefined,
|
|
83
|
+
}));
|
|
207
84
|
}
|
|
208
85
|
/**
|
|
209
86
|
* Update cart addresses
|
|
@@ -213,18 +90,12 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
213
90
|
* @returns Promise with updated cart
|
|
214
91
|
*/
|
|
215
92
|
async updateCartAddress(cartId, addressData) {
|
|
216
|
-
return this.executeRequest(
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
});
|
|
223
|
-
if (error) {
|
|
224
|
-
this.handleError(error);
|
|
225
|
-
}
|
|
226
|
-
return data?.content;
|
|
227
|
-
});
|
|
93
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/address", {
|
|
94
|
+
params: {
|
|
95
|
+
path: cartId,
|
|
96
|
+
},
|
|
97
|
+
body: addressData,
|
|
98
|
+
}));
|
|
228
99
|
}
|
|
229
100
|
/**
|
|
230
101
|
* Apply a coupon to the cart
|
|
@@ -234,18 +105,12 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
234
105
|
* @returns Promise with updated cart
|
|
235
106
|
*/
|
|
236
107
|
async applyCoupon(cartId, couponCode) {
|
|
237
|
-
return this.executeRequest(
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
});
|
|
244
|
-
if (error) {
|
|
245
|
-
this.handleError(error);
|
|
246
|
-
}
|
|
247
|
-
return data?.content;
|
|
248
|
-
});
|
|
108
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/coupon", {
|
|
109
|
+
params: {
|
|
110
|
+
path: cartId,
|
|
111
|
+
},
|
|
112
|
+
body: couponCode,
|
|
113
|
+
}));
|
|
249
114
|
}
|
|
250
115
|
/**
|
|
251
116
|
* Remove a coupon from the cart
|
|
@@ -254,18 +119,12 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
254
119
|
* @returns Promise with updated cart
|
|
255
120
|
*/
|
|
256
121
|
async removeCoupon(cartId) {
|
|
257
|
-
return this.executeRequest(
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
});
|
|
264
|
-
if (error) {
|
|
265
|
-
this.handleError(error);
|
|
266
|
-
}
|
|
267
|
-
return data?.content;
|
|
268
|
-
});
|
|
122
|
+
return this.executeRequest(() => this.client.DELETE("/carts/{id}/coupon", {
|
|
123
|
+
params: {
|
|
124
|
+
path: cartId,
|
|
125
|
+
},
|
|
126
|
+
body: undefined,
|
|
127
|
+
}));
|
|
269
128
|
}
|
|
270
129
|
/**
|
|
271
130
|
* Redeem loyalty points
|
|
@@ -275,18 +134,12 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
275
134
|
* @returns Promise with updated cart
|
|
276
135
|
*/
|
|
277
136
|
async redeemLoyaltyPoints(cartId, points) {
|
|
278
|
-
return this.executeRequest(
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
});
|
|
285
|
-
if (error) {
|
|
286
|
-
this.handleError(error);
|
|
287
|
-
}
|
|
288
|
-
return data?.content;
|
|
289
|
-
});
|
|
137
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/loyalty-points", {
|
|
138
|
+
params: {
|
|
139
|
+
path: cartId,
|
|
140
|
+
},
|
|
141
|
+
body: points,
|
|
142
|
+
}));
|
|
290
143
|
}
|
|
291
144
|
/**
|
|
292
145
|
* Remove loyalty points
|
|
@@ -295,18 +148,127 @@ class CartClient extends client_1.StorefrontAPIClient {
|
|
|
295
148
|
* @returns Promise with updated cart
|
|
296
149
|
*/
|
|
297
150
|
async removeLoyaltyPoints(cartId) {
|
|
298
|
-
return this.executeRequest(
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
151
|
+
return this.executeRequest(() => this.client.DELETE("/carts/{id}/loyalty-points", {
|
|
152
|
+
params: {
|
|
153
|
+
path: cartId,
|
|
154
|
+
},
|
|
155
|
+
body: undefined,
|
|
156
|
+
}));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Update shipping method
|
|
160
|
+
*
|
|
161
|
+
* @param cartId - The ID of the cart
|
|
162
|
+
* @param body - The body of the request
|
|
163
|
+
* @returns Promise with updated cart
|
|
164
|
+
*/
|
|
165
|
+
async updateShippingMethod(cartId, body) {
|
|
166
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/shipping-method", {
|
|
167
|
+
params: {
|
|
168
|
+
path: cartId,
|
|
169
|
+
},
|
|
170
|
+
body: body,
|
|
171
|
+
}));
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Use credit balance
|
|
175
|
+
*
|
|
176
|
+
* @param cartId - The ID of the cart
|
|
177
|
+
* @param body - The body of the request
|
|
178
|
+
* @returns Promise with updated cart
|
|
179
|
+
*/
|
|
180
|
+
async redeemCreditBalance(cartId, body) {
|
|
181
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/credit-balance", {
|
|
182
|
+
params: {
|
|
183
|
+
path: cartId,
|
|
184
|
+
},
|
|
185
|
+
body: body,
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Remove credit balance
|
|
190
|
+
*
|
|
191
|
+
* @param cartId - The ID of the cart
|
|
192
|
+
* @returns Promise with updated cart
|
|
193
|
+
*/
|
|
194
|
+
async removeCreditBalance(cartId) {
|
|
195
|
+
return this.executeRequest(() => this.client.DELETE("/carts/{id}/credit-balance", {
|
|
196
|
+
params: {
|
|
197
|
+
path: cartId,
|
|
198
|
+
},
|
|
199
|
+
body: undefined,
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Redeem gift card
|
|
204
|
+
*
|
|
205
|
+
* @param cartId - The ID of the cart
|
|
206
|
+
* @param body - The body of the request
|
|
207
|
+
* @returns Promise with updated cart
|
|
208
|
+
*/
|
|
209
|
+
async redeemGiftCard(cartId, body) {
|
|
210
|
+
return this.executeRequest(() => this.client.POST("/carts/{id}/gift-card", {
|
|
211
|
+
params: {
|
|
212
|
+
path: cartId,
|
|
213
|
+
},
|
|
214
|
+
body: body,
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Remove gift card
|
|
219
|
+
*
|
|
220
|
+
* @param cartId - The ID of the cart
|
|
221
|
+
* @returns Promise with updated cart
|
|
222
|
+
*/
|
|
223
|
+
async removeGiftCard(cartId) {
|
|
224
|
+
return this.executeRequest(() => this.client.DELETE("/carts/{id}/gift-card", {
|
|
225
|
+
params: {
|
|
226
|
+
path: cartId,
|
|
227
|
+
},
|
|
228
|
+
body: undefined,
|
|
229
|
+
}));
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* Get wishlist items
|
|
233
|
+
*
|
|
234
|
+
* @param userId - The ID of the user
|
|
235
|
+
* @returns Promise with wishlist items
|
|
236
|
+
*/
|
|
237
|
+
async getWishlist(userId) {
|
|
238
|
+
return this.executeRequest(() => this.client.GET("/wishlist/{user_id}", {
|
|
239
|
+
params: {
|
|
240
|
+
path: userId,
|
|
241
|
+
},
|
|
242
|
+
}));
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Add item to wishlist
|
|
246
|
+
*
|
|
247
|
+
* @param userId - The ID of the user
|
|
248
|
+
* @param itemId - The ID of the item
|
|
249
|
+
* @returns Promise with updated wishlist
|
|
250
|
+
*/
|
|
251
|
+
async addToWishlist(userId, itemId) {
|
|
252
|
+
return this.executeRequest(() => this.client.POST("/wishlist/{user_id}", {
|
|
253
|
+
params: {
|
|
254
|
+
path: userId,
|
|
255
|
+
},
|
|
256
|
+
body: itemId,
|
|
257
|
+
}));
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Remove item from wishlist
|
|
261
|
+
*
|
|
262
|
+
* @param userId - The ID of the user
|
|
263
|
+
* @param itemId - The ID of the item
|
|
264
|
+
* @returns Promise with updated wishlist
|
|
265
|
+
*/
|
|
266
|
+
async removeFromWishlist(userId, body) {
|
|
267
|
+
return this.executeRequest(() => this.client.DELETE("/wishlist/{user_id}", {
|
|
268
|
+
params: {
|
|
269
|
+
path: userId,
|
|
270
|
+
},
|
|
271
|
+
body: body,
|
|
272
|
+
}));
|
|
310
273
|
}
|
|
311
274
|
}
|
|
312
|
-
exports.CartClient = CartClient;
|
package/dist/lib/catalog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StorefrontAPIClient } from "./client";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ApiResult, GetProductDetailContent, GetProductDetailPathParams, GetProductDetailQuery, GetVariantDetailContent, GetVariantDetailQuery, GetVariantDetailPathParams, ListProductsContent, ListProductsQuery, ListProductVariantsContent, ListProductVariantsPathParams, ListProductVariantsQuery, ListCategoriesQuery, ListCategoriesContent, ListProductReviewsQuery, ListProductReviewsPathParams, ListProductReviewsContent, CreateProductReviewPathParams, CreateProductReviewFormData, CreateProductReviewResponse, SearchProductsBody, SearchProductsContent, ListSkusQuery, ListSkusContent, ListCrosssellProductsContent, ListCrosssellProductsQuery, ListUpsellProductsQuery, ListUpsellProductsContent, ListSimilarProductsQuery, ListSimilarProductsContent } from "../types/storefront-api-types";
|
|
3
3
|
/**
|
|
4
4
|
* Client for interacting with catalog endpoints
|
|
5
5
|
*/
|
|
@@ -10,16 +10,14 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
10
10
|
* @param options - Optional query parameters
|
|
11
11
|
* @returns Promise with products and pagination info
|
|
12
12
|
*/
|
|
13
|
-
listProducts(options?:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
pagination: components["schemas"]["Pagination"];
|
|
22
|
-
}>;
|
|
13
|
+
listProducts(options?: ListProductsQuery): Promise<ApiResult<ListProductsContent>>;
|
|
14
|
+
/**
|
|
15
|
+
* List all skus
|
|
16
|
+
*
|
|
17
|
+
* @param options - Optional query parameters
|
|
18
|
+
* @returns Promise with skus and pagination info
|
|
19
|
+
*/
|
|
20
|
+
listSkus(options?: ListSkusQuery): Promise<ApiResult<ListSkusContent>>;
|
|
23
21
|
/**
|
|
24
22
|
* Get details for a specific product
|
|
25
23
|
*
|
|
@@ -27,11 +25,7 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
27
25
|
* @param options - Optional query parameters
|
|
28
26
|
* @returns Promise with product details
|
|
29
27
|
*/
|
|
30
|
-
getProductDetail(
|
|
31
|
-
customer_group_id?: string;
|
|
32
|
-
}): Promise<{
|
|
33
|
-
product: components["schemas"]["ProductDetail"];
|
|
34
|
-
}>;
|
|
28
|
+
getProductDetail(pathParams: GetProductDetailPathParams, queryParams?: GetProductDetailQuery): Promise<ApiResult<GetProductDetailContent>>;
|
|
35
29
|
/**
|
|
36
30
|
* List variants for a specific product
|
|
37
31
|
*
|
|
@@ -39,11 +33,7 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
39
33
|
* @param options - Optional query parameters
|
|
40
34
|
* @returns Promise with variants
|
|
41
35
|
*/
|
|
42
|
-
listProductVariants(
|
|
43
|
-
customer_group_id?: string;
|
|
44
|
-
}): Promise<{
|
|
45
|
-
variants: components["schemas"]["Variant"][];
|
|
46
|
-
}>;
|
|
36
|
+
listProductVariants(pathParams: ListProductVariantsPathParams, queryParams?: ListProductVariantsQuery): Promise<ApiResult<ListProductVariantsContent>>;
|
|
47
37
|
/**
|
|
48
38
|
* Get details for a specific variant
|
|
49
39
|
*
|
|
@@ -52,26 +42,14 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
52
42
|
* @param options - Optional query parameters
|
|
53
43
|
* @returns Promise with variant details
|
|
54
44
|
*/
|
|
55
|
-
getVariantDetail(
|
|
56
|
-
customer_group_id?: string;
|
|
57
|
-
}): Promise<{
|
|
58
|
-
variant: components["schemas"]["VariantDetail"];
|
|
59
|
-
}>;
|
|
45
|
+
getVariantDetail(pathParams: GetVariantDetailPathParams, queryParams?: GetVariantDetailQuery): Promise<ApiResult<GetVariantDetailContent>>;
|
|
60
46
|
/**
|
|
61
47
|
* List all categories
|
|
62
48
|
*
|
|
63
49
|
* @param options - Optional query parameters
|
|
64
50
|
* @returns Promise with categories and pagination info
|
|
65
51
|
*/
|
|
66
|
-
listCategories(options?:
|
|
67
|
-
parent_category_id?: string;
|
|
68
|
-
nested_level?: number;
|
|
69
|
-
search?: string;
|
|
70
|
-
sort_by?: string;
|
|
71
|
-
}): Promise<{
|
|
72
|
-
categories: components["schemas"]["ProductCategory"][];
|
|
73
|
-
pagination: components["schemas"]["Pagination"];
|
|
74
|
-
}>;
|
|
52
|
+
listCategories(options?: ListCategoriesQuery): Promise<ApiResult<ListCategoriesContent>>;
|
|
75
53
|
/**
|
|
76
54
|
* List reviews for a specific product
|
|
77
55
|
*
|
|
@@ -79,17 +57,7 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
79
57
|
* @param options - Optional query parameters
|
|
80
58
|
* @returns Promise with reviews and pagination info
|
|
81
59
|
*/
|
|
82
|
-
listProductReviews(
|
|
83
|
-
page?: number;
|
|
84
|
-
limit?: number;
|
|
85
|
-
sort_by?: string;
|
|
86
|
-
search?: string;
|
|
87
|
-
review_tag?: string;
|
|
88
|
-
}): Promise<{
|
|
89
|
-
reviews: components["schemas"]["ProductReview"][];
|
|
90
|
-
review_tags?: string[] | null;
|
|
91
|
-
pagination?: components["schemas"]["Pagination"];
|
|
92
|
-
}>;
|
|
60
|
+
listProductReviews(pathParams: ListProductReviewsPathParams, queryParams?: ListProductReviewsQuery): Promise<ApiResult<ListProductReviewsContent>>;
|
|
93
61
|
/**
|
|
94
62
|
* Create a review for a specific product
|
|
95
63
|
*
|
|
@@ -97,34 +65,33 @@ export declare class CatalogClient extends StorefrontAPIClient {
|
|
|
97
65
|
* @param reviewData - The review data
|
|
98
66
|
* @returns Promise that resolves when the review is created
|
|
99
67
|
*/
|
|
100
|
-
createProductReview(
|
|
68
|
+
createProductReview(pathParams: CreateProductReviewPathParams, formData: CreateProductReviewFormData): Promise<ApiResult<CreateProductReviewResponse>>;
|
|
101
69
|
/**
|
|
102
70
|
* Search for products
|
|
103
71
|
*
|
|
104
72
|
* @param searchData - The search parameters
|
|
105
|
-
* @returns Promise with search results
|
|
73
|
+
* @returns Promise with search results, facet distribution, facet stats, and pagination
|
|
74
|
+
*/
|
|
75
|
+
searchProducts(searchData: SearchProductsBody): Promise<ApiResult<SearchProductsContent>>;
|
|
76
|
+
/**
|
|
77
|
+
* Retrieve cross-sell recommendations for a specific product
|
|
78
|
+
*
|
|
79
|
+
* @param options - Optional query parameters
|
|
80
|
+
* @returns Promise with cross-sell recommendations with pagination
|
|
106
81
|
*/
|
|
107
|
-
|
|
108
|
-
skus: components["schemas"]["SKU"][];
|
|
109
|
-
facet_distribution: {
|
|
110
|
-
[key: string]: {
|
|
111
|
-
[key: string]: number;
|
|
112
|
-
};
|
|
113
|
-
};
|
|
114
|
-
facet_stats: {
|
|
115
|
-
[key: string]: {
|
|
116
|
-
min: number;
|
|
117
|
-
max: number;
|
|
118
|
-
};
|
|
119
|
-
};
|
|
120
|
-
pagination: components["schemas"]["Pagination"];
|
|
121
|
-
}>;
|
|
82
|
+
listCrossSellProducts(options?: ListCrosssellProductsQuery): Promise<ApiResult<ListCrosssellProductsContent>>;
|
|
122
83
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* @
|
|
84
|
+
* Retrieve up-sell recommendations for a specific product
|
|
85
|
+
*
|
|
86
|
+
* @param options - Optional query parameters
|
|
87
|
+
* @returns Promise with up-sell recommendations with pagination
|
|
88
|
+
*/
|
|
89
|
+
listUpSellProducts(options?: ListUpsellProductsQuery): Promise<ApiResult<ListUpsellProductsContent>>;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve related products for a specific product
|
|
92
|
+
*
|
|
93
|
+
* @param options - Optional query parameters
|
|
94
|
+
* @returns Promise with related products with pagination
|
|
126
95
|
*/
|
|
127
|
-
|
|
128
|
-
product: components["schemas"]["ProductDetail"];
|
|
129
|
-
}>;
|
|
96
|
+
listSimilarProducts(options?: ListSimilarProductsQuery): Promise<ApiResult<ListSimilarProductsContent>>;
|
|
130
97
|
}
|