@behio/storefront-sdk 0.31.1 → 0.33.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.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 _chunkNG46DR3Ajs = require('./chunk-NG46DR3A.js');
3
+ var _chunkY4ZCK5HDjs = require('./chunk-Y4ZCK5HD.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, _chunkNG46DR3Ajs.BehioStorefront)({
21
+ const client = new (0, _chunkY4ZCK5HDjs.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-O7HDB5R4.mjs";
3
+ } from "./chunk-5KJDVDUM.mjs";
4
4
 
5
5
  // src/next.ts
6
6
  import { cookies } from "next/headers";
package/dist/react.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, M as Menu, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, L as LoyaltySummary, k as PickupPointsInput, l as PickupPoint, N as NewsletterSubscribeResult, m as NewsletterSubscribeInput, n as NewsletterUnsubscribeResult, O as OrderListItem, o as OrderDetail, p as OrderAccessRequestResponse, q as OrderAccessVerifyResponse, r as CheckoutInput, s as PageDetail, t as Page, S as ShopInfo, u as ShopScripts, v as ShopSeo, w as Bundle, x as ProductGroup, y as CrossSellItem, z as ActivePromotion, G as GiftCardBalance, W as WishlistItem, D as ProductReviewsResponse, E as SubmitReviewInput, H as ReturnableOrder, I as ReturnStatus, J as ReturnRequest, K as SubmitReturnInput, Q as CookieConsent, T as CookieConsentInput, U as QuoteRequest, V as SubmitQuoteInput, X as BackInStockSubscription } from './client-D1GZSa-N.mjs';
5
- export { Y as AddToCartInput, Z as AuthTokens, _ as BehioApiError, $ as BundleItem, a0 as CartDiscount, a1 as CartItem, a2 as CheckoutAddress, a3 as FulfillmentStatus, a4 as LoginInput, a5 as MessageResponse, a6 as OrderItem, a7 as OrderStatus, a8 as PaymentStatus, a9 as ProductPrice, aa as ProductReview, ab as ProductVariant } from './client-D1GZSa-N.mjs';
4
+ import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, M as Menu, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, L as LoyaltySummary, S as Subscription, k as SubscriptionAction, l as PickupPointsInput, m as PickupPoint, n as ShippingMethodSummary, o as ShippingQuoteInput, p as ShippingQuote, q as CheckoutPaymentMethod, N as NewsletterSubscribeResult, r as NewsletterSubscribeInput, s as NewsletterUnsubscribeResult, O as OrderListItem, t as OrderDetail, u as OrderAccessRequestResponse, v as OrderAccessVerifyResponse, w as CheckoutInput, x as PageDetail, y as Page, z as ShopInfo, D as ShopScripts, E as ShopSeo, G as Bundle, H as ProductGroup, I as CrossSellItem, J as ActivePromotion, K as GiftCardBalance, W as WishlistItem, Q as ProductReviewsResponse, T as SubmitReviewInput, U as ReturnableOrder, V as ReturnStatus, X as ReturnRequest, Y as SubmitReturnInput, Z as CookieConsent, _ as CookieConsentInput, $ as QuoteRequest, a0 as SubmitQuoteInput, a1 as BackInStockSubscription } from './client-BQlF_Vn9.mjs';
5
+ export { a2 as AddToCartInput, a3 as AuthTokens, a4 as BehioApiError, a5 as BundleItem, a6 as CartDiscount, a7 as CartItem, a8 as CheckoutAddress, a9 as FulfillmentStatus, aa as LoginInput, ab as MessageResponse, ac as OrderItem, ad as OrderStatus, ae as PaymentStatus, af as ProductPrice, ag as ProductReview, ah as ProductVariant } from './client-BQlF_Vn9.mjs';
6
6
  import * as _tanstack_query_core from '@tanstack/query-core';
7
7
  export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, trackEcommerceEvent } from './index.mjs';
8
8
 
@@ -320,6 +320,30 @@ declare function useLoyalty(options?: UseLoyaltyOptions): {
320
320
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<LoyaltySummary>, Error>>;
321
321
  };
322
322
 
