@behio/storefront-sdk 0.32.0 → 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/{chunk-Y7QAB75P.mjs → chunk-5KJDVDUM.mjs} +43 -0
- package/dist/{chunk-5OFVG2BO.js → chunk-Y4ZCK5HD.js} +43 -0
- package/dist/{client-BOz1trRk.d.mts → client-BQlF_Vn9.d.mts} +235 -5
- package/dist/{client-BOz1trRk.d.ts → client-BQlF_Vn9.d.ts} +235 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +171 -3
- package/dist/react.d.ts +171 -3
- package/dist/react.js +240 -45
- package/dist/react.mjs +279 -84
- package/package.json +1 -1
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
|
|
5
|
-
export {
|
|
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
|
|
5
|
-
export {
|
|
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 };
|