@behio/storefront-sdk 0.12.0 → 0.14.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-XWYDXBLG.js +18 -0
- package/dist/chunk-YJ45WIQZ.mjs +18 -0
- package/dist/client-tINA5Ntn.d.mts +1343 -0
- package/dist/client-tINA5Ntn.d.ts +1343 -0
- package/dist/index.d.mts +9 -1336
- package/dist/index.d.ts +9 -1336
- package/dist/index.js +5 -1
- package/dist/index.mjs +4 -0
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/react.d.mts +4 -13
- package/dist/react.d.ts +4 -13
- package/dist/react.js +4 -16
- package/dist/react.mjs +3 -15
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,1340 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
/** API key (public: pk_live_xxx or private: sk_live_xxx) */
|
|
3
|
-
apiKey: string;
|
|
4
|
-
/** Backend base URL. Default: https://api.behio.com */
|
|
5
|
-
baseUrl?: string;
|
|
6
|
-
/**
|
|
7
|
-
* The domain this storefront is served on (e.g. "mujshop.cz"), sent as
|
|
8
|
-
* X-Shop-Domain. Only needed when ONE deployment serves several domains with
|
|
9
|
-
* a single "all domains" API key (e.g. a Vercel app behind mujshop.cz +
|
|
10
|
-
* mujshop.sk) AND there's no Origin header (server-side rendering). A
|
|
11
|
-
* domain-bound key, or a browser request (Origin), doesn't need it.
|
|
12
|
-
*/
|
|
13
|
-
shopDomain?: string;
|
|
14
|
-
/** Default locale for catalog requests. Default: none (uses shop default) */
|
|
15
|
-
locale?: string;
|
|
16
|
-
/** Default currency for price resolution. Default: none (uses shop default) */
|
|
17
|
-
currency?: string;
|
|
18
|
-
/** Custom fetch implementation (for Node.js < 18 or testing) */
|
|
19
|
-
fetch?: typeof fetch;
|
|
20
|
-
/** Request timeout in milliseconds. Default: 30000 (30s) */
|
|
21
|
-
timeout?: number;
|
|
22
|
-
/** Number of retries on network/5xx errors. Default: 1 */
|
|
23
|
-
retries?: number;
|
|
24
|
-
/** Base delay between retries in ms (multiplied by attempt). Default: 1000 */
|
|
25
|
-
retryDelay?: number;
|
|
26
|
-
}
|
|
27
|
-
interface PaginatedResponse<T> {
|
|
28
|
-
items: T[];
|
|
29
|
-
total: number;
|
|
30
|
-
page: number;
|
|
31
|
-
limit: number;
|
|
32
|
-
totalPages: number;
|
|
33
|
-
}
|
|
34
|
-
interface MessageResponse {
|
|
35
|
-
message: string;
|
|
36
|
-
}
|
|
37
|
-
interface ShopInfo {
|
|
38
|
-
id: string;
|
|
39
|
-
name: string;
|
|
40
|
-
domain: string;
|
|
41
|
-
logo?: string;
|
|
42
|
-
favicon?: string;
|
|
43
|
-
isActive: boolean;
|
|
44
|
-
defaultLanguage: string;
|
|
45
|
-
supportedLanguages: string[];
|
|
46
|
-
defaultCurrency: string;
|
|
47
|
-
supportedCurrencies: string[];
|
|
48
|
-
metaTitle?: string;
|
|
49
|
-
metaDescription?: string;
|
|
50
|
-
allowGuestCheckout: boolean;
|
|
51
|
-
}
|
|
52
|
-
interface ShopSeo {
|
|
53
|
-
locale: string;
|
|
54
|
-
title: string | null;
|
|
55
|
-
description: string | null;
|
|
56
|
-
keywords: string | null;
|
|
57
|
-
ogTitle: string | null;
|
|
58
|
-
ogDescription: string | null;
|
|
59
|
-
ogImage: string | null;
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Money amount displayed to a customer in a chosen currency.
|
|
63
|
-
*
|
|
64
|
-
* Two cases:
|
|
65
|
-
* - **Fixed price** (preferred): merchant configured an explicit price for
|
|
66
|
-
* this currency. `isApproximate` is `false`/absent and `fxSource` is `null`.
|
|
67
|
-
* - **Approximate / FX-converted**: no fixed price for the requested
|
|
68
|
-
* currency, so Behio converted from the eshop's default currency using
|
|
69
|
-
* today's rate from `fxSource` (CNB or Frankfurter/ECB) plus the eshop's
|
|
70
|
-
* safety margin. UI should show a `≈` hint and offer the base price too.
|
|
71
|
-
*/
|
|
72
|
-
/**
|
|
73
|
-
* Payment method available at checkout. Returned by
|
|
74
|
-
* `GET /storefront/v1/catalog/payment-methods` filtered for the customer's
|
|
75
|
-
* chosen currency. Credentials (API keys, merchant ids) stay server-side
|
|
76
|
-
* — only customer-safe fields appear here.
|
|
77
|
-
*/
|
|
78
|
-
interface CheckoutPaymentMethod {
|
|
79
|
-
id: string;
|
|
80
|
-
/** Merchant-chosen label, e.g. "Kartou (Stripe)" or "Převodem na účet". */
|
|
81
|
-
name: string;
|
|
82
|
-
description?: string | null;
|
|
83
|
-
/** Provider id: "stripe" | "gopay" | "comgate" | "bank_transfer" | "cod" | "custom". */
|
|
84
|
-
provider: string;
|
|
85
|
-
/** Currencies this method accepts. Empty = any. */
|
|
86
|
-
currencies: string[];
|
|
87
|
-
/** Optional fee added to the order total (e.g. COD surcharge). */
|
|
88
|
-
fee?: number | null;
|
|
89
|
-
feeCurrency?: string | null;
|
|
90
|
-
/** Customer-safe slice of config: bank account, IBAN, instructions, … */
|
|
91
|
-
publicConfig?: Record<string, unknown>;
|
|
92
|
-
}
|
|
93
|
-
interface ProductPrice {
|
|
94
|
-
amount: number;
|
|
95
|
-
currency: string;
|
|
96
|
-
compareAtPrice?: number | null;
|
|
97
|
-
/** `true` when this amount was FX-converted from the eshop default currency. */
|
|
98
|
-
isApproximate?: boolean;
|
|
99
|
-
/** Provider id ("cnb" | "frankfurter" | "manual") when FX-converted. */
|
|
100
|
-
fxSource?: string | null;
|
|
101
|
-
/** Original amount in the eshop default currency before conversion. */
|
|
102
|
-
baseAmount?: number | null;
|
|
103
|
-
/** ISO code of the currency `baseAmount` is denominated in. */
|
|
104
|
-
baseCurrency?: string | null;
|
|
105
|
-
}
|
|
106
|
-
interface ProductVolumePrice {
|
|
107
|
-
minQuantity: number;
|
|
108
|
-
price: number;
|
|
109
|
-
currency?: string;
|
|
110
|
-
}
|
|
111
|
-
interface ProductVariant {
|
|
112
|
-
id: string;
|
|
113
|
-
sku: string;
|
|
114
|
-
name: string;
|
|
115
|
-
attributes: Record<string, string>;
|
|
116
|
-
price: ProductPrice;
|
|
117
|
-
inStock: boolean;
|
|
118
|
-
stockQuantity?: number;
|
|
119
|
-
/**
|
|
120
|
-
* Cover image URL for the variant. Falls back to the parent product's
|
|
121
|
-
* cover when the variant has no photo of its own — see `imageIsInherited`.
|
|
122
|
-
*/
|
|
123
|
-
imageUrl?: string | null;
|
|
124
|
-
/**
|
|
125
|
-
* `true` when `imageUrl` is borrowed from the parent product because the
|
|
126
|
-
* variant has no cover image of its own. Use this to render a hint like
|
|
127
|
-
* "default photo" or to render the picture in a subtler style.
|
|
128
|
-
*/
|
|
129
|
-
imageIsInherited: boolean;
|
|
130
|
-
}
|
|
131
|
-
interface ProductLabel {
|
|
132
|
-
id: string;
|
|
133
|
-
slug: string;
|
|
134
|
-
name: string;
|
|
135
|
-
color?: string;
|
|
136
|
-
}
|
|
137
|
-
interface ProductListItem {
|
|
138
|
-
id: string;
|
|
139
|
-
slug: string;
|
|
140
|
-
name: string;
|
|
141
|
-
shortDescription?: string;
|
|
142
|
-
sku: string;
|
|
143
|
-
gtin?: string;
|
|
144
|
-
price: ProductPrice;
|
|
145
|
-
inStock: boolean;
|
|
146
|
-
stockQuantity?: number;
|
|
147
|
-
image?: string | null;
|
|
148
|
-
labels: ProductLabel[];
|
|
149
|
-
isFeatured: boolean;
|
|
150
|
-
}
|
|
151
|
-
/** A single responsive derivative (size + format) of a media image. */
|
|
152
|
-
interface ProductMediaVariant {
|
|
153
|
-
variant: 'thumb' | 'medium' | 'large' | 'xlarge';
|
|
154
|
-
format: 'jpeg' | 'webp' | 'avif';
|
|
155
|
-
url: string;
|
|
156
|
-
width: number;
|
|
157
|
-
height: number;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* A product gallery entry (image or video), sourced from the inventory item
|
|
161
|
-
* so it is shared across every storefront listing the product. Images carry
|
|
162
|
-
* responsive `variants` (webp/avif/jpeg in three sizes) for fast LCP; pick
|
|
163
|
-
* the smallest format the client supports.
|
|
164
|
-
*/
|
|
165
|
-
interface ProductMedia {
|
|
166
|
-
id: string;
|
|
167
|
-
type: 'IMAGE' | 'VIDEO';
|
|
168
|
-
/** Original uploaded file URL. */
|
|
169
|
-
url: string;
|
|
170
|
-
alt?: string | null;
|
|
171
|
-
isCover: boolean;
|
|
172
|
-
order: number;
|
|
173
|
-
variants: ProductMediaVariant[];
|
|
174
|
-
}
|
|
175
|
-
interface ProductDetail extends ProductListItem {
|
|
176
|
-
longDescription?: string;
|
|
177
|
-
/** @deprecated Legacy per-listing images. Prefer `media`. */
|
|
178
|
-
images: Array<{
|
|
179
|
-
url: string;
|
|
180
|
-
alt?: string;
|
|
181
|
-
order: number;
|
|
182
|
-
}>;
|
|
183
|
-
/** Product gallery (images + videos) with responsive derivatives. */
|
|
184
|
-
media: ProductMedia[];
|
|
185
|
-
categories: Array<{
|
|
186
|
-
id: string;
|
|
187
|
-
slug: string;
|
|
188
|
-
name: string;
|
|
189
|
-
}>;
|
|
190
|
-
variants: ProductVariant[];
|
|
191
|
-
volumePricing: ProductVolumePrice[];
|
|
192
|
-
customFields: Record<string, unknown>;
|
|
193
|
-
seo: {
|
|
194
|
-
title?: string | null;
|
|
195
|
-
description?: string | null;
|
|
196
|
-
keywords?: string | null;
|
|
197
|
-
};
|
|
198
|
-
productGroups?: Array<{
|
|
199
|
-
slug: string;
|
|
200
|
-
name: string;
|
|
201
|
-
products: ProductListItem[];
|
|
202
|
-
}>;
|
|
203
|
-
/** Product weight (from warehouse item) */
|
|
204
|
-
weight?: number | null;
|
|
205
|
-
/** Weight unit: GRAM, KILOGRAM, TONNE */
|
|
206
|
-
weightUnit?: string | null;
|
|
207
|
-
}
|
|
208
|
-
interface Category {
|
|
209
|
-
id: string;
|
|
210
|
-
slug: string;
|
|
211
|
-
name: string;
|
|
212
|
-
description?: string;
|
|
213
|
-
imageUrl?: string;
|
|
214
|
-
children: Category[];
|
|
215
|
-
productCount?: number;
|
|
216
|
-
}
|
|
217
|
-
interface CategoryDetail extends Category {
|
|
218
|
-
seoTitle?: string;
|
|
219
|
-
seoDescription?: string;
|
|
220
|
-
}
|
|
221
|
-
type DataGroupFieldType = "TEXT" | "NUMBER" | "DECIMAL" | "BOOLEAN" | "DATE" | "TIME" | "DATETIME" | "PERCENTAGE" | "MONEY" | "ASSET" | "ITEM_LIST" | "DYNAMIC_NUMBER_CALCULATION_FROM_OTHERS";
|
|
222
|
-
interface FilterField {
|
|
223
|
-
key: string;
|
|
224
|
-
name: string;
|
|
225
|
-
type: DataGroupFieldType | string;
|
|
226
|
-
groupKey: string;
|
|
227
|
-
groupName: string;
|
|
228
|
-
values?: string[];
|
|
229
|
-
}
|
|
230
|
-
declare const ProductSort: {
|
|
231
|
-
readonly PRICE_ASC: "price_asc";
|
|
232
|
-
readonly PRICE_DESC: "price_desc";
|
|
233
|
-
readonly NAME_ASC: "name_asc";
|
|
234
|
-
readonly NAME_DESC: "name_desc";
|
|
235
|
-
readonly NEWEST: "newest";
|
|
236
|
-
readonly FEATURED: "featured";
|
|
237
|
-
};
|
|
238
|
-
type ProductSortValue = (typeof ProductSort)[keyof typeof ProductSort];
|
|
239
|
-
declare const OrderStatuses: {
|
|
240
|
-
readonly PENDING: "PENDING";
|
|
241
|
-
readonly CONFIRMED: "CONFIRMED";
|
|
242
|
-
readonly PROCESSING: "PROCESSING";
|
|
243
|
-
readonly SHIPPED: "SHIPPED";
|
|
244
|
-
readonly DELIVERED: "DELIVERED";
|
|
245
|
-
readonly CANCELLED: "CANCELLED";
|
|
246
|
-
readonly REFUNDED: "REFUNDED";
|
|
247
|
-
};
|
|
248
|
-
declare const PaymentStatuses: {
|
|
249
|
-
readonly UNPAID: "UNPAID";
|
|
250
|
-
readonly PAID: "PAID";
|
|
251
|
-
readonly PARTIALLY_REFUNDED: "PARTIALLY_REFUNDED";
|
|
252
|
-
readonly REFUNDED: "REFUNDED";
|
|
253
|
-
};
|
|
254
|
-
declare const FulfillmentStatuses: {
|
|
255
|
-
readonly UNFULFILLED: "UNFULFILLED";
|
|
256
|
-
readonly PARTIALLY_FULFILLED: "PARTIALLY_FULFILLED";
|
|
257
|
-
readonly FULFILLED: "FULFILLED";
|
|
258
|
-
};
|
|
259
|
-
declare const AddressTypes: {
|
|
260
|
-
readonly SHIPPING: "SHIPPING";
|
|
261
|
-
readonly BILLING: "BILLING";
|
|
262
|
-
};
|
|
263
|
-
type AddressType = (typeof AddressTypes)[keyof typeof AddressTypes];
|
|
264
|
-
interface ProductsQuery {
|
|
265
|
-
page?: number;
|
|
266
|
-
limit?: number;
|
|
267
|
-
/** Single category slug (OR logic with categories array) */
|
|
268
|
-
category?: string;
|
|
269
|
-
/** Multiple category slugs (OR logic — product in ANY of these categories) */
|
|
270
|
-
categories?: string[];
|
|
271
|
-
/** Single label slug */
|
|
272
|
-
label?: string;
|
|
273
|
-
priceMin?: number;
|
|
274
|
-
priceMax?: number;
|
|
275
|
-
currency?: string;
|
|
276
|
-
locale?: string;
|
|
277
|
-
sort?: ProductSortValue;
|
|
278
|
-
inStock?: boolean;
|
|
279
|
-
search?: string;
|
|
280
|
-
customFields?: Record<string, unknown>;
|
|
281
|
-
/** Filter by specific product IDs (comma-separated in URL) */
|
|
282
|
-
ids?: string[];
|
|
283
|
-
/** Filter by specific product slugs */
|
|
284
|
-
slugs?: string[];
|
|
285
|
-
/** Multiple labels (AND logic — product must have ALL) */
|
|
286
|
-
labels?: string[];
|
|
287
|
-
/** Exclude specific product IDs (e.g. for "related products" excluding current) */
|
|
288
|
-
excludeIds?: string[];
|
|
289
|
-
/** Exclude products in specific categories */
|
|
290
|
-
excludeCategories?: string[];
|
|
291
|
-
/** Only products with compareAtPrice (on sale) */
|
|
292
|
-
hasDiscount?: boolean;
|
|
293
|
-
/** Only featured products */
|
|
294
|
-
isFeatured?: boolean;
|
|
295
|
-
/** Products created after timestamp (epoch ms) */
|
|
296
|
-
createdAfter?: number;
|
|
297
|
-
}
|
|
298
|
-
interface AuthTokens {
|
|
299
|
-
accessToken: string;
|
|
300
|
-
refreshToken: string;
|
|
301
|
-
}
|
|
302
|
-
interface RegisterInput {
|
|
303
|
-
email: string;
|
|
304
|
-
password: string;
|
|
305
|
-
firstName?: string;
|
|
306
|
-
lastName?: string;
|
|
307
|
-
}
|
|
308
|
-
interface LoginInput {
|
|
309
|
-
email: string;
|
|
310
|
-
password: string;
|
|
311
|
-
}
|
|
312
|
-
interface CartItemProduct {
|
|
313
|
-
slug: string;
|
|
314
|
-
name: string;
|
|
315
|
-
sku: string;
|
|
316
|
-
imageUrl?: string;
|
|
317
|
-
inStock: boolean;
|
|
318
|
-
currentPrice: number;
|
|
319
|
-
}
|
|
320
|
-
interface CartItem {
|
|
321
|
-
id: string;
|
|
322
|
-
product: CartItemProduct;
|
|
323
|
-
quantity: number;
|
|
324
|
-
unitPrice: number;
|
|
325
|
-
totalPrice: number;
|
|
326
|
-
priceChanged: boolean;
|
|
327
|
-
volumePriceApplied: boolean;
|
|
328
|
-
}
|
|
329
|
-
interface CartDiscount {
|
|
330
|
-
code: string;
|
|
331
|
-
type: string;
|
|
332
|
-
value: number;
|
|
333
|
-
}
|
|
334
|
-
interface Cart {
|
|
335
|
-
id: string;
|
|
336
|
-
sessionToken?: string;
|
|
337
|
-
items: CartItem[];
|
|
338
|
-
subtotal: number;
|
|
339
|
-
discountTotal: number;
|
|
340
|
-
discount?: CartDiscount;
|
|
341
|
-
grandTotal: number;
|
|
342
|
-
currency: string;
|
|
343
|
-
itemCount: number;
|
|
344
|
-
}
|
|
345
|
-
interface AddToCartInput {
|
|
346
|
-
/** Product ID (eshop product ID or warehouse item ID) */
|
|
347
|
-
productId: string;
|
|
348
|
-
quantity: number;
|
|
349
|
-
}
|
|
350
|
-
interface CheckoutAddress {
|
|
351
|
-
firstName: string;
|
|
352
|
-
lastName: string;
|
|
353
|
-
company?: string;
|
|
354
|
-
street: string;
|
|
355
|
-
city: string;
|
|
356
|
-
zip: string;
|
|
357
|
-
country: string;
|
|
358
|
-
phone?: string;
|
|
359
|
-
}
|
|
360
|
-
interface CheckoutInput {
|
|
361
|
-
shippingAddress: CheckoutAddress;
|
|
362
|
-
billingAddress: CheckoutAddress;
|
|
363
|
-
email: string;
|
|
364
|
-
phone?: string;
|
|
365
|
-
customerNote?: string;
|
|
366
|
-
/**
|
|
367
|
-
* Chosen shipping method. Required whenever the eshop has at least one
|
|
368
|
-
* enabled shipping method — the backend rejects the order without it.
|
|
369
|
-
* Prefer also sending `shippingQuoteId` from `shipping.quote()`; with only
|
|
370
|
-
* the method id the backend re-quotes the cart server-side.
|
|
371
|
-
*/
|
|
372
|
-
shippingMethodId?: string;
|
|
373
|
-
/**
|
|
374
|
-
* Quote id from `shipping.quote()` — pins the exact server-computed price
|
|
375
|
-
* the customer saw. Expired quotes are re-quoted automatically; a consumed
|
|
376
|
-
* or foreign quote is rejected.
|
|
377
|
-
*/
|
|
378
|
-
shippingQuoteId?: string;
|
|
379
|
-
paymentMethodId?: string;
|
|
380
|
-
}
|
|
381
|
-
type OrderStatus = (typeof OrderStatuses)[keyof typeof OrderStatuses];
|
|
382
|
-
type PaymentStatus = (typeof PaymentStatuses)[keyof typeof PaymentStatuses];
|
|
383
|
-
type FulfillmentStatus = (typeof FulfillmentStatuses)[keyof typeof FulfillmentStatuses];
|
|
384
|
-
interface OrderListItem {
|
|
385
|
-
id: string;
|
|
386
|
-
orderNumber: string;
|
|
387
|
-
status: OrderStatus;
|
|
388
|
-
paymentStatus: PaymentStatus;
|
|
389
|
-
grandTotal: number;
|
|
390
|
-
currency: string;
|
|
391
|
-
itemCount: number;
|
|
392
|
-
createdAt: number;
|
|
393
|
-
}
|
|
394
|
-
interface OrderItem {
|
|
395
|
-
productName: string;
|
|
396
|
-
sku: string;
|
|
397
|
-
imageUrl?: string;
|
|
398
|
-
quantity: number;
|
|
399
|
-
unitPrice: number;
|
|
400
|
-
totalPrice: number;
|
|
401
|
-
totalPriceWithTax: number;
|
|
402
|
-
}
|
|
403
|
-
/**
|
|
404
|
-
* PII-minimized order view returned by `orders.track(token)`. The tracking
|
|
405
|
-
* token is shared in URLs and e-mails, so this deliberately omits full
|
|
406
|
-
* address, phone, billing and customer note, and masks the email.
|
|
407
|
-
*/
|
|
408
|
-
interface OrderTracking {
|
|
409
|
-
orderNumber: string;
|
|
410
|
-
status: OrderStatus;
|
|
411
|
-
paymentStatus: PaymentStatus;
|
|
412
|
-
fulfillmentStatus: FulfillmentStatus;
|
|
413
|
-
currency: string;
|
|
414
|
-
grandTotal: number;
|
|
415
|
-
/** Masked, e.g. "j***@e***.cz" */
|
|
416
|
-
emailMasked: string;
|
|
417
|
-
shippingCity: string | null;
|
|
418
|
-
shippingCountry: string | null;
|
|
419
|
-
items: OrderItem[];
|
|
420
|
-
createdAt: number;
|
|
421
|
-
}
|
|
422
|
-
interface OrderStatusHistory {
|
|
423
|
-
fromStatus?: OrderStatus;
|
|
424
|
-
toStatus: OrderStatus;
|
|
425
|
-
note?: string;
|
|
426
|
-
changedBy?: string;
|
|
427
|
-
createdAt: number;
|
|
428
|
-
}
|
|
429
|
-
interface OrderDetail extends OrderListItem {
|
|
430
|
-
items: OrderItem[];
|
|
431
|
-
shippingAddress: CheckoutAddress;
|
|
432
|
-
billingAddress: CheckoutAddress;
|
|
433
|
-
email: string;
|
|
434
|
-
phone?: string;
|
|
435
|
-
customerNote?: string;
|
|
436
|
-
subtotal: number;
|
|
437
|
-
taxTotal: number;
|
|
438
|
-
shippingTotal: number;
|
|
439
|
-
discountTotal: number;
|
|
440
|
-
fulfillmentStatus: FulfillmentStatus;
|
|
441
|
-
statusHistory: OrderStatusHistory[];
|
|
442
|
-
trackingToken?: string;
|
|
443
|
-
/**
|
|
444
|
-
* For redirect payment gateways (GoPay, ...), the hosted URL the
|
|
445
|
-
* storefront must send the customer to in order to pay. Present only on
|
|
446
|
-
* the order returned by `checkout.createOrder()`. Null/absent for
|
|
447
|
-
* offline methods (bank transfer, COD) and zero-total orders.
|
|
448
|
-
*/
|
|
449
|
-
paymentRedirectUrl?: string | null;
|
|
450
|
-
}
|
|
451
|
-
/** Generic response to `orders.requestAccessCode` — never reveals existence. */
|
|
452
|
-
interface OrderAccessRequestResponse {
|
|
453
|
-
success: boolean;
|
|
454
|
-
message: string;
|
|
455
|
-
}
|
|
456
|
-
/** Response to a successful `orders.verifyAccessCode`. */
|
|
457
|
-
interface OrderAccessVerifyResponse {
|
|
458
|
-
/** Short-lived JWT scoped to this single order (use with `getByAccessToken`). */
|
|
459
|
-
accessToken: string;
|
|
460
|
-
/** Token lifetime in seconds. */
|
|
461
|
-
expiresIn: number;
|
|
462
|
-
order: OrderDetail;
|
|
463
|
-
}
|
|
464
|
-
interface CustomerProfile {
|
|
465
|
-
id: string;
|
|
466
|
-
email: string;
|
|
467
|
-
firstName?: string;
|
|
468
|
-
lastName?: string;
|
|
469
|
-
phone?: string;
|
|
470
|
-
emailVerified: boolean;
|
|
471
|
-
}
|
|
472
|
-
interface CustomerAddress {
|
|
473
|
-
id: string;
|
|
474
|
-
type: AddressType;
|
|
475
|
-
isDefault: boolean;
|
|
476
|
-
firstName: string;
|
|
477
|
-
lastName: string;
|
|
478
|
-
company?: string;
|
|
479
|
-
street: string;
|
|
480
|
-
city: string;
|
|
481
|
-
zip: string;
|
|
482
|
-
country: string;
|
|
483
|
-
phone?: string;
|
|
484
|
-
}
|
|
485
|
-
interface Page {
|
|
486
|
-
slug: string;
|
|
487
|
-
title: string;
|
|
488
|
-
isActive: boolean;
|
|
489
|
-
}
|
|
490
|
-
interface PageDetail {
|
|
491
|
-
slug: string;
|
|
492
|
-
title: string;
|
|
493
|
-
content: unknown;
|
|
494
|
-
seoTitle?: string;
|
|
495
|
-
seoDescription?: string;
|
|
496
|
-
/** Downloadable files attached to the page (e.g. legal form PDFs). */
|
|
497
|
-
attachments: PageAttachment[];
|
|
498
|
-
}
|
|
499
|
-
interface PageAttachment {
|
|
500
|
-
name: string;
|
|
501
|
-
description: string | null;
|
|
502
|
-
url: string;
|
|
503
|
-
mimeType: string;
|
|
504
|
-
fileSize: number;
|
|
505
|
-
}
|
|
506
|
-
type BehioErrorCode = "UNAUTHORIZED" | "FORBIDDEN" | "NOT_FOUND" | "VALIDATION_ERROR" | "CONFLICT" | "RATE_LIMITED" | "CART_EMPTY" | "PRODUCT_NOT_FOUND" | "INVALID_CREDENTIALS" | "INVALID_DISCOUNT" | "DISCOUNT_EXPIRED" | "TOKEN_EXPIRED" | "TOKEN_INVALID" | "EMAIL_ALREADY_EXISTS" | "ORDER_NOT_CANCELLABLE" | "INTERNAL_ERROR" | "NETWORK_ERROR" | "TIMEOUT" | "UNKNOWN";
|
|
507
|
-
declare class BehioApiError extends Error {
|
|
508
|
-
readonly code: BehioErrorCode;
|
|
509
|
-
readonly status: number;
|
|
510
|
-
readonly body: unknown;
|
|
511
|
-
readonly isRetryable: boolean;
|
|
512
|
-
constructor(status: number, body: unknown, message?: string);
|
|
513
|
-
static resolveCode(status: number, body: unknown): BehioErrorCode;
|
|
514
|
-
/** Check if this is a specific error type */
|
|
515
|
-
is(code: BehioErrorCode): boolean;
|
|
516
|
-
}
|
|
517
|
-
declare class BehioNetworkError extends Error {
|
|
518
|
-
readonly code: "NETWORK_ERROR" | "TIMEOUT";
|
|
519
|
-
readonly isRetryable = true;
|
|
520
|
-
constructor(message: string, isTimeout?: boolean);
|
|
521
|
-
}
|
|
522
|
-
/**
|
|
523
|
-
* Shape every SDK call returns. Destructure `{data, error}` — exactly
|
|
524
|
-
* one of them is non-null on any given call. No more try/catch for
|
|
525
|
-
* expected failures; the type system forces you to handle `error`
|
|
526
|
-
* before touching `data`.
|
|
527
|
-
*
|
|
528
|
-
* const {data, error} = await behio.catalog.getProduct(slug);
|
|
529
|
-
* if (error) return <ErrorState code={error.code} />;
|
|
530
|
-
* return <ProductView product={data} />;
|
|
531
|
-
*/
|
|
532
|
-
type SdkResult<T> = {
|
|
533
|
-
data: T;
|
|
534
|
-
error: null;
|
|
535
|
-
} | {
|
|
536
|
-
data: null;
|
|
537
|
-
error: SdkError;
|
|
538
|
-
};
|
|
539
|
-
/**
|
|
540
|
-
* Canonical error shape returned from every SDK call. Always carries a
|
|
541
|
-
* `code` you can branch on without parsing messages.
|
|
542
|
-
*/
|
|
543
|
-
interface SdkError {
|
|
544
|
-
/**
|
|
545
|
-
* High-level category. `BehioErrorCode` covers API errors; additional
|
|
546
|
-
* buckets are network/timeout/abort/unknown.
|
|
547
|
-
*/
|
|
548
|
-
code: BehioErrorCode;
|
|
549
|
-
/** Human-readable message (fallback for unknown codes / dev logging). */
|
|
550
|
-
message: string;
|
|
551
|
-
/** HTTP status, if the error came from the API. Null for network / abort. */
|
|
552
|
-
status: number | null;
|
|
553
|
-
/** Raw API body, if present. */
|
|
554
|
-
body?: unknown;
|
|
555
|
-
/** Whether the operation is safe to retry (true for 5xx / 429 / network). */
|
|
556
|
-
isRetryable: boolean;
|
|
557
|
-
/** Preserves the original thrown instance for stack traces + rethrows. */
|
|
558
|
-
cause?: unknown;
|
|
559
|
-
}
|
|
560
|
-
declare function ok<T>(data: T): SdkResult<T>;
|
|
561
|
-
declare function err<T = never>(error: SdkError): SdkResult<T>;
|
|
562
|
-
/**
|
|
563
|
-
* Converts any thrown value into a canonical SdkError. Used by the
|
|
564
|
-
* request wrapper when catching internal throws.
|
|
565
|
-
*/
|
|
566
|
-
declare function toSdkError(err: unknown): SdkError;
|
|
567
|
-
type BehioEventType = "auth:login" | "auth:logout" | "auth:token-refresh" | "auth:token-refresh-failed" | "cart:updated" | "cart:cleared" | "order:created" | "error" | "request" | "response" | "rate-limit-warning";
|
|
568
|
-
type BehioEventHandler = (data?: unknown) => void;
|
|
569
|
-
interface RequestInterceptorConfig {
|
|
570
|
-
url: string;
|
|
571
|
-
method: string;
|
|
572
|
-
headers: Record<string, string>;
|
|
573
|
-
body?: string;
|
|
574
|
-
}
|
|
575
|
-
interface RequestInterceptor {
|
|
576
|
-
(config: RequestInterceptorConfig): RequestInterceptorConfig | Promise<RequestInterceptorConfig>;
|
|
577
|
-
}
|
|
578
|
-
interface ResponseInterceptorData {
|
|
579
|
-
status: number;
|
|
580
|
-
data: unknown;
|
|
581
|
-
headers: Headers;
|
|
582
|
-
}
|
|
583
|
-
interface ResponseInterceptor {
|
|
584
|
-
(response: ResponseInterceptorData): void | Promise<void>;
|
|
585
|
-
}
|
|
586
|
-
interface BundleItem {
|
|
587
|
-
productId: string;
|
|
588
|
-
slug: string | null;
|
|
589
|
-
name: string;
|
|
590
|
-
sku: string;
|
|
591
|
-
quantity: number;
|
|
592
|
-
imageUrl: string | null;
|
|
593
|
-
defaultPrice: number | null;
|
|
594
|
-
}
|
|
595
|
-
interface Bundle {
|
|
596
|
-
id: string;
|
|
597
|
-
slug: string;
|
|
598
|
-
name: string;
|
|
599
|
-
description: string | null;
|
|
600
|
-
bundlePrice: number;
|
|
601
|
-
currency: string;
|
|
602
|
-
coverImage: string | null;
|
|
603
|
-
endsAt: number | null;
|
|
604
|
-
itemsSum: number;
|
|
605
|
-
/** Absolute saving vs buying the components separately, in `currency`. */
|
|
606
|
-
savings: number;
|
|
607
|
-
/** Percentage saving, 0–100. 0 when `itemsSum` is zero. */
|
|
608
|
-
savingsPercent: number;
|
|
609
|
-
/** Minimum bundles per order. Default 1. */
|
|
610
|
-
minQuantity: number;
|
|
611
|
-
/** Maximum bundles per order. `null` = uncapped. */
|
|
612
|
-
maxQuantity: number | null;
|
|
613
|
-
/** Lifetime stock limit. `null` = uncapped. Once exceeded, add-to-cart fails. */
|
|
614
|
-
stockLimit: number | null;
|
|
615
|
-
/** Lifetime units sold (materialized counter). Used for "X sold" badges. */
|
|
616
|
-
soldCount: number;
|
|
617
|
-
items: BundleItem[];
|
|
618
|
-
}
|
|
619
|
-
/**
|
|
620
|
-
* Shape returned by `behio.shipping.listMethods()` — the merchant's
|
|
621
|
-
* configured shipping methods filtered by cart currency + destination
|
|
622
|
-
* country. Use this for the "always-on" picker; for live quotes, prefer
|
|
623
|
-
* `behio.shipping.quote()` which can dispatch to the meta-provider
|
|
624
|
-
* (Zaslat, Shippo, …) for a live carrier rate per address.
|
|
625
|
-
*/
|
|
626
|
-
interface ShippingMethodSummary {
|
|
627
|
-
id: string;
|
|
628
|
-
name: string;
|
|
629
|
-
description: string | null;
|
|
630
|
-
/** Internal routing id ("zaslat", "ppl_direct", "manual", …). Not for display. */
|
|
631
|
-
provider: string;
|
|
632
|
-
/** "fixed" = price known upfront; "live_quote" = must call shipping.quote() with address. */
|
|
633
|
-
priceStrategy: "fixed" | "live_quote";
|
|
634
|
-
currency: string | null;
|
|
635
|
-
/** Final customer-facing price. Null for live_quote methods (call quote() to resolve). */
|
|
636
|
-
price: number | null;
|
|
637
|
-
/** Per-currency base price from the merchant's config. Null for live_quote. */
|
|
638
|
-
basePrice: number | null;
|
|
639
|
-
isFreeShipping: boolean;
|
|
640
|
-
freeShippingThreshold: number | null;
|
|
641
|
-
/** "address" | "pickup_point" | "in_store" | "digital". */
|
|
642
|
-
deliveryType: string;
|
|
643
|
-
supportsPickupPoints: boolean;
|
|
644
|
-
etaDaysMin: number | null;
|
|
645
|
-
etaDaysMax: number | null;
|
|
646
|
-
allowedCountries: string[];
|
|
647
|
-
/** Customer-safe config fields the merchant filled in (pickup address, instructions). */
|
|
648
|
-
publicConfig: Record<string, unknown>;
|
|
649
|
-
}
|
|
650
|
-
/**
|
|
651
|
-
* Input for `behio.shipping.quote()`. At minimum requires the destination
|
|
652
|
-
* country — passing more (zip, weight per item, cart total) lets the
|
|
653
|
-
* meta-provider return better-fitting carriers and triggers free-shipping
|
|
654
|
-
* thresholds correctly.
|
|
655
|
-
*/
|
|
656
|
-
interface ShippingQuoteInput {
|
|
657
|
-
destinationAddress: {
|
|
658
|
-
country: string;
|
|
659
|
-
zip?: string;
|
|
660
|
-
city?: string;
|
|
661
|
-
street?: string;
|
|
662
|
-
};
|
|
663
|
-
items?: Array<{
|
|
664
|
-
whItemId: string;
|
|
665
|
-
quantity: number;
|
|
666
|
-
weightKg?: number;
|
|
667
|
-
}>;
|
|
668
|
-
cartTotal?: number;
|
|
669
|
-
currency?: string;
|
|
670
|
-
}
|
|
671
|
-
/**
|
|
672
|
-
* One option returned by `behio.shipping.quote()`. Methods configured for
|
|
673
|
-
* fixed pricing always come back with `available: true` and the merchant's
|
|
674
|
-
* configured price. Methods configured for live quoting come back available
|
|
675
|
-
* only when the upstream meta-provider returned a rate for the destination
|
|
676
|
-
* — otherwise `available: false` with a `reason` (e.g. `"no_rate_returned"`,
|
|
677
|
-
* `"live_quote_not_implemented"`). Filter `available: true` in your
|
|
678
|
-
* checkout picker.
|
|
679
|
-
*/
|
|
680
|
-
interface ShippingQuote extends ShippingMethodSummary {
|
|
681
|
-
/** `"fixed"` uses `pricing` rows; `"live_quote"` came from the upstream provider. */
|
|
682
|
-
strategy: "fixed" | "live_quote";
|
|
683
|
-
available: boolean;
|
|
684
|
-
reason: string | null;
|
|
685
|
-
/** Server-generated quote ID. Null for fixed-price methods. Pass to checkout for tamper-proof pricing. */
|
|
686
|
-
quoteId: string | null;
|
|
687
|
-
/** Quote expiry (epoch ms). Null for fixed-price methods. */
|
|
688
|
-
expiresAt: number | null;
|
|
689
|
-
}
|
|
690
|
-
interface CrossSellItem {
|
|
691
|
-
productId: string;
|
|
692
|
-
slug: string | null;
|
|
693
|
-
name: string;
|
|
694
|
-
sku: string;
|
|
695
|
-
price: number | null;
|
|
696
|
-
imageUrl: string | null;
|
|
697
|
-
stockCached: number;
|
|
698
|
-
}
|
|
699
|
-
interface ActivePromotion {
|
|
700
|
-
id: string;
|
|
701
|
-
name: string;
|
|
702
|
-
slug: string;
|
|
703
|
-
type: string;
|
|
704
|
-
discountType: string;
|
|
705
|
-
discountValue: number;
|
|
706
|
-
startsAt: number;
|
|
707
|
-
endsAt: number | null;
|
|
708
|
-
badgeText: string | null;
|
|
709
|
-
badgeColor: string | null;
|
|
710
|
-
showCountdown: boolean;
|
|
711
|
-
couponRequired: boolean;
|
|
712
|
-
}
|
|
713
|
-
interface GiftCardBalance {
|
|
714
|
-
valid: boolean;
|
|
715
|
-
balance: number;
|
|
716
|
-
currency: string;
|
|
717
|
-
}
|
|
718
|
-
interface WishlistItem {
|
|
719
|
-
id: string;
|
|
720
|
-
productId: string;
|
|
721
|
-
productName: string;
|
|
722
|
-
productSku: string;
|
|
723
|
-
productSlug: string | null;
|
|
724
|
-
imageUrl: string | null;
|
|
725
|
-
price: number | null;
|
|
726
|
-
stockCached: number;
|
|
727
|
-
createdAt: number;
|
|
728
|
-
}
|
|
729
|
-
interface ProductReview {
|
|
730
|
-
id: string;
|
|
731
|
-
authorName: string;
|
|
732
|
-
rating: number;
|
|
733
|
-
title: string | null;
|
|
734
|
-
content: string | null;
|
|
735
|
-
imageUrls: string[];
|
|
736
|
-
isVerifiedPurchase: boolean;
|
|
737
|
-
helpfulCount: number;
|
|
738
|
-
unhelpfulCount: number;
|
|
739
|
-
replyContent: string | null;
|
|
740
|
-
replyAt: number | null;
|
|
741
|
-
createdAt: number;
|
|
742
|
-
}
|
|
743
|
-
interface ProductReviewsResponse {
|
|
744
|
-
reviews: ProductReview[];
|
|
745
|
-
total: number;
|
|
746
|
-
page: number;
|
|
747
|
-
limit: number;
|
|
748
|
-
averageRating: number;
|
|
749
|
-
reviewCount: number;
|
|
750
|
-
}
|
|
751
|
-
/** Returned by `catalog.notifyWhenAvailable()` — back-in-stock subscription. */
|
|
752
|
-
interface BackInStockSubscription {
|
|
753
|
-
id: string;
|
|
754
|
-
eshopId: string;
|
|
755
|
-
productId: string;
|
|
756
|
-
email: string;
|
|
757
|
-
createdAt: number;
|
|
758
|
-
}
|
|
759
|
-
interface SubmitReviewInput {
|
|
760
|
-
productId: string;
|
|
761
|
-
rating: number;
|
|
762
|
-
title?: string;
|
|
763
|
-
content?: string;
|
|
764
|
-
authorName: string;
|
|
765
|
-
authorEmail?: string;
|
|
766
|
-
imageUrls?: string[];
|
|
767
|
-
}
|
|
768
|
-
interface ReturnableOrderItem {
|
|
769
|
-
orderItemId: string;
|
|
770
|
-
productName: string;
|
|
771
|
-
/** Quantity ordered */
|
|
772
|
-
quantity: number;
|
|
773
|
-
/** Units still returnable (ordered minus active return claims) */
|
|
774
|
-
returnableQuantity: number;
|
|
775
|
-
}
|
|
776
|
-
/**
|
|
777
|
-
* Result of the guest order lookup used by the EU withdrawal form:
|
|
778
|
-
* the customer enters their order number + email and gets back the
|
|
779
|
-
* internal ids needed to submit a return. No account required.
|
|
780
|
-
*/
|
|
781
|
-
interface ReturnableOrder {
|
|
782
|
-
orderId: string;
|
|
783
|
-
orderNumber: string;
|
|
784
|
-
status: string;
|
|
785
|
-
items: ReturnableOrderItem[];
|
|
786
|
-
createdAt: number;
|
|
787
|
-
}
|
|
788
|
-
interface ReturnRequestItem {
|
|
789
|
-
id: string;
|
|
790
|
-
orderItemId: string;
|
|
791
|
-
productName: string;
|
|
792
|
-
quantity: number;
|
|
793
|
-
reason: string | null;
|
|
794
|
-
imageUrls: string[];
|
|
795
|
-
}
|
|
796
|
-
/** Returned by `returns.submit()` — the acknowledged withdrawal request. */
|
|
797
|
-
interface ReturnRequest {
|
|
798
|
-
id: string;
|
|
799
|
-
eshopId: string;
|
|
800
|
-
orderId: string;
|
|
801
|
-
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
802
|
-
status: string;
|
|
803
|
-
reason: string;
|
|
804
|
-
customerNote: string | null;
|
|
805
|
-
items: ReturnRequestItem[];
|
|
806
|
-
createdAt: number;
|
|
807
|
-
}
|
|
808
|
-
interface ReturnStatusItem {
|
|
809
|
-
id: string;
|
|
810
|
-
productName: string;
|
|
811
|
-
quantity: number;
|
|
812
|
-
reason: string | null;
|
|
813
|
-
}
|
|
814
|
-
/** Returned by `returns.getStatus()` — the full public view of a return. */
|
|
815
|
-
interface ReturnStatus {
|
|
816
|
-
id: string;
|
|
817
|
-
orderNumber: string;
|
|
818
|
-
/** REQUESTED | APPROVED | SHIPPED_BACK | RECEIVED | REFUNDED | REJECTED | CLOSED */
|
|
819
|
-
status: string;
|
|
820
|
-
reason: string;
|
|
821
|
-
customerNote: string | null;
|
|
822
|
-
refundMethod: string | null;
|
|
823
|
-
refundAmount: number | null;
|
|
824
|
-
refundedAt: number | null;
|
|
825
|
-
returnTrackingNumber: string | null;
|
|
826
|
-
items: ReturnStatusItem[];
|
|
827
|
-
createdAt: number;
|
|
828
|
-
updatedAt: number;
|
|
829
|
-
}
|
|
830
|
-
interface SubmitReturnInput {
|
|
831
|
-
orderId: string;
|
|
832
|
-
/**
|
|
833
|
-
* Email used on the order. Required — it is the ownership gate for guest
|
|
834
|
-
* withdrawals; the backend rejects submissions whose email doesn't match.
|
|
835
|
-
*/
|
|
836
|
-
email: string;
|
|
837
|
-
reason: string;
|
|
838
|
-
customerNote?: string;
|
|
839
|
-
items: {
|
|
840
|
-
orderItemId: string;
|
|
841
|
-
productName: string;
|
|
842
|
-
quantity: number;
|
|
843
|
-
reason?: string;
|
|
844
|
-
imageUrls?: string[];
|
|
845
|
-
}[];
|
|
846
|
-
}
|
|
847
|
-
interface CookieConsent {
|
|
848
|
-
necessary: boolean;
|
|
849
|
-
analytics: boolean;
|
|
850
|
-
marketing: boolean;
|
|
851
|
-
preferences: boolean;
|
|
852
|
-
consentedAt: number;
|
|
853
|
-
}
|
|
854
|
-
interface CookieConsentInput {
|
|
855
|
-
visitorId: string;
|
|
856
|
-
analytics: boolean;
|
|
857
|
-
marketing: boolean;
|
|
858
|
-
preferences: boolean;
|
|
859
|
-
}
|
|
860
|
-
interface QuoteItem {
|
|
861
|
-
productId: string;
|
|
862
|
-
quantity: number;
|
|
863
|
-
requestedPrice: number | null;
|
|
864
|
-
quotedPrice: number | null;
|
|
865
|
-
}
|
|
866
|
-
interface QuoteRequest {
|
|
867
|
-
id: string;
|
|
868
|
-
/** PENDING | QUOTED | ACCEPTED | REJECTED | EXPIRED */
|
|
869
|
-
status: string;
|
|
870
|
-
contactName: string;
|
|
871
|
-
contactEmail: string;
|
|
872
|
-
companyName: string | null;
|
|
873
|
-
quotedTotal: number | null;
|
|
874
|
-
quotedCurrency: string | null;
|
|
875
|
-
quotedNote: string | null;
|
|
876
|
-
expiresAt: number | null;
|
|
877
|
-
items: QuoteItem[];
|
|
878
|
-
createdAt: number;
|
|
879
|
-
}
|
|
880
|
-
interface SubmitQuoteInput {
|
|
881
|
-
contactName: string;
|
|
882
|
-
contactEmail: string;
|
|
883
|
-
contactPhone?: string;
|
|
884
|
-
companyName?: string;
|
|
885
|
-
companyIco?: string;
|
|
886
|
-
message?: string;
|
|
887
|
-
items: {
|
|
888
|
-
productId: string;
|
|
889
|
-
quantity: number;
|
|
890
|
-
requestedPrice?: number;
|
|
891
|
-
}[];
|
|
892
|
-
}
|
|
1
|
+
export { t as ActivePromotion, J as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a3 as AddressType, a4 as AddressTypes, K as AuthTokens, I as BackInStockSubscription, L as BehioApiError, a5 as BehioErrorCode, a6 as BehioEventHandler, a7 as BehioEventType, a8 as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, r as Bundle, M as BundleItem, g as Cart, N as CartDiscount, T as CartItem, a9 as CartItemProduct, C as Category, e as CategoryDetail, U as CheckoutAddress, n as CheckoutInput, aa as CheckoutPaymentMethod, D as CookieConsent, E as CookieConsentInput, s as CrossSellItem, i as CustomerAddress, h as CustomerProfile, ab as DataGroupFieldType, F as FilterField, V as FulfillmentStatus, ac as FulfillmentStatuses, G as GiftCardBalance, X as LoginInput, Y as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, Z as OrderItem, O as OrderListItem, _ as OrderStatus, ad as OrderStatusHistory, ae as OrderStatuses, af as OrderTracking, p as Page, ag as PageAttachment, o as PageDetail, b as PaginatedResponse, $ as PaymentStatus, ah as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, ai as ProductMedia, aj as ProductMediaVariant, a0 as ProductPrice, a1 as ProductReview, u as ProductReviewsResponse, ak as ProductSort, al as ProductSortValue, a2 as ProductVariant, am as ProductVolumePrice, P as ProductsQuery, an as QuoteItem, Q as QuoteRequest, R as RegisterInput, ao as RequestInterceptor, ap as RequestInterceptorConfig, aq as ResponseInterceptor, ar as ResponseInterceptorData, y as ReturnRequest, as as ReturnRequestItem, x as ReturnStatus, at as ReturnStatusItem, w as ReturnableOrder, au as ReturnableOrderItem, av as SdkError, aw as SdkResult, ax as ShippingMethodSummary, ay as ShippingQuote, az as ShippingQuoteInput, S as ShopInfo, q as ShopSeo, H as SubmitQuoteInput, z as SubmitReturnInput, v as SubmitReviewInput, W as WishlistItem, aA as err, aB as ok, aC as toSdkError } from './client-tINA5Ntn.js';
|
|
893
2
|
|
|
894
|
-
declare class BehioStorefront {
|
|
895
|
-
private baseUrl;
|
|
896
|
-
private apiKey;
|
|
897
|
-
private shopDomain?;
|
|
898
|
-
private defaultLocale?;
|
|
899
|
-
private defaultCurrency?;
|
|
900
|
-
private fetchFn;
|
|
901
|
-
private timeout;
|
|
902
|
-
private retries;
|
|
903
|
-
private retryDelay;
|
|
904
|
-
private accessToken?;
|
|
905
|
-
private refreshToken?;
|
|
906
|
-
private isRefreshing;
|
|
907
|
-
private refreshPromise;
|
|
908
|
-
private cartSession?;
|
|
909
|
-
private listeners;
|
|
910
|
-
private requestInterceptors;
|
|
911
|
-
private responseInterceptors;
|
|
912
|
-
private rateLimitRemaining;
|
|
913
|
-
private rateLimitReset;
|
|
914
|
-
constructor(config: BehioStorefrontConfig);
|
|
915
|
-
readonly catalog: CatalogModule;
|
|
916
|
-
readonly auth: AuthModule;
|
|
917
|
-
readonly cart: CartModule;
|
|
918
|
-
readonly checkout: CheckoutModule;
|
|
919
|
-
readonly orders: OrdersModule;
|
|
920
|
-
readonly customer: CustomerModule;
|
|
921
|
-
readonly pages: PagesModule;
|
|
922
|
-
readonly wishlist: WishlistModule;
|
|
923
|
-
readonly reviews: ReviewsModule;
|
|
924
|
-
readonly returns: ReturnsModule;
|
|
925
|
-
readonly consent: ConsentModule;
|
|
926
|
-
readonly quotes: QuotesModule;
|
|
927
|
-
readonly addresses: AddressModule;
|
|
928
|
-
readonly shipping: ShippingModule;
|
|
929
|
-
/** Get basic shop info */
|
|
930
|
-
getShopInfo(): Promise<SdkResult<ShopInfo>>;
|
|
931
|
-
/** Get SEO metadata for the shop homepage in the given locale (defaults to shop default). */
|
|
932
|
-
getShopSeo(locale?: string): Promise<SdkResult<ShopSeo>>;
|
|
933
|
-
/** Set auth tokens (e.g. from localStorage) */
|
|
934
|
-
setTokens(tokens: {
|
|
935
|
-
accessToken: string;
|
|
936
|
-
refreshToken: string;
|
|
937
|
-
}): void;
|
|
938
|
-
/** Clear auth tokens */
|
|
939
|
-
clearTokens(): void;
|
|
940
|
-
/** Get current access token */
|
|
941
|
-
getAccessToken(): string | undefined;
|
|
942
|
-
/** Get current refresh token */
|
|
943
|
-
getRefreshToken(): string | undefined;
|
|
944
|
-
/** Set cart session token (e.g. from cookie) */
|
|
945
|
-
setCartSession(token: string): void;
|
|
946
|
-
/** Get cart session token */
|
|
947
|
-
getCartSession(): string | undefined;
|
|
948
|
-
/** Clear cart session */
|
|
949
|
-
clearCartSession(): void;
|
|
950
|
-
/**
|
|
951
|
-
* Set the default currency sent on every catalog request (unless a per-call
|
|
952
|
-
* `currency` overrides it). Read live at request time, so changing it takes
|
|
953
|
-
* effect immediately without rebuilding the client. Pass undefined to clear
|
|
954
|
-
* (falls back to the shop's default currency server-side).
|
|
955
|
-
*/
|
|
956
|
-
setCurrency(currency: string | undefined): void;
|
|
957
|
-
/** Get the current default currency, if any. */
|
|
958
|
-
getCurrency(): string | undefined;
|
|
959
|
-
/** Set the default locale sent on every catalog request (per-call wins). */
|
|
960
|
-
setLocale(locale: string | undefined): void;
|
|
961
|
-
/** Get the current default locale, if any. */
|
|
962
|
-
getLocale(): string | undefined;
|
|
963
|
-
/** Subscribe to SDK events. Returns an unsubscribe function. */
|
|
964
|
-
on(event: BehioEventType, handler: BehioEventHandler): () => void;
|
|
965
|
-
/** @internal Emit an event (fire-and-forget, handler errors are swallowed) */
|
|
966
|
-
emit(event: BehioEventType, data?: unknown): void;
|
|
967
|
-
/** Add a request interceptor. Returns an unsubscribe function. */
|
|
968
|
-
addRequestInterceptor(fn: RequestInterceptor): () => void;
|
|
969
|
-
/** Add a response interceptor. Returns an unsubscribe function. */
|
|
970
|
-
addResponseInterceptor(fn: ResponseInterceptor): () => void;
|
|
971
|
-
/** Get current rate limit info from latest response headers */
|
|
972
|
-
getRateLimitInfo(): {
|
|
973
|
-
remaining: number | null;
|
|
974
|
-
reset: number | null;
|
|
975
|
-
};
|
|
976
|
-
private handleTokenRefresh;
|
|
977
|
-
/**
|
|
978
|
-
* Every public module method funnels through here. Internally calls
|
|
979
|
-
* `rawRequest` (which throws on failure) and maps thrown errors to
|
|
980
|
-
* `SdkError` so the public surface can return `SdkResult<T>`.
|
|
981
|
-
*
|
|
982
|
-
* @internal — don't call from outside the SDK; use the typed module
|
|
983
|
-
* methods (behio.catalog.*, behio.cart.*, …) instead.
|
|
984
|
-
*/
|
|
985
|
-
request<T>(method: string, path: string, options?: {
|
|
986
|
-
body?: unknown;
|
|
987
|
-
query?: Record<string, string | number | boolean | undefined | string[] | number[]>;
|
|
988
|
-
auth?: boolean;
|
|
989
|
-
signal?: AbortSignal;
|
|
990
|
-
headers?: Record<string, string>;
|
|
991
|
-
}): Promise<SdkResult<T>>;
|
|
992
|
-
/**
|
|
993
|
-
* Throws on failure (API error / network / timeout). Kept private so
|
|
994
|
-
* internal auth refresh recursion keeps its existing control flow —
|
|
995
|
-
* public callers must go through `request()` which returns Result.
|
|
996
|
-
*/
|
|
997
|
-
private rawRequest;
|
|
998
|
-
}
|
|
999
|
-
declare class CatalogModule {
|
|
1000
|
-
private client;
|
|
1001
|
-
constructor(client: BehioStorefront);
|
|
1002
|
-
/** List products with filtering, pagination, search */
|
|
1003
|
-
getProducts(query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1004
|
-
/** Get product detail by slug */
|
|
1005
|
-
getProduct(slug: string, options?: {
|
|
1006
|
-
locale?: string;
|
|
1007
|
-
currency?: string;
|
|
1008
|
-
}): Promise<SdkResult<ProductDetail>>;
|
|
1009
|
-
/** Get category tree */
|
|
1010
|
-
getCategories(locale?: string): Promise<SdkResult<{
|
|
1011
|
-
categories: Category[];
|
|
1012
|
-
}>>;
|
|
1013
|
-
/** Get category detail by slug */
|
|
1014
|
-
getCategory(slug: string, locale?: string): Promise<SdkResult<CategoryDetail>>;
|
|
1015
|
-
/** Get products in a category */
|
|
1016
|
-
getCategoryProducts(slug: string, query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1017
|
-
/** Get all labels */
|
|
1018
|
-
getLabels(locale?: string): Promise<SdkResult<{
|
|
1019
|
-
labels: ProductLabel[];
|
|
1020
|
-
}>>;
|
|
1021
|
-
/** Get featured products */
|
|
1022
|
-
getFeatured(options?: {
|
|
1023
|
-
locale?: string;
|
|
1024
|
-
currency?: string;
|
|
1025
|
-
}): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1026
|
-
/** Get available filter fields for dynamic filter UI */
|
|
1027
|
-
getFilters(): Promise<SdkResult<{
|
|
1028
|
-
filters: FilterField[];
|
|
1029
|
-
}>>;
|
|
1030
|
-
/** Search products */
|
|
1031
|
-
search(query: string, options?: {
|
|
1032
|
-
page?: number;
|
|
1033
|
-
limit?: number;
|
|
1034
|
-
}): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1035
|
-
/** List all active bundles */
|
|
1036
|
-
getBundles(): Promise<SdkResult<{
|
|
1037
|
-
items: Bundle[];
|
|
1038
|
-
}>>;
|
|
1039
|
-
/** Get a single bundle by slug */
|
|
1040
|
-
getBundle(slug: string): Promise<SdkResult<Bundle>>;
|
|
1041
|
-
/** Cross-sell / related / upsell products for a product */
|
|
1042
|
-
getCrossSell(productSlug: string): Promise<SdkResult<{
|
|
1043
|
-
related: CrossSellItem[];
|
|
1044
|
-
upsell: CrossSellItem[];
|
|
1045
|
-
crossSell: CrossSellItem[];
|
|
1046
|
-
}>>;
|
|
1047
|
-
/** Active promotions applicable to a product (with countdown end time) */
|
|
1048
|
-
/** Back-in-stock notification subscription for a sold-out product. */
|
|
1049
|
-
notifyWhenAvailable(productId: string, email: string): Promise<SdkResult<BackInStockSubscription>>;
|
|
1050
|
-
getProductPromotions(productSlug: string): Promise<SdkResult<{
|
|
1051
|
-
items: ActivePromotion[];
|
|
1052
|
-
}>>;
|
|
1053
|
-
/** Check a gift card code — returns validity and remaining balance */
|
|
1054
|
-
checkGiftCard(code: string): Promise<SdkResult<GiftCardBalance>>;
|
|
1055
|
-
/** List configured payment methods (filtered by currency). */
|
|
1056
|
-
listPaymentMethods(opts?: {
|
|
1057
|
-
currency?: string;
|
|
1058
|
-
}): Promise<SdkResult<{
|
|
1059
|
-
items: CheckoutPaymentMethod[];
|
|
1060
|
-
}>>;
|
|
1061
|
-
}
|
|
1062
|
-
declare class AuthModule {
|
|
1063
|
-
private client;
|
|
1064
|
-
constructor(client: BehioStorefront);
|
|
1065
|
-
/** Register a new customer */
|
|
1066
|
-
register(input: RegisterInput): Promise<SdkResult<AuthTokens>>;
|
|
1067
|
-
/** Login with email and password */
|
|
1068
|
-
login(input: LoginInput): Promise<SdkResult<AuthTokens>>;
|
|
1069
|
-
/** Refresh access token using refresh token */
|
|
1070
|
-
refresh(refreshToken?: string): Promise<SdkResult<AuthTokens>>;
|
|
1071
|
-
/** Logout (invalidate refresh token) */
|
|
1072
|
-
logout(refreshToken?: string): Promise<SdkResult<MessageResponse>>;
|
|
1073
|
-
/** Request password reset email */
|
|
1074
|
-
forgotPassword(email: string): Promise<SdkResult<MessageResponse>>;
|
|
1075
|
-
/** Reset password with token */
|
|
1076
|
-
resetPassword(token: string, newPassword: string): Promise<SdkResult<MessageResponse>>;
|
|
1077
|
-
/** Verify email with token */
|
|
1078
|
-
verifyEmail(token: string): Promise<SdkResult<MessageResponse>>;
|
|
1079
|
-
/** Check if user is logged in (has access token) */
|
|
1080
|
-
isLoggedIn(): boolean;
|
|
1081
|
-
}
|
|
1082
|
-
declare class CartModule {
|
|
1083
|
-
private client;
|
|
1084
|
-
constructor(client: BehioStorefront);
|
|
1085
|
-
/** Get current cart */
|
|
1086
|
-
get(): Promise<SdkResult<Cart>>;
|
|
1087
|
-
/** Add item to cart */
|
|
1088
|
-
addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
|
|
1089
|
-
newSessionToken?: string;
|
|
1090
|
-
}>>;
|
|
1091
|
-
/** Update item quantity */
|
|
1092
|
-
updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
|
|
1093
|
-
/** Remove item from cart */
|
|
1094
|
-
removeItem(itemId: string): Promise<SdkResult<Cart>>;
|
|
1095
|
-
/** Clear entire cart */
|
|
1096
|
-
clear(): Promise<SdkResult<void>>;
|
|
1097
|
-
/** Apply a gift card code to the cart. Balance is deducted at checkout. */
|
|
1098
|
-
applyGiftCard(code: string): Promise<SdkResult<Cart>>;
|
|
1099
|
-
/** Remove a gift card from the cart */
|
|
1100
|
-
removeGiftCard(): Promise<SdkResult<Cart>>;
|
|
1101
|
-
/**
|
|
1102
|
-
* Add a bundle to the cart. Price is snapshotted at the bundle's current
|
|
1103
|
-
* price. Pass either the bundle id or its slug — slug is more ergonomic
|
|
1104
|
-
* for static storefront wiring (`behio.cart.addBundle({slug: "morning-set"})`).
|
|
1105
|
-
*
|
|
1106
|
-
* Respects the bundle's `minQuantity`, `maxQuantity`, and `stockLimit`:
|
|
1107
|
-
* the request rejects with HTTP 400 if the resulting cart line would
|
|
1108
|
-
* violate any of them. The returned error includes the relevant field
|
|
1109
|
-
* (`minQuantity`, `maxQuantity`, or `remaining`) so the storefront can
|
|
1110
|
-
* surface a meaningful message.
|
|
1111
|
-
*
|
|
1112
|
-
* @param identifier Either `{id: bundleId}` or `{slug: bundleSlug}`. As a
|
|
1113
|
-
* convenience, passing a plain string is treated as the
|
|
1114
|
-
* bundle id for backwards compatibility.
|
|
1115
|
-
* @param quantity How many bundles to add (defaults to 1). Capped by
|
|
1116
|
-
* the bundle's `maxQuantity` if set.
|
|
1117
|
-
*/
|
|
1118
|
-
addBundle(identifier: string | {
|
|
1119
|
-
id: string;
|
|
1120
|
-
} | {
|
|
1121
|
-
slug: string;
|
|
1122
|
-
}, quantity?: number): Promise<SdkResult<Cart>>;
|
|
1123
|
-
/** Update quantity of a bundle already in the cart */
|
|
1124
|
-
updateBundleQuantity(bundleId: string, quantity: number): Promise<SdkResult<Cart>>;
|
|
1125
|
-
/** Remove a bundle from the cart */
|
|
1126
|
-
removeBundle(bundleId: string): Promise<SdkResult<Cart>>;
|
|
1127
|
-
/** Merge anonymous cart into authenticated customer cart */
|
|
1128
|
-
merge(): Promise<SdkResult<Cart>>;
|
|
1129
|
-
/** Apply discount code */
|
|
1130
|
-
applyDiscount(code: string): Promise<SdkResult<Cart>>;
|
|
1131
|
-
/** Remove discount code */
|
|
1132
|
-
removeDiscount(): Promise<SdkResult<Cart>>;
|
|
1133
|
-
}
|
|
1134
|
-
declare class CheckoutModule {
|
|
1135
|
-
private client;
|
|
1136
|
-
constructor(client: BehioStorefront);
|
|
1137
|
-
/** Create order from cart */
|
|
1138
|
-
createOrder(input: CheckoutInput): Promise<SdkResult<OrderDetail>>;
|
|
1139
|
-
}
|
|
1140
|
-
declare class OrdersModule {
|
|
1141
|
-
private client;
|
|
1142
|
-
constructor(client: BehioStorefront);
|
|
1143
|
-
/** List customer orders (requires auth) */
|
|
1144
|
-
list(options?: {
|
|
1145
|
-
page?: number;
|
|
1146
|
-
limit?: number;
|
|
1147
|
-
}): Promise<SdkResult<PaginatedResponse<OrderListItem>>>;
|
|
1148
|
-
/** Get order detail (requires auth) */
|
|
1149
|
-
get(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1150
|
-
/** Cancel a PENDING order (requires auth) */
|
|
1151
|
-
cancel(orderNumber: string): Promise<SdkResult<OrderDetail>>;
|
|
1152
|
-
/**
|
|
1153
|
-
* Track an order by tracking token (no login, only API key). Returns a
|
|
1154
|
-
* PII-minimized view: order status + items + masked email + destination
|
|
1155
|
-
* city, never full address / phone / billing — the token travels in URLs
|
|
1156
|
-
* and e-mails so it must not expose full personal data.
|
|
1157
|
-
*/
|
|
1158
|
-
track(trackingToken: string): Promise<SdkResult<OrderTracking>>;
|
|
1159
|
-
/**
|
|
1160
|
-
* Step 1 of guest order-access: request a 6-digit code e-mailed to the
|
|
1161
|
-
* address on the order. The response is always generic (success) regardless
|
|
1162
|
-
* of whether the order number + e-mail match, so order numbers can't be
|
|
1163
|
-
* enumerated. No login, only API key.
|
|
1164
|
-
*/
|
|
1165
|
-
requestAccessCode(orderNumber: string, email: string): Promise<SdkResult<OrderAccessRequestResponse>>;
|
|
1166
|
-
/**
|
|
1167
|
-
* Step 2 of guest order-access: verify the e-mailed code. On success returns
|
|
1168
|
-
* the FULL order detail plus a short-lived `accessToken` you can pass to
|
|
1169
|
-
* {@link getByAccessToken} to re-fetch the detail without re-entering the
|
|
1170
|
-
* code. No login, only API key.
|
|
1171
|
-
*/
|
|
1172
|
-
verifyAccessCode(orderNumber: string, email: string, code: string): Promise<SdkResult<OrderAccessVerifyResponse>>;
|
|
1173
|
-
/**
|
|
1174
|
-
* Re-fetch a guest order's full detail using the `accessToken` returned by
|
|
1175
|
-
* {@link verifyAccessCode}. The token is scoped to that single order and
|
|
1176
|
-
* expires after 30 minutes.
|
|
1177
|
-
*/
|
|
1178
|
-
getByAccessToken(accessToken: string): Promise<SdkResult<OrderDetail>>;
|
|
1179
|
-
}
|
|
1180
|
-
declare class CustomerModule {
|
|
1181
|
-
private client;
|
|
1182
|
-
constructor(client: BehioStorefront);
|
|
1183
|
-
/** Get customer profile */
|
|
1184
|
-
getProfile(): Promise<SdkResult<CustomerProfile>>;
|
|
1185
|
-
/** Update customer profile */
|
|
1186
|
-
updateProfile(data: Partial<Pick<CustomerProfile, "firstName" | "lastName" | "phone">>): Promise<SdkResult<CustomerProfile>>;
|
|
1187
|
-
/** Change password */
|
|
1188
|
-
changePassword(currentPassword: string, newPassword: string): Promise<SdkResult<MessageResponse>>;
|
|
1189
|
-
/** List addresses */
|
|
1190
|
-
getAddresses(): Promise<SdkResult<{
|
|
1191
|
-
items: CustomerAddress[];
|
|
1192
|
-
}>>;
|
|
1193
|
-
/** Create address */
|
|
1194
|
-
createAddress(address: Omit<CustomerAddress, "id">): Promise<SdkResult<CustomerAddress>>;
|
|
1195
|
-
/** Update address */
|
|
1196
|
-
updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<SdkResult<CustomerAddress>>;
|
|
1197
|
-
/** Delete address */
|
|
1198
|
-
deleteAddress(addressId: string): Promise<SdkResult<void>>;
|
|
1199
|
-
}
|
|
1200
|
-
declare class PagesModule {
|
|
1201
|
-
private client;
|
|
1202
|
-
constructor(client: BehioStorefront);
|
|
1203
|
-
/** List CMS pages */
|
|
1204
|
-
list(locale?: string): Promise<SdkResult<{
|
|
1205
|
-
pages: Page[];
|
|
1206
|
-
}>>;
|
|
1207
|
-
/** Get page by slug */
|
|
1208
|
-
get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
|
|
1209
|
-
}
|
|
1210
|
-
declare class WishlistModule {
|
|
1211
|
-
private client;
|
|
1212
|
-
constructor(client: BehioStorefront);
|
|
1213
|
-
get(): Promise<SdkResult<{
|
|
1214
|
-
items: WishlistItem[];
|
|
1215
|
-
}>>;
|
|
1216
|
-
add(productId: string): Promise<SdkResult<{
|
|
1217
|
-
success: boolean;
|
|
1218
|
-
}>>;
|
|
1219
|
-
remove(productId: string): Promise<SdkResult<{
|
|
1220
|
-
success: boolean;
|
|
1221
|
-
}>>;
|
|
1222
|
-
isInWishlist(productId: string): Promise<SdkResult<{
|
|
1223
|
-
inWishlist: boolean;
|
|
1224
|
-
}>>;
|
|
1225
|
-
}
|
|
1226
|
-
declare class ReviewsModule {
|
|
1227
|
-
private client;
|
|
1228
|
-
constructor(client: BehioStorefront);
|
|
1229
|
-
getProductReviews(productId: string, page?: number, limit?: number): Promise<SdkResult<ProductReviewsResponse>>;
|
|
1230
|
-
submit(input: SubmitReviewInput): Promise<SdkResult<{
|
|
1231
|
-
id: string;
|
|
1232
|
-
}>>;
|
|
1233
|
-
voteHelpful(reviewId: string, helpful: boolean): Promise<SdkResult<{
|
|
1234
|
-
success: boolean;
|
|
1235
|
-
}>>;
|
|
1236
|
-
}
|
|
1237
|
-
declare class ReturnsModule {
|
|
1238
|
-
private client;
|
|
1239
|
-
constructor(client: BehioStorefront);
|
|
1240
|
-
/**
|
|
1241
|
-
* Guest order lookup for the EU withdrawal form: order number + the email
|
|
1242
|
-
* used on the order resolve to the order id and per-item returnable
|
|
1243
|
-
* quantities. POST so the email never appears in a URL.
|
|
1244
|
-
*/
|
|
1245
|
-
lookupOrder(orderNumber: string, email: string): Promise<SdkResult<ReturnableOrder>>;
|
|
1246
|
-
submit(input: SubmitReturnInput): Promise<SdkResult<ReturnRequest>>;
|
|
1247
|
-
/** Email is the ownership gate; POST so it never lands in a URL / log. */
|
|
1248
|
-
getStatus(returnId: string, email: string): Promise<SdkResult<ReturnStatus>>;
|
|
1249
|
-
}
|
|
1250
|
-
declare class ConsentModule {
|
|
1251
|
-
private client;
|
|
1252
|
-
constructor(client: BehioStorefront);
|
|
1253
|
-
record(input: CookieConsentInput): Promise<SdkResult<CookieConsent>>;
|
|
1254
|
-
get(visitorId: string): Promise<SdkResult<CookieConsent | null>>;
|
|
1255
|
-
revoke(visitorId: string): Promise<SdkResult<{
|
|
1256
|
-
success: boolean;
|
|
1257
|
-
}>>;
|
|
1258
|
-
}
|
|
1259
|
-
declare class QuotesModule {
|
|
1260
|
-
private client;
|
|
1261
|
-
constructor(client: BehioStorefront);
|
|
1262
|
-
submit(input: SubmitQuoteInput): Promise<SdkResult<QuoteRequest>>;
|
|
1263
|
-
accept(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
|
|
1264
|
-
/** Email is the ownership gate — quotes carry contact PII and negotiated
|
|
1265
|
-
* prices, so the id alone is never enough. POST keeps it out of URLs. */
|
|
1266
|
-
getStatus(quoteId: string, email: string): Promise<SdkResult<QuoteRequest>>;
|
|
1267
|
-
}
|
|
1268
|
-
interface AddressSuggestion {
|
|
1269
|
-
placeId: string;
|
|
1270
|
-
description: string;
|
|
1271
|
-
street: string;
|
|
1272
|
-
city: string;
|
|
1273
|
-
zip: string;
|
|
1274
|
-
country: string;
|
|
1275
|
-
countryCode: string;
|
|
1276
|
-
}
|
|
1277
|
-
interface AddressDetail {
|
|
1278
|
-
street: string;
|
|
1279
|
-
streetNumber: string;
|
|
1280
|
-
city: string;
|
|
1281
|
-
zip: string;
|
|
1282
|
-
country: string;
|
|
1283
|
-
countryCode: string;
|
|
1284
|
-
formattedAddress: string;
|
|
1285
|
-
lat: number;
|
|
1286
|
-
lng: number;
|
|
1287
|
-
}
|
|
1288
|
-
declare class AddressModule {
|
|
1289
|
-
private client;
|
|
1290
|
-
constructor(client: BehioStorefront);
|
|
1291
|
-
/** Search for address suggestions (debounce on your side, or use the React hook) */
|
|
1292
|
-
autocomplete(query: string, country: string): Promise<SdkResult<{
|
|
1293
|
-
suggestions: AddressSuggestion[];
|
|
1294
|
-
}>>;
|
|
1295
|
-
/** Get full structured address from a suggestion's placeId */
|
|
1296
|
-
getDetail(placeId: string): Promise<SdkResult<AddressDetail>>;
|
|
1297
|
-
}
|
|
1298
3
|
/**
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
*
|
|
4
|
+
* Format a price amount with currency using Intl.NumberFormat.
|
|
5
|
+
*
|
|
6
|
+
* @param amount - The price amount (e.g. 1499, 24.99)
|
|
7
|
+
* @param currency - ISO 4217 currency code (e.g. "CZK", "EUR", "USD")
|
|
8
|
+
* @param locale - BCP 47 locale string (e.g. "cs", "en", "de"). Defaults to "cs".
|
|
9
|
+
* @returns Formatted price string (e.g. "1 499 Kč", "24,99 €")
|
|
1304
10
|
*/
|
|
1305
|
-
declare
|
|
1306
|
-
private client;
|
|
1307
|
-
constructor(client: BehioStorefront);
|
|
1308
|
-
/**
|
|
1309
|
-
* Return the configured shipping methods that pass the current
|
|
1310
|
-
* currency + country filter. Fixed-price methods come back with
|
|
1311
|
-
* their `pricing[]` row resolved; live-quote methods come back with
|
|
1312
|
-
* `price` 0 here — call `quote()` to get the real live price.
|
|
1313
|
-
*/
|
|
1314
|
-
listMethods(opts?: {
|
|
1315
|
-
currency?: string;
|
|
1316
|
-
country?: string;
|
|
1317
|
-
cartTotal?: number;
|
|
1318
|
-
cartWeightKg?: number;
|
|
1319
|
-
}): Promise<SdkResult<{
|
|
1320
|
-
items: ShippingMethodSummary[];
|
|
1321
|
-
}>>;
|
|
1322
|
-
/**
|
|
1323
|
-
* Quote shipping for a destination address + cart contents. Each
|
|
1324
|
-
* configured method is evaluated:
|
|
1325
|
-
* - `priceStrategy="fixed"` → resolved from the merchant's per-currency
|
|
1326
|
-
* `pricing[]` rows + free-shipping threshold check.
|
|
1327
|
-
* - `priceStrategy="live_quote"` → dispatched to the upstream
|
|
1328
|
-
* meta-provider (Zaslat, future Shippo / Sendcloud / …) and run
|
|
1329
|
-
* through the merchant's markup/rounding rules.
|
|
1330
|
-
*
|
|
1331
|
-
* Filter `available: true` for the checkout picker; `available: false`
|
|
1332
|
-
* rows carry a `reason` (`"no_rate_returned"`, `"live_quote_not_implemented"`,
|
|
1333
|
-
* …) you can log but should not display.
|
|
1334
|
-
*/
|
|
1335
|
-
quote(input: ShippingQuoteInput): Promise<SdkResult<{
|
|
1336
|
-
items: ShippingQuote[];
|
|
1337
|
-
}>>;
|
|
1338
|
-
}
|
|
11
|
+
declare function formatPrice(amount: number, currency: string, locale?: string): string;
|
|
1339
12
|
|
|
1340
|
-
export {
|
|
13
|
+
export { formatPrice };
|