323
+ interface UseSubscriptionsOptions {
324
+ enabled?: boolean;
325
+ }
326
+ /**
327
+ * The logged-in customer's recurring-order subscriptions (GAP-40): products,
328
+ * cadence, next order date and status, plus pause / resume / cancel actions.
329
+ * Only runs when a customer is authenticated. Subscriptions are merchant-created
330
+ * in v1; a storefront self-serve subscribe flow is a follow-up.
331
+ */
332
+ declare function useSubscriptions(options?: UseSubscriptionsOptions): {
333
+ subscriptions: Subscription[];
334
+ isLoading: boolean;
335
+ error: Error | null;
336
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
337
+ items: Subscription[];
338
+ }>, Error>>;
339
+ pause: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
340
+ resume: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
341
+ cancel: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
342
+ isPausing: boolean;
343
+ isResuming: boolean;
344
+ isCancelling: boolean;
345
+ };
346
+
323
347
  /**
324
348
  * Pickup points (parcel shops / lockers) for a shipping method that supports
325
349
  * them (GAP-03). Pass `methodId` and optionally a `query` (name / city / zip)
@@ -337,6 +361,150 @@ declare function usePickupPoints(input: Partial<PickupPointsInput> & {
337
361
  }>, Error>>;
338
362
  };
339
363
 
364
+ interface UseShippingMethodsOptions {
365
+ /** ISO 4217 code; defaults to the provider / shop currency. */
366
+ currency?: string;
367
+ /** ISO 3166-1 alpha-2 destination country to filter methods. */
368
+ country?: string;
369
+ /** Cart total for free-shipping / price-tier resolution. */
370
+ cartTotal?: number;
371
+ /** Cart weight in kg for weight-tier pricing. */
372
+ cartWeightKg?: number;
373
+ enabled?: boolean;
374
+ }
375
+ /**
376
+ * Merchant shipping methods with resolved fixed prices (GAP-20). Pass the
377
+ * cart total / weight so tiered and free-shipping rules resolve; methods with
378
+ * `priceStrategy: "live_quote"` have `price: null` — get a real price via
379
+ * `useShippingQuote` once a destination address is known.
380
+ */
381
+ declare function useShippingMethods(options?: UseShippingMethodsOptions): {
382
+ methods: ShippingMethodSummary[];
383
+ isLoading: boolean;
384
+ error: Error | null;
385
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
386
+ items: ShippingMethodSummary[];
387
+ }>, Error>>;
388
+ };
389
+
390
+ interface UseShippingQuoteOptions extends Partial<ShippingQuoteInput> {
391
+ enabled?: boolean;
392
+ }
393
+ /**
394
+ * Live shipping quote for a destination address (GAP-20). Disabled until the
395
+ * destination country is known — pass the address as the customer fills the
396
+ * checkout form and the quote re-resolves automatically. Each returned item
397
+ * carries `available` + `reason` so the template can grey out methods the
398
+ * carrier refused to price.
399
+ */
400
+ declare function useShippingQuote(options?: UseShippingQuoteOptions): {
401
+ quotes: ShippingQuote[];
402
+ isLoading: boolean;
403
+ error: Error | null;
404
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
405
+ items: ShippingQuote[];
406
+ }>, Error>>;
407
+ };
408
+
409
+ interface UsePaymentMethodsOptions {
410
+ /** ISO 4217 code; defaults to the active currency. Methods that do not
411
+ * support the currency are filtered out server-side. */
412
+ currency?: string;
413
+ enabled?: boolean;
414
+ }
415
+ /**
416
+ * Merchant payment methods for the checkout (GAP-20). `publicConfig` carries
417
+ * customer-safe provider hints (e.g. `redirectFlow`, `offline`, bank account
418
+ * for transfers); `fee` is the optional payment surcharge.
419
+ */
420
+ declare function usePaymentMethods(options?: UsePaymentMethodsOptions): {
421
+ methods: CheckoutPaymentMethod[];
422
+ isLoading: boolean;
423
+ error: Error | null;
424
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
425
+ items: CheckoutPaymentMethod[];
426
+ }>, Error>>;
427
+ };
428
+
429
+ /** One behavioral personal offer (Behio Analytics -> Smart Offers). */
430
+ interface PersonalOffer {
431
+ id: string;
432
+ productId: string;
433
+ percent: number;
434
+ /** "OFFERED" = code ready; "EMAIL_PENDING" = e-mail gate, claim to reveal. */
435
+ status: string;
436
+ code: string | null;
437
+ /** Epoch ms. */
438
+ expiresAt: number;
439
+ }
440
+ interface UsePersonalOffersOptions {
441
+ /**
442
+ * Consent-gated analytics visitor id. When omitted the hook polls
443
+ * `client.getAnalyticsVisitorId()` until the tracker resolves consent
444
+ * (it is null before consent / for opted-out visitors).
445
+ */
446
+ visitorId?: string;
447
+ enabled?: boolean;
448
+ }
449
+ /**
450
+ * Personal behavioral offers for the current visitor (GAP-20 / GAP-28).
451
+ * Consent-gated: without an analytics visitor id the hook stays idle and
452
+ * `offers` is empty, so it is always safe to mount. `claimByEmail` completes
453
+ * the e-mail gate flow and updates the cached offer with the revealed code.
454
+ */
455
+ declare function usePersonalOffers(options?: UsePersonalOffersOptions): {
456
+ offers: PersonalOffer[];
457
+ /** Resolved consent-gated visitor id (null before consent). */
458
+ visitorId: string | null;
459
+ isLoading: boolean;
460
+ error: Error | null;
461
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
462
+ items: PersonalOffer[];
463
+ }>, Error>>;
464
+ /** E-mail gate: trade an e-mail for the discount code of the given offer. */
465
+ claimByEmail: (offerId: string, email: string) => Promise<{
466
+ code: string;
467
+ percent: number;
468
+ expiresAt: number;
469
+ }>;
470
+ isClaiming: boolean;
471
+ claimError: Error | null;
472
+ };
473
+
474
+ /** One Behio Analytics ingest event (mirrors the public analytics DTO). */
475
+ interface AnalyticsEventInput {
476
+ type: "pageview" | "ecommerce" | "custom";
477
+ name?: string;
478
+ /** Client event time (epoch ms); defaults server-side to receive time. */
479
+ ts?: number;
480
+ path?: string;
481
+ referrer?: string;
482
+ utmSource?: string;
483
+ utmMedium?: string;
484
+ utmCampaign?: string;
485
+ dwellMs?: number;
486
+ value?: number;
487
+ currency?: string;
488
+ props?: Record<string, unknown>;
489
+ }
490
+ /**
491
+ * Thin wrapper over the fire-and-forget Behio Analytics ingest (GAP-20).
492
+ * Prefer mounting `BehioAnalyticsTracker` (it handles pageviews, consent and
493
+ * batching for you); use this hook for extra `custom` / `ecommerce` events on
494
+ * top. The consent-gated visitor id is attached automatically when available;
495
+ * failures are swallowed — analytics never breaks the shop.
496
+ */
497
+ declare function useAnalyticsEvents(): {
498
+ /** Send one or more raw analytics events. */
499
+ track: (events: AnalyticsEventInput | AnalyticsEventInput[], opts?: {
500
+ sessionId?: string;
501
+ }) => Promise<void>;
502
+ /** Convenience: send a named `custom` event with optional props. */
503
+ trackEvent: (name: string, props?: Record<string, unknown>) => Promise<void>;
504
+ /** Consent-gated visitor id, null before analytics consent. */
505
+ getVisitorId: () => string | null;
506
+ };
507
+
340
508
  /**
341
509
  * Subscribe an email to the shop newsletter (first-party opt-in, GAP-08).
342
510
  * Use for the footer signup block; the checkout opt-in checkbox goes through
@@ -1113,4 +1281,4 @@ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResu
1113
1281
  */
