@behio/storefront-sdk 0.27.0 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.d.ts CHANGED
@@ -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, O as OrderListItem, k as OrderDetail, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, n as CheckoutInput, o as PageDetail, p as Page, S as ShopInfo, q as ShopScripts, r as ShopSeo, s as Bundle, t as ProductGroup, u as CrossSellItem, v as ActivePromotion, G as GiftCardBalance, W as WishlistItem, w as ProductReviewsResponse, x as SubmitReviewInput, y as ReturnableOrder, z as ReturnStatus, D as ReturnRequest, E as SubmitReturnInput, H as CookieConsent, I as CookieConsentInput, Q as QuoteRequest, J as SubmitQuoteInput, K as BackInStockSubscription } from './client-DL533jvY.js';
5
- export { L as AddToCartInput, N as AuthTokens, T as BehioApiError, U as BundleItem, V as CartDiscount, X as CartItem, Y as CheckoutAddress, Z as FulfillmentStatus, _ as LoginInput, $ as MessageResponse, a0 as OrderItem, a1 as OrderStatus, a2 as PaymentStatus, a3 as ProductPrice, a4 as ProductReview, a5 as ProductVariant } from './client-DL533jvY.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, 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-CJ_CoUIh.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-CJ_CoUIh.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
 
@@ -305,6 +305,48 @@ interface UseAddressAutocompleteReturn {
305
305
  */
306
306
  declare function useAddressAutocomplete(options: UseAddressAutocompleteOptions): UseAddressAutocompleteReturn;
307
307
 
308
+ interface UseLoyaltyOptions {
309
+ enabled?: boolean;
310
+ }
311
+ /**
312
+ * Loyalty program summary for the logged-in customer (GAP-06): points
313
+ * balance + value, current tier, next-tier progress, point ratio, referral
314
+ * code and recent transactions. Only runs when a customer is authenticated.
315
+ */
316
+ declare function useLoyalty(options?: UseLoyaltyOptions): {
317
+ loyalty: NoInfer<LoyaltySummary> | undefined;
318
+ isLoading: boolean;
319
+ error: Error | null;
320
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<LoyaltySummary>, Error>>;
321
+ };
322
+
323
+ /**
324
+ * Pickup points (parcel shops / lockers) for a shipping method that supports
325
+ * them (GAP-03). Pass `methodId` and optionally a `query` (name / city / zip)
326
+ * for a "find your branch" search box. Send the chosen point's `externalId`
327
+ * as `checkout.pickupPointId`. The query is disabled until `methodId` is set.
328
+ */
329
+ declare function usePickupPoints(input: Partial<PickupPointsInput> & {
330
+ enabled?: boolean;
331
+ }): {
332
+ pickupPoints: PickupPoint[];
333
+ isLoading: boolean;
334
+ error: Error | null;
335
+ refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<NoInfer<{
336
+ items: PickupPoint[];
337
+ }>, Error>>;
338
+ };
339
+
340
+ /**
341
+ * Subscribe an email to the shop newsletter (first-party opt-in, GAP-08).
342
+ * Use for the footer signup block; the checkout opt-in checkbox goes through
343
+ * the checkout input's `newsletterOptIn` instead. Subscribing is idempotent
344
+ * and re-activates a previously unsubscribed email.
345
+ */
346
+ declare function useNewsletterSubscribe(): _tanstack_react_query.UseMutationResult<NewsletterSubscribeResult, Error, NewsletterSubscribeInput, unknown>;
347
+ /** Unsubscribe an email from the shop newsletter (idempotent). */
348
+ declare function useNewsletterUnsubscribe(): _tanstack_react_query.UseMutationResult<NewsletterUnsubscribeResult, Error, string, unknown>;
349
+
308
350
  interface UseOrdersOptions {
309
351
  page?: number;
310
352
  limit?: number;
@@ -571,6 +613,8 @@ type CrossSellResponse = {
571
613
  * different sections on the product detail page.
572
614
  */
573
615
  declare function useCrossSell(productSlug: string | undefined, options?: {
616
+ locale?: string;
617
+ currency?: string;
574
618
  enabled?: boolean;
575
619
  initialData?: CrossSellResponse;
576
620
  }): _tanstack_react_query.UseQueryResult<NoInfer<CrossSellResponse>, Error>;
@@ -1069,4 +1113,4 @@ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResu
1069
1113
  */
1070
1114
  declare function useBehioClient(): BehioStorefront;
1071
1115
 
1072
- 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 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, useMenu, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, useProduct, useProductGroup, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
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 };
package/dist/react.js CHANGED
@@ -4,7 +4,7 @@
4
4
  var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
5
5
 
6
6
 
7
- var _chunkHOL6WRHRjs = require('./chunk-HOL6WRHR.js');
7
+ var _chunkNG46DR3Ajs = require('./chunk-NG46DR3A.js');
8
8
 
9
9
  // src/react/provider.tsx
10
10
  var _react = require('react');
@@ -134,7 +134,7 @@ function BehioProvider({
134
134
  const [activeCurrency, setActiveCurrency] = _react.useState.call(void 0, resolveInitialCurrency);
135
135
  const clientRef = _react.useRef.call(void 0, null);
136
136
  if (!clientRef.current) {
137
- clientRef.current = new (0, _chunkHOL6WRHRjs.BehioStorefront)({
137
+ clientRef.current = new (0, _chunkNG46DR3Ajs.BehioStorefront)({
138
138
  apiKey,
139
139
  baseUrl,
140
140
  ...shopDomain ? { shopDomain } : {},
@@ -872,6 +872,54 @@ function useAddressAutocomplete(options) {
872
872
  };
873
873
  }
874
874
 
875
+ // src/react/hooks/use-loyalty.ts
876
+
877
+ var LOYALTY_KEY = ["behio", "loyalty"];
878
+ function useLoyalty(options) {
879
+ const { client } = useBehio();
880
+ const { data, isLoading, error, refetch } = _reactquery.useQuery.call(void 0, {
881
+ queryKey: [...LOYALTY_KEY],
882
+ queryFn: () => unwrap(client.customer.getLoyalty()),
883
+ enabled: _optionalChain([options, 'optionalAccess', _53 => _53.enabled]) !== false && !!client.getAccessToken()
884
+ });
885
+ return { loyalty: data, isLoading, error, refetch };
886
+ }
887
+
888
+ // src/react/hooks/use-pickup-points.ts
889
+
890
+ function usePickupPoints(input) {
891
+ const { client } = useBehio();
892
+ const { methodId, query, country, limit, enabled } = input;
893
+ const { data, isLoading, error, refetch } = _reactquery.useQuery.call(void 0, {
894
+ queryKey: ["behio", "pickup-points", methodId, _nullishCoalesce(query, () => ( "")), _nullishCoalesce(country, () => ( "")), _nullishCoalesce(limit, () => ( 30))],
895
+ queryFn: () => unwrap(
896
+ client.shipping.getPickupPoints({
897
+ methodId,
898
+ query,
899
+ country,
900
+ limit
901
+ })
902
+ ),
903
+ enabled: enabled !== false && !!methodId
904
+ });
905
+ return { pickupPoints: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _54 => _54.items]), () => ( [])), isLoading, error, refetch };
906
+ }
907
+
908
+ // src/react/hooks/use-newsletter.ts
909
+
910
+ function useNewsletterSubscribe() {
911
+ const { client } = useBehio();
912
+ return _reactquery.useMutation.call(void 0, {
913
+ mutationFn: (input) => unwrap(client.newsletter.subscribe(input))
914
+ });
915
+ }
916
+ function useNewsletterUnsubscribe() {
917
+ const { client } = useBehio();
918
+ return _reactquery.useMutation.call(void 0, {
919
+ mutationFn: (email) => unwrap(client.newsletter.unsubscribe(email))
920
+ });
921
+ }
922
+
875
923
  // src/react/hooks/use-orders.ts
876
924
 
877
925
 
@@ -888,10 +936,10 @@ function useOrders(options) {
888
936
  enabled: enabled !== false && !!client.getAccessToken()
889
937
  });
890
938
  const items = _react.useMemo.call(void 0,
891
- () => _nullishCoalesce(_optionalChain([infinite, 'access', _53 => _53.data, 'optionalAccess', _54 => _54.pages, 'access', _55 => _55.flatMap, 'call', _56 => _56((p) => p.items)]), () => ( [])),
939
+ () => _nullishCoalesce(_optionalChain([infinite, 'access', _55 => _55.data, 'optionalAccess', _56 => _56.pages, 'access', _57 => _57.flatMap, 'call', _58 => _58((p) => p.items)]), () => ( [])),
892
940
  [infinite.data]
893
941
  );
894
- const lastPage = _optionalChain([infinite, 'access', _57 => _57.data, 'optionalAccess', _58 => _58.pages, 'access', _59 => _59[infinite.data.pages.length - 1]]);
942
+ const lastPage = _optionalChain([infinite, 'access', _59 => _59.data, 'optionalAccess', _60 => _60.pages, 'access', _61 => _61[infinite.data.pages.length - 1]]);
895
943
  const loadMore = _react.useCallback.call(void 0, () => {
896
944
  if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
897
945
  return infinite.fetchNextPage();
@@ -904,10 +952,10 @@ function useOrders(options) {
904
952
  return {
905
953
  items,
906
954
  data: infinite.data,
907
- total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _60 => _60.total]), () => ( 0)),
908
- totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _61 => _61.totalPages]), () => ( 0)),
909
- currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _62 => _62.page]), () => ( page)),
910
- limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _63 => _63.limit]), () => ( limit)), () => ( 20)),
955
+ total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _62 => _62.total]), () => ( 0)),
956
+ totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _63 => _63.totalPages]), () => ( 0)),
957
+ currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _64 => _64.page]), () => ( page)),
958
+ limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess', _65 => _65.limit]), () => ( limit)), () => ( 20)),
911
959
  page,
912
960
  setPage: goToPage,
913
961
  loadMore,
@@ -936,7 +984,7 @@ function useOrder(orderNumber, options) {
936
984
  } = _reactquery.useQuery.call(void 0, {
937
985
  queryKey: ["behio", "order", orderNumber],
938
986
  queryFn: () => unwrap(client.orders.get(orderNumber)),
939
- enabled: _optionalChain([options, 'optionalAccess', _64 => _64.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
987
+ enabled: _optionalChain([options, 'optionalAccess', _66 => _66.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
940
988
  });
941
989
  const cancelMutation = _reactquery.useMutation.call(void 0, {
942
990
  mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
@@ -1061,7 +1109,7 @@ function usePages(locale, options) {
1061
1109
  const result = await unwrap(client.pages.list(locale));
1062
1110
  return result.pages;
1063
1111
  },
1064
- enabled: _optionalChain([options, 'optionalAccess', _65 => _65.enabled]) !== false
1112
+ enabled: _optionalChain([options, 'optionalAccess', _67 => _67.enabled]) !== false
1065
1113
  });
1066
1114
  }
1067
1115
  function usePage(slug, locale, options) {
@@ -1069,7 +1117,7 @@ function usePage(slug, locale, options) {
1069
1117
  return _reactquery.useQuery.call(void 0, {
1070
1118
  queryKey: ["behio", "page", slug, locale],
1071
1119
  queryFn: () => unwrap(client.pages.get(slug, locale)),
1072
- enabled: _optionalChain([options, 'optionalAccess', _66 => _66.enabled]) !== false && !!slug
1120
+ enabled: _optionalChain([options, 'optionalAccess', _68 => _68.enabled]) !== false && !!slug
1073
1121
  });
1074
1122
  }
1075
1123
 
@@ -1080,7 +1128,7 @@ function useShopInfo(options) {
1080
1128
  return _reactquery.useQuery.call(void 0, {
1081
1129
  queryKey: ["behio", "shop-info"],
1082
1130
  queryFn: () => unwrap(client.getShopInfo()),
1083
- enabled: _optionalChain([options, 'optionalAccess', _67 => _67.enabled]) !== false
1131
+ enabled: _optionalChain([options, 'optionalAccess', _69 => _69.enabled]) !== false
1084
1132
  });
1085
1133
  }
1086
1134
 
@@ -1091,7 +1139,7 @@ function useShopScripts(options) {
1091
1139
  return _reactquery.useQuery.call(void 0, {
1092
1140
  queryKey: ["behio", "shop-scripts"],
1093
1141
  queryFn: () => unwrap(client.getShopScripts()),
1094
- enabled: _optionalChain([options, 'optionalAccess', _68 => _68.enabled]) !== false
1142
+ enabled: _optionalChain([options, 'optionalAccess', _70 => _70.enabled]) !== false
1095
1143
  });
1096
1144
  }
1097
1145
 
@@ -1119,8 +1167,8 @@ function dedupe(values) {
1119
1167
  function useCurrency() {
1120
1168
  const { currency, setCurrency, configuredDefaultCurrency, configuredCurrencies } = useBehio();
1121
1169
  const { data: shop, isLoading } = useShopInfo();
1122
- const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess', _69 => _69.defaultCurrency])));
1123
- const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess', _70 => _70.supportedCurrencies]), () => ( []))]);
1170
+ const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess', _71 => _71.defaultCurrency])));
1171
+ const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess', _72 => _72.supportedCurrencies]), () => ( []))]);
1124
1172
  return {
1125
1173
  currency,
1126
1174
  effectiveCurrency: _nullishCoalesce(currency, () => ( defaultCurrency)),
@@ -1143,7 +1191,7 @@ function CurrencySwitcher({
1143
1191
  const { currencies, effectiveCurrency, setCurrency } = useCurrency();
1144
1192
  if (currencies.length === 0) return null;
1145
1193
  if (currencies.length <= 1 && !showWhenSingle) return null;
1146
- const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _71 => _71[code]]), () => ( code));
1194
+ const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _73 => _73[code]]), () => ( code));
1147
1195
  if (children) {
1148
1196
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: children({ currencies, value: effectiveCurrency, setCurrency, label }) });
1149
1197
  }
@@ -1260,9 +1308,9 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
1260
1308
  }
