@behio/storefront-sdk 2.2.0 → 2.3.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 +10 -0
- package/dist/{chunk-PUAQHLBV.js → chunk-B6LU56EC.js} +16 -9
- package/dist/{chunk-5C43BIAZ.mjs → chunk-ET7SLTHN.mjs} +16 -9
- package/dist/{client-BhdlZIGe.d.mts → client-CDpkw2Qv.d.mts} +15 -1
- package/dist/{client-BhdlZIGe.d.ts → client-CDpkw2Qv.d.ts} +15 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -3
- package/dist/index.mjs +3 -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.js +14 -8
- package/dist/react.mjs +14 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -252,6 +252,16 @@ A failed price entitlement lookup returns HTTP 503 with `be.storefront.pricingUn
|
|
|
252
252
|
|
|
253
253
|
`catalog.getCategoryProducts(slug, query)` shares the full `ProductsQuery` serializer with `getProducts`. Price bounds retain zero, boolean filters retain false, arrays use repeated parameters and public parameter/facet selections use JSON. Category, main-list and featured availability follow the same published-variant and stock-mode rules in the backend.
|
|
254
254
|
|
|
255
|
+
### Cart summary for page scripts (2.2, helper 2.3)
|
|
256
|
+
|
|
257
|
+
Browser cart responses dispatch `behio:cart` on `window` with
|
|
258
|
+
`{total, currency, itemCount}` and keep the last value in `window.__behioCart`
|
|
259
|
+
(Behio Chat reads it for cart-value greetings). Carts with
|
|
260
|
+
`totalsAvailable: false` are not announced. Storefronts that mutate the cart on
|
|
261
|
+
the server (Server Actions, snapshot routes) call
|
|
262
|
+
`publishCartSummary({total, currency, itemCount})` on the client after each
|
|
263
|
+
fresh cart; it does nothing during SSR.
|
|
264
|
+
|
|
255
265
|
### Bundle offers and galleries (2.0, unreleased)
|
|
256
266
|
|
|
257
267
|
`catalog.getBundles({locale, currency, country})` and `getBundle(slug, options)`
|
|
@@ -2104,22 +2104,28 @@ var NewsletterModule = class {
|
|
|
2104
2104
|
);
|
|
2105
2105
|
}
|
|
2106
2106
|
};
|
|
2107
|
-
function
|
|
2107
|
+
function publishCartSummary(summary) {
|
|
2108
2108
|
if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
|
|
2109
|
+
if (!Number.isFinite(summary.total) || !Number.isFinite(summary.itemCount)) return;
|
|
2110
|
+
const detail = { total: summary.total, currency: _nullishCoalesce(summary.currency, () => ( null)), itemCount: summary.itemCount };
|
|
2111
|
+
try {
|
|
2112
|
+
window.__behioCart = detail;
|
|
2113
|
+
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2114
|
+
} catch (e6) {
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
function emitCartEvent(data) {
|
|
2118
|
+
if (typeof window === "undefined") return;
|
|
2109
2119
|
const cart = data;
|
|
2110
2120
|
if (!cart || typeof cart !== "object" || !Array.isArray(cart.items)) return;
|
|
2121
|
+
if (cart.totalsAvailable === false) return;
|
|
2111
2122
|
const items = cart.items;
|
|
2112
2123
|
const total = typeof cart.grandTotal === "number" ? cart.grandTotal : typeof cart.subtotal === "number" ? cart.subtotal : 0;
|
|
2113
|
-
|
|
2124
|
+
publishCartSummary({
|
|
2114
2125
|
total,
|
|
2115
2126
|
currency: typeof cart.currency === "string" ? cart.currency : null,
|
|
2116
2127
|
itemCount: items.reduce((n, i) => n + (typeof _optionalChain([i, 'optionalAccess', _53 => _53.quantity]) === "number" ? i.quantity : 1), 0)
|
|
2117
|
-
};
|
|
2118
|
-
try {
|
|
2119
|
-
window.__behioCart = detail;
|
|
2120
|
-
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2121
|
-
} catch (e6) {
|
|
2122
|
-
}
|
|
2128
|
+
});
|
|
2123
2129
|
}
|
|
2124
2130
|
|
|
2125
2131
|
|
|
@@ -2134,4 +2140,5 @@ function emitCartEvent(data) {
|
|
|
2134
2140
|
|
|
2135
2141
|
|
|
2136
2142
|
|
|
2137
|
-
|
|
2143
|
+
|
|
2144
|
+
exports.ProductSort = ProductSort; exports.OrderStatuses = OrderStatuses; exports.PaymentStatuses = PaymentStatuses; exports.FulfillmentStatuses = FulfillmentStatuses; exports.AddressTypes = AddressTypes; exports.BehioApiError = BehioApiError; exports.BehioNetworkError = BehioNetworkError; exports.ok = ok; exports.err = err; exports.toSdkError = toSdkError; exports.BehioStorefront = BehioStorefront; exports.publishCartSummary = publishCartSummary;
|
|
@@ -2104,22 +2104,28 @@ var NewsletterModule = class {
|
|
|
2104
2104
|
);
|
|
2105
2105
|
}
|
|
2106
2106
|
};
|
|
2107
|
-
function
|
|
2107
|
+
function publishCartSummary(summary) {
|
|
2108
2108
|
if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
|
|
2109
|
+
if (!Number.isFinite(summary.total) || !Number.isFinite(summary.itemCount)) return;
|
|
2110
|
+
const detail = { total: summary.total, currency: summary.currency ?? null, itemCount: summary.itemCount };
|
|
2111
|
+
try {
|
|
2112
|
+
window.__behioCart = detail;
|
|
2113
|
+
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2114
|
+
} catch {
|
|
2115
|
+
}
|
|
2116
|
+
}
|
|
2117
|
+
function emitCartEvent(data) {
|
|
2118
|
+
if (typeof window === "undefined") return;
|
|
2109
2119
|
const cart = data;
|
|
2110
2120
|
if (!cart || typeof cart !== "object" || !Array.isArray(cart.items)) return;
|
|
2121
|
+
if (cart.totalsAvailable === false) return;
|
|
2111
2122
|
const items = cart.items;
|
|
2112
2123
|
const total = typeof cart.grandTotal === "number" ? cart.grandTotal : typeof cart.subtotal === "number" ? cart.subtotal : 0;
|
|
2113
|
-
|
|
2124
|
+
publishCartSummary({
|
|
2114
2125
|
total,
|
|
2115
2126
|
currency: typeof cart.currency === "string" ? cart.currency : null,
|
|
2116
2127
|
itemCount: items.reduce((n, i) => n + (typeof i?.quantity === "number" ? i.quantity : 1), 0)
|
|
2117
|
-
};
|
|
2118
|
-
try {
|
|
2119
|
-
window.__behioCart = detail;
|
|
2120
|
-
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2121
|
-
} catch {
|
|
2122
|
-
}
|
|
2128
|
+
});
|
|
2123
2129
|
}
|
|
2124
2130
|
|
|
2125
2131
|
export {
|
|
@@ -2133,5 +2139,6 @@ export {
|
|
|
2133
2139
|
ok,
|
|
2134
2140
|
err,
|
|
2135
2141
|
toSdkError,
|
|
2136
|
-
BehioStorefront
|
|
2142
|
+
BehioStorefront,
|
|
2143
|
+
publishCartSummary
|
|
2137
2144
|
};
|
|
@@ -3790,5 +3790,19 @@ declare class NewsletterModule {
|
|
|
3790
3790
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
3791
3791
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3792
3792
|
}
|
|
3793
|
+
/** Souhrn kosiku pro skripty na strance (Behio Chat, analytika). */
|
|
3794
|
+
interface CartSummaryEvent {
|
|
3795
|
+
total: number;
|
|
3796
|
+
currency: string | null;
|
|
3797
|
+
itemCount: number;
|
|
3798
|
+
}
|
|
3799
|
+
/**
|
|
3800
|
+
* Vysle v prohlizeci udalost `behio:cart` ({total, currency, itemCount})
|
|
3801
|
+
* a ulozi ji do `window.__behioCart`. Posloucha ji Behio Chat (osloveni podle
|
|
3802
|
+
* hodnoty kosiku, promenne {cartTotal}). SDK ji vola samo po kazde odpovedi
|
|
3803
|
+
* kosiku v prohlizeci. Sablona, ktera kosik meni na serveru (Server Actions,
|
|
3804
|
+
* vlastni route), ji zavola sama s aktualnim souhrnem. Na serveru nedela nic.
|
|
3805
|
+
*/
|
|
3806
|
+
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
3793
3807
|
|
|
3794
|
-
export { type
|
|
3808
|
+
export { type CourseCommentsList as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type CartSummaryEvent as K, type Category as L, type CategoryDetail as M, type CertificateVerification as N, type CheckoutAddress as O, type ProductDetail as P, type CheckoutInput as Q, type CheckoutPaymentMethod as R, type SdkResult as S, type CheckoutPreview as T, type CheckoutResult as U, type CheckoutSettings as V, type CookieConsentInput as W, type CourseAttachment as X, type CourseCertificate as Y, type CourseComment as Z, type CourseCommentReply as _, type ProductVariant as a, type PaymentStatus as a$, type CourseDetail as a0, type CourseLesson as a1, type CourseListItem as a2, type CourseModule as a3, type CoursePostedComment as a4, type CourseProgress as a5, type CourseTutorMessage as a6, type CourseTutorThread as a7, type CrossSellItem as a8, type CurrencyDisplayFormat as a9, type LoyaltySummary as aA, type LoyaltyTier as aB, type LoyaltyTierPerks as aC, type LoyaltyTransaction as aD, type Menu as aE, type MenuItem as aF, type MenuItemRef as aG, type MenuItemType as aH, type MessageResponse as aI, type NewsletterOptInDefault as aJ, type NewsletterSubscribeInput as aK, type NewsletterSubscribeResult as aL, type NewsletterUnsubscribeResult as aM, type OrderAccessRequestResponse as aN, type OrderAccessVerifyResponse as aO, type OrderDetail as aP, type OrderItem as aQ, type OrderListItem as aR, type OrderStatus as aS, type OrderStatusHistory as aT, OrderStatuses as aU, type OrderTracking as aV, type Page as aW, type PageAttachment as aX, type PageDetail as aY, type PaginatedResponse as aZ, type PaymentInstrument as a_, type CustomerAddress as aa, type CustomerProfile as ab, type DigitalDownload as ac, type DownloadUrl as ad, type Facet as ae, type FacetAvailability as af, type FacetCategory as ag, type FacetLabel as ah, type FacetPriceRange as ai, type FacetRange as aj, type FacetRatingBucket as ak, type FacetValue as al, type FacetsResponse as am, type FilterField as an, type FulfillmentStatus as ao, FulfillmentStatuses as ap, type GiftCardBalance as aq, type GiftCardPurchaseInput as ar, type GiftCardPurchaseResult as as, type GiftCardSummary as at, type LessonNote as au, type LessonQuiz as av, type LoginInput as aw, type LoyaltyBalance as ax, type LoyaltyNextTier as ay, type LoyaltyProgram as az, type StorefrontFormFieldError as b, type StockMode as b$, PaymentStatuses as b0, type PaymentSwift as b1, type PickupPoint as b2, type PickupPointHours as b3, type PickupPointsInput as b4, type PickupWidgetConfig as b5, type PriceDisplay as b6, type ProductAssetGroup as b7, type ProductAssetItem as b8, type ProductAvailability as b9, type RequestInterceptorConfig as bA, type ResponseInterceptor as bB, type ResponseInterceptorData as bC, type ReturnRequest as bD, type ReturnRequestItem as bE, type ReturnStatus as bF, type ReturnStatusItem as bG, type ReturnableOrder as bH, type ReturnableOrderItem as bI, type SdkError as bJ, type ShippingMethodSummary as bK, type ShippingQuote as bL, type ShippingQuoteInput as bM, type ShopAppearance as bN, type ShopInfo as bO, type ShopScript as bP, type ShopScriptPlacement as bQ, type ShopScriptType as bR, type ShopScripts as bS, type ShopSeo as bT, type ShopSeoIdentity as bU, type SiteFormField as bV, type SiteFormFieldOption as bW, type SiteFormFieldType as bX, type Sitemap as bY, type SitemapEntry as bZ, type StockBehavior as b_, type ProductGroup as ba, type ProductLabel as bb, type ProductListItem as bc, type ProductMedia as bd, type ProductMediaVariant as be, type ProductParameter as bf, type ProductParameterGroup as bg, type ProductParametersResponse as bh, type ProductPrice as bi, type ProductPromotionSummary as bj, type ProductReview as bk, type ProductReviewsResponse as bl, type ProductSibling as bm, ProductSort as bn, type ProductSortValue as bo, type ProductVolumePrice as bp, type ProductsQuery as bq, type QuizAnswerInput as br, type QuizAnswerResult as bs, type QuizQuestion as bt, type QuizResult as bu, type QuoteItem as bv, type QuoteRequest as bw, type RegisterInput as bx, type RegisterResult as by, type RequestInterceptor as bz, type AddToCartInput as c, type StorefrontForm as c0, type StorefrontFormFieldErrorCode as c1, type StorefrontFormFile as c2, type StorefrontFormSettings as c3, type StorefrontFormSubmitInput as c4, type StorefrontFormSubmitResult as c5, type StorefrontFormUpload as c6, type SubmitQuoteInput as c7, type SubmitReturnInput as c8, type SubmitReviewInput as c9, type Subscription as ca, type SubscriptionAction as cb, type SubscriptionFrequency as cc, type SubscriptionItem as cd, type SubscriptionStatus as ce, type TaxBreakdownLine as cf, type VariantAxis as cg, type VariantAxisValue as ch, type WishlistItem as ci, err as cj, ok as ck, publishCartSummary as cl, toSdkError as cm, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
|
|
@@ -3790,5 +3790,19 @@ declare class NewsletterModule {
|
|
|
3790
3790
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
3791
3791
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3792
3792
|
}
|
|
3793
|
+
/** Souhrn kosiku pro skripty na strance (Behio Chat, analytika). */
|
|
3794
|
+
interface CartSummaryEvent {
|
|
3795
|
+
total: number;
|
|
3796
|
+
currency: string | null;
|
|
3797
|
+
itemCount: number;
|
|
3798
|
+
}
|
|
3799
|
+
/**
|
|
3800
|
+
* Vysle v prohlizeci udalost `behio:cart` ({total, currency, itemCount})
|
|
3801
|
+
* a ulozi ji do `window.__behioCart`. Posloucha ji Behio Chat (osloveni podle
|
|
3802
|
+
* hodnoty kosiku, promenne {cartTotal}). SDK ji vola samo po kazde odpovedi
|
|
3803
|
+
* kosiku v prohlizeci. Sablona, ktera kosik meni na serveru (Server Actions,
|
|
3804
|
+
* vlastni route), ji zavola sama s aktualnim souhrnem. Na serveru nedela nic.
|
|
3805
|
+
*/
|
|
3806
|
+
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
3793
3807
|
|
|
3794
|
-
export { type
|
|
3808
|
+
export { type CourseCommentsList as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type Cart as D, type CartBundleLine as E, type CartBundleLineItem as F, type CartDiscount as G, type CartItem as H, type CartItemProduct as I, type CartPromotion as J, type CartSummaryEvent as K, type Category as L, type CategoryDetail as M, type CertificateVerification as N, type CheckoutAddress as O, type ProductDetail as P, type CheckoutInput as Q, type CheckoutPaymentMethod as R, type SdkResult as S, type CheckoutPreview as T, type CheckoutResult as U, type CheckoutSettings as V, type CookieConsentInput as W, type CourseAttachment as X, type CourseCertificate as Y, type CourseComment as Z, type CourseCommentReply as _, type ProductVariant as a, type PaymentStatus as a$, type CourseDetail as a0, type CourseLesson as a1, type CourseListItem as a2, type CourseModule as a3, type CoursePostedComment as a4, type CourseProgress as a5, type CourseTutorMessage as a6, type CourseTutorThread as a7, type CrossSellItem as a8, type CurrencyDisplayFormat as a9, type LoyaltySummary as aA, type LoyaltyTier as aB, type LoyaltyTierPerks as aC, type LoyaltyTransaction as aD, type Menu as aE, type MenuItem as aF, type MenuItemRef as aG, type MenuItemType as aH, type MessageResponse as aI, type NewsletterOptInDefault as aJ, type NewsletterSubscribeInput as aK, type NewsletterSubscribeResult as aL, type NewsletterUnsubscribeResult as aM, type OrderAccessRequestResponse as aN, type OrderAccessVerifyResponse as aO, type OrderDetail as aP, type OrderItem as aQ, type OrderListItem as aR, type OrderStatus as aS, type OrderStatusHistory as aT, OrderStatuses as aU, type OrderTracking as aV, type Page as aW, type PageAttachment as aX, type PageDetail as aY, type PaginatedResponse as aZ, type PaymentInstrument as a_, type CustomerAddress as aa, type CustomerProfile as ab, type DigitalDownload as ac, type DownloadUrl as ad, type Facet as ae, type FacetAvailability as af, type FacetCategory as ag, type FacetLabel as ah, type FacetPriceRange as ai, type FacetRange as aj, type FacetRatingBucket as ak, type FacetValue as al, type FacetsResponse as am, type FilterField as an, type FulfillmentStatus as ao, FulfillmentStatuses as ap, type GiftCardBalance as aq, type GiftCardPurchaseInput as ar, type GiftCardPurchaseResult as as, type GiftCardSummary as at, type LessonNote as au, type LessonQuiz as av, type LoginInput as aw, type LoyaltyBalance as ax, type LoyaltyNextTier as ay, type LoyaltyProgram as az, type StorefrontFormFieldError as b, type StockMode as b$, PaymentStatuses as b0, type PaymentSwift as b1, type PickupPoint as b2, type PickupPointHours as b3, type PickupPointsInput as b4, type PickupWidgetConfig as b5, type PriceDisplay as b6, type ProductAssetGroup as b7, type ProductAssetItem as b8, type ProductAvailability as b9, type RequestInterceptorConfig as bA, type ResponseInterceptor as bB, type ResponseInterceptorData as bC, type ReturnRequest as bD, type ReturnRequestItem as bE, type ReturnStatus as bF, type ReturnStatusItem as bG, type ReturnableOrder as bH, type ReturnableOrderItem as bI, type SdkError as bJ, type ShippingMethodSummary as bK, type ShippingQuote as bL, type ShippingQuoteInput as bM, type ShopAppearance as bN, type ShopInfo as bO, type ShopScript as bP, type ShopScriptPlacement as bQ, type ShopScriptType as bR, type ShopScripts as bS, type ShopSeo as bT, type ShopSeoIdentity as bU, type SiteFormField as bV, type SiteFormFieldOption as bW, type SiteFormFieldType as bX, type Sitemap as bY, type SitemapEntry as bZ, type StockBehavior as b_, type ProductGroup as ba, type ProductLabel as bb, type ProductListItem as bc, type ProductMedia as bd, type ProductMediaVariant as be, type ProductParameter as bf, type ProductParameterGroup as bg, type ProductParametersResponse as bh, type ProductPrice as bi, type ProductPromotionSummary as bj, type ProductReview as bk, type ProductReviewsResponse as bl, type ProductSibling as bm, ProductSort as bn, type ProductSortValue as bo, type ProductVolumePrice as bp, type ProductsQuery as bq, type QuizAnswerInput as br, type QuizAnswerResult as bs, type QuizQuestion as bt, type QuizResult as bu, type QuoteItem as bv, type QuoteRequest as bw, type RegisterInput as bx, type RegisterResult as by, type RequestInterceptor as bz, type AddToCartInput as c, type StorefrontForm as c0, type StorefrontFormFieldErrorCode as c1, type StorefrontFormFile as c2, type StorefrontFormSettings as c3, type StorefrontFormSubmitInput as c4, type StorefrontFormSubmitResult as c5, type StorefrontFormUpload as c6, type SubmitQuoteInput as c7, type SubmitReturnInput as c8, type SubmitReviewInput as c9, type Subscription as ca, type SubscriptionAction as cb, type SubscriptionFrequency as cc, type SubscriptionItem as cd, type SubscriptionStatus as ce, type TaxBreakdownLine as cf, type VariantAxis as cg, type VariantAxisValue as ch, type WishlistItem as ci, err as cj, ok as ck, publishCartSummary as cl, toSdkError as cm, type AddressDetail as d, type AddressSuggestion as e, type AddressType as f, AddressTypes as g, type AuthTokens as h, type BackInStockSubscription as i, type BadgeTone as j, BehioApiError as k, type BehioErrorCode as l, type BehioEventHandler as m, type BehioEventType as n, BehioNetworkError as o, type BehioStorefrontConfig as p, type Blog as q, type BlogPostDetail as r, type BlogPostListItem as s, type BlogPostsPage as t, type BlogPostsQuery as u, type BlogSettings as v, type BlogTag as w, type Bundle as x, type BundleCatalogQuery as y, type BundleItem as z };
|
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, b as StorefrontFormFieldError } from './client-
|
|
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 BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-CDpkw2Qv.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 BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as CartSummaryEvent, L as Category, M as CategoryDetail, N as CertificateVerification, O as CheckoutAddress, Q as CheckoutInput, R as CheckoutPaymentMethod, T as CheckoutPreview, U as CheckoutResult, V as CheckoutSettings, W as CookieConsentInput, X as CourseAttachment, Y as CourseCertificate, Z as CourseComment, _ as CourseCommentReply, $ as CourseCommentsList, a0 as CourseDetail, a1 as CourseLesson, a2 as CourseListItem, a3 as CourseModule, a4 as CoursePostedComment, a5 as CourseProgress, a6 as CourseTutorMessage, a7 as CourseTutorThread, a8 as CrossSellItem, a9 as CurrencyDisplayFormat, aa as CustomerAddress, ab as CustomerProfile, ac as DigitalDownload, ad as DownloadUrl, ae as Facet, af as FacetAvailability, ag as FacetCategory, ah as FacetLabel, ai as FacetPriceRange, aj as FacetRange, ak as FacetRatingBucket, al as FacetValue, am as FacetsResponse, an as FilterField, ao as FulfillmentStatus, ap as FulfillmentStatuses, aq as GiftCardBalance, ar as GiftCardPurchaseInput, as as GiftCardPurchaseResult, at as GiftCardSummary, au as LessonNote, av as LessonQuiz, aw as LoginInput, ax as LoyaltyBalance, ay as LoyaltyNextTier, az as LoyaltyProgram, aA as LoyaltySummary, aB as LoyaltyTier, aC as LoyaltyTierPerks, aD as LoyaltyTransaction, aE as Menu, aF as MenuItem, aG as MenuItemRef, aH as MenuItemType, aI as MessageResponse, aJ as NewsletterOptInDefault, aK as NewsletterSubscribeInput, aL as NewsletterSubscribeResult, aM as NewsletterUnsubscribeResult, aN as OrderAccessRequestResponse, aO as OrderAccessVerifyResponse, aP as OrderDetail, aQ as OrderItem, aR as OrderListItem, aS as OrderStatus, aT as OrderStatusHistory, aU as OrderStatuses, aV as OrderTracking, aW as Page, aX as PageAttachment, aY as PageDetail, aZ as PaginatedResponse, a_ as PaymentInstrument, a$ as PaymentStatus, b0 as PaymentStatuses, b1 as PaymentSwift, b2 as PickupPoint, b3 as PickupPointHours, b4 as PickupPointsInput, b5 as PickupWidgetConfig, b6 as PriceDisplay, b7 as ProductAssetGroup, b8 as ProductAssetItem, b9 as ProductAvailability, ba as ProductGroup, bb as ProductLabel, bc as ProductListItem, bd as ProductMedia, be as ProductMediaVariant, bf as ProductParameter, bg as ProductParameterGroup, bh as ProductParametersResponse, bi as ProductPrice, bj as ProductPromotionSummary, bk as ProductReview, bl as ProductReviewsResponse, bm as ProductSibling, bn as ProductSort, bo as ProductSortValue, bp as ProductVolumePrice, bq as ProductsQuery, br as QuizAnswerInput, bs as QuizAnswerResult, bt as QuizQuestion, bu as QuizResult, bv as QuoteItem, bw as QuoteRequest, bx as RegisterInput, by as RegisterResult, bz as RequestInterceptor, bA as RequestInterceptorConfig, bB as ResponseInterceptor, bC as ResponseInterceptorData, bD as ReturnRequest, bE as ReturnRequestItem, bF as ReturnStatus, bG as ReturnStatusItem, bH as ReturnableOrder, bI as ReturnableOrderItem, bJ as SdkError, bK as ShippingMethodSummary, bL as ShippingQuote, bM as ShippingQuoteInput, bN as ShopAppearance, bO as ShopInfo, bP as ShopScript, bQ as ShopScriptPlacement, bR as ShopScriptType, bS as ShopScripts, bT as ShopSeo, bU as ShopSeoIdentity, bV as SiteFormField, bW as SiteFormFieldOption, bX as SiteFormFieldType, bY as Sitemap, bZ as SitemapEntry, b_ as StockBehavior, b$ as StockMode, c0 as StorefrontForm, c1 as StorefrontFormFieldErrorCode, c2 as StorefrontFormFile, c3 as StorefrontFormSettings, c4 as StorefrontFormSubmitInput, c5 as StorefrontFormSubmitResult, c6 as StorefrontFormUpload, c7 as SubmitQuoteInput, c8 as SubmitReturnInput, c9 as SubmitReviewInput, ca as Subscription, cb as SubscriptionAction, cc as SubscriptionFrequency, cd as SubscriptionItem, ce as SubscriptionStatus, cf as TaxBreakdownLine, cg as VariantAxis, ch as VariantAxisValue, ci as WishlistItem, cj as err, ck as ok, cl as publishCartSummary, cm as toSdkError } from './client-CDpkw2Qv.mjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
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, b as StorefrontFormFieldError } from './client-
|
|
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 BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-CDpkw2Qv.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 BundleCatalogQuery, z as BundleItem, D as Cart, E as CartBundleLine, F as CartBundleLineItem, G as CartDiscount, H as CartItem, I as CartItemProduct, J as CartPromotion, K as CartSummaryEvent, L as Category, M as CategoryDetail, N as CertificateVerification, O as CheckoutAddress, Q as CheckoutInput, R as CheckoutPaymentMethod, T as CheckoutPreview, U as CheckoutResult, V as CheckoutSettings, W as CookieConsentInput, X as CourseAttachment, Y as CourseCertificate, Z as CourseComment, _ as CourseCommentReply, $ as CourseCommentsList, a0 as CourseDetail, a1 as CourseLesson, a2 as CourseListItem, a3 as CourseModule, a4 as CoursePostedComment, a5 as CourseProgress, a6 as CourseTutorMessage, a7 as CourseTutorThread, a8 as CrossSellItem, a9 as CurrencyDisplayFormat, aa as CustomerAddress, ab as CustomerProfile, ac as DigitalDownload, ad as DownloadUrl, ae as Facet, af as FacetAvailability, ag as FacetCategory, ah as FacetLabel, ai as FacetPriceRange, aj as FacetRange, ak as FacetRatingBucket, al as FacetValue, am as FacetsResponse, an as FilterField, ao as FulfillmentStatus, ap as FulfillmentStatuses, aq as GiftCardBalance, ar as GiftCardPurchaseInput, as as GiftCardPurchaseResult, at as GiftCardSummary, au as LessonNote, av as LessonQuiz, aw as LoginInput, ax as LoyaltyBalance, ay as LoyaltyNextTier, az as LoyaltyProgram, aA as LoyaltySummary, aB as LoyaltyTier, aC as LoyaltyTierPerks, aD as LoyaltyTransaction, aE as Menu, aF as MenuItem, aG as MenuItemRef, aH as MenuItemType, aI as MessageResponse, aJ as NewsletterOptInDefault, aK as NewsletterSubscribeInput, aL as NewsletterSubscribeResult, aM as NewsletterUnsubscribeResult, aN as OrderAccessRequestResponse, aO as OrderAccessVerifyResponse, aP as OrderDetail, aQ as OrderItem, aR as OrderListItem, aS as OrderStatus, aT as OrderStatusHistory, aU as OrderStatuses, aV as OrderTracking, aW as Page, aX as PageAttachment, aY as PageDetail, aZ as PaginatedResponse, a_ as PaymentInstrument, a$ as PaymentStatus, b0 as PaymentStatuses, b1 as PaymentSwift, b2 as PickupPoint, b3 as PickupPointHours, b4 as PickupPointsInput, b5 as PickupWidgetConfig, b6 as PriceDisplay, b7 as ProductAssetGroup, b8 as ProductAssetItem, b9 as ProductAvailability, ba as ProductGroup, bb as ProductLabel, bc as ProductListItem, bd as ProductMedia, be as ProductMediaVariant, bf as ProductParameter, bg as ProductParameterGroup, bh as ProductParametersResponse, bi as ProductPrice, bj as ProductPromotionSummary, bk as ProductReview, bl as ProductReviewsResponse, bm as ProductSibling, bn as ProductSort, bo as ProductSortValue, bp as ProductVolumePrice, bq as ProductsQuery, br as QuizAnswerInput, bs as QuizAnswerResult, bt as QuizQuestion, bu as QuizResult, bv as QuoteItem, bw as QuoteRequest, bx as RegisterInput, by as RegisterResult, bz as RequestInterceptor, bA as RequestInterceptorConfig, bB as ResponseInterceptor, bC as ResponseInterceptorData, bD as ReturnRequest, bE as ReturnRequestItem, bF as ReturnStatus, bG as ReturnStatusItem, bH as ReturnableOrder, bI as ReturnableOrderItem, bJ as SdkError, bK as ShippingMethodSummary, bL as ShippingQuote, bM as ShippingQuoteInput, bN as ShopAppearance, bO as ShopInfo, bP as ShopScript, bQ as ShopScriptPlacement, bR as ShopScriptType, bS as ShopScripts, bT as ShopSeo, bU as ShopSeoIdentity, bV as SiteFormField, bW as SiteFormFieldOption, bX as SiteFormFieldType, bY as Sitemap, bZ as SitemapEntry, b_ as StockBehavior, b$ as StockMode, c0 as StorefrontForm, c1 as StorefrontFormFieldErrorCode, c2 as StorefrontFormFile, c3 as StorefrontFormSettings, c4 as StorefrontFormSubmitInput, c5 as StorefrontFormSubmitResult, c6 as StorefrontFormUpload, c7 as SubmitQuoteInput, c8 as SubmitReturnInput, c9 as SubmitReviewInput, ca as Subscription, cb as SubscriptionAction, cc as SubscriptionFrequency, cd as SubscriptionItem, ce as SubscriptionStatus, cf as TaxBreakdownLine, cg as VariantAxis, ch as VariantAxisValue, ci as WishlistItem, cj as err, ck as ok, cl as publishCartSummary, cm as toSdkError } from './client-CDpkw2Qv.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
var _chunkB6LU56ECjs = require('./chunk-B6LU56EC.js');
|
|
14
15
|
|
|
15
16
|
// src/react/utils/format-price.ts
|
|
16
17
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -948,7 +949,7 @@ var GENERIC = {
|
|
|
948
949
|
en: "Something went wrong, please try again."
|
|
949
950
|
};
|
|
950
951
|
function bodyOf(err2) {
|
|
951
|
-
const body = err2 instanceof
|
|
952
|
+
const body = err2 instanceof _chunkB6LU56ECjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
|
|
952
953
|
return body && typeof body === "object" ? body : null;
|
|
953
954
|
}
|
|
954
955
|
function errorCode(err2) {
|
|
@@ -1060,4 +1061,5 @@ function formFieldErrors(err2) {
|
|
|
1060
1061
|
|
|
1061
1062
|
|
|
1062
1063
|
|
|
1063
|
-
|
|
1064
|
+
|
|
1065
|
+
exports.AddressTypes = _chunkB6LU56ECjs.AddressTypes; exports.BehioApiError = _chunkB6LU56ECjs.BehioApiError; exports.BehioNetworkError = _chunkB6LU56ECjs.BehioNetworkError; exports.BehioStorefront = _chunkB6LU56ECjs.BehioStorefront; exports.FulfillmentStatuses = _chunkB6LU56ECjs.FulfillmentStatuses; exports.OrderStatuses = _chunkB6LU56ECjs.OrderStatuses; exports.PaymentStatuses = _chunkB6LU56ECjs.PaymentStatuses; exports.ProductSort = _chunkB6LU56ECjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkB6LU56ECjs.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkB6LU56ECjs.ok; exports.publishCartSummary = _chunkB6LU56ECjs.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkB6LU56ECjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
|
package/dist/index.mjs
CHANGED
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
ProductSort,
|
|
10
10
|
err,
|
|
11
11
|
ok,
|
|
12
|
+
publishCartSummary,
|
|
12
13
|
toSdkError
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-ET7SLTHN.mjs";
|
|
14
15
|
|
|
15
16
|
// src/react/utils/format-price.ts
|
|
16
17
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -1053,6 +1054,7 @@ export {
|
|
|
1053
1054
|
getStoredVisitorId,
|
|
1054
1055
|
grantAnalyticsConsent,
|
|
1055
1056
|
ok,
|
|
1057
|
+
publishCartSummary,
|
|
1056
1058
|
resolveVariantContent,
|
|
1057
1059
|
revokeAnalyticsConsent,
|
|
1058
1060
|
toSdkError,
|
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-CDpkw2Qv.mjs';
|
|
2
2
|
|
|
3
3
|
interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
|
|
4
4
|
/** Override the cart session cookie name (default: "behio_cart_session"). */
|
package/dist/next.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { p as BehioStorefrontConfig, B as BehioStorefront } from './client-CDpkw2Qv.js';
|
|
2
2
|
|
|
3
3
|
interface GetBehioOptions extends Partial<BehioStorefrontConfig> {
|
|
4
4
|
/** Override the cart session cookie name (default: "behio_cart_session"). */
|
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 _chunkB6LU56ECjs = require('./chunk-B6LU56EC.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, _chunkB6LU56ECjs.BehioStorefront)({
|
|
23
23
|
apiKey,
|
|
24
24
|
...baseUrl ? { baseUrl } : {},
|
|
25
25
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.js
CHANGED
|
@@ -2183,22 +2183,28 @@ var NewsletterModule = class {
|
|
|
2183
2183
|
);
|
|
2184
2184
|
}
|
|
2185
2185
|
};
|
|
2186
|
-
function
|
|
2186
|
+
function publishCartSummary(summary) {
|
|
2187
2187
|
if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
|
|
2188
|
+
if (!Number.isFinite(summary.total) || !Number.isFinite(summary.itemCount)) return;
|
|
2189
|
+
const detail = { total: summary.total, currency: summary.currency ?? null, itemCount: summary.itemCount };
|
|
2190
|
+
try {
|
|
2191
|
+
window.__behioCart = detail;
|
|
2192
|
+
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2193
|
+
} catch {
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
function emitCartEvent(data) {
|
|
2197
|
+
if (typeof window === "undefined") return;
|
|
2188
2198
|
const cart = data;
|
|
2189
2199
|
if (!cart || typeof cart !== "object" || !Array.isArray(cart.items)) return;
|
|
2200
|
+
if (cart.totalsAvailable === false) return;
|
|
2190
2201
|
const items = cart.items;
|
|
2191
2202
|
const total = typeof cart.grandTotal === "number" ? cart.grandTotal : typeof cart.subtotal === "number" ? cart.subtotal : 0;
|
|
2192
|
-
|
|
2203
|
+
publishCartSummary({
|
|
2193
2204
|
total,
|
|
2194
2205
|
currency: typeof cart.currency === "string" ? cart.currency : null,
|
|
2195
2206
|
itemCount: items.reduce((n, i) => n + (typeof i?.quantity === "number" ? i.quantity : 1), 0)
|
|
2196
|
-
};
|
|
2197
|
-
try {
|
|
2198
|
-
window.__behioCart = detail;
|
|
2199
|
-
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2200
|
-
} catch {
|
|
2201
|
-
}
|
|
2207
|
+
});
|
|
2202
2208
|
}
|
|
2203
2209
|
|
|
2204
2210
|
// src/react/context.ts
|
package/dist/react.mjs
CHANGED
|
@@ -2073,22 +2073,28 @@ var NewsletterModule = class {
|
|
|
2073
2073
|
);
|
|
2074
2074
|
}
|
|
2075
2075
|
};
|
|
2076
|
-
function
|
|
2076
|
+
function publishCartSummary(summary) {
|
|
2077
2077
|
if (typeof window === "undefined" || typeof window.dispatchEvent !== "function") return;
|
|
2078
|
+
if (!Number.isFinite(summary.total) || !Number.isFinite(summary.itemCount)) return;
|
|
2079
|
+
const detail = { total: summary.total, currency: summary.currency ?? null, itemCount: summary.itemCount };
|
|
2080
|
+
try {
|
|
2081
|
+
window.__behioCart = detail;
|
|
2082
|
+
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2083
|
+
} catch {
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
function emitCartEvent(data) {
|
|
2087
|
+
if (typeof window === "undefined") return;
|
|
2078
2088
|
const cart = data;
|
|
2079
2089
|
if (!cart || typeof cart !== "object" || !Array.isArray(cart.items)) return;
|
|
2090
|
+
if (cart.totalsAvailable === false) return;
|
|
2080
2091
|
const items = cart.items;
|
|
2081
2092
|
const total = typeof cart.grandTotal === "number" ? cart.grandTotal : typeof cart.subtotal === "number" ? cart.subtotal : 0;
|
|
2082
|
-
|
|
2093
|
+
publishCartSummary({
|
|
2083
2094
|
total,
|
|
2084
2095
|
currency: typeof cart.currency === "string" ? cart.currency : null,
|
|
2085
2096
|
itemCount: items.reduce((n, i) => n + (typeof i?.quantity === "number" ? i.quantity : 1), 0)
|
|
2086
|
-
};
|
|
2087
|
-
try {
|
|
2088
|
-
window.__behioCart = detail;
|
|
2089
|
-
window.dispatchEvent(new CustomEvent("behio:cart", { detail }));
|
|
2090
|
-
} catch {
|
|
2091
|
-
}
|
|
2097
|
+
});
|
|
2092
2098
|
}
|
|
2093
2099
|
|
|
2094
2100
|
// src/react/context.ts
|