1114
1282
  declare function useBehioClient(): BehioStorefront;
1115
1283
 
1116
- export { ActivePromotion, BehioAnalyticsTracker, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, StorefrontScripts, type StorefrontScriptsProps, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCurrency, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePickupPoints, useProduct, useProductGroup, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
1284
+ export { ActivePromotion, type AnalyticsEventInput, BehioAnalyticsTracker, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, type PersonalOffer, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, StorefrontScripts, type StorefrontScriptsProps, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSubscriptionsOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCurrency, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useWishlist };
package/dist/react.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as _tanstack_react_query from '@tanstack/react-query';
3
3
  import { QueryClient } from '@tanstack/react-query';
4
- import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, M as Menu, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, L as LoyaltySummary, k as PickupPointsInput, l as PickupPoint, N as NewsletterSubscribeResult, m as NewsletterSubscribeInput, n as NewsletterUnsubscribeResult, O as OrderListItem, o as OrderDetail, p as OrderAccessRequestResponse, q as OrderAccessVerifyResponse, r as CheckoutInput, s as PageDetail, t as Page, S as ShopInfo, u as ShopScripts, v as ShopSeo, w as Bundle, x as ProductGroup, y as CrossSellItem, z as ActivePromotion, G as GiftCardBalance, W as WishlistItem, D as ProductReviewsResponse, E as SubmitReviewInput, H as ReturnableOrder, I as ReturnStatus, J as ReturnRequest, K as SubmitReturnInput, Q as CookieConsent, T as CookieConsentInput, U as QuoteRequest, V as SubmitQuoteInput, X as BackInStockSubscription } from './client-D1GZSa-N.js';
5
- export { Y as AddToCartInput, Z as AuthTokens, _ as BehioApiError, $ as BundleItem, a0 as CartDiscount, a1 as CartItem, a2 as CheckoutAddress, a3 as FulfillmentStatus, a4 as LoginInput, a5 as MessageResponse, a6 as OrderItem, a7 as OrderStatus, a8 as PaymentStatus, a9 as ProductPrice, aa as ProductReview, ab as ProductVariant } from './client-D1GZSa-N.js';
4
+ import { a as BehioStorefront, P as ProductsQuery, b as PaginatedResponse, c as ProductListItem, d as ProductDetail, C as Category, e as CategoryDetail, M as Menu, f as ProductLabel, F as FilterField, g as Cart, h as CustomerProfile, R as RegisterInput, i as CustomerAddress, A as AddressSuggestion, j as AddressDetail, L as LoyaltySummary, S as Subscription, k as SubscriptionAction, l as PickupPointsInput, m as PickupPoint, n as ShippingMethodSummary, o as ShippingQuoteInput, p as ShippingQuote, q as CheckoutPaymentMethod, N as NewsletterSubscribeResult, r as NewsletterSubscribeInput, s as NewsletterUnsubscribeResult, O as OrderListItem, t as OrderDetail, u as OrderAccessRequestResponse, v as OrderAccessVerifyResponse, w as CheckoutInput, x as PageDetail, y as Page, z as ShopInfo, D as ShopScripts, E as ShopSeo, G as Bundle, H as ProductGroup, I as CrossSellItem, J as ActivePromotion, K as GiftCardBalance, W as WishlistItem, Q as ProductReviewsResponse, T as SubmitReviewInput, U as ReturnableOrder, V as ReturnStatus, X as ReturnRequest, Y as SubmitReturnInput, Z as CookieConsent, _ as CookieConsentInput, $ as QuoteRequest, a0 as SubmitQuoteInput, a1 as BackInStockSubscription } from './client-BQlF_Vn9.js';
5
+ export { a2 as AddToCartInput, a3 as AuthTokens, a4 as BehioApiError, a5 as BundleItem, a6 as CartDiscount, a7 as CartItem, a8 as CheckoutAddress, a9 as FulfillmentStatus, aa as LoginInput, ab as MessageResponse, ac as OrderItem, ad as OrderStatus, ae as PaymentStatus, af as ProductPrice, ag as ProductReview, ah as ProductVariant } from './client-BQlF_Vn9.js';
6
6
  import * as _tanstack_query_core from '@tanstack/query-core';