1261
1309
  }, [visitorIdProp]);
1262
1310
  const { data: consent } = useCookieConsent(visitorId || void 0);
1263
- const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess', _72 => _72.analytics]));
1311
+ const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess', _74 => _74.analytics]));
1264
1312
  const scripts = _react.useMemo.call(void 0,
1265
- () => (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _73 => _73.scripts]), () => ( []))).filter((s) => !s.consentRequired || analyticsOk),
1313
+ () => (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _75 => _75.scripts]), () => ( []))).filter((s) => !s.consentRequired || analyticsOk),
1266
1314
  [data, analyticsOk]
1267
1315
  );
1268
1316
  const signature = _react.useMemo.call(void 0,
@@ -1327,7 +1375,7 @@ function initTracker(client) {
1327
1375
  return;
1328
1376
  }
1329
1377
  const { data } = await client.consent.get(stored);
1330
- const granted = Boolean(_optionalChain([data, 'optionalAccess', _74 => _74.analytics]));
1378
+ const granted = Boolean(_optionalChain([data, 'optionalAccess', _76 => _76.analytics]));
1331
1379
  visitorId = granted ? stored : void 0;
1332
1380
  client.setAnalyticsVisitorId(granted ? stored : null);
1333
1381
  } catch (e7) {
@@ -1411,7 +1459,7 @@ function initTracker(client) {
1411
1459
  };
1412
1460
  const onClick = (ev) => {
1413
1461
  const target = ev.target;
1414
- const el = _optionalChain([target, 'optionalAccess', _75 => _75.closest, 'optionalCall', _76 => _76("a,button,[role=button],[data-behio-event]")]);
1462
+ const el = _optionalChain([target, 'optionalAccess', _77 => _77.closest, 'optionalCall', _78 => _78("a,button,[role=button],[data-behio-event]")]);
1415
1463
  if (!el) return;
1416
1464
  const explicit = _nullishCoalesce(el.getAttribute("data-behio-event"), () => ( void 0));
1417
1465
  const text = (_nullishCoalesce(el.textContent, () => ( ""))).trim().replace(/\s+/g, " ").slice(0, 80) || void 0;
@@ -1452,7 +1500,7 @@ function initTracker(client) {
1452
1500
  items: payload.items.length,
1453
1501
  // First item id = the product (view_item/add_to_cart are
1454
1502
  // single-product in practice) - Behavioral Offers count on it.
1455
- itemId: _optionalChain([payload, 'access', _77 => _77.items, 'access', _78 => _78[0], 'optionalAccess', _79 => _79.item_id])
1503
+ itemId: _optionalChain([payload, 'access', _79 => _79.items, 'access', _80 => _80[0], 'optionalAccess', _81 => _81.item_id])
1456
1504
  }
1457
1505
  } : {}
1458
1506
  });
