@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/dist/react.d.ts CHANGED
@@ -156,6 +156,13 @@ interface CheckoutSettings {
156
156
  requireGdprConsent: boolean;
157
157
  /** Default state of the newsletter opt-in on the checkout (or hide it). */
158
158
  newsletterOptInDefault: NewsletterOptInDefault;
159
+ /**
160
+ * Merchant collects consent for marketing SMS in the checkout. When true,
161
+ * render an OPTIONAL, unchecked checkbox in the contact step and send the
162
+ * answer as `smsConsent` in `checkout.createOrder`. Never make it required:
163
+ * order updates are transactional and need no consent, marketing does.
164
+ */
165
+ collectSmsConsent: boolean;
159
166
  /** Minimum order value in the shop default currency, or null when unset. */
160
167
  minOrderValue: number | null;
161
168
  /** Maximum order value in the shop default currency, or null when unset. */
@@ -229,6 +236,21 @@ interface ShopInfo {
229
236
  * than hardcoded template config.
230
237
  */
231
238
  quotesEnabled: boolean;
239
+ /**
240
+ * Countries the shop delivers to, derived from the ENABLED shipping methods
241
+ * (union of their allowed countries). `null` = no restriction (some enabled
242
+ * method ships anywhere), `[]` = no enabled shipping method. Limit the
243
+ * checkout country select to this list so a shopper from an unserved
244
+ * country learns it up front, not at the shipping step. Optional because
245
+ * cached ShopInfo payloads predating SDK 1.15.0 may still be served.
246
+ */
247
+ shippingCountries?: string[] | null;
248
+ /**
249
+ * Default currency per delivery country, e.g. `{SK: "EUR"}`. When the
250
+ * shopper picks such a country, switch the cart with `cart.setCurrency()`
251
+ * (and the display currency) unless they chose one themselves. SDK 1.17.0.
252
+ */
253
+ currencyByCountry?: Record<string, string>;
232
254
  /** Full merchant checkout & cart contract. Honour these in cart + checkout. */
233
255
  checkout: CheckoutSettings;
234
256
  /**
@@ -325,6 +347,45 @@ interface CheckoutPaymentMethod {
325
347
  feeCurrency?: string | null;
326
348
  /** Customer-safe slice of config: bank account, IBAN, instructions, … */
327
349
  publicConfig?: Record<string, unknown>;
350
+ /**
351
+ * Concrete payment instruments the provider offers for this method
352
+ * (card, Google Pay, Apple Pay, bank transfer with a bank grid, ...).
353
+ * Gateways such as GoPay require the customer to choose the instrument
354
+ * ALREADY IN THE CHECKOUT, so render them as tiles under the selected method
355
+ * and send the chosen `code` as `paymentInstrument` in `createOrder` (plus
356
+ * `paymentSwift` for `BANK_ACCOUNT`). `null` = the provider has no
357
+ * instruments (cash on delivery, plain bank transfer, Stripe hosted page);
358
+ * render nothing extra and send nothing extra. SDK 1.14.0.
359
+ */
360
+ instruments?: PaymentInstrument[] | null;
361
+ }
362
+ /**
363
+ * One payment instrument of a gateway method (SDK 1.14.0). The first item is
364
+ * the sensible default (card for GoPay). `swifts` is non-empty only for
365
+ * `BANK_ACCOUNT`, where the customer additionally picks a bank.
366
+ */
367
+ interface PaymentInstrument {
368
+ /** Provider code: "PAYMENT_CARD" | "BANK_ACCOUNT" | "GPAY" | "APPLE_PAY" | "PAYPAL" | ... */
369
+ code: string;
370
+ /** Localized label (requested `locale`), e.g. "Platební karta". */
371
+ label: string;
372
+ /** Small logo URL or null. */
373
+ image: string | null;
374
+ /** Larger logo URL or null. */
375
+ imageLarge: string | null;
376
+ /** Banks for `BANK_ACCOUNT`; empty for every other instrument. */
377
+ swifts: PaymentSwift[];
378
+ }
379
+ /** One bank of a `BANK_ACCOUNT` instrument (SDK 1.14.0). */
380
+ interface PaymentSwift {
381
+ /** SWIFT/BIC, e.g. "FIOBCZPP". Send it as `paymentSwift`. */
382
+ code: string;
383
+ /** Localized bank name. */
384
+ label: string;
385
+ /** Bank logo URL or null. */
386
+ image: string | null;
387
+ /** Instant online bank payment; show these first. */
388
+ online: boolean;
328
389
  }
329
390
  interface ProductPrice {
330
391
  amount: number;
@@ -1052,6 +1113,12 @@ type AddressType = (typeof AddressTypes)[keyof typeof AddressTypes];
1052
1113
  interface ProductsQuery {
1053
1114
  page?: number;
1054
1115
  limit?: number;
1116
+ /**
1117
+ * Delivery country (ISO-2). Lets country-scoped price rules (for example a
1118
+ * surcharge for SK) apply in the listing; the cart and checkout use the
1119
+ * cart destination instead.
1120
+ */
1121
+ country?: string;
1055
1122
  /** Single category slug (OR logic with categories array) */
1056
1123
  category?: string;
1057
1124
  /** Multiple category slugs (OR logic — product in ANY of these categories) */
@@ -1204,20 +1271,48 @@ interface Cart {
1204
1271
  id: string;
1205
1272
  sessionToken?: string;
1206
1273
  items: CartItem[];
1274
+ /** Sum of the lines at catalog prices: VAT included when the shop runs
1275
+ * `INCL_VAT`, VAT excluded when it runs `EXCL_VAT`. Not the payable amount,
1276
+ * that is `grandTotal`. */
1207
1277
  subtotal: number;
1278
+ /** Discount from the applied code. Always based on `subtotal`, i.e. on the
1279
+ * prices the customer sees, so "10 % off 200" is 20 in both price modes. */
1208
1280
  discountTotal: number;
1209
1281
  discount?: CartDiscount;
1210
1282
  /** Auto-apply promotion discount lines (sale/BOGO). */
1211
1283
  appliedPromotions: CartPromotion[];
1212
1284
  /** Sum of `appliedPromotions[].discountAmount`; already reflected in `grandTotal`. */
1213
1285
  promotionDiscountTotal: number;
1286
+ /** THE PAYABLE AMOUNT for the goods, VAT included, after discounts. This is
1287
+ * exactly what the customer pays for the cart lines, minus shipping and the
1288
+ * payment-method fee (both chosen at checkout and added to
1289
+ * `order.grandTotal`).
1290
+ *
1291
+ * `grandTotal = netSubtotal + taxTotal - discounts` holds in BOTH price
1292
+ * modes: under `INCL_VAT` the VAT is extracted out of the price (the sum is
1293
+ * back to the catalog price), under `EXCL_VAT` it is added on top. Render
1294
+ * this as the cart total; do not add `taxTotal` to it. */
1214
1295
  grandTotal: number;
1215
- /** Total VAT contained in / added to the cart across all lines (GAP-30). An
1216
- * estimate finalized at checkout once the shipping country is known. */
1296
+ /** VAT contained in the prices (`INCL_VAT`) or added on top of them
1297
+ * (`EXCL_VAT`), across all lines (GAP-30). An estimate finalized at checkout
1298
+ * once the shipping country is known. */
1217
1299
  taxTotal: number;
1218
1300
  /** VAT split by rate for "DPH 21 %: X Kč" summary rows. Empty for a
1219
1301
  * non-VAT-payer shop. */
1220
1302
  taxBreakdown: TaxBreakdownLine[];
1303
+ /** Delivery country set via `cart.setDestination()`, null until known. SDK 1.17.0. */
1304
+ shippingCountry: string | null;
1305
+ /**
1306
+ * Which VAT rule the cart uses: `DOMESTIC` (home rate), `OSS` (delivery
1307
+ * country rate), `REVERSE_CHARGE` (EU business with a valid VAT ID, 0 %),
1308
+ * `EXPORT` (outside the EU, 0 %). Show a note for the last two: the
1309
+ * breakdown is empty then. SDK 1.17.0.
1310
+ */
1311
+ vatMode: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT";
1312
+ /** B2B VAT ID set via `cart.setDestination()`. */
1313
+ vatId: string | null;
1314
+ /** VIES result for `vatId`: true valid, false invalid or unverifiable, null not given. */
1315
+ vatIdValid: boolean | null;
1221
1316
  currency: string;
1222
1317
  itemCount: number;
1223
1318
  /** Applied gift cards (multi). They deduct at checkout (consumed in order, each
@@ -1275,6 +1370,8 @@ interface CheckoutAddress {
1275
1370
  street: string;
1276
1371
  city: string;
1277
1372
  zip: string;
1373
+ /** State / province where the country needs it (US, CA, AU, BR, IN, MX). SDK 1.17.0. */
1374
+ state?: string;
1278
1375
  country: string;
1279
1376
  phone?: string;
1280
1377
  }
@@ -1299,6 +1396,14 @@ interface CheckoutInput {
1299
1396
  termsConsent?: boolean;
1300
1397
  gdprConsent?: boolean;
1301
1398
  newsletterOptIn?: boolean;
1399
+ /**
1400
+ * Consent to marketing SMS, from the optional checkout checkbox. Render it
1401
+ * only when `ShopInfo.checkout.collectSmsConsent` is true; shops that do not
1402
+ * collect consent ignore the flag. The consent is stored against the phone
1403
+ * number on the created order, so it needs a usable phone in the order or
1404
+ * the shipping address, and it never blocks or fails the order.
1405
+ */
1406
+ smsConsent?: boolean;
1302
1407
  /**
1303
1408
  * Chosen shipping method. Required whenever the eshop has at least one
1304
1409
  * enabled shipping method — the backend rejects the order without it.
@@ -1318,7 +1423,33 @@ interface CheckoutInput {
1318
1423
  * the backend rejects the order without it. Snapshotted onto the order.
1319
1424
  */
1320
1425
  pickupPointId?: string;
1426
+ /**
1427
+ * Snapshot of the chosen point when it came from a carrier widget and may
1428
+ * not be in Behio's cache yet (Packeta serves partner points too). Sent
1429
+ * along with `pickupPointId`; ignored when the cache knows the point.
1430
+ * SDK 1.16.0.
1431
+ */
1432
+ pickupPoint?: {
1433
+ name: string;
1434
+ street?: string;
1435
+ city?: string;
1436
+ zip?: string;
1437
+ country?: string;
1438
+ };
1321
1439
  paymentMethodId?: string;
1440
+ /**
1441
+ * Chosen instrument `code` of the payment method (SDK 1.14.0), e.g.
1442
+ * "PAYMENT_CARD" | "GPAY" | "APPLE_PAY" | "BANK_ACCOUNT". Send it whenever the
1443
+ * chosen method lists `instruments`; the gateway is then opened directly on
1444
+ * that instrument. An instrument the method does not offer returns 400
1445
+ * (`be.storefront.paymentInstrumentInvalid`).
1446
+ */
1447
+ paymentInstrument?: string;
1448
+ /**
1449
+ * Chosen bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0),
1450
+ * from `PaymentInstrument.swifts[].code`. Ignored for other instruments.
1451
+ */
1452
+ paymentSwift?: string;
1322
1453
  /**
1323
1454
  * Loyalty points to redeem on this order. Validated server-side against the
1324
1455
  * customer's actual balance and the program's redemption cap; ignored for
@@ -1386,6 +1517,8 @@ interface OrderDetail extends OrderListItem {
1386
1517
  /** VAT split by rate (GAP-30), summed from the order lines. Render
1387
1518
  * "DPH 21 %: X Kč" rows. Empty for a non-VAT order. */
1388
1519
  taxBreakdown: TaxBreakdownLine[];
1520
+ /** DOMESTIC, OSS, REVERSE_CHARGE (no VAT, buyer accounts for it) or EXPORT (no VAT, outside EU). SDK 1.17.0. */
1521
+ vatMode?: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT" | null;
1389
1522
  shippingTotal: number;
1390
1523
  discountTotal: number;
1391
1524
  fulfillmentStatus: FulfillmentStatus;
@@ -1729,6 +1862,19 @@ interface CustomerAddress {
1729
1862
  city: string;
1730
1863
  zip: string;
1731
1864
  country: string;
1865
+ /** State / region for countries that need it (US, CA, AU). */
1866
+ state?: string | null;
1867
+ /** Company registration number. */
1868
+ companyId?: string | null;
1869
+ /** VAT ID. EU numbers are verified in VIES when the address is saved. */
1870
+ vatId?: string | null;
1871
+ /**
1872
+ * VIES result at save time: true = valid, false = not confirmed, null = no
1873
+ * VAT ID or not an EU number. Read-only, the server sets it.
1874
+ */
1875
+ vatIdValid?: boolean | null;
1876
+ /** When the VAT ID was last checked (ms). Read-only. */
1877
+ vatIdCheckedAt?: number | null;
1732
1878
  phone?: string;
1733
1879
  }
1734
1880
  interface Page {
@@ -1757,6 +1903,159 @@ interface PageAttachment {
1757
1903
  mimeType: string;
1758
1904
  fileSize: number;
1759
1905
  }
1906
+ interface BlogSettings {
1907
+ postsPerPage?: number;
1908
+ showAuthor?: boolean;
1909
+ showReadingTime?: boolean;
1910
+ showTags?: boolean;
1911
+ layout?: "grid" | "list" | "magazine";
1912
+ }
1913
+ /** One blog (a group of posts). A site can have several: news, recipes, stories. */
1914
+ interface Blog {
1915
+ /** URL segment: /blog/{handle} */
1916
+ handle: string;
1917
+ name: string;
1918
+ description: string | null;
1919
+ postCount: number;
1920
+ settings: BlogSettings;
1921
+ /** Latest publish time (epoch ms), for sitemaps. */
1922
+ updatedAt: number | null;
1923
+ }
1924
+ interface BlogTag {
1925
+ slug: string;
1926
+ name: string;
1927
+ }
1928
+ interface BlogPostListItem {
1929
+ slug: string;
1930
+ title: string;
1931
+ excerpt: string | null;
1932
+ coverUrl: string | null;
1933
+ publishedAt: number | null;
1934
+ readingTimeMin: number | null;
1935
+ authorName: string | null;
1936
+ isFeatured: boolean;
1937
+ tags: BlogTag[];
1938
+ }
1939
+ interface BlogPostsPage {
1940
+ items: BlogPostListItem[];
1941
+ total: number;
1942
+ page: number;
1943
+ limit: number;
1944
+ totalPages: number;
1945
+ /** Tags of the blog (for a filter). */
1946
+ tags: BlogTag[];
1947
+ }
1948
+ interface BlogPostDetail {
1949
+ slug: string;
1950
+ blogHandle: string;
1951
+ blogName: string;
1952
+ title: string;
1953
+ excerpt: string | null;
1954
+ /** `{format: "html", html}` sanitised by the API; render with RichText. */
1955
+ content: {
1956
+ format?: string;
1957
+ html?: string;
1958
+ } & Record<string, unknown>;
1959
+ coverUrl: string | null;
1960
+ publishedAt: number | null;
1961
+ updatedAt: number | null;
1962
+ readingTimeMin: number | null;
1963
+ authorName: string | null;
1964
+ tags: BlogTag[];
1965
+ seoTitle: string | null;
1966
+ seoDescription: string | null;
1967
+ ogImage: string | null;
1968
+ /** Other posts of the same blog. */
1969
+ related: BlogPostListItem[];
1970
+ }
1971
+ interface BlogPostsQuery {
1972
+ locale?: string;
1973
+ page?: number;
1974
+ limit?: number;
1975
+ /** Filter by tag slug. */
1976
+ tag?: string;
1977
+ }
1978
+ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "select" | "radio" | "checkbox" | "multiselect" | "date"
1979
+ /** "HH:MM" */
1980
+ | "time"
1981
+ /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
1982
+ | "datetime"
1983
+ /** http(s) address */
1984
+ | "url" | "hidden";
1985
+ interface SiteFormFieldOption {
1986
+ value: string;
1987
+ label: string;
1988
+ }
1989
+ /** One field of a merchant-defined form; render it by `type`. */
1990
+ interface SiteFormField {
1991
+ /** Key in the submitted `data` object (lowercase, underscores). */
1992
+ key: string;
1993
+ type: SiteFormFieldType;
1994
+ label: string;
1995
+ placeholder?: string;
1996
+ /** Help line under the field. */
1997
+ help?: string;
1998
+ required: boolean;
1999
+ /** Present for select / radio / multiselect. */
2000
+ options?: SiteFormFieldOption[];
2001
+ /** Number: min/max value. Text: min/max length. */
2002
+ min?: number;
2003
+ max?: number;
2004
+ /** Regular expression for text fields (without slashes). */
2005
+ pattern?: string;
2006
+ /** Layout hint: "half" fields sit side by side on wide screens. */
2007
+ width?: "full" | "half";
2008
+ /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
2009
+ defaultValue?: string;
2010
+ }
2011
+ interface StorefrontFormSettings {
2012
+ submitLabel?: string;
2013
+ /** Shown after a successful submit (also returned as `message`). */
2014
+ successMessage?: string;
2015
+ /** When set, redirect the visitor here after a successful submit. */
2016
+ redirectUrl?: string;
2017
+ /** Text of the consent checkbox. */
2018
+ consentText?: string;
2019
+ /** When true, `consent: true` is required for the submit to pass. */
2020
+ requireConsent?: boolean;
2021
+ }
2022
+ /** Public definition of a form (`GET /forms/{slug}`). */
2023
+ interface StorefrontForm {
2024
+ slug: string;
2025
+ name: string;
2026
+ description: string | null;
2027
+ fields: SiteFormField[];
2028
+ settings: StorefrontFormSettings;
2029
+ }
2030
+ interface StorefrontFormSubmitInput {
2031
+ /** `{fieldKey: value}`; unknown keys are dropped server-side. */
2032
+ data: Record<string, unknown>;
2033
+ locale?: string;
2034
+ /** URL of the page the form was submitted from (context for the merchant). */
2035
+ page?: string;
2036
+ /** Consent checkbox state (required when `settings.requireConsent`). */
2037
+ consent?: boolean;
2038
+ /**
2039
+ * Honeypot. Render it as a visually hidden input and pass its value through
2040
+ * untouched: a filled value is answered like a success but stored nowhere.
2041
+ */
2042
+ website?: string;
2043
+ }
2044
+ interface StorefrontFormSubmitResult {
2045
+ ok: boolean;
2046
+ /** Id of the stored submission (null when the form does not store responses). */
2047
+ id: string | null;
2048
+ /** `settings.successMessage`, when set. */
2049
+ message: string | null;
2050
+ /** `settings.redirectUrl`, when set. */
2051
+ redirectUrl: string | null;
2052
+ }
2053
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2054
+ /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2055
+ interface StorefrontFormFieldError {
2056
+ key: string;
2057
+ code: StorefrontFormFieldErrorCode;
2058
+ }
1760
2059
  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";
1761
2060
  declare class BehioApiError extends Error {
1762
2061
  readonly code: BehioErrorCode;
@@ -1944,11 +2243,6 @@ interface ShippingQuote extends ShippingMethodSummary {
1944
2243
  /** Quote expiry (epoch ms). Null for fixed-price methods. */
1945
2244
  expiresAt: number | null;
1946
2245
  }
1947
- /**
1948
- * A pickup point (parcel shop / locker) for a shipping method with
1949
- * `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
1950
- * then send the chosen `externalId` as `checkout.pickupPointId`.
1951
- */
1952
2246
  interface PickupPoint {
1953
2247
  /** Carrier-native id. Send this back as `checkout.pickupPointId`. */
1954
2248
  externalId: string;
@@ -2116,6 +2410,10 @@ interface GiftCardPurchaseInput {
2116
2410
  personalMessage?: string;
2117
2411
  /** Online payment method id (from listPaymentMethods) to start payment right away. */
2118
2412
  paymentMethodId?: string;
2413
+ /** Instrument `code` of the chosen method (SDK 1.14.0), see `CheckoutInput.paymentInstrument`. */
2414
+ paymentInstrument?: string;
2415
+ /** Bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0). */
2416
+ paymentSwift?: string;
2119
2417
  locale?: string;
2120
2418
  }
2121
2419
  interface GiftCardPurchaseResult {
@@ -2400,6 +2698,8 @@ declare class BehioStorefront {
2400
2698
  readonly orders: OrdersModule;
2401
2699
  readonly customer: CustomerModule;
2402
2700
  readonly pages: PagesModule;
2701
+ readonly blog: BlogModule;
2702
+ readonly forms: FormsModule;
2403
2703
  readonly wishlist: WishlistModule;
2404
2704
  readonly reviews: ReviewsModule;
2405
2705
  readonly returns: ReturnsModule;
@@ -2589,6 +2889,7 @@ declare class CatalogModule {
2589
2889
  getProduct(slug: string, options?: {
2590
2890
  locale?: string;
2591
2891
  currency?: string;
2892
+ country?: string;
2592
2893
  }): Promise<SdkResult<ProductDetail>>;
2593
2894
  /**
2594
2895
  * URLs for the sitemap, already filtered by the merchant's indexing choice
@@ -2711,9 +3012,25 @@ declare class CatalogModule {
2711
3012
  * code is generated and emailed to the recipient once the order is paid.
2712
3013
  */
2713
3014
  purchaseGiftCard(input: GiftCardPurchaseInput): Promise<SdkResult<GiftCardPurchaseResult>>;
2714
- /** List configured payment methods (filtered by currency). */
3015
+ /**
3016
+ * List configured payment methods (filtered by currency). `locale` picks the
3017
+ * language of `instruments[].label` / `swifts[].label` (SDK 1.14.0); pass the
3018
+ * locale of the page so the instrument tiles read in the shopper's language.
3019
+ */
2715
3020
  listPaymentMethods(opts?: {
2716
3021
  currency?: string;
3022
+ locale?: string;
3023
+ /** Delivery country (ISO): hides methods not valid there, orders them per country. SDK 1.15.0 */
3024
+ country?: string;
3025
+ /** Chosen shipping method: hides cash on delivery when the carrier cannot do it. SDK 1.15.0 */
3026
+ shippingMethodId?: string;
3027
+ }): Promise<SdkResult<{
3028
+ items: CheckoutPaymentMethod[];
3029
+ }>>;
3030
+ /** Alias of `listPaymentMethods` (SDK 1.14.0). */
3031
+ paymentMethods(opts?: {
3032
+ currency?: string;
3033
+ locale?: string;
2717
3034
  }): Promise<SdkResult<{
2718
3035
  items: CheckoutPaymentMethod[];
2719
3036
  }>>;
@@ -2763,6 +3080,22 @@ declare class CartModule {
2763
3080
  * ```
2764
3081
  */
2765
3082
  setCurrency(currency: string): Promise<SdkResult<Cart>>;
3083
+ /**
3084
+ * Tell the cart where the order will ship (and, for B2B, the buyer's VAT
3085
+ * ID) so the VAT breakdown matches the checkout before the address form:
3086
+ * destination-country rate (OSS), 0 % export outside the EU, or reverse
3087
+ * charge for an EU business with a VIES-valid VAT ID. `cart.vatMode` says
3088
+ * which rule applied. SDK 1.17.0.
3089
+ *
3090
+ * ```ts
3091
+ * await client.cart.setDestination({ country: "SK" });
3092
+ * await client.cart.setDestination({ vatId: "SK2020000001" }); // "" clears
3093
+ * ```
3094
+ */
3095
+ setDestination(input: {
3096
+ country?: string;
3097
+ vatId?: string | null;
3098
+ }): Promise<SdkResult<Cart>>;
2766
3099
  /** Update item quantity */
2767
3100
  updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
2768
3101
  /** Remove item from cart */
@@ -2815,6 +3148,27 @@ declare class CheckoutModule {
2815
3148
  declare class OrdersModule {
2816
3149
  private client;
2817
3150
  constructor(client: BehioStorefront);
3151
+ /**
3152
+ * Ask the backend to re-check this order's payment with the gateway.
3153
+ *
3154
+ * Call it on the thank-you page the customer lands on after paying, BEFORE
3155
+ * you read the order. Some gateways (Tatrapay+) have no server-to-server
3156
+ * notification at all, so the customer's return is the only fast way the
3157
+ * payment gets confirmed; for the others it is a safety net for a lost
3158
+ * notification.
3159
+ *
3160
+ * The response is deliberately opaque (`{ok: true}` every time, even for an
3161
+ * order number that does not exist): order numbers are sequential, so
3162
+ * anything else would turn this into a probe for other people's orders.
3163
+ * Read the actual state afterwards through a path that proves entitlement
3164
+ * ({@link get}, {@link track} or the guest access-code flow).
3165
+ *
3166
+ * Never throws for a missing order and never blocks the page: treat a
3167
+ * failure as "not confirmed yet", the backend poller catches up on its own.
3168
+ */
3169
+ syncPaymentOnReturn(orderNumber: string): Promise<SdkResult<{
3170
+ ok: boolean;
3171
+ }>>;
2818
3172
  /** List customer orders (requires auth) */
2819
3173
  list(options?: {
2820
3174
  page?: number;
@@ -2872,9 +3226,12 @@ declare class CustomerModule {
2872
3226
  items: CustomerAddress[];
2873
3227
  }>>;
2874
3228
  /** Create address */
2875
- createAddress(address: Omit<CustomerAddress, "id">): Promise<SdkResult<CustomerAddress>>;
2876
- /** Update address */
2877
- updateAddress(addressId: string, data: Partial<CustomerAddress>): Promise<SdkResult<CustomerAddress>>;
3229
+ createAddress(address: Omit<CustomerAddress, "id" | "vatIdValid" | "vatIdCheckedAt">): Promise<SdkResult<CustomerAddress>>;
3230
+ /**
3231
+ * Update address. Partial: `{isDefault: true}` alone is a valid body. A
3232
+ * changed `vatId` or `country` re-runs the VIES check on the server.
3233
+ */
3234
+ updateAddress(addressId: string, data: Partial<Omit<CustomerAddress, "id" | "vatIdValid" | "vatIdCheckedAt">>): Promise<SdkResult<CustomerAddress>>;
2878
3235
  /** Delete address */
2879
3236
  deleteAddress(addressId: string): Promise<SdkResult<void>>;
2880
3237
  /**
@@ -2995,6 +3352,37 @@ declare class PagesModule {
2995
3352
  /** Get page by slug */
2996
3353
  get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
2997
3354
  }
3355
+ declare class BlogModule {
3356
+ private client;
3357
+ constructor(client: BehioStorefront);
3358
+ /** List the site's blogs (active only). */
3359
+ list(locale?: string): Promise<SdkResult<{
3360
+ blogs: Blog[];
3361
+ }>>;
3362
+ /** Published posts of one blog, newest first (featured first), paginated. */
3363
+ posts(handle: string, query?: BlogPostsQuery): Promise<SdkResult<BlogPostsPage>>;
3364
+ /** One published post with sanitised HTML content and related posts. */
3365
+ post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
3366
+ }
3367
+ /**
3368
+ * Merchant-defined forms (contact, demand, registration to an event...).
3369
+ * The definition is public and cacheable; a submit is validated server-side
3370
+ * against it, so the browser-side checks are only a courtesy. Works with
3371
+ * website keys that have no e-shop attached.
3372
+ */
3373
+ declare class FormsModule {
3374
+ private client;
3375
+ constructor(client: BehioStorefront);
3376
+ /** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
3377
+ get(slug: string): Promise<SdkResult<StorefrontForm>>;
3378
+ /**
3379
+ * Submit a response. On `be.forms.validationFailed` the returned error
3380
+ * carries per-field codes: read them with `formFieldErrors(error)`. Other
3381
+ * rejections: `be.forms.consentRequired`, `be.forms.tooLarge`,
3382
+ * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3383
+ */
3384
+ submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3385
+ }
2998
3386
  declare class WishlistModule {
2999
3387
  private client;
3000
3388
  constructor(client: BehioStorefront);
@@ -3705,12 +4093,18 @@ interface UsePaymentMethodsOptions {
3705
4093
  /** ISO 4217 code; defaults to the active currency. Methods that do not
3706
4094
  * support the currency are filtered out server-side. */
3707
4095
  currency?: string;
4096
+ /** Language of `instruments[].label` / `swifts[].label` (SDK 1.14.0);
4097
+ * pass the page locale so instrument tiles read in the shopper's language. */
4098
+ locale?: string;
3708
4099
  enabled?: boolean;
3709
4100
  }
3710
4101
  /**
3711
4102
  * Merchant payment methods for the checkout (GAP-20). `publicConfig` carries
3712
4103
  * customer-safe provider hints (e.g. `redirectFlow`, `offline`, bank account
3713
- * for transfers); `fee` is the optional payment surcharge.
4104
+ * for transfers); `fee` is the optional payment surcharge. `instruments`
4105
+ * (SDK 1.14.0) lists the gateway's concrete instruments (card, Google Pay,
4106
+ * Apple Pay, bank transfer with a bank grid) that the customer picks in the
4107
+ * checkout; `null` means the method has none.
3714
4108
  */
3715
4109
  declare function usePaymentMethods(options?: UsePaymentMethodsOptions): {
3716
4110
  methods: CheckoutPaymentMethod[];
@@ -3957,6 +4351,55 @@ interface UsePageOptions {
3957
4351
  }
3958
4352
  declare function usePage(slug: string, locale?: string, options?: UsePageOptions): _tanstack_react_query.UseQueryResult<NoInfer<PageDetail>, Error>;
3959
4353
 
4354
+ interface UseBlogsOptions {
4355
+ enabled?: boolean;
4356
+ }
4357
+ /** All active blogs of the site (a site can have several). */
4358
+ declare function useBlogs(locale?: string, options?: UseBlogsOptions): _tanstack_react_query.UseQueryResult<NoInfer<Blog[]>, Error>;
4359
+ interface UseBlogPostsOptions {
4360
+ enabled?: boolean;
4361
+ }
4362
+ /** Published posts of one blog, paginated; `query.tag` filters by tag slug. */
4363
+ declare function useBlogPosts(handle: string, query?: BlogPostsQuery, options?: UseBlogPostsOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostsPage>, Error>;
4364
+ interface UseBlogPostOptions {
4365
+ enabled?: boolean;
4366
+ }
4367
+ /** One published post (sanitised HTML content + related posts). */
4368
+ declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
4369
+
4370
+ interface UseSiteFormOptions {
4371
+ enabled?: boolean;
4372
+ }
4373
+ /** Public definition of a merchant-defined form (fields + settings). */
4374
+ declare function useSiteForm(slug: string, options?: UseSiteFormOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontForm>, Error>;
4375
+ /**
4376
+ * Submit state of one form. `fieldErrors` maps a field key to its validation
4377
+ * code (`required`, `invalid`, `tooShort`, `tooLong`, `min`, `max`,
4378
+ * `notOption`, `pattern`) after a rejected submit; `errorCode` is the
4379
+ * backend key (`be.forms.consentRequired`, `be.forms.validationFailed`, ...)
4380
+ * for everything that is not tied to a single field.
4381
+ *
4382
+ * const form = useSiteFormSubmit("contact");
4383
+ * await form.submit({data, consent, website: honeypot});
4384
+ * if (form.isSuccess) show(form.result?.message);
4385
+ * form.fieldErrors.email === "invalid"
4386
+ */
4387
+ declare function useSiteFormSubmit(slug: string): {
4388
+ /** Resolves to the result, or null when the submit was rejected (see `fieldErrors` / `errorCode`). */
4389
+ submit: (input: StorefrontFormSubmitInput) => Promise<StorefrontFormSubmitResult | null>;
4390
+ isSubmitting: boolean;
4391
+ isSuccess: boolean;
4392
+ /** `{ok, id, message, redirectUrl}` after a successful submit. */
4393
+ result: StorefrontFormSubmitResult | null;
4394
+ /** Field key -> validation code after a rejected submit. */
4395
+ fieldErrors: Record<string, StorefrontFormFieldErrorCode>;
4396
+ /** Backend error key (`be.forms.*`) or SDK code when the rejection is not per field. */
4397
+ errorCode: string | null;
4398
+ /** Raw SDK error (pass to `errorMessage(error, locale)` for a sentence). */
4399
+ error: SdkError | null;
4400
+ reset: () => void;
4401
+ };
4402
+
3960
4403
  interface UseShopInfoOptions {
3961
4404
  enabled?: boolean;
3962
4405
  }
@@ -4753,4 +5196,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
4753
5196
  success: boolean;
4754
5197
  }>>;
4755
5198
 
4756
- export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentStatus, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type StorageAdapter, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };
5199
+ export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Blog, type BlogPostDetail, type BlogPostListItem, type BlogPostsPage, type BlogPostsQuery, type BlogSettings, type BlogTag, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentInstrument, type PaymentStatus, type PaymentSwift, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type SiteFormField, type SiteFormFieldOption, type SiteFormFieldType, type StorageAdapter, type StorefrontForm, type StorefrontFormFieldError, type StorefrontFormFieldErrorCode, type StorefrontFormSettings, type StorefrontFormSubmitInput, type StorefrontFormSubmitResult, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseBlogPostOptions, type UseBlogPostsOptions, type UseBlogsOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSiteFormOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBlogPost, useBlogPosts, useBlogs, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSiteForm, useSiteFormSubmit, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };