@behio/storefront-sdk 0.32.0 → 0.34.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-CZRSJULD.js +118 -0
- package/dist/chunk-QUU76QUB.mjs +118 -0
- package/dist/{chunk-5OFVG2BO.js → chunk-Y4ZCK5HD.js} +43 -0
- package/dist/{client-BOz1trRk.d.mts → client-DdaC0_6x.d.mts} +239 -5
- package/dist/{client-BOz1trRk.d.ts → client-DdaC0_6x.d.ts} +239 -5
- package/dist/index.d.mts +86 -8
- package/dist/index.d.ts +86 -8
- package/dist/index.js +11 -3
- package/dist/index.mjs +10 -2
- 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 +172 -4
- package/dist/react.d.ts +172 -4
- package/dist/react.js +285 -55
- package/dist/react.mjs +325 -95
- package/package.json +1 -1
- package/dist/chunk-JIAOZ5YW.js +0 -40
- package/dist/chunk-ZOZAJG6T.mjs +0 -40
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { a as BehioStorefront, ai as SdkResult, Z as CookieConsent } from './client-DdaC0_6x.js';
|
|
2
|
+
export { J as ActivePromotion, a2 as AddToCartInput, j as AddressDetail, A as AddressSuggestion, aj as AddressType, ak as AddressTypes, a3 as AuthTokens, a1 as BackInStockSubscription, al as BadgeTone, a4 as BehioApiError, am as BehioErrorCode, an as BehioEventHandler, ao as BehioEventType, ap as BehioNetworkError, B as BehioStorefrontConfig, G as Bundle, a5 as BundleItem, g as Cart, aq as CartBundleLine, ar as CartBundleLineItem, a6 as CartDiscount, a7 as CartItem, as as CartItemProduct, at as CartPromotion, C as Category, e as CategoryDetail, a8 as CheckoutAddress, w as CheckoutInput, q as CheckoutPaymentMethod, au as CheckoutSettings, _ as CookieConsentInput, I as CrossSellItem, i as CustomerAddress, h as CustomerProfile, av as DataGroupFieldType, aw as DigitalDownload, ax as DownloadUrl, F as FilterField, a9 as FulfillmentStatus, ay as FulfillmentStatuses, K as GiftCardBalance, az as GiftCardPurchaseInput, aA as GiftCardPurchaseResult, aB as GiftCardSummary, aa as LoginInput, aC as LoyaltyBalance, aD as LoyaltyNextTier, aE as LoyaltyProgram, L as LoyaltySummary, aF as LoyaltyTier, aG as LoyaltyTierPerks, aH as LoyaltyTransaction, M as Menu, aI as MenuItem, aJ as MenuItemRef, aK as MenuItemType, ab as MessageResponse, aL as NewsletterOptInDefault, r as NewsletterSubscribeInput, N as NewsletterSubscribeResult, s as NewsletterUnsubscribeResult, u as OrderAccessRequestResponse, v as OrderAccessVerifyResponse, t as OrderDetail, ac as OrderItem, O as OrderListItem, ad as OrderStatus, aM as OrderStatusHistory, aN as OrderStatuses, aO as OrderTracking, y as Page, aP as PageAttachment, x as PageDetail, b as PaginatedResponse, ae as PaymentStatus, aQ as PaymentStatuses, m as PickupPoint, aR as PickupPointHours, l as PickupPointsInput, aS as PriceDisplay, aT as ProductAvailability, aU as ProductCustomField, aV as ProductCustomFieldGroup, d as ProductDetail, H as ProductGroup, f as ProductLabel, c as ProductListItem, aW as ProductMedia, aX as ProductMediaVariant, af as ProductPrice, aY as ProductPromotionSummary, ag as ProductReview, Q as ProductReviewsResponse, aZ as ProductSort, a_ as ProductSortValue, ah as ProductVariant, a$ as ProductVolumePrice, P as ProductsQuery, b0 as QuoteItem, $ as QuoteRequest, R as RegisterInput, b1 as RegisterResult, b2 as RequestInterceptor, b3 as RequestInterceptorConfig, b4 as ResponseInterceptor, b5 as ResponseInterceptorData, X as ReturnRequest, b6 as ReturnRequestItem, V as ReturnStatus, b7 as ReturnStatusItem, U as ReturnableOrder, b8 as ReturnableOrderItem, b9 as SdkError, n as ShippingMethodSummary, p as ShippingQuote, o as ShippingQuoteInput, z as ShopInfo, ba as ShopScript, bb as ShopScriptPlacement, bc as ShopScriptType, D as ShopScripts, E as ShopSeo, bd as ShopSeoIdentity, be as StockBehavior, a0 as SubmitQuoteInput, Y as SubmitReturnInput, T as SubmitReviewInput, S as Subscription, k as SubscriptionAction, bf as SubscriptionFrequency, bg as SubscriptionItem, bh as SubscriptionStatus, bi as TaxBreakdownLine, bj as VariantAxis, bk as VariantAxisValue, W as WishlistItem, bl as err, bm as ok, bn as toSdkError } from './client-DdaC0_6x.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -13,20 +14,29 @@ declare function formatPrice(amount: number, currency: string, locale?: string):
|
|
|
13
14
|
/**
|
|
14
15
|
* GA4 e-commerce event helper.
|
|
15
16
|
*
|
|
16
|
-
* Fires standard GA4 ecommerce events (view_item, add_to_cart,
|
|
17
|
-
* purchase, ...) into whatever analytics runtime the
|
|
18
|
-
* `<StorefrontScripts
|
|
17
|
+
* Fires standard GA4 ecommerce/engagement events (view_item, add_to_cart,
|
|
18
|
+
* begin_checkout, purchase, search, ...) into whatever analytics runtime the
|
|
19
|
+
* shop has injected via `<StorefrontScripts/>`, and — crucially — into Behio
|
|
20
|
+
* Analytics via the sink the tracker registers. One call, both systems.
|
|
19
21
|
*
|
|
22
|
+
* Sinks:
|
|
23
|
+
* - Behio Analytics (`__behioEcommerceSink`) — always, when the tracker is
|
|
24
|
+
* mounted. Records the ORIGINAL event name so Behio-exclusive signals
|
|
25
|
+
* (variant_selected, newsletter_signup) stay distinct.
|
|
20
26
|
* - direct GA4 (`gtag` present) -> `gtag("event", name, payload)`
|
|
21
27
|
* - GTM (`dataLayer` array present) -> `dataLayer.push({event, ecommerce})`
|
|
22
28
|
* (with the recommended `ecommerce: null` reset push first)
|
|
23
29
|
* - neither present (no analytics configured, or consent not granted yet so
|
|
24
|
-
* the consent-gated script never loaded) -> silent no-op
|
|
30
|
+
* the consent-gated script never loaded) -> silent no-op for the GA path
|
|
31
|
+
*
|
|
32
|
+
* Behio-only signal names that have a GA4 recommended equivalent are remapped
|
|
33
|
+
* for the GA path only (see `GA4_NAME_MAP`), so merchants keep clean GA4
|
|
34
|
+
* reports while Behio keeps the richer signal.
|
|
25
35
|
*
|
|
26
36
|
* Consent stays the script layer's job: this helper never loads anything, it
|
|
27
37
|
* only talks to runtimes that already exist on the page.
|
|
28
38
|
*/
|
|
29
|
-
type EcommerceEventName = "view_item" | "add_to_cart" | "remove_from_cart" | "view_cart" | "begin_checkout" | "add_payment_info" | "add_shipping_info" | "purchase";
|
|
39
|
+
type EcommerceEventName = "view_item" | "view_item_list" | "select_item" | "add_to_cart" | "remove_from_cart" | "view_cart" | "add_to_wishlist" | "view_promotion" | "select_promotion" | "begin_checkout" | "add_payment_info" | "add_shipping_info" | "search" | "generate_lead" | "purchase" | "variant_selected" | "newsletter_signup";
|
|
30
40
|
type EcommerceItem = {
|
|
31
41
|
item_id: string;
|
|
32
42
|
item_name: string;
|
|
@@ -34,6 +44,8 @@ type EcommerceItem = {
|
|
|
34
44
|
quantity?: number;
|
|
35
45
|
item_variant?: string;
|
|
36
46
|
item_category?: string;
|
|
47
|
+
/** Position in the list (1-based) — for select_item rail/list attribution. */
|
|
48
|
+
index?: number;
|
|
37
49
|
};
|
|
38
50
|
type EcommercePayload = {
|
|
39
51
|
currency?: string;
|
|
@@ -42,8 +54,74 @@ type EcommercePayload = {
|
|
|
42
54
|
/** Required for `purchase` — the order number. */
|
|
43
55
|
transaction_id?: string;
|
|
44
56
|
shipping?: number;
|
|
45
|
-
|
|
57
|
+
/** Optional for non-item events (search, add_shipping_info, newsletter). */
|
|
58
|
+
items?: EcommerceItem[];
|
|
59
|
+
/** search event: the query string. */
|
|
60
|
+
search_term?: string;
|
|
61
|
+
/** add_shipping_info: the selected shipping method label. */
|
|
62
|
+
shipping_tier?: string;
|
|
63
|
+
/** add_payment_info: the selected payment method type. */
|
|
64
|
+
payment_type?: string;
|
|
65
|
+
/** view_item_list / select_item: the list id (shop|category|search|rail:*). */
|
|
66
|
+
item_list_id?: string;
|
|
67
|
+
/** view_item_list / select_item: human-readable list name. */
|
|
68
|
+
item_list_name?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Behio-only extra props forwarded verbatim into the Behio event `props`
|
|
71
|
+
* (ignored by GA4). Use for signals GA4 can't model: resultsCount,
|
|
72
|
+
* zeroResults, variantId, listId, position, source, ...
|
|
73
|
+
*/
|
|
74
|
+
props?: Record<string, unknown>;
|
|
46
75
|
};
|
|
47
76
|
declare function trackEcommerceEvent(event: EcommerceEventName, payload: EcommercePayload): void;
|
|
48
77
|
|
|
49
|
-
|
|
78
|
+
/**
|
|
79
|
+
* Consent-gated visitor identity helpers.
|
|
80
|
+
*
|
|
81
|
+
* Behio Analytics has three identity tiers (see BehioAnalyticsTracker):
|
|
82
|
+
* anonymous (cookieless server hash), consented (persistent behio_visitor_id),
|
|
83
|
+
* and customer-linked (server stitches at checkout/login). The persistent
|
|
84
|
+
* `behio_visitor_id` is what unlocks returning-visitor metrics, the customer
|
|
85
|
+
* journey and Smart Offers.
|
|
86
|
+
*
|
|
87
|
+
* Historically the SDK only READ that id and left generation/writing to each
|
|
88
|
+
* shop's consent banner — so any storefront that forgot the write stayed 100%
|
|
89
|
+
* anonymous. These helpers move the write into the SDK: the consent banner just
|
|
90
|
+
* calls `grantAnalyticsConsent(client)` / `revokeAnalyticsConsent(client)` and
|
|
91
|
+
* everything (id generation, storage, server record, tracker refresh) is
|
|
92
|
+
* handled here, identically for every template and AI-generated shop.
|
|
93
|
+
*/
|
|
94
|
+
|
|
95
|
+
/** Read the persistent visitor id (localStorage first, cookie fallback for SSR-set ids). */
|
|
96
|
+
declare function getStoredVisitorId(): string | null;
|
|
97
|
+
/**
|
|
98
|
+
* Generate a fresh, URL-safe visitor id in the range the ingest DTO accepts
|
|
99
|
+
* (8..64 chars, [A-Za-z0-9_-]). Uses crypto when available, falling back to
|
|
100
|
+
* Math.random so it never throws in a locked-down runtime.
|
|
101
|
+
*/
|
|
102
|
+
declare function generateVisitorId(): string;
|
|
103
|
+
/**
|
|
104
|
+
* Grant analytics consent: ensure a persistent `behio_visitor_id` exists, store
|
|
105
|
+
* it, record the consent server-side, wire the id into the client (so orders /
|
|
106
|
+
* logins can be attributed) and notify the tracker to start sending it.
|
|
107
|
+
*
|
|
108
|
+
* Returns the visitor id (or an SdkResult error if the server record failed —
|
|
109
|
+
* the id is still stored locally so tracking works and can retry later).
|
|
110
|
+
*
|
|
111
|
+
* @param categories optional marketing/preferences flags (default false); the
|
|
112
|
+
* analytics flag is always true here.
|
|
113
|
+
*/
|
|
114
|
+
declare function grantAnalyticsConsent(client: BehioStorefront, categories?: {
|
|
115
|
+
marketing?: boolean;
|
|
116
|
+
preferences?: boolean;
|
|
117
|
+
}): Promise<SdkResult<CookieConsent>>;
|
|
118
|
+
/**
|
|
119
|
+
* Revoke analytics consent: tell the server, stop sending the id and notify the
|
|
120
|
+
* tracker. The stored id is kept (consent record now says analytics=false) so a
|
|
121
|
+
* later re-grant reuses the same visitor rather than fragmenting the journey.
|
|
122
|
+
*/
|
|
123
|
+
declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkResult<{
|
|
124
|
+
success: boolean;
|
|
125
|
+
}>>;
|
|
126
|
+
|
|
127
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, SdkResult, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, revokeAnalyticsConsent, trackEcommerceEvent };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
5
4
|
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
|
|
8
|
+
var _chunkCZRSJULDjs = require('./chunk-CZRSJULD.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -14,11 +14,11 @@ var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var _chunk5OFVG2BOjs = require('./chunk-5OFVG2BO.js');
|
|
18
17
|
|
|
19
18
|
|
|
20
19
|
|
|
21
20
|
|
|
21
|
+
var _chunkY4ZCK5HDjs = require('./chunk-Y4ZCK5HD.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -29,4 +29,12 @@ var _chunk5OFVG2BOjs = require('./chunk-5OFVG2BO.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.AddressTypes = _chunkY4ZCK5HDjs.AddressTypes; exports.BehioApiError = _chunkY4ZCK5HDjs.BehioApiError; exports.BehioNetworkError = _chunkY4ZCK5HDjs.BehioNetworkError; exports.BehioStorefront = _chunkY4ZCK5HDjs.BehioStorefront; exports.FulfillmentStatuses = _chunkY4ZCK5HDjs.FulfillmentStatuses; exports.OrderStatuses = _chunkY4ZCK5HDjs.OrderStatuses; exports.PaymentStatuses = _chunkY4ZCK5HDjs.PaymentStatuses; exports.ProductSort = _chunkY4ZCK5HDjs.ProductSort; exports.err = _chunkY4ZCK5HDjs.err; exports.formatPrice = _chunkCZRSJULDjs.formatPrice; exports.generateVisitorId = _chunkCZRSJULDjs.generateVisitorId; exports.getStoredVisitorId = _chunkCZRSJULDjs.getStoredVisitorId; exports.grantAnalyticsConsent = _chunkCZRSJULDjs.grantAnalyticsConsent; exports.ok = _chunkY4ZCK5HDjs.ok; exports.revokeAnalyticsConsent = _chunkCZRSJULDjs.revokeAnalyticsConsent; exports.toSdkError = _chunkY4ZCK5HDjs.toSdkError; exports.trackEcommerceEvent = _chunkCZRSJULDjs.trackEcommerceEvent;
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatPrice,
|
|
3
|
+
generateVisitorId,
|
|
4
|
+
getStoredVisitorId,
|
|
5
|
+
grantAnalyticsConsent,
|
|
6
|
+
revokeAnalyticsConsent,
|
|
3
7
|
trackEcommerceEvent
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-QUU76QUB.mjs";
|
|
5
9
|
import {
|
|
6
10
|
AddressTypes,
|
|
7
11
|
BehioApiError,
|
|
@@ -14,7 +18,7 @@ import {
|
|
|
14
18
|
err,
|
|
15
19
|
ok,
|
|
16
20
|
toSdkError
|
|
17
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-5KJDVDUM.mjs";
|
|
18
22
|
export {
|
|
19
23
|
AddressTypes,
|
|
20
24
|
BehioApiError,
|
|
@@ -26,7 +30,11 @@ export {
|
|
|
26
30
|
ProductSort,
|
|
27
31
|
err,
|
|
28
32
|
formatPrice,
|
|
33
|
+
generateVisitorId,
|
|
34
|
+
getStoredVisitorId,
|
|
35
|
+
grantAnalyticsConsent,
|
|
29
36
|
ok,
|
|
37
|
+
revokeAnalyticsConsent,
|
|
30
38
|
toSdkError,
|
|
31
39
|
trackEcommerceEvent
|
|
32
40
|
};
|
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-
|
|
1
|
+
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-DdaC0_6x.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 { B as BehioStorefrontConfig, a as BehioStorefront } from './client-
|
|
1
|
+
import { B as BehioStorefrontConfig, a as BehioStorefront } from './client-DdaC0_6x.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
|
|
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,
|
|
21
|
+
const client = new (0, _chunkY4ZCK5HDjs.BehioStorefront)({
|
|
22
22
|
apiKey,
|
|
23
23
|
...baseUrl ? { baseUrl } : {},
|
|
24
24
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-DdaC0_6x.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-DdaC0_6x.mjs';
|
|
6
6
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
7
|
-
export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, trackEcommerceEvent } from './index.mjs';
|
|
7
|
+
export { EcommerceEventName, EcommerceItem, EcommercePayload, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, revokeAnalyticsConsent, trackEcommerceEvent } from './index.mjs';
|
|
8
8
|
|
|
9
9
|
interface StorageAdapter {
|
|
10
10
|
get(key: string): string | null;
|
|
@@ -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 };
|