@@ -1514,8 +1562,8 @@ function useBundles(options) {
1514
1562
  return _reactquery.useQuery.call(void 0, {
1515
1563
  queryKey: ["behio", "bundles"],
1516
1564
  queryFn: () => unwrap(client.catalog.getBundles()),
1517
- enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.enabled]), () => ( true)),
1518
- initialData: _optionalChain([options, 'optionalAccess', _81 => _81.initialData])
1565
+ enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.enabled]), () => ( true)),
1566
+ initialData: _optionalChain([options, 'optionalAccess', _83 => _83.initialData])
1519
1567
  });
1520
1568
  }
1521
1569
  function useBundle(slug, options) {
@@ -1523,8 +1571,8 @@ function useBundle(slug, options) {
1523
1571
  return _reactquery.useQuery.call(void 0, {
1524
1572
  queryKey: ["behio", "bundle", slug],
1525
1573
  queryFn: () => unwrap(client.catalog.getBundle(slug)),
1526
- enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.enabled]), () => ( true))),
1527
- initialData: _optionalChain([options, 'optionalAccess', _83 => _83.initialData])
1574
+ enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.enabled]), () => ( true))),
1575
+ initialData: _optionalChain([options, 'optionalAccess', _85 => _85.initialData])
1528
1576
  });
