@nymbalhq/sdk 1.3.0 → 1.5.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/dist/chunk-333Z6VKZ.js +133 -0
- package/dist/chunk-333Z6VKZ.js.map +1 -0
- package/dist/chunk-4GP43MKT.js +19 -0
- package/dist/chunk-4GP43MKT.js.map +1 -0
- package/dist/chunk-BAWTE4QS.js +113 -0
- package/dist/chunk-BAWTE4QS.js.map +1 -0
- package/dist/chunk-EFRWJT3L.js +520 -0
- package/dist/chunk-EFRWJT3L.js.map +1 -0
- package/dist/chunk-FWEQBOEX.js +92 -0
- package/dist/chunk-FWEQBOEX.js.map +1 -0
- package/dist/chunk-KRVUYBKB.js +118 -0
- package/dist/chunk-KRVUYBKB.js.map +1 -0
- package/dist/chunk-L7EZURSK.js +130 -0
- package/dist/chunk-L7EZURSK.js.map +1 -0
- package/dist/chunk-QUSTGYBM.js +52 -0
- package/dist/chunk-QUSTGYBM.js.map +1 -0
- package/dist/chunk-U6QF2DRY.js +30 -0
- package/dist/chunk-U6QF2DRY.js.map +1 -0
- package/dist/core-DCBjP2Ev.d.ts +523 -0
- package/dist/core.d.ts +2 -0
- package/dist/core.js +17 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +4 -429
- package/dist/index.js +32 -974
- package/dist/index.js.map +1 -1
- package/dist/ns/auth.d.ts +2 -0
- package/dist/ns/auth.js +4 -0
- package/dist/ns/auth.js.map +1 -0
- package/dist/ns/cart.d.ts +2 -0
- package/dist/ns/cart.js +4 -0
- package/dist/ns/cart.js.map +1 -0
- package/dist/ns/checkout.d.ts +2 -0
- package/dist/ns/checkout.js +5 -0
- package/dist/ns/checkout.js.map +1 -0
- package/dist/ns/product-list.d.ts +2 -0
- package/dist/ns/product-list.js +4 -0
- package/dist/ns/product-list.js.map +1 -0
- package/dist/ns/product.d.ts +2 -0
- package/dist/ns/product.js +4 -0
- package/dist/ns/product.js.map +1 -0
- package/dist/ns/search.d.ts +2 -0
- package/dist/ns/search.js +4 -0
- package/dist/ns/search.js.map +1 -0
- package/package.json +17 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,432 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
interface DenormalisedVariant {
|
|
5
|
-
id: string;
|
|
6
|
-
sku: string;
|
|
7
|
-
name: string;
|
|
8
|
-
priceMinor: number;
|
|
9
|
-
stock: number;
|
|
10
|
-
options: VariantOption[];
|
|
11
|
-
}
|
|
12
|
-
interface DenormalisedProduct {
|
|
13
|
-
id: string;
|
|
14
|
-
slug: string;
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
shortDescription: string;
|
|
18
|
-
status: string;
|
|
19
|
-
type: string;
|
|
20
|
-
media: unknown;
|
|
21
|
-
variantCount: number;
|
|
22
|
-
inStock: boolean;
|
|
23
|
-
priceRange: {
|
|
24
|
-
minMinor: number;
|
|
25
|
-
maxMinor: number;
|
|
26
|
-
} | null;
|
|
27
|
-
currency: string | null;
|
|
28
|
-
priceMinor: number | null;
|
|
29
|
-
variants: DenormalisedVariant[];
|
|
30
|
-
categoryIds: string[];
|
|
31
|
-
categories: Array<{
|
|
32
|
-
id: string;
|
|
33
|
-
name: string;
|
|
34
|
-
slug: string;
|
|
35
|
-
}>;
|
|
36
|
-
createdAt: string;
|
|
37
|
-
updatedAt: string;
|
|
38
|
-
}
|
|
39
|
-
interface CartState {
|
|
40
|
-
items: CartItem[];
|
|
41
|
-
subtotalMinor: number;
|
|
42
|
-
currency: string;
|
|
43
|
-
itemCount: number;
|
|
44
|
-
loading: boolean;
|
|
45
|
-
error: string | null;
|
|
46
|
-
}
|
|
47
|
-
interface ProductState {
|
|
48
|
-
product: DenormalisedProduct | null;
|
|
49
|
-
selectedVariant: DenormalisedVariant | null;
|
|
50
|
-
loading: boolean;
|
|
51
|
-
error: string | null;
|
|
52
|
-
}
|
|
53
|
-
interface ProductListState {
|
|
54
|
-
products: DenormalisedProduct[];
|
|
55
|
-
facets: Facet[];
|
|
56
|
-
filters: Record<string, string | string[]>;
|
|
57
|
-
sort: ProductSortKey;
|
|
58
|
-
pagination: {
|
|
59
|
-
cursor: string | null;
|
|
60
|
-
hasMore: boolean;
|
|
61
|
-
};
|
|
62
|
-
loading: boolean;
|
|
63
|
-
error: string | null;
|
|
64
|
-
}
|
|
65
|
-
interface SearchState {
|
|
66
|
-
query: string;
|
|
67
|
-
/** The category slug the search is narrowed to, or null for every category. */
|
|
68
|
-
category: string | null;
|
|
69
|
-
/** Every page loaded so far, in rank order. */
|
|
70
|
-
results: DenormalisedProduct[];
|
|
71
|
-
/** The API's count of every match, not of the results loaded. */
|
|
72
|
-
total: number;
|
|
73
|
-
/** The next page's cursor; null when every match is loaded. */
|
|
74
|
-
nextCursor: string | null;
|
|
75
|
-
/** The search's facets: the category facet when search reports `facet` and the query matches. */
|
|
76
|
-
facets: Facet[];
|
|
77
|
-
loading: boolean;
|
|
78
|
-
}
|
|
79
|
-
type CheckoutStep = 'contact' | 'shipping' | 'payment' | 'confirmation';
|
|
80
|
-
interface ShippingMethod {
|
|
81
|
-
carrier: string;
|
|
82
|
-
service: string;
|
|
83
|
-
amountMinor: number;
|
|
84
|
-
currency: string;
|
|
85
|
-
estimatedDays: number;
|
|
86
|
-
}
|
|
87
|
-
interface CheckoutState {
|
|
88
|
-
step: CheckoutStep;
|
|
89
|
-
email: string;
|
|
90
|
-
shippingAddress: Address | null;
|
|
91
|
-
billingAddress: Address | null;
|
|
92
|
-
shippingMethod: ShippingMethod | null;
|
|
93
|
-
/** What the server said about the payment; `succeeded` only once the order is paid. */
|
|
94
|
-
paymentStatus: 'idle' | 'processing' | 'requires_action' | 'succeeded' | 'failed';
|
|
95
|
-
error: string | null;
|
|
96
|
-
order: {
|
|
97
|
-
orderId: string;
|
|
98
|
-
orderNumber: string;
|
|
99
|
-
paymentIntent: PaymentIntent;
|
|
100
|
-
} | null;
|
|
101
|
-
/** The order this cart already became, when the server refused a resubmit and named it. */
|
|
102
|
-
placedOrderNumber: string | null;
|
|
103
|
-
}
|
|
104
|
-
interface AuthState {
|
|
105
|
-
customer: Customer | null;
|
|
106
|
-
isAuthenticated: boolean;
|
|
107
|
-
loading: boolean;
|
|
108
|
-
error: string | null;
|
|
109
|
-
}
|
|
110
|
-
interface ProductListParams {
|
|
111
|
-
limit?: number;
|
|
112
|
-
cursor?: string;
|
|
113
|
-
category?: string;
|
|
114
|
-
sort?: ProductSortKey;
|
|
115
|
-
}
|
|
116
|
-
interface ProductListResult {
|
|
117
|
-
items: DenormalisedProduct[];
|
|
118
|
-
nextCursor: string | null;
|
|
119
|
-
facets?: Facet[];
|
|
120
|
-
}
|
|
121
|
-
interface ProductSearchParams {
|
|
122
|
-
limit?: number;
|
|
123
|
-
cursor?: string;
|
|
124
|
-
/** A category slug, as on the listing. */
|
|
125
|
-
category?: string;
|
|
126
|
-
}
|
|
127
|
-
interface ProductSearchResult {
|
|
128
|
-
items: DenormalisedProduct[];
|
|
129
|
-
nextCursor: string | null;
|
|
130
|
-
total: number;
|
|
131
|
-
facets: Facet[];
|
|
132
|
-
}
|
|
133
|
-
interface CheckoutDetails {
|
|
134
|
-
email: string;
|
|
135
|
-
billingAddress: Address;
|
|
136
|
-
shippingAddress: Address;
|
|
137
|
-
notes?: string;
|
|
138
|
-
}
|
|
139
|
-
interface CheckoutResult {
|
|
140
|
-
orderId: string;
|
|
141
|
-
orderNumber: string;
|
|
142
|
-
paymentIntent: PaymentIntent;
|
|
143
|
-
currency: string;
|
|
144
|
-
totalMinor: number;
|
|
145
|
-
orderStatus: OrderStatus;
|
|
146
|
-
payment: CheckoutPayment;
|
|
147
|
-
}
|
|
148
|
-
interface RegisterParams {
|
|
149
|
-
email: string;
|
|
150
|
-
password: string;
|
|
151
|
-
firstName?: string;
|
|
152
|
-
lastName?: string;
|
|
153
|
-
phone?: string;
|
|
154
|
-
}
|
|
155
|
-
interface AuthResult {
|
|
156
|
-
customer: Customer;
|
|
157
|
-
accessToken: string;
|
|
158
|
-
expiresIn: number;
|
|
159
|
-
}
|
|
160
|
-
type NewAddress = Address & {
|
|
161
|
-
isDefaultBilling?: boolean;
|
|
162
|
-
isDefaultShipping?: boolean;
|
|
163
|
-
};
|
|
164
|
-
interface OrderPage {
|
|
165
|
-
items: Order[];
|
|
166
|
-
nextCursor: string | null;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
interface CommerceAdapter {
|
|
170
|
-
/** What the store can do (GET /api/capabilities); an adapter without it cannot tell the storefront. */
|
|
171
|
-
capabilities?: {
|
|
172
|
-
get(): Promise<StoreCapabilities>;
|
|
173
|
-
};
|
|
174
|
-
cart: {
|
|
175
|
-
get(): Promise<Cart>;
|
|
176
|
-
addItem(variantId: string, qty: number): Promise<Cart>;
|
|
177
|
-
removeItem(variantId: string): Promise<Cart>;
|
|
178
|
-
updateQuantity(variantId: string, qty: number): Promise<Cart>;
|
|
179
|
-
clear(): Promise<Cart>;
|
|
180
|
-
};
|
|
181
|
-
products: {
|
|
182
|
-
getBySlug(slug: string): Promise<DenormalisedProduct>;
|
|
183
|
-
list(params?: ProductListParams): Promise<ProductListResult>;
|
|
184
|
-
search(query: string, params?: ProductSearchParams): Promise<ProductSearchResult>;
|
|
185
|
-
};
|
|
186
|
-
checkout: {
|
|
187
|
-
create(details: CheckoutDetails): Promise<CheckoutResult>;
|
|
188
|
-
};
|
|
189
|
-
customers: {
|
|
190
|
-
register(params: RegisterParams): Promise<AuthResult>;
|
|
191
|
-
login(email: string, password: string): Promise<AuthResult>;
|
|
192
|
-
logout(): Promise<void>;
|
|
193
|
-
refresh(): Promise<{
|
|
194
|
-
accessToken: string;
|
|
195
|
-
expiresIn: number;
|
|
196
|
-
}>;
|
|
197
|
-
getProfile(): Promise<Customer>;
|
|
198
|
-
updateProfile(updates: Partial<Pick<Customer, 'firstName' | 'lastName' | 'phone'>>): Promise<Customer>;
|
|
199
|
-
listAddresses(): Promise<CustomerAddress[]>;
|
|
200
|
-
addAddress(address: NewAddress): Promise<CustomerAddress>;
|
|
201
|
-
removeAddress(id: string): Promise<void>;
|
|
202
|
-
listOrders(params?: {
|
|
203
|
-
cursor?: string;
|
|
204
|
-
}): Promise<OrderPage>;
|
|
205
|
-
getOrder(orderNumber: string): Promise<Order>;
|
|
206
|
-
};
|
|
207
|
-
reviews: {
|
|
208
|
-
getForProduct(productId: string, params?: {
|
|
209
|
-
limit?: number;
|
|
210
|
-
cursor?: string;
|
|
211
|
-
}): Promise<ReviewsResult>;
|
|
212
|
-
submit(review: {
|
|
213
|
-
productId: string;
|
|
214
|
-
rating: number;
|
|
215
|
-
title: string;
|
|
216
|
-
body: string;
|
|
217
|
-
}): Promise<ReviewResult>;
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
interface CartStore {
|
|
222
|
-
getState(): CartState;
|
|
223
|
-
subscribe(listener: () => void): () => void;
|
|
224
|
-
addItem(variantId: string, qty?: number): Promise<void>;
|
|
225
|
-
removeItem(variantId: string): Promise<void>;
|
|
226
|
-
updateQuantity(variantId: string, qty: number): Promise<void>;
|
|
227
|
-
clear(): Promise<void>;
|
|
228
|
-
load(): Promise<void>;
|
|
229
|
-
destroy(): void;
|
|
230
|
-
}
|
|
231
|
-
declare function createCartStore(adapter: CommerceAdapter): CartStore;
|
|
232
|
-
|
|
233
|
-
interface ProductStore {
|
|
234
|
-
getState(): ProductState;
|
|
235
|
-
subscribe(listener: () => void): () => void;
|
|
236
|
-
loadBySlug(slug: string): Promise<void>;
|
|
237
|
-
selectVariant(variant: DenormalisedVariant | null): void;
|
|
238
|
-
destroy(): void;
|
|
239
|
-
}
|
|
240
|
-
declare function createProductStore(adapter: CommerceAdapter): ProductStore;
|
|
241
|
-
|
|
242
|
-
interface ProductListStore {
|
|
243
|
-
getState(): ProductListState;
|
|
244
|
-
subscribe(listener: () => void): () => void;
|
|
245
|
-
load(params?: ProductListParams): Promise<void>;
|
|
246
|
-
loadMore(): Promise<void>;
|
|
247
|
-
applyFilter(name: string, value: string | string[]): Promise<void>;
|
|
248
|
-
removeFilter(name: string): Promise<void>;
|
|
249
|
-
setSort(sort: ProductSortKey): Promise<void>;
|
|
250
|
-
destroy(): void;
|
|
251
|
-
}
|
|
252
|
-
declare function createProductListStore(adapter: CommerceAdapter): ProductListStore;
|
|
253
|
-
|
|
254
|
-
interface SearchStore {
|
|
255
|
-
getState(): SearchState;
|
|
256
|
-
subscribe(listener: () => void): () => void;
|
|
257
|
-
/** Page 1 of `query`, in `options.category` (a slug) when given, otherwise in every category. */
|
|
258
|
-
search(query: string, options?: {
|
|
259
|
-
category?: string | null;
|
|
260
|
-
}): Promise<void>;
|
|
261
|
-
/** Appends the next page; a no-op when every match is loaded or a page is loading. */
|
|
262
|
-
loadMore(): Promise<void>;
|
|
263
|
-
/** Page 1 of the current query in `category` (a slug), or in every category when null. */
|
|
264
|
-
setCategory(category: string | null): Promise<void>;
|
|
265
|
-
clearSearch(): void;
|
|
266
|
-
destroy(): void;
|
|
267
|
-
}
|
|
268
|
-
declare function createSearchStore(adapter: CommerceAdapter): SearchStore;
|
|
269
|
-
|
|
270
|
-
interface CheckoutStore {
|
|
271
|
-
getState(): CheckoutState;
|
|
272
|
-
subscribe(listener: () => void): () => void;
|
|
273
|
-
setEmail(email: string): void;
|
|
274
|
-
setShippingAddress(address: Address): void;
|
|
275
|
-
setBillingAddress(address: Address): void;
|
|
276
|
-
setShippingMethod(method: ShippingMethod): void;
|
|
277
|
-
/** Places the order; resolves to the server's result, or null when there is none. */
|
|
278
|
-
submitPayment(): Promise<CheckoutResult | null>;
|
|
279
|
-
/** The provider confirmed the payment on the client (Stripe's `confirmCardPayment`). */
|
|
280
|
-
markConfirmed(): void;
|
|
281
|
-
reset(): void;
|
|
282
|
-
destroy(): void;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* `cart`, when given, is loaded again once the server has answered a submit: placing an order changes the cart on the
|
|
286
|
-
* server (emptied when confirmed, kept while awaiting payment), and whatever renders the cart store must show that.
|
|
287
|
-
*/
|
|
288
|
-
declare function createCheckoutStore(adapter: CommerceAdapter, cart?: CartStore): CheckoutStore;
|
|
289
|
-
|
|
290
|
-
interface TokenManagerOptions {
|
|
291
|
-
storage?: 'memory' | 'localStorage';
|
|
292
|
-
storageKey?: string;
|
|
293
|
-
}
|
|
294
|
-
interface TokenManager {
|
|
295
|
-
getAccessToken(): string | null;
|
|
296
|
-
setTokens(accessToken: string, expiresIn: number): void;
|
|
297
|
-
clear(): void;
|
|
298
|
-
scheduleRefresh(refreshFn: () => Promise<{
|
|
299
|
-
accessToken: string;
|
|
300
|
-
expiresIn: number;
|
|
301
|
-
}>): void;
|
|
302
|
-
destroy(): void;
|
|
303
|
-
}
|
|
304
|
-
declare function createTokenManager(options?: TokenManagerOptions): TokenManager;
|
|
305
|
-
|
|
306
|
-
interface AuthStore {
|
|
307
|
-
getState(): AuthState;
|
|
308
|
-
subscribe(listener: () => void): () => void;
|
|
309
|
-
login(email: string, password: string): Promise<void>;
|
|
310
|
-
register(params: RegisterParams): Promise<void>;
|
|
311
|
-
logout(): Promise<void>;
|
|
312
|
-
refreshToken(): Promise<void>;
|
|
313
|
-
updateProfile(updates: Partial<Pick<Customer, 'firstName' | 'lastName' | 'phone'>>): Promise<void>;
|
|
314
|
-
loadProfile(): Promise<void>;
|
|
315
|
-
destroy(): void;
|
|
316
|
-
}
|
|
317
|
-
declare function createAuthStore(adapter: CommerceAdapter, tokenManager: TokenManager): AuthStore;
|
|
318
|
-
|
|
319
|
-
interface NymbalClientOptions {
|
|
320
|
-
baseUrl: string;
|
|
321
|
-
adapter?: CommerceAdapter;
|
|
322
|
-
tokenStorage?: 'memory' | 'localStorage';
|
|
323
|
-
credentials?: RequestCredentials;
|
|
324
|
-
getCartToken?: () => string | null;
|
|
325
|
-
}
|
|
326
|
-
/** The signed-in customer's own account; every call sends the session's bearer token. */
|
|
327
|
-
interface CustomerAccount {
|
|
328
|
-
addresses: {
|
|
329
|
-
list(): Promise<CustomerAddress[]>;
|
|
330
|
-
create(address: NewAddress): Promise<CustomerAddress>;
|
|
331
|
-
remove(id: string): Promise<void>;
|
|
332
|
-
};
|
|
333
|
-
orders: {
|
|
334
|
-
list(opts?: {
|
|
335
|
-
cursor?: string;
|
|
336
|
-
}): Promise<OrderPage>;
|
|
337
|
-
get(orderNumber: string): Promise<Order>;
|
|
338
|
-
};
|
|
339
|
-
}
|
|
340
|
-
/** The store's capabilities report, read once per client: what it can do does not change while it runs. */
|
|
341
|
-
interface StoreCapabilitiesReader {
|
|
342
|
-
get(): Promise<StoreCapabilities>;
|
|
343
|
-
}
|
|
344
|
-
interface NymbalClient {
|
|
345
|
-
capabilities: StoreCapabilitiesReader;
|
|
346
|
-
cart: CartStore;
|
|
347
|
-
product: ProductStore;
|
|
348
|
-
productList: ProductListStore;
|
|
349
|
-
search: SearchStore;
|
|
350
|
-
checkout: CheckoutStore;
|
|
351
|
-
auth: AuthStore;
|
|
352
|
-
customer: CustomerAccount;
|
|
353
|
-
adapter: CommerceAdapter;
|
|
354
|
-
destroy(): void;
|
|
355
|
-
}
|
|
356
|
-
declare function createNymbalClient(options: NymbalClientOptions): NymbalClient;
|
|
357
|
-
|
|
358
|
-
/** What a checkout already knows about the shopper, which a driver may hand its processor with the payment. */
|
|
359
|
-
interface PaymentConfirmContext {
|
|
360
|
-
email?: string;
|
|
361
|
-
billing?: Address;
|
|
362
|
-
}
|
|
363
|
-
/** What a payment driver's `confirm` answers: paid now, accepted without a payment yet, or refused with a reason. */
|
|
364
|
-
type PaymentConfirmation = {
|
|
365
|
-
ok: true;
|
|
366
|
-
confirmed: boolean;
|
|
367
|
-
} | {
|
|
368
|
-
ok: false;
|
|
369
|
-
error: string;
|
|
370
|
-
};
|
|
371
|
-
/**
|
|
372
|
-
* The browser half of a payments adapter, named by the `driver` of GET /api/capabilities' payments client. `mount`
|
|
373
|
-
* renders whatever the shopper pays with inside `el`; `confirm` completes a payment the API left `requires_action`,
|
|
374
|
-
* with the shopper's email and billing address when the checkout has them.
|
|
375
|
-
*/
|
|
376
|
-
interface PaymentDriver {
|
|
377
|
-
mount(el: HTMLElement, options: Record<string, string>): Promise<void> | void;
|
|
378
|
-
confirm(clientSecret: string, context?: PaymentConfirmContext): Promise<PaymentConfirmation>;
|
|
379
|
-
}
|
|
380
|
-
/** Registers `driver` under `name`, replacing any driver of that name. */
|
|
381
|
-
declare function registerPaymentDriver(name: string, driver: PaymentDriver): void;
|
|
382
|
-
declare function getPaymentDriver(name: string): PaymentDriver | undefined;
|
|
383
|
-
|
|
384
|
-
type Listener = () => void;
|
|
385
|
-
interface Store<TState> {
|
|
386
|
-
getState(): TState;
|
|
387
|
-
setState(partial: Partial<TState> | ((prev: TState) => Partial<TState>)): void;
|
|
388
|
-
subscribe(listener: Listener): () => void;
|
|
389
|
-
destroy(): void;
|
|
390
|
-
}
|
|
391
|
-
declare function createStore<TState extends object>(initialState: TState): Store<TState>;
|
|
392
|
-
|
|
393
|
-
declare class NymbalApiError extends Error {
|
|
394
|
-
readonly code: string;
|
|
395
|
-
readonly status: number;
|
|
396
|
-
readonly context?: Record<string, unknown> | undefined;
|
|
397
|
-
constructor(code: string, message: string, status: number, context?: Record<string, unknown> | undefined);
|
|
398
|
-
}
|
|
399
|
-
interface FetchClientOptions {
|
|
400
|
-
baseUrl: string;
|
|
401
|
-
credentials?: RequestCredentials;
|
|
402
|
-
getAccessToken?: () => string | null;
|
|
403
|
-
getCartToken?: () => string | null;
|
|
404
|
-
onUnauthorized?: () => Promise<void>;
|
|
405
|
-
}
|
|
406
|
-
declare class FetchClient {
|
|
407
|
-
private readonly baseUrl;
|
|
408
|
-
private readonly credentials;
|
|
409
|
-
private readonly getAccessToken;
|
|
410
|
-
private readonly getCartToken;
|
|
411
|
-
private readonly onUnauthorized;
|
|
412
|
-
private handlingUnauthorized;
|
|
413
|
-
/** The token `GET /api/csrf` answered: the API's `nymbal.csrf` cookie, which this origin may not be able to read. */
|
|
414
|
-
private csrfToken;
|
|
415
|
-
constructor(options: FetchClientOptions);
|
|
416
|
-
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
417
|
-
/** Like `request`, keeping the envelope's `meta` (pagination cursors live there). */
|
|
418
|
-
requestWithMeta<T>(method: string, path: string, body?: unknown): Promise<{
|
|
419
|
-
data: T;
|
|
420
|
-
meta: Record<string, unknown>;
|
|
421
|
-
}>;
|
|
422
|
-
private csrf;
|
|
423
|
-
private fetchCsrfToken;
|
|
424
|
-
private isCsrfRejection;
|
|
425
|
-
private doFetch;
|
|
426
|
-
private parseResponse;
|
|
427
|
-
}
|
|
1
|
+
import { F as FetchClient, C as CommerceAdapter } from './core-DCBjP2Ev.js';
|
|
2
|
+
export { A as AuthResult, a as AuthState, b as AuthStore, c as CartState, d as CartStore, e as CheckoutDetails, f as CheckoutResult, g as CheckoutState, h as CheckoutStep, i as CheckoutStore, j as CustomerAccount, D as DenormalisedProduct, k as DenormalisedVariant, l as FetchClientOptions, G as GuestOrders, L as Listener, N as NewAddress, m as NymbalApiError, n as NymbalClient, o as NymbalClientOptions, O as OrderPage, P as PaymentConfirmContext, p as PaymentConfirmation, q as PaymentDriver, r as ProductListParams, s as ProductListResult, t as ProductListState, u as ProductListStore, v as ProductSearchParams, w as ProductSearchResult, x as ProductState, y as ProductStore, R as RecentlyViewed, z as RegisterParams, S as SearchState, B as SearchStore, E as ShippingMethod, H as Store, I as StoreCapabilitiesReader, T as TokenManager, J as TokenManagerOptions, K as createAuthStore, M as createCartStore, Q as createCheckoutStore, U as createNymbalClient, V as createProductListStore, W as createProductStore, X as createSearchStore, Y as createStore, Z as createTokenManager, _ as getPaymentDriver, $ as registerPaymentDriver } from './core-DCBjP2Ev.js';
|
|
3
|
+
export { AlertKind, PaymentClient, ProductSortKey, ReviewResult as ReviewSubmitResult, ReviewsResult as ReviewsListResult, StoreCapabilities } from '@nymbalhq/types';
|
|
428
4
|
|
|
429
5
|
declare function createNymbalApiAdapter(fetchClient: FetchClient): CommerceAdapter;
|
|
430
6
|
|
|
431
|
-
export {
|
|
432
|
-
export type { AuthResult, AuthState, AuthStore, CartState, CartStore, CheckoutDetails, CheckoutResult, CheckoutState, CheckoutStep, CheckoutStore, CommerceAdapter, CustomerAccount, DenormalisedProduct, DenormalisedVariant, FetchClientOptions, Listener, NewAddress, NymbalClient, NymbalClientOptions, OrderPage, PaymentConfirmContext, PaymentConfirmation, PaymentDriver, ProductListParams, ProductListResult, ProductListState, ProductListStore, ProductSearchParams, ProductSearchResult, ProductState, ProductStore, RegisterParams, SearchState, SearchStore, ShippingMethod, Store, StoreCapabilitiesReader, TokenManager, TokenManagerOptions };
|
|
7
|
+
export { CommerceAdapter, FetchClient, createNymbalApiAdapter };
|