@behio/storefront-sdk 1.6.0 → 1.8.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-TOSF3K7J.mjs → chunk-LA6K4KYS.mjs} +12 -0
- package/dist/{chunk-TJ4TZ5FI.js → chunk-LQ4GGXMJ.js} +12 -0
- package/dist/{client-B9jHeWca.d.mts → client-BP9n3a_D.d.mts} +69 -1
- package/dist/{client-B9jHeWca.d.ts → client-BP9n3a_D.d.ts} +69 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +68 -0
- package/dist/react.d.ts +68 -0
- package/dist/react.js +12 -0
- package/dist/react.mjs +12 -0
- package/package.json +1 -1
|
@@ -116,6 +116,11 @@ function toSdkError(err2) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// src/client.ts
|
|
119
|
+
function isAvailabilityFailure(err2) {
|
|
120
|
+
if (err2 instanceof BehioNetworkError) return true;
|
|
121
|
+
if (err2 instanceof BehioApiError) return err2.isRetryable;
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
119
124
|
var BehioStorefront = class {
|
|
120
125
|
constructor(config) {
|
|
121
126
|
/** Consent-gated persistent visitor id — set by the analytics tracker. */
|
|
@@ -144,6 +149,7 @@ var BehioStorefront = class {
|
|
|
144
149
|
this.retries = config.retries ?? 1;
|
|
145
150
|
this.retryDelay = config.retryDelay ?? 1e3;
|
|
146
151
|
this.visitorIp = config.visitorIp;
|
|
152
|
+
this.throwOnAvailabilityError = config.throwOnAvailabilityError ?? false;
|
|
147
153
|
this.catalog = new CatalogModule(this);
|
|
148
154
|
this.auth = new AuthModule(this);
|
|
149
155
|
this.cart = new CartModule(this);
|
|
@@ -374,6 +380,9 @@ var BehioStorefront = class {
|
|
|
374
380
|
const data = await this.rawRequest(method, path, options);
|
|
375
381
|
return ok(data);
|
|
376
382
|
} catch (err2) {
|
|
383
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err2)) {
|
|
384
|
+
throw err2;
|
|
385
|
+
}
|
|
377
386
|
return { data: null, error: toSdkError(err2) };
|
|
378
387
|
}
|
|
379
388
|
}
|
|
@@ -401,6 +410,9 @@ var BehioStorefront = class {
|
|
|
401
410
|
}
|
|
402
411
|
return ok(await res.blob());
|
|
403
412
|
} catch (err2) {
|
|
413
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err2)) {
|
|
414
|
+
throw err2;
|
|
415
|
+
}
|
|
404
416
|
return { data: null, error: toSdkError(err2) };
|
|
405
417
|
}
|
|
406
418
|
}
|
|
@@ -116,6 +116,11 @@ function toSdkError(err2) {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
// src/client.ts
|
|
119
|
+
function isAvailabilityFailure(err2) {
|
|
120
|
+
if (err2 instanceof BehioNetworkError) return true;
|
|
121
|
+
if (err2 instanceof BehioApiError) return err2.isRetryable;
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
119
124
|
var BehioStorefront = class {
|
|
120
125
|
constructor(config) {
|
|
121
126
|
/** Consent-gated persistent visitor id — set by the analytics tracker. */
|
|
@@ -144,6 +149,7 @@ var BehioStorefront = class {
|
|
|
144
149
|
this.retries = _nullishCoalesce(config.retries, () => ( 1));
|
|
145
150
|
this.retryDelay = _nullishCoalesce(config.retryDelay, () => ( 1e3));
|
|
146
151
|
this.visitorIp = config.visitorIp;
|
|
152
|
+
this.throwOnAvailabilityError = _nullishCoalesce(config.throwOnAvailabilityError, () => ( false));
|
|
147
153
|
this.catalog = new CatalogModule(this);
|
|
148
154
|
this.auth = new AuthModule(this);
|
|
149
155
|
this.cart = new CartModule(this);
|
|
@@ -374,6 +380,9 @@ var BehioStorefront = class {
|
|
|
374
380
|
const data = await this.rawRequest(method, path, options);
|
|
375
381
|
return ok(data);
|
|
376
382
|
} catch (err2) {
|
|
383
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err2)) {
|
|
384
|
+
throw err2;
|
|
385
|
+
}
|
|
377
386
|
return { data: null, error: toSdkError(err2) };
|
|
378
387
|
}
|
|
379
388
|
}
|
|
@@ -401,6 +410,9 @@ var BehioStorefront = class {
|
|
|
401
410
|
}
|
|
402
411
|
return ok(await res.blob());
|
|
403
412
|
} catch (err2) {
|
|
413
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err2)) {
|
|
414
|
+
throw err2;
|
|
415
|
+
}
|
|
404
416
|
return { data: null, error: toSdkError(err2) };
|
|
405
417
|
}
|
|
406
418
|
}
|
|
@@ -29,6 +29,19 @@ interface BehioStorefrontConfig {
|
|
|
29
29
|
* automatically from the incoming request headers.
|
|
30
30
|
*/
|
|
31
31
|
visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
|
|
32
|
+
/**
|
|
33
|
+
* Throw availability failures (429, 5xx, network, timeout) instead of
|
|
34
|
+
* returning them as `SdkResult.error`. Business outcomes (400, 401, 404,
|
|
35
|
+
* 409, …) keep the tuple shape either way.
|
|
36
|
+
*
|
|
37
|
+
* Why this exists: a storefront section that reads `result.data ?? []`
|
|
38
|
+
* silently renders an EMPTY catalog when the API is rate-limited or down,
|
|
39
|
+
* which looks exactly like a shop with no products. With this flag the
|
|
40
|
+
* failure surfaces as an exception, so SSR/ISR keeps the last good page and
|
|
41
|
+
* the visitor gets an error boundary instead of a lying page. Recommended
|
|
42
|
+
* `true` for every server-rendered catalog client.
|
|
43
|
+
*/
|
|
44
|
+
throwOnAvailabilityError?: boolean;
|
|
32
45
|
/** Request timeout in milliseconds. Default: 30000 (30s) */
|
|
33
46
|
timeout?: number;
|
|
34
47
|
/** Number of retries on network/5xx errors. Default: 1 */
|
|
@@ -644,6 +657,50 @@ interface ProductParameterGroup {
|
|
|
644
657
|
interface ProductParametersResponse {
|
|
645
658
|
groups: ProductParameterGroup[];
|
|
646
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* One item of a product asset group: an image, a hosted video, a downloadable
|
|
662
|
+
* file, or an external video embed. Added in SDK 1.7.0.
|
|
663
|
+
*
|
|
664
|
+
* `kind` decides how to render it:
|
|
665
|
+
* - `IMAGE` / `VIDEO` / `FILE`: a file hosted on the Behio CDN (`url` is a
|
|
666
|
+
* direct file URL; `contentType` and `size` describe it).
|
|
667
|
+
* - `EXTERNAL_VIDEO`: an embed URL (YouTube/Vimeo). Render it in an
|
|
668
|
+
* `<iframe>`, never in a `<video>` tag. `size` is null.
|
|
669
|
+
*/
|
|
670
|
+
interface ProductAssetItem {
|
|
671
|
+
id: string;
|
|
672
|
+
kind: "IMAGE" | "VIDEO" | "FILE" | "EXTERNAL_VIDEO";
|
|
673
|
+
url: string;
|
|
674
|
+
/** MIME type ("video/mp4", "application/pdf"); null when unknown or external. */
|
|
675
|
+
contentType?: string | null;
|
|
676
|
+
/** File size in bytes; null for external videos. */
|
|
677
|
+
size?: number | null;
|
|
678
|
+
/** Merchant title in the requested locale, or null when none was written. */
|
|
679
|
+
title?: string | null;
|
|
680
|
+
description?: string | null;
|
|
681
|
+
order: number;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* A merchant-named group of extra product content ("videos", "downloads").
|
|
685
|
+
* Groups only exist while they have items, so empty groups are never emitted.
|
|
686
|
+
* Added in SDK 1.7.0.
|
|
687
|
+
*
|
|
688
|
+
* Example: render a video section from the "videos" group:
|
|
689
|
+
* ```tsx
|
|
690
|
+
* const videos = product.assetGroups.find((g) => g.group === "videos");
|
|
691
|
+
* videos?.items.map((v) =>
|
|
692
|
+
* v.kind === "EXTERNAL_VIDEO"
|
|
693
|
+
* ? <iframe key={v.id} src={v.url} title={v.title ?? undefined} allowFullScreen />
|
|
694
|
+
* : <video key={v.id} controls preload="metadata" src={v.url} />
|
|
695
|
+
* );
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
interface ProductAssetGroup {
|
|
699
|
+
/** Merchant-named group slug ("videos", "downloads"). */
|
|
700
|
+
group: string;
|
|
701
|
+
/** Items sorted by `order`. */
|
|
702
|
+
items: ProductAssetItem[];
|
|
703
|
+
}
|
|
647
704
|
interface ProductDetail extends ProductListItem {
|
|
648
705
|
longDescription?: string;
|
|
649
706
|
/**
|
|
@@ -686,6 +743,16 @@ interface ProductDetail extends ProductListItem {
|
|
|
686
743
|
* data groups, which published internal bookkeeping nobody curated.
|
|
687
744
|
*/
|
|
688
745
|
parameterGroups: ProductParameterGroup[];
|
|
746
|
+
/**
|
|
747
|
+
* Merchant-curated extra content in named groups ("videos", "downloads"):
|
|
748
|
+
* images, videos, files and external video embeds attached to the product.
|
|
749
|
+
* Distinct from `images` (roled gallery) and `media` (inventory gallery).
|
|
750
|
+
* Empty array when the merchant attached nothing. Added in SDK 1.7.0.
|
|
751
|
+
*
|
|
752
|
+
* Videos: `kind === "EXTERNAL_VIDEO"` is an embed URL (YouTube/Vimeo) for an
|
|
753
|
+
* `<iframe>`; `kind === "VIDEO"` is a CDN-hosted file for a `<video>` tag.
|
|
754
|
+
*/
|
|
755
|
+
assetGroups: ProductAssetGroup[];
|
|
689
756
|
seo: {
|
|
690
757
|
/**
|
|
691
758
|
* Slug of the page that should be canonical INSTEAD of this one. Empty
|
|
@@ -2280,6 +2347,7 @@ declare class BehioStorefront {
|
|
|
2280
2347
|
private rateLimitRemaining;
|
|
2281
2348
|
private rateLimitReset;
|
|
2282
2349
|
private visitorIp?;
|
|
2350
|
+
private throwOnAvailabilityError;
|
|
2283
2351
|
constructor(config: BehioStorefrontConfig);
|
|
2284
2352
|
readonly catalog: CatalogModule;
|
|
2285
2353
|
readonly auth: AuthModule;
|
|
@@ -3043,4 +3111,4 @@ declare class NewsletterModule {
|
|
|
3043
3111
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3044
3112
|
}
|
|
3045
3113
|
|
|
3046
|
-
export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type
|
|
3114
|
+
export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParameter as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAssetGroup as aT, type ProductAssetItem as aU, type ProductAvailability as aV, type ProductGroup as aW, type ProductLabel as aX, type ProductListItem as aY, type ProductMedia as aZ, type ProductMediaVariant as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductParameterGroup as b0, type ProductParametersResponse as b1, type ProductPrice as b2, type ProductPromotionSummary as b3, type ProductReview as b4, type ProductReviewsResponse as b5, type ProductSibling as b6, ProductSort as b7, type ProductSortValue as b8, type ProductVolumePrice as b9, type ShopScriptType as bA, type ShopScripts as bB, type ShopSeo as bC, type ShopSeoIdentity as bD, type Sitemap as bE, type SitemapEntry as bF, type StockBehavior as bG, type StockMode as bH, type SubmitQuoteInput as bI, type SubmitReturnInput as bJ, type SubmitReviewInput as bK, type Subscription as bL, type SubscriptionAction as bM, type SubscriptionFrequency as bN, type SubscriptionItem as bO, type SubscriptionStatus as bP, type TaxBreakdownLine as bQ, type VariantAxis as bR, type VariantAxisValue as bS, type WishlistItem as bT, err as bU, ok as bV, toSdkError as bW, type ProductsQuery as ba, type QuizAnswerInput as bb, type QuizAnswerResult as bc, type QuizQuestion as bd, type QuizResult as be, type QuoteItem as bf, type QuoteRequest as bg, type RegisterInput as bh, type RegisterResult as bi, type RequestInterceptor as bj, type RequestInterceptorConfig as bk, type ResponseInterceptor as bl, type ResponseInterceptorData as bm, type ReturnRequest as bn, type ReturnRequestItem as bo, type ReturnStatus as bp, type ReturnStatusItem as bq, type ReturnableOrder as br, type ReturnableOrderItem as bs, type SdkError as bt, type ShippingMethodSummary as bu, type ShippingQuote as bv, type ShippingQuoteInput as bw, type ShopInfo as bx, type ShopScript as by, type ShopScriptPlacement as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail as z };
|
|
@@ -29,6 +29,19 @@ interface BehioStorefrontConfig {
|
|
|
29
29
|
* automatically from the incoming request headers.
|
|
30
30
|
*/
|
|
31
31
|
visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
|
|
32
|
+
/**
|
|
33
|
+
* Throw availability failures (429, 5xx, network, timeout) instead of
|
|
34
|
+
* returning them as `SdkResult.error`. Business outcomes (400, 401, 404,
|
|
35
|
+
* 409, …) keep the tuple shape either way.
|
|
36
|
+
*
|
|
37
|
+
* Why this exists: a storefront section that reads `result.data ?? []`
|
|
38
|
+
* silently renders an EMPTY catalog when the API is rate-limited or down,
|
|
39
|
+
* which looks exactly like a shop with no products. With this flag the
|
|
40
|
+
* failure surfaces as an exception, so SSR/ISR keeps the last good page and
|
|
41
|
+
* the visitor gets an error boundary instead of a lying page. Recommended
|
|
42
|
+
* `true` for every server-rendered catalog client.
|
|
43
|
+
*/
|
|
44
|
+
throwOnAvailabilityError?: boolean;
|
|
32
45
|
/** Request timeout in milliseconds. Default: 30000 (30s) */
|
|
33
46
|
timeout?: number;
|
|
34
47
|
/** Number of retries on network/5xx errors. Default: 1 */
|
|
@@ -644,6 +657,50 @@ interface ProductParameterGroup {
|
|
|
644
657
|
interface ProductParametersResponse {
|
|
645
658
|
groups: ProductParameterGroup[];
|
|
646
659
|
}
|
|
660
|
+
/**
|
|
661
|
+
* One item of a product asset group: an image, a hosted video, a downloadable
|
|
662
|
+
* file, or an external video embed. Added in SDK 1.7.0.
|
|
663
|
+
*
|
|
664
|
+
* `kind` decides how to render it:
|
|
665
|
+
* - `IMAGE` / `VIDEO` / `FILE`: a file hosted on the Behio CDN (`url` is a
|
|
666
|
+
* direct file URL; `contentType` and `size` describe it).
|
|
667
|
+
* - `EXTERNAL_VIDEO`: an embed URL (YouTube/Vimeo). Render it in an
|
|
668
|
+
* `<iframe>`, never in a `<video>` tag. `size` is null.
|
|
669
|
+
*/
|
|
670
|
+
interface ProductAssetItem {
|
|
671
|
+
id: string;
|
|
672
|
+
kind: "IMAGE" | "VIDEO" | "FILE" | "EXTERNAL_VIDEO";
|
|
673
|
+
url: string;
|
|
674
|
+
/** MIME type ("video/mp4", "application/pdf"); null when unknown or external. */
|
|
675
|
+
contentType?: string | null;
|
|
676
|
+
/** File size in bytes; null for external videos. */
|
|
677
|
+
size?: number | null;
|
|
678
|
+
/** Merchant title in the requested locale, or null when none was written. */
|
|
679
|
+
title?: string | null;
|
|
680
|
+
description?: string | null;
|
|
681
|
+
order: number;
|
|
682
|
+
}
|
|
683
|
+
/**
|
|
684
|
+
* A merchant-named group of extra product content ("videos", "downloads").
|
|
685
|
+
* Groups only exist while they have items, so empty groups are never emitted.
|
|
686
|
+
* Added in SDK 1.7.0.
|
|
687
|
+
*
|
|
688
|
+
* Example: render a video section from the "videos" group:
|
|
689
|
+
* ```tsx
|
|
690
|
+
* const videos = product.assetGroups.find((g) => g.group === "videos");
|
|
691
|
+
* videos?.items.map((v) =>
|
|
692
|
+
* v.kind === "EXTERNAL_VIDEO"
|
|
693
|
+
* ? <iframe key={v.id} src={v.url} title={v.title ?? undefined} allowFullScreen />
|
|
694
|
+
* : <video key={v.id} controls preload="metadata" src={v.url} />
|
|
695
|
+
* );
|
|
696
|
+
* ```
|
|
697
|
+
*/
|
|
698
|
+
interface ProductAssetGroup {
|
|
699
|
+
/** Merchant-named group slug ("videos", "downloads"). */
|
|
700
|
+
group: string;
|
|
701
|
+
/** Items sorted by `order`. */
|
|
702
|
+
items: ProductAssetItem[];
|
|
703
|
+
}
|
|
647
704
|
interface ProductDetail extends ProductListItem {
|
|
648
705
|
longDescription?: string;
|
|
649
706
|
/**
|
|
@@ -686,6 +743,16 @@ interface ProductDetail extends ProductListItem {
|
|
|
686
743
|
* data groups, which published internal bookkeeping nobody curated.
|
|
687
744
|
*/
|
|
688
745
|
parameterGroups: ProductParameterGroup[];
|
|
746
|
+
/**
|
|
747
|
+
* Merchant-curated extra content in named groups ("videos", "downloads"):
|
|
748
|
+
* images, videos, files and external video embeds attached to the product.
|
|
749
|
+
* Distinct from `images` (roled gallery) and `media` (inventory gallery).
|
|
750
|
+
* Empty array when the merchant attached nothing. Added in SDK 1.7.0.
|
|
751
|
+
*
|
|
752
|
+
* Videos: `kind === "EXTERNAL_VIDEO"` is an embed URL (YouTube/Vimeo) for an
|
|
753
|
+
* `<iframe>`; `kind === "VIDEO"` is a CDN-hosted file for a `<video>` tag.
|
|
754
|
+
*/
|
|
755
|
+
assetGroups: ProductAssetGroup[];
|
|
689
756
|
seo: {
|
|
690
757
|
/**
|
|
691
758
|
* Slug of the page that should be canonical INSTEAD of this one. Empty
|
|
@@ -2280,6 +2347,7 @@ declare class BehioStorefront {
|
|
|
2280
2347
|
private rateLimitRemaining;
|
|
2281
2348
|
private rateLimitReset;
|
|
2282
2349
|
private visitorIp?;
|
|
2350
|
+
private throwOnAvailabilityError;
|
|
2283
2351
|
constructor(config: BehioStorefrontConfig);
|
|
2284
2352
|
readonly catalog: CatalogModule;
|
|
2285
2353
|
readonly auth: AuthModule;
|
|
@@ -3043,4 +3111,4 @@ declare class NewsletterModule {
|
|
|
3043
3111
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
3044
3112
|
}
|
|
3045
3113
|
|
|
3046
|
-
export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type
|
|
3114
|
+
export { type DigitalDownload as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type CertificateVerification as D, type CheckoutAddress as E, type CheckoutInput as F, type CheckoutPaymentMethod as G, type CheckoutSettings as H, type CookieConsentInput as I, type CourseAttachment as J, type CourseCertificate as K, type CourseComment as L, type CourseCommentReply as M, type CourseCommentsList as N, type CourseDetail as O, type ProductDetail as P, type CourseLesson as Q, type CourseListItem as R, type SdkResult as S, type CourseModule as T, type CoursePostedComment as U, type CourseProgress as V, type CourseTutorMessage as W, type CourseTutorThread as X, type CrossSellItem as Y, type CustomerAddress as Z, type CustomerProfile as _, type ProductVariant as a, type ProductParameter as a$, type DownloadUrl as a0, type Facet as a1, type FacetAvailability as a2, type FacetCategory as a3, type FacetLabel as a4, type FacetPriceRange as a5, type FacetRange as a6, type FacetRatingBucket as a7, type FacetValue as a8, type FacetsResponse as a9, type OrderAccessRequestResponse as aA, type OrderAccessVerifyResponse as aB, type OrderDetail as aC, type OrderItem as aD, type OrderListItem as aE, type OrderStatus as aF, type OrderStatusHistory as aG, OrderStatuses as aH, type OrderTracking as aI, type Page as aJ, type PageAttachment as aK, type PageDetail as aL, type PaginatedResponse as aM, type PaymentStatus as aN, PaymentStatuses as aO, type PickupPoint as aP, type PickupPointHours as aQ, type PickupPointsInput as aR, type PriceDisplay as aS, type ProductAssetGroup as aT, type ProductAssetItem as aU, type ProductAvailability as aV, type ProductGroup as aW, type ProductLabel as aX, type ProductListItem as aY, type ProductMedia as aZ, type ProductMediaVariant as a_, type FilterField as aa, type FulfillmentStatus as ab, FulfillmentStatuses as ac, type GiftCardBalance as ad, type GiftCardPurchaseInput as ae, type GiftCardPurchaseResult as af, type GiftCardSummary as ag, type LessonNote as ah, type LessonQuiz as ai, type LoginInput as aj, type LoyaltyBalance as ak, type LoyaltyNextTier as al, type LoyaltyProgram as am, type LoyaltySummary as an, type LoyaltyTier as ao, type LoyaltyTierPerks as ap, type LoyaltyTransaction as aq, type Menu as ar, type MenuItem as as, type MenuItemRef as at, type MenuItemType as au, type MessageResponse as av, type NewsletterOptInDefault as aw, type NewsletterSubscribeInput as ax, type NewsletterSubscribeResult as ay, type NewsletterUnsubscribeResult as az, type AddToCartInput as b, type ProductParameterGroup as b0, type ProductParametersResponse as b1, type ProductPrice as b2, type ProductPromotionSummary as b3, type ProductReview as b4, type ProductReviewsResponse as b5, type ProductSibling as b6, ProductSort as b7, type ProductSortValue as b8, type ProductVolumePrice as b9, type ShopScriptType as bA, type ShopScripts as bB, type ShopSeo as bC, type ShopSeoIdentity as bD, type Sitemap as bE, type SitemapEntry as bF, type StockBehavior as bG, type StockMode as bH, type SubmitQuoteInput as bI, type SubmitReturnInput as bJ, type SubmitReviewInput as bK, type Subscription as bL, type SubscriptionAction as bM, type SubscriptionFrequency as bN, type SubscriptionItem as bO, type SubscriptionStatus as bP, type TaxBreakdownLine as bQ, type VariantAxis as bR, type VariantAxisValue as bS, type WishlistItem as bT, err as bU, ok as bV, toSdkError as bW, type ProductsQuery as ba, type QuizAnswerInput as bb, type QuizAnswerResult as bc, type QuizQuestion as bd, type QuizResult as be, type QuoteItem as bf, type QuoteRequest as bg, type RegisterInput as bh, type RegisterResult as bi, type RequestInterceptor as bj, type RequestInterceptorConfig as bk, type ResponseInterceptor as bl, type ResponseInterceptorData as bm, type ReturnRequest as bn, type ReturnRequestItem as bo, type ReturnStatus as bp, type ReturnStatusItem as bq, type ReturnableOrder as br, type ReturnableOrderItem as bs, type SdkError as bt, type ShippingMethodSummary as bu, type ShippingQuote as bv, type ShippingQuoteInput as bw, type ShopInfo as bx, type ShopScript as by, type ShopScriptPlacement as bz, type AddressDetail as c, type AddressSuggestion as d, type AddressType as e, AddressTypes as f, type AuthTokens as g, type BackInStockSubscription as h, type BadgeTone as i, BehioApiError as j, type BehioErrorCode as k, type BehioEventHandler as l, type BehioEventType as m, BehioNetworkError as n, type BehioStorefrontConfig as o, type Bundle as p, type BundleItem as q, type Cart as r, type CartBundleLine as s, type CartBundleLineItem as t, type CartDiscount as u, type CartItem as v, type CartItemProduct as w, type CartPromotion as x, type Category as y, type CategoryDetail 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 } from './client-
|
|
2
|
-
export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-BP9n3a_D.mjs';
|
|
2
|
+
export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAssetGroup, aU as ProductAssetItem, aV as ProductAvailability, aW as ProductGroup, aX as ProductLabel, aY as ProductListItem, aZ as ProductMedia, a_ as ProductMediaVariant, a$ as ProductParameter, b0 as ProductParameterGroup, b1 as ProductParametersResponse, b2 as ProductPrice, b3 as ProductPromotionSummary, b4 as ProductReview, b5 as ProductReviewsResponse, b6 as ProductSibling, b7 as ProductSort, b8 as ProductSortValue, b9 as ProductVolumePrice, ba as ProductsQuery, bb as QuizAnswerInput, bc as QuizAnswerResult, bd as QuizQuestion, be as QuizResult, bf as QuoteItem, bg as QuoteRequest, bh as RegisterInput, bi as RegisterResult, bj as RequestInterceptor, bk as RequestInterceptorConfig, bl as ResponseInterceptor, bm as ResponseInterceptorData, bn as ReturnRequest, bo as ReturnRequestItem, bp as ReturnStatus, bq as ReturnStatusItem, br as ReturnableOrder, bs as ReturnableOrderItem, bt as SdkError, bu as ShippingMethodSummary, bv as ShippingQuote, bw as ShippingQuoteInput, bx as ShopInfo, by as ShopScript, bz as ShopScriptPlacement, bA as ShopScriptType, bB as ShopScripts, bC as ShopSeo, bD as ShopSeoIdentity, bE as Sitemap, bF as SitemapEntry, bG as StockBehavior, bH as StockMode, bI as SubmitQuoteInput, bJ as SubmitReturnInput, bK as SubmitReviewInput, bL as Subscription, bM as SubscriptionAction, bN as SubscriptionFrequency, bO as SubscriptionItem, bP as SubscriptionStatus, bQ as TaxBreakdownLine, bR as VariantAxis, bS as VariantAxisValue, bT as WishlistItem, bU as err, bV as ok, bW as toSdkError } from './client-BP9n3a_D.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 } from './client-
|
|
2
|
-
export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent } from './client-BP9n3a_D.js';
|
|
2
|
+
export { A as ActivePromotion, b as AddToCartInput, c as AddressDetail, d as AddressSuggestion, e as AddressType, f as AddressTypes, g as AuthTokens, h as BackInStockSubscription, i as BadgeTone, j as BehioApiError, k as BehioErrorCode, l as BehioEventHandler, m as BehioEventType, n as BehioNetworkError, o as BehioStorefrontConfig, p as Bundle, q as BundleItem, r as Cart, s as CartBundleLine, t as CartBundleLineItem, u as CartDiscount, v as CartItem, w as CartItemProduct, x as CartPromotion, y as Category, z as CategoryDetail, D as CertificateVerification, E as CheckoutAddress, F as CheckoutInput, G as CheckoutPaymentMethod, H as CheckoutSettings, I as CookieConsentInput, J as CourseAttachment, K as CourseCertificate, L as CourseComment, M as CourseCommentReply, N as CourseCommentsList, O as CourseDetail, Q as CourseLesson, R as CourseListItem, T as CourseModule, U as CoursePostedComment, V as CourseProgress, W as CourseTutorMessage, X as CourseTutorThread, Y as CrossSellItem, Z as CustomerAddress, _ as CustomerProfile, $ as DigitalDownload, a0 as DownloadUrl, a1 as Facet, a2 as FacetAvailability, a3 as FacetCategory, a4 as FacetLabel, a5 as FacetPriceRange, a6 as FacetRange, a7 as FacetRatingBucket, a8 as FacetValue, a9 as FacetsResponse, aa as FilterField, ab as FulfillmentStatus, ac as FulfillmentStatuses, ad as GiftCardBalance, ae as GiftCardPurchaseInput, af as GiftCardPurchaseResult, ag as GiftCardSummary, ah as LessonNote, ai as LessonQuiz, aj as LoginInput, ak as LoyaltyBalance, al as LoyaltyNextTier, am as LoyaltyProgram, an as LoyaltySummary, ao as LoyaltyTier, ap as LoyaltyTierPerks, aq as LoyaltyTransaction, ar as Menu, as as MenuItem, at as MenuItemRef, au as MenuItemType, av as MessageResponse, aw as NewsletterOptInDefault, ax as NewsletterSubscribeInput, ay as NewsletterSubscribeResult, az as NewsletterUnsubscribeResult, aA as OrderAccessRequestResponse, aB as OrderAccessVerifyResponse, aC as OrderDetail, aD as OrderItem, aE as OrderListItem, aF as OrderStatus, aG as OrderStatusHistory, aH as OrderStatuses, aI as OrderTracking, aJ as Page, aK as PageAttachment, aL as PageDetail, aM as PaginatedResponse, aN as PaymentStatus, aO as PaymentStatuses, aP as PickupPoint, aQ as PickupPointHours, aR as PickupPointsInput, aS as PriceDisplay, aT as ProductAssetGroup, aU as ProductAssetItem, aV as ProductAvailability, aW as ProductGroup, aX as ProductLabel, aY as ProductListItem, aZ as ProductMedia, a_ as ProductMediaVariant, a$ as ProductParameter, b0 as ProductParameterGroup, b1 as ProductParametersResponse, b2 as ProductPrice, b3 as ProductPromotionSummary, b4 as ProductReview, b5 as ProductReviewsResponse, b6 as ProductSibling, b7 as ProductSort, b8 as ProductSortValue, b9 as ProductVolumePrice, ba as ProductsQuery, bb as QuizAnswerInput, bc as QuizAnswerResult, bd as QuizQuestion, be as QuizResult, bf as QuoteItem, bg as QuoteRequest, bh as RegisterInput, bi as RegisterResult, bj as RequestInterceptor, bk as RequestInterceptorConfig, bl as ResponseInterceptor, bm as ResponseInterceptorData, bn as ReturnRequest, bo as ReturnRequestItem, bp as ReturnStatus, bq as ReturnStatusItem, br as ReturnableOrder, bs as ReturnableOrderItem, bt as SdkError, bu as ShippingMethodSummary, bv as ShippingQuote, bw as ShippingQuoteInput, bx as ShopInfo, by as ShopScript, bz as ShopScriptPlacement, bA as ShopScriptType, bB as ShopScripts, bC as ShopSeo, bD as ShopSeoIdentity, bE as Sitemap, bF as SitemapEntry, bG as StockBehavior, bH as StockMode, bI as SubmitQuoteInput, bJ as SubmitReturnInput, bK as SubmitReviewInput, bL as Subscription, bM as SubscriptionAction, bN as SubscriptionFrequency, bO as SubscriptionItem, bP as SubscriptionStatus, bQ as TaxBreakdownLine, bR as VariantAxis, bS as VariantAxisValue, bT as WishlistItem, bU as err, bV as ok, bW as toSdkError } from './client-BP9n3a_D.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkLQ4GGXMJjs = require('./chunk-LQ4GGXMJ.js');
|
|
14
14
|
|
|
15
15
|
// src/react/utils/format-price.ts
|
|
16
16
|
function formatPrice(amount, currency, locale) {
|
|
@@ -243,4 +243,4 @@ async function revokeAnalyticsConsent(client) {
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
|
|
246
|
-
exports.AddressTypes =
|
|
246
|
+
exports.AddressTypes = _chunkLQ4GGXMJjs.AddressTypes; exports.BehioApiError = _chunkLQ4GGXMJjs.BehioApiError; exports.BehioNetworkError = _chunkLQ4GGXMJjs.BehioNetworkError; exports.BehioStorefront = _chunkLQ4GGXMJjs.BehioStorefront; exports.FulfillmentStatuses = _chunkLQ4GGXMJjs.FulfillmentStatuses; exports.OrderStatuses = _chunkLQ4GGXMJjs.OrderStatuses; exports.PaymentStatuses = _chunkLQ4GGXMJjs.PaymentStatuses; exports.ProductSort = _chunkLQ4GGXMJjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkLQ4GGXMJjs.err; exports.findVariantByAttributes = findVariantByAttributes; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.ok = _chunkLQ4GGXMJjs.ok; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkLQ4GGXMJjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
|
package/dist/index.mjs
CHANGED
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-BP9n3a_D.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 { o as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { o as BehioStorefrontConfig, B as BehioStorefront } from './client-BP9n3a_D.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 _chunkLQ4GGXMJjs = require('./chunk-LQ4GGXMJ.js');
|
|
4
4
|
|
|
5
5
|
// src/next.ts
|
|
6
6
|
var _headers = require('next/headers');
|
|
@@ -18,7 +18,7 @@ async function getBehio(options = {}) {
|
|
|
18
18
|
const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
|
|
19
19
|
const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
|
|
20
20
|
const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
|
|
21
|
-
const client = new (0,
|
|
21
|
+
const client = new (0, _chunkLQ4GGXMJjs.BehioStorefront)({
|
|
22
22
|
apiKey,
|
|
23
23
|
...baseUrl ? { baseUrl } : {},
|
|
24
24
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -85,6 +85,19 @@ interface BehioStorefrontConfig {
|
|
|
85
85
|
* automatically from the incoming request headers.
|
|
86
86
|
*/
|
|
87
87
|
visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
|
|
88
|
+
/**
|
|
89
|
+
* Throw availability failures (429, 5xx, network, timeout) instead of
|
|
90
|
+
* returning them as `SdkResult.error`. Business outcomes (400, 401, 404,
|
|
91
|
+
* 409, …) keep the tuple shape either way.
|
|
92
|
+
*
|
|
93
|
+
* Why this exists: a storefront section that reads `result.data ?? []`
|
|
94
|
+
* silently renders an EMPTY catalog when the API is rate-limited or down,
|
|
95
|
+
* which looks exactly like a shop with no products. With this flag the
|
|
96
|
+
* failure surfaces as an exception, so SSR/ISR keeps the last good page and
|
|
97
|
+
* the visitor gets an error boundary instead of a lying page. Recommended
|
|
98
|
+
* `true` for every server-rendered catalog client.
|
|
99
|
+
*/
|
|
100
|
+
throwOnAvailabilityError?: boolean;
|
|
88
101
|
/** Request timeout in milliseconds. Default: 30000 (30s) */
|
|
89
102
|
timeout?: number;
|
|
90
103
|
/** Number of retries on network/5xx errors. Default: 1 */
|
|
@@ -700,6 +713,50 @@ interface ProductParameterGroup {
|
|
|
700
713
|
interface ProductParametersResponse {
|
|
701
714
|
groups: ProductParameterGroup[];
|
|
702
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* One item of a product asset group: an image, a hosted video, a downloadable
|
|
718
|
+
* file, or an external video embed. Added in SDK 1.7.0.
|
|
719
|
+
*
|
|
720
|
+
* `kind` decides how to render it:
|
|
721
|
+
* - `IMAGE` / `VIDEO` / `FILE`: a file hosted on the Behio CDN (`url` is a
|
|
722
|
+
* direct file URL; `contentType` and `size` describe it).
|
|
723
|
+
* - `EXTERNAL_VIDEO`: an embed URL (YouTube/Vimeo). Render it in an
|
|
724
|
+
* `<iframe>`, never in a `<video>` tag. `size` is null.
|
|
725
|
+
*/
|
|
726
|
+
interface ProductAssetItem {
|
|
727
|
+
id: string;
|
|
728
|
+
kind: "IMAGE" | "VIDEO" | "FILE" | "EXTERNAL_VIDEO";
|
|
729
|
+
url: string;
|
|
730
|
+
/** MIME type ("video/mp4", "application/pdf"); null when unknown or external. */
|
|
731
|
+
contentType?: string | null;
|
|
732
|
+
/** File size in bytes; null for external videos. */
|
|
733
|
+
size?: number | null;
|
|
734
|
+
/** Merchant title in the requested locale, or null when none was written. */
|
|
735
|
+
title?: string | null;
|
|
736
|
+
description?: string | null;
|
|
737
|
+
order: number;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* A merchant-named group of extra product content ("videos", "downloads").
|
|
741
|
+
* Groups only exist while they have items, so empty groups are never emitted.
|
|
742
|
+
* Added in SDK 1.7.0.
|
|
743
|
+
*
|
|
744
|
+
* Example: render a video section from the "videos" group:
|
|
745
|
+
* ```tsx
|
|
746
|
+
* const videos = product.assetGroups.find((g) => g.group === "videos");
|
|
747
|
+
* videos?.items.map((v) =>
|
|
748
|
+
* v.kind === "EXTERNAL_VIDEO"
|
|
749
|
+
* ? <iframe key={v.id} src={v.url} title={v.title ?? undefined} allowFullScreen />
|
|
750
|
+
* : <video key={v.id} controls preload="metadata" src={v.url} />
|
|
751
|
+
* );
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
interface ProductAssetGroup {
|
|
755
|
+
/** Merchant-named group slug ("videos", "downloads"). */
|
|
756
|
+
group: string;
|
|
757
|
+
/** Items sorted by `order`. */
|
|
758
|
+
items: ProductAssetItem[];
|
|
759
|
+
}
|
|
703
760
|
interface ProductDetail extends ProductListItem {
|
|
704
761
|
longDescription?: string;
|
|
705
762
|
/**
|
|
@@ -742,6 +799,16 @@ interface ProductDetail extends ProductListItem {
|
|
|
742
799
|
* data groups, which published internal bookkeeping nobody curated.
|
|
743
800
|
*/
|
|
744
801
|
parameterGroups: ProductParameterGroup[];
|
|
802
|
+
/**
|
|
803
|
+
* Merchant-curated extra content in named groups ("videos", "downloads"):
|
|
804
|
+
* images, videos, files and external video embeds attached to the product.
|
|
805
|
+
* Distinct from `images` (roled gallery) and `media` (inventory gallery).
|
|
806
|
+
* Empty array when the merchant attached nothing. Added in SDK 1.7.0.
|
|
807
|
+
*
|
|
808
|
+
* Videos: `kind === "EXTERNAL_VIDEO"` is an embed URL (YouTube/Vimeo) for an
|
|
809
|
+
* `<iframe>`; `kind === "VIDEO"` is a CDN-hosted file for a `<video>` tag.
|
|
810
|
+
*/
|
|
811
|
+
assetGroups: ProductAssetGroup[];
|
|
745
812
|
seo: {
|
|
746
813
|
/**
|
|
747
814
|
* Slug of the page that should be canonical INSTEAD of this one. Empty
|
|
@@ -2324,6 +2391,7 @@ declare class BehioStorefront {
|
|
|
2324
2391
|
private rateLimitRemaining;
|
|
2325
2392
|
private rateLimitReset;
|
|
2326
2393
|
private visitorIp?;
|
|
2394
|
+
private throwOnAvailabilityError;
|
|
2327
2395
|
constructor(config: BehioStorefrontConfig);
|
|
2328
2396
|
readonly catalog: CatalogModule;
|
|
2329
2397
|
readonly auth: AuthModule;
|
package/dist/react.d.ts
CHANGED
|
@@ -85,6 +85,19 @@ interface BehioStorefrontConfig {
|
|
|
85
85
|
* automatically from the incoming request headers.
|
|
86
86
|
*/
|
|
87
87
|
visitorIp?: string | (() => string | null | undefined | Promise<string | null | undefined>);
|
|
88
|
+
/**
|
|
89
|
+
* Throw availability failures (429, 5xx, network, timeout) instead of
|
|
90
|
+
* returning them as `SdkResult.error`. Business outcomes (400, 401, 404,
|
|
91
|
+
* 409, …) keep the tuple shape either way.
|
|
92
|
+
*
|
|
93
|
+
* Why this exists: a storefront section that reads `result.data ?? []`
|
|
94
|
+
* silently renders an EMPTY catalog when the API is rate-limited or down,
|
|
95
|
+
* which looks exactly like a shop with no products. With this flag the
|
|
96
|
+
* failure surfaces as an exception, so SSR/ISR keeps the last good page and
|
|
97
|
+
* the visitor gets an error boundary instead of a lying page. Recommended
|
|
98
|
+
* `true` for every server-rendered catalog client.
|
|
99
|
+
*/
|
|
100
|
+
throwOnAvailabilityError?: boolean;
|
|
88
101
|
/** Request timeout in milliseconds. Default: 30000 (30s) */
|
|
89
102
|
timeout?: number;
|
|
90
103
|
/** Number of retries on network/5xx errors. Default: 1 */
|
|
@@ -700,6 +713,50 @@ interface ProductParameterGroup {
|
|
|
700
713
|
interface ProductParametersResponse {
|
|
701
714
|
groups: ProductParameterGroup[];
|
|
702
715
|
}
|
|
716
|
+
/**
|
|
717
|
+
* One item of a product asset group: an image, a hosted video, a downloadable
|
|
718
|
+
* file, or an external video embed. Added in SDK 1.7.0.
|
|
719
|
+
*
|
|
720
|
+
* `kind` decides how to render it:
|
|
721
|
+
* - `IMAGE` / `VIDEO` / `FILE`: a file hosted on the Behio CDN (`url` is a
|
|
722
|
+
* direct file URL; `contentType` and `size` describe it).
|
|
723
|
+
* - `EXTERNAL_VIDEO`: an embed URL (YouTube/Vimeo). Render it in an
|
|
724
|
+
* `<iframe>`, never in a `<video>` tag. `size` is null.
|
|
725
|
+
*/
|
|
726
|
+
interface ProductAssetItem {
|
|
727
|
+
id: string;
|
|
728
|
+
kind: "IMAGE" | "VIDEO" | "FILE" | "EXTERNAL_VIDEO";
|
|
729
|
+
url: string;
|
|
730
|
+
/** MIME type ("video/mp4", "application/pdf"); null when unknown or external. */
|
|
731
|
+
contentType?: string | null;
|
|
732
|
+
/** File size in bytes; null for external videos. */
|
|
733
|
+
size?: number | null;
|
|
734
|
+
/** Merchant title in the requested locale, or null when none was written. */
|
|
735
|
+
title?: string | null;
|
|
736
|
+
description?: string | null;
|
|
737
|
+
order: number;
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* A merchant-named group of extra product content ("videos", "downloads").
|
|
741
|
+
* Groups only exist while they have items, so empty groups are never emitted.
|
|
742
|
+
* Added in SDK 1.7.0.
|
|
743
|
+
*
|
|
744
|
+
* Example: render a video section from the "videos" group:
|
|
745
|
+
* ```tsx
|
|
746
|
+
* const videos = product.assetGroups.find((g) => g.group === "videos");
|
|
747
|
+
* videos?.items.map((v) =>
|
|
748
|
+
* v.kind === "EXTERNAL_VIDEO"
|
|
749
|
+
* ? <iframe key={v.id} src={v.url} title={v.title ?? undefined} allowFullScreen />
|
|
750
|
+
* : <video key={v.id} controls preload="metadata" src={v.url} />
|
|
751
|
+
* );
|
|
752
|
+
* ```
|
|
753
|
+
*/
|
|
754
|
+
interface ProductAssetGroup {
|
|
755
|
+
/** Merchant-named group slug ("videos", "downloads"). */
|
|
756
|
+
group: string;
|
|
757
|
+
/** Items sorted by `order`. */
|
|
758
|
+
items: ProductAssetItem[];
|
|
759
|
+
}
|
|
703
760
|
interface ProductDetail extends ProductListItem {
|
|
704
761
|
longDescription?: string;
|
|
705
762
|
/**
|
|
@@ -742,6 +799,16 @@ interface ProductDetail extends ProductListItem {
|
|
|
742
799
|
* data groups, which published internal bookkeeping nobody curated.
|
|
743
800
|
*/
|
|
744
801
|
parameterGroups: ProductParameterGroup[];
|
|
802
|
+
/**
|
|
803
|
+
* Merchant-curated extra content in named groups ("videos", "downloads"):
|
|
804
|
+
* images, videos, files and external video embeds attached to the product.
|
|
805
|
+
* Distinct from `images` (roled gallery) and `media` (inventory gallery).
|
|
806
|
+
* Empty array when the merchant attached nothing. Added in SDK 1.7.0.
|
|
807
|
+
*
|
|
808
|
+
* Videos: `kind === "EXTERNAL_VIDEO"` is an embed URL (YouTube/Vimeo) for an
|
|
809
|
+
* `<iframe>`; `kind === "VIDEO"` is a CDN-hosted file for a `<video>` tag.
|
|
810
|
+
*/
|
|
811
|
+
assetGroups: ProductAssetGroup[];
|
|
745
812
|
seo: {
|
|
746
813
|
/**
|
|
747
814
|
* Slug of the page that should be canonical INSTEAD of this one. Empty
|
|
@@ -2324,6 +2391,7 @@ declare class BehioStorefront {
|
|
|
2324
2391
|
private rateLimitRemaining;
|
|
2325
2392
|
private rateLimitReset;
|
|
2326
2393
|
private visitorIp?;
|
|
2394
|
+
private throwOnAvailabilityError;
|
|
2327
2395
|
constructor(config: BehioStorefrontConfig);
|
|
2328
2396
|
readonly catalog: CatalogModule;
|
|
2329
2397
|
readonly auth: AuthModule;
|
package/dist/react.js
CHANGED
|
@@ -188,6 +188,11 @@ function toSdkError(err) {
|
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
// src/client.ts
|
|
191
|
+
function isAvailabilityFailure(err) {
|
|
192
|
+
if (err instanceof BehioNetworkError) return true;
|
|
193
|
+
if (err instanceof BehioApiError) return err.isRetryable;
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
191
196
|
var BehioStorefront = class {
|
|
192
197
|
constructor(config) {
|
|
193
198
|
/** Consent-gated persistent visitor id — set by the analytics tracker. */
|
|
@@ -216,6 +221,7 @@ var BehioStorefront = class {
|
|
|
216
221
|
this.retries = config.retries ?? 1;
|
|
217
222
|
this.retryDelay = config.retryDelay ?? 1e3;
|
|
218
223
|
this.visitorIp = config.visitorIp;
|
|
224
|
+
this.throwOnAvailabilityError = config.throwOnAvailabilityError ?? false;
|
|
219
225
|
this.catalog = new CatalogModule(this);
|
|
220
226
|
this.auth = new AuthModule(this);
|
|
221
227
|
this.cart = new CartModule(this);
|
|
@@ -446,6 +452,9 @@ var BehioStorefront = class {
|
|
|
446
452
|
const data = await this.rawRequest(method, path, options);
|
|
447
453
|
return ok(data);
|
|
448
454
|
} catch (err) {
|
|
455
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err)) {
|
|
456
|
+
throw err;
|
|
457
|
+
}
|
|
449
458
|
return { data: null, error: toSdkError(err) };
|
|
450
459
|
}
|
|
451
460
|
}
|
|
@@ -473,6 +482,9 @@ var BehioStorefront = class {
|
|
|
473
482
|
}
|
|
474
483
|
return ok(await res.blob());
|
|
475
484
|
} catch (err) {
|
|
485
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err)) {
|
|
486
|
+
throw err;
|
|
487
|
+
}
|
|
476
488
|
return { data: null, error: toSdkError(err) };
|
|
477
489
|
}
|
|
478
490
|
}
|
package/dist/react.mjs
CHANGED
|
@@ -85,6 +85,11 @@ function toSdkError(err) {
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// src/client.ts
|
|
88
|
+
function isAvailabilityFailure(err) {
|
|
89
|
+
if (err instanceof BehioNetworkError) return true;
|
|
90
|
+
if (err instanceof BehioApiError) return err.isRetryable;
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
88
93
|
var BehioStorefront = class {
|
|
89
94
|
constructor(config) {
|
|
90
95
|
/** Consent-gated persistent visitor id — set by the analytics tracker. */
|
|
@@ -113,6 +118,7 @@ var BehioStorefront = class {
|
|
|
113
118
|
this.retries = config.retries ?? 1;
|
|
114
119
|
this.retryDelay = config.retryDelay ?? 1e3;
|
|
115
120
|
this.visitorIp = config.visitorIp;
|
|
121
|
+
this.throwOnAvailabilityError = config.throwOnAvailabilityError ?? false;
|
|
116
122
|
this.catalog = new CatalogModule(this);
|
|
117
123
|
this.auth = new AuthModule(this);
|
|
118
124
|
this.cart = new CartModule(this);
|
|
@@ -343,6 +349,9 @@ var BehioStorefront = class {
|
|
|
343
349
|
const data = await this.rawRequest(method, path, options);
|
|
344
350
|
return ok(data);
|
|
345
351
|
} catch (err) {
|
|
352
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err)) {
|
|
353
|
+
throw err;
|
|
354
|
+
}
|
|
346
355
|
return { data: null, error: toSdkError(err) };
|
|
347
356
|
}
|
|
348
357
|
}
|
|
@@ -370,6 +379,9 @@ var BehioStorefront = class {
|
|
|
370
379
|
}
|
|
371
380
|
return ok(await res.blob());
|
|
372
381
|
} catch (err) {
|
|
382
|
+
if (this.throwOnAvailabilityError && isAvailabilityFailure(err)) {
|
|
383
|
+
throw err;
|
|
384
|
+
}
|
|
373
385
|
return { data: null, error: toSdkError(err) };
|
|
374
386
|
}
|
|
375
387
|
}
|