@behio/storefront-sdk 0.24.1 → 0.25.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-YS4RARKL.js → chunk-MUSTZBNR.js} +18 -7
- package/dist/{chunk-OFUECU3W.mjs → chunk-V5WU3XI4.mjs} +11 -0
- package/dist/{client-BaXNaWiW.d.mts → client-76vvJ0_n.d.mts} +46 -1
- package/dist/{client-BaXNaWiW.d.ts → client-76vvJ0_n.d.ts} +46 -1
- 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 +15 -3
- package/dist/react.d.ts +15 -3
- package/dist/react.js +69 -57
- package/dist/react.mjs +64 -52
- package/package.json +1 -1
|
@@ -539,6 +539,17 @@ var CatalogModule = class {
|
|
|
539
539
|
}
|
|
540
540
|
return this.client.request("GET", `/catalog/categories/${slug}/products`, { query: q });
|
|
541
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* Resolved navigation menu by handle (e.g. "main", "footer"), built in the
|
|
544
|
+
* admin Navigace. Item labels resolve in `locale`; typed refs come back as
|
|
545
|
+
* {type, slug} for link building. Returns an SdkResult error (404) when the
|
|
546
|
+
* handle is unknown or inactive — callers fall back to their own source.
|
|
547
|
+
*/
|
|
548
|
+
async getMenu(handle, options) {
|
|
549
|
+
return this.client.request("GET", `/catalog/menu/${encodeURIComponent(handle)}`, {
|
|
550
|
+
query: { locale: _optionalChain([options, 'optionalAccess', _22 => _22.locale]) }
|
|
551
|
+
});
|
|
552
|
+
}
|
|
542
553
|
/** Get all labels */
|
|
543
554
|
async getLabels(locale) {
|
|
544
555
|
const res = await this.client.request("GET", "/catalog/labels", { query: { locale } });
|
|
@@ -548,7 +559,7 @@ var CatalogModule = class {
|
|
|
548
559
|
/** Get featured products */
|
|
549
560
|
async getFeatured(options) {
|
|
550
561
|
return this.client.request("GET", "/catalog/featured", {
|
|
551
|
-
query: { locale: _optionalChain([options, 'optionalAccess',
|
|
562
|
+
query: { locale: _optionalChain([options, 'optionalAccess', _23 => _23.locale]), currency: _optionalChain([options, 'optionalAccess', _24 => _24.currency]) }
|
|
552
563
|
});
|
|
553
564
|
}
|
|
554
565
|
/** Get available filter fields for dynamic filter UI */
|
|
@@ -593,7 +604,7 @@ var CatalogModule = class {
|
|
|
593
604
|
/** List configured payment methods (filtered by currency). */
|
|
594
605
|
async listPaymentMethods(opts) {
|
|
595
606
|
const query = {};
|
|
596
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
607
|
+
if (_optionalChain([opts, 'optionalAccess', _25 => _25.currency])) query.currency = opts.currency;
|
|
597
608
|
return this.client.request("GET", "/catalog/payment-methods", { query });
|
|
598
609
|
}
|
|
599
610
|
};
|
|
@@ -839,7 +850,7 @@ var OrdersModule = class {
|
|
|
839
850
|
/** List customer orders (requires auth) */
|
|
840
851
|
async list(options) {
|
|
841
852
|
return this.client.request("GET", "/orders", {
|
|
842
|
-
query: { page: _optionalChain([options, 'optionalAccess',
|
|
853
|
+
query: { page: _optionalChain([options, 'optionalAccess', _26 => _26.page]), limit: _optionalChain([options, 'optionalAccess', _27 => _27.limit]) }
|
|
843
854
|
});
|
|
844
855
|
}
|
|
845
856
|
/** Get order detail (requires auth) */
|
|
@@ -1062,10 +1073,10 @@ var ShippingModule = class {
|
|
|
1062
1073
|
*/
|
|
1063
1074
|
async listMethods(opts) {
|
|
1064
1075
|
const query = {};
|
|
1065
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1066
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1067
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1068
|
-
if (_optionalChain([opts, 'optionalAccess',
|
|
1076
|
+
if (_optionalChain([opts, 'optionalAccess', _28 => _28.currency])) query.currency = opts.currency;
|
|
1077
|
+
if (_optionalChain([opts, 'optionalAccess', _29 => _29.country])) query.country = opts.country;
|
|
1078
|
+
if (_optionalChain([opts, 'optionalAccess', _30 => _30.cartTotal]) != null) query.cartTotal = String(opts.cartTotal);
|
|
1079
|
+
if (_optionalChain([opts, 'optionalAccess', _31 => _31.cartWeightKg]) != null) query.cartWeightKg = String(opts.cartWeightKg);
|
|
1069
1080
|
return this.client.request(
|
|
1070
1081
|
"GET",
|
|
1071
1082
|
"/catalog/shipping-methods",
|
|
@@ -539,6 +539,17 @@ var CatalogModule = class {
|
|
|
539
539
|
}
|
|
540
540
|
return this.client.request("GET", `/catalog/categories/${slug}/products`, { query: q });
|
|
541
541
|
}
|
|
542
|
+
/**
|
|
543
|
+
* Resolved navigation menu by handle (e.g. "main", "footer"), built in the
|
|
544
|
+
* admin Navigace. Item labels resolve in `locale`; typed refs come back as
|
|
545
|
+
* {type, slug} for link building. Returns an SdkResult error (404) when the
|
|
546
|
+
* handle is unknown or inactive — callers fall back to their own source.
|
|
547
|
+
*/
|
|
548
|
+
async getMenu(handle, options) {
|
|
549
|
+
return this.client.request("GET", `/catalog/menu/${encodeURIComponent(handle)}`, {
|
|
550
|
+
query: { locale: options?.locale }
|
|
551
|
+
});
|
|
552
|
+
}
|
|
542
553
|
/** Get all labels */
|
|
543
554
|
async getLabels(locale) {
|
|
544
555
|
const res = await this.client.request("GET", "/catalog/labels", { query: { locale } });
|
|
@@ -251,6 +251,42 @@ interface Category {
|
|
|
251
251
|
children: Category[];
|
|
252
252
|
productCount?: number;
|
|
253
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Navigation menu built in the admin (Navigace). Matches the backend
|
|
256
|
+
* `GET /storefront/v1/catalog/menu/{handle}` response exactly. Item labels are
|
|
257
|
+
* resolved in the requested locale; typed refs resolve to {type, slug} at read
|
|
258
|
+
* time so category/page/product renames flow through automatically.
|
|
259
|
+
*/
|
|
260
|
+
type MenuItemType = "CATEGORY" | "PAGE" | "LINK" | "COLLECTION" | "PRODUCT";
|
|
261
|
+
/** Resolved target of a typed menu item. Null on LINK items (use `url`). */
|
|
262
|
+
interface MenuItemRef {
|
|
263
|
+
type: MenuItemType;
|
|
264
|
+
slug: string;
|
|
265
|
+
}
|
|
266
|
+
interface MenuItem {
|
|
267
|
+
id: string;
|
|
268
|
+
type: MenuItemType;
|
|
269
|
+
/** Resolved label in the requested locale. */
|
|
270
|
+
label: string;
|
|
271
|
+
description?: string | null;
|
|
272
|
+
/** LINK items only: the raw URL to navigate to. Null on typed items. */
|
|
273
|
+
url?: string | null;
|
|
274
|
+
/** Typed items (CATEGORY/PAGE/COLLECTION/PRODUCT): resolved {type, slug}. Null on LINK. */
|
|
275
|
+
ref?: MenuItemRef | null;
|
|
276
|
+
/** Optional badge chip text (e.g. "Novinka", "Sleva"). */
|
|
277
|
+
badgeText?: string | null;
|
|
278
|
+
/** Processed image URL for mega-menu tiles (null when no image set). */
|
|
279
|
+
imageUrl?: string | null;
|
|
280
|
+
/** Nested items, up to depth 3. */
|
|
281
|
+
children: MenuItem[];
|
|
282
|
+
}
|
|
283
|
+
interface Menu {
|
|
284
|
+
handle: string;
|
|
285
|
+
name: string;
|
|
286
|
+
/** Locale the labels are resolved in. */
|
|
287
|
+
locale: string;
|
|
288
|
+
items: MenuItem[];
|
|
289
|
+
}
|
|
254
290
|
interface CategoryDetail extends Category {
|
|
255
291
|
/**
|
|
256
292
|
* SEO/Open Graph for the category page. Matches the backend's nested `seo`
|
|
@@ -1189,6 +1225,15 @@ declare class CatalogModule {
|
|
|
1189
1225
|
getCategory(slug: string, locale?: string): Promise<SdkResult<CategoryDetail>>;
|
|
1190
1226
|
/** Get products in a category */
|
|
1191
1227
|
getCategoryProducts(slug: string, query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Resolved navigation menu by handle (e.g. "main", "footer"), built in the
|
|
1230
|
+
* admin Navigace. Item labels resolve in `locale`; typed refs come back as
|
|
1231
|
+
* {type, slug} for link building. Returns an SdkResult error (404) when the
|
|
1232
|
+
* handle is unknown or inactive — callers fall back to their own source.
|
|
1233
|
+
*/
|
|
1234
|
+
getMenu(handle: string, options?: {
|
|
1235
|
+
locale?: string;
|
|
1236
|
+
}): Promise<SdkResult<Menu>>;
|
|
1192
1237
|
/** Get all labels */
|
|
1193
1238
|
getLabels(locale?: string): Promise<SdkResult<{
|
|
1194
1239
|
labels: ProductLabel[];
|
|
@@ -1512,4 +1557,4 @@ declare class ShippingModule {
|
|
|
1512
1557
|
}>>;
|
|
1513
1558
|
}
|
|
1514
1559
|
|
|
1515
|
-
export { type
|
|
1560
|
+
export { type OrderItem as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, type Menu as M, BehioApiError as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type BundleItem as T, type CartDiscount as U, type CartItem as V, type WishlistItem as W, type CheckoutAddress as X, type FulfillmentStatus as Y, type LoginInput as Z, type MessageResponse as _, BehioStorefront as a, type OrderStatus as a0, type PaymentStatus as a1, type ProductPrice as a2, type ProductReview as a3, type ProductVariant as a4, type AddressType as a5, AddressTypes as a6, type BehioErrorCode as a7, type BehioEventHandler as a8, type BehioEventType as a9, type ResponseInterceptorData as aA, type ReturnRequestItem as aB, type ReturnStatusItem as aC, type ReturnableOrderItem as aD, type SdkError as aE, type SdkResult as aF, type ShippingMethodSummary as aG, type ShippingQuote as aH, type ShippingQuoteInput as aI, type ShopScript as aJ, type ShopScriptPlacement as aK, type ShopScriptType as aL, err as aM, ok as aN, toSdkError as aO, BehioNetworkError as aa, type CartBundleLine as ab, type CartBundleLineItem as ac, type CartItemProduct as ad, type CheckoutPaymentMethod as ae, type DataGroupFieldType as af, FulfillmentStatuses as ag, type GiftCardSummary as ah, type MenuItem as ai, type MenuItemRef as aj, type MenuItemType as ak, type OrderStatusHistory as al, OrderStatuses as am, type OrderTracking as an, type PageAttachment as ao, PaymentStatuses as ap, type ProductMedia as aq, type ProductMediaVariant as ar, ProductSort as as, type ProductSortValue as at, type ProductVolumePrice as au, type QuoteItem as av, type RegisterResult as aw, type RequestInterceptor as ax, type RequestInterceptorConfig as ay, type ResponseInterceptor as az, type PaginatedResponse as b, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type Cart as g, type CustomerProfile as h, type CustomerAddress as i, type AddressDetail as j, type OrderDetail as k, type OrderAccessRequestResponse as l, type OrderAccessVerifyResponse as m, type CheckoutInput as n, type PageDetail as o, type Page as p, type ShopScripts as q, type ShopSeo as r, type Bundle as s, type CrossSellItem as t, type ActivePromotion as u, type ProductReviewsResponse as v, type SubmitReviewInput as w, type ReturnableOrder as x, type ReturnStatus as y, type ReturnRequest as z };
|
|
@@ -251,6 +251,42 @@ interface Category {
|
|
|
251
251
|
children: Category[];
|
|
252
252
|
productCount?: number;
|
|
253
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* Navigation menu built in the admin (Navigace). Matches the backend
|
|
256
|
+
* `GET /storefront/v1/catalog/menu/{handle}` response exactly. Item labels are
|
|
257
|
+
* resolved in the requested locale; typed refs resolve to {type, slug} at read
|
|
258
|
+
* time so category/page/product renames flow through automatically.
|
|
259
|
+
*/
|
|
260
|
+
type MenuItemType = "CATEGORY" | "PAGE" | "LINK" | "COLLECTION" | "PRODUCT";
|
|
261
|
+
/** Resolved target of a typed menu item. Null on LINK items (use `url`). */
|
|
262
|
+
interface MenuItemRef {
|
|
263
|
+
type: MenuItemType;
|
|
264
|
+
slug: string;
|
|
265
|
+
}
|
|
266
|
+
interface MenuItem {
|
|
267
|
+
id: string;
|
|
268
|
+
type: MenuItemType;
|
|
269
|
+
/** Resolved label in the requested locale. */
|
|
270
|
+
label: string;
|
|
271
|
+
description?: string | null;
|
|
272
|
+
/** LINK items only: the raw URL to navigate to. Null on typed items. */
|
|
273
|
+
url?: string | null;
|
|
274
|
+
/** Typed items (CATEGORY/PAGE/COLLECTION/PRODUCT): resolved {type, slug}. Null on LINK. */
|
|
275
|
+
ref?: MenuItemRef | null;
|
|
276
|
+
/** Optional badge chip text (e.g. "Novinka", "Sleva"). */
|
|
277
|
+
badgeText?: string | null;
|
|
278
|
+
/** Processed image URL for mega-menu tiles (null when no image set). */
|
|
279
|
+
imageUrl?: string | null;
|
|
280
|
+
/** Nested items, up to depth 3. */
|
|
281
|
+
children: MenuItem[];
|
|
282
|
+
}
|
|
283
|
+
interface Menu {
|
|
284
|
+
handle: string;
|
|
285
|
+
name: string;
|
|
286
|
+
/** Locale the labels are resolved in. */
|
|
287
|
+
locale: string;
|
|
288
|
+
items: MenuItem[];
|
|
289
|
+
}
|
|
254
290
|
interface CategoryDetail extends Category {
|
|
255
291
|
/**
|
|
256
292
|
* SEO/Open Graph for the category page. Matches the backend's nested `seo`
|
|
@@ -1189,6 +1225,15 @@ declare class CatalogModule {
|
|
|
1189
1225
|
getCategory(slug: string, locale?: string): Promise<SdkResult<CategoryDetail>>;
|
|
1190
1226
|
/** Get products in a category */
|
|
1191
1227
|
getCategoryProducts(slug: string, query?: ProductsQuery): Promise<SdkResult<PaginatedResponse<ProductListItem>>>;
|
|
1228
|
+
/**
|
|
1229
|
+
* Resolved navigation menu by handle (e.g. "main", "footer"), built in the
|
|
1230
|
+
* admin Navigace. Item labels resolve in `locale`; typed refs come back as
|
|
1231
|
+
* {type, slug} for link building. Returns an SdkResult error (404) when the
|
|
1232
|
+
* handle is unknown or inactive — callers fall back to their own source.
|
|
1233
|
+
*/
|
|
1234
|
+
getMenu(handle: string, options?: {
|
|
1235
|
+
locale?: string;
|
|
1236
|
+
}): Promise<SdkResult<Menu>>;
|
|
1192
1237
|
/** Get all labels */
|
|
1193
1238
|
getLabels(locale?: string): Promise<SdkResult<{
|
|
1194
1239
|
labels: ProductLabel[];
|
|
@@ -1512,4 +1557,4 @@ declare class ShippingModule {
|
|
|
1512
1557
|
}>>;
|
|
1513
1558
|
}
|
|
1514
1559
|
|
|
1515
|
-
export { type
|
|
1560
|
+
export { type OrderItem as $, type AddressSuggestion as A, type BehioStorefrontConfig as B, type Category as C, type SubmitReturnInput as D, type CookieConsent as E, type FilterField as F, type GiftCardBalance as G, type CookieConsentInput as H, type SubmitQuoteInput as I, type BackInStockSubscription as J, type AddToCartInput as K, type AuthTokens as L, type Menu as M, BehioApiError as N, type OrderListItem as O, type ProductsQuery as P, type QuoteRequest as Q, type RegisterInput as R, type ShopInfo as S, type BundleItem as T, type CartDiscount as U, type CartItem as V, type WishlistItem as W, type CheckoutAddress as X, type FulfillmentStatus as Y, type LoginInput as Z, type MessageResponse as _, BehioStorefront as a, type OrderStatus as a0, type PaymentStatus as a1, type ProductPrice as a2, type ProductReview as a3, type ProductVariant as a4, type AddressType as a5, AddressTypes as a6, type BehioErrorCode as a7, type BehioEventHandler as a8, type BehioEventType as a9, type ResponseInterceptorData as aA, type ReturnRequestItem as aB, type ReturnStatusItem as aC, type ReturnableOrderItem as aD, type SdkError as aE, type SdkResult as aF, type ShippingMethodSummary as aG, type ShippingQuote as aH, type ShippingQuoteInput as aI, type ShopScript as aJ, type ShopScriptPlacement as aK, type ShopScriptType as aL, err as aM, ok as aN, toSdkError as aO, BehioNetworkError as aa, type CartBundleLine as ab, type CartBundleLineItem as ac, type CartItemProduct as ad, type CheckoutPaymentMethod as ae, type DataGroupFieldType as af, FulfillmentStatuses as ag, type GiftCardSummary as ah, type MenuItem as ai, type MenuItemRef as aj, type MenuItemType as ak, type OrderStatusHistory as al, OrderStatuses as am, type OrderTracking as an, type PageAttachment as ao, PaymentStatuses as ap, type ProductMedia as aq, type ProductMediaVariant as ar, ProductSort as as, type ProductSortValue as at, type ProductVolumePrice as au, type QuoteItem as av, type RegisterResult as aw, type RequestInterceptor as ax, type RequestInterceptorConfig as ay, type ResponseInterceptor as az, type PaginatedResponse as b, type ProductListItem as c, type ProductDetail as d, type CategoryDetail as e, type ProductLabel as f, type Cart as g, type CustomerProfile as h, type CustomerAddress as i, type AddressDetail as j, type OrderDetail as k, type OrderAccessRequestResponse as l, type OrderAccessVerifyResponse as m, type CheckoutInput as n, type PageDetail as o, type Page as p, type ShopScripts as q, type ShopSeo as r, type Bundle as s, type CrossSellItem as t, type ActivePromotion as u, type ProductReviewsResponse as v, type SubmitReviewInput as w, type ReturnableOrder as x, type ReturnStatus as y, type ReturnRequest as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion,
|
|
1
|
+
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a5 as AddressType, a6 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, N as BehioApiError, a7 as BehioErrorCode, a8 as BehioEventHandler, a9 as BehioEventType, aa as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, T as BundleItem, g as Cart, ab as CartBundleLine, ac as CartBundleLineItem, U as CartDiscount, V as CartItem, ad as CartItemProduct, C as Category, e as CategoryDetail, X as CheckoutAddress, n as CheckoutInput, ae as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, af as DataGroupFieldType, F as FilterField, Y as FulfillmentStatus, ag as FulfillmentStatuses, G as GiftCardBalance, ah as GiftCardSummary, Z as LoginInput, M as Menu, ai as MenuItem, aj as MenuItemRef, ak as MenuItemType, _ as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, $ as OrderItem, O as OrderListItem, a0 as OrderStatus, al as OrderStatusHistory, am as OrderStatuses, an as OrderTracking, p as Page, ao as PageAttachment, o as PageDetail, b as PaginatedResponse, a1 as PaymentStatus, ap as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, aq as ProductMedia, ar as ProductMediaVariant, a2 as ProductPrice, a3 as ProductReview, v as ProductReviewsResponse, as as ProductSort, at as ProductSortValue, a4 as ProductVariant, au as ProductVolumePrice, P as ProductsQuery, av as QuoteItem, Q as QuoteRequest, R as RegisterInput, aw as RegisterResult, ax as RequestInterceptor, ay as RequestInterceptorConfig, az as ResponseInterceptor, aA as ResponseInterceptorData, z as ReturnRequest, aB as ReturnRequestItem, y as ReturnStatus, aC as ReturnStatusItem, x as ReturnableOrder, aD as ReturnableOrderItem, aE as SdkError, aF as SdkResult, aG as ShippingMethodSummary, aH as ShippingQuote, aI as ShippingQuoteInput, S as ShopInfo, aJ as ShopScript, aK as ShopScriptPlacement, aL as ShopScriptType, q as ShopScripts, r as ShopSeo, I as SubmitQuoteInput, D as SubmitReturnInput, w as SubmitReviewInput, W as WishlistItem, aM as err, aN as ok, aO as toSdkError } from './client-76vvJ0_n.mjs';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion,
|
|
1
|
+
export { u as ActivePromotion, K as AddToCartInput, j as AddressDetail, A as AddressSuggestion, a5 as AddressType, a6 as AddressTypes, L as AuthTokens, J as BackInStockSubscription, N as BehioApiError, a7 as BehioErrorCode, a8 as BehioEventHandler, a9 as BehioEventType, aa as BehioNetworkError, a as BehioStorefront, B as BehioStorefrontConfig, s as Bundle, T as BundleItem, g as Cart, ab as CartBundleLine, ac as CartBundleLineItem, U as CartDiscount, V as CartItem, ad as CartItemProduct, C as Category, e as CategoryDetail, X as CheckoutAddress, n as CheckoutInput, ae as CheckoutPaymentMethod, E as CookieConsent, H as CookieConsentInput, t as CrossSellItem, i as CustomerAddress, h as CustomerProfile, af as DataGroupFieldType, F as FilterField, Y as FulfillmentStatus, ag as FulfillmentStatuses, G as GiftCardBalance, ah as GiftCardSummary, Z as LoginInput, M as Menu, ai as MenuItem, aj as MenuItemRef, ak as MenuItemType, _ as MessageResponse, l as OrderAccessRequestResponse, m as OrderAccessVerifyResponse, k as OrderDetail, $ as OrderItem, O as OrderListItem, a0 as OrderStatus, al as OrderStatusHistory, am as OrderStatuses, an as OrderTracking, p as Page, ao as PageAttachment, o as PageDetail, b as PaginatedResponse, a1 as PaymentStatus, ap as PaymentStatuses, d as ProductDetail, f as ProductLabel, c as ProductListItem, aq as ProductMedia, ar as ProductMediaVariant, a2 as ProductPrice, a3 as ProductReview, v as ProductReviewsResponse, as as ProductSort, at as ProductSortValue, a4 as ProductVariant, au as ProductVolumePrice, P as ProductsQuery, av as QuoteItem, Q as QuoteRequest, R as RegisterInput, aw as RegisterResult, ax as RequestInterceptor, ay as RequestInterceptorConfig, az as ResponseInterceptor, aA as ResponseInterceptorData, z as ReturnRequest, aB as ReturnRequestItem, y as ReturnStatus, aC as ReturnStatusItem, x as ReturnableOrder, aD as ReturnableOrderItem, aE as SdkError, aF as SdkResult, aG as ShippingMethodSummary, aH as ShippingQuote, aI as ShippingQuoteInput, S as ShopInfo, aJ as ShopScript, aK as ShopScriptPlacement, aL as ShopScriptType, q as ShopScripts, r as ShopSeo, I as SubmitQuoteInput, D as SubmitReturnInput, w as SubmitReviewInput, W as WishlistItem, aM as err, aN as ok, aO as toSdkError } from './client-76vvJ0_n.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var _chunkJIAOZ5YWjs = require('./chunk-JIAOZ5YW.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
var
|
|
17
|
+
var _chunkMUSTZBNRjs = require('./chunk-MUSTZBNR.js');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -29,4 +29,4 @@ var _chunkYS4RARKLjs = require('./chunk-YS4RARKL.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.AddressTypes =
|
|
32
|
+
exports.AddressTypes = _chunkMUSTZBNRjs.AddressTypes; exports.BehioApiError = _chunkMUSTZBNRjs.BehioApiError; exports.BehioNetworkError = _chunkMUSTZBNRjs.BehioNetworkError; exports.BehioStorefront = _chunkMUSTZBNRjs.BehioStorefront; exports.FulfillmentStatuses = _chunkMUSTZBNRjs.FulfillmentStatuses; exports.OrderStatuses = _chunkMUSTZBNRjs.OrderStatuses; exports.PaymentStatuses = _chunkMUSTZBNRjs.PaymentStatuses; exports.ProductSort = _chunkMUSTZBNRjs.ProductSort; exports.err = _chunkMUSTZBNRjs.err; exports.formatPrice = _chunkJIAOZ5YWjs.formatPrice; exports.ok = _chunkMUSTZBNRjs.ok; exports.toSdkError = _chunkMUSTZBNRjs.toSdkError; exports.trackEcommerceEvent = _chunkJIAOZ5YWjs.trackEcommerceEvent;
|
package/dist/index.mjs
CHANGED
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-76vvJ0_n.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-76vvJ0_n.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 _chunkMUSTZBNRjs = require('./chunk-MUSTZBNR.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, _chunkMUSTZBNRjs.BehioStorefront)({
|
|
22
22
|
apiKey,
|
|
23
23
|
...baseUrl ? { baseUrl } : {},
|
|
24
24
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
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, 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 CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-
|
|
5
|
-
export { K as AddToCartInput, L as AuthTokens,
|
|
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 CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-76vvJ0_n.mjs';
|
|
5
|
+
export { K as AddToCartInput, L as AuthTokens, N as BehioApiError, T as BundleItem, U as CartDiscount, V as CartItem, X as CheckoutAddress, Y as FulfillmentStatus, Z as LoginInput, _ as MessageResponse, $ as OrderItem, a0 as OrderStatus, a1 as PaymentStatus, a2 as ProductPrice, a3 as ProductReview, a4 as ProductVariant } from './client-76vvJ0_n.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
|
|
|
@@ -149,6 +149,18 @@ interface UseCategoryOptions {
|
|
|
149
149
|
}
|
|
150
150
|
declare function useCategory(slug: string, options?: UseCategoryOptions): _tanstack_react_query.UseQueryResult<NoInfer<CategoryDetail>, Error>;
|
|
151
151
|
|
|
152
|
+
interface UseMenuOptions {
|
|
153
|
+
locale?: string;
|
|
154
|
+
enabled?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Fetch a resolved navigation menu by handle (e.g. "main"). Server-side
|
|
158
|
+
* rendering via `client.catalog.getMenu` is the primary path for templates;
|
|
159
|
+
* this hook covers client-rendered navs. Throws (via unwrap) on 404 so callers
|
|
160
|
+
* can decide whether to fall back — pass `enabled: false` to defer.
|
|
161
|
+
*/
|
|
162
|
+
declare function useMenu(handle: string, options?: UseMenuOptions): _tanstack_react_query.UseQueryResult<NoInfer<Menu>, Error>;
|
|
163
|
+
|
|
152
164
|
interface UseLabelsOptions {
|
|
153
165
|
enabled?: boolean;
|
|
154
166
|
}
|
|
@@ -1049,4 +1061,4 @@ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResu
|
|
|
1049
1061
|
*/
|
|
1050
1062
|
declare function useBehioClient(): BehioStorefront;
|
|
1051
1063
|
|
|
1052
|
-
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 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, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
1064
|
+
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, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, 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, 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 CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-
|
|
5
|
-
export { K as AddToCartInput, L as AuthTokens,
|
|
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 CrossSellItem, u as ActivePromotion, G as GiftCardBalance, W as WishlistItem, v as ProductReviewsResponse, w as SubmitReviewInput, x as ReturnableOrder, y as ReturnStatus, z as ReturnRequest, D as SubmitReturnInput, E as CookieConsent, H as CookieConsentInput, Q as QuoteRequest, I as SubmitQuoteInput, J as BackInStockSubscription } from './client-76vvJ0_n.js';
|
|
5
|
+
export { K as AddToCartInput, L as AuthTokens, N as BehioApiError, T as BundleItem, U as CartDiscount, V as CartItem, X as CheckoutAddress, Y as FulfillmentStatus, Z as LoginInput, _ as MessageResponse, $ as OrderItem, a0 as OrderStatus, a1 as PaymentStatus, a2 as ProductPrice, a3 as ProductReview, a4 as ProductVariant } from './client-76vvJ0_n.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
|
|
|
@@ -149,6 +149,18 @@ interface UseCategoryOptions {
|
|
|
149
149
|
}
|
|
150
150
|
declare function useCategory(slug: string, options?: UseCategoryOptions): _tanstack_react_query.UseQueryResult<NoInfer<CategoryDetail>, Error>;
|
|
151
151
|
|
|
152
|
+
interface UseMenuOptions {
|
|
153
|
+
locale?: string;
|
|
154
|
+
enabled?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Fetch a resolved navigation menu by handle (e.g. "main"). Server-side
|
|
158
|
+
* rendering via `client.catalog.getMenu` is the primary path for templates;
|
|
159
|
+
* this hook covers client-rendered navs. Throws (via unwrap) on 404 so callers
|
|
160
|
+
* can decide whether to fall back — pass `enabled: false` to defer.
|
|
161
|
+
*/
|
|
162
|
+
declare function useMenu(handle: string, options?: UseMenuOptions): _tanstack_react_query.UseQueryResult<NoInfer<Menu>, Error>;
|
|
163
|
+
|
|
152
164
|
interface UseLabelsOptions {
|
|
153
165
|
enabled?: boolean;
|
|
154
166
|
}
|
|
@@ -1049,4 +1061,4 @@ declare function useNotifyWhenAvailable(): _tanstack_react_query.UseMutationResu
|
|
|
1049
1061
|
*/
|
|
1050
1062
|
declare function useBehioClient(): BehioStorefront;
|
|
1051
1063
|
|
|
1052
|
-
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 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, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, useProduct, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShopInfo, useShopScripts, useShopSeo, useSubmitQuote, useSubmitReturn, useSubmitReview, useWishlist };
|
|
1064
|
+
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, 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
|
|
7
|
+
var _chunkMUSTZBNRjs = require('./chunk-MUSTZBNR.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,
|
|
137
|
+
clientRef.current = new (0, _chunkMUSTZBNRjs.BehioStorefront)({
|
|
138
138
|
apiKey,
|
|
139
139
|
baseUrl,
|
|
140
140
|
...shopDomain ? { shopDomain } : {},
|
|
@@ -334,6 +334,17 @@ function useCategory(slug, options) {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
+
// src/react/hooks/use-menu.ts
|
|
338
|
+
|
|
339
|
+
function useMenu(handle, options) {
|
|
340
|
+
const { client } = useBehio();
|
|
341
|
+
return _reactquery.useQuery.call(void 0, {
|
|
342
|
+
queryKey: ["behio", "menu", handle, _optionalChain([options, 'optionalAccess', _27 => _27.locale])],
|
|
343
|
+
queryFn: () => unwrap(client.catalog.getMenu(handle, { locale: _optionalChain([options, 'optionalAccess', _28 => _28.locale]) })),
|
|
344
|
+
enabled: _optionalChain([options, 'optionalAccess', _29 => _29.enabled]) !== false && !!handle
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
337
348
|
// src/react/hooks/use-labels.ts
|
|
338
349
|
|
|
339
350
|
function useLabels(locale, options) {
|
|
@@ -344,7 +355,7 @@ function useLabels(locale, options) {
|
|
|
344
355
|
const result = await unwrap(client.catalog.getLabels(locale));
|
|
345
356
|
return result.labels;
|
|
346
357
|
},
|
|
347
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
358
|
+
enabled: _optionalChain([options, 'optionalAccess', _30 => _30.enabled]) !== false
|
|
348
359
|
});
|
|
349
360
|
}
|
|
350
361
|
|
|
@@ -353,13 +364,13 @@ function useLabels(locale, options) {
|
|
|
353
364
|
function useFeatured(options) {
|
|
354
365
|
const { client } = useBehio();
|
|
355
366
|
return _reactquery.useQuery.call(void 0, {
|
|
356
|
-
queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess',
|
|
367
|
+
queryKey: ["behio", "featured", _optionalChain([options, 'optionalAccess', _31 => _31.locale]), _optionalChain([options, 'optionalAccess', _32 => _32.currency])],
|
|
357
368
|
queryFn: () => unwrap(client.catalog.getFeatured({
|
|
358
|
-
locale: _optionalChain([options, 'optionalAccess',
|
|
359
|
-
currency: _optionalChain([options, 'optionalAccess',
|
|
369
|
+
locale: _optionalChain([options, 'optionalAccess', _33 => _33.locale]),
|
|
370
|
+
currency: _optionalChain([options, 'optionalAccess', _34 => _34.currency])
|
|
360
371
|
})),
|
|
361
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
362
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
372
|
+
initialData: _optionalChain([options, 'optionalAccess', _35 => _35.initialData]),
|
|
373
|
+
enabled: _optionalChain([options, 'optionalAccess', _36 => _36.enabled]) !== false
|
|
363
374
|
});
|
|
364
375
|
}
|
|
365
376
|
|
|
@@ -373,7 +384,7 @@ function useFilters(options) {
|
|
|
373
384
|
const result = await unwrap(client.catalog.getFilters());
|
|
374
385
|
return result.filters;
|
|
375
386
|
},
|
|
376
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
387
|
+
enabled: _optionalChain([options, 'optionalAccess', _37 => _37.enabled]) !== false
|
|
377
388
|
});
|
|
378
389
|
}
|
|
379
390
|
|
|
@@ -382,7 +393,7 @@ function useFilters(options) {
|
|
|
382
393
|
|
|
383
394
|
function useSearch(query, options) {
|
|
384
395
|
const { client } = useBehio();
|
|
385
|
-
const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
396
|
+
const debounceMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _38 => _38.debounceMs]), () => ( 300));
|
|
386
397
|
const [debouncedQuery, setDebouncedQuery] = _react.useState.call(void 0, query);
|
|
387
398
|
_react.useEffect.call(void 0, () => {
|
|
388
399
|
if (debounceMs <= 0) {
|
|
@@ -393,12 +404,12 @@ function useSearch(query, options) {
|
|
|
393
404
|
return () => clearTimeout(timer);
|
|
394
405
|
}, [query, debounceMs]);
|
|
395
406
|
return _reactquery.useQuery.call(void 0, {
|
|
396
|
-
queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess',
|
|
407
|
+
queryKey: ["behio", "search", debouncedQuery, _optionalChain([options, 'optionalAccess', _39 => _39.page]), _optionalChain([options, 'optionalAccess', _40 => _40.limit])],
|
|
397
408
|
queryFn: () => unwrap(client.catalog.search(debouncedQuery, {
|
|
398
|
-
page: _optionalChain([options, 'optionalAccess',
|
|
399
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
409
|
+
page: _optionalChain([options, 'optionalAccess', _41 => _41.page]),
|
|
410
|
+
limit: _optionalChain([options, 'optionalAccess', _42 => _42.limit])
|
|
400
411
|
})),
|
|
401
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
412
|
+
enabled: _optionalChain([options, 'optionalAccess', _43 => _43.enabled]) !== false && debouncedQuery.length > 0
|
|
402
413
|
});
|
|
403
414
|
}
|
|
404
415
|
|
|
@@ -417,7 +428,7 @@ function useCart(options) {
|
|
|
417
428
|
queryKey: [...CART_KEY],
|
|
418
429
|
queryFn: () => unwrap(client.cart.get()),
|
|
419
430
|
// Only fetch if we have a cart session or are logged in
|
|
420
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
431
|
+
enabled: _optionalChain([options, 'optionalAccess', _44 => _44.enabled]) !== false && (!!client.getCartSession() || !!client.getAccessToken())
|
|
421
432
|
});
|
|
422
433
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
423
434
|
mutationFn: async ({ productId, quantity }) => {
|
|
@@ -450,7 +461,7 @@ function useCart(options) {
|
|
|
450
461
|
return { previous };
|
|
451
462
|
},
|
|
452
463
|
onError: (_err, _vars, context) => {
|
|
453
|
-
if (_optionalChain([context, 'optionalAccess',
|
|
464
|
+
if (_optionalChain([context, 'optionalAccess', _45 => _45.previous])) {
|
|
454
465
|
queryClient.setQueryData([...CART_KEY], context.previous);
|
|
455
466
|
}
|
|
456
467
|
},
|
|
@@ -476,7 +487,7 @@ function useCart(options) {
|
|
|
476
487
|
return { previous };
|
|
477
488
|
},
|
|
478
489
|
onError: (_err, _vars, context) => {
|
|
479
|
-
if (_optionalChain([context, 'optionalAccess',
|
|
490
|
+
if (_optionalChain([context, 'optionalAccess', _46 => _46.previous])) {
|
|
480
491
|
queryClient.setQueryData([...CART_KEY], context.previous);
|
|
481
492
|
}
|
|
482
493
|
},
|
|
@@ -553,7 +564,7 @@ function useCart(options) {
|
|
|
553
564
|
removeDiscount,
|
|
554
565
|
merge,
|
|
555
566
|
// Computed
|
|
556
|
-
itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess',
|
|
567
|
+
itemCount: _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _47 => _47.itemCount]), () => ( 0)),
|
|
557
568
|
isEmpty: !cart || cart.items.length === 0,
|
|
558
569
|
// Mutation states
|
|
559
570
|
isAdding: addMutation.isPending,
|
|
@@ -572,10 +583,10 @@ function useCartCount(options) {
|
|
|
572
583
|
const { data } = _reactquery.useQuery.call(void 0, {
|
|
573
584
|
queryKey: [...CART_KEY2],
|
|
574
585
|
queryFn: () => unwrap(client.cart.get()),
|
|
575
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
586
|
+
enabled: _optionalChain([options, 'optionalAccess', _48 => _48.enabled]) !== false && !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
|
|
576
587
|
});
|
|
577
588
|
const cart = _nullishCoalesce(cachedCart, () => ( data));
|
|
578
|
-
return _nullishCoalesce(_optionalChain([cart, 'optionalAccess',
|
|
589
|
+
return _nullishCoalesce(_optionalChain([cart, 'optionalAccess', _49 => _49.itemCount]), () => ( 0));
|
|
579
590
|
}
|
|
580
591
|
|
|
581
592
|
// src/react/hooks/use-auth.ts
|
|
@@ -715,7 +726,7 @@ function useCustomer(options) {
|
|
|
715
726
|
} = _reactquery.useQuery.call(void 0, {
|
|
716
727
|
queryKey: [...CUSTOMER_KEY2],
|
|
717
728
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
718
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
729
|
+
enabled: _optionalChain([options, 'optionalAccess', _50 => _50.enabled]) !== false && !!client.getAccessToken()
|
|
719
730
|
});
|
|
720
731
|
const updateMutation = _reactquery.useMutation.call(void 0, {
|
|
721
732
|
mutationFn: (data2) => unwrap(client.customer.updateProfile(data2)),
|
|
@@ -753,7 +764,7 @@ function useAddresses(options) {
|
|
|
753
764
|
const result = await unwrap(client.customer.getAddresses());
|
|
754
765
|
return result.items;
|
|
755
766
|
},
|
|
756
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
767
|
+
enabled: _optionalChain([options, 'optionalAccess', _51 => _51.enabled]) !== false && !!client.getAccessToken()
|
|
757
768
|
});
|
|
758
769
|
const createMutation = _reactquery.useMutation.call(void 0, {
|
|
759
770
|
mutationFn: (address) => unwrap(client.customer.createAddress(address)),
|
|
@@ -852,7 +863,7 @@ function useAddressAutocomplete(options) {
|
|
|
852
863
|
return {
|
|
853
864
|
query,
|
|
854
865
|
setQuery,
|
|
855
|
-
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
866
|
+
suggestions: _nullishCoalesce(_optionalChain([data, 'optionalAccess', _52 => _52.suggestions]), () => ( [])),
|
|
856
867
|
isLoading: isLoading && debouncedQuery.length >= minChars,
|
|
857
868
|
select,
|
|
858
869
|
selected,
|
|
@@ -877,10 +888,10 @@ function useOrders(options) {
|
|
|
877
888
|
enabled: enabled !== false && !!client.getAccessToken()
|
|
878
889
|
});
|
|
879
890
|
const items = _react.useMemo.call(void 0,
|
|
880
|
-
() => _nullishCoalesce(_optionalChain([infinite, 'access',
|
|
891
|
+
() => _nullishCoalesce(_optionalChain([infinite, 'access', _53 => _53.data, 'optionalAccess', _54 => _54.pages, 'access', _55 => _55.flatMap, 'call', _56 => _56((p) => p.items)]), () => ( [])),
|
|
881
892
|
[infinite.data]
|
|
882
893
|
);
|
|
883
|
-
const lastPage = _optionalChain([infinite, 'access',
|
|
894
|
+
const lastPage = _optionalChain([infinite, 'access', _57 => _57.data, 'optionalAccess', _58 => _58.pages, 'access', _59 => _59[infinite.data.pages.length - 1]]);
|
|
884
895
|
const loadMore = _react.useCallback.call(void 0, () => {
|
|
885
896
|
if (infinite.hasNextPage && !infinite.isFetchingNextPage) {
|
|
886
897
|
return infinite.fetchNextPage();
|
|
@@ -893,10 +904,10 @@ function useOrders(options) {
|
|
|
893
904
|
return {
|
|
894
905
|
items,
|
|
895
906
|
data: infinite.data,
|
|
896
|
-
total: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
897
|
-
totalPages: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
898
|
-
currentPage: _nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
899
|
-
limit: _nullishCoalesce(_nullishCoalesce(_optionalChain([lastPage, 'optionalAccess',
|
|
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)),
|
|
900
911
|
page,
|
|
901
912
|
setPage: goToPage,
|
|
902
913
|
loadMore,
|
|
@@ -925,7 +936,7 @@ function useOrder(orderNumber, options) {
|
|
|
925
936
|
} = _reactquery.useQuery.call(void 0, {
|
|
926
937
|
queryKey: ["behio", "order", orderNumber],
|
|
927
938
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
928
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
939
|
+
enabled: _optionalChain([options, 'optionalAccess', _64 => _64.enabled]) !== false && !!orderNumber && !!client.getAccessToken()
|
|
929
940
|
});
|
|
930
941
|
const cancelMutation = _reactquery.useMutation.call(void 0, {
|
|
931
942
|
mutationFn: () => unwrap(client.orders.cancel(orderNumber)),
|
|
@@ -1050,7 +1061,7 @@ function usePages(locale, options) {
|
|
|
1050
1061
|
const result = await unwrap(client.pages.list(locale));
|
|
1051
1062
|
return result.pages;
|
|
1052
1063
|
},
|
|
1053
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1064
|
+
enabled: _optionalChain([options, 'optionalAccess', _65 => _65.enabled]) !== false
|
|
1054
1065
|
});
|
|
1055
1066
|
}
|
|
1056
1067
|
function usePage(slug, locale, options) {
|
|
@@ -1058,7 +1069,7 @@ function usePage(slug, locale, options) {
|
|
|
1058
1069
|
return _reactquery.useQuery.call(void 0, {
|
|
1059
1070
|
queryKey: ["behio", "page", slug, locale],
|
|
1060
1071
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1061
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1072
|
+
enabled: _optionalChain([options, 'optionalAccess', _66 => _66.enabled]) !== false && !!slug
|
|
1062
1073
|
});
|
|
1063
1074
|
}
|
|
1064
1075
|
|
|
@@ -1069,7 +1080,7 @@ function useShopInfo(options) {
|
|
|
1069
1080
|
return _reactquery.useQuery.call(void 0, {
|
|
1070
1081
|
queryKey: ["behio", "shop-info"],
|
|
1071
1082
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1072
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1083
|
+
enabled: _optionalChain([options, 'optionalAccess', _67 => _67.enabled]) !== false
|
|
1073
1084
|
});
|
|
1074
1085
|
}
|
|
1075
1086
|
|
|
@@ -1080,7 +1091,7 @@ function useShopScripts(options) {
|
|
|
1080
1091
|
return _reactquery.useQuery.call(void 0, {
|
|
1081
1092
|
queryKey: ["behio", "shop-scripts"],
|
|
1082
1093
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1083
|
-
enabled: _optionalChain([options, 'optionalAccess',
|
|
1094
|
+
enabled: _optionalChain([options, 'optionalAccess', _68 => _68.enabled]) !== false
|
|
1084
1095
|
});
|
|
1085
1096
|
}
|
|
1086
1097
|
|
|
@@ -1108,8 +1119,8 @@ function dedupe(values) {
|
|
|
1108
1119
|
function useCurrency() {
|
|
1109
1120
|
const { currency, setCurrency, configuredDefaultCurrency, configuredCurrencies } = useBehio();
|
|
1110
1121
|
const { data: shop, isLoading } = useShopInfo();
|
|
1111
|
-
const defaultCurrency = _nullishCoalesce(configuredDefaultCurrency, () => ( _optionalChain([shop, 'optionalAccess',
|
|
1112
|
-
const currencies = configuredCurrencies && configuredCurrencies.length > 0 ? dedupe(configuredCurrencies) : dedupe([defaultCurrency, ..._nullishCoalesce(_optionalChain([shop, 'optionalAccess',
|
|
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]), () => ( []))]);
|
|
1113
1124
|
return {
|
|
1114
1125
|
currency,
|
|
1115
1126
|
effectiveCurrency: _nullishCoalesce(currency, () => ( defaultCurrency)),
|
|
@@ -1132,7 +1143,7 @@ function CurrencySwitcher({
|
|
|
1132
1143
|
const { currencies, effectiveCurrency, setCurrency } = useCurrency();
|
|
1133
1144
|
if (currencies.length === 0) return null;
|
|
1134
1145
|
if (currencies.length <= 1 && !showWhenSingle) return null;
|
|
1135
|
-
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess',
|
|
1146
|
+
const label = (code) => _nullishCoalesce(_optionalChain([labels, 'optionalAccess', _71 => _71[code]]), () => ( code));
|
|
1136
1147
|
if (children) {
|
|
1137
1148
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children: children({ currencies, value: effectiveCurrency, setCurrency, label }) });
|
|
1138
1149
|
}
|
|
@@ -1249,9 +1260,9 @@ function StorefrontScripts({ visitorId: visitorIdProp } = {}) {
|
|
|
1249
1260
|
}
|
|
1250
1261
|
}, [visitorIdProp]);
|
|
1251
1262
|
const { data: consent } = useCookieConsent(visitorId || void 0);
|
|
1252
|
-
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess',
|
|
1263
|
+
const analyticsOk = Boolean(_optionalChain([consent, 'optionalAccess', _72 => _72.analytics]));
|
|
1253
1264
|
const scripts = _react.useMemo.call(void 0,
|
|
1254
|
-
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess',
|
|
1265
|
+
() => (_nullishCoalesce(_optionalChain([data, 'optionalAccess', _73 => _73.scripts]), () => ( []))).filter((s) => !s.consentRequired || analyticsOk),
|
|
1255
1266
|
[data, analyticsOk]
|
|
1256
1267
|
);
|
|
1257
1268
|
const signature = _react.useMemo.call(void 0,
|
|
@@ -1316,7 +1327,7 @@ function initTracker(client) {
|
|
|
1316
1327
|
return;
|
|
1317
1328
|
}
|
|
1318
1329
|
const { data } = await client.consent.get(stored);
|
|
1319
|
-
const granted = Boolean(_optionalChain([data, 'optionalAccess',
|
|
1330
|
+
const granted = Boolean(_optionalChain([data, 'optionalAccess', _74 => _74.analytics]));
|
|
1320
1331
|
visitorId = granted ? stored : void 0;
|
|
1321
1332
|
client.setAnalyticsVisitorId(granted ? stored : null);
|
|
1322
1333
|
} catch (e7) {
|
|
@@ -1400,7 +1411,7 @@ function initTracker(client) {
|
|
|
1400
1411
|
};
|
|
1401
1412
|
const onClick = (ev) => {
|
|
1402
1413
|
const target = ev.target;
|
|
1403
|
-
const el = _optionalChain([target, 'optionalAccess',
|
|
1414
|
+
const el = _optionalChain([target, 'optionalAccess', _75 => _75.closest, 'optionalCall', _76 => _76("a,button,[role=button],[data-behio-event]")]);
|
|
1404
1415
|
if (!el) return;
|
|
1405
1416
|
const explicit = _nullishCoalesce(el.getAttribute("data-behio-event"), () => ( void 0));
|
|
1406
1417
|
const text = (_nullishCoalesce(el.textContent, () => ( ""))).trim().replace(/\s+/g, " ").slice(0, 80) || void 0;
|
|
@@ -1441,7 +1452,7 @@ function initTracker(client) {
|
|
|
1441
1452
|
items: payload.items.length,
|
|
1442
1453
|
// First item id = the product (view_item/add_to_cart are
|
|
1443
1454
|
// single-product in practice) - Behavioral Offers count on it.
|
|
1444
|
-
itemId: _optionalChain([payload, 'access',
|
|
1455
|
+
itemId: _optionalChain([payload, 'access', _77 => _77.items, 'access', _78 => _78[0], 'optionalAccess', _79 => _79.item_id])
|
|
1445
1456
|
}
|
|
1446
1457
|
} : {}
|
|
1447
1458
|
});
|
|
@@ -1503,8 +1514,8 @@ function useBundles(options) {
|
|
|
1503
1514
|
return _reactquery.useQuery.call(void 0, {
|
|
1504
1515
|
queryKey: ["behio", "bundles"],
|
|
1505
1516
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1506
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1507
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1517
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _80 => _80.enabled]), () => ( true)),
|
|
1518
|
+
initialData: _optionalChain([options, 'optionalAccess', _81 => _81.initialData])
|
|
1508
1519
|
});
|
|
1509
1520
|
}
|
|
1510
1521
|
function useBundle(slug, options) {
|
|
@@ -1512,8 +1523,8 @@ function useBundle(slug, options) {
|
|
|
1512
1523
|
return _reactquery.useQuery.call(void 0, {
|
|
1513
1524
|
queryKey: ["behio", "bundle", slug],
|
|
1514
1525
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1515
|
-
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1516
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1526
|
+
enabled: Boolean(slug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _82 => _82.enabled]), () => ( true))),
|
|
1527
|
+
initialData: _optionalChain([options, 'optionalAccess', _83 => _83.initialData])
|
|
1517
1528
|
});
|
|
1518
1529
|
}
|
|
1519
1530
|
|
|
@@ -1524,8 +1535,8 @@ function useCrossSell(productSlug, options) {
|
|
|
1524
1535
|
return _reactquery.useQuery.call(void 0, {
|
|
1525
1536
|
queryKey: ["behio", "cross-sell", productSlug],
|
|
1526
1537
|
queryFn: () => unwrap(client.catalog.getCrossSell(productSlug)),
|
|
1527
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1528
|
-
initialData: _optionalChain([options, 'optionalAccess',
|
|
1538
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _84 => _84.enabled]), () => ( true))),
|
|
1539
|
+
initialData: _optionalChain([options, 'optionalAccess', _85 => _85.initialData])
|
|
1529
1540
|
});
|
|
1530
1541
|
}
|
|
1531
1542
|
|
|
@@ -1536,8 +1547,8 @@ function useProductPromotions(productSlug, options) {
|
|
|
1536
1547
|
return _reactquery.useQuery.call(void 0, {
|
|
1537
1548
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1538
1549
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1539
|
-
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1540
|
-
refetchInterval: _optionalChain([options, 'optionalAccess',
|
|
1550
|
+
enabled: Boolean(productSlug) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _86 => _86.enabled]), () => ( true))),
|
|
1551
|
+
refetchInterval: _optionalChain([options, 'optionalAccess', _87 => _87.refetchIntervalMs])
|
|
1541
1552
|
});
|
|
1542
1553
|
}
|
|
1543
1554
|
|
|
@@ -1545,11 +1556,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1545
1556
|
|
|
1546
1557
|
function useGiftCardBalance(code, options) {
|
|
1547
1558
|
const { client } = useBehio();
|
|
1548
|
-
const trimmed = _optionalChain([code, 'optionalAccess',
|
|
1559
|
+
const trimmed = _optionalChain([code, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()]);
|
|
1549
1560
|
return _reactquery.useQuery.call(void 0, {
|
|
1550
1561
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1551
1562
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1552
|
-
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1563
|
+
enabled: Boolean(trimmed && trimmed.length >= 6) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _90 => _90.enabled]), () => ( true)))
|
|
1553
1564
|
});
|
|
1554
1565
|
}
|
|
1555
1566
|
|
|
@@ -1561,7 +1572,7 @@ function useWishlist(options) {
|
|
|
1561
1572
|
const query = _reactquery.useQuery.call(void 0, {
|
|
1562
1573
|
queryKey: ["behio", "wishlist"],
|
|
1563
1574
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1564
|
-
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1575
|
+
enabled: _nullishCoalesce(_optionalChain([options, 'optionalAccess', _91 => _91.enabled]), () => ( true))
|
|
1565
1576
|
});
|
|
1566
1577
|
const addMutation = _reactquery.useMutation.call(void 0, {
|
|
1567
1578
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
@@ -1593,9 +1604,9 @@ function useIsInWishlist(productId) {
|
|
|
1593
1604
|
function useProductReviews(productId, options) {
|
|
1594
1605
|
const { client } = useBehio();
|
|
1595
1606
|
return _reactquery.useQuery.call(void 0, {
|
|
1596
|
-
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1597
|
-
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess',
|
|
1598
|
-
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1607
|
+
queryKey: ["behio", "reviews", productId, _nullishCoalesce(_optionalChain([options, 'optionalAccess', _92 => _92.page]), () => ( 1))],
|
|
1608
|
+
queryFn: () => unwrap(client.reviews.getProductReviews(productId, _optionalChain([options, 'optionalAccess', _93 => _93.page]), _optionalChain([options, 'optionalAccess', _94 => _94.limit]))),
|
|
1609
|
+
enabled: Boolean(productId) && (_nullishCoalesce(_optionalChain([options, 'optionalAccess', _95 => _95.enabled]), () => ( true)))
|
|
1599
1610
|
});
|
|
1600
1611
|
}
|
|
1601
1612
|
function useSubmitReview() {
|
|
@@ -1709,4 +1720,5 @@ function useNotifyWhenAvailable() {
|
|
|
1709
1720
|
|
|
1710
1721
|
|
|
1711
1722
|
|
|
1712
|
-
|
|
1723
|
+
|
|
1724
|
+
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.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;
|
package/dist/react.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-ZOZAJG6T.mjs";
|
|
5
5
|
import {
|
|
6
6
|
BehioStorefront
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-V5WU3XI4.mjs";
|
|
8
8
|
|
|
9
9
|
// src/react/provider.tsx
|
|
10
10
|
import { useRef, useEffect, useMemo, useState, useCallback } from "react";
|
|
@@ -334,11 +334,22 @@ function useCategory(slug, options) {
|
|
|
334
334
|
});
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
// src/react/hooks/use-
|
|
337
|
+
// src/react/hooks/use-menu.ts
|
|
338
338
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
339
|
-
function
|
|
339
|
+
function useMenu(handle, options) {
|
|
340
340
|
const { client } = useBehio();
|
|
341
341
|
return useQuery3({
|
|
342
|
+
queryKey: ["behio", "menu", handle, options?.locale],
|
|
343
|
+
queryFn: () => unwrap(client.catalog.getMenu(handle, { locale: options?.locale })),
|
|
344
|
+
enabled: options?.enabled !== false && !!handle
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
// src/react/hooks/use-labels.ts
|
|
349
|
+
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
350
|
+
function useLabels(locale, options) {
|
|
351
|
+
const { client } = useBehio();
|
|
352
|
+
return useQuery4({
|
|
342
353
|
queryKey: ["behio", "labels", locale],
|
|
343
354
|
queryFn: async () => {
|
|
344
355
|
const result = await unwrap(client.catalog.getLabels(locale));
|
|
@@ -349,10 +360,10 @@ function useLabels(locale, options) {
|
|
|
349
360
|
}
|
|
350
361
|
|
|
351
362
|
// src/react/hooks/use-featured.ts
|
|
352
|
-
import { useQuery as
|
|
363
|
+
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
353
364
|
function useFeatured(options) {
|
|
354
365
|
const { client } = useBehio();
|
|
355
|
-
return
|
|
366
|
+
return useQuery5({
|
|
356
367
|
queryKey: ["behio", "featured", options?.locale, options?.currency],
|
|
357
368
|
queryFn: () => unwrap(client.catalog.getFeatured({
|
|
358
369
|
locale: options?.locale,
|
|
@@ -364,10 +375,10 @@ function useFeatured(options) {
|
|
|
364
375
|
}
|
|
365
376
|
|
|
366
377
|
// src/react/hooks/use-filters.ts
|
|
367
|
-
import { useQuery as
|
|
378
|
+
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
368
379
|
function useFilters(options) {
|
|
369
380
|
const { client } = useBehio();
|
|
370
|
-
return
|
|
381
|
+
return useQuery6({
|
|
371
382
|
queryKey: ["behio", "filters"],
|
|
372
383
|
queryFn: async () => {
|
|
373
384
|
const result = await unwrap(client.catalog.getFilters());
|
|
@@ -379,7 +390,7 @@ function useFilters(options) {
|
|
|
379
390
|
|
|
380
391
|
// src/react/hooks/use-search.ts
|
|
381
392
|
import { useState as useState3, useEffect as useEffect2 } from "react";
|
|
382
|
-
import { useQuery as
|
|
393
|
+
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
383
394
|
function useSearch(query, options) {
|
|
384
395
|
const { client } = useBehio();
|
|
385
396
|
const debounceMs = options?.debounceMs ?? 300;
|
|
@@ -392,7 +403,7 @@ function useSearch(query, options) {
|
|
|
392
403
|
const timer = setTimeout(() => setDebouncedQuery(query), debounceMs);
|
|
393
404
|
return () => clearTimeout(timer);
|
|
394
405
|
}, [query, debounceMs]);
|
|
395
|
-
return
|
|
406
|
+
return useQuery7({
|
|
396
407
|
queryKey: ["behio", "search", debouncedQuery, options?.page, options?.limit],
|
|
397
408
|
queryFn: () => unwrap(client.catalog.search(debouncedQuery, {
|
|
398
409
|
page: options?.page,
|
|
@@ -404,7 +415,7 @@ function useSearch(query, options) {
|
|
|
404
415
|
|
|
405
416
|
// src/react/hooks/use-cart.ts
|
|
406
417
|
import { useCallback as useCallback3 } from "react";
|
|
407
|
-
import { useQuery as
|
|
418
|
+
import { useQuery as useQuery8, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
408
419
|
var CART_KEY = ["behio", "cart"];
|
|
409
420
|
function useCart(options) {
|
|
410
421
|
const { client, storage } = useBehio();
|
|
@@ -413,7 +424,7 @@ function useCart(options) {
|
|
|
413
424
|
data: cart,
|
|
414
425
|
isLoading,
|
|
415
426
|
error
|
|
416
|
-
} =
|
|
427
|
+
} = useQuery8({
|
|
417
428
|
queryKey: [...CART_KEY],
|
|
418
429
|
queryFn: () => unwrap(client.cart.get()),
|
|
419
430
|
// Only fetch if we have a cart session or are logged in
|
|
@@ -563,13 +574,13 @@ function useCart(options) {
|
|
|
563
574
|
}
|
|
564
575
|
|
|
565
576
|
// src/react/hooks/use-cart-count.ts
|
|
566
|
-
import { useQuery as
|
|
577
|
+
import { useQuery as useQuery9, useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
567
578
|
var CART_KEY2 = ["behio", "cart"];
|
|
568
579
|
function useCartCount(options) {
|
|
569
580
|
const { client } = useBehio();
|
|
570
581
|
const queryClient = useQueryClient2();
|
|
571
582
|
const cachedCart = queryClient.getQueryData([...CART_KEY2]);
|
|
572
|
-
const { data } =
|
|
583
|
+
const { data } = useQuery9({
|
|
573
584
|
queryKey: [...CART_KEY2],
|
|
574
585
|
queryFn: () => unwrap(client.cart.get()),
|
|
575
586
|
enabled: options?.enabled !== false && !cachedCart && (!!client.getCartSession() || !!client.getAccessToken())
|
|
@@ -580,7 +591,7 @@ function useCartCount(options) {
|
|
|
580
591
|
|
|
581
592
|
// src/react/hooks/use-auth.ts
|
|
582
593
|
import { useCallback as useCallback4 } from "react";
|
|
583
|
-
import { useQuery as
|
|
594
|
+
import { useQuery as useQuery10, useMutation as useMutation2, useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
584
595
|
var CUSTOMER_KEY = ["behio", "customer"];
|
|
585
596
|
var CART_KEY3 = ["behio", "cart"];
|
|
586
597
|
function useAuth() {
|
|
@@ -590,7 +601,7 @@ function useAuth() {
|
|
|
590
601
|
const {
|
|
591
602
|
data: customer,
|
|
592
603
|
isLoading
|
|
593
|
-
} =
|
|
604
|
+
} = useQuery10({
|
|
594
605
|
queryKey: [...CUSTOMER_KEY],
|
|
595
606
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
596
607
|
enabled: isLoggedIn
|
|
@@ -703,7 +714,7 @@ function useAuth() {
|
|
|
703
714
|
|
|
704
715
|
// src/react/hooks/use-customer.ts
|
|
705
716
|
import { useCallback as useCallback5 } from "react";
|
|
706
|
-
import { useQuery as
|
|
717
|
+
import { useQuery as useQuery11, useMutation as useMutation3, useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
707
718
|
var CUSTOMER_KEY2 = ["behio", "customer"];
|
|
708
719
|
function useCustomer(options) {
|
|
709
720
|
const { client } = useBehio();
|
|
@@ -712,7 +723,7 @@ function useCustomer(options) {
|
|
|
712
723
|
data,
|
|
713
724
|
isLoading,
|
|
714
725
|
error
|
|
715
|
-
} =
|
|
726
|
+
} = useQuery11({
|
|
716
727
|
queryKey: [...CUSTOMER_KEY2],
|
|
717
728
|
queryFn: () => unwrap(client.customer.getProfile()),
|
|
718
729
|
enabled: options?.enabled !== false && !!client.getAccessToken()
|
|
@@ -738,7 +749,7 @@ function useCustomer(options) {
|
|
|
738
749
|
|
|
739
750
|
// src/react/hooks/use-addresses.ts
|
|
740
751
|
import { useCallback as useCallback6 } from "react";
|
|
741
|
-
import { useQuery as
|
|
752
|
+
import { useQuery as useQuery12, useMutation as useMutation4, useQueryClient as useQueryClient5 } from "@tanstack/react-query";
|
|
742
753
|
var ADDRESSES_KEY = ["behio", "addresses"];
|
|
743
754
|
function useAddresses(options) {
|
|
744
755
|
const { client } = useBehio();
|
|
@@ -747,7 +758,7 @@ function useAddresses(options) {
|
|
|
747
758
|
data,
|
|
748
759
|
isLoading,
|
|
749
760
|
error
|
|
750
|
-
} =
|
|
761
|
+
} = useQuery12({
|
|
751
762
|
queryKey: [...ADDRESSES_KEY],
|
|
752
763
|
queryFn: async () => {
|
|
753
764
|
const result = await unwrap(client.customer.getAddresses());
|
|
@@ -799,7 +810,7 @@ function useAddresses(options) {
|
|
|
799
810
|
|
|
800
811
|
// src/react/hooks/use-address-autocomplete.ts
|
|
801
812
|
import { useState as useState4, useEffect as useEffect3, useRef as useRef2, useCallback as useCallback7 } from "react";
|
|
802
|
-
import { useQuery as
|
|
813
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
803
814
|
var AC_KEY = ["behio", "address-autocomplete"];
|
|
804
815
|
function useAddressAutocomplete(options) {
|
|
805
816
|
const { country, debounce = 300, minChars = 3, enabled = true } = options;
|
|
@@ -822,7 +833,7 @@ function useAddressAutocomplete(options) {
|
|
|
822
833
|
if (timerRef.current) clearTimeout(timerRef.current);
|
|
823
834
|
};
|
|
824
835
|
}, [query, debounce, minChars]);
|
|
825
|
-
const { data, isLoading } =
|
|
836
|
+
const { data, isLoading } = useQuery13({
|
|
826
837
|
queryKey: [...AC_KEY, debouncedQuery, country],
|
|
827
838
|
queryFn: () => unwrap(client.addresses.autocomplete(debouncedQuery, country)),
|
|
828
839
|
enabled: enabled && debouncedQuery.length >= minChars,
|
|
@@ -914,7 +925,7 @@ function useOrders(options) {
|
|
|
914
925
|
|
|
915
926
|
// src/react/hooks/use-order.ts
|
|
916
927
|
import { useCallback as useCallback9 } from "react";
|
|
917
|
-
import { useQuery as
|
|
928
|
+
import { useQuery as useQuery14, useMutation as useMutation5, useQueryClient as useQueryClient7 } from "@tanstack/react-query";
|
|
918
929
|
function useOrder(orderNumber, options) {
|
|
919
930
|
const { client } = useBehio();
|
|
920
931
|
const queryClient = useQueryClient7();
|
|
@@ -922,7 +933,7 @@ function useOrder(orderNumber, options) {
|
|
|
922
933
|
data,
|
|
923
934
|
isLoading,
|
|
924
935
|
error
|
|
925
|
-
} =
|
|
936
|
+
} = useQuery14({
|
|
926
937
|
queryKey: ["behio", "order", orderNumber],
|
|
927
938
|
queryFn: () => unwrap(client.orders.get(orderNumber)),
|
|
928
939
|
enabled: options?.enabled !== false && !!orderNumber && !!client.getAccessToken()
|
|
@@ -1041,10 +1052,10 @@ function useCheckout() {
|
|
|
1041
1052
|
}
|
|
1042
1053
|
|
|
1043
1054
|
// src/react/hooks/use-pages.ts
|
|
1044
|
-
import { useQuery as
|
|
1055
|
+
import { useQuery as useQuery15 } from "@tanstack/react-query";
|
|
1045
1056
|
function usePages(locale, options) {
|
|
1046
1057
|
const { client } = useBehio();
|
|
1047
|
-
return
|
|
1058
|
+
return useQuery15({
|
|
1048
1059
|
queryKey: ["behio", "pages", locale],
|
|
1049
1060
|
queryFn: async () => {
|
|
1050
1061
|
const result = await unwrap(client.pages.list(locale));
|
|
@@ -1055,7 +1066,7 @@ function usePages(locale, options) {
|
|
|
1055
1066
|
}
|
|
1056
1067
|
function usePage(slug, locale, options) {
|
|
1057
1068
|
const { client } = useBehio();
|
|
1058
|
-
return
|
|
1069
|
+
return useQuery15({
|
|
1059
1070
|
queryKey: ["behio", "page", slug, locale],
|
|
1060
1071
|
queryFn: () => unwrap(client.pages.get(slug, locale)),
|
|
1061
1072
|
enabled: options?.enabled !== false && !!slug
|
|
@@ -1063,10 +1074,10 @@ function usePage(slug, locale, options) {
|
|
|
1063
1074
|
}
|
|
1064
1075
|
|
|
1065
1076
|
// src/react/hooks/use-shop-info.ts
|
|
1066
|
-
import { useQuery as
|
|
1077
|
+
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
1067
1078
|
function useShopInfo(options) {
|
|
1068
1079
|
const { client } = useBehio();
|
|
1069
|
-
return
|
|
1080
|
+
return useQuery16({
|
|
1070
1081
|
queryKey: ["behio", "shop-info"],
|
|
1071
1082
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
1072
1083
|
enabled: options?.enabled !== false
|
|
@@ -1074,10 +1085,10 @@ function useShopInfo(options) {
|
|
|
1074
1085
|
}
|
|
1075
1086
|
|
|
1076
1087
|
// src/react/hooks/use-shop-scripts.ts
|
|
1077
|
-
import { useQuery as
|
|
1088
|
+
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
1078
1089
|
function useShopScripts(options) {
|
|
1079
1090
|
const { client } = useBehio();
|
|
1080
|
-
return
|
|
1091
|
+
return useQuery17({
|
|
1081
1092
|
queryKey: ["behio", "shop-scripts"],
|
|
1082
1093
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
1083
1094
|
enabled: options?.enabled !== false
|
|
@@ -1085,11 +1096,11 @@ function useShopScripts(options) {
|
|
|
1085
1096
|
}
|
|
1086
1097
|
|
|
1087
1098
|
// src/react/hooks/use-shop-seo.ts
|
|
1088
|
-
import { useQuery as
|
|
1099
|
+
import { useQuery as useQuery18 } from "@tanstack/react-query";
|
|
1089
1100
|
function useShopSeo(options) {
|
|
1090
1101
|
const { client } = useBehio();
|
|
1091
1102
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
1092
|
-
return
|
|
1103
|
+
return useQuery18({
|
|
1093
1104
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
1094
1105
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
1095
1106
|
initialData,
|
|
@@ -1152,11 +1163,11 @@ function CurrencySwitcher({
|
|
|
1152
1163
|
import { useEffect as useEffect4, useMemo as useMemo4, useState as useState8 } from "react";
|
|
1153
1164
|
|
|
1154
1165
|
// src/react/hooks/use-consent.ts
|
|
1155
|
-
import { useQuery as
|
|
1166
|
+
import { useQuery as useQuery19, useMutation as useMutation8, useQueryClient as useQueryClient9 } from "@tanstack/react-query";
|
|
1156
1167
|
function useCookieConsent(visitorId) {
|
|
1157
1168
|
const { client } = useBehio();
|
|
1158
1169
|
const qc = useQueryClient9();
|
|
1159
|
-
const query =
|
|
1170
|
+
const query = useQuery19({
|
|
1160
1171
|
queryKey: ["behio", "consent", visitorId],
|
|
1161
1172
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
1162
1173
|
enabled: Boolean(visitorId)
|
|
@@ -1497,10 +1508,10 @@ function utmFromSearch(search) {
|
|
|
1497
1508
|
}
|
|
1498
1509
|
|
|
1499
1510
|
// src/react/hooks/use-bundles.ts
|
|
1500
|
-
import { useQuery as
|
|
1511
|
+
import { useQuery as useQuery20 } from "@tanstack/react-query";
|
|
1501
1512
|
function useBundles(options) {
|
|
1502
1513
|
const { client } = useBehio();
|
|
1503
|
-
return
|
|
1514
|
+
return useQuery20({
|
|
1504
1515
|
queryKey: ["behio", "bundles"],
|
|
1505
1516
|
queryFn: () => unwrap(client.catalog.getBundles()),
|
|
1506
1517
|
enabled: options?.enabled ?? true,
|
|
@@ -1509,7 +1520,7 @@ function useBundles(options) {
|
|
|
1509
1520
|
}
|
|
1510
1521
|
function useBundle(slug, options) {
|
|
1511
1522
|
const { client } = useBehio();
|
|
1512
|
-
return
|
|
1523
|
+
return useQuery20({
|
|
1513
1524
|
queryKey: ["behio", "bundle", slug],
|
|
1514
1525
|
queryFn: () => unwrap(client.catalog.getBundle(slug)),
|
|
1515
1526
|
enabled: Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -1518,10 +1529,10 @@ function useBundle(slug, options) {
|
|
|
1518
1529
|
}
|
|
1519
1530
|
|
|
1520
1531
|
// src/react/hooks/use-cross-sell.ts
|
|
1521
|
-
import { useQuery as
|
|
1532
|
+
import { useQuery as useQuery21 } from "@tanstack/react-query";
|
|
1522
1533
|
function useCrossSell(productSlug, options) {
|
|
1523
1534
|
const { client } = useBehio();
|
|
1524
|
-
return
|
|
1535
|
+
return useQuery21({
|
|
1525
1536
|
queryKey: ["behio", "cross-sell", productSlug],
|
|
1526
1537
|
queryFn: () => unwrap(client.catalog.getCrossSell(productSlug)),
|
|
1527
1538
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -1530,10 +1541,10 @@ function useCrossSell(productSlug, options) {
|
|
|
1530
1541
|
}
|
|
1531
1542
|
|
|
1532
1543
|
// src/react/hooks/use-product-promotions.ts
|
|
1533
|
-
import { useQuery as
|
|
1544
|
+
import { useQuery as useQuery22 } from "@tanstack/react-query";
|
|
1534
1545
|
function useProductPromotions(productSlug, options) {
|
|
1535
1546
|
const { client } = useBehio();
|
|
1536
|
-
return
|
|
1547
|
+
return useQuery22({
|
|
1537
1548
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
1538
1549
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
1539
1550
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -1542,11 +1553,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
1542
1553
|
}
|
|
1543
1554
|
|
|
1544
1555
|
// src/react/hooks/use-gift-card.ts
|
|
1545
|
-
import { useQuery as
|
|
1556
|
+
import { useQuery as useQuery23 } from "@tanstack/react-query";
|
|
1546
1557
|
function useGiftCardBalance(code, options) {
|
|
1547
1558
|
const { client } = useBehio();
|
|
1548
1559
|
const trimmed = code?.trim();
|
|
1549
|
-
return
|
|
1560
|
+
return useQuery23({
|
|
1550
1561
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
1551
1562
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
1552
1563
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -1554,11 +1565,11 @@ function useGiftCardBalance(code, options) {
|
|
|
1554
1565
|
}
|
|
1555
1566
|
|
|
1556
1567
|
// src/react/hooks/use-wishlist.ts
|
|
1557
|
-
import { useQuery as
|
|
1568
|
+
import { useQuery as useQuery24, useMutation as useMutation9, useQueryClient as useQueryClient10 } from "@tanstack/react-query";
|
|
1558
1569
|
function useWishlist(options) {
|
|
1559
1570
|
const { client } = useBehio();
|
|
1560
1571
|
const qc = useQueryClient10();
|
|
1561
|
-
const query =
|
|
1572
|
+
const query = useQuery24({
|
|
1562
1573
|
queryKey: ["behio", "wishlist"],
|
|
1563
1574
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
1564
1575
|
enabled: options?.enabled ?? true
|
|
@@ -1581,7 +1592,7 @@ function useWishlist(options) {
|
|
|
1581
1592
|
}
|
|
1582
1593
|
function useIsInWishlist(productId) {
|
|
1583
1594
|
const { client } = useBehio();
|
|
1584
|
-
return
|
|
1595
|
+
return useQuery24({
|
|
1585
1596
|
queryKey: ["behio", "wishlist-check", productId],
|
|
1586
1597
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
1587
1598
|
enabled: Boolean(productId)
|
|
@@ -1589,10 +1600,10 @@ function useIsInWishlist(productId) {
|
|
|
1589
1600
|
}
|
|
1590
1601
|
|
|
1591
1602
|
// src/react/hooks/use-reviews.ts
|
|
1592
|
-
import { useQuery as
|
|
1603
|
+
import { useQuery as useQuery25, useMutation as useMutation10, useQueryClient as useQueryClient11 } from "@tanstack/react-query";
|
|
1593
1604
|
function useProductReviews(productId, options) {
|
|
1594
1605
|
const { client } = useBehio();
|
|
1595
|
-
return
|
|
1606
|
+
return useQuery25({
|
|
1596
1607
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1],
|
|
1597
1608
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
1598
1609
|
enabled: Boolean(productId) && (options?.enabled ?? true)
|
|
@@ -1608,7 +1619,7 @@ function useSubmitReview() {
|
|
|
1608
1619
|
}
|
|
1609
1620
|
|
|
1610
1621
|
// src/react/hooks/use-returns.ts
|
|
1611
|
-
import { useQuery as
|
|
1622
|
+
import { useQuery as useQuery26, useMutation as useMutation11 } from "@tanstack/react-query";
|
|
1612
1623
|
function useLookupReturnableOrder() {
|
|
1613
1624
|
const { client } = useBehio();
|
|
1614
1625
|
return useMutation11({
|
|
@@ -1623,7 +1634,7 @@ function useSubmitReturn() {
|
|
|
1623
1634
|
}
|
|
1624
1635
|
function useReturnStatus(returnId, email) {
|
|
1625
1636
|
const { client } = useBehio();
|
|
1626
|
-
return
|
|
1637
|
+
return useQuery26({
|
|
1627
1638
|
queryKey: ["behio", "return-status", returnId],
|
|
1628
1639
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
1629
1640
|
enabled: Boolean(returnId && email)
|
|
@@ -1631,7 +1642,7 @@ function useReturnStatus(returnId, email) {
|
|
|
1631
1642
|
}
|
|
1632
1643
|
|
|
1633
1644
|
// src/react/hooks/use-quotes.ts
|
|
1634
|
-
import { useMutation as useMutation12, useQuery as
|
|
1645
|
+
import { useMutation as useMutation12, useQuery as useQuery27 } from "@tanstack/react-query";
|
|
1635
1646
|
function useSubmitQuote() {
|
|
1636
1647
|
const { client } = useBehio();
|
|
1637
1648
|
return useMutation12({
|
|
@@ -1640,7 +1651,7 @@ function useSubmitQuote() {
|
|
|
1640
1651
|
}
|
|
1641
1652
|
function useQuoteStatus(quoteId, email) {
|
|
1642
1653
|
const { client } = useBehio();
|
|
1643
|
-
return
|
|
1654
|
+
return useQuery27({
|
|
1644
1655
|
queryKey: ["behio", "quote-status", quoteId],
|
|
1645
1656
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
1646
1657
|
enabled: Boolean(quoteId && email)
|
|
@@ -1689,6 +1700,7 @@ export {
|
|
|
1689
1700
|
useIsInWishlist,
|
|
1690
1701
|
useLabels,
|
|
1691
1702
|
useLookupReturnableOrder,
|
|
1703
|
+
useMenu,
|
|
1692
1704
|
useNotifyWhenAvailable,
|
|
1693
1705
|
useOrder,
|
|
1694
1706
|
useOrderAccess,
|