7
7
  export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, trackEcommerceEvent } from './index.js';
8
8
 
@@ -320,6 +320,30 @@ declare function useLoyalty(options?: UseLoyaltyOptions): {
320
320
  refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<LoyaltySummary>, Error>>;
321
321
  };
322
322
 
323
+ interface UseSubscriptionsOptions {
324
+ enabled?: boolean;
325
+ }
326
+ /**
327
+ * The logged-in customer's recurring-order subscriptions (GAP-40): products,
328
+ * cadence, next order date and status, plus pause / resume / cancel actions.
329
+ * Only runs when a customer is authenticated. Subscriptions are merchant-created
330
+ * in v1; a storefront self-serve subscribe flow is a follow-up.
331
+ */
332
+ declare function useSubscriptions(options?: UseSubscriptionsOptions): {
333
+ subscriptions: Subscription[];
334
+ isLoading: boolean;
335
+ error: Error | null;
336
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
337
+ items: Subscription[];
338
+ }>, Error>>;
339
+ pause: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
340
+ resume: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
341
+ cancel: _tanstack_react_query.UseMutateAsyncFunction<SubscriptionAction, Error, string, unknown>;
342
+ isPausing: boolean;
343
+ isResuming: boolean;
344
+ isCancelling: boolean;
345
+ };
346
+
323
347
  /**
324
348
  * Pickup points (parcel shops / lockers) for a shipping method that supports
325
349
  * them (GAP-03). Pass `methodId` and optionally a `query` (name / city / zip)
@@ -337,6 +361,150 @@ declare function usePickupPoints(input: Partial<PickupPointsInput> & {
337
361
  }>, Error>>;
338
362
  };
339
363
 
364
+ interface UseShippingMethodsOptions {
365
+ /** ISO 4217 code; defaults to the provider / shop currency. */
366
+ currency?: string;
367
+ /** ISO 3166-1 alpha-2 destination country to filter methods. */
368
+ country?: string;
369
+ /** Cart total for free-shipping / price-tier resolution. */
370
+ cartTotal?: number;
371
+ /** Cart weight in kg for weight-tier pricing. */
372
+ cartWeightKg?: number;
373
+ enabled?: boolean;
374
+ }
375
+ /**
376
+ * Merchant shipping methods with resolved fixed prices (GAP-20). Pass the
377
+ * cart total / weight so tiered and free-shipping rules resolve; methods with
378
+ * `priceStrategy: "live_quote"` have `price: null` — get a real price via
379
+ * `useShippingQuote` once a destination address is known.
380
+ */
381
+ declare function useShippingMethods(options?: UseShippingMethodsOptions): {
382
+ methods: ShippingMethodSummary[];
383
+ isLoading: boolean;
384
+ error: Error | null;
385
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
386
+ items: ShippingMethodSummary[];
387
+ }>, Error>>;
388
+ };
389
+
390
+ interface UseShippingQuoteOptions extends Partial<ShippingQuoteInput> {
391
+ enabled?: boolean;
392
+ }
393
+ /**
394
+ * Live shipping quote for a destination address (GAP-20). Disabled until the
395
+ * destination country is known — pass the address as the customer fills the
396
+ * checkout form and the quote re-resolves automatically. Each returned item
397
+ * carries `available` + `reason` so the template can grey out methods the
398
+ * carrier refused to price.
399
+ */
400
+ declare function useShippingQuote(options?: UseShippingQuoteOptions): {
401
+ quotes: ShippingQuote[];
402
+ isLoading: boolean;
403
+ error: Error | null;
404
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
405
+ items: ShippingQuote[];
406
+ }>, Error>>;
407
+ };
408
+
409
+ interface UsePaymentMethodsOptions {
410
+ /** ISO 4217 code; defaults to the active currency. Methods that do not
411
+ * support the currency are filtered out server-side. */
412
+ currency?: string;
413
+ enabled?: boolean;
414
+ }
415
+ /**
416
+ * Merchant payment methods for the checkout (GAP-20). `publicConfig` carries
417
+ * customer-safe provider hints (e.g. `redirectFlow`, `offline`, bank account
418
+ * for transfers); `fee` is the optional payment surcharge.
419
+ */
420
+ declare function usePaymentMethods(options?: UsePaymentMethodsOptions): {
421
+ methods: CheckoutPaymentMethod[];
422
+ isLoading: boolean;
423
+ error: Error | null;
424
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
425
+ items: CheckoutPaymentMethod[];
426
+ }>, Error>>;
427
+ };
428
+
429
+ /** One behavioral personal offer (Behio Analytics -> Smart Offers). */
430
+ interface PersonalOffer {
431
+ id: string;
432
+ productId: string;
433
+ percent: number;
434
+ /** "OFFERED" = code ready; "EMAIL_PENDING" = e-mail gate, claim to reveal. */
435
+ status: string;
436
+ code: string | null;
437
+ /** Epoch ms. */
438
+ expiresAt: number;
439
+ }
440
+ interface UsePersonalOffersOptions {
441
+ /**
442
+ * Consent-gated analytics visitor id. When omitted the hook polls
443
+ * `client.getAnalyticsVisitorId()` until the tracker resolves consent
444
+ * (it is null before consent / for opted-out visitors).
445
+ */
446
+ visitorId?: string;
447
+ enabled?: boolean;
448
+ }
449
+ /**
450
+ * Personal behavioral offers for the current visitor (GAP-20 / GAP-28).
451
+ * Consent-gated: without an analytics visitor id the hook stays idle and
452
+ * `offers` is empty, so it is always safe to mount. `claimByEmail` completes
453
+ * the e-mail gate flow and updates the cached offer with the revealed code.
454
+ */
455
+ declare function usePersonalOffers(options?: UsePersonalOffersOptions): {
456
+ offers: PersonalOffer[];
457
+ /** Resolved consent-gated visitor id (null before consent). */
458
+ visitorId: string | null;
459
+ isLoading: boolean;
460
+ error: Error | null;
461
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
462
+ items: PersonalOffer[];
463
+ }>, Error>>;
464
+ /** E-mail gate: trade an e-mail for the discount code of the given offer. */
465
+ claimByEmail: (offerId: string, email: string) => Promise<{
466
+ code: string;
467
+ percent: number;
468
+ expiresAt: number;
469
+ }>;
470
+ isClaiming: boolean;
471
+ claimError: Error | null;
472
+ };
473
+
474
+ /** One Behio Analytics ingest event (mirrors the public analytics DTO). */
475
+ interface AnalyticsEventInput {
476
+ type: "pageview" | "ecommerce" | "custom";
477
+ name?: string;
478
+ /** Client event time (epoch ms); defaults server-side to receive time. */
479
+ ts?: number;
480
+ path?: string;
481
+ referrer?: string;
482
+ utmSource?: string;
483
+ utmMedium?: string;
484
+ utmCampaign?: string;
485
+ dwellMs?: number;
486
+ value?: number;
487
+ currency?: string;
488
+ props?: Record<string, unknown>;
489
+ }
490
+ /**
491
+ * Thin wrapper over the fire-and-forget Behio Analytics ingest (GAP-20).
492
+ * Prefer mounting `BehioAnalyticsTracker` (it handles pageviews, consent and
493
+ * batching for you); use this hook for extra `custom` / `ecommerce` events on
494
+ * top. The consent-gated visitor id is attached automatically when available;
495
+ * failures are swallowed — analytics never breaks the shop.
496
+ */
497
+ declare function useAnalyticsEvents(): {
498
+ /** Send one or more raw analytics events. */
499
+ track: (events: AnalyticsEventInput | AnalyticsEventInput[], opts?: {
500
+ sessionId?: string;
501
+ }) => Promise<void>;
502
+ /** Convenience: send a named `custom` event with optional props. */
503
+ trackEvent: (name: string, props?: Record<string, unknown>) => Promise<void>;
504
+ /** Consent-gated visitor id, null before analytics consent. */
505
+ getVisitorId: () => string | null;
506
+ };
507
+
340
508
  /**
341
509
  * Subscribe an email to the shop newsletter (first-party opt-in, GAP-08).
342
510
  * Use for the footer signup block; the checkout opt-in checkbox goes through
@@ -1113,4 +1281,4 @@ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResu
1113
1281
  */
