@behio/storefront-sdk 2.15.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-DF78Zgb0.d.mts → client-CKg4F98v.d.mts} +99 -4
- package/dist/{client-DF78Zgb0.d.ts → client-CKg4F98v.d.ts} +99 -4
- 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 +132 -3
- package/dist/react.d.ts +132 -3
- package/dist/react.js +96 -44
- package/dist/react.mjs +80 -30
- package/package.json +1 -1
package/dist/next.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNBYEO5KCjs = require('./chunk-NBYEO5KC.js');
|
|
4
4
|
|
|
5
5
|
// src/next.ts
|
|
6
6
|
var _headers = require('next/headers');
|
|
@@ -19,7 +19,7 @@ async function getBehio(options = {}) {
|
|
|
19
19
|
const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
|
|
20
20
|
const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
|
|
21
21
|
const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
|
|
22
|
-
const client = new (0,
|
|
22
|
+
const client = new (0, _chunkNBYEO5KCjs.BehioStorefront)({
|
|
23
23
|
apiKey,
|
|
24
24
|
...baseUrl ? { baseUrl } : {},
|
|
25
25
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
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;
|
|
@@ -2593,8 +2630,23 @@ interface ShippingMethodSummary {
|
|
|
2593
2630
|
etaDaysMin: number | null;
|
|
2594
2631
|
etaDaysMax: number | null;
|
|
2595
2632
|
allowedCountries: string[];
|
|
2596
|
-
/** Customer-safe config fields the merchant filled in (pickup address, instructions). */
|
|
2597
|
-
publicConfig:
|
|
2633
|
+
/** Customer-safe config fields the merchant filled in (pickup address, instructions) and the pickup map widget. */
|
|
2634
|
+
publicConfig: ShippingPublicConfig;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Customer-safe part of a shipping method's config. Typed keys since
|
|
2638
|
+
* SDK 2.16.0; the index signature keeps older code that reads it as a
|
|
2639
|
+
* plain record compiling.
|
|
2640
|
+
*/
|
|
2641
|
+
interface ShippingPublicConfig {
|
|
2642
|
+
instructions?: string;
|
|
2643
|
+
/** In-store pickup address. */
|
|
2644
|
+
pickupAddress?: string;
|
|
2645
|
+
/** In-store pickup opening hours. */
|
|
2646
|
+
openingHours?: string;
|
|
2647
|
+
/** Pickup point map for methods with `supportsPickupPoints`. */
|
|
2648
|
+
pickupWidget?: PickupWidgetConfig;
|
|
2649
|
+
[key: string]: unknown;
|
|
2598
2650
|
}
|
|
2599
2651
|
/**
|
|
2600
2652
|
* Input for `behio.shipping.quote()`. At minimum requires the destination
|
|
@@ -2642,6 +2694,51 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
2642
2694
|
/** Quote expiry (epoch ms). Null for fixed-price methods. */
|
|
2643
2695
|
expiresAt: number | null;
|
|
2644
2696
|
}
|
|
2697
|
+
/**
|
|
2698
|
+
* A pickup point (parcel shop / locker) for a shipping method with
|
|
2699
|
+
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
2700
|
+
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
2701
|
+
*/
|
|
2702
|
+
/**
|
|
2703
|
+
* Carrier map widget for choosing a pickup point in checkout. Present in
|
|
2704
|
+
* `ShippingMethod.publicConfig.pickupWidget` when the merchant's carrier
|
|
2705
|
+
* supports it (today Packeta: load https://widget.packeta.com/v6/www/js/library.js
|
|
2706
|
+
* and call `Packeta.Widget.pick(apiKey, cb, {country, language})`; send
|
|
2707
|
+
* `String(point.id)` back as `checkout.pickupPointId`). SDK 1.15.0.
|
|
2708
|
+
* `provider: "behio"` (SDK 1.16.0) means "draw the map yourself from
|
|
2709
|
+
* `getPickupPoints()` coordinates".
|
|
2710
|
+
* `provider: "zaslat"` (SDK 2.16.0) is the Zaslat map widget
|
|
2711
|
+
* (https://docs.zaslat.cz/map_widget): load
|
|
2712
|
+
* https://app.zaslat.cz/map/zaslat-map.umd.min.js once, call
|
|
2713
|
+
* `zslt.openMap({addressType: "recipient", carriers, territory, lang, value})`
|
|
2714
|
+
* and send `place.code || String(place.id)` back as `checkout.pickupPointId`
|
|
2715
|
+
* together with a `checkout.pickupPoint` snapshot.
|
|
2716
|
+
*/
|
|
2717
|
+
type PickupWidgetConfig = {
|
|
2718
|
+
provider: "packeta";
|
|
2719
|
+
/** Public widget key (never the API password). */
|
|
2720
|
+
apiKey: string;
|
|
2721
|
+
} | {
|
|
2722
|
+
/**
|
|
2723
|
+
* No carrier widget, but every point from `getPickupPoints()` carries
|
|
2724
|
+
* `latitude`/`longitude`: render your own map (SDK 1.16.0; PPL, GLS,
|
|
2725
|
+
* Aramex).
|
|
2726
|
+
*/
|
|
2727
|
+
provider: "behio";
|
|
2728
|
+
} | {
|
|
2729
|
+
/** Zaslat map widget, no key needed (SDK 2.16.0). */
|
|
2730
|
+
provider: "zaslat";
|
|
2731
|
+
/**
|
|
2732
|
+
* Zaslat carrier code for the widget `carriers` filter
|
|
2733
|
+
* (e.g. "ZASILKOVNA", "PPL"); null = show every carrier.
|
|
2734
|
+
*/
|
|
2735
|
+
carrier: string | null;
|
|
2736
|
+
/**
|
|
2737
|
+
* Widget `territory` when the method ships to exactly one of CZ/SK;
|
|
2738
|
+
* null = use the delivery country (`"cz"` or `"sk"`).
|
|
2739
|
+
*/
|
|
2740
|
+
territory: "cz" | "sk" | null;
|
|
2741
|
+
};
|
|
2645
2742
|
interface PickupPoint {
|
|
2646
2743
|
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
2647
2744
|
externalId: string;
|
|
@@ -3207,6 +3304,7 @@ declare class BehioStorefront {
|
|
|
3207
3304
|
readonly pages: PagesModule;
|
|
3208
3305
|
readonly blog: BlogModule;
|
|
3209
3306
|
readonly forms: FormsModule;
|
|
3307
|
+
readonly collections: CollectionsModule;
|
|
3210
3308
|
readonly wishlist: WishlistModule;
|
|
3211
3309
|
readonly reviews: ReviewsModule;
|
|
3212
3310
|
readonly returns: ReturnsModule;
|
|
@@ -3914,6 +4012,29 @@ declare class BlogModule {
|
|
|
3914
4012
|
/** One published post with sanitised HTML content and related posts. */
|
|
3915
4013
|
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3916
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
|
+
}
|
|
3917
4038
|
/**
|
|
3918
4039
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3919
4040
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -4949,6 +5070,14 @@ interface UseBlogPostOptions {
|
|
|
4949
5070
|
/** One published post (sanitised HTML content + related posts). */
|
|
4950
5071
|
declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
|
|
4951
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
|
+
|
|
4952
5081
|
interface UseSiteFormOptions {
|
|
4953
5082
|
enabled?: boolean;
|
|
4954
5083
|
}
|
|
@@ -5782,4 +5911,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5782
5911
|
success: boolean;
|
|
5783
5912
|
}>>;
|
|
5784
5913
|
|
|
5785
|
-
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;
|
|
@@ -2593,8 +2630,23 @@ interface ShippingMethodSummary {
|
|
|
2593
2630
|
etaDaysMin: number | null;
|
|
2594
2631
|
etaDaysMax: number | null;
|
|
2595
2632
|
allowedCountries: string[];
|
|
2596
|
-
/** Customer-safe config fields the merchant filled in (pickup address, instructions). */
|
|
2597
|
-
publicConfig:
|
|
2633
|
+
/** Customer-safe config fields the merchant filled in (pickup address, instructions) and the pickup map widget. */
|
|
2634
|
+
publicConfig: ShippingPublicConfig;
|
|
2635
|
+
}
|
|
2636
|
+
/**
|
|
2637
|
+
* Customer-safe part of a shipping method's config. Typed keys since
|
|
2638
|
+
* SDK 2.16.0; the index signature keeps older code that reads it as a
|
|
2639
|
+
* plain record compiling.
|
|
2640
|
+
*/
|
|
2641
|
+
interface ShippingPublicConfig {
|
|
2642
|
+
instructions?: string;
|
|
2643
|
+
/** In-store pickup address. */
|
|
2644
|
+
pickupAddress?: string;
|
|
2645
|
+
/** In-store pickup opening hours. */
|
|
2646
|
+
openingHours?: string;
|
|
2647
|
+
/** Pickup point map for methods with `supportsPickupPoints`. */
|
|
2648
|
+
pickupWidget?: PickupWidgetConfig;
|
|
2649
|
+
[key: string]: unknown;
|
|
2598
2650
|
}
|
|
2599
2651
|
/**
|
|
2600
2652
|
* Input for `behio.shipping.quote()`. At minimum requires the destination
|
|
@@ -2642,6 +2694,51 @@ interface ShippingQuote extends ShippingMethodSummary {
|
|
|
2642
2694
|
/** Quote expiry (epoch ms). Null for fixed-price methods. */
|
|
2643
2695
|
expiresAt: number | null;
|
|
2644
2696
|
}
|
|
2697
|
+
/**
|
|
2698
|
+
* A pickup point (parcel shop / locker) for a shipping method with
|
|
2699
|
+
* `supportsPickupPoints`. Fetch with `behio.shipping.getPickupPoints()`,
|
|
2700
|
+
* then send the chosen `externalId` as `checkout.pickupPointId`.
|
|
2701
|
+
*/
|
|
2702
|
+
/**
|
|
2703
|
+
* Carrier map widget for choosing a pickup point in checkout. Present in
|
|
2704
|
+
* `ShippingMethod.publicConfig.pickupWidget` when the merchant's carrier
|
|
2705
|
+
* supports it (today Packeta: load https://widget.packeta.com/v6/www/js/library.js
|
|
2706
|
+
* and call `Packeta.Widget.pick(apiKey, cb, {country, language})`; send
|
|
2707
|
+
* `String(point.id)` back as `checkout.pickupPointId`). SDK 1.15.0.
|
|
2708
|
+
* `provider: "behio"` (SDK 1.16.0) means "draw the map yourself from
|
|
2709
|
+
* `getPickupPoints()` coordinates".
|
|
2710
|
+
* `provider: "zaslat"` (SDK 2.16.0) is the Zaslat map widget
|
|
2711
|
+
* (https://docs.zaslat.cz/map_widget): load
|
|
2712
|
+
* https://app.zaslat.cz/map/zaslat-map.umd.min.js once, call
|
|
2713
|
+
* `zslt.openMap({addressType: "recipient", carriers, territory, lang, value})`
|
|
2714
|
+
* and send `place.code || String(place.id)` back as `checkout.pickupPointId`
|
|
2715
|
+
* together with a `checkout.pickupPoint` snapshot.
|
|
2716
|
+
*/
|
|
2717
|
+
type PickupWidgetConfig = {
|
|
2718
|
+
provider: "packeta";
|
|
2719
|
+
/** Public widget key (never the API password). */
|
|
2720
|
+
apiKey: string;
|
|
2721
|
+
} | {
|
|
2722
|
+
/**
|
|
2723
|
+
* No carrier widget, but every point from `getPickupPoints()` carries
|
|
2724
|
+
* `latitude`/`longitude`: render your own map (SDK 1.16.0; PPL, GLS,
|
|
2725
|
+
* Aramex).
|
|
2726
|
+
*/
|
|
2727
|
+
provider: "behio";
|
|
2728
|
+
} | {
|
|
2729
|
+
/** Zaslat map widget, no key needed (SDK 2.16.0). */
|
|
2730
|
+
provider: "zaslat";
|
|
2731
|
+
/**
|
|
2732
|
+
* Zaslat carrier code for the widget `carriers` filter
|
|
2733
|
+
* (e.g. "ZASILKOVNA", "PPL"); null = show every carrier.
|
|
2734
|
+
*/
|
|
2735
|
+
carrier: string | null;
|
|
2736
|
+
/**
|
|
2737
|
+
* Widget `territory` when the method ships to exactly one of CZ/SK;
|
|
2738
|
+
* null = use the delivery country (`"cz"` or `"sk"`).
|
|
2739
|
+
*/
|
|
2740
|
+
territory: "cz" | "sk" | null;
|
|
2741
|
+
};
|
|
2645
2742
|
interface PickupPoint {
|
|
2646
2743
|
/** Carrier-native id. Send this back as `checkout.pickupPointId`. */
|
|
2647
2744
|
externalId: string;
|
|
@@ -3207,6 +3304,7 @@ declare class BehioStorefront {
|
|
|
3207
3304
|
readonly pages: PagesModule;
|
|
3208
3305
|
readonly blog: BlogModule;
|
|
3209
3306
|
readonly forms: FormsModule;
|
|
3307
|
+
readonly collections: CollectionsModule;
|
|
3210
3308
|
readonly wishlist: WishlistModule;
|
|
3211
3309
|
readonly reviews: ReviewsModule;
|
|
3212
3310
|
readonly returns: ReturnsModule;
|
|
@@ -3914,6 +4012,29 @@ declare class BlogModule {
|
|
|
3914
4012
|
/** One published post with sanitised HTML content and related posts. */
|
|
3915
4013
|
post(handle: string, slug: string, locale?: string): Promise<SdkResult<BlogPostDetail>>;
|
|
3916
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
|
+
}
|
|
3917
4038
|
/**
|
|
3918
4039
|
* Merchant-defined forms (contact, demand, registration to an event...).
|
|
3919
4040
|
* The definition is public and cacheable; a submit is validated server-side
|
|
@@ -4949,6 +5070,14 @@ interface UseBlogPostOptions {
|
|
|
4949
5070
|
/** One published post (sanitised HTML content + related posts). */
|
|
4950
5071
|
declare function useBlogPost(handle: string, slug: string, locale?: string, options?: UseBlogPostOptions): _tanstack_react_query.UseQueryResult<NoInfer<BlogPostDetail>, Error>;
|
|
4951
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
|
+
|
|
4952
5081
|
interface UseSiteFormOptions {
|
|
4953
5082
|
enabled?: boolean;
|
|
4954
5083
|
}
|
|
@@ -5782,4 +5911,4 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
5782
5911
|
success: boolean;
|
|
5783
5912
|
}>>;
|
|
5784
5913
|
|
|
5785
|
-
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 };
|