@behio/storefront-sdk 2.3.0 → 2.5.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 +17 -0
- package/dist/{chunk-ET7SLTHN.mjs → chunk-5WHX5QA4.mjs} +19 -0
- package/dist/{chunk-B6LU56EC.js → chunk-XVKKDVOO.js} +19 -0
- package/dist/{client-CDpkw2Qv.d.mts → client-B2eSpsfP.d.mts} +35 -1
- package/dist/{client-CDpkw2Qv.d.ts → client-B2eSpsfP.d.ts} +35 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +1 -1
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/react.d.mts +34 -0
- package/dist/react.d.ts +34 -0
- package/dist/react.js +19 -0
- package/dist/react.mjs +19 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -252,6 +252,23 @@ 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
|
+
### One of a kind (2.5)
|
|
256
|
+
|
|
257
|
+
`ProductListItem.isUnique` marks a handmade original: one piece, never
|
|
258
|
+
restocked, never sold beyond stock. `soldAt` is set once it sells and the
|
|
259
|
+
availability label reads "Sold". Hide quantity steppers, never offer
|
|
260
|
+
back-in-stock watching for originals, offer "I want a similar one" instead.
|
|
261
|
+
|
|
262
|
+
### Cart links from Behio Chat (2.4)
|
|
263
|
+
|
|
264
|
+
`cart.claimLink(token)` adds the products of a prepared cart link (created by
|
|
265
|
+
the AI in Behio Chat) to the visitor's cart and applies the link's discount
|
|
266
|
+
code. Call it on the server in a `/cart/link/[token]` route handler, then
|
|
267
|
+
redirect to checkout. Items are added, never replacing the cart; a second open
|
|
268
|
+
does not double quantities. Expired links fail with
|
|
269
|
+
`be.storefront.cartLinkExpired`. Answer `GET /cart/link/_probe` with header
|
|
270
|
+
`x-behio-cart-link: 1` so Behio Chat knows the storefront supports links.
|
|
271
|
+
|
|
255
272
|
### Cart summary for page scripts (2.2, helper 2.3)
|
|
256
273
|
|
|
257
274
|
Browser cart responses dispatch `behio:cart` on `window` with
|
|
@@ -1301,6 +1301,25 @@ var CartModule = class {
|
|
|
1301
1301
|
this.client.emit("cart:updated", res.data);
|
|
1302
1302
|
return res;
|
|
1303
1303
|
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
1306
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
1307
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
1308
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
1309
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
1310
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
1311
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
1312
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
1313
|
+
*/
|
|
1314
|
+
async claimLink(token) {
|
|
1315
|
+
const res = await this.client.request("POST", `/cart/links/${encodeURIComponent(token)}/claim`, {});
|
|
1316
|
+
if (res.error) return res;
|
|
1317
|
+
if (res.data.newSessionToken) {
|
|
1318
|
+
this.client.setCartSession(res.data.newSessionToken);
|
|
1319
|
+
}
|
|
1320
|
+
this.client.emit("cart:updated", res.data);
|
|
1321
|
+
return res;
|
|
1322
|
+
}
|
|
1304
1323
|
/** Remove discount code */
|
|
1305
1324
|
async removeDiscount() {
|
|
1306
1325
|
const res = await this.client.request("DELETE", "/cart/discount");
|
|
@@ -1301,6 +1301,25 @@ var CartModule = class {
|
|
|
1301
1301
|
this.client.emit("cart:updated", res.data);
|
|
1302
1302
|
return res;
|
|
1303
1303
|
}
|
|
1304
|
+
/**
|
|
1305
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
1306
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
1307
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
1308
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
1309
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
1310
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
1311
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
1312
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
1313
|
+
*/
|
|
1314
|
+
async claimLink(token) {
|
|
1315
|
+
const res = await this.client.request("POST", `/cart/links/${encodeURIComponent(token)}/claim`, {});
|
|
1316
|
+
if (res.error) return res;
|
|
1317
|
+
if (res.data.newSessionToken) {
|
|
1318
|
+
this.client.setCartSession(res.data.newSessionToken);
|
|
1319
|
+
}
|
|
1320
|
+
this.client.emit("cart:updated", res.data);
|
|
1321
|
+
return res;
|
|
1322
|
+
}
|
|
1304
1323
|
/** Remove discount code */
|
|
1305
1324
|
async removeDiscount() {
|
|
1306
1325
|
const res = await this.client.request("DELETE", "/cart/discount");
|
|
@@ -572,6 +572,19 @@ interface ProductListItem {
|
|
|
572
572
|
* never turn it on.
|
|
573
573
|
*/
|
|
574
574
|
variantsOnly: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* One of a kind (handmade original, SDK 2.5): exactly one piece exists and it
|
|
577
|
+
* is never restocked. While available, show it as a one-off (the server label
|
|
578
|
+
* already says so in `availability.label`) and hide the quantity stepper.
|
|
579
|
+
* Once sold, `soldAt` is set, `availability.label` reads "Sold" and the
|
|
580
|
+
* product is not purchasable: never offer back-in-stock watching (the server
|
|
581
|
+
* refuses it), offer "I want a similar one" instead. The merchant decides
|
|
582
|
+
* whether sold originals stay listed (N days, forever) or disappear at once;
|
|
583
|
+
* in the last case the product page returns 404.
|
|
584
|
+
*/
|
|
585
|
+
isUnique: boolean;
|
|
586
|
+
/** When the one-of-a-kind piece sold (epoch ms); null while available. */
|
|
587
|
+
soldAt: number | null;
|
|
575
588
|
/**
|
|
576
589
|
* "From" price: the CHEAPEST variant price, in the requested currency, or
|
|
577
590
|
* null when the product has no variants (or prices are gated behind login in
|
|
@@ -2852,6 +2865,16 @@ interface Sitemap {
|
|
|
2852
2865
|
categories: SitemapEntry[];
|
|
2853
2866
|
pages: SitemapEntry[];
|
|
2854
2867
|
}
|
|
2868
|
+
/** Result of `cart.claimLink(token)`: the updated cart plus what the link did. */
|
|
2869
|
+
interface CartLinkClaimed extends Cart {
|
|
2870
|
+
/** New anonymous cart session (the SDK stores it automatically). */
|
|
2871
|
+
newSessionToken?: string;
|
|
2872
|
+
/** Products from the link that can no longer be bought and were skipped. */
|
|
2873
|
+
linkSkippedItems: number;
|
|
2874
|
+
/** A discount code carried by the link was applied. */
|
|
2875
|
+
linkDiscountApplied: boolean;
|
|
2876
|
+
linkDiscountCode: string | null;
|
|
2877
|
+
}
|
|
2855
2878
|
|
|
2856
2879
|
declare class BehioStorefront {
|
|
2857
2880
|
private baseUrl;
|
|
@@ -3350,6 +3373,17 @@ declare class CartModule {
|
|
|
3350
3373
|
merge(): Promise<SdkResult<Cart>>;
|
|
3351
3374
|
/** Apply discount code */
|
|
3352
3375
|
applyDiscount(code: string): Promise<SdkResult<Cart>>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
3378
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
3379
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
3380
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
3381
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
3382
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
3383
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
3384
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
3385
|
+
*/
|
|
3386
|
+
claimLink(token: string): Promise<SdkResult<CartLinkClaimed>>;
|
|
3353
3387
|
/** Remove discount code */
|
|
3354
3388
|
removeDiscount(): Promise<SdkResult<Cart>>;
|
|
3355
3389
|
}
|
|
@@ -3805,4 +3839,4 @@ interface CartSummaryEvent {
|
|
|
3805
3839
|
*/
|
|
3806
3840
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
3807
3841
|
|
|
3808
|
-
export { type
|
|
3842
|
+
export { type CourseCommentReply 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 CartLinkClaimed as J, type CartPromotion as K, type CartSummaryEvent as L, type Category as M, type CategoryDetail as N, type CertificateVerification as O, type ProductDetail as P, type CheckoutAddress as Q, type CheckoutInput as R, type SdkResult as S, type CheckoutPaymentMethod as T, type CheckoutPreview as U, type CheckoutResult as V, type CheckoutSettings as W, type CookieConsentInput as X, type CourseAttachment as Y, type CourseCertificate as Z, type CourseComment as _, type ProductVariant as a, type PaymentInstrument as a$, type CourseCommentsList as a0, type CourseDetail as a1, type CourseLesson as a2, type CourseListItem as a3, type CourseModule as a4, type CoursePostedComment as a5, type CourseProgress as a6, type CourseTutorMessage as a7, type CourseTutorThread as a8, type CrossSellItem as a9, type LoyaltyProgram as aA, type LoyaltySummary as aB, type LoyaltyTier as aC, type LoyaltyTierPerks as aD, type LoyaltyTransaction as aE, type Menu as aF, type MenuItem as aG, type MenuItemRef as aH, type MenuItemType as aI, type MessageResponse as aJ, type NewsletterOptInDefault as aK, type NewsletterSubscribeInput as aL, type NewsletterSubscribeResult as aM, type NewsletterUnsubscribeResult as aN, type OrderAccessRequestResponse as aO, type OrderAccessVerifyResponse as aP, type OrderDetail as aQ, type OrderItem as aR, type OrderListItem as aS, type OrderStatus as aT, type OrderStatusHistory as aU, OrderStatuses as aV, type OrderTracking as aW, type Page as aX, type PageAttachment as aY, type PageDetail as aZ, type PaginatedResponse as a_, type CurrencyDisplayFormat as aa, type CustomerAddress as ab, type CustomerProfile as ac, type DigitalDownload as ad, type DownloadUrl as ae, type Facet as af, type FacetAvailability as ag, type FacetCategory as ah, type FacetLabel as ai, type FacetPriceRange as aj, type FacetRange as ak, type FacetRatingBucket as al, type FacetValue as am, type FacetsResponse as an, type FilterField as ao, type FulfillmentStatus as ap, FulfillmentStatuses as aq, type GiftCardBalance as ar, type GiftCardPurchaseInput as as, type GiftCardPurchaseResult as at, type GiftCardSummary as au, type LessonNote as av, type LessonQuiz as aw, type LoginInput as ax, type LoyaltyBalance as ay, type LoyaltyNextTier as az, type StorefrontFormFieldError as b, type StockBehavior as b$, type PaymentStatus as b0, PaymentStatuses as b1, type PaymentSwift as b2, type PickupPoint as b3, type PickupPointHours as b4, type PickupPointsInput as b5, type PickupWidgetConfig as b6, type PriceDisplay as b7, type ProductAssetGroup as b8, type ProductAssetItem as b9, type RequestInterceptor as bA, type RequestInterceptorConfig as bB, type ResponseInterceptor as bC, type ResponseInterceptorData as bD, type ReturnRequest as bE, type ReturnRequestItem as bF, type ReturnStatus as bG, type ReturnStatusItem as bH, type ReturnableOrder as bI, type ReturnableOrderItem as bJ, type SdkError as bK, type ShippingMethodSummary as bL, type ShippingQuote as bM, type ShippingQuoteInput as bN, type ShopAppearance as bO, type ShopInfo as bP, type ShopScript as bQ, type ShopScriptPlacement as bR, type ShopScriptType as bS, type ShopScripts as bT, type ShopSeo as bU, type ShopSeoIdentity as bV, type SiteFormField as bW, type SiteFormFieldOption as bX, type SiteFormFieldType as bY, type Sitemap as bZ, type SitemapEntry as b_, type ProductAvailability as ba, type ProductGroup as bb, type ProductLabel as bc, type ProductListItem as bd, type ProductMedia as be, type ProductMediaVariant as bf, type ProductParameter as bg, type ProductParameterGroup as bh, type ProductParametersResponse as bi, type ProductPrice as bj, type ProductPromotionSummary as bk, type ProductReview as bl, type ProductReviewsResponse as bm, type ProductSibling as bn, ProductSort as bo, type ProductSortValue as bp, type ProductVolumePrice as bq, type ProductsQuery as br, type QuizAnswerInput as bs, type QuizAnswerResult as bt, type QuizQuestion as bu, type QuizResult as bv, type QuoteItem as bw, type QuoteRequest as bx, type RegisterInput as by, type RegisterResult as bz, type AddToCartInput as c, type StockMode as c0, type StorefrontForm as c1, type StorefrontFormFieldErrorCode as c2, type StorefrontFormFile as c3, type StorefrontFormSettings as c4, type StorefrontFormSubmitInput as c5, type StorefrontFormSubmitResult as c6, type StorefrontFormUpload as c7, type SubmitQuoteInput as c8, type SubmitReturnInput as c9, type SubmitReviewInput as ca, type Subscription as cb, type SubscriptionAction as cc, type SubscriptionFrequency as cd, type SubscriptionItem as ce, type SubscriptionStatus as cf, type TaxBreakdownLine as cg, type VariantAxis as ch, type VariantAxisValue as ci, type WishlistItem as cj, err as ck, ok as cl, publishCartSummary as cm, toSdkError as cn, 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 };
|
|
@@ -572,6 +572,19 @@ interface ProductListItem {
|
|
|
572
572
|
* never turn it on.
|
|
573
573
|
*/
|
|
574
574
|
variantsOnly: boolean;
|
|
575
|
+
/**
|
|
576
|
+
* One of a kind (handmade original, SDK 2.5): exactly one piece exists and it
|
|
577
|
+
* is never restocked. While available, show it as a one-off (the server label
|
|
578
|
+
* already says so in `availability.label`) and hide the quantity stepper.
|
|
579
|
+
* Once sold, `soldAt` is set, `availability.label` reads "Sold" and the
|
|
580
|
+
* product is not purchasable: never offer back-in-stock watching (the server
|
|
581
|
+
* refuses it), offer "I want a similar one" instead. The merchant decides
|
|
582
|
+
* whether sold originals stay listed (N days, forever) or disappear at once;
|
|
583
|
+
* in the last case the product page returns 404.
|
|
584
|
+
*/
|
|
585
|
+
isUnique: boolean;
|
|
586
|
+
/** When the one-of-a-kind piece sold (epoch ms); null while available. */
|
|
587
|
+
soldAt: number | null;
|
|
575
588
|
/**
|
|
576
589
|
* "From" price: the CHEAPEST variant price, in the requested currency, or
|
|
577
590
|
* null when the product has no variants (or prices are gated behind login in
|
|
@@ -2852,6 +2865,16 @@ interface Sitemap {
|
|
|
2852
2865
|
categories: SitemapEntry[];
|
|
2853
2866
|
pages: SitemapEntry[];
|
|
2854
2867
|
}
|
|
2868
|
+
/** Result of `cart.claimLink(token)`: the updated cart plus what the link did. */
|
|
2869
|
+
interface CartLinkClaimed extends Cart {
|
|
2870
|
+
/** New anonymous cart session (the SDK stores it automatically). */
|
|
2871
|
+
newSessionToken?: string;
|
|
2872
|
+
/** Products from the link that can no longer be bought and were skipped. */
|
|
2873
|
+
linkSkippedItems: number;
|
|
2874
|
+
/** A discount code carried by the link was applied. */
|
|
2875
|
+
linkDiscountApplied: boolean;
|
|
2876
|
+
linkDiscountCode: string | null;
|
|
2877
|
+
}
|
|
2855
2878
|
|
|
2856
2879
|
declare class BehioStorefront {
|
|
2857
2880
|
private baseUrl;
|
|
@@ -3350,6 +3373,17 @@ declare class CartModule {
|
|
|
3350
3373
|
merge(): Promise<SdkResult<Cart>>;
|
|
3351
3374
|
/** Apply discount code */
|
|
3352
3375
|
applyDiscount(code: string): Promise<SdkResult<Cart>>;
|
|
3376
|
+
/**
|
|
3377
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
3378
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
3379
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
3380
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
3381
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
3382
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
3383
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
3384
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
3385
|
+
*/
|
|
3386
|
+
claimLink(token: string): Promise<SdkResult<CartLinkClaimed>>;
|
|
3353
3387
|
/** Remove discount code */
|
|
3354
3388
|
removeDiscount(): Promise<SdkResult<Cart>>;
|
|
3355
3389
|
}
|
|
@@ -3805,4 +3839,4 @@ interface CartSummaryEvent {
|
|
|
3805
3839
|
*/
|
|
3806
3840
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
3807
3841
|
|
|
3808
|
-
export { type
|
|
3842
|
+
export { type CourseCommentReply 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 CartLinkClaimed as J, type CartPromotion as K, type CartSummaryEvent as L, type Category as M, type CategoryDetail as N, type CertificateVerification as O, type ProductDetail as P, type CheckoutAddress as Q, type CheckoutInput as R, type SdkResult as S, type CheckoutPaymentMethod as T, type CheckoutPreview as U, type CheckoutResult as V, type CheckoutSettings as W, type CookieConsentInput as X, type CourseAttachment as Y, type CourseCertificate as Z, type CourseComment as _, type ProductVariant as a, type PaymentInstrument as a$, type CourseCommentsList as a0, type CourseDetail as a1, type CourseLesson as a2, type CourseListItem as a3, type CourseModule as a4, type CoursePostedComment as a5, type CourseProgress as a6, type CourseTutorMessage as a7, type CourseTutorThread as a8, type CrossSellItem as a9, type LoyaltyProgram as aA, type LoyaltySummary as aB, type LoyaltyTier as aC, type LoyaltyTierPerks as aD, type LoyaltyTransaction as aE, type Menu as aF, type MenuItem as aG, type MenuItemRef as aH, type MenuItemType as aI, type MessageResponse as aJ, type NewsletterOptInDefault as aK, type NewsletterSubscribeInput as aL, type NewsletterSubscribeResult as aM, type NewsletterUnsubscribeResult as aN, type OrderAccessRequestResponse as aO, type OrderAccessVerifyResponse as aP, type OrderDetail as aQ, type OrderItem as aR, type OrderListItem as aS, type OrderStatus as aT, type OrderStatusHistory as aU, OrderStatuses as aV, type OrderTracking as aW, type Page as aX, type PageAttachment as aY, type PageDetail as aZ, type PaginatedResponse as a_, type CurrencyDisplayFormat as aa, type CustomerAddress as ab, type CustomerProfile as ac, type DigitalDownload as ad, type DownloadUrl as ae, type Facet as af, type FacetAvailability as ag, type FacetCategory as ah, type FacetLabel as ai, type FacetPriceRange as aj, type FacetRange as ak, type FacetRatingBucket as al, type FacetValue as am, type FacetsResponse as an, type FilterField as ao, type FulfillmentStatus as ap, FulfillmentStatuses as aq, type GiftCardBalance as ar, type GiftCardPurchaseInput as as, type GiftCardPurchaseResult as at, type GiftCardSummary as au, type LessonNote as av, type LessonQuiz as aw, type LoginInput as ax, type LoyaltyBalance as ay, type LoyaltyNextTier as az, type StorefrontFormFieldError as b, type StockBehavior as b$, type PaymentStatus as b0, PaymentStatuses as b1, type PaymentSwift as b2, type PickupPoint as b3, type PickupPointHours as b4, type PickupPointsInput as b5, type PickupWidgetConfig as b6, type PriceDisplay as b7, type ProductAssetGroup as b8, type ProductAssetItem as b9, type RequestInterceptor as bA, type RequestInterceptorConfig as bB, type ResponseInterceptor as bC, type ResponseInterceptorData as bD, type ReturnRequest as bE, type ReturnRequestItem as bF, type ReturnStatus as bG, type ReturnStatusItem as bH, type ReturnableOrder as bI, type ReturnableOrderItem as bJ, type SdkError as bK, type ShippingMethodSummary as bL, type ShippingQuote as bM, type ShippingQuoteInput as bN, type ShopAppearance as bO, type ShopInfo as bP, type ShopScript as bQ, type ShopScriptPlacement as bR, type ShopScriptType as bS, type ShopScripts as bT, type ShopSeo as bU, type ShopSeoIdentity as bV, type SiteFormField as bW, type SiteFormFieldOption as bX, type SiteFormFieldType as bY, type Sitemap as bZ, type SitemapEntry as b_, type ProductAvailability as ba, type ProductGroup as bb, type ProductLabel as bc, type ProductListItem as bd, type ProductMedia as be, type ProductMediaVariant as bf, type ProductParameter as bg, type ProductParameterGroup as bh, type ProductParametersResponse as bi, type ProductPrice as bj, type ProductPromotionSummary as bk, type ProductReview as bl, type ProductReviewsResponse as bm, type ProductSibling as bn, ProductSort as bo, type ProductSortValue as bp, type ProductVolumePrice as bq, type ProductsQuery as br, type QuizAnswerInput as bs, type QuizAnswerResult as bt, type QuizQuestion as bu, type QuizResult as bv, type QuoteItem as bw, type QuoteRequest as bx, type RegisterInput as by, type RegisterResult as bz, type AddToCartInput as c, type StockMode as c0, type StorefrontForm as c1, type StorefrontFormFieldErrorCode as c2, type StorefrontFormFile as c3, type StorefrontFormSettings as c4, type StorefrontFormSubmitInput as c5, type StorefrontFormSubmitResult as c6, type StorefrontFormUpload as c7, type SubmitQuoteInput as c8, type SubmitReturnInput as c9, type SubmitReviewInput as ca, type Subscription as cb, type SubscriptionAction as cc, type SubscriptionFrequency as cd, type SubscriptionItem as ce, type SubscriptionStatus as cf, type TaxBreakdownLine as cg, type VariantAxis as ch, type VariantAxisValue as ci, type WishlistItem as cj, err as ck, ok as cl, publishCartSummary as cm, toSdkError as cn, 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
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-B2eSpsfP.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 CartLinkClaimed, K as CartPromotion, L as CartSummaryEvent, M as Category, N as CategoryDetail, O as CertificateVerification, Q as CheckoutAddress, R as CheckoutInput, T as CheckoutPaymentMethod, U as CheckoutPreview, V as CheckoutResult, W as CheckoutSettings, X as CookieConsentInput, Y as CourseAttachment, Z as CourseCertificate, _ as CourseComment, $ as CourseCommentReply, a0 as CourseCommentsList, a1 as CourseDetail, a2 as CourseLesson, a3 as CourseListItem, a4 as CourseModule, a5 as CoursePostedComment, a6 as CourseProgress, a7 as CourseTutorMessage, a8 as CourseTutorThread, a9 as CrossSellItem, aa as CurrencyDisplayFormat, ab as CustomerAddress, ac as CustomerProfile, ad as DigitalDownload, ae as DownloadUrl, af as Facet, ag as FacetAvailability, ah as FacetCategory, ai as FacetLabel, aj as FacetPriceRange, ak as FacetRange, al as FacetRatingBucket, am as FacetValue, an as FacetsResponse, ao as FilterField, ap as FulfillmentStatus, aq as FulfillmentStatuses, ar as GiftCardBalance, as as GiftCardPurchaseInput, at as GiftCardPurchaseResult, au as GiftCardSummary, av as LessonNote, aw as LessonQuiz, ax as LoginInput, ay as LoyaltyBalance, az as LoyaltyNextTier, aA as LoyaltyProgram, aB as LoyaltySummary, aC as LoyaltyTier, aD as LoyaltyTierPerks, aE as LoyaltyTransaction, aF as Menu, aG as MenuItem, aH as MenuItemRef, aI as MenuItemType, aJ as MessageResponse, aK as NewsletterOptInDefault, aL as NewsletterSubscribeInput, aM as NewsletterSubscribeResult, aN as NewsletterUnsubscribeResult, aO as OrderAccessRequestResponse, aP as OrderAccessVerifyResponse, aQ as OrderDetail, aR as OrderItem, aS as OrderListItem, aT as OrderStatus, aU as OrderStatusHistory, aV as OrderStatuses, aW as OrderTracking, aX as Page, aY as PageAttachment, aZ as PageDetail, a_ as PaginatedResponse, a$ as PaymentInstrument, b0 as PaymentStatus, b1 as PaymentStatuses, b2 as PaymentSwift, b3 as PickupPoint, b4 as PickupPointHours, b5 as PickupPointsInput, b6 as PickupWidgetConfig, b7 as PriceDisplay, b8 as ProductAssetGroup, b9 as ProductAssetItem, ba as ProductAvailability, bb as ProductGroup, bc as ProductLabel, bd as ProductListItem, be as ProductMedia, bf as ProductMediaVariant, bg as ProductParameter, bh as ProductParameterGroup, bi as ProductParametersResponse, bj as ProductPrice, bk as ProductPromotionSummary, bl as ProductReview, bm as ProductReviewsResponse, bn as ProductSibling, bo as ProductSort, bp as ProductSortValue, bq as ProductVolumePrice, br as ProductsQuery, bs as QuizAnswerInput, bt as QuizAnswerResult, bu as QuizQuestion, bv as QuizResult, bw as QuoteItem, bx as QuoteRequest, by as RegisterInput, bz as RegisterResult, bA as RequestInterceptor, bB as RequestInterceptorConfig, bC as ResponseInterceptor, bD as ResponseInterceptorData, bE as ReturnRequest, bF as ReturnRequestItem, bG as ReturnStatus, bH as ReturnStatusItem, bI as ReturnableOrder, bJ as ReturnableOrderItem, bK as SdkError, bL as ShippingMethodSummary, bM as ShippingQuote, bN as ShippingQuoteInput, bO as ShopAppearance, bP as ShopInfo, bQ as ShopScript, bR as ShopScriptPlacement, bS as ShopScriptType, bT as ShopScripts, bU as ShopSeo, bV as ShopSeoIdentity, bW as SiteFormField, bX as SiteFormFieldOption, bY as SiteFormFieldType, bZ as Sitemap, b_ as SitemapEntry, b$ as StockBehavior, c0 as StockMode, c1 as StorefrontForm, c2 as StorefrontFormFieldErrorCode, c3 as StorefrontFormFile, c4 as StorefrontFormSettings, c5 as StorefrontFormSubmitInput, c6 as StorefrontFormSubmitResult, c7 as StorefrontFormUpload, c8 as SubmitQuoteInput, c9 as SubmitReturnInput, ca as SubmitReviewInput, cb as Subscription, cc as SubscriptionAction, cd as SubscriptionFrequency, ce as SubscriptionItem, cf as SubscriptionStatus, cg as TaxBreakdownLine, ch as VariantAxis, ci as VariantAxisValue, cj as WishlistItem, ck as err, cl as ok, cm as publishCartSummary, cn as toSdkError } from './client-B2eSpsfP.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
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-B2eSpsfP.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 CartLinkClaimed, K as CartPromotion, L as CartSummaryEvent, M as Category, N as CategoryDetail, O as CertificateVerification, Q as CheckoutAddress, R as CheckoutInput, T as CheckoutPaymentMethod, U as CheckoutPreview, V as CheckoutResult, W as CheckoutSettings, X as CookieConsentInput, Y as CourseAttachment, Z as CourseCertificate, _ as CourseComment, $ as CourseCommentReply, a0 as CourseCommentsList, a1 as CourseDetail, a2 as CourseLesson, a3 as CourseListItem, a4 as CourseModule, a5 as CoursePostedComment, a6 as CourseProgress, a7 as CourseTutorMessage, a8 as CourseTutorThread, a9 as CrossSellItem, aa as CurrencyDisplayFormat, ab as CustomerAddress, ac as CustomerProfile, ad as DigitalDownload, ae as DownloadUrl, af as Facet, ag as FacetAvailability, ah as FacetCategory, ai as FacetLabel, aj as FacetPriceRange, ak as FacetRange, al as FacetRatingBucket, am as FacetValue, an as FacetsResponse, ao as FilterField, ap as FulfillmentStatus, aq as FulfillmentStatuses, ar as GiftCardBalance, as as GiftCardPurchaseInput, at as GiftCardPurchaseResult, au as GiftCardSummary, av as LessonNote, aw as LessonQuiz, ax as LoginInput, ay as LoyaltyBalance, az as LoyaltyNextTier, aA as LoyaltyProgram, aB as LoyaltySummary, aC as LoyaltyTier, aD as LoyaltyTierPerks, aE as LoyaltyTransaction, aF as Menu, aG as MenuItem, aH as MenuItemRef, aI as MenuItemType, aJ as MessageResponse, aK as NewsletterOptInDefault, aL as NewsletterSubscribeInput, aM as NewsletterSubscribeResult, aN as NewsletterUnsubscribeResult, aO as OrderAccessRequestResponse, aP as OrderAccessVerifyResponse, aQ as OrderDetail, aR as OrderItem, aS as OrderListItem, aT as OrderStatus, aU as OrderStatusHistory, aV as OrderStatuses, aW as OrderTracking, aX as Page, aY as PageAttachment, aZ as PageDetail, a_ as PaginatedResponse, a$ as PaymentInstrument, b0 as PaymentStatus, b1 as PaymentStatuses, b2 as PaymentSwift, b3 as PickupPoint, b4 as PickupPointHours, b5 as PickupPointsInput, b6 as PickupWidgetConfig, b7 as PriceDisplay, b8 as ProductAssetGroup, b9 as ProductAssetItem, ba as ProductAvailability, bb as ProductGroup, bc as ProductLabel, bd as ProductListItem, be as ProductMedia, bf as ProductMediaVariant, bg as ProductParameter, bh as ProductParameterGroup, bi as ProductParametersResponse, bj as ProductPrice, bk as ProductPromotionSummary, bl as ProductReview, bm as ProductReviewsResponse, bn as ProductSibling, bo as ProductSort, bp as ProductSortValue, bq as ProductVolumePrice, br as ProductsQuery, bs as QuizAnswerInput, bt as QuizAnswerResult, bu as QuizQuestion, bv as QuizResult, bw as QuoteItem, bx as QuoteRequest, by as RegisterInput, bz as RegisterResult, bA as RequestInterceptor, bB as RequestInterceptorConfig, bC as ResponseInterceptor, bD as ResponseInterceptorData, bE as ReturnRequest, bF as ReturnRequestItem, bG as ReturnStatus, bH as ReturnStatusItem, bI as ReturnableOrder, bJ as ReturnableOrderItem, bK as SdkError, bL as ShippingMethodSummary, bM as ShippingQuote, bN as ShippingQuoteInput, bO as ShopAppearance, bP as ShopInfo, bQ as ShopScript, bR as ShopScriptPlacement, bS as ShopScriptType, bT as ShopScripts, bU as ShopSeo, bV as ShopSeoIdentity, bW as SiteFormField, bX as SiteFormFieldOption, bY as SiteFormFieldType, bZ as Sitemap, b_ as SitemapEntry, b$ as StockBehavior, c0 as StockMode, c1 as StorefrontForm, c2 as StorefrontFormFieldErrorCode, c3 as StorefrontFormFile, c4 as StorefrontFormSettings, c5 as StorefrontFormSubmitInput, c6 as StorefrontFormSubmitResult, c7 as StorefrontFormUpload, c8 as SubmitQuoteInput, c9 as SubmitReturnInput, ca as SubmitReviewInput, cb as Subscription, cc as SubscriptionAction, cd as SubscriptionFrequency, ce as SubscriptionItem, cf as SubscriptionStatus, cg as TaxBreakdownLine, ch as VariantAxis, ci as VariantAxisValue, cj as WishlistItem, ck as err, cl as ok, cm as publishCartSummary, cn as toSdkError } from './client-B2eSpsfP.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkXVKKDVOOjs = require('./chunk-XVKKDVOO.js');
|
|
15
15
|
|
|
16
16
|
// src/react/utils/format-price.ts
|
|
17
17
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -949,7 +949,7 @@ var GENERIC = {
|
|
|
949
949
|
en: "Something went wrong, please try again."
|
|
950
950
|
};
|
|
951
951
|
function bodyOf(err2) {
|
|
952
|
-
const body = err2 instanceof
|
|
952
|
+
const body = err2 instanceof _chunkXVKKDVOOjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
|
|
953
953
|
return body && typeof body === "object" ? body : null;
|
|
954
954
|
}
|
|
955
955
|
function errorCode(err2) {
|
|
@@ -1062,4 +1062,4 @@ function formFieldErrors(err2) {
|
|
|
1062
1062
|
|
|
1063
1063
|
|
|
1064
1064
|
|
|
1065
|
-
exports.AddressTypes =
|
|
1065
|
+
exports.AddressTypes = _chunkXVKKDVOOjs.AddressTypes; exports.BehioApiError = _chunkXVKKDVOOjs.BehioApiError; exports.BehioNetworkError = _chunkXVKKDVOOjs.BehioNetworkError; exports.BehioStorefront = _chunkXVKKDVOOjs.BehioStorefront; exports.FulfillmentStatuses = _chunkXVKKDVOOjs.FulfillmentStatuses; exports.OrderStatuses = _chunkXVKKDVOOjs.OrderStatuses; exports.PaymentStatuses = _chunkXVKKDVOOjs.PaymentStatuses; exports.ProductSort = _chunkXVKKDVOOjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.err = _chunkXVKKDVOOjs.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 = _chunkXVKKDVOOjs.ok; exports.publishCartSummary = _chunkXVKKDVOOjs.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkXVKKDVOOjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
|
package/dist/index.mjs
CHANGED
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-B2eSpsfP.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-B2eSpsfP.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 _chunkXVKKDVOOjs = require('./chunk-XVKKDVOO.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, _chunkXVKKDVOOjs.BehioStorefront)({
|
|
23
23
|
apiKey,
|
|
24
24
|
...baseUrl ? { baseUrl } : {},
|
|
25
25
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -628,6 +628,19 @@ interface ProductListItem {
|
|
|
628
628
|
* never turn it on.
|
|
629
629
|
*/
|
|
630
630
|
variantsOnly: boolean;
|
|
631
|
+
/**
|
|
632
|
+
* One of a kind (handmade original, SDK 2.5): exactly one piece exists and it
|
|
633
|
+
* is never restocked. While available, show it as a one-off (the server label
|
|
634
|
+
* already says so in `availability.label`) and hide the quantity stepper.
|
|
635
|
+
* Once sold, `soldAt` is set, `availability.label` reads "Sold" and the
|
|
636
|
+
* product is not purchasable: never offer back-in-stock watching (the server
|
|
637
|
+
* refuses it), offer "I want a similar one" instead. The merchant decides
|
|
638
|
+
* whether sold originals stay listed (N days, forever) or disappear at once;
|
|
639
|
+
* in the last case the product page returns 404.
|
|
640
|
+
*/
|
|
641
|
+
isUnique: boolean;
|
|
642
|
+
/** When the one-of-a-kind piece sold (epoch ms); null while available. */
|
|
643
|
+
soldAt: number | null;
|
|
631
644
|
/**
|
|
632
645
|
* "From" price: the CHEAPEST variant price, in the requested currency, or
|
|
633
646
|
* null when the product has no variants (or prices are gated behind login in
|
|
@@ -2862,6 +2875,16 @@ interface Sitemap {
|
|
|
2862
2875
|
categories: SitemapEntry[];
|
|
2863
2876
|
pages: SitemapEntry[];
|
|
2864
2877
|
}
|
|
2878
|
+
/** Result of `cart.claimLink(token)`: the updated cart plus what the link did. */
|
|
2879
|
+
interface CartLinkClaimed extends Cart {
|
|
2880
|
+
/** New anonymous cart session (the SDK stores it automatically). */
|
|
2881
|
+
newSessionToken?: string;
|
|
2882
|
+
/** Products from the link that can no longer be bought and were skipped. */
|
|
2883
|
+
linkSkippedItems: number;
|
|
2884
|
+
/** A discount code carried by the link was applied. */
|
|
2885
|
+
linkDiscountApplied: boolean;
|
|
2886
|
+
linkDiscountCode: string | null;
|
|
2887
|
+
}
|
|
2865
2888
|
|
|
2866
2889
|
declare class BehioStorefront {
|
|
2867
2890
|
private baseUrl;
|
|
@@ -3360,6 +3383,17 @@ declare class CartModule {
|
|
|
3360
3383
|
merge(): Promise<SdkResult<Cart>>;
|
|
3361
3384
|
/** Apply discount code */
|
|
3362
3385
|
applyDiscount(code: string): Promise<SdkResult<Cart>>;
|
|
3386
|
+
/**
|
|
3387
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
3388
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
3389
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
3390
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
3391
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
3392
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
3393
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
3394
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
3395
|
+
*/
|
|
3396
|
+
claimLink(token: string): Promise<SdkResult<CartLinkClaimed>>;
|
|
3363
3397
|
/** Remove discount code */
|
|
3364
3398
|
removeDiscount(): Promise<SdkResult<Cart>>;
|
|
3365
3399
|
}
|
package/dist/react.d.ts
CHANGED
|
@@ -628,6 +628,19 @@ interface ProductListItem {
|
|
|
628
628
|
* never turn it on.
|
|
629
629
|
*/
|
|
630
630
|
variantsOnly: boolean;
|
|
631
|
+
/**
|
|
632
|
+
* One of a kind (handmade original, SDK 2.5): exactly one piece exists and it
|
|
633
|
+
* is never restocked. While available, show it as a one-off (the server label
|
|
634
|
+
* already says so in `availability.label`) and hide the quantity stepper.
|
|
635
|
+
* Once sold, `soldAt` is set, `availability.label` reads "Sold" and the
|
|
636
|
+
* product is not purchasable: never offer back-in-stock watching (the server
|
|
637
|
+
* refuses it), offer "I want a similar one" instead. The merchant decides
|
|
638
|
+
* whether sold originals stay listed (N days, forever) or disappear at once;
|
|
639
|
+
* in the last case the product page returns 404.
|
|
640
|
+
*/
|
|
641
|
+
isUnique: boolean;
|
|
642
|
+
/** When the one-of-a-kind piece sold (epoch ms); null while available. */
|
|
643
|
+
soldAt: number | null;
|
|
631
644
|
/**
|
|
632
645
|
* "From" price: the CHEAPEST variant price, in the requested currency, or
|
|
633
646
|
* null when the product has no variants (or prices are gated behind login in
|
|
@@ -2862,6 +2875,16 @@ interface Sitemap {
|
|
|
2862
2875
|
categories: SitemapEntry[];
|
|
2863
2876
|
pages: SitemapEntry[];
|
|
2864
2877
|
}
|
|
2878
|
+
/** Result of `cart.claimLink(token)`: the updated cart plus what the link did. */
|
|
2879
|
+
interface CartLinkClaimed extends Cart {
|
|
2880
|
+
/** New anonymous cart session (the SDK stores it automatically). */
|
|
2881
|
+
newSessionToken?: string;
|
|
2882
|
+
/** Products from the link that can no longer be bought and were skipped. */
|
|
2883
|
+
linkSkippedItems: number;
|
|
2884
|
+
/** A discount code carried by the link was applied. */
|
|
2885
|
+
linkDiscountApplied: boolean;
|
|
2886
|
+
linkDiscountCode: string | null;
|
|
2887
|
+
}
|
|
2865
2888
|
|
|
2866
2889
|
declare class BehioStorefront {
|
|
2867
2890
|
private baseUrl;
|
|
@@ -3360,6 +3383,17 @@ declare class CartModule {
|
|
|
3360
3383
|
merge(): Promise<SdkResult<Cart>>;
|
|
3361
3384
|
/** Apply discount code */
|
|
3362
3385
|
applyDiscount(code: string): Promise<SdkResult<Cart>>;
|
|
3386
|
+
/**
|
|
3387
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
3388
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
3389
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
3390
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
3391
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
3392
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
3393
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
3394
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
3395
|
+
*/
|
|
3396
|
+
claimLink(token: string): Promise<SdkResult<CartLinkClaimed>>;
|
|
3363
3397
|
/** Remove discount code */
|
|
3364
3398
|
removeDiscount(): Promise<SdkResult<Cart>>;
|
|
3365
3399
|
}
|
package/dist/react.js
CHANGED
|
@@ -1380,6 +1380,25 @@ var CartModule = class {
|
|
|
1380
1380
|
this.client.emit("cart:updated", res.data);
|
|
1381
1381
|
return res;
|
|
1382
1382
|
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
1385
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
1386
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
1387
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
1388
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
1389
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
1390
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
1391
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
1392
|
+
*/
|
|
1393
|
+
async claimLink(token) {
|
|
1394
|
+
const res = await this.client.request("POST", `/cart/links/${encodeURIComponent(token)}/claim`, {});
|
|
1395
|
+
if (res.error) return res;
|
|
1396
|
+
if (res.data.newSessionToken) {
|
|
1397
|
+
this.client.setCartSession(res.data.newSessionToken);
|
|
1398
|
+
}
|
|
1399
|
+
this.client.emit("cart:updated", res.data);
|
|
1400
|
+
return res;
|
|
1401
|
+
}
|
|
1383
1402
|
/** Remove discount code */
|
|
1384
1403
|
async removeDiscount() {
|
|
1385
1404
|
const res = await this.client.request("DELETE", "/cart/discount");
|
package/dist/react.mjs
CHANGED
|
@@ -1270,6 +1270,25 @@ var CartModule = class {
|
|
|
1270
1270
|
this.client.emit("cart:updated", res.data);
|
|
1271
1271
|
return res;
|
|
1272
1272
|
}
|
|
1273
|
+
/**
|
|
1274
|
+
* Add the products of a prepared cart link to the visitor's cart (SDK 2.4).
|
|
1275
|
+
* Behio Chat creates these links when the AI assembles a cart for the
|
|
1276
|
+
* visitor; the storefront handles `/cart/link/<token>`, calls this on the
|
|
1277
|
+
* server (Server Action or route handler, so the session cookie can be
|
|
1278
|
+
* written) and redirects to checkout. Items are ADDED, never replacing the
|
|
1279
|
+
* cart; opening the link twice does not double quantities. A discount code
|
|
1280
|
+
* carried by the link is applied with the normal validation. An expired or
|
|
1281
|
+
* unknown link fails with `be.storefront.cartLinkExpired` (404).
|
|
1282
|
+
*/
|
|
1283
|
+
async claimLink(token) {
|
|
1284
|
+
const res = await this.client.request("POST", `/cart/links/${encodeURIComponent(token)}/claim`, {});
|
|
1285
|
+
if (res.error) return res;
|
|
1286
|
+
if (res.data.newSessionToken) {
|
|
1287
|
+
this.client.setCartSession(res.data.newSessionToken);
|
|
1288
|
+
}
|
|
1289
|
+
this.client.emit("cart:updated", res.data);
|
|
1290
|
+
return res;
|
|
1291
|
+
}
|
|
1273
1292
|
/** Remove discount code */
|
|
1274
1293
|
async removeDiscount() {
|
|
1275
1294
|
const res = await this.client.request("DELETE", "/cart/discount");
|