@epcc-sdk/sdks-shopper 0.0.6 → 0.0.9
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/README.md
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
# @epcc-sdk/sdks-shopper SDK
|
|
2
|
+
|
|
3
|
+
Below you’ll find instructions on how to install, set up, and use the client, along with a list of available operations.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- type-safe response data and errors
|
|
8
|
+
- response data validation and transformation
|
|
9
|
+
- access to the original request and response
|
|
10
|
+
- granular request and response customization options
|
|
11
|
+
- minimal learning curve thanks to extending the underlying technology
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @epcc-sdk/sdks-shopper
|
|
19
|
+
# or
|
|
20
|
+
pnpm install @epcc-sdk/sdks-shopper
|
|
21
|
+
# or
|
|
22
|
+
yarn add @epcc-sdk/sdks-shopper
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Client Usage
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Clients are responsible for sending the actual HTTP requests.
|
|
31
|
+
|
|
32
|
+
The Fetch client is built as a thin wrapper on top of Fetch API, extending its functionality. If you're already familiar with Fetch, configuring your client will feel like working directly with Fetch API.
|
|
33
|
+
|
|
34
|
+
You can configure the client in two ways:
|
|
35
|
+
|
|
36
|
+
- Configuring the internal `client` instance directly
|
|
37
|
+
- Using the `createClient` function
|
|
38
|
+
|
|
39
|
+
**When using the operation function to make requests, by default the global client will be used unless another is provided.**
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### 1. Configure the internal `client` instance directly
|
|
43
|
+
|
|
44
|
+
This is the simpler approach. You can call the setConfig() method at the beginning of your application or anytime you need to update the client configuration. You can pass any Fetch API configuration option to setConfig(), and even your own Fetch implementation.
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
import { client } from "@epcc-sdk/sdks-shopper";
|
|
48
|
+
|
|
49
|
+
client.setConfig({
|
|
50
|
+
// set default base url for requests
|
|
51
|
+
baseUrl: 'https://euwest.api.elasticpath.com',
|
|
52
|
+
|
|
53
|
+
// set default headers for requests
|
|
54
|
+
headers: {
|
|
55
|
+
Authorization: 'Bearer YOUR_AUTH_TOKEN',
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The disadvantage of this approach is that your code may call the client instance before it's configured for the first time. Depending on your use case, you might need to use the second approach.
|
|
61
|
+
|
|
62
|
+
### 2. Using the `createClient` function
|
|
63
|
+
|
|
64
|
+
This is useful when you want to use a different instance of the client for different parts of your application or when you want to use different configurations for different parts of your application.
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
import { createClient } from "@epcc-sdk/sdks-shopper";
|
|
68
|
+
|
|
69
|
+
// Create the client with your API base URL.
|
|
70
|
+
const client = createClient({
|
|
71
|
+
// set default base url for requests
|
|
72
|
+
baseUrl: "https://euwest.api.elasticpath.com",
|
|
73
|
+
/**
|
|
74
|
+
* Set default headers only for requests made by this client.
|
|
75
|
+
*/
|
|
76
|
+
headers: {
|
|
77
|
+
"Custom-Header": 'My Value',
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
You can also pass this instance to any SDK function through the client option. This will override the default instance from `import { client } from "@epcc-sdk/sdks-shopper>".
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
const response = await getByContextProduct({
|
|
86
|
+
client: myClient,
|
|
87
|
+
});
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Direct configuration
|
|
91
|
+
|
|
92
|
+
Alternatively, you can pass the client configuration options to each SDK function. This is useful if you don't want to create a client instance for one-off use cases.
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const response = await getByContextProduct({
|
|
96
|
+
baseUrl: 'https://example.com', // <-- override default configuration
|
|
97
|
+
});
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Interceptors (Middleware)
|
|
101
|
+
|
|
102
|
+
Interceptors (middleware) can be used to modify requests before they're sent or responses before they're returned to your application. They can be added with use and removed with eject. Below is an example request interceptor
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { client } from "@epcc-sdk/sdks-shopper";
|
|
106
|
+
|
|
107
|
+
// Supports async functions
|
|
108
|
+
client.interceptors.request.use(async (request) => {
|
|
109
|
+
// do something
|
|
110
|
+
return request;
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
client.interceptors.request.eject((request) => {
|
|
114
|
+
// do something
|
|
115
|
+
return request;
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
and an example response interceptor
|
|
121
|
+
|
|
122
|
+
```ts
|
|
123
|
+
import { client } from "@epcc-sdk/sdks-shopper";
|
|
124
|
+
|
|
125
|
+
client.interceptors.response.use((response) => {
|
|
126
|
+
// do something
|
|
127
|
+
return response;
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
client.interceptors.response.eject((response) => {
|
|
131
|
+
// do something
|
|
132
|
+
return response;
|
|
133
|
+
});
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
> **_Tip:_** To eject, you must provide a reference to the function that was passed to use().
|
|
137
|
+
|
|
138
|
+
## Authentication
|
|
139
|
+
|
|
140
|
+
We are working to provide helpers to handle auth easier for you but for now using an interceptor is the easiest method.
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { client } from "@epcc-sdk/sdks-shopper";
|
|
144
|
+
|
|
145
|
+
client.interceptors.request.use((request, options) => {
|
|
146
|
+
request.headers.set('Authorization', 'Bearer MY_TOKEN');
|
|
147
|
+
return request;
|
|
148
|
+
});
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Build URL
|
|
152
|
+
|
|
153
|
+
If you need to access the compiled URL, you can use the buildUrl() method. It's loosely typed by default to accept almost any value; in practice, you will want to pass a type hint.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
type FooData = {
|
|
157
|
+
path: {
|
|
158
|
+
fooId: number;
|
|
159
|
+
};
|
|
160
|
+
query?: {
|
|
161
|
+
bar?: string;
|
|
162
|
+
};
|
|
163
|
+
url: '/foo/{fooId}';
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const url = client.buildUrl<FooData>({
|
|
167
|
+
path: {
|
|
168
|
+
fooId: 1,
|
|
169
|
+
},
|
|
170
|
+
query: {
|
|
171
|
+
bar: 'baz',
|
|
172
|
+
},
|
|
173
|
+
url: '/foo/{fooId}',
|
|
174
|
+
});
|
|
175
|
+
console.log(url); // prints '/foo/1?bar=baz'
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
## Operation Usage
|
|
186
|
+
The following examples demonstrate how to use the operation function to make requests.
|
|
187
|
+
|
|
188
|
+
```ts
|
|
189
|
+
import { getByContextProduct } from "@epcc-sdk/sdks-shopper";
|
|
190
|
+
|
|
191
|
+
const product = await getByContextProduct({
|
|
192
|
+
// client: localClient, // optional if you have a client instance you want to use otherwise the global client will be used
|
|
193
|
+
path: {
|
|
194
|
+
...
|
|
195
|
+
},
|
|
196
|
+
query: {
|
|
197
|
+
...
|
|
198
|
+
},
|
|
199
|
+
});
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## Available Operations
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
- **`getByContextRelease`** (`GET /catalog`)
|
|
211
|
+
|
|
212
|
+
- **`getByContextAllHierarchies`** (`GET /catalog/hierarchies`)
|
|
213
|
+
|
|
214
|
+
- **`getByContextHierarchy`** (`GET /catalog/hierarchies/{hierarchy_id}`)
|
|
215
|
+
|
|
216
|
+
- **`getByContextHierarchyNodes`** (`GET /catalog/hierarchies/{hierarchy_id}/nodes`)
|
|
217
|
+
|
|
218
|
+
- **`getByContextHierarchyChildNodes`** (`GET /catalog/hierarchies/{hierarchy_id}/children`)
|
|
219
|
+
|
|
220
|
+
- **`getByContextAllNodes`** (`GET /catalog/nodes`)
|
|
221
|
+
|
|
222
|
+
- **`getByContextNode`** (`GET /catalog/nodes/{node_id}`)
|
|
223
|
+
|
|
224
|
+
- **`getByContextChildNodes`** (`GET /catalog/nodes/{node_id}/relationships/children`)
|
|
225
|
+
|
|
226
|
+
- **`getByContextAllProducts`** (`GET /catalog/products`)
|
|
227
|
+
|
|
228
|
+
- **`getByContextProduct`** (`GET /catalog/products/{product_id}`)
|
|
229
|
+
|
|
230
|
+
- **`getByContextComponentProductIds`** (`GET /catalog/products/{product_id}/relationships/component_products`)
|
|
231
|
+
|
|
232
|
+
- **`getByContextChildProducts`** (`GET /catalog/products/{product_id}/relationships/children`)
|
|
233
|
+
|
|
234
|
+
- **`getByContextProductsForHierarchy`** (`GET /catalog/hierarchies/{hierarchy_id}/products`)
|
|
235
|
+
|
|
236
|
+
- **`getByContextProductsForNode`** (`GET /catalog/nodes/{node_id}/relationships/products`)
|
|
237
|
+
|
|
238
|
+
- **`configureByContextProduct`** (`POST /catalog/products/{product_id}/configure`)
|
|
239
|
+
|
|
240
|
+
- **`getCatalogs`** (`GET /catalogs`)
|
|
241
|
+
|
|
242
|
+
- **`createCatalog`** (`POST /catalogs`)
|
|
243
|
+
|
|
244
|
+
- **`deleteCatalogById`** (`DELETE /catalogs/{catalog_id}`)
|
|
245
|
+
|
|
246
|
+
- **`getCatalogById`** (`GET /catalogs/{catalog_id}`)
|
|
247
|
+
|
|
248
|
+
- **`updateCatalog`** (`PUT /catalogs/{catalog_id}`)
|
|
249
|
+
|
|
250
|
+
- **`deleteReleases`** (`DELETE /catalogs/{catalog_id}/releases`)
|
|
251
|
+
|
|
252
|
+
- **`getReleases`** (`GET /catalogs/{catalog_id}/releases`)
|
|
253
|
+
|
|
254
|
+
- **`publishRelease`** (`POST /catalogs/{catalog_id}/releases`)
|
|
255
|
+
|
|
256
|
+
- **`deleteReleaseById`** (`DELETE /catalogs/{catalog_id}/releases/{release_id}`)
|
|
257
|
+
|
|
258
|
+
- **`getReleaseById`** (`GET /catalogs/{catalog_id}/releases/{release_id}`)
|
|
259
|
+
|
|
260
|
+
- **`getRules`** (`GET /catalogs/rules`)
|
|
261
|
+
|
|
262
|
+
- **`createRule`** (`POST /catalogs/rules`)
|
|
263
|
+
|
|
264
|
+
- **`deleteRuleById`** (`DELETE /catalogs/rules/{catalog_rule_id}`)
|
|
265
|
+
|
|
266
|
+
- **`getRuleById`** (`GET /catalogs/rules/{catalog_rule_id}`)
|
|
267
|
+
|
|
268
|
+
- **`updateRule`** (`PUT /catalogs/rules/{catalog_rule_id}`)
|
|
269
|
+
|
|
270
|
+
- **`getAllHierarchies`** (`GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies`)
|
|
271
|
+
|
|
272
|
+
- **`getHierarchy`** (`GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}`)
|
|
273
|
+
|
|
274
|
+
- **`getHierarchyNodes`** (`GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/nodes`)
|
|
275
|
+
|
|
276
|
+
- **`getHierarchyChildNodes`** (`GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/children`)
|
|
277
|
+
|
|
278
|
+
- **`getAllNodes`** (`GET /catalogs/{catalog_id}/releases/{release_id}/nodes`)
|
|
279
|
+
|
|
280
|
+
- **`getNode`** (`GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}`)
|
|
281
|
+
|
|
282
|
+
- **`getChildNodes`** (`GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/children`)
|
|
283
|
+
|
|
284
|
+
- **`getAllProducts`** (`GET /catalogs/{catalog_id}/releases/{release_id}/products`)
|
|
285
|
+
|
|
286
|
+
- **`getProduct`** (`GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}`)
|
|
287
|
+
|
|
288
|
+
- **`getComponentProductIds`** (`GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/component_products`)
|
|
289
|
+
|
|
290
|
+
- **`getChildProducts`** (`GET /catalogs/{catalog_id}/releases/{release_id}/products/{product_id}/relationships/children`)
|
|
291
|
+
|
|
292
|
+
- **`getProductsForHierarchy`** (`GET /catalogs/{catalog_id}/releases/{release_id}/hierarchies/{hierarchy_id}/products`)
|
|
293
|
+
|
|
294
|
+
- **`getProductsForNode`** (`GET /catalogs/{catalog_id}/releases/{release_id}/nodes/{node_id}/relationships/products`)
|
|
295
|
+
|
|
296
|
+
- **`getCarts`** (`GET /v2/carts`)
|
|
297
|
+
|
|
298
|
+
- **`createACart`** (`POST /v2/carts`)
|
|
299
|
+
|
|
300
|
+
- **`deleteACart`** (`DELETE /v2/carts/{cartID}`)
|
|
301
|
+
|
|
302
|
+
- **`getCart`** (`GET /v2/carts/{cartID}`)
|
|
303
|
+
|
|
304
|
+
- **`updateACart`** (`PUT /v2/carts/{cartID}`)
|
|
305
|
+
|
|
306
|
+
- **`deleteAllCartItems`** (`DELETE /v2/carts/{cartID}/items`)
|
|
307
|
+
|
|
308
|
+
- **`getCartItems`** (`GET /v2/carts/{cartID}/items`)
|
|
309
|
+
|
|
310
|
+
- **`manageCarts`** (`POST /v2/carts/{cartID}/items`)
|
|
311
|
+
|
|
312
|
+
- **`bulkUpdateItemsInCart`** (`PUT /v2/carts/{cartID}/items`)
|
|
313
|
+
|
|
314
|
+
- **`deleteACartItem`** (`DELETE /v2/carts/{cartID}/items/{cartitemID}`)
|
|
315
|
+
|
|
316
|
+
- **`updateACartItem`** (`PUT /v2/carts/{cartID}/items/{cartitemID}`)
|
|
317
|
+
|
|
318
|
+
- **`deleteAccountCartAssociation`** (`DELETE /v2/carts/{cartID}/relationships/accounts`)
|
|
319
|
+
|
|
320
|
+
- **`createAccountCartAssociation`** (`POST /v2/carts/{cartID}/relationships/accounts`)
|
|
321
|
+
|
|
322
|
+
- **`deleteCustomerCartAssociation`** (`DELETE /v2/carts/{cartID}/relationships/customers`)
|
|
323
|
+
|
|
324
|
+
- **`createCustomerCartAssociation`** (`POST /v2/carts/{cartID}/relationships/customers`)
|
|
325
|
+
|
|
326
|
+
- **`deleteAPromotionViaPromotionCode`** (`DELETE /v2/carts/{cartID}/discounts/{promoCode}`)
|
|
327
|
+
|
|
328
|
+
- **`addTaxItemToCart`** (`POST /v2/carts/{cartID}/items/{cartitemID}/taxes`)
|
|
329
|
+
|
|
330
|
+
- **`bulkDeleteTaxItemsFromCart`** (`DELETE /v2/carts/{cartID}/taxes`)
|
|
331
|
+
|
|
332
|
+
- **`bulkAddTaxItemsToCart`** (`POST /v2/carts/{cartID}/taxes`)
|
|
333
|
+
|
|
334
|
+
- **`deleteATaxItem`** (`DELETE /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}`)
|
|
335
|
+
|
|
336
|
+
- **`updateATaxItem`** (`PUT /v2/carts/{cartID}/items/{cartitemID}/taxes/{taxitemID}`)
|
|
337
|
+
|
|
338
|
+
- **`bulkDeleteCustomDiscountsFromCart`** (`DELETE /v2/carts/{cartID}/custom-discounts`)
|
|
339
|
+
|
|
340
|
+
- **`bulkAddCustomDiscountsToCart`** (`POST /v2/carts/{cartID}/custom-discounts`)
|
|
341
|
+
|
|
342
|
+
- **`deleteCustomDiscountFromCart`** (`DELETE /v2/carts/{cartID}/custom-discounts/{customdiscountID}`)
|
|
343
|
+
|
|
344
|
+
- **`updateCustomDiscountForCart`** (`PUT /v2/carts/{cartID}/custom-discounts/{customdiscountID}`)
|
|
345
|
+
|
|
346
|
+
- **`addCustomDiscountToCartItem`** (`POST /v2/carts/{cartID}/items/{cartitemID}/custom-discounts`)
|
|
347
|
+
|
|
348
|
+
- **`deleteCustomDiscountFromCartItem`** (`DELETE /v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}`)
|
|
349
|
+
|
|
350
|
+
- **`updateCustomDiscountForCartItem`** (`PUT /v2/carts/{cartID}/items/{cartitemID}/custom-discounts/{customdiscountID}`)
|
|
351
|
+
|
|
352
|
+
- **`createCartPaymentIntent`** (`POST /v2/carts/{cartID}/payments`)
|
|
353
|
+
|
|
354
|
+
- **`checkoutApi`** (`POST /v2/carts/{cartID}/checkout`)
|
|
355
|
+
|
|
356
|
+
- **`getCustomerOrders`** (`GET /v2/orders`)
|
|
357
|
+
|
|
358
|
+
- **`getAnOrder`** (`GET /v2/orders/{orderID}`)
|
|
359
|
+
|
|
360
|
+
- **`updateAnOrder`** (`PUT /v2/orders/{orderID}`)
|
|
361
|
+
|
|
362
|
+
- **`getOrderItems`** (`GET /v2/orders/{orderID}/items`)
|
|
363
|
+
|
|
364
|
+
- **`anonymizeOrders`** (`POST /v2/orders/anonymize`)
|
|
365
|
+
|
|
366
|
+
- **`paymentSetup`** (`POST /v2/orders/{orderID}/payments`)
|
|
367
|
+
|
|
368
|
+
- **`confirmPayment`** (`POST /v2/orders/{orderID}/transactions/{transactionID}/confirm`)
|
|
369
|
+
|
|
370
|
+
- **`captureATransaction`** (`POST /v2/orders/{orderID}/transactions/{transactionID}/capture`)
|
|
371
|
+
|
|
372
|
+
- **`refundATransaction`** (`POST /v2/orders/{orderID}/transactions/{transactionID}/refund`)
|
|
373
|
+
|
|
374
|
+
- **`getOrderTransactions`** (`GET /v2/orders/{orderID}/transactions`)
|
|
375
|
+
|
|
376
|
+
- **`getATransaction`** (`GET /v2/orders/{orderID}/transactions/{transactionID}`)
|
|
377
|
+
|
|
378
|
+
- **`cancelATransaction`** (`POST /v2/orders/{orderID}/transactions/{transactionID}/cancel`)
|
|
379
|
+
|
|
380
|
+
- **`getSubscriptionProduct`** (`GET /v2/subscriptions/products/{product_uuid}`)
|
|
381
|
+
|
|
382
|
+
- **`getPlan`** (`GET /v2/subscriptions/plans/{plan_uuid}`)
|
|
383
|
+
|
|
384
|
+
- **`listOfferings`** (`GET /v2/subscriptions/offerings`)
|
|
385
|
+
|
|
386
|
+
- **`getOffering`** (`GET /v2/subscriptions/offerings/{offering_uuid}`)
|
|
387
|
+
|
|
388
|
+
- **`listOfferingPlans`** (`GET /v2/subscriptions/offerings/{offering_uuid}/plans`)
|
|
389
|
+
|
|
390
|
+
- **`listOfferingFeatures`** (`GET /v2/subscriptions/offerings/{offering_uuid}/features`)
|
|
391
|
+
|
|
392
|
+
- **`listOfferingProducts`** (`GET /v2/subscriptions/offerings/{offering_uuid}/products`)
|
|
393
|
+
|
|
394
|
+
- **`getFeature`** (`GET /v2/subscriptions/features/{feature_uuid}`)
|
|
395
|
+
|
|
396
|
+
- **`getStock`** (`GET /v2/inventories/{product_uuid}`)
|
|
397
|
+
|
|
398
|
+
- **`listLocations`** (`GET /v2/inventories/locations`)
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
---
|
|
@@ -858,20 +858,29 @@ export declare const createACartMutation: (options?: Partial<Options<CreateACart
|
|
|
858
858
|
data?: import("../types.gen").CartResponse;
|
|
859
859
|
}, import("../types.gen").ResponseError, Options<CreateACartData>, unknown>;
|
|
860
860
|
export declare const deleteACartMutation: (options?: Partial<Options<DeleteACartData>>) => UseMutationOptions<void, import("../types.gen").ResponseError, Options<DeleteACartData>, unknown>;
|
|
861
|
-
export declare const getCartQueryKey: (options
|
|
861
|
+
export declare const getCartQueryKey: (options: Options<GetCartData>) => (Pick<Options<GetCartData>, "body" | "headers" | "path" | "query" | "baseUrl"> & {
|
|
862
862
|
_id: string;
|
|
863
863
|
_infinite?: boolean;
|
|
864
864
|
})[];
|
|
865
|
-
export declare const getCartOptions: (options
|
|
865
|
+
export declare const getCartOptions: (options: Options<GetCartData>) => import("@tanstack/react-query").OmitKeyof<import("@tanstack/react-query").UseQueryOptions<import("../types.gen").ResponseData & {
|
|
866
866
|
data?: import("../types.gen").CartResponse;
|
|
867
|
+
} & {
|
|
868
|
+
data?: import("../types.gen").CartResponse;
|
|
869
|
+
included?: import("../types.gen").CartInclude;
|
|
867
870
|
}, Error, import("../types.gen").ResponseData & {
|
|
868
871
|
data?: import("../types.gen").CartResponse;
|
|
872
|
+
} & {
|
|
873
|
+
data?: import("../types.gen").CartResponse;
|
|
874
|
+
included?: import("../types.gen").CartInclude;
|
|
869
875
|
}, (Pick<Options<GetCartData>, "body" | "headers" | "path" | "query" | "baseUrl"> & {
|
|
870
876
|
_id: string;
|
|
871
877
|
_infinite?: boolean;
|
|
872
878
|
})[]>, "queryFn"> & {
|
|
873
879
|
queryFn?: import("@tanstack/react-query").QueryFunction<import("../types.gen").ResponseData & {
|
|
874
880
|
data?: import("../types.gen").CartResponse;
|
|
881
|
+
} & {
|
|
882
|
+
data?: import("../types.gen").CartResponse;
|
|
883
|
+
included?: import("../types.gen").CartInclude;
|
|
875
884
|
}, (Pick<Options<GetCartData>, "body" | "headers" | "path" | "query" | "baseUrl"> & {
|
|
876
885
|
_id: string;
|
|
877
886
|
_infinite?: boolean;
|
|
@@ -883,6 +892,9 @@ export declare const getCartOptions: (options?: Options<GetCartData>) => import(
|
|
|
883
892
|
})[] & {
|
|
884
893
|
[dataTagSymbol]: import("../types.gen").ResponseData & {
|
|
885
894
|
data?: import("../types.gen").CartResponse;
|
|
895
|
+
} & {
|
|
896
|
+
data?: import("../types.gen").CartResponse;
|
|
897
|
+
included?: import("../types.gen").CartInclude;
|
|
886
898
|
};
|
|
887
899
|
[dataTagErrorSymbol]: Error;
|
|
888
900
|
};
|
package/dist/client/sdk.gen.d.ts
CHANGED
|
@@ -1147,8 +1147,11 @@ export declare const deleteACart: <ThrowOnError extends boolean = false>(options
|
|
|
1147
1147
|
* | `include` | Optional | `string` | Comma-delimited string of entities that can be included. The information included are `items`,`tax_items`, `custom_discounts`, or `promotions`. |
|
|
1148
1148
|
*
|
|
1149
1149
|
*/
|
|
1150
|
-
export declare const getCart: <ThrowOnError extends boolean = false>(options
|
|
1150
|
+
export declare const getCart: <ThrowOnError extends boolean = false>(options: Options<GetCartData, ThrowOnError>) => import("@hey-api/client-fetch").RequestResult<import("./types.gen").ResponseData & {
|
|
1151
1151
|
data?: import("./types.gen").CartResponse;
|
|
1152
|
+
} & {
|
|
1153
|
+
data?: import("./types.gen").CartResponse;
|
|
1154
|
+
included?: import("./types.gen").CartInclude;
|
|
1152
1155
|
}, import("./types.gen").ResponseError, ThrowOnError>;
|
|
1153
1156
|
/**
|
|
1154
1157
|
* Update a Cart
|
|
@@ -3178,7 +3178,7 @@ export type CartInclude = {
|
|
|
3178
3178
|
/**
|
|
3179
3179
|
* The cart items associated with a cart.
|
|
3180
3180
|
*/
|
|
3181
|
-
items?: Array<
|
|
3181
|
+
items?: Array<CartItemResponse>;
|
|
3182
3182
|
};
|
|
3183
3183
|
/**
|
|
3184
3184
|
* Whether a plan is active on a subscription using that offering. The `active_plan` attribute is null if a plan is not active in a subscription.
|
|
@@ -5466,6 +5466,10 @@ export type GetByContextAllProductsResponse = GetByContextAllProductsResponses[k
|
|
|
5466
5466
|
export type GetByContextProductData = {
|
|
5467
5467
|
body?: never;
|
|
5468
5468
|
headers?: {
|
|
5469
|
+
/**
|
|
5470
|
+
* The language and locale your storefront prefers. See [Accept-Language](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language).
|
|
5471
|
+
*/
|
|
5472
|
+
"accept-language"?: string;
|
|
5469
5473
|
/**
|
|
5470
5474
|
* The list of channels in which this catalog can be displayed. A channel is the shopping experience, such as a mobile app or web storefront. If empty, the catalog rule matches all channels. The channel will eventually be included in the bearer token that is used for authorization, but currently, you must set the `EP-Channel` header in your requests.
|
|
5471
5475
|
*/
|
|
@@ -6860,7 +6864,12 @@ export type DeleteACartResponses = {
|
|
|
6860
6864
|
export type DeleteACartResponse = DeleteACartResponses[keyof DeleteACartResponses];
|
|
6861
6865
|
export type GetCartData = {
|
|
6862
6866
|
body?: never;
|
|
6863
|
-
path
|
|
6867
|
+
path: {
|
|
6868
|
+
/**
|
|
6869
|
+
* The unique identifier for this cart that you created.
|
|
6870
|
+
*/
|
|
6871
|
+
cartID: string;
|
|
6872
|
+
};
|
|
6864
6873
|
query?: {
|
|
6865
6874
|
include?: Array<"items">;
|
|
6866
6875
|
};
|
|
@@ -6879,6 +6888,9 @@ export type GetCartResponses = {
|
|
|
6879
6888
|
*/
|
|
6880
6889
|
200: ResponseData & {
|
|
6881
6890
|
data?: CartResponse;
|
|
6891
|
+
} & {
|
|
6892
|
+
data?: CartResponse;
|
|
6893
|
+
included?: CartInclude;
|
|
6882
6894
|
};
|
|
6883
6895
|
};
|
|
6884
6896
|
export type GetCartResponse = GetCartResponses[keyof GetCartResponses];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epcc-sdk/sdks-shopper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
"@redocly/openapi-core": "^1.21.0",
|
|
25
25
|
"@tanstack/react-query": "^5.52.1",
|
|
26
26
|
"lodash": "^4.17.21",
|
|
27
|
-
"typescript": "^5.5.3"
|
|
27
|
+
"typescript": "^5.5.3",
|
|
28
|
+
"@types/ejs": "^3.1.5",
|
|
29
|
+
"ejs": "^3.1.10"
|
|
28
30
|
},
|
|
29
31
|
"dependencies": {
|
|
30
32
|
"@hey-api/client-fetch": "0.6.0"
|