1529
1577
  }
1530
1578
 
@@ -1533,15 +1581,15 @@ function useBundle(slug, options) {
1533
1581
  function useProductGroup(slug, options) {
1534
1582
  const { client } = useBehio();
1535
1583
  return _reactquery.useQuery.call(void 0, {
1536
- queryKey: ["behio", "product-group", slug, _optionalChain([options, 'optionalAccess', _84 => _84.locale]), _optionalChain([options, 'optionalAccess', _85 => _85.currency])],
1584
+ queryKey: ["behio", "product-group", slug, _optionalChain([options, 'optionalAccess', _86 => _86.locale]), _optionalChain([options, 'optionalAccess', _87 => _87.currency])],
1537
1585
  queryFn: () => unwrap(
1538
1586
  client.catalog.getProductGroup(slug, {
1539
- locale: _optionalChain([options, 'optionalAccess', _86 => _86.locale]),
1540
- currency: _optionalChain([options, 'optionalAccess', _87 => _87.currency])
1587
+ locale: _optionalChain([options, 'optionalAccess', _88 => _88.locale]),
1588
+ currency: _optionalChain([options, 'optionalAccess', _89 => _89.currency])
1541
1589
  })
1542
1590
  ),
1543
- enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _88 => _88.enabled]), () => ( true))),
1544
- initialData: _optionalChain([options, 'optionalAccess', _89 => _89.initialData])
1591
+ enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.enabled]), () => ( true))),
1592
+ initialData: _optionalChain([options, 'optionalAccess', _91 => _91.initialData])
1545
1593
  });
1546
1594
  }
1547
1595
 
