@behio/storefront-sdk 2.16.0 → 2.17.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-AUH7KNL6.mjs → chunk-N6YG4AJ4.mjs} +29 -0
- package/dist/{chunk-AOUXSMSR.js → chunk-NBYEO5KC.js} +34 -5
- package/dist/{client-Ddk-DIHi.d.mts → client-CKg4F98v.d.mts} +62 -1
- package/dist/{client-Ddk-DIHi.d.ts → client-CKg4F98v.d.ts} +62 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -3
- package/dist/index.mjs +7 -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 +70 -1
- package/dist/react.d.ts +70 -1
- package/dist/react.js +96 -44
- package/dist/react.mjs +80 -30
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -2381,6 +2381,43 @@ interface StorefrontFormSettings {
|
|
|
2381
2381
|
/** When true, `consent: true` is required for the submit to pass. */
|
|
2382
2382
|
requireConsent?: boolean;
|
|
2383
2383
|
}
|
|
2384
|
+
/** Field types of a data collection. */
|
|
2385
|
+
type StorefrontCollectionFieldType = "text" | "longtext" | "number" | "boolean" | "date" | "url" | "image" | "email" | "select" | "tags";
|
|
2386
|
+
/** One field of a data collection; item values live under `data[key]`. */
|
|
2387
|
+
interface StorefrontCollectionField {
|
|
2388
|
+
key: string;
|
|
2389
|
+
type: StorefrontCollectionFieldType;
|
|
2390
|
+
label: string;
|
|
2391
|
+
required: boolean;
|
|
2392
|
+
help?: string;
|
|
2393
|
+
/** Choices for `select`, suggestions for `tags`. */
|
|
2394
|
+
options?: string[];
|
|
2395
|
+
}
|
|
2396
|
+
/** One published item of a data collection. */
|
|
2397
|
+
interface StorefrontCollectionItem {
|
|
2398
|
+
id: string;
|
|
2399
|
+
/** Detail address, unique in the collection; null when the item has none. */
|
|
2400
|
+
slug: string | null;
|
|
2401
|
+
/** `{fieldKey: value}`: text, number, boolean, `YYYY-MM-DD` date, URL, string[] for tags. */
|
|
2402
|
+
data: Record<string, unknown>;
|
|
2403
|
+
createdAt: number;
|
|
2404
|
+
updatedAt: number;
|
|
2405
|
+
}
|
|
2406
|
+
/** A public data collection (`GET /collections/{slug}`). */
|
|
2407
|
+
interface StorefrontCollection {
|
|
2408
|
+
slug: string;
|
|
2409
|
+
name: string;
|
|
2410
|
+
description: string | null;
|
|
2411
|
+
fields: StorefrontCollectionField[];
|
|
2412
|
+
items: StorefrontCollectionItem[];
|
|
2413
|
+
/** Number of published items (for paging). */
|
|
2414
|
+
total: number;
|
|
2415
|
+
}
|
|
2416
|
+
interface StorefrontCollectionQuery {
|
|
2417
|
+
/** 1 to 200, default 100. */
|
|
2418
|
+
limit?: number;
|
|
2419
|
+
offset?: number;
|
|
2420
|
+
}
|
|
2384
2421
|
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
2385
2422
|
interface StorefrontForm {
|
|
2386
2423
|
slug: string;
|
|
@@ -3267,6 +3304,7 @@ declare class BehioStorefront {
|
|
|
3267
3304
|
readonly pages: PagesModule;
|
|
3268
3305
|
readonly blog: BlogModule;
|
|
3269
3306
|
readonly forms: FormsModule;
|
|
3307
|
+
readonly collections: CollectionsModule;
|
|
3270
3308
|
readonly wishlist: WishlistModule;
|
|
3271
3309
|
readonly reviews: ReviewsModule;
|
|
3272
3310
|
readonly returns: ReturnsModule;
|
|
@@ -3974,6 +4012,29 @@ declare class BlogModule {
|
|
|
3974
4012
|
/** One published post with sanitised HTML content and related posts. */
|
|
3975
4013
|
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3976
4014
|
}
|
|
4015
|
+
/**
|
|
4016
|
+
* Data collections: structured content the owner edits in Behio (team,
|
|
4017
|
+
* references, price list, FAQ, listings) and the site reads at runtime, so
|
|
4018
|
+
* no site needs its own database. Only public collections and published
|
|
4019
|
+
* items are returned. Cached by Behio and invalidated on every admin change.
|
|
4020
|
+
* Works with website keys that have no e-shop attached.
|
|
4021
|
+
*/
|
|
4022
|
+
declare class CollectionsModule {
|
|
4023
|
+
private client;
|
|
4024
|
+
constructor(client: BehioStorefront);
|
|
4025
|
+
/**
|
|
4026
|
+
* One collection with its published items in the owner's order.
|
|
4027
|
+
* `limit` 1 to 200 (default 100), `offset` for paging; `total` is the
|
|
4028
|
+
* number of published items. 404 `be.collections.collectionNotFound` for an
|
|
4029
|
+
* unknown or private slug.
|
|
4030
|
+
*/
|
|
4031
|
+
get(slug: string, query?: StorefrontCollectionQuery): Promise<SdkResult<StorefrontCollection>>;
|
|
4032
|
+
/**
|
|
4033
|
+
* One published item by its slug or id (detail page). 404
|
|
4034
|
+
* `be.collections.itemNotFound` for a draft or unknown item.
|
|
4035
|
+
*/
|
|
4036
|
+
item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>;
|
|
4037
|
+
}
|
|
3977
4038
|
/**
|
|
3978
4039
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3979
4040
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -5009,6 +5070,14 @@ interface UseBlogPostOptions {
|
|
|
5009
5070
|
/** One published post (sanitised HTML content + related posts). */
|
|
5010
5071
|
declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
|
|
5011
5072
|
|
|
5073
|
+
interface UseCollectionOptions {
|
|
5074
|
+
enabled?: boolean;
|
|
5075
|
+
}
|
|
5076
|
+
/** A public data collection with its published items (team, references, FAQ...). */
|
|
5077
|
+
declare function useCollection(slug: string, query?: StorefrontCollectionQuery, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollection>, Error>;
|
|
5078
|
+
/** One published collection item by slug or id (detail page). */
|
|
5079
|
+
declare function useCollectionItem(slug: string, itemSlugOrId: string, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollectionItem>, Error>;
|
|
5080
|
+
|
|
5012
5081
|
interface UseSiteFormOptions {
|
|
5013
5082
|
enabled?: boolean;
|
|
5014
5083
|
}
|
|
@@ -5842,4 +5911,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5842
5911
|
success: boolean;
|
|
5843
5912
|
}>>;
|
|
5844
5913
|
|
|
5845
|
-
export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Blog, type BlogPostDetail, type BlogPostListItem, type BlogPostsPage, type BlogPostsQuery, type BlogSettings, type BlogTag, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentInstrument, type PaymentStatus, type PaymentSwift, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type SiteFormField, type SiteFormFieldOption, type SiteFormFieldType, type StorageAdapter, type StorefrontForm, type StorefrontFormFieldError, type StorefrontFormFieldErrorCode, type StorefrontFormSettings, type StorefrontFormSubmitInput, type StorefrontFormSubmitResult, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseBlogPostOptions, type UseBlogPostsOptions, type UseBlogsOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSiteFormOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBlogPost, useBlogPosts, useBlogs, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCheckoutPreview, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSiteForm, useSiteFormSubmit, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };
|
|
5914
|
+
export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Blog, type BlogPostDetail, type BlogPostListItem, type BlogPostsPage, type BlogPostsQuery, type BlogSettings, type BlogTag, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentInstrument, type PaymentStatus, type PaymentSwift, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type SiteFormField, type SiteFormFieldOption, type SiteFormFieldType, type StorageAdapter, type StorefrontForm, type StorefrontFormFieldError, type StorefrontFormFieldErrorCode, type StorefrontFormSettings, type StorefrontFormSubmitInput, type StorefrontFormSubmitResult, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseBlogPostOptions, type UseBlogPostsOptions, type UseBlogsOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCollectionOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSiteFormOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBlogPost, useBlogPosts, useBlogs, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCheckoutPreview, useCollection, useCollectionItem, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSiteForm, useSiteFormSubmit, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };
|
package/dist/react.d.ts
CHANGED
|
@@ -2381,6 +2381,43 @@ interface StorefrontFormSettings {
|
|
|
2381
2381
|
/** When true, `consent: true` is required for the submit to pass. */
|
|
2382
2382
|
requireConsent?: boolean;
|
|
2383
2383
|
}
|
|
2384
|
+
/** Field types of a data collection. */
|
|
2385
|
+
type StorefrontCollectionFieldType = "text" | "longtext" | "number" | "boolean" | "date" | "url" | "image" | "email" | "select" | "tags";
|
|
2386
|
+
/** One field of a data collection; item values live under `data[key]`. */
|
|
2387
|
+
interface StorefrontCollectionField {
|
|
2388
|
+
key: string;
|
|
2389
|
+
type: StorefrontCollectionFieldType;
|
|
2390
|
+
label: string;
|
|
2391
|
+
required: boolean;
|
|
2392
|
+
help?: string;
|
|
2393
|
+
/** Choices for `select`, suggestions for `tags`. */
|
|
2394
|
+
options?: string[];
|
|
2395
|
+
}
|
|
2396
|
+
/** One published item of a data collection. */
|
|
2397
|
+
interface StorefrontCollectionItem {
|
|
2398
|
+
id: string;
|
|
2399
|
+
/** Detail address, unique in the collection; null when the item has none. */
|
|
2400
|
+
slug: string | null;
|
|
2401
|
+
/** `{fieldKey: value}`: text, number, boolean, `YYYY-MM-DD` date, URL, string[] for tags. */
|
|
2402
|
+
data: Record<string, unknown>;
|
|
2403
|
+
createdAt: number;
|
|
2404
|
+
updatedAt: number;
|
|
2405
|
+
}
|
|
2406
|
+
/** A public data collection (`GET /collections/{slug}`). */
|
|
2407
|
+
interface StorefrontCollection {
|
|
2408
|
+
slug: string;
|
|
2409
|
+
name: string;
|
|
2410
|
+
description: string | null;
|
|
2411
|
+
fields: StorefrontCollectionField[];
|
|
2412
|
+
items: StorefrontCollectionItem[];
|
|
2413
|
+
/** Number of published items (for paging). */
|
|
2414
|
+
total: number;
|
|
2415
|
+
}
|
|
2416
|
+
interface StorefrontCollectionQuery {
|
|
2417
|
+
/** 1 to 200, default 100. */
|
|
2418
|
+
limit?: number;
|
|
2419
|
+
offset?: number;
|
|
2420
|
+
}
|
|
2384
2421
|
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
2385
2422
|
interface StorefrontForm {
|
|
2386
2423
|
slug: string;
|
|
@@ -3267,6 +3304,7 @@ declare class BehioStorefront {
|
|
|
3267
3304
|
readonly pages: PagesModule;
|
|
3268
3305
|
readonly blog: BlogModule;
|
|
3269
3306
|
readonly forms: FormsModule;
|
|
3307
|
+
readonly collections: CollectionsModule;
|
|
3270
3308
|
readonly wishlist: WishlistModule;
|
|
3271
3309
|
readonly reviews: ReviewsModule;
|
|
3272
3310
|
readonly returns: ReturnsModule;
|
|
@@ -3974,6 +4012,29 @@ declare class BlogModule {
|
|
|
3974
4012
|
/** One published post with sanitised HTML content and related posts. */
|
|
3975
4013
|
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3976
4014
|
}
|
|
4015
|
+
/**
|
|
4016
|
+
* Data collections: structured content the owner edits in Behio (team,
|
|
4017
|
+
* references, price list, FAQ, listings) and the site reads at runtime, so
|
|
4018
|
+
* no site needs its own database. Only public collections and published
|
|
4019
|
+
* items are returned. Cached by Behio and invalidated on every admin change.
|
|
4020
|
+
* Works with website keys that have no e-shop attached.
|
|
4021
|
+
*/
|
|
4022
|
+
declare class CollectionsModule {
|
|
4023
|
+
private client;
|
|
4024
|
+
constructor(client: BehioStorefront);
|
|
4025
|
+
/**
|
|
4026
|
+
* One collection with its published items in the owner's order.
|
|
4027
|
+
* `limit` 1 to 200 (default 100), `offset` for paging; `total` is the
|
|
4028
|
+
* number of published items. 404 `be.collections.collectionNotFound` for an
|
|
4029
|
+
* unknown or private slug.
|
|
4030
|
+
*/
|
|
4031
|
+
get(slug: string, query?: StorefrontCollectionQuery): Promise<SdkResult<StorefrontCollection>>;
|
|
4032
|
+
/**
|
|
4033
|
+
* One published item by its slug or id (detail page). 404
|
|
4034
|
+
* `be.collections.itemNotFound` for a draft or unknown item.
|
|
4035
|
+
*/
|
|
4036
|
+
item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>;
|
|
4037
|
+
}
|
|
3977
4038
|
/**
|
|
3978
4039
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3979
4040
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -5009,6 +5070,14 @@ interface UseBlogPostOptions {
|
|
|
5009
5070
|
/** One published post (sanitised HTML content + related posts). */
|
|
5010
5071
|
declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
|
|
5011
5072
|
|
|
5073
|
+
interface UseCollectionOptions {
|
|
5074
|
+
enabled?: boolean;
|
|
5075
|
+
}
|
|
5076
|
+
/** A public data collection with its published items (team, references, FAQ...). */
|
|
5077
|
+
declare function useCollection(slug: string, query?: StorefrontCollectionQuery, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollection>, Error>;
|
|
5078
|
+
/** One published collection item by slug or id (detail page). */
|
|
5079
|
+
declare function useCollectionItem(slug: string, itemSlugOrId: string, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollectionItem>, Error>;
|
|
5080
|
+
|
|
5012
5081
|
interface UseSiteFormOptions {
|
|
5013
5082
|
enabled?: boolean;
|
|
5014
5083
|
}
|
|
@@ -5842,4 +5911,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5842
5911
|
success: boolean;
|
|
5843
5912
|
}>>;
|
|
5844
5913
|
|
|
5845
|
-
export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Blog, type BlogPostDetail, type BlogPostListItem, type BlogPostsPage, type BlogPostsQuery, type BlogSettings, type BlogTag, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentInstrument, type PaymentStatus, type PaymentSwift, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type SiteFormField, type SiteFormFieldOption, type SiteFormFieldType, type StorageAdapter, type StorefrontForm, type StorefrontFormFieldError, type StorefrontFormFieldErrorCode, type StorefrontFormSettings, type StorefrontFormSubmitInput, type StorefrontFormSubmitResult, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseBlogPostOptions, type UseBlogPostsOptions, type UseBlogsOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSiteFormOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBlogPost, useBlogPosts, useBlogs, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCheckoutPreview, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSiteForm, useSiteFormSubmit, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };
|
|
5914
|
+
export { type ActivePromotion, type AddToCartInput, type AnalyticsEventInput, type AuthTokens, BehioAnalyticsTracker, BehioApiError, BehioProvider, type BehioProviderProps, type Blog, type BlogPostDetail, type BlogPostListItem, type BlogPostsPage, type BlogPostsQuery, type BlogSettings, type BlogTag, type Bundle, type BundleItem, type Cart, type CartDiscount, type CartItem, type Category, type CategoryDetail, type CheckoutAddress, type CheckoutInput, type CheckoutPaymentMethod, type CookieConsent, type CookieConsentInput, type CrossSellItem, CurrencySwitcher, type CurrencySwitcherProps, type CurrencySwitcherRenderProps, type CustomerAddress, type CustomerProfile, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type Facet, type FacetRange, type FacetValue, type FacetsResponse, type FilterField, type FulfillmentStatus, type GiftCardBalance, type LoginInput, type MessageResponse, type OrderDetail, type OrderItem, type OrderListItem, type OrderStatus, type Page, type PageDetail, type PaginatedResponse, type PaymentInstrument, type PaymentStatus, type PaymentSwift, type PersonalOffer, type ProductDetail, type ProductLabel, type ProductListItem, type ProductParameter, type ProductParameterGroup, type ProductParametersResponse, type ProductPrice, type ProductReview, type ProductReviewsResponse, type ProductVariant, type ProductsQuery, type QuoteRequest, type RegisterInput, type ReturnRequest, type ShopInfo, type ShopSeo, type SiteFormField, type SiteFormFieldOption, type SiteFormFieldType, type StorageAdapter, type StorefrontForm, type StorefrontFormFieldError, type StorefrontFormFieldErrorCode, type StorefrontFormSettings, type StorefrontFormSubmitInput, type StorefrontFormSubmitResult, StorefrontScripts, type StorefrontScriptsProps, type SubmitQuoteInput, type SubmitReturnInput, type SubmitReviewInput, type UseAddressAutocompleteOptions, type UseAddressAutocompleteReturn, type UseAddressesOptions, type UseBlogPostOptions, type UseBlogPostsOptions, type UseBlogsOptions, type UseCartCountOptions, type UseCartOptions, type UseCategoriesOptions, type UseCategoryOptions, type UseCertificateVerificationOptions, type UseCollectionOptions, type UseCourseCertificatesOptions, type UseCourseOptions, type UseCoursesOptions, type UseCurrencyResult, type UseCustomerOptions, type UseFacetsOptions, type UseFeaturedOptions, type UseFiltersOptions, type UseLabelsOptions, type UseLessonCommentsOptions, type UseLessonNoteOptions, type UseLessonQuizOptions, type UseLessonTutorOptions, type UseLoyaltyOptions, type UseMenuOptions, type UseOrderOptions, type UseOrdersOptions, type UsePageOptions, type UsePagesOptions, type UsePaymentMethodsOptions, type UsePersonalOffersOptions, type UseProductOptions, type UseProductParametersOptions, type UseProductsOptions, type UseSearchOptions, type UseShippingMethodsOptions, type UseShippingQuoteOptions, type UseShopInfoOptions, type UseShopScriptsOptions, type UseShopSeoOptions, type UseSiteFormOptions, type UseSubscriptionsOptions, type UseVisitorMessagesOptions, type VisitorMessage, type WishlistItem, cookieStorage, createMemoryStorage, detectStorage, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, localStorageAdapter, memoryStorage, revokeAnalyticsConsent, trackEcommerceEvent, useAddressAutocomplete, useAddresses, useAnalyticsEvents, useAuth, useBehio, useBehioClient, useBlogPost, useBlogPosts, useBlogs, useBundle, useBundles, useCart, useCartCount, useCategories, useCategory, useCertificateVerification, useCheckout, useCheckoutPreview, useCollection, useCollectionItem, useCookieConsent, useCourse, useCourseCertificates, useCourses, useCrossSell, useCurrency, useCustomer, useFacets, useFeatured, useFilters, useGiftCardBalance, useIsInWishlist, useLabels, useLessonComments, useLessonNote, useLessonQuiz, useLessonTutor, useLookupReturnableOrder, useLoyalty, useMenu, useNewsletterSubscribe, useNewsletterUnsubscribe, useNotifyWhenAvailable, useOrder, useOrderAccess, useOrders, usePage, usePages, usePaymentMethods, usePersonalOffers, usePickupPoints, useProduct, useProductGroup, useProductParameters, useProductPromotions, useProductReviews, useProducts, useQuoteStatus, useReturnStatus, useSearch, useShippingMethods, useShippingQuote, useShopInfo, useShopScripts, useShopSeo, useSiteForm, useSiteFormSubmit, useSubmitQuote, useSubmitReturn, useSubmitReview, useSubscriptions, useVisitorMessages, useWishlist };
|
package/dist/react.js
CHANGED
|
@@ -54,6 +54,8 @@ __export(react_exports, {
|
|
|
54
54
|
useCertificateVerification: () => useCertificateVerification,
|
|
55
55
|
useCheckout: () => useCheckout,
|
|
56
56
|
useCheckoutPreview: () => useCheckoutPreview,
|
|
57
|
+
useCollection: () => useCollection,
|
|
58
|
+
useCollectionItem: () => useCollectionItem,
|
|
57
59
|
useCookieConsent: () => useCookieConsent,
|
|
58
60
|
useCourse: () => useCourse,
|
|
59
61
|
useCourseCertificates: () => useCourseCertificates,
|
|
@@ -281,6 +283,7 @@ var BehioStorefront = class {
|
|
|
281
283
|
this.pages = new PagesModule(this);
|
|
282
284
|
this.blog = new BlogModule(this);
|
|
283
285
|
this.forms = new FormsModule(this);
|
|
286
|
+
this.collections = new CollectionsModule(this);
|
|
284
287
|
this.wishlist = new WishlistModule(this);
|
|
285
288
|
this.reviews = new ReviewsModule(this);
|
|
286
289
|
this.returns = new ReturnsModule(this);
|
|
@@ -1909,6 +1912,34 @@ var BlogModule = class {
|
|
|
1909
1912
|
});
|
|
1910
1913
|
}
|
|
1911
1914
|
};
|
|
1915
|
+
var CollectionsModule = class {
|
|
1916
|
+
constructor(client) {
|
|
1917
|
+
this.client = client;
|
|
1918
|
+
}
|
|
1919
|
+
/**
|
|
1920
|
+
* One collection with its published items in the owner's order.
|
|
1921
|
+
* `limit` 1 to 200 (default 100), `offset` for paging; `total` is the
|
|
1922
|
+
* number of published items. 404 `be.collections.collectionNotFound` for an
|
|
1923
|
+
* unknown or private slug.
|
|
1924
|
+
*/
|
|
1925
|
+
async get(slug, query) {
|
|
1926
|
+
return this.client.request(
|
|
1927
|
+
"GET",
|
|
1928
|
+
`/collections/${encodeURIComponent(slug)}`,
|
|
1929
|
+
{ query: { limit: query?.limit, offset: query?.offset } }
|
|
1930
|
+
);
|
|
1931
|
+
}
|
|
1932
|
+
/**
|
|
1933
|
+
* One published item by its slug or id (detail page). 404
|
|
1934
|
+
* `be.collections.itemNotFound` for a draft or unknown item.
|
|
1935
|
+
*/
|
|
1936
|
+
async item(slug, itemSlugOrId) {
|
|
1937
|
+
return this.client.request(
|
|
1938
|
+
"GET",
|
|
1939
|
+
`/collections/${encodeURIComponent(slug)}/items/${encodeURIComponent(itemSlugOrId)}`
|
|
1940
|
+
);
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1912
1943
|
var FormsModule = class {
|
|
1913
1944
|
constructor(client) {
|
|
1914
1945
|
this.client = client;
|
|
@@ -4065,9 +4096,28 @@ function useBlogPost(handle, slug, locale, options) {
|
|
|
4065
4096
|
});
|
|
4066
4097
|
}
|
|
4067
4098
|
|
|
4099
|
+
// src/react/hooks/use-collection.ts
|
|
4100
|
+
var import_react_query37 = require("@tanstack/react-query");
|
|
4101
|
+
function useCollection(slug, query, options) {
|
|
4102
|
+
const { client } = useBehio();
|
|
4103
|
+
return (0, import_react_query37.useQuery)({
|
|
4104
|
+
queryKey: ["behio", "collection", slug, query?.limit, query?.offset],
|
|
4105
|
+
queryFn: () => unwrap(client.collections.get(slug, query)),
|
|
4106
|
+
enabled: options?.enabled !== false && !!slug
|
|
4107
|
+
});
|
|
4108
|
+
}
|
|
4109
|
+
function useCollectionItem(slug, itemSlugOrId, options) {
|
|
4110
|
+
const { client } = useBehio();
|
|
4111
|
+
return (0, import_react_query37.useQuery)({
|
|
4112
|
+
queryKey: ["behio", "collection", slug, "item", itemSlugOrId],
|
|
4113
|
+
queryFn: () => unwrap(client.collections.item(slug, itemSlugOrId)),
|
|
4114
|
+
enabled: options?.enabled !== false && !!slug && !!itemSlugOrId
|
|
4115
|
+
});
|
|
4116
|
+
}
|
|
4117
|
+
|
|
4068
4118
|
// src/react/hooks/use-site-form.ts
|
|
4069
4119
|
var import_react17 = require("react");
|
|
4070
|
-
var
|
|
4120
|
+
var import_react_query38 = require("@tanstack/react-query");
|
|
4071
4121
|
|
|
4072
4122
|
// src/errors.ts
|
|
4073
4123
|
function bodyOf(err) {
|
|
@@ -4118,7 +4168,7 @@ function formFieldErrors(err) {
|
|
|
4118
4168
|
// src/react/hooks/use-site-form.ts
|
|
4119
4169
|
function useSiteForm(slug, options) {
|
|
4120
4170
|
const { client } = useBehio();
|
|
4121
|
-
return (0,
|
|
4171
|
+
return (0, import_react_query38.useQuery)({
|
|
4122
4172
|
queryKey: ["behio", "form", slug],
|
|
4123
4173
|
queryFn: () => unwrap(client.forms.get(slug)),
|
|
4124
4174
|
enabled: options?.enabled !== false && !!slug
|
|
@@ -4126,7 +4176,7 @@ function useSiteForm(slug, options) {
|
|
|
4126
4176
|
}
|
|
4127
4177
|
function useSiteFormSubmit(slug) {
|
|
4128
4178
|
const { client } = useBehio();
|
|
4129
|
-
const mutation = (0,
|
|
4179
|
+
const mutation = (0, import_react_query38.useMutation)({
|
|
4130
4180
|
mutationFn: (input) => unwrap(client.forms.submit(slug, input))
|
|
4131
4181
|
});
|
|
4132
4182
|
const sdkError = mutation.error instanceof UnwrappedError ? mutation.error.sdkError : null;
|
|
@@ -4162,10 +4212,10 @@ function useSiteFormSubmit(slug) {
|
|
|
4162
4212
|
}
|
|
4163
4213
|
|
|
4164
4214
|
// src/react/hooks/use-shop-info.ts
|
|
4165
|
-
var
|
|
4215
|
+
var import_react_query39 = require("@tanstack/react-query");
|
|
4166
4216
|
function useShopInfo(options) {
|
|
4167
4217
|
const { client } = useBehio();
|
|
4168
|
-
return (0,
|
|
4218
|
+
return (0, import_react_query39.useQuery)({
|
|
4169
4219
|
queryKey: ["behio", "shop-info"],
|
|
4170
4220
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
4171
4221
|
enabled: options?.enabled !== false
|
|
@@ -4173,10 +4223,10 @@ function useShopInfo(options) {
|
|
|
4173
4223
|
}
|
|
4174
4224
|
|
|
4175
4225
|
// src/react/hooks/use-shop-scripts.ts
|
|
4176
|
-
var
|
|
4226
|
+
var import_react_query40 = require("@tanstack/react-query");
|
|
4177
4227
|
function useShopScripts(options) {
|
|
4178
4228
|
const { client } = useBehio();
|
|
4179
|
-
return (0,
|
|
4229
|
+
return (0, import_react_query40.useQuery)({
|
|
4180
4230
|
queryKey: ["behio", "shop-scripts"],
|
|
4181
4231
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
4182
4232
|
enabled: options?.enabled !== false,
|
|
@@ -4185,11 +4235,11 @@ function useShopScripts(options) {
|
|
|
4185
4235
|
}
|
|
4186
4236
|
|
|
4187
4237
|
// src/react/hooks/use-shop-seo.ts
|
|
4188
|
-
var
|
|
4238
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
4189
4239
|
function useShopSeo(options) {
|
|
4190
4240
|
const { client } = useBehio();
|
|
4191
4241
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
4192
|
-
return (0,
|
|
4242
|
+
return (0, import_react_query41.useQuery)({
|
|
4193
4243
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
4194
4244
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
4195
4245
|
initialData,
|
|
@@ -4252,20 +4302,20 @@ function CurrencySwitcher({
|
|
|
4252
4302
|
var import_react18 = require("react");
|
|
4253
4303
|
|
|
4254
4304
|
// src/react/hooks/use-consent.ts
|
|
4255
|
-
var
|
|
4305
|
+
var import_react_query42 = require("@tanstack/react-query");
|
|
4256
4306
|
function useCookieConsent(visitorId) {
|
|
4257
4307
|
const { client } = useBehio();
|
|
4258
|
-
const qc = (0,
|
|
4259
|
-
const query = (0,
|
|
4308
|
+
const qc = (0, import_react_query42.useQueryClient)();
|
|
4309
|
+
const query = (0, import_react_query42.useQuery)({
|
|
4260
4310
|
queryKey: ["behio", "consent", visitorId],
|
|
4261
4311
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
4262
4312
|
enabled: Boolean(visitorId)
|
|
4263
4313
|
});
|
|
4264
|
-
const recordMutation = (0,
|
|
4314
|
+
const recordMutation = (0, import_react_query42.useMutation)({
|
|
4265
4315
|
mutationFn: (input) => unwrap(client.consent.record(input)),
|
|
4266
4316
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4267
4317
|
});
|
|
4268
|
-
const revokeMutation = (0,
|
|
4318
|
+
const revokeMutation = (0, import_react_query42.useMutation)({
|
|
4269
4319
|
mutationFn: () => unwrap(client.consent.revoke(visitorId)),
|
|
4270
4320
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4271
4321
|
});
|
|
@@ -4634,11 +4684,11 @@ function utmFromSearch(search) {
|
|
|
4634
4684
|
}
|
|
4635
4685
|
|
|
4636
4686
|
// src/react/hooks/use-bundles.ts
|
|
4637
|
-
var
|
|
4687
|
+
var import_react_query43 = require("@tanstack/react-query");
|
|
4638
4688
|
function useBundles(options) {
|
|
4639
4689
|
const { client, sessionRestored } = useBehio();
|
|
4640
4690
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4641
|
-
return (0,
|
|
4691
|
+
return (0, import_react_query43.useQuery)({
|
|
4642
4692
|
queryKey: ["behio", "bundles", query],
|
|
4643
4693
|
queryFn: () => unwrap(client.catalog.getBundles(query)),
|
|
4644
4694
|
enabled: sessionRestored && (options?.enabled ?? true),
|
|
@@ -4648,7 +4698,7 @@ function useBundles(options) {
|
|
|
4648
4698
|
function useBundle(slug, options) {
|
|
4649
4699
|
const { client, sessionRestored } = useBehio();
|
|
4650
4700
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4651
|
-
return (0,
|
|
4701
|
+
return (0, import_react_query43.useQuery)({
|
|
4652
4702
|
queryKey: ["behio", "bundle", slug, query],
|
|
4653
4703
|
queryFn: () => unwrap(client.catalog.getBundle(slug, query)),
|
|
4654
4704
|
enabled: sessionRestored && Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -4657,10 +4707,10 @@ function useBundle(slug, options) {
|
|
|
4657
4707
|
}
|
|
4658
4708
|
|
|
4659
4709
|
// src/react/hooks/use-product-group.ts
|
|
4660
|
-
var
|
|
4710
|
+
var import_react_query44 = require("@tanstack/react-query");
|
|
4661
4711
|
function useProductGroup(slug, options) {
|
|
4662
4712
|
const { client } = useBehio();
|
|
4663
|
-
return (0,
|
|
4713
|
+
return (0, import_react_query44.useQuery)({
|
|
4664
4714
|
queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
|
|
4665
4715
|
queryFn: () => unwrap(
|
|
4666
4716
|
client.catalog.getProductGroup(slug, {
|
|
@@ -4674,10 +4724,10 @@ function useProductGroup(slug, options) {
|
|
|
4674
4724
|
}
|
|
4675
4725
|
|
|
4676
4726
|
// src/react/hooks/use-cross-sell.ts
|
|
4677
|
-
var
|
|
4727
|
+
var import_react_query45 = require("@tanstack/react-query");
|
|
4678
4728
|
function useCrossSell(productSlug, options) {
|
|
4679
4729
|
const { client } = useBehio();
|
|
4680
|
-
return (0,
|
|
4730
|
+
return (0, import_react_query45.useQuery)({
|
|
4681
4731
|
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
4682
4732
|
queryFn: () => unwrap(
|
|
4683
4733
|
client.catalog.getCrossSell(productSlug, {
|
|
@@ -4691,10 +4741,10 @@ function useCrossSell(productSlug, options) {
|
|
|
4691
4741
|
}
|
|
4692
4742
|
|
|
4693
4743
|
// src/react/hooks/use-product-promotions.ts
|
|
4694
|
-
var
|
|
4744
|
+
var import_react_query46 = require("@tanstack/react-query");
|
|
4695
4745
|
function useProductPromotions(productSlug, options) {
|
|
4696
4746
|
const { client } = useBehio();
|
|
4697
|
-
return (0,
|
|
4747
|
+
return (0, import_react_query46.useQuery)({
|
|
4698
4748
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
4699
4749
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
4700
4750
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -4703,11 +4753,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
4703
4753
|
}
|
|
4704
4754
|
|
|
4705
4755
|
// src/react/hooks/use-gift-card.ts
|
|
4706
|
-
var
|
|
4756
|
+
var import_react_query47 = require("@tanstack/react-query");
|
|
4707
4757
|
function useGiftCardBalance(code, options) {
|
|
4708
4758
|
const { client } = useBehio();
|
|
4709
4759
|
const trimmed = code?.trim();
|
|
4710
|
-
return (0,
|
|
4760
|
+
return (0, import_react_query47.useQuery)({
|
|
4711
4761
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
4712
4762
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
4713
4763
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -4715,20 +4765,20 @@ function useGiftCardBalance(code, options) {
|
|
|
4715
4765
|
}
|
|
4716
4766
|
|
|
4717
4767
|
// src/react/hooks/use-wishlist.ts
|
|
4718
|
-
var
|
|
4768
|
+
var import_react_query48 = require("@tanstack/react-query");
|
|
4719
4769
|
function useWishlist(options) {
|
|
4720
4770
|
const { client } = useBehio();
|
|
4721
|
-
const qc = (0,
|
|
4722
|
-
const query = (0,
|
|
4771
|
+
const qc = (0, import_react_query48.useQueryClient)();
|
|
4772
|
+
const query = (0, import_react_query48.useQuery)({
|
|
4723
4773
|
queryKey: ["behio", "wishlist"],
|
|
4724
4774
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
4725
4775
|
enabled: options?.enabled ?? true
|
|
4726
4776
|
});
|
|
4727
|
-
const addMutation = (0,
|
|
4777
|
+
const addMutation = (0, import_react_query48.useMutation)({
|
|
4728
4778
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
4729
4779
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4730
4780
|
});
|
|
4731
|
-
const removeMutation = (0,
|
|
4781
|
+
const removeMutation = (0, import_react_query48.useMutation)({
|
|
4732
4782
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
4733
4783
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4734
4784
|
});
|
|
@@ -4742,7 +4792,7 @@ function useWishlist(options) {
|
|
|
4742
4792
|
}
|
|
4743
4793
|
function useIsInWishlist(productId) {
|
|
4744
4794
|
const { client } = useBehio();
|
|
4745
|
-
return (0,
|
|
4795
|
+
return (0, import_react_query48.useQuery)({
|
|
4746
4796
|
queryKey: ["behio", "wishlist-check", productId],
|
|
4747
4797
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
4748
4798
|
enabled: Boolean(productId)
|
|
@@ -4750,10 +4800,10 @@ function useIsInWishlist(productId) {
|
|
|
4750
4800
|
}
|
|
4751
4801
|
|
|
4752
4802
|
// src/react/hooks/use-reviews.ts
|
|
4753
|
-
var
|
|
4803
|
+
var import_react_query49 = require("@tanstack/react-query");
|
|
4754
4804
|
function useProductReviews(productId, options) {
|
|
4755
4805
|
const { client } = useBehio();
|
|
4756
|
-
return (0,
|
|
4806
|
+
return (0, import_react_query49.useQuery)({
|
|
4757
4807
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1, options?.limit ?? 20],
|
|
4758
4808
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
4759
4809
|
initialData: options?.initialData,
|
|
@@ -4763,30 +4813,30 @@ function useProductReviews(productId, options) {
|
|
|
4763
4813
|
}
|
|
4764
4814
|
function useSubmitReview() {
|
|
4765
4815
|
const { client } = useBehio();
|
|
4766
|
-
const qc = (0,
|
|
4767
|
-
return (0,
|
|
4816
|
+
const qc = (0, import_react_query49.useQueryClient)();
|
|
4817
|
+
return (0, import_react_query49.useMutation)({
|
|
4768
4818
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
4769
4819
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
4770
4820
|
});
|
|
4771
4821
|
}
|
|
4772
4822
|
|
|
4773
4823
|
// src/react/hooks/use-returns.ts
|
|
4774
|
-
var
|
|
4824
|
+
var import_react_query50 = require("@tanstack/react-query");
|
|
4775
4825
|
function useLookupReturnableOrder() {
|
|
4776
4826
|
const { client } = useBehio();
|
|
4777
|
-
return (0,
|
|
4827
|
+
return (0, import_react_query50.useMutation)({
|
|
4778
4828
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
4779
4829
|
});
|
|
4780
4830
|
}
|
|
4781
4831
|
function useSubmitReturn() {
|
|
4782
4832
|
const { client } = useBehio();
|
|
4783
|
-
return (0,
|
|
4833
|
+
return (0, import_react_query50.useMutation)({
|
|
4784
4834
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
4785
4835
|
});
|
|
4786
4836
|
}
|
|
4787
4837
|
function useReturnStatus(returnId, email) {
|
|
4788
4838
|
const { client } = useBehio();
|
|
4789
|
-
return (0,
|
|
4839
|
+
return (0, import_react_query50.useQuery)({
|
|
4790
4840
|
queryKey: ["behio", "return-status", returnId],
|
|
4791
4841
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
4792
4842
|
enabled: Boolean(returnId && email)
|
|
@@ -4794,16 +4844,16 @@ function useReturnStatus(returnId, email) {
|
|
|
4794
4844
|
}
|
|
4795
4845
|
|
|
4796
4846
|
// src/react/hooks/use-quotes.ts
|
|
4797
|
-
var
|
|
4847
|
+
var import_react_query51 = require("@tanstack/react-query");
|
|
4798
4848
|
function useSubmitQuote() {
|
|
4799
4849
|
const { client } = useBehio();
|
|
4800
|
-
return (0,
|
|
4850
|
+
return (0, import_react_query51.useMutation)({
|
|
4801
4851
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
4802
4852
|
});
|
|
4803
4853
|
}
|
|
4804
4854
|
function useQuoteStatus(quoteId, email) {
|
|
4805
4855
|
const { client } = useBehio();
|
|
4806
|
-
return (0,
|
|
4856
|
+
return (0, import_react_query51.useQuery)({
|
|
4807
4857
|
queryKey: ["behio", "quote-status", quoteId],
|
|
4808
4858
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
4809
4859
|
enabled: Boolean(quoteId && email)
|
|
@@ -4811,10 +4861,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
4811
4861
|
}
|
|
4812
4862
|
|
|
4813
4863
|
// src/react/hooks/use-back-in-stock.ts
|
|
4814
|
-
var
|
|
4864
|
+
var import_react_query52 = require("@tanstack/react-query");
|
|
4815
4865
|
function useNotifyWhenAvailable() {
|
|
4816
4866
|
const { client } = useBehio();
|
|
4817
|
-
return (0,
|
|
4867
|
+
return (0, import_react_query52.useMutation)({
|
|
4818
4868
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
4819
4869
|
});
|
|
4820
4870
|
}
|
|
@@ -4971,6 +5021,8 @@ async function revokeAnalyticsConsent(client) {
|
|
|
4971
5021
|
useCertificateVerification,
|
|
4972
5022
|
useCheckout,
|
|
4973
5023
|
useCheckoutPreview,
|
|
5024
|
+
useCollection,
|
|
5025
|
+
useCollectionItem,
|
|
4974
5026
|
useCookieConsent,
|
|
4975
5027
|
useCourse,
|
|
4976
5028
|
useCourseCertificates,
|