@behio/storefront-sdk 2.20.0 → 2.21.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/README.md +22 -1
- package/dist/{chunk-NBYEO5KC.js → chunk-L7IIU5MZ.js} +26 -5
- package/dist/{chunk-N6YG4AJ4.mjs → chunk-VHHDIU6J.mjs} +21 -0
- package/dist/{client-B_nmL9ab.d.mts → client-C5ODb5cR.d.mts} +61 -1
- package/dist/{client-B_nmL9ab.d.ts → client-C5ODb5cR.d.ts} +61 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- 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 +69 -1
- package/dist/react.d.ts +69 -1
- package/dist/react.js +88 -44
- package/dist/react.mjs +72 -30
- package/package.json +1 -1
package/dist/react.d.ts
CHANGED
|
@@ -2454,6 +2454,42 @@ interface StorefrontCollectionQuery {
|
|
|
2454
2454
|
limit?: number;
|
|
2455
2455
|
offset?: number;
|
|
2456
2456
|
}
|
|
2457
|
+
/** One visible question of an FAQ group. */
|
|
2458
|
+
interface StorefrontFaqItem {
|
|
2459
|
+
id: string;
|
|
2460
|
+
question: string;
|
|
2461
|
+
/** Cleaned HTML of the answer (paragraphs, emphasis, links, lists). */
|
|
2462
|
+
answer: string;
|
|
2463
|
+
}
|
|
2464
|
+
/** An FAQ group in the list (`GET /faq`). */
|
|
2465
|
+
interface StorefrontFaqGroupSummary {
|
|
2466
|
+
id: string;
|
|
2467
|
+
/** Stable identifier the owner sets in the admin (use it in code). */
|
|
2468
|
+
slug: string;
|
|
2469
|
+
name: string;
|
|
2470
|
+
description: string | null;
|
|
2471
|
+
/** Number of visible questions. */
|
|
2472
|
+
itemCount: number;
|
|
2473
|
+
}
|
|
2474
|
+
/** FAQ groups of the site in the admin order (`GET /faq`). */
|
|
2475
|
+
interface StorefrontFaqGroups {
|
|
2476
|
+
items: StorefrontFaqGroupSummary[];
|
|
2477
|
+
/** Language the texts are in (the requested one when the site offers it, else the main language). */
|
|
2478
|
+
locale: string;
|
|
2479
|
+
}
|
|
2480
|
+
/** One FAQ group with its visible questions in the admin order (`GET /faq/{group}`). */
|
|
2481
|
+
interface StorefrontFaqGroup {
|
|
2482
|
+
id: string;
|
|
2483
|
+
slug: string;
|
|
2484
|
+
name: string;
|
|
2485
|
+
description: string | null;
|
|
2486
|
+
locale: string;
|
|
2487
|
+
items: StorefrontFaqItem[];
|
|
2488
|
+
}
|
|
2489
|
+
interface StorefrontFaqQuery {
|
|
2490
|
+
/** Language of the texts; defaults to the client locale, then the main language of the site. */
|
|
2491
|
+
locale?: string;
|
|
2492
|
+
}
|
|
2457
2493
|
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
2458
2494
|
interface StorefrontForm {
|
|
2459
2495
|
slug: string;
|
|
@@ -3341,6 +3377,7 @@ declare class BehioStorefront {
|
|
|
3341
3377
|
readonly blog: BlogModule;
|
|
3342
3378
|
readonly forms: FormsModule;
|
|
3343
3379
|
readonly collections: CollectionsModule;
|
|
3380
|
+
readonly faq: FaqModule;
|
|
3344
3381
|
readonly wishlist: WishlistModule;
|
|
3345
3382
|
readonly reviews: ReviewsModule;
|
|
3346
3383
|
readonly returns: ReturnsModule;
|
|
@@ -4071,6 +4108,29 @@ declare class CollectionsModule {
|
|
|
4071
4108
|
*/
|
|
4072
4109
|
item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>;
|
|
4073
4110
|
}
|
|
4111
|
+
/**
|
|
4112
|
+
* Frequently asked questions: groups of questions and answers the owner
|
|
4113
|
+
* writes in the Behio admin (FAQ module) in every language of the site.
|
|
4114
|
+
* Only visible questions are returned, in the admin order, in the requested
|
|
4115
|
+
* language (a missing translation falls back to the main language of the
|
|
4116
|
+
* site). Answers are cleaned HTML (paragraphs, emphasis, links, lists).
|
|
4117
|
+
* Cached by Behio and invalidated on every admin change. Works with website
|
|
4118
|
+
* keys that have no e-shop attached.
|
|
4119
|
+
*
|
|
4120
|
+
* Tip: render the questions with `FAQPage` structured data (JSON-LD) so
|
|
4121
|
+
* search engines and AI assistants recognise them as answers.
|
|
4122
|
+
*/
|
|
4123
|
+
declare class FaqModule {
|
|
4124
|
+
private client;
|
|
4125
|
+
constructor(client: BehioStorefront);
|
|
4126
|
+
/** FAQ groups of the site in the admin order with the number of visible questions. */
|
|
4127
|
+
list(query?: StorefrontFaqQuery): Promise<SdkResult<StorefrontFaqGroups>>;
|
|
4128
|
+
/**
|
|
4129
|
+
* One group by its slug or id with its visible questions. 404
|
|
4130
|
+
* `be.faq.groupNotFound` for an unknown group.
|
|
4131
|
+
*/
|
|
4132
|
+
get(group: string, query?: StorefrontFaqQuery): Promise<SdkResult<StorefrontFaqGroup>>;
|
|
4133
|
+
}
|
|
4074
4134
|
/**
|
|
4075
4135
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
4076
4136
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -5114,6 +5174,14 @@ declare function useCollection(slug: string, query?: StorefrontCollectionQuery,
|
|
|
5114
5174
|
/** One published collection item by slug or id (detail page). */
|
|
5115
5175
|
declare function useCollectionItem(slug: string, itemSlugOrId: string, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollectionItem>, Error>;
|
|
5116
5176
|
|
|
5177
|
+
interface UseFaqOptions {
|
|
5178
|
+
enabled?: boolean;
|
|
5179
|
+
}
|
|
5180
|
+
/** FAQ groups of the site with the number of visible questions. */
|
|
5181
|
+
declare function useFaqGroups(query?: StorefrontFaqQuery, options?: UseFaqOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontFaqGroups>, Error>;
|
|
5182
|
+
/** One FAQ group (slug or id) with its visible questions in the admin order. */
|
|
5183
|
+
declare function useFaqGroup(group: string, query?: StorefrontFaqQuery, options?: UseFaqOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontFaqGroup>, Error>;
|
|
5184
|
+
|
|
5117
5185
|
interface UseSiteFormOptions {
|
|
5118
5186
|
enabled?: boolean;
|
|
5119
5187
|
}
|
|
@@ -5983,4 +6051,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5983
6051
|
success: boolean;
|
|
5984
6052
|
}>>;
|
|
5985
6053
|
|
|
5986
|
-
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 PageAttachment, 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, RichText, type RichTextProps, 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 };
|
|
6054
|
+
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 PageAttachment, 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, RichText, type RichTextProps, 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 UseFaqOptions, 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, useFaqGroup, useFaqGroups, 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
|
@@ -65,6 +65,8 @@ __export(react_exports, {
|
|
|
65
65
|
useCurrency: () => useCurrency,
|
|
66
66
|
useCustomer: () => useCustomer,
|
|
67
67
|
useFacets: () => useFacets,
|
|
68
|
+
useFaqGroup: () => useFaqGroup,
|
|
69
|
+
useFaqGroups: () => useFaqGroups,
|
|
68
70
|
useFeatured: () => useFeatured,
|
|
69
71
|
useFilters: () => useFilters,
|
|
70
72
|
useGiftCardBalance: () => useGiftCardBalance,
|
|
@@ -285,6 +287,7 @@ var BehioStorefront = class {
|
|
|
285
287
|
this.blog = new BlogModule(this);
|
|
286
288
|
this.forms = new FormsModule(this);
|
|
287
289
|
this.collections = new CollectionsModule(this);
|
|
290
|
+
this.faq = new FaqModule(this);
|
|
288
291
|
this.wishlist = new WishlistModule(this);
|
|
289
292
|
this.reviews = new ReviewsModule(this);
|
|
290
293
|
this.returns = new ReturnsModule(this);
|
|
@@ -1941,6 +1944,26 @@ var CollectionsModule = class {
|
|
|
1941
1944
|
);
|
|
1942
1945
|
}
|
|
1943
1946
|
};
|
|
1947
|
+
var FaqModule = class {
|
|
1948
|
+
constructor(client) {
|
|
1949
|
+
this.client = client;
|
|
1950
|
+
}
|
|
1951
|
+
/** FAQ groups of the site in the admin order with the number of visible questions. */
|
|
1952
|
+
async list(query) {
|
|
1953
|
+
return this.client.request("GET", "/faq", {
|
|
1954
|
+
query: { locale: query?.locale }
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
/**
|
|
1958
|
+
* One group by its slug or id with its visible questions. 404
|
|
1959
|
+
* `be.faq.groupNotFound` for an unknown group.
|
|
1960
|
+
*/
|
|
1961
|
+
async get(group, query) {
|
|
1962
|
+
return this.client.request("GET", `/faq/${encodeURIComponent(group)}`, {
|
|
1963
|
+
query: { locale: query?.locale }
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1944
1967
|
var FormsModule = class {
|
|
1945
1968
|
constructor(client) {
|
|
1946
1969
|
this.client = client;
|
|
@@ -4116,9 +4139,28 @@ function useCollectionItem(slug, itemSlugOrId, options) {
|
|
|
4116
4139
|
});
|
|
4117
4140
|
}
|
|
4118
4141
|
|
|
4142
|
+
// src/react/hooks/use-faq.ts
|
|
4143
|
+
var import_react_query38 = require("@tanstack/react-query");
|
|
4144
|
+
function useFaqGroups(query, options) {
|
|
4145
|
+
const { client } = useBehio();
|
|
4146
|
+
return (0, import_react_query38.useQuery)({
|
|
4147
|
+
queryKey: ["behio", "faq", query?.locale],
|
|
4148
|
+
queryFn: () => unwrap(client.faq.list(query)),
|
|
4149
|
+
enabled: options?.enabled !== false
|
|
4150
|
+
});
|
|
4151
|
+
}
|
|
4152
|
+
function useFaqGroup(group, query, options) {
|
|
4153
|
+
const { client } = useBehio();
|
|
4154
|
+
return (0, import_react_query38.useQuery)({
|
|
4155
|
+
queryKey: ["behio", "faq", group, query?.locale],
|
|
4156
|
+
queryFn: () => unwrap(client.faq.get(group, query)),
|
|
4157
|
+
enabled: options?.enabled !== false && !!group
|
|
4158
|
+
});
|
|
4159
|
+
}
|
|
4160
|
+
|
|
4119
4161
|
// src/react/hooks/use-site-form.ts
|
|
4120
4162
|
var import_react17 = require("react");
|
|
4121
|
-
var
|
|
4163
|
+
var import_react_query39 = require("@tanstack/react-query");
|
|
4122
4164
|
|
|
4123
4165
|
// src/errors.ts
|
|
4124
4166
|
function bodyOf(err) {
|
|
@@ -4169,7 +4211,7 @@ function formFieldErrors(err) {
|
|
|
4169
4211
|
// src/react/hooks/use-site-form.ts
|
|
4170
4212
|
function useSiteForm(slug, options) {
|
|
4171
4213
|
const { client } = useBehio();
|
|
4172
|
-
return (0,
|
|
4214
|
+
return (0, import_react_query39.useQuery)({
|
|
4173
4215
|
queryKey: ["behio", "form", slug],
|
|
4174
4216
|
queryFn: () => unwrap(client.forms.get(slug)),
|
|
4175
4217
|
enabled: options?.enabled !== false && !!slug
|
|
@@ -4177,7 +4219,7 @@ function useSiteForm(slug, options) {
|
|
|
4177
4219
|
}
|
|
4178
4220
|
function useSiteFormSubmit(slug) {
|
|
4179
4221
|
const { client } = useBehio();
|
|
4180
|
-
const mutation = (0,
|
|
4222
|
+
const mutation = (0, import_react_query39.useMutation)({
|
|
4181
4223
|
mutationFn: (input) => unwrap(client.forms.submit(slug, input))
|
|
4182
4224
|
});
|
|
4183
4225
|
const sdkError = mutation.error instanceof UnwrappedError ? mutation.error.sdkError : null;
|
|
@@ -4213,10 +4255,10 @@ function useSiteFormSubmit(slug) {
|
|
|
4213
4255
|
}
|
|
4214
4256
|
|
|
4215
4257
|
// src/react/hooks/use-shop-info.ts
|
|
4216
|
-
var
|
|
4258
|
+
var import_react_query40 = require("@tanstack/react-query");
|
|
4217
4259
|
function useShopInfo(options) {
|
|
4218
4260
|
const { client } = useBehio();
|
|
4219
|
-
return (0,
|
|
4261
|
+
return (0, import_react_query40.useQuery)({
|
|
4220
4262
|
queryKey: ["behio", "shop-info"],
|
|
4221
4263
|
queryFn: () => unwrap(client.getShopInfo()),
|
|
4222
4264
|
enabled: options?.enabled !== false
|
|
@@ -4224,10 +4266,10 @@ function useShopInfo(options) {
|
|
|
4224
4266
|
}
|
|
4225
4267
|
|
|
4226
4268
|
// src/react/hooks/use-shop-scripts.ts
|
|
4227
|
-
var
|
|
4269
|
+
var import_react_query41 = require("@tanstack/react-query");
|
|
4228
4270
|
function useShopScripts(options) {
|
|
4229
4271
|
const { client } = useBehio();
|
|
4230
|
-
return (0,
|
|
4272
|
+
return (0, import_react_query41.useQuery)({
|
|
4231
4273
|
queryKey: ["behio", "shop-scripts"],
|
|
4232
4274
|
queryFn: () => unwrap(client.getShopScripts()),
|
|
4233
4275
|
enabled: options?.enabled !== false,
|
|
@@ -4236,11 +4278,11 @@ function useShopScripts(options) {
|
|
|
4236
4278
|
}
|
|
4237
4279
|
|
|
4238
4280
|
// src/react/hooks/use-shop-seo.ts
|
|
4239
|
-
var
|
|
4281
|
+
var import_react_query42 = require("@tanstack/react-query");
|
|
4240
4282
|
function useShopSeo(options) {
|
|
4241
4283
|
const { client } = useBehio();
|
|
4242
4284
|
const { locale, initialData, enabled = true } = options ?? {};
|
|
4243
|
-
return (0,
|
|
4285
|
+
return (0, import_react_query42.useQuery)({
|
|
4244
4286
|
queryKey: ["behio", "shop-seo", locale ?? "_default"],
|
|
4245
4287
|
queryFn: () => unwrap(client.getShopSeo(locale)),
|
|
4246
4288
|
initialData,
|
|
@@ -4303,20 +4345,20 @@ function CurrencySwitcher({
|
|
|
4303
4345
|
var import_react18 = require("react");
|
|
4304
4346
|
|
|
4305
4347
|
// src/react/hooks/use-consent.ts
|
|
4306
|
-
var
|
|
4348
|
+
var import_react_query43 = require("@tanstack/react-query");
|
|
4307
4349
|
function useCookieConsent(visitorId) {
|
|
4308
4350
|
const { client } = useBehio();
|
|
4309
|
-
const qc = (0,
|
|
4310
|
-
const query = (0,
|
|
4351
|
+
const qc = (0, import_react_query43.useQueryClient)();
|
|
4352
|
+
const query = (0, import_react_query43.useQuery)({
|
|
4311
4353
|
queryKey: ["behio", "consent", visitorId],
|
|
4312
4354
|
queryFn: () => unwrap(client.consent.get(visitorId)),
|
|
4313
4355
|
enabled: Boolean(visitorId)
|
|
4314
4356
|
});
|
|
4315
|
-
const recordMutation = (0,
|
|
4357
|
+
const recordMutation = (0, import_react_query43.useMutation)({
|
|
4316
4358
|
mutationFn: (input) => unwrap(client.consent.record(input)),
|
|
4317
4359
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4318
4360
|
});
|
|
4319
|
-
const revokeMutation = (0,
|
|
4361
|
+
const revokeMutation = (0, import_react_query43.useMutation)({
|
|
4320
4362
|
mutationFn: () => unwrap(client.consent.revoke(visitorId)),
|
|
4321
4363
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "consent"] })
|
|
4322
4364
|
});
|
|
@@ -4695,11 +4737,11 @@ function RichText({ html, className, as = "div" }) {
|
|
|
4695
4737
|
}
|
|
4696
4738
|
|
|
4697
4739
|
// src/react/hooks/use-bundles.ts
|
|
4698
|
-
var
|
|
4740
|
+
var import_react_query44 = require("@tanstack/react-query");
|
|
4699
4741
|
function useBundles(options) {
|
|
4700
4742
|
const { client, sessionRestored } = useBehio();
|
|
4701
4743
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4702
|
-
return (0,
|
|
4744
|
+
return (0, import_react_query44.useQuery)({
|
|
4703
4745
|
queryKey: ["behio", "bundles", query],
|
|
4704
4746
|
queryFn: () => unwrap(client.catalog.getBundles(query)),
|
|
4705
4747
|
enabled: sessionRestored && (options?.enabled ?? true),
|
|
@@ -4709,7 +4751,7 @@ function useBundles(options) {
|
|
|
4709
4751
|
function useBundle(slug, options) {
|
|
4710
4752
|
const { client, sessionRestored } = useBehio();
|
|
4711
4753
|
const query = { locale: options?.locale ?? client.getLocale(), currency: options?.currency ?? client.getCurrency(), country: options?.country ?? client.getCountry() };
|
|
4712
|
-
return (0,
|
|
4754
|
+
return (0, import_react_query44.useQuery)({
|
|
4713
4755
|
queryKey: ["behio", "bundle", slug, query],
|
|
4714
4756
|
queryFn: () => unwrap(client.catalog.getBundle(slug, query)),
|
|
4715
4757
|
enabled: sessionRestored && Boolean(slug) && (options?.enabled ?? true),
|
|
@@ -4718,10 +4760,10 @@ function useBundle(slug, options) {
|
|
|
4718
4760
|
}
|
|
4719
4761
|
|
|
4720
4762
|
// src/react/hooks/use-product-group.ts
|
|
4721
|
-
var
|
|
4763
|
+
var import_react_query45 = require("@tanstack/react-query");
|
|
4722
4764
|
function useProductGroup(slug, options) {
|
|
4723
4765
|
const { client } = useBehio();
|
|
4724
|
-
return (0,
|
|
4766
|
+
return (0, import_react_query45.useQuery)({
|
|
4725
4767
|
queryKey: ["behio", "product-group", slug, options?.locale, options?.currency],
|
|
4726
4768
|
queryFn: () => unwrap(
|
|
4727
4769
|
client.catalog.getProductGroup(slug, {
|
|
@@ -4735,10 +4777,10 @@ function useProductGroup(slug, options) {
|
|
|
4735
4777
|
}
|
|
4736
4778
|
|
|
4737
4779
|
// src/react/hooks/use-cross-sell.ts
|
|
4738
|
-
var
|
|
4780
|
+
var import_react_query46 = require("@tanstack/react-query");
|
|
4739
4781
|
function useCrossSell(productSlug, options) {
|
|
4740
4782
|
const { client } = useBehio();
|
|
4741
|
-
return (0,
|
|
4783
|
+
return (0, import_react_query46.useQuery)({
|
|
4742
4784
|
queryKey: ["behio", "cross-sell", productSlug, options?.locale, options?.currency],
|
|
4743
4785
|
queryFn: () => unwrap(
|
|
4744
4786
|
client.catalog.getCrossSell(productSlug, {
|
|
@@ -4752,10 +4794,10 @@ function useCrossSell(productSlug, options) {
|
|
|
4752
4794
|
}
|
|
4753
4795
|
|
|
4754
4796
|
// src/react/hooks/use-product-promotions.ts
|
|
4755
|
-
var
|
|
4797
|
+
var import_react_query47 = require("@tanstack/react-query");
|
|
4756
4798
|
function useProductPromotions(productSlug, options) {
|
|
4757
4799
|
const { client } = useBehio();
|
|
4758
|
-
return (0,
|
|
4800
|
+
return (0, import_react_query47.useQuery)({
|
|
4759
4801
|
queryKey: ["behio", "product-promotions", productSlug],
|
|
4760
4802
|
queryFn: () => unwrap(client.catalog.getProductPromotions(productSlug)),
|
|
4761
4803
|
enabled: Boolean(productSlug) && (options?.enabled ?? true),
|
|
@@ -4764,11 +4806,11 @@ function useProductPromotions(productSlug, options) {
|
|
|
4764
4806
|
}
|
|
4765
4807
|
|
|
4766
4808
|
// src/react/hooks/use-gift-card.ts
|
|
4767
|
-
var
|
|
4809
|
+
var import_react_query48 = require("@tanstack/react-query");
|
|
4768
4810
|
function useGiftCardBalance(code, options) {
|
|
4769
4811
|
const { client } = useBehio();
|
|
4770
4812
|
const trimmed = code?.trim();
|
|
4771
|
-
return (0,
|
|
4813
|
+
return (0, import_react_query48.useQuery)({
|
|
4772
4814
|
queryKey: ["behio", "gift-card-balance", trimmed],
|
|
4773
4815
|
queryFn: () => unwrap(client.catalog.checkGiftCard(trimmed)),
|
|
4774
4816
|
enabled: Boolean(trimmed && trimmed.length >= 6) && (options?.enabled ?? true)
|
|
@@ -4776,20 +4818,20 @@ function useGiftCardBalance(code, options) {
|
|
|
4776
4818
|
}
|
|
4777
4819
|
|
|
4778
4820
|
// src/react/hooks/use-wishlist.ts
|
|
4779
|
-
var
|
|
4821
|
+
var import_react_query49 = require("@tanstack/react-query");
|
|
4780
4822
|
function useWishlist(options) {
|
|
4781
4823
|
const { client } = useBehio();
|
|
4782
|
-
const qc = (0,
|
|
4783
|
-
const query = (0,
|
|
4824
|
+
const qc = (0, import_react_query49.useQueryClient)();
|
|
4825
|
+
const query = (0, import_react_query49.useQuery)({
|
|
4784
4826
|
queryKey: ["behio", "wishlist"],
|
|
4785
4827
|
queryFn: () => unwrap(client.wishlist.get()),
|
|
4786
4828
|
enabled: options?.enabled ?? true
|
|
4787
4829
|
});
|
|
4788
|
-
const addMutation = (0,
|
|
4830
|
+
const addMutation = (0, import_react_query49.useMutation)({
|
|
4789
4831
|
mutationFn: (productId) => unwrap(client.wishlist.add(productId)),
|
|
4790
4832
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4791
4833
|
});
|
|
4792
|
-
const removeMutation = (0,
|
|
4834
|
+
const removeMutation = (0, import_react_query49.useMutation)({
|
|
4793
4835
|
mutationFn: (productId) => unwrap(client.wishlist.remove(productId)),
|
|
4794
4836
|
onSuccess: () => qc.invalidateQueries({ queryKey: ["behio", "wishlist"] })
|
|
4795
4837
|
});
|
|
@@ -4803,7 +4845,7 @@ function useWishlist(options) {
|
|
|
4803
4845
|
}
|
|
4804
4846
|
function useIsInWishlist(productId) {
|
|
4805
4847
|
const { client } = useBehio();
|
|
4806
|
-
return (0,
|
|
4848
|
+
return (0, import_react_query49.useQuery)({
|
|
4807
4849
|
queryKey: ["behio", "wishlist-check", productId],
|
|
4808
4850
|
queryFn: () => unwrap(client.wishlist.isInWishlist(productId)),
|
|
4809
4851
|
enabled: Boolean(productId)
|
|
@@ -4811,10 +4853,10 @@ function useIsInWishlist(productId) {
|
|
|
4811
4853
|
}
|
|
4812
4854
|
|
|
4813
4855
|
// src/react/hooks/use-reviews.ts
|
|
4814
|
-
var
|
|
4856
|
+
var import_react_query50 = require("@tanstack/react-query");
|
|
4815
4857
|
function useProductReviews(productId, options) {
|
|
4816
4858
|
const { client } = useBehio();
|
|
4817
|
-
return (0,
|
|
4859
|
+
return (0, import_react_query50.useQuery)({
|
|
4818
4860
|
queryKey: ["behio", "reviews", productId, options?.page ?? 1, options?.limit ?? 20],
|
|
4819
4861
|
queryFn: () => unwrap(client.reviews.getProductReviews(productId, options?.page, options?.limit)),
|
|
4820
4862
|
initialData: options?.initialData,
|
|
@@ -4824,30 +4866,30 @@ function useProductReviews(productId, options) {
|
|
|
4824
4866
|
}
|
|
4825
4867
|
function useSubmitReview() {
|
|
4826
4868
|
const { client } = useBehio();
|
|
4827
|
-
const qc = (0,
|
|
4828
|
-
return (0,
|
|
4869
|
+
const qc = (0, import_react_query50.useQueryClient)();
|
|
4870
|
+
return (0, import_react_query50.useMutation)({
|
|
4829
4871
|
mutationFn: (input) => unwrap(client.reviews.submit(input)),
|
|
4830
4872
|
onSuccess: (_, input) => qc.invalidateQueries({ queryKey: ["behio", "reviews", input.productId] })
|
|
4831
4873
|
});
|
|
4832
4874
|
}
|
|
4833
4875
|
|
|
4834
4876
|
// src/react/hooks/use-returns.ts
|
|
4835
|
-
var
|
|
4877
|
+
var import_react_query51 = require("@tanstack/react-query");
|
|
4836
4878
|
function useLookupReturnableOrder() {
|
|
4837
4879
|
const { client } = useBehio();
|
|
4838
|
-
return (0,
|
|
4880
|
+
return (0, import_react_query51.useMutation)({
|
|
4839
4881
|
mutationFn: ({ orderNumber, email }) => unwrap(client.returns.lookupOrder(orderNumber, email))
|
|
4840
4882
|
});
|
|
4841
4883
|
}
|
|
4842
4884
|
function useSubmitReturn() {
|
|
4843
4885
|
const { client } = useBehio();
|
|
4844
|
-
return (0,
|
|
4886
|
+
return (0, import_react_query51.useMutation)({
|
|
4845
4887
|
mutationFn: (input) => unwrap(client.returns.submit(input))
|
|
4846
4888
|
});
|
|
4847
4889
|
}
|
|
4848
4890
|
function useReturnStatus(returnId, email) {
|
|
4849
4891
|
const { client } = useBehio();
|
|
4850
|
-
return (0,
|
|
4892
|
+
return (0, import_react_query51.useQuery)({
|
|
4851
4893
|
queryKey: ["behio", "return-status", returnId],
|
|
4852
4894
|
queryFn: () => unwrap(client.returns.getStatus(returnId, email)),
|
|
4853
4895
|
enabled: Boolean(returnId && email)
|
|
@@ -4855,16 +4897,16 @@ function useReturnStatus(returnId, email) {
|
|
|
4855
4897
|
}
|
|
4856
4898
|
|
|
4857
4899
|
// src/react/hooks/use-quotes.ts
|
|
4858
|
-
var
|
|
4900
|
+
var import_react_query52 = require("@tanstack/react-query");
|
|
4859
4901
|
function useSubmitQuote() {
|
|
4860
4902
|
const { client } = useBehio();
|
|
4861
|
-
return (0,
|
|
4903
|
+
return (0, import_react_query52.useMutation)({
|
|
4862
4904
|
mutationFn: (input) => unwrap(client.quotes.submit(input))
|
|
4863
4905
|
});
|
|
4864
4906
|
}
|
|
4865
4907
|
function useQuoteStatus(quoteId, email) {
|
|
4866
4908
|
const { client } = useBehio();
|
|
4867
|
-
return (0,
|
|
4909
|
+
return (0, import_react_query52.useQuery)({
|
|
4868
4910
|
queryKey: ["behio", "quote-status", quoteId],
|
|
4869
4911
|
queryFn: () => unwrap(client.quotes.getStatus(quoteId, email)),
|
|
4870
4912
|
enabled: Boolean(quoteId && email)
|
|
@@ -4872,10 +4914,10 @@ function useQuoteStatus(quoteId, email) {
|
|
|
4872
4914
|
}
|
|
4873
4915
|
|
|
4874
4916
|
// src/react/hooks/use-back-in-stock.ts
|
|
4875
|
-
var
|
|
4917
|
+
var import_react_query53 = require("@tanstack/react-query");
|
|
4876
4918
|
function useNotifyWhenAvailable() {
|
|
4877
4919
|
const { client } = useBehio();
|
|
4878
|
-
return (0,
|
|
4920
|
+
return (0, import_react_query53.useMutation)({
|
|
4879
4921
|
mutationFn: ({ productId, email }) => unwrap(client.catalog.notifyWhenAvailable(productId, email))
|
|
4880
4922
|
});
|
|
4881
4923
|
}
|
|
@@ -5043,6 +5085,8 @@ async function revokeAnalyticsConsent(client) {
|
|
|
5043
5085
|
useCurrency,
|
|
5044
5086
|
useCustomer,
|
|
5045
5087
|
useFacets,
|
|
5088
|
+
useFaqGroup,
|
|
5089
|
+
useFaqGroups,
|
|
5046
5090
|
useFeatured,
|
|
5047
5091
|
useFilters,
|
|
5048
5092
|
useGiftCardBalance,
|