1114
1282
  declare function useBehioClient(): BehioStorefront;
1115
1283
 
1116
- export { ActivePromotion, BehioAnalyticsTracker, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, StorefrontScripts, type StorefrontScriptsProps, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCurrency, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePickupPoints, useProduct, useProductGroup, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
1284
+ export { ActivePromotion, type AnalyticsEventInput, BehioAnalyticsTracker, BehioProvider, type BehioProviderProps, Bundle, Cart, Category, CategoryDetail, CheckoutInput, CookieConsent, CookieConsentInput, CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, CustomerAddress, CustomerProfile, FilterField, GiftCardBalance, OrderDetail, OrderListItem, Page, PageDetail, PaginatedResponse, type PersonalOffer, ProductDetail, ProductLabel, ProductListItem, ProductReviewsResponse, ProductsQuery, QuoteRequest, RegisterInput, ReturnRequest, ShopInfo, ShopSeo, type StorageAdapter, StorefrontScripts, type StorefrontScriptsProps, SubmitQuoteInput, SubmitReturnInput, SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSubscriptionsOptions, WishlistItem, cookieStorage, createMemoryStorage, detectStorage, localStorageAdapter, memoryStorage, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCheckout, useCookieConsent, useCrossSell, useCurrency, useCustomer, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useWishlist };