@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/dist/next.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-C635vSzU.mjs';
1
+ import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-yo90ANGT.mjs';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-C635vSzU.js';
1
+ import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-yo90ANGT.js';
2
2
 
3
3
  interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
4
4
  /** Override the cart session cookie name (default: "behio_cart_session"). */
package/dist/next.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkCY6D2YEIjs = require('./chunk-CY6D2YEI.js');
3
+ var _chunkFMMFIZHAjs = require('./chunk-FMMFIZHA.js');
4
4
 
5
5
  // src/next.ts
6
6
  var _headers = require('next/headers');
@@ -18,7 +18,7 @@ async function getBehio(options = {}) {
18
18
  const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
19
19
  const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
20
20
  const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
21
- const client = new (0, _chunkCY6D2YEIjs.BehioStorefront)({
21
+ const client = new (0, _chunkFMMFIZHAjs.BehioStorefront)({
22
22
  apiKey,
23
23
  ...baseUrl ? { baseUrl } : {},
24
24
  ...locale ? { locale } : {},
package/dist/next.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  BehioStorefront
3
- } from "./chunk-XMKY4RI5.mjs";
3
+ } from "./chunk-PU4QV6JS.mjs";
4
4
 
5
5
  // src/next.ts
6
6
  import { cookies, headers } from "next/headers";
package/dist/react.d.mts 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;
@@ -1204,20 +1265,48 @@ interface Cart {
1204
1265
  id: string;
1205
1266
  sessionToken?: string;
1206
1267
  items: CartItem[];
1268
+ /** Sum of the lines at catalog prices: VAT included when the shop runs
1269
+ * `INCL_VAT`, VAT excluded when it runs `EXCL_VAT`. Not the payable amount,
1270
+ * that is `grandTotal`. */
1207
1271
  subtotal: number;
1272
+ /** Discount from the applied code. Always based on `subtotal`, i.e. on the
1273
+ * prices the customer sees, so "10 % off 200" is 20 in both price modes. */
1208
1274
  discountTotal: number;
1209
1275
  discount?: CartDiscount;
1210
1276
  /** Auto-apply promotion discount lines (sale/BOGO). */
1211
1277
  appliedPromotions: CartPromotion[];
1212
1278
  /** Sum of `appliedPromotions[].discountAmount`; already reflected in `grandTotal`. */
1213
1279
  promotionDiscountTotal: number;
1280
+ /** THE PAYABLE AMOUNT for the goods, VAT included, after discounts. This is
1281
+ * exactly what the customer pays for the cart lines, minus shipping and the
1282
+ * payment-method fee (both chosen at checkout and added to
1283
+ * `order.grandTotal`).
1284
+ *
1285
+ * `grandTotal = netSubtotal + taxTotal - discounts` holds in BOTH price
1286
+ * modes: under `INCL_VAT` the VAT is extracted out of the price (the sum is
1287
+ * back to the catalog price), under `EXCL_VAT` it is added on top. Render
1288
+ * this as the cart total; do not add `taxTotal` to it. */
1214
1289
  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. */
1290
+ /** VAT contained in the prices (`INCL_VAT`) or added on top of them
1291
+ * (`EXCL_VAT`), across all lines (GAP-30). An estimate finalized at checkout
1292
+ * once the shipping country is known. */
1217
1293
  taxTotal: number;
1218
1294
  /** VAT split by rate for "DPH 21 %: X Kč" summary rows. Empty for a
1219
1295
  * non-VAT-payer shop. */
1220
1296
  taxBreakdown: TaxBreakdownLine[];
1297
+ /** Delivery country set via `cart.setDestination()`, null until known. SDK 1.17.0. */
1298
+ shippingCountry: string | null;
1299
+ /**
1300
+ * Which VAT rule the cart uses: `DOMESTIC` (home rate), `OSS` (delivery
1301
+ * country rate), `REVERSE_CHARGE` (EU business with a valid VAT ID, 0 %),
1302
+ * `EXPORT` (outside the EU, 0 %). Show a note for the last two: the
1303
+ * breakdown is empty then. SDK 1.17.0.
1304
+ */
1305
+ vatMode: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT";
1306
+ /** B2B VAT ID set via `cart.setDestination()`. */
1307
+ vatId: string | null;
1308
+ /** VIES result for `vatId`: true valid, false invalid or unverifiable, null not given. */
1309
+ vatIdValid: boolean | null;
1221
1310
  currency: string;
1222
1311
  itemCount: number;
1223
1312
  /** Applied gift cards (multi). They deduct at checkout (consumed in order, each
@@ -1275,6 +1364,8 @@ interface CheckoutAddress {
1275
1364
  street: string;
1276
1365
  city: string;
1277
1366
  zip: string;
1367
+ /** State / province where the country needs it (US, CA, AU, BR, IN, MX). SDK 1.17.0. */
1368
+ state?: string;
1278
1369
  country: string;
1279
1370
  phone?: string;
1280
1371
  }
@@ -1299,6 +1390,14 @@ interface CheckoutInput {
1299
1390
  termsConsent?: boolean;
1300
1391
  gdprConsent?: boolean;
1301
1392
  newsletterOptIn?: boolean;
1393
+ /**
1394
+ * Consent to marketing SMS, from the optional checkout checkbox. Render it
1395
+ * only when `ShopInfo.checkout.collectSmsConsent` is true; shops that do not
1396
+ * collect consent ignore the flag. The consent is stored against the phone
1397
+ * number on the created order, so it needs a usable phone in the order or
1398
+ * the shipping address, and it never blocks or fails the order.
1399
+ */
1400
+ smsConsent?: boolean;
1302
1401
  /**
1303
1402
  * Chosen shipping method. Required whenever the eshop has at least one
1304
1403
  * enabled shipping method — the backend rejects the order without it.
@@ -1318,7 +1417,33 @@ interface CheckoutInput {
1318
1417
  * the backend rejects the order without it. Snapshotted onto the order.
1319
1418
  */
1320
1419
  pickupPointId?: string;
1420
+ /**
1421
+ * Snapshot of the chosen point when it came from a carrier widget and may
1422
+ * not be in Behio's cache yet (Packeta serves partner points too). Sent
1423
+ * along with `pickupPointId`; ignored when the cache knows the point.
1424
+ * SDK 1.16.0.
1425
+ */
1426
+ pickupPoint?: {
1427
+ name: string;
1428
+ street?: string;
1429
+ city?: string;
1430
+ zip?: string;
1431
+ country?: string;
1432
+ };
1321
1433
  paymentMethodId?: string;
1434
+ /**
1435
+ * Chosen instrument `code` of the payment method (SDK 1.14.0), e.g.
1436
+ * "PAYMENT_CARD" | "GPAY" | "APPLE_PAY" | "BANK_ACCOUNT". Send it whenever the
1437
+ * chosen method lists `instruments`; the gateway is then opened directly on
1438
+ * that instrument. An instrument the method does not offer returns 400
1439
+ * (`be.storefront.paymentInstrumentInvalid`).
1440
+ */
1441
+ paymentInstrument?: string;
1442
+ /**
1443
+ * Chosen bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0),
1444
+ * from `PaymentInstrument.swifts[].code`. Ignored for other instruments.
1445
+ */
1446
+ paymentSwift?: string;
1322
1447
  /**
1323
1448
  * Loyalty points to redeem on this order. Validated server-side against the
1324
1449
  * customer's actual balance and the program's redemption cap; ignored for
@@ -1386,6 +1511,8 @@ interface OrderDetail extends OrderListItem {
1386
1511
  /** VAT split by rate (GAP-30), summed from the order lines. Render
1387
1512
  * "DPH 21 %: X Kč" rows. Empty for a non-VAT order. */
1388
1513
  taxBreakdown: TaxBreakdownLine[];
1514
+ /** DOMESTIC, OSS, REVERSE_CHARGE (no VAT, buyer accounts for it) or EXPORT (no VAT, outside EU). SDK 1.17.0. */
1515
+ vatMode?: "DOMESTIC" | "OSS" | "REVERSE_CHARGE" | "EXPORT" | null;
1389
1516
  shippingTotal: number;
1390
1517
  discountTotal: number;
1391
1518
  fulfillmentStatus: FulfillmentStatus;
@@ -1757,6 +1884,159 @@ interface PageAttachment {
1757
1884
  mimeType: string;
1758
1885
  fileSize: number;
1759
1886
  }
1887
+ interface BlogSettings {
1888
+ postsPerPage?: number;
1889
+ showAuthor?: boolean;
1890
+ showReadingTime?: boolean;
1891
+ showTags?: boolean;
1892
+ layout?: "grid" | "list" | "magazine";
1893
+ }
1894
+ /** One blog (a group of posts). A site can have several: news, recipes, stories. */
1895
+ interface Blog {
1896
+ /** URL segment: /blog/{handle} */
1897
+ handle: string;
1898
+ name: string;
1899
+ description: string | null;
1900
+ postCount: number;
1901
+ settings: BlogSettings;
1902
+ /** Latest publish time (epoch ms), for sitemaps. */
1903
+ updatedAt: number | null;
1904
+ }
1905
+ interface BlogTag {
1906
+ slug: string;
1907
+ name: string;
1908
+ }
1909
+ interface BlogPostListItem {
1910
+ slug: string;
1911
+ title: string;
1912
+ excerpt: string | null;
1913
+ coverUrl: string | null;
1914
+ publishedAt: number | null;
1915
+ readingTimeMin: number | null;
1916
+ authorName: string | null;
1917
+ isFeatured: boolean;
1918
+ tags: BlogTag[];
1919
+ }
1920
+ interface BlogPostsPage {
1921
+ items: BlogPostListItem[];
1922
+ total: number;
1923
+ page: number;
1924
+ limit: number;
1925
+ totalPages: number;
1926
+ /** Tags of the blog (for a filter). */
1927
+ tags: BlogTag[];
1928
+ }
1929
+ interface BlogPostDetail {
1930
+ slug: string;
1931
+ blogHandle: string;
1932
+ blogName: string;
1933
+ title: string;
1934
+ excerpt: string | null;
1935
+ /** `{format: "html", html}` sanitised by the API; render with RichText. */
1936
+ content: {
1937
+ format?: string;
1938
+ html?: string;
1939
+ } & Record<string, unknown>;
1940
+ coverUrl: string | null;
1941
+ publishedAt: number | null;
1942
+ updatedAt: number | null;
1943
+ readingTimeMin: number | null;
1944
+ authorName: string | null;
1945
+ tags: BlogTag[];
1946
+ seoTitle: string | null;
1947
+ seoDescription: string | null;
1948
+ ogImage: string | null;
1949
+ /** Other posts of the same blog. */
1950
+ related: BlogPostListItem[];
1951
+ }
1952
+ interface BlogPostsQuery {
1953
+ locale?: string;
1954
+ page?: number;
1955
+ limit?: number;
1956
+ /** Filter by tag slug. */
1957
+ tag?: string;
1958
+ }
1959
+ type SiteFormFieldType = "text" | "email" | "phone" | "textarea" | "number" | "select" | "radio" | "checkbox" | "multiselect" | "date"
1960
+ /** "HH:MM" */
1961
+ | "time"
1962
+ /** "YYYY-MM-DDTHH:MM" without a zone, as `<input type="datetime-local">` */
1963
+ | "datetime"
1964
+ /** http(s) address */
1965
+ | "url" | "hidden";
1966
+ interface SiteFormFieldOption {
1967
+ value: string;
1968
+ label: string;
1969
+ }
1970
+ /** One field of a merchant-defined form; render it by `type`. */
1971
+ interface SiteFormField {
1972
+ /** Key in the submitted `data` object (lowercase, underscores). */
1973
+ key: string;
1974
+ type: SiteFormFieldType;
1975
+ label: string;
1976
+ placeholder?: string;
1977
+ /** Help line under the field. */
1978
+ help?: string;
1979
+ required: boolean;
1980
+ /** Present for select / radio / multiselect. */
1981
+ options?: SiteFormFieldOption[];
1982
+ /** Number: min/max value. Text: min/max length. */
1983
+ min?: number;
1984
+ max?: number;
1985
+ /** Regular expression for text fields (without slashes). */
1986
+ pattern?: string;
1987
+ /** Layout hint: "half" fields sit side by side on wide screens. */
1988
+ width?: "full" | "half";
1989
+ /** Value of hidden fields (source, campaign) or a prefill for visible ones. */
1990
+ defaultValue?: string;
1991
+ }
1992
+ interface StorefrontFormSettings {
1993
+ submitLabel?: string;
1994
+ /** Shown after a successful submit (also returned as `message`). */
1995
+ successMessage?: string;
1996
+ /** When set, redirect the visitor here after a successful submit. */
1997
+ redirectUrl?: string;
1998
+ /** Text of the consent checkbox. */
1999
+ consentText?: string;
2000
+ /** When true, `consent: true` is required for the submit to pass. */
2001
+ requireConsent?: boolean;
2002
+ }
2003
+ /** Public definition of a form (`GET /forms/{slug}`). */
2004
+ interface StorefrontForm {
2005
+ slug: string;
2006
+ name: string;
2007
+ description: string | null;
2008
+ fields: SiteFormField[];
2009
+ settings: StorefrontFormSettings;
2010
+ }
2011
+ interface StorefrontFormSubmitInput {
2012
+ /** `{fieldKey: value}`; unknown keys are dropped server-side. */
2013
+ data: Record<string, unknown>;
2014
+ locale?: string;
2015
+ /** URL of the page the form was submitted from (context for the merchant). */
2016
+ page?: string;
2017
+ /** Consent checkbox state (required when `settings.requireConsent`). */
2018
+ consent?: boolean;
2019
+ /**
2020
+ * Honeypot. Render it as a visually hidden input and pass its value through
2021
+ * untouched: a filled value is answered like a success but stored nowhere.
2022
+ */
2023
+ website?: string;
2024
+ }
2025
+ interface StorefrontFormSubmitResult {
2026
+ ok: boolean;
2027
+ /** Id of the stored submission (null when the form does not store responses). */
2028
+ id: string | null;
2029
+ /** `settings.successMessage`, when set. */
2030
+ message: string | null;
2031
+ /** `settings.redirectUrl`, when set. */
2032
+ redirectUrl: string | null;
2033
+ }
2034
+ type StorefrontFormFieldErrorCode = "required" | "invalid" | "tooShort" | "tooLong" | "min" | "max" | "notOption" | "pattern";
2035
+ /** One per-field validation error of a rejected submit (`be.forms.validationFailed`). */
2036
+ interface StorefrontFormFieldError {
2037
+ key: string;
2038
+ code: StorefrontFormFieldErrorCode;
2039
+ }
1760
2040
  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
2041
  declare class BehioApiError extends Error {
1762
2042
  readonly code: BehioErrorCode;
@@ -1944,11 +2224,6 @@ interface ShippingQuote extends ShippingMethodSummary {
1944
2224
  /** Quote expiry (epoch ms). Null for fixed-price methods. */
1945
2225
  expiresAt: number | null;
1946
2226
  }
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
2227
  interface PickupPoint {
1953
2228
  /** Carrier-native id. Send this back as `checkout.pickupPointId`. */
1954
2229
  externalId: string;
@@ -2116,6 +2391,10 @@ interface GiftCardPurchaseInput {
2116
2391
  personalMessage?: string;
2117
2392
  /** Online payment method id (from listPaymentMethods) to start payment right away. */
2118
2393
  paymentMethodId?: string;
2394
+ /** Instrument `code` of the chosen method (SDK 1.14.0), see `CheckoutInput.paymentInstrument`. */
2395
+ paymentInstrument?: string;
2396
+ /** Bank SWIFT for `paymentInstrument: "BANK_ACCOUNT"` (SDK 1.14.0). */
2397
+ paymentSwift?: string;
2119
2398
  locale?: string;
2120
2399
  }
2121
2400
  interface GiftCardPurchaseResult {
@@ -2400,6 +2679,8 @@ declare class BehioStorefront {
2400
2679
  readonly orders: OrdersModule;
2401
2680
  readonly customer: CustomerModule;
2402
2681
  readonly pages: PagesModule;
2682
+ readonly blog: BlogModule;
2683
+ readonly forms: FormsModule;
2403
2684
  readonly wishlist: WishlistModule;
2404
2685
  readonly reviews: ReviewsModule;
2405
2686
  readonly returns: ReturnsModule;
@@ -2711,9 +2992,25 @@ declare class CatalogModule {
2711
2992
  * code is generated and emailed to the recipient once the order is paid.
2712
2993
  */
2713
2994
  purchaseGiftCard(input: GiftCardPurchaseInput): Promise<SdkResult<GiftCardPurchaseResult>>;
2714
- /** List configured payment methods (filtered by currency). */
2995
+ /**
2996
+ * List configured payment methods (filtered by currency). `locale` picks the
2997
+ * language of `instruments[].label` / `swifts[].label` (SDK 1.14.0); pass the
2998
+ * locale of the page so the instrument tiles read in the shopper's language.
2999
+ */
2715
3000
  listPaymentMethods(opts?: {
2716
3001
  currency?: string;
3002
+ locale?: string;
3003
+ /** Delivery country (ISO): hides methods not valid there, orders them per country. SDK 1.15.0 */
3004
+ country?: string;
3005
+ /** Chosen shipping method: hides cash on delivery when the carrier cannot do it. SDK 1.15.0 */
3006
+ shippingMethodId?: string;
3007
+ }): Promise<SdkResult<{
3008
+ items: CheckoutPaymentMethod[];
3009
+ }>>;
3010
+ /** Alias of `listPaymentMethods` (SDK 1.14.0). */
3011
+ paymentMethods(opts?: {
3012
+ currency?: string;
3013
+ locale?: string;
2717
3014
  }): Promise<SdkResult<{
2718
3015
  items: CheckoutPaymentMethod[];
2719
3016
  }>>;
@@ -2763,6 +3060,22 @@ declare class CartModule {
2763
3060
  * ```
2764
3061
  */
2765
3062
  setCurrency(currency: string): Promise<SdkResult<Cart>>;
3063
+ /**
3064
+ * Tell the cart where the order will ship (and, for B2B, the buyer's VAT
3065
+ * ID) so the VAT breakdown matches the checkout before the address form:
3066
+ * destination-country rate (OSS), 0 % export outside the EU, or reverse
3067
+ * charge for an EU business with a VIES-valid VAT ID. `cart.vatMode` says
3068
+ * which rule applied. SDK 1.17.0.
3069
+ *
3070
+ * ```ts
3071
+ * await client.cart.setDestination({ country: "SK" });
3072
+ * await client.cart.setDestination({ vatId: "SK2020000001" }); // "" clears
3073
+ * ```
3074
+ */
3075
+ setDestination(input: {
3076
+ country?: string;
3077
+ vatId?: string | null;
3078
+ }): Promise<SdkResult<Cart>>;
2766
3079
  /** Update item quantity */
2767
3080
  updateQuantity(itemId: string, quantity: number): Promise<SdkResult<Cart>>;
2768
3081
  /** Remove item from cart */
@@ -2815,6 +3128,27 @@ declare class CheckoutModule {
2815
3128
  declare class OrdersModule {
2816
3129
  private client;
2817
3130
  constructor(client: BehioStorefront);
3131
+ /**
3132
+ * Ask the backend to re-check this order's payment with the gateway.
3133
+ *
3134
+ * Call it on the thank-you page the customer lands on after paying, BEFORE
3135
+ * you read the order. Some gateways (Tatrapay+) have no server-to-server
3136
+ * notification at all, so the customer's return is the only fast way the
3137
+ * payment gets confirmed; for the others it is a safety net for a lost
3138
+ * notification.
3139
+ *
3140
+ * The response is deliberately opaque (`{ok: true}` every time, even for an
3141
+ * order number that does not exist): order numbers are sequential, so
3142
+ * anything else would turn this into a probe for other people's orders.
3143
+ * Read the actual state afterwards through a path that proves entitlement
3144
+ * ({@link get}, {@link track} or the guest access-code flow).
3145
+ *
3146
+ * Never throws for a missing order and never blocks the page: treat a
3147
+ * failure as "not confirmed yet", the backend poller catches up on its own.
3148
+ */
3149
+ syncPaymentOnReturn(orderNumber: string): Promise<SdkResult<{
3150
+ ok: boolean;
3151
+ }>>;
2818
3152
  /** List customer orders (requires auth) */
2819
3153
  list(options?: {
2820
3154
  page?: number;
@@ -2995,6 +3329,37 @@ declare class PagesModule {
2995
3329
  /** Get page by slug */
2996
3330
  get(slug: string, locale?: string): Promise<SdkResult<PageDetail>>;
2997
3331
  }
3332
+ declare class BlogModule {
3333
+ private client;
3334
+ constructor(client: BehioStorefront);
3335
+ /** List the site's blogs (active only). */
3336
+ list(locale?: string): Promise<SdkResult<{
3337
+ blogs: Blog[];
3338
+ }>>;
3339
+ /** Published posts of one blog, newest first (featured first), paginated. */
3340
+ posts(handle: string, query?: BlogPostsQuery): Promise<SdkResult<BlogPostsPage>>;
3341
+ /** One published post with sanitised HTML content and related posts. */
3342
+ post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
3343
+ }
3344
+ /**
3345
+ * Merchant-defined forms (contact, demand, registration to an event...).
3346
+ * The definition is public and cacheable; a submit is validated server-side
3347
+ * against it, so the browser-side checks are only a courtesy. Works with
3348
+ * website keys that have no e-shop attached.
3349
+ */
3350
+ declare class FormsModule {
3351
+ private client;
3352
+ constructor(client: BehioStorefront);
3353
+ /** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
3354
+ get(slug: string): Promise<SdkResult<StorefrontForm>>;
3355
+ /**
3356
+ * Submit a response. On `be.forms.validationFailed` the returned error
3357
+ * carries per-field codes: read them with `formFieldErrors(error)`. Other
3358
+ * rejections: `be.forms.consentRequired`, `be.forms.tooLarge`,
3359
+ * `be.forms.formNotFound`; rate limit 10 submits per minute per visitor.
3360
+ */
3361
+ submit(slug: string, input: StorefrontFormSubmitInput): Promise<SdkResult<StorefrontFormSubmitResult>>;
3362
+ }
2998
3363
  declare class WishlistModule {
2999
3364
  private client;
3000
3365
  constructor(client: BehioStorefront);
@@ -3705,12 +4070,18 @@ interface UsePaymentMethodsOptions {
3705
4070
  /** ISO 4217 code; defaults to the active currency. Methods that do not
3706
4071
  * support the currency are filtered out server-side. */
3707
4072
  currency?: string;
4073
+ /** Language of `instruments[].label` / `swifts[].label` (SDK 1.14.0);
4074
+ * pass the page locale so instrument tiles read in the shopper's language. */
4075
+ locale?: string;
3708
4076
  enabled?: boolean;
3709
4077
  }
3710
4078
  /**
3711
4079
  * Merchant payment methods for the checkout (GAP-20). `publicConfig` carries
3712
4080
  * customer-safe provider hints (e.g. `redirectFlow`, `offline`, bank account
3713
- * for transfers); `fee` is the optional payment surcharge.
4081
+ * for transfers); `fee` is the optional payment surcharge. `instruments`
4082
+ * (SDK 1.14.0) lists the gateway's concrete instruments (card, Google Pay,
4083
+ * Apple Pay, bank transfer with a bank grid) that the customer picks in the
4084
+ * checkout; `null` means the method has none.
3714
4085
  */
3715
4086
  declare function usePaymentMethods(options?: UsePaymentMethodsOptions): {
3716
4087
  methods: CheckoutPaymentMethod[];
@@ -3957,6 +4328,55 @@ interface UsePageOptions {
3957
4328
  }
3958
4329
  declare function usePage(slug: string, locale?: string, options?: UsePageOptions): _tanstack_react_query.UseQueryResult<NoInfer<PageDetail>, Error>;
3959
4330
 
4331
+ interface UseBlogsOptions {
4332
+ enabled?: boolean;
4333
+ }
4334
+ /** All active blogs of the site (a site can have several). */
4335
+ declare function useBlogs(locale?: string, options?: UseBlogsOptions): _tanstack_react_query.UseQueryResult<NoInfer<Blog[]>, Error>;
4336
+ interface UseBlogPostsOptions {
4337
+ enabled?: boolean;
4338
+ }
4339
+ /** Published posts of one blog, paginated; `query.tag` filters by tag slug. */
4340
+ declare function useBlogPosts(handle: string, query?: BlogPostsQuery, options?: UseBlogPostsOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostsPage>, Error>;
4341
+ interface UseBlogPostOptions {
4342
+ enabled?: boolean;
4343
+ }
4344
+ /** One published post (sanitised HTML content + related posts). */
4345
+ declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
4346
+
4347
+ interface UseSiteFormOptions {
4348
+ enabled?: boolean;
4349
+ }
4350
+ /** Public definition of a merchant-defined form (fields + settings). */
4351
+ declare function useSiteForm(slug: string, options?: UseSiteFormOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontForm>, Error>;
4352
+ /**
4353
+ * Submit state of one form. `fieldErrors` maps a field key to its validation
4354
+ * code (`required`, `invalid`, `tooShort`, `tooLong`, `min`, `max`,
4355
+ * `notOption`, `pattern`) after a rejected submit; `errorCode` is the
4356
+ * backend key (`be.forms.consentRequired`, `be.forms.validationFailed`, ...)
4357
+ * for everything that is not tied to a single field.
4358
+ *
4359
+ * const form = useSiteFormSubmit("contact");
4360
+ * await form.submit({data, consent, website: honeypot});
4361
+ * if (form.isSuccess) show(form.result?.message);
4362
+ * form.fieldErrors.email === "invalid"
4363
+ */
4364
+ declare function useSiteFormSubmit(slug: string): {
4365
+ /** Resolves to the result, or null when the submit was rejected (see `fieldErrors` / `errorCode`). */
4366
+ submit: (input: StorefrontFormSubmitInput) => Promise<StorefrontFormSubmitResult | null>;
4367
+ isSubmitting: boolean;
4368
+ isSuccess: boolean;
4369
+ /** `{ok, id, message, redirectUrl}` after a successful submit. */
4370
+ result: StorefrontFormSubmitResult | null;
4371
+ /** Field key -> validation code after a rejected submit. */
4372
+ fieldErrors: Record<string, StorefrontFormFieldErrorCode>;
4373
+ /** Backend error key (`be.forms.*`) or SDK code when the rejection is not per field. */
4374
+ errorCode: string | null;
4375
+ /** Raw SDK error (pass to `errorMessage(error, locale)` for a sentence). */
4376
+ error: SdkError | null;
4377
+ reset: () => void;
4378
+ };
4379
+
3960
4380
  interface UseShopInfoOptions {
3961
4381
  enabled?: boolean;
3962
4382
  }
@@ -4753,4 +5173,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
4753
5173
  success: boolean;
4754
5174
  }>>;
4755
5175
 
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 };
5176
+ 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 };