@behio/storefront-sdk 2.19.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-CeIGiIf2.d.mts → client-C5ODb5cR.d.mts} +76 -2
- package/dist/{client-CeIGiIf2.d.ts → client-C5ODb5cR.d.ts} +76 -2
- 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 +121 -2
- package/dist/react.d.ts +121 -2
- package/dist/react.js +100 -44
- package/dist/react.mjs +83 -30
- package/package.json +1 -1
package/dist/react.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ 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
4
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
5
|
+
import * as react from 'react';
|
|
5
6
|
|
|
6
7
|
interface StorageAdapter {
|
|
7
8
|
get(key: string): string | null;
|
|
@@ -2258,7 +2259,20 @@ interface Page {
|
|
|
2258
2259
|
interface PageDetail {
|
|
2259
2260
|
slug: string;
|
|
2260
2261
|
title: string;
|
|
2261
|
-
|
|
2262
|
+
/**
|
|
2263
|
+
* Page body as ready to render, sanitized HTML. Always a string, empty when
|
|
2264
|
+
* the page has no body. Markdown pages are converted on the server and their
|
|
2265
|
+
* headings start at `<h2>` (the page renders its own `<h1>` from `title`).
|
|
2266
|
+
* Render it with `<RichText html={page.contentHtml} />` from
|
|
2267
|
+
* `@behio/storefront-sdk/react`.
|
|
2268
|
+
*/
|
|
2269
|
+
contentHtml: string;
|
|
2270
|
+
/**
|
|
2271
|
+
* @deprecated Read `contentHtml`. The page body as a string: sanitized HTML,
|
|
2272
|
+
* or markdown for older pages written in markdown (convert it yourself).
|
|
2273
|
+
* Kept for storefronts built before SDK 2.20.0.
|
|
2274
|
+
*/
|
|
2275
|
+
content: string;
|
|
2262
2276
|
seoTitle?: string;
|
|
2263
2277
|
seoDescription?: string;
|
|
2264
2278
|
ogTitle?: string;
|
|
@@ -2267,6 +2281,7 @@ interface PageDetail {
|
|
|
2267
2281
|
/** Downloadable files attached to the page (e.g. legal form PDFs). */
|
|
2268
2282
|
attachments: PageAttachment[];
|
|
2269
2283
|
}
|
|
2284
|
+
/** A downloadable file attached to a page. Link to `url`. */
|
|
2270
2285
|
interface PageAttachment {
|
|
2271
2286
|
name: string;
|
|
2272
2287
|
description: string | null;
|
|
@@ -2439,6 +2454,42 @@ interface StorefrontCollectionQuery {
|
|
|
2439
2454
|
limit?: number;
|
|
2440
2455
|
offset?: number;
|
|
2441
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
|
+
}
|
|
2442
2493
|
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
2443
2494
|
interface StorefrontForm {
|
|
2444
2495
|
slug: string;
|
|
@@ -3326,6 +3377,7 @@ declare class BehioStorefront {
|
|
|
3326
3377
|
readonly blog: BlogModule;
|
|
3327
3378
|
readonly forms: FormsModule;
|
|
3328
3379
|
readonly collections: CollectionsModule;
|
|
3380
|
+
readonly faq: FaqModule;
|
|
3329
3381
|
readonly wishlist: WishlistModule;
|
|
3330
3382
|
readonly reviews: ReviewsModule;
|
|
3331
3383
|
readonly returns: ReturnsModule;
|
|
@@ -4056,6 +4108,29 @@ declare class CollectionsModule {
|
|
|
4056
4108
|
*/
|
|
4057
4109
|
item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>;
|
|
4058
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
|
+
}
|
|
4059
4134
|
/**
|
|
4060
4135
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
4061
4136
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -5099,6 +5174,14 @@ declare function useCollection(slug: string, query?: StorefrontCollectionQuery,
|
|
|
5099
5174
|
/** One published collection item by slug or id (detail page). */
|
|
5100
5175
|
declare function useCollectionItem(slug: string, itemSlugOrId: string, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollectionItem>, Error>;
|
|
5101
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
|
+
|
|
5102
5185
|
interface UseSiteFormOptions {
|
|
5103
5186
|
enabled?: boolean;
|
|
5104
5187
|
}
|
|
@@ -5274,6 +5357,42 @@ declare function StorefrontScripts({ visitorId: visitorIdProp, initialScripts }?
|
|
|
5274
5357
|
*/
|
|
5275
5358
|
declare function BehioAnalyticsTracker(): null;
|
|
5276
5359
|
|
|
5360
|
+
interface RichTextProps {
|
|
5361
|
+
/**
|
|
5362
|
+
* HTML from a Behio API field that the API already sanitizes on read:
|
|
5363
|
+
* `page.contentHtml`, a blog post's `content.html`, product
|
|
5364
|
+
* `shortDescription` / `longDescription`. Empty or missing renders nothing.
|
|
5365
|
+
*/
|
|
5366
|
+
html?: string | null;
|
|
5367
|
+
/** Extra class names; the element always carries `behio-rich-text`. */
|
|
5368
|
+
className?: string;
|
|
5369
|
+
/** Wrapper element. Default: "div". */
|
|
5370
|
+
as?: "div" | "article" | "section";
|
|
5371
|
+
}
|
|
5372
|
+
/**
|
|
5373
|
+
* Renders merchant rich text (CMS pages, blog posts, product descriptions).
|
|
5374
|
+
*
|
|
5375
|
+
* The HTML is inserted as is with `dangerouslySetInnerHTML`. That is safe only
|
|
5376
|
+
* because the Behio API sanitizes these fields on the server before it sends
|
|
5377
|
+
* them (scripts, event handlers, `javascript:` links and unsafe inline styles
|
|
5378
|
+
* are removed). Use it ONLY for the API fields listed on `html`, never for
|
|
5379
|
+
* HTML from a visitor, a query string or another service.
|
|
5380
|
+
*
|
|
5381
|
+
* Style the content with the `.behio-rich-text` class (headings, lists,
|
|
5382
|
+
* tables, images and the `bh-*` story blocks the editor produces).
|
|
5383
|
+
*
|
|
5384
|
+
* @example
|
|
5385
|
+
* const { data: page } = await client.pages.get(slug, locale);
|
|
5386
|
+
* <h1>{page.title}</h1>
|
|
5387
|
+
* <RichText html={page.contentHtml} as="article" />
|
|
5388
|
+
*/
|
|
5389
|
+
declare function RichText({ html, className, as }: RichTextProps): react.DetailedReactHTMLElement<{
|
|
5390
|
+
className: string;
|
|
5391
|
+
dangerouslySetInnerHTML: {
|
|
5392
|
+
__html: string;
|
|
5393
|
+
};
|
|
5394
|
+
}, HTMLElement> | null;
|
|
5395
|
+
|
|
5277
5396
|
/** List all active bundles. */
|
|
5278
5397
|
declare function useBundles(options?: BundleCatalogQuery & {
|
|
5279
5398
|
enabled?: boolean;
|
|
@@ -5932,4 +6051,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5932
6051
|
success: boolean;
|
|
5933
6052
|
}>>;
|
|
5934
6053
|
|
|
5935
|
-
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 };
|
|
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.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ 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
4
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
5
|
+
import * as react from 'react';
|
|
5
6
|
|
|
6
7
|
interface StorageAdapter {
|
|
7
8
|
get(key: string): string | null;
|
|
@@ -2258,7 +2259,20 @@ interface Page {
|
|
|
2258
2259
|
interface PageDetail {
|
|
2259
2260
|
slug: string;
|
|
2260
2261
|
title: string;
|
|
2261
|
-
|
|
2262
|
+
/**
|
|
2263
|
+
* Page body as ready to render, sanitized HTML. Always a string, empty when
|
|
2264
|
+
* the page has no body. Markdown pages are converted on the server and their
|
|
2265
|
+
* headings start at `<h2>` (the page renders its own `<h1>` from `title`).
|
|
2266
|
+
* Render it with `<RichText html={page.contentHtml} />` from
|
|
2267
|
+
* `@behio/storefront-sdk/react`.
|
|
2268
|
+
*/
|
|
2269
|
+
contentHtml: string;
|
|
2270
|
+
/**
|
|
2271
|
+
* @deprecated Read `contentHtml`. The page body as a string: sanitized HTML,
|
|
2272
|
+
* or markdown for older pages written in markdown (convert it yourself).
|
|
2273
|
+
* Kept for storefronts built before SDK 2.20.0.
|
|
2274
|
+
*/
|
|
2275
|
+
content: string;
|
|
2262
2276
|
seoTitle?: string;
|
|
2263
2277
|
seoDescription?: string;
|
|
2264
2278
|
ogTitle?: string;
|
|
@@ -2267,6 +2281,7 @@ interface PageDetail {
|
|
|
2267
2281
|
/** Downloadable files attached to the page (e.g. legal form PDFs). */
|
|
2268
2282
|
attachments: PageAttachment[];
|
|
2269
2283
|
}
|
|
2284
|
+
/** A downloadable file attached to a page. Link to `url`. */
|
|
2270
2285
|
interface PageAttachment {
|
|
2271
2286
|
name: string;
|
|
2272
2287
|
description: string | null;
|
|
@@ -2439,6 +2454,42 @@ interface StorefrontCollectionQuery {
|
|
|
2439
2454
|
limit?: number;
|
|
2440
2455
|
offset?: number;
|
|
2441
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
|
+
}
|
|
2442
2493
|
/** Public definition of a form (`GET /forms/{slug}`). */
|
|
2443
2494
|
interface StorefrontForm {
|
|
2444
2495
|
slug: string;
|
|
@@ -3326,6 +3377,7 @@ declare class BehioStorefront {
|
|
|
3326
3377
|
readonly blog: BlogModule;
|
|
3327
3378
|
readonly forms: FormsModule;
|
|
3328
3379
|
readonly collections: CollectionsModule;
|
|
3380
|
+
readonly faq: FaqModule;
|
|
3329
3381
|
readonly wishlist: WishlistModule;
|
|
3330
3382
|
readonly reviews: ReviewsModule;
|
|
3331
3383
|
readonly returns: ReturnsModule;
|
|
@@ -4056,6 +4108,29 @@ declare class CollectionsModule {
|
|
|
4056
4108
|
*/
|
|
4057
4109
|
item(slug: string, itemSlugOrId: string): Promise<SdkResult<StorefrontCollectionItem>>;
|
|
4058
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
|
+
}
|
|
4059
4134
|
/**
|
|
4060
4135
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
4061
4136
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -5099,6 +5174,14 @@ declare function useCollection(slug: string, query?: StorefrontCollectionQuery,
|
|
|
5099
5174
|
/** One published collection item by slug or id (detail page). */
|
|
5100
5175
|
declare function useCollectionItem(slug: string, itemSlugOrId: string, options?: UseCollectionOptions): _tanstack_react_query.UseQueryResult<NoInfer<StorefrontCollectionItem>, Error>;
|
|
5101
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
|
+
|
|
5102
5185
|
interface UseSiteFormOptions {
|
|
5103
5186
|
enabled?: boolean;
|
|
5104
5187
|
}
|
|
@@ -5274,6 +5357,42 @@ declare function StorefrontScripts({ visitorId: visitorIdProp, initialScripts }?
|
|
|
5274
5357
|
*/
|
|
5275
5358
|
declare function BehioAnalyticsTracker(): null;
|
|
5276
5359
|
|
|
5360
|
+
interface RichTextProps {
|
|
5361
|
+
/**
|
|
5362
|
+
* HTML from a Behio API field that the API already sanitizes on read:
|
|
5363
|
+
* `page.contentHtml`, a blog post's `content.html`, product
|
|
5364
|
+
* `shortDescription` / `longDescription`. Empty or missing renders nothing.
|
|
5365
|
+
*/
|
|
5366
|
+
html?: string | null;
|
|
5367
|
+
/** Extra class names; the element always carries `behio-rich-text`. */
|
|
5368
|
+
className?: string;
|
|
5369
|
+
/** Wrapper element. Default: "div". */
|
|
5370
|
+
as?: "div" | "article" | "section";
|
|
5371
|
+
}
|
|
5372
|
+
/**
|
|
5373
|
+
* Renders merchant rich text (CMS pages, blog posts, product descriptions).
|
|
5374
|
+
*
|
|
5375
|
+
* The HTML is inserted as is with `dangerouslySetInnerHTML`. That is safe only
|
|
5376
|
+
* because the Behio API sanitizes these fields on the server before it sends
|
|
5377
|
+
* them (scripts, event handlers, `javascript:` links and unsafe inline styles
|
|
5378
|
+
* are removed). Use it ONLY for the API fields listed on `html`, never for
|
|
5379
|
+
* HTML from a visitor, a query string or another service.
|
|
5380
|
+
*
|
|
5381
|
+
* Style the content with the `.behio-rich-text` class (headings, lists,
|
|
5382
|
+
* tables, images and the `bh-*` story blocks the editor produces).
|
|
5383
|
+
*
|
|
5384
|
+
* @example
|
|
5385
|
+
* const { data: page } = await client.pages.get(slug, locale);
|
|
5386
|
+
* <h1>{page.title}</h1>
|
|
5387
|
+
* <RichText html={page.contentHtml} as="article" />
|
|
5388
|
+
*/
|
|
5389
|
+
declare function RichText({ html, className, as }: RichTextProps): react.DetailedReactHTMLElement<{
|
|
5390
|
+
className: string;
|
|
5391
|
+
dangerouslySetInnerHTML: {
|
|
5392
|
+
__html: string;
|
|
5393
|
+
};
|
|
5394
|
+
}, HTMLElement> | null;
|
|
5395
|
+
|
|
5277
5396
|
/** List all active bundles. */
|
|
5278
5397
|
declare function useBundles(options?: BundleCatalogQuery & {
|
|
5279
5398
|
enabled?: boolean;
|
|
@@ -5932,4 +6051,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5932
6051
|
success: boolean;
|
|
5933
6052
|
}>>;
|
|
5934
6053
|
|
|
5935
|
-
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 };
|
|
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 };
|