@@ -1550,10 +1598,15 @@ function useProductGroup(slug, options) {
1550
1598
  function useCrossSell(productSlug, options) {
1551
1599
  const { client } = useBehio();
1552
1600
  return _reactquery.useQuery.call(void 0, {
1553
- queryKey: ["behio", "cross-sell", productSlug],
1554
- queryFn: () => unwrap(client.catalog.getCrossSell(productSlug)),
1555
- enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.enabled]), () => ( true))),
1556
- initialData: _optionalChain([options, 'optionalAccess', _91 => _91.initialData])
1601
+ queryKey: ["behio", "cross-sell", productSlug, _optionalChain([options, 'optionalAccess', _92 => _92.locale]), _optionalChain([options, 'optionalAccess', _93 => _93.currency])],
1602
+ queryFn: () => unwrap(
1603
+ client.catalog.getCrossSell(productSlug, {
1604
+ locale: _optionalChain([options, 'optionalAccess', _94 => _94.locale]),
1605
+ currency: _optionalChain([options, 'optionalAccess', _95 => _95.currency])
1606
+ })
1607
+ ),
1608
+ enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.enabled]), () => ( true))),
1609
+ initialData: _optionalChain([options, 'optionalAccess', _97 => _97.initialData])
1557
1610
  });
1558
1611
  }
1559
1612
 
@@ -1564,8 +1617,8 @@ function useProductPromotions(productSlug, options) {
1564
1617
  return _reactquery.useQuery.call(void 0, {
1565
1618
  queryKey: ["behio", "product-promotions", productSlug],
1566
1619
  queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
1567
- enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _92 => _92.enabled]), () => ( true))),
1568
- refetchInterval: _optionalChain([options, 'optionalAccess', _93 => _93.refetchIntervalMs])
1620
+ enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.enabled]), () => ( true))),
1621
+ refetchInterval: _optionalChain([options, 'optionalAccess', _99 => _99.refetchIntervalMs])
1569
1622
  });
1570
1623
  }
1571
1624
 
@@ -1573,11 +1626,11 @@ function useProductPromotions(productSlug, options) {
1573
1626
 
1574
1627
  function useGiftCardBalance(code, options) {
1575
1628
  const { client } = useBehio();
1576
- const trimmed = _optionalChain([code, 'optionalAccess', _94 => _94.trim, 'call', _95 => _95()]);
1629
+ const trimmed = _optionalChain([code, 'optionalAccess', _100 => _100.trim, 'call', _101 => _101()]);
1577
1630
  return _reactquery.useQuery.call(void 0, {
1578
1631
  queryKey: ["behio", "gift-card-balance", trimmed],
1579
1632
  queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
1580
- enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _96 => _96.enabled]), () => ( true)))
1633
+ enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _102 => _102.enabled]), () => ( true)))
1581
1634
  });
1582
1635
  }
1583
1636
 
@@ -1589,7 +1642,7 @@ function useWishlist(options) {
1589
1642
  const query = _reactquery.useQuery.call(void 0, {
1590
1643
  queryKey: ["behio", "wishlist"],
1591
1644
  queryFn: () => unwrap(client.wishlist.get()),
1592
- enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _97 => _97.enabled]), () => ( true))
1645
+ enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _103 => _103.enabled]), () => ( true))
1593
1646
  });
1594
1647
  const addMutation = _reactquery.useMutation.call(void 0, {
1595
1648
  mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
@@ -1621,9 +1674,9 @@ function useIsInWishlist(productId) {
1621
1674
  function useProductReviews(productId, options) {
1622
1675
  const { client } = useBehio();
1623
1676
  return _reactquery.useQuery.call(void 0, {
1624
- queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _98 => _98.page]), () => ( 1))],
1625
- queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _99 => _99.page]), _optionalChain([options, 'optionalAccess', _100 => _100.limit]))),
1626
- enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _101 => _101.enabled]), () => ( true)))
1677
+ queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _104 => _104.page]), () => ( 1))],
1678
+ queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _105 => _105.page]), _optionalChain([options, 'optionalAccess', _106 => _106.limit]))),
1679
+ enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _107 => _107.enabled]), () => ( true)))
1627
1680
  });
1628
1681
  }
