@behio/storefront-sdk 1.9.0 → 1.17.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-FMMFIZHA.js} +173 -26
- package/dist/{chunk-XMKY4RI5.mjs → chunk-PU4QV6JS.mjs} +148 -1
- package/dist/{client-C635vSzU.d.mts → client-yo90ANGT.d.mts} +395 -4
- package/dist/{client-C635vSzU.d.ts → client-yo90ANGT.d.ts} +395 -4
- 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 +430 -10
- package/dist/react.d.ts +430 -10
- package/dist/react.js +333 -52
- package/dist/react.mjs +320 -44
- 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;
|
|
@@ -1148,20 +1209,48 @@ interface Cart {
|
|
|
1148
1209
|
id: string;
|
|
1149
1210
|
sessionToken?: string;
|
|
1150
1211
|
items: CartItem[];
|
|
1212
|
+
/** Sum of the lines at catalog prices: VAT included when the shop runs
|
|
1213
|
+
* `INCL_VAT`, VAT excluded when it runs `EXCL_VAT`. Not the payable amount,
|
|
1214
|
+
* that is `grandTotal`. */
|
|
1151
1215
|
subtotal: number;
|
|
1216
|
+
/** Discount from the applied code. Always based on `subtotal`, i.e. on the
|
|
1217
|
+
* prices the customer sees, so "10 % off 200" is 20 in both price modes. */
|
|
1152
1218
|
discountTotal: number;
|
|
1153
1219
|
discount?: CartDiscount;
|
|
1154
1220
|
/** Auto-apply promotion discount lines (sale/BOGO). */
|
|
1155
1221
|
appliedPromotions: CartPromotion[];
|
|
1156
1222
|
/** Sum of `appliedPromotions[].discountAmount`; already reflected in `grandTotal`. */
|
|
1157
1223
|
promotionDiscountTotal: number;
|
|
1224
|
+
/** THE PAYABLE AMOUNT for the goods, VAT included, after discounts. This is
|
|
1225
|
+
* exactly what the customer pays for the cart lines, minus shipping and the
|
|
1226
|
+
* payment-method fee (both chosen at checkout and added to
|
|
1227
|
+
* `order.grandTotal`).
|
|
1228
|
+
*
|
|
1229
|
+
* `grandTotal = netSubtotal + taxTotal - discounts` holds in BOTH price
|
|
1230
|
+
* modes: under `INCL_VAT` the VAT is extracted out of the price (the sum is
|
|
1231
|
+
* back to the catalog price), under `EXCL_VAT` it is added on top. Render
|
|
1232
|
+
* this as the cart total; do not add `taxTotal` to it. */
|
|
1158
1233
|
grandTotal: number;
|
|
1159
|
-
/**
|
|
1160
|
-
*
|
|
1234
|
+
/** VAT contained in the prices (`INCL_VAT`) or added on top of them
|
|
1235
|
+
* (`EXCL_VAT`), across all lines (GAP-30). An estimate finalized at checkout
|
|
1236
|
+
* once the shipping country is known. */
|
|
1161
1237
|
taxTotal: number;
|
|
1162
1238
|
/** VAT split by rate for "DPH 21 %: X Kč" summary rows. Empty for a
|
|
1163
1239
|
* non-VAT-payer shop. */
|
|
1164
1240
|
taxBreakdown: TaxBreakdownLine[];
|
|
1241
|
+
/** Delivery country set via `cart.setDestination()`, null until known. SDK 1.17.0. */
|
|
1242
|
+
shippingCountry: string | null;
|
|
1243
|
+
/**
|
|
1244
|
+
* Which VAT rule the cart uses: `DOMESTIC` (home rate), `OSS` (delivery
|
|
1245
|
+
* country rate), `REVERSE_CHARGE` (EU business with a valid VAT ID, 0 %),
|
|
1246
|
+
* `EXPORT` (outside the EU, 0 %). Show a note for the last two: the
|
|
1247
|
+
* breakdown is empty then. SDK 1.17.0.
|
|
1248
|
+
*/
|
|
1249
|
+
vatMode: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT";
|
|
1250
|
+
/** B2B VAT ID set via `cart.setDestination()`. */
|
|
1251
|
+
vatId: string | null;
|
|
1252
|
+
/** VIES result for `vatId`: true valid, false invalid or unverifiable, null not given. */
|
|
1253
|
+
vatIdValid: boolean | null;
|
|
1165
1254
|
currency: string;
|
|
1166
1255
|
itemCount: number;
|
|
1167
1256
|
/** Applied gift cards (multi). They deduct at checkout (consumed in order, each
|
|
@@ -1219,6 +1308,8 @@ interface CheckoutAddress {
|
|
|
1219
1308
|
street: string;
|
|
1220
1309
|
city: string;
|
|
1221
1310
|
zip: string;
|
|
1311
|
+
/** State / province where the country needs it (US, CA, AU, BR, IN, MX). SDK 1.17.0. */
|
|
1312
|
+
state?: string;
|
|
1222
1313
|
country: string;
|
|
1223
1314
|
phone?: string;
|
|
1224
1315
|
}
|
|
@@ -1243,6 +1334,14 @@ interface CheckoutInput {
|
|
|
1243
1334
|
termsConsent?: boolean;
|
|
1244
1335
|
gdprConsent?: boolean;
|
|
1245
1336
|
newsletterOptIn?: boolean;
|
|
1337
|
+
/**
|
|
1338
|
+
* Consent to marketing SMS, from the optional checkout checkbox. Render it
|
|
1339
|
+
* only when `ShopInfo.checkout.collectSmsConsent` is true; shops that do not
|
|
1340
|
+
* collect consent ignore the flag. The consent is stored against the phone
|
|
1341
|
+
* number on the created order, so it needs a usable phone in the order or
|
|
1342
|
+
* the shipping address, and it never blocks or fails the order.
|
|
1343
|
+
*/
|
|
1344
|
+
smsConsent?: boolean;
|
|
1246
1345
|
/**
|
|
1247
1346
|
* Chosen shipping method. Required whenever the eshop has at least one
|
|
1248
1347
|
* enabled shipping method — the backend rejects the order without it.
|
|
@@ -1262,7 +1361,33 @@ interface CheckoutInput {
|
|
|
1262
1361
|
* the backend rejects the order without it. Snapshotted onto the order.
|
|
1263
1362
|
*/
|
|
1264
1363
|
pickupPointId?: string;
|
|
1364
|
+
/**
|
|
1365
|
+
* Snapshot of the chosen point when it came from a carrier widget and may
|
|
1366
|
+
* not be in Behio's cache yet (Packeta serves partner points too). Sent
|
|
1367
|
+
* along with `pickupPointId`; ignored when the cache knows the point.
|
|
1368
|
+
* SDK 1.16.0.
|
|
1369
|
+
*/
|
|
1370
|
+
pickupPoint?: {
|
|
1371
|
+
name: string;
|
|
1372
|
+
street?: string;
|
|
1373
|
+
city?: string;
|
|
1374
|
+
zip?: string;
|
|
1375
|
+
country?: string;
|
|
1376
|
+
};
|
|
1265
1377
|
paymentMethodId?: string;
|
|
1378
|
+
/**
|
|
1379
|
+
* Chosen instrument `code` of the payment method (SDK 1.14.0), e.g.
|
|
1380
|
+
* "PAYMENT_CARD" | "GPAY" | "APPLE_PAY" | "BANK_ACCOUNT". Send it whenever the
|
|
1381
|
+
* chosen method lists `instruments`; the gateway is then opened directly on
|
|
1382
|
+
* that instrument. An instrument the method does not offer returns 400
|
|
1383
|
+
* (`be.storefront.paymentInstrumentInvalid`).
|
|
1384
|
+
*/
|
|
1385
|
+
paymentInstrument?: string;
|
|
1386
|
+
/**
|
|
1387
|
+
* Chosen bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0),
|
|
1388
|
+
* from `PaymentInstrument.swifts[].code`. Ignored for other instruments.
|
|
1389
|
+
*/
|
|
1390
|
+
paymentSwift?: string;
|
|
1266
1391
|
/**
|
|
1267
1392
|
* Loyalty points to redeem on this order. Validated server-side against the
|
|
1268
1393
|
* customer's actual balance and the program's redemption cap; ignored for
|
|
@@ -1330,6 +1455,8 @@ interface OrderDetail extends OrderListItem {
|
|
|
1330
1455
|
/** VAT split by rate (GAP-30), summed from the order lines. Render
|
|
1331
1456
|
* "DPH 21 %: X Kč" rows. Empty for a non-VAT order. */
|
|
1332
1457
|
taxBreakdown: TaxBreakdownLine[];
|
|
1458
|
+
/** DOMESTIC, OSS, REVERSE_CHARGE (no VAT, buyer accounts for it) or EXPORT (no VAT, outside EU). SDK 1.17.0. */
|
|
1459
|
+
vatMode?: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT" | null;
|
|
1333
1460
|
shippingTotal: number;
|
|
1334
1461
|
discountTotal: number;
|
|
1335
1462
|
fulfillmentStatus: FulfillmentStatus;
|
|
@@ -1701,6 +1828,159 @@ interface PageAttachment {
|
|
|
1701
1828
|
mimeType: string;
|
|
1702
1829
|
fileSize: number;
|
|
1703
1830
|
}
|
|
1831
|
+
interface BlogSettings {
|
|
1832
|
+
postsPerPage?: number;
|
|
1833
|
+
showAuthor?: boolean;
|
|
1834
|
+
showReadingTime?: boolean;
|
|
1835
|
+
showTags?: boolean;
|
|
1836
|
+
layout?: "grid" | "list" | "magazine";
|
|
1837
|
+
}
|
|
1838
|
+
/** One blog (a group of posts). A site can have several: news, recipes, stories. */
|
|
1839
|
+
interface Blog {
|
|
1840
|
+
/** URL segment: /blog/{handle} */
|
|
1841
|
+
handle: string;
|
|
1842
|
+
name: string;
|
|
1843
|
+
description: string | null;
|
|
1844
|
+
postCount: number;
|
|
1845
|
+
settings: BlogSettings;
|
|
1846
|
+
/** Latest publish time (epoch ms), for sitemaps. */
|
|
1847
|
+
updatedAt: number | null;
|
|
1848
|
+
}
|
|
1849
|
+
interface BlogTag {
|
|
1850
|
+
slug: string;
|
|
1851
|
+
name: string;
|
|
1852
|
+
}
|
|
1853
|
+
interface BlogPostListItem {
|
|
1854
|
+
slug: string;
|
|
1855
|
+
title: string;
|
|
1856
|
+
excerpt: string | null;
|
|
1857
|
+
coverUrl: string | null;
|
|
1858
|
+
publishedAt: number | null;
|
|
1859
|
+
readingTimeMin: number | null;
|
|
1860
|
+
authorName: string | null;
|
|
1861
|
+
isFeatured: boolean;
|
|
1862
|
+
tags: BlogTag[];
|
|
1863
|
+
}
|
|
1864
|
+
interface BlogPostsPage {
|
|
1865
|
+
items: BlogPostListItem[];
|
|
1866
|
+
total: number;
|
|
1867
|
+
page: number;
|
|
1868
|
+
limit: number;
|
|
1869
|
+
totalPages: number;
|
|
1870
|
+
/** Tags of the blog (for a filter). */
|
|
1871
|
+
tags: BlogTag[];
|
|
1872
|
+
}
|
|
1873
|
+
interface BlogPostDetail {
|
|
1874
|
+
slug: string;
|
|
1875
|
+
blogHandle: string;
|
|
1876
|
+
blogName: string;
|
|
1877
|
+
title: string;
|
|
1878
|
+
excerpt: string | null;
|
|
1879
|
+
/** `{format: "html", html}` sanitised by the API; render with RichText. */
|
|
1880
|
+
content: {
|
|
1881
|
+
format?: string;
|
|
1882
|
+
html?: string;
|
|
1883
|
+
} & Record<string, unknown>;
|
|
1884
|
+
coverUrl: string | null;
|
|
1885
|
+
publishedAt: number | null;
|
|
1886
|
+
updatedAt: number | null;
|
|
1887
|
+
readingTimeMin: number | null;
|
|
1888
|
+
authorName: string | null;
|
|
1889
|
+
tags: BlogTag[];
|
|
1890
|
+
seoTitle: string | null;
|
|
1891
|
+
seoDescription: string | null;
|
|
1892
|
+
ogImage: string | null;
|
|
1893
|
+
/** Other posts of the same blog. */
|
|
1894
|
+
related: BlogPostListItem[];
|
|
1895
|
+
}
|
|
1896
|
+
interface BlogPostsQuery {
|
|
1897
|
+
locale?: string;
|
|
1898
|
+
page?: number;
|
|
1899
|
+
limit?: number;
|
|
1900
|
+
/** Filter by tag slug. */
|
|
1901
|
+
tag?: string;
|
|
1902
|
+
}
|
|
1903
|
+
type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "select" | "radio" | "checkbox" | "multiselect" | "date"
|
|
1904
|
+
/** "HH:MM" */
|
|
1905
|
+
| "time"
|
|
1906
|
+
/** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
|
|
1907
|
+
| "datetime"
|
|
1908
|
+
/** http(s) address */
|
|
1909
|
+
| "url" | "hidden";
|
|
1910
|
+
interface SiteFormFieldOption {
|
|
1911
|
+
value: string;
|
|
1912
|
+
label: string;
|
|
1913
|
+
}
|
|
1914
|
+
/** One field of a merchant-defined form; render it by `type`. */
|
|
1915
|
+
interface SiteFormField {
|
|
1916
|
+
/** Key in the submitted `data` object (lowercase, underscores). */
|
|
1917
|
+
key: string;
|
|
1918
|
+
type: SiteFormFieldType;
|
|
1919
|
+
label: string;
|
|
1920
|
+
placeholder?: string;
|
|
1921
|
+
/** Help line under the field. */
|
|
1922
|
+
help?: string;
|
|
1923
|
+
required: boolean;
|
|
1924
|
+
/** Present for select / radio / multiselect. */
|
|
1925
|
+
options?: SiteFormFieldOption[];
|
|
1926
|
+
/** Number: min/max value. Text: min/max length. */
|
|
1927
|
+
min?: number;
|
|
1928
|
+
max?: number;
|
|
1929
|
+
/** Regular expression for text fields (without slashes). */
|
|
1930
|
+
pattern?: string;
|
|
1931
|
+
/** Layout hint: "half" fields sit side by side on wide screens. */
|
|
1932
|
+
width?: "full" | "half";
|
|
1933
|
+
/** Value of hidden fields (source, campaign) or a prefill for visible ones. */
|
|
1934
|
+
defaultValue?: string;
|
|
1935
|
+
}
|
|
1936
|
+
interface StorefrontFormSettings {
|
|
1937
|
+
submitLabel?: string;
|
|
1938
|
+
/** Shown after a successful submit (also returned as `message`). */
|
|
1939
|
+
successMessage?: string;
|
|
1940
|
+
/** When set, redirect the visitor here after a successful submit. */
|
|
1941
|
+
redirectUrl?: string;
|
|
1942
|
+
/** Text of the consent checkbox. */
|
|
1943
|
+
consentText?: string;
|
|
1944
|
+
/** When true, `consent: true` is required for the submit to pass. */
|
|
1945
|
+
requireConsent?: boolean;
|
|
1946
|
+
}
|
|
1947
|
+
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
1948
|
+
interface StorefrontForm {
|
|
1949
|
+
slug: string;
|
|
1950
|
+
name: string;
|
|
1951
|
+
description: string | null;
|
|
1952
|
+
fields: SiteFormField[];
|
|
1953
|
+
settings: StorefrontFormSettings;
|
|
1954
|
+
}
|
|
1955
|
+
interface StorefrontFormSubmitInput {
|
|
1956
|
+
/** `{fieldKey: value}`; unknown keys are dropped server-side. */
|
|
1957
|
+
data: Record<string, unknown>;
|
|
1958
|
+
locale?: string;
|
|
1959
|
+
/** URL of the page the form was submitted from (context for the merchant). */
|
|
1960
|
+
page?: string;
|
|
1961
|
+
/** Consent checkbox state (required when `settings.requireConsent`). */
|
|
1962
|
+
consent?: boolean;
|
|
1963
|
+
/**
|
|
1964
|
+
* Honeypot. Render it as a visually hidden input and pass its value through
|
|
1965
|
+
* untouched: a filled value is answered like a success but stored nowhere.
|
|
1966
|
+
*/
|
|
1967
|
+
website?: string;
|
|
1968
|
+
}
|
|
1969
|
+
interface StorefrontFormSubmitResult {
|
|
1970
|
+
ok: boolean;
|
|
1971
|
+
/** Id of the stored submission (null when the form does not store responses). */
|
|
1972
|
+
id: string | null;
|
|
1973
|
+
/** `settings.successMessage`, when set. */
|
|
1974
|
+
message: string | null;
|
|
1975
|
+
/** `settings.redirectUrl`, when set. */
|
|
1976
|
+
redirectUrl: string | null;
|
|
1977
|
+
}
|
|
1978
|
+
type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
|
|
1979
|
+
/** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
|
|
1980
|
+
interface StorefrontFormFieldError {
|
|
1981
|
+
key: string;
|
|
1982
|
+
code: StorefrontFormFieldErrorCode;
|
|
1983
|
+
}
|
|
1704
1984
|
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
1985
|
declare class BehioApiError extends Error {
|
|
1706
1986
|
readonly code: BehioErrorCode;
|
|
@@ -1905,6 +2185,27 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
1905
2185
|
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
1906
2186
|
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
1907
2187
|
*/
|
|
2188
|
+
/**
|
|
2189
|
+
* Carrier map widget for choosing a pickup point in checkout. Present in
|
|
2190
|
+
* `ShippingMethod.publicConfig.pickupWidget` when the merchant's carrier
|
|
2191
|
+
* supports it (today Packeta: load https://widget.packeta.com/v6/www/js/library.js
|
|
2192
|
+
* and call `Packeta.Widget.pick(apiKey, cb, {country, language})`; send
|
|
2193
|
+
* `String(point.id)` back as `checkout.pickupPointId`). SDK 1.15.0.
|
|
2194
|
+
* `provider: "behio"` (SDK 1.16.0) means "draw the map yourself from
|
|
2195
|
+
* `getPickupPoints()` coordinates".
|
|
2196
|
+
*/
|
|
2197
|
+
type PickupWidgetConfig = {
|
|
2198
|
+
provider: "packeta";
|
|
2199
|
+
/** Public widget key (never the API password). */
|
|
2200
|
+
apiKey: string;
|
|
2201
|
+
} | {
|
|
2202
|
+
/**
|
|
2203
|
+
* No carrier widget, but every point from `getPickupPoints()` carries
|
|
2204
|
+
* `latitude`/`longitude`: render your own map (SDK 1.16.0; PPL, GLS,
|
|
2205
|
+
* Aramex, Zaslat).
|
|
2206
|
+
*/
|
|
2207
|
+
provider: "behio";
|
|
2208
|
+
};
|
|
1908
2209
|
interface PickupPoint {
|
|
1909
2210
|
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
1910
2211
|
externalId: string;
|
|
@@ -2072,6 +2373,10 @@ interface GiftCardPurchaseInput {
|
|
|
2072
2373
|
personalMessage?: string;
|
|
2073
2374
|
/** Online payment method id (from listPaymentMethods) to start payment right away. */
|
|
2074
2375
|
paymentMethodId?: string;
|
|
2376
|
+
/** Instrument `code` of the chosen method (SDK 1.14.0), see `CheckoutInput.paymentInstrument`. */
|
|
2377
|
+
paymentInstrument?: string;
|
|
2378
|
+
/** Bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0). */
|
|
2379
|
+
paymentSwift?: string;
|
|
2075
2380
|
locale?: string;
|
|
2076
2381
|
}
|
|
2077
2382
|
interface GiftCardPurchaseResult {
|
|
@@ -2356,6 +2661,8 @@ declare class BehioStorefront {
|
|
|
2356
2661
|
readonly orders: OrdersModule;
|
|
2357
2662
|
readonly customer: CustomerModule;
|
|
2358
2663
|
readonly pages: PagesModule;
|
|
2664
|
+
readonly blog: BlogModule;
|
|
2665
|
+
readonly forms: FormsModule;
|
|
2359
2666
|
readonly wishlist: WishlistModule;
|
|
2360
2667
|
readonly reviews: ReviewsModule;
|
|
2361
2668
|
readonly returns: ReturnsModule;
|
|
@@ -2667,9 +2974,25 @@ declare class CatalogModule {
|
|
|
2667
2974
|
* code is generated and emailed to the recipient once the order is paid.
|
|
2668
2975
|
*/
|
|
2669
2976
|
purchaseGiftCard(input: GiftCardPurchaseInput): Promise<SdkResult<GiftCardPurchaseResult>>;
|
|
2670
|
-
/**
|
|
2977
|
+
/**
|
|
2978
|
+
* List configured payment methods (filtered by currency). `locale` picks the
|
|
2979
|
+
* language of `instruments[].label` / `swifts[].label` (SDK 1.14.0); pass the
|
|
2980
|
+
* locale of the page so the instrument tiles read in the shopper's language.
|
|
2981
|
+
*/
|
|
2671
2982
|
listPaymentMethods(opts?: {
|
|
2672
2983
|
currency?: string;
|
|
2984
|
+
locale?: string;
|
|
2985
|
+
/** Delivery country (ISO): hides methods not valid there, orders them per country. SDK 1.15.0 */
|
|
2986
|
+
country?: string;
|
|
2987
|
+
/** Chosen shipping method: hides cash on delivery when the carrier cannot do it. SDK 1.15.0 */
|
|
2988
|
+
shippingMethodId?: string;
|
|
2989
|
+
}): Promise<SdkResult<{
|
|
2990
|
+
items: CheckoutPaymentMethod[];
|
|
2991
|
+
}>>;
|
|
2992
|
+
/** Alias of `listPaymentMethods` (SDK 1.14.0). */
|
|
2993
|
+
paymentMethods(opts?: {
|
|
2994
|
+
currency?: string;
|
|
2995
|
+
locale?: string;
|
|
2673
2996
|
}): Promise<SdkResult<{
|
|
2674
2997
|
items: CheckoutPaymentMethod[];
|
|
2675
2998
|
}>>;
|
|
@@ -2719,6 +3042,22 @@ declare class CartModule {
|
|
|
2719
3042
|
* ```
|
|
2720
3043
|
*/
|
|
2721
3044
|
setCurrency(currency: string): Promise<SdkResult<Cart>>;
|
|
3045
|
+
/**
|
|
3046
|
+
* Tell the cart where the order will ship (and, for B2B, the buyer's VAT
|
|
3047
|
+
* ID) so the VAT breakdown matches the checkout before the address form:
|
|
3048
|
+
* destination-country rate (OSS), 0 % export outside the EU, or reverse
|
|
3049
|
+
* charge for an EU business with a VIES-valid VAT ID. `cart.vatMode` says
|
|
3050
|
+
* which rule applied. SDK 1.17.0.
|
|
3051
|
+
*
|
|
3052
|
+
* ```ts
|
|
3053
|
+
* await client.cart.setDestination({ country: "SK" });
|
|
3054
|
+
* await client.cart.setDestination({ vatId: "SK2020000001" }); // "" clears
|
|
3055
|
+
* ```
|
|
3056
|
+
*/
|
|
3057
|
+
setDestination(input: {
|
|
3058
|
+
country?: string;
|
|
3059
|
+
vatId?: string | null;
|
|
3060
|
+
}): Promise<SdkResult<Cart>>;
|
|
2722
3061
|
/** Update item quantity */
|
|
2723
3062
|
updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
|
|
2724
3063
|
/** Remove item from cart */
|
|
@@ -2771,6 +3110,27 @@ declare class CheckoutModule {
|
|
|
2771
3110
|
declare class OrdersModule {
|
|
2772
3111
|
private client;
|
|
2773
3112
|
constructor(client: BehioStorefront);
|
|
3113
|
+
/**
|
|
3114
|
+
* Ask the backend to re-check this order's payment with the gateway.
|
|
3115
|
+
*
|
|
3116
|
+
* Call it on the thank-you page the customer lands on after paying, BEFORE
|
|
3117
|
+
* you read the order. Some gateways (Tatrapay+) have no server-to-server
|
|
3118
|
+
* notification at all, so the customer's return is the only fast way the
|
|
3119
|
+
* payment gets confirmed; for the others it is a safety net for a lost
|
|
3120
|
+
* notification.
|
|
3121
|
+
*
|
|
3122
|
+
* The response is deliberately opaque (`{ok: true}` every time, even for an
|
|
3123
|
+
* order number that does not exist): order numbers are sequential, so
|
|
3124
|
+
* anything else would turn this into a probe for other people's orders.
|
|
3125
|
+
* Read the actual state afterwards through a path that proves entitlement
|
|
3126
|
+
* ({@link get}, {@link track} or the guest access-code flow).
|
|
3127
|
+
*
|
|
3128
|
+
* Never throws for a missing order and never blocks the page: treat a
|
|
3129
|
+
* failure as "not confirmed yet", the backend poller catches up on its own.
|
|
3130
|
+
*/
|
|
3131
|
+
syncPaymentOnReturn(orderNumber: string): Promise<SdkResult<{
|
|
3132
|
+
ok: boolean;
|
|
3133
|
+
}>>;
|
|
2774
3134
|
/** List customer orders (requires auth) */
|
|
2775
3135
|
list(options?: {
|
|
2776
3136
|
page?: number;
|
|
@@ -2951,6 +3311,37 @@ declare class PagesModule {
|
|
|
2951
3311
|
/** Get page by slug */
|
|
2952
3312
|
get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
|
|
2953
3313
|
}
|
|
3314
|
+
declare class BlogModule {
|
|
3315
|
+
private client;
|
|
3316
|
+
constructor(client: BehioStorefront);
|
|
3317
|
+
/** List the site's blogs (active only). */
|
|
3318
|
+
list(locale?: string): Promise<SdkResult<{
|
|
3319
|
+
blogs: Blog[];
|
|
3320
|
+
}>>;
|
|
3321
|
+
/** Published posts of one blog, newest first (featured first), paginated. */
|
|
3322
|
+
posts(handle: string, query?: BlogPostsQuery): Promise<SdkResult<BlogPostsPage>>;
|
|
3323
|
+
/** One published post with sanitised HTML content and related posts. */
|
|
3324
|
+
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3325
|
+
}
|
|
3326
|
+
/**
|
|
3327
|
+
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3328
|
+
* The definition is public and cacheable; a submit is validated server-side
|
|
3329
|
+
* against it, so the browser-side checks are only a courtesy. Works with
|
|
3330
|
+
* website keys that have no e-shop attached.
|
|
3331
|
+
*/
|
|
3332
|
+
declare class FormsModule {
|
|
3333
|
+
private client;
|
|
3334
|
+
constructor(client: BehioStorefront);
|
|
3335
|
+
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
3336
|
+
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
3337
|
+
/**
|
|
3338
|
+
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
3339
|
+
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
3340
|
+
* rejections: `be.forms.consentRequired`, `be.forms.tooLarge`,
|
|
3341
|
+
* `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
|
|
3342
|
+
*/
|
|
3343
|
+
submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
|
|
3344
|
+
}
|
|
2954
3345
|
declare class WishlistModule {
|
|
2955
3346
|
private client;
|
|
2956
3347
|
constructor(client: BehioStorefront);
|
|
@@ -3130,4 +3521,4 @@ declare class NewsletterModule {
|
|
|
3130
3521
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3131
3522
|
}
|
|
3132
3523
|
|
|
3133
|
-
export { type
|
|
3524
|
+
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 };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-
|
|
2
|
-
export { A as ActivePromotion,
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-yo90ANGT.mjs';
|
|
2
|
+
export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleItem, z as Cart, D as CartBundleLine, E as CartBundleLineItem, F as CartDiscount, G as CartItem, H as CartItemProduct, I as CartPromotion, J as Category, K as CategoryDetail, L as CertificateVerification, M as CheckoutAddress, N as CheckoutInput, O as CheckoutPaymentMethod, Q as CheckoutSettings, R as CookieConsentInput, T as CourseAttachment, U as CourseCertificate, V as CourseComment, W as CourseCommentReply, X as CourseCommentsList, Y as CourseDetail, Z as CourseLesson, _ as CourseListItem, $ as CourseModule, a0 as CoursePostedComment, a1 as CourseProgress, a2 as CourseTutorMessage, a3 as CourseTutorThread, a4 as CrossSellItem, a5 as CustomerAddress, a6 as CustomerProfile, a7 as DigitalDownload, a8 as DownloadUrl, a9 as Facet, aa as FacetAvailability, ab as FacetCategory, ac as FacetLabel, ad as FacetPriceRange, ae as FacetRange, af as FacetRatingBucket, ag as FacetValue, ah as FacetsResponse, ai as FilterField, aj as FulfillmentStatus, ak as FulfillmentStatuses, al as GiftCardBalance, am as GiftCardPurchaseInput, an as GiftCardPurchaseResult, ao as GiftCardSummary, ap as LessonNote, aq as LessonQuiz, ar as LoginInput, as as LoyaltyBalance, at as LoyaltyNextTier, au as LoyaltyProgram, av as LoyaltySummary, aw as LoyaltyTier, ax as LoyaltyTierPerks, ay as LoyaltyTransaction, az as Menu, aA as MenuItem, aB as MenuItemRef, aC as MenuItemType, aD as MessageResponse, aE as NewsletterOptInDefault, aF as NewsletterSubscribeInput, aG as NewsletterSubscribeResult, aH as NewsletterUnsubscribeResult, aI as OrderAccessRequestResponse, aJ as OrderAccessVerifyResponse, aK as OrderDetail, aL as OrderItem, aM as OrderListItem, aN as OrderStatus, aO as OrderStatusHistory, aP as OrderStatuses, aQ as OrderTracking, aR as Page, aS as PageAttachment, aT as PageDetail, aU as PaginatedResponse, aV as PaymentInstrument, aW as PaymentStatus, aX as PaymentStatuses, aY as PaymentSwift, aZ as PickupPoint, a_ as PickupPointHours, a$ as PickupPointsInput, b0 as PickupWidgetConfig, b1 as PriceDisplay, b2 as ProductAssetGroup, b3 as ProductAssetItem, b4 as ProductAvailability, b5 as ProductGroup, b6 as ProductLabel, b7 as ProductListItem, b8 as ProductMedia, b9 as ProductMediaVariant, ba as ProductParameter, bb as ProductParameterGroup, bc as ProductParametersResponse, bd as ProductPrice, be as ProductPromotionSummary, bf as ProductReview, bg as ProductReviewsResponse, bh as ProductSibling, bi as ProductSort, bj as ProductSortValue, bk as ProductVolumePrice, bl as ProductsQuery, bm as QuizAnswerInput, bn as QuizAnswerResult, bo as QuizQuestion, bp as QuizResult, bq as QuoteItem, br as QuoteRequest, bs as RegisterInput, bt as RegisterResult, bu as RequestInterceptor, bv as RequestInterceptorConfig, bw as ResponseInterceptor, bx as ResponseInterceptorData, by as ReturnRequest, bz as ReturnRequestItem, bA as ReturnStatus, bB as ReturnStatusItem, bC as ReturnableOrder, bD as ReturnableOrderItem, bE as SdkError, bF as ShippingMethodSummary, bG as ShippingQuote, bH as ShippingQuoteInput, bI as ShopInfo, bJ as ShopScript, bK as ShopScriptPlacement, bL as ShopScriptType, bM as ShopScripts, bN as ShopSeo, bO as ShopSeoIdentity, bP as SiteFormField, bQ as SiteFormFieldOption, bR as SiteFormFieldType, bS as Sitemap, bT as SitemapEntry, bU as StockBehavior, bV as StockMode, bW as StorefrontForm, bX as StorefrontFormFieldErrorCode, bY as StorefrontFormSettings, bZ as StorefrontFormSubmitInput, b_ as StorefrontFormSubmitResult, b$ as SubmitQuoteInput, c0 as SubmitReturnInput, c1 as SubmitReviewInput, c2 as Subscription, c3 as SubscriptionAction, c4 as SubscriptionFrequency, c5 as SubscriptionItem, c6 as SubscriptionStatus, c7 as TaxBreakdownLine, c8 as VariantAxis, c9 as VariantAxisValue, ca as WishlistItem, cb as err, cc as ok, cd as toSdkError } from './client-yo90ANGT.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -224,4 +224,45 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
224
224
|
success: boolean;
|
|
225
225
|
}>>;
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
type ErrorMessageLocale = "cs" | "sk" | "en";
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Preklad chyb backendu (chybovy kontrakt, docs/error-contract.md).
|
|
231
|
+
*
|
|
232
|
+
* Verejne /storefront/v1 chyby nesou od BE:
|
|
233
|
+
* {statusCode, key: "be.storefront.x", code: "be.storefront.x", params, message}
|
|
234
|
+
* `message` je anglicka veta (docasna kompatibilita, zmizi v major verzi);
|
|
235
|
+
* `code`/`key` je stabilni strojovy identifikator. `errorMessage()` vrati
|
|
236
|
+
* lokalizovanou vetu pro cs/sk/en s interpolaci `params`, s fallbackem na
|
|
237
|
+
* anglickou `message` z odpovedi.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/** Stabilni chybovy kod (`be.storefront.*`) z odpovedi BE, nebo null. */
|
|
241
|
+
declare function errorCode(err: unknown): string | null;
|
|
242
|
+
/** Interpolacni parametry chyby ({name}, {min}, ...), nebo prazdny objekt. */
|
|
243
|
+
declare function errorParams(err: unknown): Record<string, unknown>;
|
|
244
|
+
/**
|
|
245
|
+
* Lokalizovana veta pro chybu z SDK volani.
|
|
246
|
+
*
|
|
247
|
+
* const {data, error} = await behio.cart.addItem(...);
|
|
248
|
+
* if (error) show(errorMessage(error, "cs"));
|
|
249
|
+
*
|
|
250
|
+
* Poradi: preklad podle `code` -> anglicka `message` z odpovedi -> obecna veta.
|
|
251
|
+
*/
|
|
252
|
+
declare function errorMessage(err: unknown, locale?: ErrorMessageLocale): string;
|
|
253
|
+
/**
|
|
254
|
+
* Prelozene chyby validace per pole (`be.validation.failed` telo).
|
|
255
|
+
* Vrati mapu path -> veta ("email" -> "Neplatná e-mailová adresa.").
|
|
256
|
+
*/
|
|
257
|
+
declare function validationFieldMessages(err: unknown, locale?: ErrorMessageLocale): Record<string, string>;
|
|
258
|
+
/**
|
|
259
|
+
* Per-field errors of a rejected form submit (`be.forms.validationFailed`).
|
|
260
|
+
* The backend sends `params.errors` as `"fieldKey:code"` strings; this turns
|
|
261
|
+
* them into `{key, code}` pairs. Empty for any other error.
|
|
262
|
+
*
|
|
263
|
+
* const {error} = await behio.forms.submit("contact", {data});
|
|
264
|
+
* const byKey = Object.fromEntries(formFieldErrors(error).map((e) => [e.key, e.code]));
|
|
265
|
+
*/
|
|
266
|
+
declare function formFieldErrors(err: unknown): StorefrontFormFieldError[];
|
|
267
|
+
|
|
268
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, validationFieldMessages, variantFromQuery, variantHref };
|