@behio/storefront-sdk 1.9.0 → 1.18.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/README.md +11 -9
- package/dist/{chunk-CY6D2YEI.js → chunk-GAYYRRUL.js} +178 -27
- package/dist/{chunk-XMKY4RI5.mjs → chunk-W2P2D3EZ.mjs} +154 -3
- package/dist/{client-C635vSzU.d.mts → client-B29GktSJ.d.mts} +421 -7
- package/dist/{client-C635vSzU.d.ts → client-B29GktSJ.d.ts} +421 -7
- package/dist/index.d.mts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +743 -2
- package/dist/index.mjs +742 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +456 -13
- package/dist/react.d.ts +456 -13
- package/dist/react.js +339 -54
- package/dist/react.mjs +326 -46
- package/package.json +2 -2
|
@@ -100,6 +100,13 @@ interface CheckoutSettings {
|
|
|
100
100
|
requireGdprConsent: boolean;
|
|
101
101
|
/** Default state of the newsletter opt-in on the checkout (or hide it). */
|
|
102
102
|
newsletterOptInDefault: NewsletterOptInDefault;
|
|
103
|
+
/**
|
|
104
|
+
* Merchant collects consent for marketing SMS in the checkout. When true,
|
|
105
|
+
* render an OPTIONAL, unchecked checkbox in the contact step and send the
|
|
106
|
+
* answer as `smsConsent` in `checkout.createOrder`. Never make it required:
|
|
107
|
+
* order updates are transactional and need no consent, marketing does.
|
|
108
|
+
*/
|
|
109
|
+
collectSmsConsent: boolean;
|
|
103
110
|
/** Minimum order value in the shop default currency, or null when unset. */
|
|
104
111
|
minOrderValue: number | null;
|
|
105
112
|
/** Maximum order value in the shop default currency, or null when unset. */
|
|
@@ -173,6 +180,21 @@ interface ShopInfo {
|
|
|
173
180
|
* than hardcoded template config.
|
|
174
181
|
*/
|
|
175
182
|
quotesEnabled: boolean;
|
|
183
|
+
/**
|
|
184
|
+
* Countries the shop delivers to, derived from the ENABLED shipping methods
|
|
185
|
+
* (union of their allowed countries). `null` = no restriction (some enabled
|
|
186
|
+
* method ships anywhere), `[]` = no enabled shipping method. Limit the
|
|
187
|
+
* checkout country select to this list so a shopper from an unserved
|
|
188
|
+
* country learns it up front, not at the shipping step. Optional because
|
|
189
|
+
* cached ShopInfo payloads predating SDK 1.15.0 may still be served.
|
|
190
|
+
*/
|
|
191
|
+
shippingCountries?: string[] | null;
|
|
192
|
+
/**
|
|
193
|
+
* Default currency per delivery country, e.g. `{SK: "EUR"}`. When the
|
|
194
|
+
* shopper picks such a country, switch the cart with `cart.setCurrency()`
|
|
195
|
+
* (and the display currency) unless they chose one themselves. SDK 1.17.0.
|
|
196
|
+
*/
|
|
197
|
+
currencyByCountry?: Record<string, string>;
|
|
176
198
|
/** Full merchant checkout & cart contract. Honour these in cart + checkout. */
|
|
177
199
|
checkout: CheckoutSettings;
|
|
178
200
|
/**
|
|
@@ -269,6 +291,45 @@ interface CheckoutPaymentMethod {
|
|
|
269
291
|
feeCurrency?: string | null;
|
|
270
292
|
/** Customer-safe slice of config: bank account, IBAN, instructions, … */
|
|
271
293
|
publicConfig?: Record<string, unknown>;
|
|
294
|
+
/**
|
|
295
|
+
* Concrete payment instruments the provider offers for this method
|
|
296
|
+
* (card, Google Pay, Apple Pay, bank transfer with a bank grid, ...).
|
|
297
|
+
* Gateways such as GoPay require the customer to choose the instrument
|
|
298
|
+
* ALREADY IN THE CHECKOUT, so render them as tiles under the selected method
|
|
299
|
+
* and send the chosen `code` as `paymentInstrument` in `createOrder` (plus
|
|
300
|
+
* `paymentSwift` for `BANK_ACCOUNT`). `null` = the provider has no
|
|
301
|
+
* instruments (cash on delivery, plain bank transfer, Stripe hosted page);
|
|
302
|
+
* render nothing extra and send nothing extra. SDK 1.14.0.
|
|
303
|
+
*/
|
|
304
|
+
instruments?: PaymentInstrument[] | null;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* One payment instrument of a gateway method (SDK 1.14.0). The first item is
|
|
308
|
+
* the sensible default (card for GoPay). `swifts` is non-empty only for
|
|
309
|
+
* `BANK_ACCOUNT`, where the customer additionally picks a bank.
|
|
310
|
+
*/
|
|
311
|
+
interface PaymentInstrument {
|
|
312
|
+
/** Provider code: "PAYMENT_CARD" | "BANK_ACCOUNT" | "GPAY" | "APPLE_PAY" | "PAYPAL" | ... */
|
|
313
|
+
code: string;
|
|
314
|
+
/** Localized label (requested `locale`), e.g. "Platební karta". */
|
|
315
|
+
label: string;
|
|
316
|
+
/** Small logo URL or null. */
|
|
317
|
+
image: string | null;
|
|
318
|
+
/** Larger logo URL or null. */
|
|
319
|
+
imageLarge: string | null;
|
|
320
|
+
/** Banks for `BANK_ACCOUNT`; empty for every other instrument. */
|
|
321
|
+
swifts: PaymentSwift[];
|
|
322
|
+
}
|
|
323
|
+
/** One bank of a `BANK_ACCOUNT` instrument (SDK 1.14.0). */
|
|
324
|
+
interface PaymentSwift {
|
|
325
|
+
/** SWIFT/BIC, e.g. "FIOBCZPP". Send it as `paymentSwift`. */
|
|
326
|
+
code: string;
|
|
327
|
+
/** Localized bank name. */
|
|
328
|
+
label: string;
|
|
329
|
+
/** Bank logo URL or null. */
|
|
330
|
+
image: string | null;
|
|
331
|
+
/** Instant online bank payment; show these first. */
|
|
332
|
+
online: boolean;
|
|
272
333
|
}
|
|
273
334
|
interface ProductPrice {
|
|
274
335
|
amount: number;
|
|
@@ -996,6 +1057,12 @@ type AddressType = (typeof AddressTypes)[keyof typeof AddressTypes];
|
|
|
996
1057
|
interface ProductsQuery {
|
|
997
1058
|
page?: number;
|
|
998
1059
|
limit?: number;
|
|
1060
|
+
/**
|
|
1061
|
+
* Delivery country (ISO-2). Lets country-scoped price rules (for example a
|
|
1062
|
+
* surcharge for SK) apply in the listing; the cart and checkout use the
|
|
1063
|
+
* cart destination instead.
|
|
1064
|
+
*/
|
|
1065
|
+
country?: string;
|
|
999
1066
|
/** Single category slug (OR logic with categories array) */
|
|
1000
1067
|
category?: string;
|
|
1001
1068
|
/** Multiple category slugs (OR logic — product in ANY of these categories) */
|
|
@@ -1148,20 +1215,48 @@ interface Cart {
|
|
|
1148
1215
|
id: string;
|
|
1149
1216
|
sessionToken?: string;
|
|
1150
1217
|
items: CartItem[];
|
|
1218
|
+
/** Sum of the lines at catalog prices: VAT included when the shop runs
|
|
1219
|
+
* `INCL_VAT`, VAT excluded when it runs `EXCL_VAT`. Not the payable amount,
|
|
1220
|
+
* that is `grandTotal`. */
|
|
1151
1221
|
subtotal: number;
|
|
1222
|
+
/** Discount from the applied code. Always based on `subtotal`, i.e. on the
|
|
1223
|
+
* prices the customer sees, so "10 % off 200" is 20 in both price modes. */
|
|
1152
1224
|
discountTotal: number;
|
|
1153
1225
|
discount?: CartDiscount;
|
|
1154
1226
|
/** Auto-apply promotion discount lines (sale/BOGO). */
|
|
1155
1227
|
appliedPromotions: CartPromotion[];
|
|
1156
1228
|
/** Sum of `appliedPromotions[].discountAmount`; already reflected in `grandTotal`. */
|
|
1157
1229
|
promotionDiscountTotal: number;
|
|
1230
|
+
/** THE PAYABLE AMOUNT for the goods, VAT included, after discounts. This is
|
|
1231
|
+
* exactly what the customer pays for the cart lines, minus shipping and the
|
|
1232
|
+
* payment-method fee (both chosen at checkout and added to
|
|
1233
|
+
* `order.grandTotal`).
|
|
1234
|
+
*
|
|
1235
|
+
* `grandTotal = netSubtotal + taxTotal - discounts` holds in BOTH price
|
|
1236
|
+
* modes: under `INCL_VAT` the VAT is extracted out of the price (the sum is
|
|
1237
|
+
* back to the catalog price), under `EXCL_VAT` it is added on top. Render
|
|
1238
|
+
* this as the cart total; do not add `taxTotal` to it. */
|
|
1158
1239
|
grandTotal: number;
|
|
1159
|
-
/**
|
|
1160
|
-
*
|
|
1240
|
+
/** VAT contained in the prices (`INCL_VAT`) or added on top of them
|
|
1241
|
+
* (`EXCL_VAT`), across all lines (GAP-30). An estimate finalized at checkout
|
|
1242
|
+
* once the shipping country is known. */
|
|
1161
1243
|
taxTotal: number;
|
|
1162
1244
|
/** VAT split by rate for "DPH 21 %: X Kč" summary rows. Empty for a
|
|
1163
1245
|
* non-VAT-payer shop. */
|
|
1164
1246
|
taxBreakdown: TaxBreakdownLine[];
|
|
1247
|
+
/** Delivery country set via `cart.setDestination()`, null until known. SDK 1.17.0. */
|
|
1248
|
+
shippingCountry: string | null;
|
|
1249
|
+
/**
|
|
1250
|
+
* Which VAT rule the cart uses: `DOMESTIC` (home rate), `OSS` (delivery
|
|
1251
|
+
* country rate), `REVERSE_CHARGE` (EU business with a valid VAT ID, 0 %),
|
|
1252
|
+
* `EXPORT` (outside the EU, 0 %). Show a note for the last two: the
|
|
1253
|
+
* breakdown is empty then. SDK 1.17.0.
|
|
1254
|
+
*/
|
|
1255
|
+
vatMode: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT";
|
|
1256
|
+
/** B2B VAT ID set via `cart.setDestination()`. */
|
|
1257
|
+
vatId: string | null;
|
|
1258
|
+
/** VIES result for `vatId`: true valid, false invalid or unverifiable, null not given. */
|
|
1259
|
+
vatIdValid: boolean | null;
|
|
1165
1260
|
currency: string;
|
|
1166
1261
|
itemCount: number;
|
|
1167
1262
|
/** Applied gift cards (multi). They deduct at checkout (consumed in order, each
|
|
@@ -1219,6 +1314,8 @@ interface CheckoutAddress {
|
|
|
1219
1314
|
street: string;
|
|
1220
1315
|
city: string;
|
|
1221
1316
|
zip: string;
|
|
1317
|
+
/** State / province where the country needs it (US, CA, AU, BR, IN, MX). SDK 1.17.0. */
|
|
1318
|
+
state?: string;
|
|
1222
1319
|
country: string;
|
|
1223
1320
|
phone?: string;
|
|
1224
1321
|
}
|
|
@@ -1243,6 +1340,14 @@ interface CheckoutInput {
|
|
|
1243
1340
|
termsConsent?: boolean;
|
|
1244
1341
|
gdprConsent?: boolean;
|
|
1245
1342
|
newsletterOptIn?: boolean;
|
|
1343
|
+
/**
|
|
1344
|
+
* Consent to marketing SMS, from the optional checkout checkbox. Render it
|
|
1345
|
+
* only when `ShopInfo.checkout.collectSmsConsent` is true; shops that do not
|
|
1346
|
+
* collect consent ignore the flag. The consent is stored against the phone
|
|
1347
|
+
* number on the created order, so it needs a usable phone in the order or
|
|
1348
|
+
* the shipping address, and it never blocks or fails the order.
|
|
1349
|
+
*/
|
|
1350
|
+
smsConsent?: boolean;
|
|
1246
1351
|
/**
|
|
1247
1352
|
* Chosen shipping method. Required whenever the eshop has at least one
|
|
1248
1353
|
* enabled shipping method — the backend rejects the order without it.
|
|
@@ -1262,7 +1367,33 @@ interface CheckoutInput {
|
|
|
1262
1367
|
* the backend rejects the order without it. Snapshotted onto the order.
|
|
1263
1368
|
*/
|
|
1264
1369
|
pickupPointId?: string;
|
|
1370
|
+
/**
|
|
1371
|
+
* Snapshot of the chosen point when it came from a carrier widget and may
|
|
1372
|
+
* not be in Behio's cache yet (Packeta serves partner points too). Sent
|
|
1373
|
+
* along with `pickupPointId`; ignored when the cache knows the point.
|
|
1374
|
+
* SDK 1.16.0.
|
|
1375
|
+
*/
|
|
1376
|
+
pickupPoint?: {
|
|
1377
|
+
name: string;
|
|
1378
|
+
street?: string;
|
|
1379
|
+
city?: string;
|
|
1380
|
+
zip?: string;
|
|
1381
|
+
country?: string;
|
|
1382
|
+
};
|
|
1265
1383
|
paymentMethodId?: string;
|
|
1384
|
+
/**
|
|
1385
|
+
* Chosen instrument `code` of the payment method (SDK 1.14.0), e.g.
|
|
1386
|
+
* "PAYMENT_CARD" | "GPAY" | "APPLE_PAY" | "BANK_ACCOUNT". Send it whenever the
|
|
1387
|
+
* chosen method lists `instruments`; the gateway is then opened directly on
|
|
1388
|
+
* that instrument. An instrument the method does not offer returns 400
|
|
1389
|
+
* (`be.storefront.paymentInstrumentInvalid`).
|
|
1390
|
+
*/
|
|
1391
|
+
paymentInstrument?: string;
|
|
1392
|
+
/**
|
|
1393
|
+
* Chosen bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0),
|
|
1394
|
+
* from `PaymentInstrument.swifts[].code`. Ignored for other instruments.
|
|
1395
|
+
*/
|
|
1396
|
+
paymentSwift?: string;
|
|
1266
1397
|
/**
|
|
1267
1398
|
* Loyalty points to redeem on this order. Validated server-side against the
|
|
1268
1399
|
* customer's actual balance and the program's redemption cap; ignored for
|
|
@@ -1330,6 +1461,8 @@ interface OrderDetail extends OrderListItem {
|
|
|
1330
1461
|
/** VAT split by rate (GAP-30), summed from the order lines. Render
|
|
1331
1462
|
* "DPH 21 %: X Kč" rows. Empty for a non-VAT order. */
|
|
1332
1463
|
taxBreakdown: TaxBreakdownLine[];
|
|
1464
|
+
/** DOMESTIC, OSS, REVERSE_CHARGE (no VAT, buyer accounts for it) or EXPORT (no VAT, outside EU). SDK 1.17.0. */
|
|
1465
|
+
vatMode?: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT" | null;
|
|
1333
1466
|
shippingTotal: number;
|
|
1334
1467
|
discountTotal: number;
|
|
1335
1468
|
fulfillmentStatus: FulfillmentStatus;
|
|
@@ -1673,6 +1806,19 @@ interface CustomerAddress {
|
|
|
1673
1806
|
city: string;
|
|
1674
1807
|
zip: string;
|
|
1675
1808
|
country: string;
|
|
1809
|
+
/** State / region for countries that need it (US, CA, AU). */
|
|
1810
|
+
state?: string | null;
|
|
1811
|
+
/** Company registration number. */
|
|
1812
|
+
companyId?: string | null;
|
|
1813
|
+
/** VAT ID. EU numbers are verified in VIES when the address is saved. */
|
|
1814
|
+
vatId?: string | null;
|
|
1815
|
+
/**
|
|
1816
|
+
* VIES result at save time: true = valid, false = not confirmed, null = no
|
|
1817
|
+
* VAT ID or not an EU number. Read-only, the server sets it.
|
|
1818
|
+
*/
|
|
1819
|
+
vatIdValid?: boolean | null;
|
|
1820
|
+
/** When the VAT ID was last checked (ms). Read-only. */
|
|
1821
|
+
vatIdCheckedAt?: number | null;
|
|
1676
1822
|
phone?: string;
|
|
1677
1823
|
}
|
|
1678
1824
|
interface Page {
|
|
@@ -1701,6 +1847,159 @@ interface PageAttachment {
|
|
|
1701
1847
|
mimeType: string;
|
|
1702
1848
|
fileSize: number;
|
|
1703
1849
|
}
|
|
1850
|
+
interface BlogSettings {
|
|
1851
|
+
postsPerPage?: number;
|
|
1852
|
+
showAuthor?: boolean;
|
|
1853
|
+
showReadingTime?: boolean;
|
|
1854
|
+
showTags?: boolean;
|
|
1855
|
+
layout?: "grid" | "list" | "magazine";
|
|
1856
|
+
}
|
|
1857
|
+
/** One blog (a group of posts). A site can have several: news, recipes, stories. */
|
|
1858
|
+
interface Blog {
|
|
1859
|
+
/** URL segment: /blog/{handle} */
|
|
1860
|
+
handle: string;
|
|
1861
|
+
name: string;
|
|
1862
|
+
description: string | null;
|
|
1863
|
+
postCount: number;
|
|
1864
|
+
settings: BlogSettings;
|
|
1865
|
+
/** Latest publish time (epoch ms), for sitemaps. */
|
|
1866
|
+
updatedAt: number | null;
|
|
1867
|
+
}
|
|
1868
|
+
interface BlogTag {
|
|
1869
|
+
slug: string;
|
|
1870
|
+
name: string;
|
|
1871
|
+
}
|
|
1872
|
+
interface BlogPostListItem {
|
|
1873
|
+
slug: string;
|
|
1874
|
+
title: string;
|
|
1875
|
+
excerpt: string | null;
|
|
1876
|
+
coverUrl: string | null;
|
|
1877
|
+
publishedAt: number | null;
|
|
1878
|
+
readingTimeMin: number | null;
|
|
1879
|
+
authorName: string | null;
|
|
1880
|
+
isFeatured: boolean;
|
|
1881
|
+
tags: BlogTag[];
|
|
1882
|
+
}
|
|
1883
|
+
interface BlogPostsPage {
|
|
1884
|
+
items: BlogPostListItem[];
|
|
1885
|
+
total: number;
|
|
1886
|
+
page: number;
|
|
1887
|
+
limit: number;
|
|
1888
|
+
totalPages: number;
|
|
1889
|
+
/** Tags of the blog (for a filter). */
|
|
1890
|
+
tags: BlogTag[];
|
|
1891
|
+
}
|
|
1892
|
+
interface BlogPostDetail {
|
|
1893
|
+
slug: string;
|
|
1894
|
+
blogHandle: string;
|
|
1895
|
+
blogName: string;
|
|
1896
|
+
title: string;
|
|
1897
|
+
excerpt: string | null;
|
|
1898
|
+
/** `{format: "html", html}` sanitised by the API; render with RichText. */
|
|
1899
|
+
content: {
|
|
1900
|
+
format?: string;
|
|
1901
|
+
html?: string;
|
|
1902
|
+
} & Record<string, unknown>;
|
|
1903
|
+
coverUrl: string | null;
|
|
1904
|
+
publishedAt: number | null;
|
|
1905
|
+
updatedAt: number | null;
|
|
1906
|
+
readingTimeMin: number | null;
|
|
1907
|
+
authorName: string | null;
|
|
1908
|
+
tags: BlogTag[];
|
|
1909
|
+
seoTitle: string | null;
|
|
1910
|
+
seoDescription: string | null;
|
|
1911
|
+
ogImage: string | null;
|
|
1912
|
+
/** Other posts of the same blog. */
|
|
1913
|
+
related: BlogPostListItem[];
|
|
1914
|
+
}
|
|
1915
|
+
interface BlogPostsQuery {
|
|
1916
|
+
locale?: string;
|
|
1917
|
+
page?: number;
|
|
1918
|
+
limit?: number;
|
|
1919
|
+
/** Filter by tag slug. */
|
|
1920
|
+
tag?: string;
|
|
1921
|
+
}
|
|
1922
|
+
type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "select" | "radio" | "checkbox" | "multiselect" | "date"
|
|
1923
|
+
/** "HH:MM" */
|
|
1924
|
+
| "time"
|
|
1925
|
+
/** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
|
|
1926
|
+
| "datetime"
|
|
1927
|
+
/** http(s) address */
|
|
1928
|
+
| "url" | "hidden";
|
|
1929
|
+
interface SiteFormFieldOption {
|
|
1930
|
+
value: string;
|
|
1931
|
+
label: string;
|
|
1932
|
+
}
|
|
1933
|
+
/** One field of a merchant-defined form; render it by `type`. */
|
|
1934
|
+
interface SiteFormField {
|
|
1935
|
+
/** Key in the submitted `data` object (lowercase, underscores). */
|
|
1936
|
+
key: string;
|
|
1937
|
+
type: SiteFormFieldType;
|
|
1938
|
+
label: string;
|
|
1939
|
+
placeholder?: string;
|
|
1940
|
+
/** Help line under the field. */
|
|
1941
|
+
help?: string;
|
|
1942
|
+
required: boolean;
|
|
1943
|
+
/** Present for select / radio / multiselect. */
|
|
1944
|
+
options?: SiteFormFieldOption[];
|
|
1945
|
+
/** Number: min/max value. Text: min/max length. */
|
|
1946
|
+
min?: number;
|
|
1947
|
+
max?: number;
|
|
1948
|
+
/** Regular expression for text fields (without slashes). */
|
|
1949
|
+
pattern?: string;
|
|
1950
|
+
/** Layout hint: "half" fields sit side by side on wide screens. */
|
|
1951
|
+
width?: "full" | "half";
|
|
1952
|
+
/** Value of hidden fields (source, campaign) or a prefill for visible ones. */
|
|
1953
|
+
defaultValue?: string;
|
|
1954
|
+
}
|
|
1955
|
+
interface StorefrontFormSettings {
|
|
1956
|
+
submitLabel?: string;
|
|
1957
|
+
/** Shown after a successful submit (also returned as `message`). */
|
|
1958
|
+
successMessage?: string;
|
|
1959
|
+
/** When set, redirect the visitor here after a successful submit. */
|
|
1960
|
+
redirectUrl?: string;
|
|
1961
|
+
/** Text of the consent checkbox. */
|
|
1962
|
+
consentText?: string;
|
|
1963
|
+
/** When true, `consent: true` is required for the submit to pass. */
|
|
1964
|
+
requireConsent?: boolean;
|
|
1965
|
+
}
|
|
1966
|
+
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
1967
|
+
interface StorefrontForm {
|
|
1968
|
+
slug: string;
|
|
1969
|
+
name: string;
|
|
1970
|
+
description: string | null;
|
|
1971
|
+
fields: SiteFormField[];
|
|
1972
|
+
settings: StorefrontFormSettings;
|
|
1973
|
+
}
|
|
1974
|
+
interface StorefrontFormSubmitInput {
|
|
1975
|
+
/** `{fieldKey: value}`; unknown keys are dropped server-side. */
|
|
1976
|
+
data: Record<string, unknown>;
|
|
1977
|
+
locale?: string;
|
|
1978
|
+
/** URL of the page the form was submitted from (context for the merchant). */
|
|
1979
|
+
page?: string;
|
|
1980
|
+
/** Consent checkbox state (required when `settings.requireConsent`). */
|
|
1981
|
+
consent?: boolean;
|
|
1982
|
+
/**
|
|
1983
|
+
* Honeypot. Render it as a visually hidden input and pass its value through
|
|
1984
|
+
* untouched: a filled value is answered like a success but stored nowhere.
|
|
1985
|
+
*/
|
|
1986
|
+
website?: string;
|
|
1987
|
+
}
|
|
1988
|
+
interface StorefrontFormSubmitResult {
|
|
1989
|
+
ok: boolean;
|
|
1990
|
+
/** Id of the stored submission (null when the form does not store responses). */
|
|
1991
|
+
id: string | null;
|
|
1992
|
+
/** `settings.successMessage`, when set. */
|
|
1993
|
+
message: string | null;
|
|
1994
|
+
/** `settings.redirectUrl`, when set. */
|
|
1995
|
+
redirectUrl: string | null;
|
|
1996
|
+
}
|
|
1997
|
+
type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
|
|
1998
|
+
/** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
|
|
1999
|
+
interface StorefrontFormFieldError {
|
|
2000
|
+
key: string;
|
|
2001
|
+
code: StorefrontFormFieldErrorCode;
|
|
2002
|
+
}
|
|
1704
2003
|
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";
|
|
1705
2004
|
declare class BehioApiError extends Error {
|
|
1706
2005
|
readonly code: BehioErrorCode;
|
|
@@ -1905,6 +2204,27 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
1905
2204
|
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
1906
2205
|
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
1907
2206
|
*/
|
|
2207
|
+
/**
|
|
2208
|
+
* Carrier map widget for choosing a pickup point in checkout. Present in
|
|
2209
|
+
* `ShippingMethod.publicConfig.pickupWidget` when the merchant's carrier
|
|
2210
|
+
* supports it (today Packeta: load https://widget.packeta.com/v6/www/js/library.js
|
|
2211
|
+
* and call `Packeta.Widget.pick(apiKey, cb, {country, language})`; send
|
|
2212
|
+
* `String(point.id)` back as `checkout.pickupPointId`). SDK 1.15.0.
|
|
2213
|
+
* `provider: "behio"` (SDK 1.16.0) means "draw the map yourself from
|
|
2214
|
+
* `getPickupPoints()` coordinates".
|
|
2215
|
+
*/
|
|
2216
|
+
type PickupWidgetConfig = {
|
|
2217
|
+
provider: "packeta";
|
|
2218
|
+
/** Public widget key (never the API password). */
|
|
2219
|
+
apiKey: string;
|
|
2220
|
+
} | {
|
|
2221
|
+
/**
|
|
2222
|
+
* No carrier widget, but every point from `getPickupPoints()` carries
|
|
2223
|
+
* `latitude`/`longitude`: render your own map (SDK 1.16.0; PPL, GLS,
|
|
2224
|
+
* Aramex, Zaslat).
|
|
2225
|
+
*/
|
|
2226
|
+
provider: "behio";
|
|
2227
|
+
};
|
|
1908
2228
|
interface PickupPoint {
|
|
1909
2229
|
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
1910
2230
|
externalId: string;
|
|
@@ -2072,6 +2392,10 @@ interface GiftCardPurchaseInput {
|
|
|
2072
2392
|
personalMessage?: string;
|
|
2073
2393
|
/** Online payment method id (from listPaymentMethods) to start payment right away. */
|
|
2074
2394
|
paymentMethodId?: string;
|
|
2395
|
+
/** Instrument `code` of the chosen method (SDK 1.14.0), see `CheckoutInput.paymentInstrument`. */
|
|
2396
|
+
paymentInstrument?: string;
|
|
2397
|
+
/** Bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0). */
|
|
2398
|
+
paymentSwift?: string;
|
|
2075
2399
|
locale?: string;
|
|
2076
2400
|
}
|
|
2077
2401
|
interface GiftCardPurchaseResult {
|
|
@@ -2356,6 +2680,8 @@ declare class BehioStorefront {
|
|
|
2356
2680
|
readonly orders: OrdersModule;
|
|
2357
2681
|
readonly customer: CustomerModule;
|
|
2358
2682
|
readonly pages: PagesModule;
|
|
2683
|
+
readonly blog: BlogModule;
|
|
2684
|
+
readonly forms: FormsModule;
|
|
2359
2685
|
readonly wishlist: WishlistModule;
|
|
2360
2686
|
readonly reviews: ReviewsModule;
|
|
2361
2687
|
readonly returns: ReturnsModule;
|
|
@@ -2545,6 +2871,7 @@ declare class CatalogModule {
|
|
|
2545
2871
|
getProduct(slug: string, options?: {
|
|
2546
2872
|
locale?: string;
|
|
2547
2873
|
currency?: string;
|
|
2874
|
+
country?: string;
|
|
2548
2875
|
}): Promise<SdkResult<ProductDetail>>;
|
|
2549
2876
|
/**
|
|
2550
2877
|
* URLs for the sitemap, already filtered by the merchant's indexing choice
|
|
@@ -2667,9 +2994,25 @@ declare class CatalogModule {
|
|
|
2667
2994
|
* code is generated and emailed to the recipient once the order is paid.
|
|
2668
2995
|
*/
|
|
2669
2996
|
purchaseGiftCard(input: GiftCardPurchaseInput): Promise<SdkResult<GiftCardPurchaseResult>>;
|
|
2670
|
-
/**
|
|
2997
|
+
/**
|
|
2998
|
+
* List configured payment methods (filtered by currency). `locale` picks the
|
|
2999
|
+
* language of `instruments[].label` / `swifts[].label` (SDK 1.14.0); pass the
|
|
3000
|
+
* locale of the page so the instrument tiles read in the shopper's language.
|
|
3001
|
+
*/
|
|
2671
3002
|
listPaymentMethods(opts?: {
|
|
2672
3003
|
currency?: string;
|
|
3004
|
+
locale?: string;
|
|
3005
|
+
/** Delivery country (ISO): hides methods not valid there, orders them per country. SDK 1.15.0 */
|
|
3006
|
+
country?: string;
|
|
3007
|
+
/** Chosen shipping method: hides cash on delivery when the carrier cannot do it. SDK 1.15.0 */
|
|
3008
|
+
shippingMethodId?: string;
|
|
3009
|
+
}): Promise<SdkResult<{
|
|
3010
|
+
items: CheckoutPaymentMethod[];
|
|
3011
|
+
}>>;
|
|
3012
|
+
/** Alias of `listPaymentMethods` (SDK 1.14.0). */
|
|
3013
|
+
paymentMethods(opts?: {
|
|
3014
|
+
currency?: string;
|
|
3015
|
+
locale?: string;
|
|
2673
3016
|
}): Promise<SdkResult<{
|
|
2674
3017
|
items: CheckoutPaymentMethod[];
|
|
2675
3018
|
}>>;
|
|
@@ -2719,6 +3062,22 @@ declare class CartModule {
|
|
|
2719
3062
|
* ```
|
|
2720
3063
|
*/
|
|
2721
3064
|
setCurrency(currency: string): Promise<SdkResult<Cart>>;
|
|
3065
|
+
/**
|
|
3066
|
+
* Tell the cart where the order will ship (and, for B2B, the buyer's VAT
|
|
3067
|
+
* ID) so the VAT breakdown matches the checkout before the address form:
|
|
3068
|
+
* destination-country rate (OSS), 0 % export outside the EU, or reverse
|
|
3069
|
+
* charge for an EU business with a VIES-valid VAT ID. `cart.vatMode` says
|
|
3070
|
+
* which rule applied. SDK 1.17.0.
|
|
3071
|
+
*
|
|
3072
|
+
* ```ts
|
|
3073
|
+
* await client.cart.setDestination({ country: "SK" });
|
|
3074
|
+
* await client.cart.setDestination({ vatId: "SK2020000001" }); // "" clears
|
|
3075
|
+
* ```
|
|
3076
|
+
*/
|
|
3077
|
+
setDestination(input: {
|
|
3078
|
+
country?: string;
|
|
3079
|
+
vatId?: string | null;
|
|
3080
|
+
}): Promise<SdkResult<Cart>>;
|
|
2722
3081
|
/** Update item quantity */
|
|
2723
3082
|
updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
|
|
2724
3083
|
/** Remove item from cart */
|
|
@@ -2771,6 +3130,27 @@ declare class CheckoutModule {
|
|
|
2771
3130
|
declare class OrdersModule {
|
|
2772
3131
|
private client;
|
|
2773
3132
|
constructor(client: BehioStorefront);
|
|
3133
|
+
/**
|
|
3134
|
+
* Ask the backend to re-check this order's payment with the gateway.
|
|
3135
|
+
*
|
|
3136
|
+
* Call it on the thank-you page the customer lands on after paying, BEFORE
|
|
3137
|
+
* you read the order. Some gateways (Tatrapay+) have no server-to-server
|
|
3138
|
+
* notification at all, so the customer's return is the only fast way the
|
|
3139
|
+
* payment gets confirmed; for the others it is a safety net for a lost
|
|
3140
|
+
* notification.
|
|
3141
|
+
*
|
|
3142
|
+
* The response is deliberately opaque (`{ok: true}` every time, even for an
|
|
3143
|
+
* order number that does not exist): order numbers are sequential, so
|
|
3144
|
+
* anything else would turn this into a probe for other people's orders.
|
|
3145
|
+
* Read the actual state afterwards through a path that proves entitlement
|
|
3146
|
+
* ({@link get}, {@link track} or the guest access-code flow).
|
|
3147
|
+
*
|
|
3148
|
+
* Never throws for a missing order and never blocks the page: treat a
|
|
3149
|
+
* failure as "not confirmed yet", the backend poller catches up on its own.
|
|
3150
|
+
*/
|
|
3151
|
+
syncPaymentOnReturn(orderNumber: string): Promise<SdkResult<{
|
|
3152
|
+
ok: boolean;
|
|
3153
|
+
}>>;
|
|
2774
3154
|
/** List customer orders (requires auth) */
|
|
2775
3155
|
list(options?: {
|
|
2776
3156
|
page?: number;
|
|
@@ -2828,9 +3208,12 @@ declare class CustomerModule {
|
|
|
2828
3208
|
items: CustomerAddress[];
|
|
2829
3209
|
}>>;
|
|
2830
3210
|
/** Create address */
|
|
2831
|
-
createAddress(address: Omit<CustomerAddress, "id">): Promise<SdkResult<CustomerAddress>>;
|
|
2832
|
-
/**
|
|
2833
|
-
|
|
3211
|
+
createAddress(address: Omit<CustomerAddress, "id" | "vatIdValid" | "vatIdCheckedAt">): Promise<SdkResult<CustomerAddress>>;
|
|
3212
|
+
/**
|
|
3213
|
+
* Update address. Partial: `{isDefault: true}` alone is a valid body. A
|
|
3214
|
+
* changed `vatId` or `country` re-runs the VIES check on the server.
|
|
3215
|
+
*/
|
|
3216
|
+
updateAddress(addressId: string, data: Partial<Omit<CustomerAddress, "id" | "vatIdValid" | "vatIdCheckedAt">>): Promise<SdkResult<CustomerAddress>>;
|
|
2834
3217
|
/** Delete address */
|
|
2835
3218
|
deleteAddress(addressId: string): Promise<SdkResult<void>>;
|
|
2836
3219
|
/**
|
|
@@ -2951,6 +3334,37 @@ declare class PagesModule {
|
|
|
2951
3334
|
/** Get page by slug */
|
|
2952
3335
|
get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
|
|
2953
3336
|
}
|
|
3337
|
+
declare class BlogModule {
|
|
3338
|
+
private client;
|
|
3339
|
+
constructor(client: BehioStorefront);
|
|
3340
|
+
/** List the site's blogs (active only). */
|
|
3341
|
+
list(locale?: string): Promise<SdkResult<{
|
|
3342
|
+
blogs: Blog[];
|
|
3343
|
+
}>>;
|
|
3344
|
+
/** Published posts of one blog, newest first (featured first), paginated. */
|
|
3345
|
+
posts(handle: string, query?: BlogPostsQuery): Promise<SdkResult<BlogPostsPage>>;
|
|
3346
|
+
/** One published post with sanitised HTML content and related posts. */
|
|
3347
|
+
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3348
|
+
}
|
|
3349
|
+
/**
|
|
3350
|
+
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3351
|
+
* The definition is public and cacheable; a submit is validated server-side
|
|
3352
|
+
* against it, so the browser-side checks are only a courtesy. Works with
|
|
3353
|
+
* website keys that have no e-shop attached.
|
|
3354
|
+
*/
|
|
3355
|
+
declare class FormsModule {
|
|
3356
|
+
private client;
|
|
3357
|
+
constructor(client: BehioStorefront);
|
|
3358
|
+
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
3359
|
+
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
3360
|
+
/**
|
|
3361
|
+
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
3362
|
+
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
3363
|
+
* rejections: `be.forms.consentRequired`, `be.forms.tooLarge`,
|
|
3364
|
+
* `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
|
|
3365
|
+
*/
|
|
3366
|
+
submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
|
|
3367
|
+
}
|
|
2954
3368
|
declare class WishlistModule {
|
|
2955
3369
|
private client;
|
|
2956
3370
|
constructor(client: BehioStorefront);
|
|
@@ -3130,4 +3544,4 @@ declare class NewsletterModule {
|
|
|
3130
3544
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3131
3545
|
}
|
|
3132
3546
|
|
|
3133
|
-
export { type
|
|
3547
|
+
export { type CourseModule as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CartBundleLine as D, type CartBundleLineItem as E, type CartDiscount as F, type CartItem as G, type CartItemProduct as H, type CartPromotion as I, type Category as J, type CategoryDetail as K, type CertificateVerification as L, type CheckoutAddress as M, type CheckoutInput as N, type CheckoutPaymentMethod as O, type ProductDetail as P, type CheckoutSettings as Q, type CookieConsentInput as R, type SdkResult as S, type CourseAttachment as T, type CourseCertificate as U, type CourseComment as V, type CourseCommentReply as W, type CourseCommentsList as X, type CourseDetail as Y, type CourseLesson as Z, type CourseListItem as _, type ProductVariant as a, type PickupPointsInput as a$, type CoursePostedComment as a0, type CourseProgress as a1, type CourseTutorMessage as a2, type CourseTutorThread as a3, type CrossSellItem as a4, type CustomerAddress as a5, type CustomerProfile as a6, type DigitalDownload as a7, type DownloadUrl as a8, type Facet as a9, type MenuItem as aA, type MenuItemRef as aB, type MenuItemType as aC, type MessageResponse as aD, type NewsletterOptInDefault as aE, type NewsletterSubscribeInput as aF, type NewsletterSubscribeResult as aG, type NewsletterUnsubscribeResult as aH, type OrderAccessRequestResponse as aI, type OrderAccessVerifyResponse as aJ, type OrderDetail as aK, type OrderItem as aL, type OrderListItem as aM, type OrderStatus as aN, type OrderStatusHistory as aO, OrderStatuses as aP, type OrderTracking as aQ, type Page as aR, type PageAttachment as aS, type PageDetail as aT, type PaginatedResponse as aU, type PaymentInstrument as aV, type PaymentStatus as aW, PaymentStatuses as aX, type PaymentSwift as aY, type PickupPoint as aZ, type PickupPointHours as a_, type FacetAvailability as aa, type FacetCategory as ab, type FacetLabel as ac, type FacetPriceRange as ad, type FacetRange as ae, type FacetRatingBucket as af, type FacetValue as ag, type FacetsResponse as ah, type FilterField as ai, type FulfillmentStatus as aj, FulfillmentStatuses as ak, type GiftCardBalance as al, type GiftCardPurchaseInput as am, type GiftCardPurchaseResult as an, type GiftCardSummary as ao, type LessonNote as ap, type LessonQuiz as aq, type LoginInput as ar, type LoyaltyBalance as as, type LoyaltyNextTier as at, type LoyaltyProgram as au, type LoyaltySummary as av, type LoyaltyTier as aw, type LoyaltyTierPerks as ax, type LoyaltyTransaction as ay, type Menu as az, type StorefrontFormFieldError as b, type SubmitQuoteInput as b$, type PickupWidgetConfig as b0, type PriceDisplay as b1, type ProductAssetGroup as b2, type ProductAssetItem as b3, type ProductAvailability as b4, type ProductGroup as b5, type ProductLabel as b6, type ProductListItem as b7, type ProductMedia as b8, type ProductMediaVariant as b9, type ReturnStatus as bA, type ReturnStatusItem as bB, type ReturnableOrder as bC, type ReturnableOrderItem as bD, type SdkError as bE, type ShippingMethodSummary as bF, type ShippingQuote as bG, type ShippingQuoteInput as bH, type ShopInfo as bI, type ShopScript as bJ, type ShopScriptPlacement as bK, type ShopScriptType as bL, type ShopScripts as bM, type ShopSeo as bN, type ShopSeoIdentity as bO, type SiteFormField as bP, type SiteFormFieldOption as bQ, type SiteFormFieldType as bR, type Sitemap as bS, type SitemapEntry as bT, type StockBehavior as bU, type StockMode as bV, type StorefrontForm as bW, type StorefrontFormFieldErrorCode as bX, type StorefrontFormSettings as bY, type StorefrontFormSubmitInput as bZ, type StorefrontFormSubmitResult as b_, type ProductParameter as ba, type ProductParameterGroup as bb, type ProductParametersResponse as bc, type ProductPrice as bd, type ProductPromotionSummary as be, type ProductReview as bf, type ProductReviewsResponse as bg, type ProductSibling as bh, ProductSort as bi, type ProductSortValue as bj, type ProductVolumePrice as bk, type ProductsQuery as bl, type QuizAnswerInput as bm, type QuizAnswerResult as bn, type QuizQuestion as bo, type QuizResult as bp, type QuoteItem as bq, type QuoteRequest as br, type RegisterInput as bs, type RegisterResult as bt, type RequestInterceptor as bu, type RequestInterceptorConfig as bv, type ResponseInterceptor as bw, type ResponseInterceptorData as bx, type ReturnRequest as by, type ReturnRequestItem as bz, type AddToCartInput as c, type SubmitReturnInput as c0, type SubmitReviewInput as c1, type Subscription as c2, type SubscriptionAction as c3, type SubscriptionFrequency as c4, type SubscriptionItem as c5, type SubscriptionStatus as c6, type TaxBreakdownLine as c7, type VariantAxis as c8, type VariantAxisValue as c9, type WishlistItem as ca, err as cb, ok as cc, toSdkError as cd, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleItem as y, type Cart as z };
|