1629
1682
  function useSubmitReview() {
@@ -1739,4 +1792,8 @@ function useNotifyWhenAvailable() {
1739
1792
 
1740
1793
 
1741
1794
 
1742
- exports.BehioAnalyticsTracker = BehioAnalyticsTracker; exports.BehioProvider = BehioProvider; exports.CurrencySwitcher = CurrencySwitcher; exports.StorefrontScripts = StorefrontScripts; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = _chunkJIAOZ5YWjs.formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.trackEcommerceEvent = _chunkJIAOZ5YWjs.trackEcommerceEvent; exports.useAddressAutocomplete = useAddressAutocomplete; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useBundle = useBundle; exports.useBundles = useBundles; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCookieConsent = useCookieConsent; exports.useCrossSell = useCrossSell; exports.useCurrency = useCurrency; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useGiftCardBalance = useGiftCardBalance; exports.useIsInWishlist = useIsInWishlist; exports.useLabels = useLabels; exports.useLookupReturnableOrder = useLookupReturnableOrder; exports.useMenu = useMenu; exports.useNotifyWhenAvailable = useNotifyWhenAvailable; exports.useOrder = useOrder; exports.useOrderAccess = useOrderAccess; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.useProduct = useProduct; exports.useProductGroup = useProductGroup; exports.useProductPromotions = useProductPromotions; exports.useProductReviews = useProductReviews; exports.useProducts = useProducts; exports.useQuoteStatus = useQuoteStatus; exports.useReturnStatus = useReturnStatus; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo; exports.useShopScripts = useShopScripts; exports.useShopSeo = useShopSeo; exports.useSubmitQuote = useSubmitQuote; exports.useSubmitReturn = useSubmitReturn; exports.useSubmitReview = useSubmitReview; exports.useWishlist = useWishlist;
1795
+
1796
+
1797
+
1798
+
1799
+ exports.BehioAnalyticsTracker = BehioAnalyticsTracker; exports.BehioProvider = BehioProvider; exports.CurrencySwitcher = CurrencySwitcher; exports.StorefrontScripts = StorefrontScripts; exports.cookieStorage = cookieStorage; exports.createMemoryStorage = createMemoryStorage; exports.detectStorage = detectStorage; exports.formatPrice = _chunkJIAOZ5YWjs.formatPrice; exports.localStorageAdapter = localStorageAdapter; exports.memoryStorage = memoryStorage; exports.trackEcommerceEvent = _chunkJIAOZ5YWjs.trackEcommerceEvent; exports.useAddressAutocomplete = useAddressAutocomplete; exports.useAddresses = useAddresses; exports.useAuth = useAuth; exports.useBehio = useBehio; exports.useBehioClient = useBehioClient; exports.useBundle = useBundle; exports.useBundles = useBundles; exports.useCart = useCart; exports.useCartCount = useCartCount; exports.useCategories = useCategories; exports.useCategory = useCategory; exports.useCheckout = useCheckout; exports.useCookieConsent = useCookieConsent; exports.useCrossSell = useCrossSell; exports.useCurrency = useCurrency; exports.useCustomer = useCustomer; exports.useFeatured = useFeatured; exports.useFilters = useFilters; exports.useGiftCardBalance = useGiftCardBalance; exports.useIsInWishlist = useIsInWishlist; exports.useLabels = useLabels; exports.useLookupReturnableOrder = useLookupReturnableOrder; exports.useLoyalty = useLoyalty; exports.useMenu = useMenu; exports.useNewsletterSubscribe = useNewsletterSubscribe; exports.useNewsletterUnsubscribe = useNewsletterUnsubscribe; exports.useNotifyWhenAvailable = useNotifyWhenAvailable; exports.useOrder = useOrder; exports.useOrderAccess = useOrderAccess; exports.useOrders = useOrders; exports.usePage = usePage; exports.usePages = usePages; exports.usePickupPoints = usePickupPoints; exports.useProduct = useProduct; exports.useProductGroup = useProductGroup; exports.useProductPromotions = useProductPromotions; exports.useProductReviews = useProductReviews; exports.useProducts = useProducts; exports.useQuoteStatus = useQuoteStatus; exports.useReturnStatus = useReturnStatus; exports.useSearch = useSearch; exports.useShopInfo = useShopInfo; exports.useShopScripts = useShopScripts; exports.useShopSeo = useShopSeo; exports.useSubmitQuote = useSubmitQuote; exports.useSubmitReturn = useSubmitReturn; exports.useSubmitReview = useSubmitReview; exports.useWishlist = useWishlist;