@behio/storefront-sdk 1.9.0 → 1.18.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 +11 -9
- package/dist/{chunk-CY6D2YEI.js → chunk-GAYYRRUL.js} +178 -27
- package/dist/{chunk-XMKY4RI5.mjs → chunk-W2P2D3EZ.mjs} +154 -3
- package/dist/{client-C635vSzU.d.mts → client-B29GktSJ.d.mts} +421 -7
- package/dist/{client-C635vSzU.d.ts → client-B29GktSJ.d.ts} +421 -7
- package/dist/index.d.mts +44 -3
- package/dist/index.d.ts +44 -3
- package/dist/index.js +743 -2
- package/dist/index.mjs +742 -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 +456 -13
- package/dist/react.d.ts +456 -13
- package/dist/react.js +339 -54
- package/dist/react.mjs +326 -46
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-
|
|
2
|
-
export { A as ActivePromotion,
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-B29GktSJ.mjs';
|
|
2
|
+
export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleItem, z as Cart, D as CartBundleLine, E as CartBundleLineItem, F as CartDiscount, G as CartItem, H as CartItemProduct, I as CartPromotion, J as Category, K as CategoryDetail, L as CertificateVerification, M as CheckoutAddress, N as CheckoutInput, O as CheckoutPaymentMethod, Q as CheckoutSettings, R as CookieConsentInput, T as CourseAttachment, U as CourseCertificate, V as CourseComment, W as CourseCommentReply, X as CourseCommentsList, Y as CourseDetail, Z as CourseLesson, _ as CourseListItem, $ as CourseModule, a0 as CoursePostedComment, a1 as CourseProgress, a2 as CourseTutorMessage, a3 as CourseTutorThread, a4 as CrossSellItem, a5 as CustomerAddress, a6 as CustomerProfile, a7 as DigitalDownload, a8 as DownloadUrl, a9 as Facet, aa as FacetAvailability, ab as FacetCategory, ac as FacetLabel, ad as FacetPriceRange, ae as FacetRange, af as FacetRatingBucket, ag as FacetValue, ah as FacetsResponse, ai as FilterField, aj as FulfillmentStatus, ak as FulfillmentStatuses, al as GiftCardBalance, am as GiftCardPurchaseInput, an as GiftCardPurchaseResult, ao as GiftCardSummary, ap as LessonNote, aq as LessonQuiz, ar as LoginInput, as as LoyaltyBalance, at as LoyaltyNextTier, au as LoyaltyProgram, av as LoyaltySummary, aw as LoyaltyTier, ax as LoyaltyTierPerks, ay as LoyaltyTransaction, az as Menu, aA as MenuItem, aB as MenuItemRef, aC as MenuItemType, aD as MessageResponse, aE as NewsletterOptInDefault, aF as NewsletterSubscribeInput, aG as NewsletterSubscribeResult, aH as NewsletterUnsubscribeResult, aI as OrderAccessRequestResponse, aJ as OrderAccessVerifyResponse, aK as OrderDetail, aL as OrderItem, aM as OrderListItem, aN as OrderStatus, aO as OrderStatusHistory, aP as OrderStatuses, aQ as OrderTracking, aR as Page, aS as PageAttachment, aT as PageDetail, aU as PaginatedResponse, aV as PaymentInstrument, aW as PaymentStatus, aX as PaymentStatuses, aY as PaymentSwift, aZ as PickupPoint, a_ as PickupPointHours, a$ as PickupPointsInput, b0 as PickupWidgetConfig, b1 as PriceDisplay, b2 as ProductAssetGroup, b3 as ProductAssetItem, b4 as ProductAvailability, b5 as ProductGroup, b6 as ProductLabel, b7 as ProductListItem, b8 as ProductMedia, b9 as ProductMediaVariant, ba as ProductParameter, bb as ProductParameterGroup, bc as ProductParametersResponse, bd as ProductPrice, be as ProductPromotionSummary, bf as ProductReview, bg as ProductReviewsResponse, bh as ProductSibling, bi as ProductSort, bj as ProductSortValue, bk as ProductVolumePrice, bl as ProductsQuery, bm as QuizAnswerInput, bn as QuizAnswerResult, bo as QuizQuestion, bp as QuizResult, bq as QuoteItem, br as QuoteRequest, bs as RegisterInput, bt as RegisterResult, bu as RequestInterceptor, bv as RequestInterceptorConfig, bw as ResponseInterceptor, bx as ResponseInterceptorData, by as ReturnRequest, bz as ReturnRequestItem, bA as ReturnStatus, bB as ReturnStatusItem, bC as ReturnableOrder, bD as ReturnableOrderItem, bE as SdkError, bF as ShippingMethodSummary, bG as ShippingQuote, bH as ShippingQuoteInput, bI as ShopInfo, bJ as ShopScript, bK as ShopScriptPlacement, bL as ShopScriptType, bM as ShopScripts, bN as ShopSeo, bO as ShopSeoIdentity, bP as SiteFormField, bQ as SiteFormFieldOption, bR as SiteFormFieldType, bS as Sitemap, bT as SitemapEntry, bU as StockBehavior, bV as StockMode, bW as StorefrontForm, bX as StorefrontFormFieldErrorCode, bY as StorefrontFormSettings, bZ as StorefrontFormSubmitInput, b_ as StorefrontFormSubmitResult, b$ as SubmitQuoteInput, c0 as SubmitReturnInput, c1 as SubmitReviewInput, c2 as Subscription, c3 as SubscriptionAction, c4 as SubscriptionFrequency, c5 as SubscriptionItem, c6 as SubscriptionStatus, c7 as TaxBreakdownLine, c8 as VariantAxis, c9 as VariantAxisValue, ca as WishlistItem, cb as err, cc as ok, cd as toSdkError } from './client-B29GktSJ.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -224,4 +224,45 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
224
224
|
success: boolean;
|
|
225
225
|
}>>;
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
type ErrorMessageLocale = "cs" | "sk" | "en";
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Preklad chyb backendu (chybovy kontrakt, docs/error-contract.md).
|
|
231
|
+
*
|
|
232
|
+
* Verejne /storefront/v1 chyby nesou od BE:
|
|
233
|
+
* {statusCode, key: "be.storefront.x", code: "be.storefront.x", params, message}
|
|
234
|
+
* `message` je anglicka veta (docasna kompatibilita, zmizi v major verzi);
|
|
235
|
+
* `code`/`key` je stabilni strojovy identifikator. `errorMessage()` vrati
|
|
236
|
+
* lokalizovanou vetu pro cs/sk/en s interpolaci `params`, s fallbackem na
|
|
237
|
+
* anglickou `message` z odpovedi.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/** Stabilni chybovy kod (`be.storefront.*`) z odpovedi BE, nebo null. */
|
|
241
|
+
declare function errorCode(err: unknown): string | null;
|
|
242
|
+
/** Interpolacni parametry chyby ({name}, {min}, ...), nebo prazdny objekt. */
|
|
243
|
+
declare function errorParams(err: unknown): Record<string, unknown>;
|
|
244
|
+
/**
|
|
245
|
+
* Lokalizovana veta pro chybu z SDK volani.
|
|
246
|
+
*
|
|
247
|
+
* const {data, error} = await behio.cart.addItem(...);
|
|
248
|
+
* if (error) show(errorMessage(error, "cs"));
|
|
249
|
+
*
|
|
250
|
+
* Poradi: preklad podle `code` -> anglicka `message` z odpovedi -> obecna veta.
|
|
251
|
+
*/
|
|
252
|
+
declare function errorMessage(err: unknown, locale?: ErrorMessageLocale): string;
|
|
253
|
+
/**
|
|
254
|
+
* Prelozene chyby validace per pole (`be.validation.failed` telo).
|
|
255
|
+
* Vrati mapu path -> veta ("email" -> "Neplatná e-mailová adresa.").
|
|
256
|
+
*/
|
|
257
|
+
declare function validationFieldMessages(err: unknown, locale?: ErrorMessageLocale): Record<string, string>;
|
|
258
|
+
/**
|
|
259
|
+
* Per-field errors of a rejected form submit (`be.forms.validationFailed`).
|
|
260
|
+
* The backend sends `params.errors` as `"fieldKey:code"` strings; this turns
|
|
261
|
+
* them into `{key, code}` pairs. Empty for any other error.
|
|
262
|
+
*
|
|
263
|
+
* const {error} = await behio.forms.submit("contact", {data});
|
|
264
|
+
* const byKey = Object.fromEntries(formFieldErrors(error).map((e) => [e.key, e.code]));
|
|
265
|
+
*/
|
|
266
|
+
declare function formFieldErrors(err: unknown): StorefrontFormFieldError[];
|
|
267
|
+
|
|
268
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, validationFieldMessages, variantFromQuery, variantHref };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-
|
|
2
|
-
export { A as ActivePromotion,
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-B29GktSJ.js';
|
|
2
|
+
export { A as ActivePromotion, c as AddToCartInput, d as AddressDetail, e as AddressSuggestion, f as AddressType, g as AddressTypes, h as AuthTokens, i as BackInStockSubscription, j as BadgeTone, k as BehioApiError, l as BehioErrorCode, m as BehioEventHandler, n as BehioEventType, o as BehioNetworkError, p as BehioStorefrontConfig, q as Blog, r as BlogPostDetail, s as BlogPostListItem, t as BlogPostsPage, u as BlogPostsQuery, v as BlogSettings, w as BlogTag, x as Bundle, y as BundleItem, z as Cart, D as CartBundleLine, E as CartBundleLineItem, F as CartDiscount, G as CartItem, H as CartItemProduct, I as CartPromotion, J as Category, K as CategoryDetail, L as CertificateVerification, M as CheckoutAddress, N as CheckoutInput, O as CheckoutPaymentMethod, Q as CheckoutSettings, R as CookieConsentInput, T as CourseAttachment, U as CourseCertificate, V as CourseComment, W as CourseCommentReply, X as CourseCommentsList, Y as CourseDetail, Z as CourseLesson, _ as CourseListItem, $ as CourseModule, a0 as CoursePostedComment, a1 as CourseProgress, a2 as CourseTutorMessage, a3 as CourseTutorThread, a4 as CrossSellItem, a5 as CustomerAddress, a6 as CustomerProfile, a7 as DigitalDownload, a8 as DownloadUrl, a9 as Facet, aa as FacetAvailability, ab as FacetCategory, ac as FacetLabel, ad as FacetPriceRange, ae as FacetRange, af as FacetRatingBucket, ag as FacetValue, ah as FacetsResponse, ai as FilterField, aj as FulfillmentStatus, ak as FulfillmentStatuses, al as GiftCardBalance, am as GiftCardPurchaseInput, an as GiftCardPurchaseResult, ao as GiftCardSummary, ap as LessonNote, aq as LessonQuiz, ar as LoginInput, as as LoyaltyBalance, at as LoyaltyNextTier, au as LoyaltyProgram, av as LoyaltySummary, aw as LoyaltyTier, ax as LoyaltyTierPerks, ay as LoyaltyTransaction, az as Menu, aA as MenuItem, aB as MenuItemRef, aC as MenuItemType, aD as MessageResponse, aE as NewsletterOptInDefault, aF as NewsletterSubscribeInput, aG as NewsletterSubscribeResult, aH as NewsletterUnsubscribeResult, aI as OrderAccessRequestResponse, aJ as OrderAccessVerifyResponse, aK as OrderDetail, aL as OrderItem, aM as OrderListItem, aN as OrderStatus, aO as OrderStatusHistory, aP as OrderStatuses, aQ as OrderTracking, aR as Page, aS as PageAttachment, aT as PageDetail, aU as PaginatedResponse, aV as PaymentInstrument, aW as PaymentStatus, aX as PaymentStatuses, aY as PaymentSwift, aZ as PickupPoint, a_ as PickupPointHours, a$ as PickupPointsInput, b0 as PickupWidgetConfig, b1 as PriceDisplay, b2 as ProductAssetGroup, b3 as ProductAssetItem, b4 as ProductAvailability, b5 as ProductGroup, b6 as ProductLabel, b7 as ProductListItem, b8 as ProductMedia, b9 as ProductMediaVariant, ba as ProductParameter, bb as ProductParameterGroup, bc as ProductParametersResponse, bd as ProductPrice, be as ProductPromotionSummary, bf as ProductReview, bg as ProductReviewsResponse, bh as ProductSibling, bi as ProductSort, bj as ProductSortValue, bk as ProductVolumePrice, bl as ProductsQuery, bm as QuizAnswerInput, bn as QuizAnswerResult, bo as QuizQuestion, bp as QuizResult, bq as QuoteItem, br as QuoteRequest, bs as RegisterInput, bt as RegisterResult, bu as RequestInterceptor, bv as RequestInterceptorConfig, bw as ResponseInterceptor, bx as ResponseInterceptorData, by as ReturnRequest, bz as ReturnRequestItem, bA as ReturnStatus, bB as ReturnStatusItem, bC as ReturnableOrder, bD as ReturnableOrderItem, bE as SdkError, bF as ShippingMethodSummary, bG as ShippingQuote, bH as ShippingQuoteInput, bI as ShopInfo, bJ as ShopScript, bK as ShopScriptPlacement, bL as ShopScriptType, bM as ShopScripts, bN as ShopSeo, bO as ShopSeoIdentity, bP as SiteFormField, bQ as SiteFormFieldOption, bR as SiteFormFieldType, bS as Sitemap, bT as SitemapEntry, bU as StockBehavior, bV as StockMode, bW as StorefrontForm, bX as StorefrontFormFieldErrorCode, bY as StorefrontFormSettings, bZ as StorefrontFormSubmitInput, b_ as StorefrontFormSubmitResult, b$ as SubmitQuoteInput, c0 as SubmitReturnInput, c1 as SubmitReviewInput, c2 as Subscription, c3 as SubscriptionAction, c4 as SubscriptionFrequency, c5 as SubscriptionItem, c6 as SubscriptionStatus, c7 as TaxBreakdownLine, c8 as VariantAxis, c9 as VariantAxisValue, ca as WishlistItem, cb as err, cc as ok, cd as toSdkError } from './client-B29GktSJ.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -224,4 +224,45 @@ declare function revokeAnalyticsConsent(client: BehioStorefront): Promise<SdkRes
|
|
|
224
224
|
success: boolean;
|
|
225
225
|
}>>;
|
|
226
226
|
|
|
227
|
-
|
|
227
|
+
type ErrorMessageLocale = "cs" | "sk" | "en";
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Preklad chyb backendu (chybovy kontrakt, docs/error-contract.md).
|
|
231
|
+
*
|
|
232
|
+
* Verejne /storefront/v1 chyby nesou od BE:
|
|
233
|
+
* {statusCode, key: "be.storefront.x", code: "be.storefront.x", params, message}
|
|
234
|
+
* `message` je anglicka veta (docasna kompatibilita, zmizi v major verzi);
|
|
235
|
+
* `code`/`key` je stabilni strojovy identifikator. `errorMessage()` vrati
|
|
236
|
+
* lokalizovanou vetu pro cs/sk/en s interpolaci `params`, s fallbackem na
|
|
237
|
+
* anglickou `message` z odpovedi.
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
/** Stabilni chybovy kod (`be.storefront.*`) z odpovedi BE, nebo null. */
|
|
241
|
+
declare function errorCode(err: unknown): string | null;
|
|
242
|
+
/** Interpolacni parametry chyby ({name}, {min}, ...), nebo prazdny objekt. */
|
|
243
|
+
declare function errorParams(err: unknown): Record<string, unknown>;
|
|
244
|
+
/**
|
|
245
|
+
* Lokalizovana veta pro chybu z SDK volani.
|
|
246
|
+
*
|
|
247
|
+
* const {data, error} = await behio.cart.addItem(...);
|
|
248
|
+
* if (error) show(errorMessage(error, "cs"));
|
|
249
|
+
*
|
|
250
|
+
* Poradi: preklad podle `code` -> anglicka `message` z odpovedi -> obecna veta.
|
|
251
|
+
*/
|
|
252
|
+
declare function errorMessage(err: unknown, locale?: ErrorMessageLocale): string;
|
|
253
|
+
/**
|
|
254
|
+
* Prelozene chyby validace per pole (`be.validation.failed` telo).
|
|
255
|
+
* Vrati mapu path -> veta ("email" -> "Neplatná e-mailová adresa.").
|
|
256
|
+
*/
|
|
257
|
+
declare function validationFieldMessages(err: unknown, locale?: ErrorMessageLocale): Record<string, string>;
|
|
258
|
+
/**
|
|
259
|
+
* Per-field errors of a rejected form submit (`be.forms.validationFailed`).
|
|
260
|
+
* The backend sends `params.errors` as `"fieldKey:code"` strings; this turns
|
|
261
|
+
* them into `{key, code}` pairs. Empty for any other error.
|
|
262
|
+
*
|
|
263
|
+
* const {error} = await behio.forms.submit("contact", {data});
|
|
264
|
+
* const byKey = Object.fromEntries(formFieldErrors(error).map((e) => [e.key, e.code]));
|
|
265
|
+
*/
|
|
266
|
+
declare function formFieldErrors(err: unknown): StorefrontFormFieldError[];
|
|
267
|
+
|
|
268
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, validationFieldMessages, variantFromQuery, variantHref };
|