@behio/storefront-sdk 2.26.0 → 2.28.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-IUC57IOB.js → chunk-IB3DU7B6.js} +16 -0
- package/dist/{chunk-GNWW2O3A.mjs → chunk-VYJLUJXO.mjs} +16 -0
- package/dist/{client-BuL50_BZ.d.mts → client-Bm8Fwcp7.d.mts} +18 -1
- package/dist/{client-BuL50_BZ.d.ts → client-Bm8Fwcp7.d.ts} +18 -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 +25 -0
- package/dist/react.d.ts +25 -0
- package/dist/react.js +33 -2
- package/dist/react.mjs +33 -2
- package/package.json +1 -1
|
@@ -1181,6 +1181,22 @@ var CartModule = class {
|
|
|
1181
1181
|
this.client.emit("cart:updated", res.data);
|
|
1182
1182
|
return res;
|
|
1183
1183
|
}
|
|
1184
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
1185
|
+
async addItems(input) {
|
|
1186
|
+
const res = await this.client.request("POST", "/cart/items/batch", {
|
|
1187
|
+
body: { items: input.items.map((item) => ({ productId: item.productId, quantity: item.quantity, ...item.assignToProductId ? { assignToProductId: item.assignToProductId } : {} })) }
|
|
1188
|
+
});
|
|
1189
|
+
if (res.error) return res;
|
|
1190
|
+
if (res.data.newSessionToken) this.client.setCartSession(res.data.newSessionToken);
|
|
1191
|
+
this.client.emit("cart:updated", res.data);
|
|
1192
|
+
return res;
|
|
1193
|
+
}
|
|
1194
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
1195
|
+
async setAddon(itemId, productId, selected) {
|
|
1196
|
+
const res = await this.client.request("PUT", `/cart/items/${encodeURIComponent(itemId)}/addons/${encodeURIComponent(productId)}`, { body: { selected } });
|
|
1197
|
+
if (!res.error) this.client.emit("cart:updated", res.data);
|
|
1198
|
+
return res;
|
|
1199
|
+
}
|
|
1184
1200
|
/**
|
|
1185
1201
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
1186
1202
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -1181,6 +1181,22 @@ var CartModule = class {
|
|
|
1181
1181
|
this.client.emit("cart:updated", res.data);
|
|
1182
1182
|
return res;
|
|
1183
1183
|
}
|
|
1184
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
1185
|
+
async addItems(input) {
|
|
1186
|
+
const res = await this.client.request("POST", "/cart/items/batch", {
|
|
1187
|
+
body: { items: input.items.map((item) => ({ productId: item.productId, quantity: item.quantity, ...item.assignToProductId ? { assignToProductId: item.assignToProductId } : {} })) }
|
|
1188
|
+
});
|
|
1189
|
+
if (res.error) return res;
|
|
1190
|
+
if (res.data.newSessionToken) this.client.setCartSession(res.data.newSessionToken);
|
|
1191
|
+
this.client.emit("cart:updated", res.data);
|
|
1192
|
+
return res;
|
|
1193
|
+
}
|
|
1194
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
1195
|
+
async setAddon(itemId, productId, selected) {
|
|
1196
|
+
const res = await this.client.request("PUT", `/cart/items/${encodeURIComponent(itemId)}/addons/${encodeURIComponent(productId)}`, { body: { selected } });
|
|
1197
|
+
if (!res.error) this.client.emit("cart:updated", res.data);
|
|
1198
|
+
return res;
|
|
1199
|
+
}
|
|
1184
1200
|
/**
|
|
1185
1201
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
1186
1202
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -1370,6 +1370,11 @@ interface CartItemProduct {
|
|
|
1370
1370
|
orderQuantityStep?: number | null;
|
|
1371
1371
|
}
|
|
1372
1372
|
interface CartItem {
|
|
1373
|
+
/** Extras allocated to this exact main cart line. Older servers omit it. */
|
|
1374
|
+
addonSelections?: Array<{
|
|
1375
|
+
productId: string;
|
|
1376
|
+
quantity: number;
|
|
1377
|
+
}>;
|
|
1373
1378
|
id: string;
|
|
1374
1379
|
/** A retained row can be unavailable after the merchant changes its offer. */
|
|
1375
1380
|
isPurchasable: boolean;
|
|
@@ -1556,6 +1561,12 @@ interface GiftCardSummary {
|
|
|
1556
1561
|
balance: number;
|
|
1557
1562
|
currency: string;
|
|
1558
1563
|
}
|
|
1564
|
+
/** Atomic multi-product purchase; every product is validated before any line changes. */
|
|
1565
|
+
interface AddToCartItemsInput {
|
|
1566
|
+
items: Array<AddToCartInput & {
|
|
1567
|
+
assignToProductId?: string;
|
|
1568
|
+
}>;
|
|
1569
|
+
}
|
|
1559
1570
|
interface AddToCartInput {
|
|
1560
1571
|
/**
|
|
1561
1572
|
* Eshop product ID of the sellable unit. A variant is its own eshop product,
|
|
@@ -3973,6 +3984,12 @@ declare class CartModule {
|
|
|
3973
3984
|
addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
|
|
3974
3985
|
newSessionToken?: string;
|
|
3975
3986
|
}>>;
|
|
3987
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
3988
|
+
addItems(input: AddToCartItemsInput): Promise<SdkResult<Cart & {
|
|
3989
|
+
newSessionToken?: string;
|
|
3990
|
+
}>>;
|
|
3991
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
3992
|
+
setAddon(itemId: string, productId: string, selected: boolean): Promise<SdkResult<Cart>>;
|
|
3976
3993
|
/**
|
|
3977
3994
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
3978
3995
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -4620,4 +4637,4 @@ declare function clearCartSummary(): void;
|
|
|
4620
4637
|
/** Publish only authoritative current totals; server cart consumers call this after hydration and revalidation. */
|
|
4621
4638
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
4622
4639
|
|
|
4623
|
-
export { type
|
|
4640
|
+
export { type CartPromotion as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingConfig as D, type BookingCreateInput as E, type BookingCreated as F, type BookingLocale as G, type BookingLocation as H, type BookingManageSlotsQuery as I, type BookingService as J, type BookingSlot as K, type BookingSlots as L, type BookingSlotsQuery as M, type BookingStaff as N, type BookingStatus as O, type ProductDetail as P, type Bundle as Q, type BundleCatalogQuery as R, type SdkResult as S, type BundleItem as T, type Cart as U, type CartBundleLine as V, type CartBundleLineItem as W, type CartDiscount as X, type CartItem as Y, type CartItemProduct as Z, type CartLinkClaimed as _, type ProductVariant as a, type Menu as a$, type CartSummaryEvent as a0, type Category as a1, type CategoryDetail as a2, type CertificateVerification as a3, type CheckoutAddress as a4, type CheckoutInput as a5, type CheckoutPaymentMethod as a6, type CheckoutPreview as a7, type CheckoutResult as a8, type CheckoutSettings as a9, type FacetCategory as aA, type FacetLabel as aB, type FacetPriceRange as aC, type FacetRange as aD, type FacetRatingBucket as aE, type FacetValue as aF, type FacetsResponse as aG, type FilterField as aH, type FulfillmentStatus as aI, FulfillmentStatuses as aJ, type GamificationRefreshResult as aK, type GiftCardBalance as aL, type GiftCardPurchaseInput as aM, type GiftCardPurchaseResult as aN, type GiftCardSummary as aO, type LessonNote as aP, type LessonQuiz as aQ, type LoginInput as aR, type LoyaltyBalance as aS, type LoyaltyNextTier as aT, type LoyaltyProgram as aU, type LoyaltyQuery as aV, type LoyaltyReferralResult as aW, type LoyaltySummary as aX, type LoyaltyTier as aY, type LoyaltyTierPerks as aZ, type LoyaltyTransaction as a_, type CookieConsentInput as aa, type CourseAttachment as ab, type CourseCertificate as ac, type CourseComment as ad, type CourseCommentReply as ae, type CourseCommentsList as af, type CourseDetail as ag, type CourseLesson as ah, type CourseListItem as ai, type CourseModule as aj, type CoursePostedComment as ak, type CourseProgress as al, type CourseTutorMessage as am, type CourseTutorThread as an, type CrossSellItem as ao, type CurrencyDisplayFormat as ap, type CustomerAddress as aq, type CustomerBadge as ar, type CustomerChallenge as as, type CustomerGamification as at, type CustomerGamificationQuery as au, type CustomerProfile as av, type DigitalDownload as aw, type DownloadUrl as ax, type Facet as ay, type FacetAvailability as az, type StorefrontFormFieldError as b, type RequestInterceptor as b$, type MenuItem as b0, type MenuItemRef as b1, type MenuItemType as b2, type MessageResponse as b3, type NewsletterOptInDefault as b4, type NewsletterSubscribeInput as b5, type NewsletterSubscribeResult as b6, type NewsletterUnsubscribeResult as b7, type OrderAccessRequestResponse as b8, type OrderAccessVerifyResponse as b9, type ProductAssetItem as bA, type ProductAvailability as bB, type ProductGroup as bC, type ProductLabel as bD, type ProductListItem as bE, type ProductMedia as bF, type ProductMediaVariant as bG, type ProductParameter as bH, type ProductParameterGroup as bI, type ProductParametersResponse as bJ, type ProductPrice as bK, type ProductPromotionSummary as bL, type ProductReview as bM, type ProductReviewsResponse as bN, type ProductSibling as bO, ProductSort as bP, type ProductSortValue as bQ, type ProductVolumePrice as bR, type ProductsQuery as bS, type QuizAnswerInput as bT, type QuizAnswerResult as bU, type QuizQuestion as bV, type QuizResult as bW, type QuoteItem as bX, type QuoteRequest as bY, type RegisterInput as bZ, type RegisterResult as b_, type OrderDetail as ba, type OrderDiscount as bb, type OrderDocument as bc, type OrderItem as bd, type OrderListItem as be, type OrderPaymentInstructions as bf, type OrderPickupPoint as bg, type OrderShipment as bh, type OrderStatus as bi, type OrderStatusHistory as bj, OrderStatuses as bk, type OrderTracking as bl, type Page as bm, type PageAttachment as bn, type PageDetail as bo, type PaginatedResponse as bp, type PaymentInstrument as bq, type PaymentStatus as br, PaymentStatuses as bs, type PaymentSwift as bt, type PickupPoint as bu, type PickupPointHours as bv, type PickupPointsInput as bw, type PickupWidgetConfig as bx, type PriceDisplay as by, type ProductAssetGroup as bz, type AddToCartInput as c, type WithdrawalWindow as c$, type RequestInterceptorConfig as c0, type ResponseInterceptor as c1, type ResponseInterceptorData as c2, type ReturnRequest as c3, type ReturnRequestItem as c4, type ReturnStatus as c5, type ReturnStatusItem as c6, type ReturnableOrder as c7, type ReturnableOrderItem as c8, type SdkError as c9, type StorefrontFaqGroupSummary as cA, type StorefrontFaqGroups as cB, type StorefrontFaqItem as cC, type StorefrontFaqQuery as cD, type StorefrontForm as cE, type StorefrontFormFieldErrorCode as cF, type StorefrontFormFile as cG, type StorefrontFormSettings as cH, type StorefrontFormSubmitInput as cI, type StorefrontFormSubmitResult as cJ, type StorefrontFormUpload as cK, type SubmitQuoteInput as cL, type SubmitReturnInput as cM, type SubmitReviewInput as cN, type SubmitWithdrawalInput as cO, type Subscription as cP, type SubscriptionAction as cQ, type SubscriptionFrequency as cR, type SubscriptionItem as cS, type SubscriptionStatus as cT, type TaxBreakdownLine as cU, type VariantAxis as cV, type VariantAxisValue as cW, type WishlistItem as cX, type WithdrawalAcknowledgement as cY, type WithdrawalFlag as cZ, type WithdrawalSettings as c_, type ShippingMethodSummary as ca, type ShippingPublicConfig as cb, type ShippingQuote as cc, type ShippingQuoteInput as cd, type ShopAppearance as ce, type ShopCommerce as cf, type ShopInfo as cg, type ShopScript as ch, type ShopScriptPlacement as ci, type ShopScriptType as cj, type ShopScripts as ck, type ShopSeo as cl, type ShopSeoIdentity as cm, type SiteFormField as cn, type SiteFormFieldOption as co, type SiteFormFieldType as cp, type Sitemap as cq, type SitemapEntry as cr, type StockBehavior as cs, type StockMode as ct, type StorefrontCollection as cu, type StorefrontCollectionField as cv, type StorefrontCollectionFieldType as cw, type StorefrontCollectionItem as cx, type StorefrontCollectionQuery as cy, type StorefrontFaqGroup as cz, type AddToCartItemsInput as d, clearCartSummary as d0, err as d1, ok as d2, publishCartSummary as d3, toSdkError as d4, type AddressDetail as e, type AddressSuggestion as f, type AddressType as g, AddressTypes as h, type AuthTokens as i, type BackInStockSubscription as j, type BadgeTone as k, BehioApiError as l, type BehioErrorCode as m, type BehioEventHandler as n, type BehioEventType as o, BehioNetworkError as p, type BehioStorefrontConfig as q, type Blog as r, type BlogPostDetail as s, type BlogPostListItem as t, type BlogPostsPage as u, type BlogPostsQuery as v, type BlogSettings as w, type BlogTag as x, type Booking as y, type BookingCategory as z };
|
|
@@ -1370,6 +1370,11 @@ interface CartItemProduct {
|
|
|
1370
1370
|
orderQuantityStep?: number | null;
|
|
1371
1371
|
}
|
|
1372
1372
|
interface CartItem {
|
|
1373
|
+
/** Extras allocated to this exact main cart line. Older servers omit it. */
|
|
1374
|
+
addonSelections?: Array<{
|
|
1375
|
+
productId: string;
|
|
1376
|
+
quantity: number;
|
|
1377
|
+
}>;
|
|
1373
1378
|
id: string;
|
|
1374
1379
|
/** A retained row can be unavailable after the merchant changes its offer. */
|
|
1375
1380
|
isPurchasable: boolean;
|
|
@@ -1556,6 +1561,12 @@ interface GiftCardSummary {
|
|
|
1556
1561
|
balance: number;
|
|
1557
1562
|
currency: string;
|
|
1558
1563
|
}
|
|
1564
|
+
/** Atomic multi-product purchase; every product is validated before any line changes. */
|
|
1565
|
+
interface AddToCartItemsInput {
|
|
1566
|
+
items: Array<AddToCartInput & {
|
|
1567
|
+
assignToProductId?: string;
|
|
1568
|
+
}>;
|
|
1569
|
+
}
|
|
1559
1570
|
interface AddToCartInput {
|
|
1560
1571
|
/**
|
|
1561
1572
|
* Eshop product ID of the sellable unit. A variant is its own eshop product,
|
|
@@ -3973,6 +3984,12 @@ declare class CartModule {
|
|
|
3973
3984
|
addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
|
|
3974
3985
|
newSessionToken?: string;
|
|
3975
3986
|
}>>;
|
|
3987
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
3988
|
+
addItems(input: AddToCartItemsInput): Promise<SdkResult<Cart & {
|
|
3989
|
+
newSessionToken?: string;
|
|
3990
|
+
}>>;
|
|
3991
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
3992
|
+
setAddon(itemId: string, productId: string, selected: boolean): Promise<SdkResult<Cart>>;
|
|
3976
3993
|
/**
|
|
3977
3994
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
3978
3995
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -4620,4 +4637,4 @@ declare function clearCartSummary(): void;
|
|
|
4620
4637
|
/** Publish only authoritative current totals; server cart consumers call this after hydration and revalidation. */
|
|
4621
4638
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
4622
4639
|
|
|
4623
|
-
export { type
|
|
4640
|
+
export { type CartPromotion as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingConfig as D, type BookingCreateInput as E, type BookingCreated as F, type BookingLocale as G, type BookingLocation as H, type BookingManageSlotsQuery as I, type BookingService as J, type BookingSlot as K, type BookingSlots as L, type BookingSlotsQuery as M, type BookingStaff as N, type BookingStatus as O, type ProductDetail as P, type Bundle as Q, type BundleCatalogQuery as R, type SdkResult as S, type BundleItem as T, type Cart as U, type CartBundleLine as V, type CartBundleLineItem as W, type CartDiscount as X, type CartItem as Y, type CartItemProduct as Z, type CartLinkClaimed as _, type ProductVariant as a, type Menu as a$, type CartSummaryEvent as a0, type Category as a1, type CategoryDetail as a2, type CertificateVerification as a3, type CheckoutAddress as a4, type CheckoutInput as a5, type CheckoutPaymentMethod as a6, type CheckoutPreview as a7, type CheckoutResult as a8, type CheckoutSettings as a9, type FacetCategory as aA, type FacetLabel as aB, type FacetPriceRange as aC, type FacetRange as aD, type FacetRatingBucket as aE, type FacetValue as aF, type FacetsResponse as aG, type FilterField as aH, type FulfillmentStatus as aI, FulfillmentStatuses as aJ, type GamificationRefreshResult as aK, type GiftCardBalance as aL, type GiftCardPurchaseInput as aM, type GiftCardPurchaseResult as aN, type GiftCardSummary as aO, type LessonNote as aP, type LessonQuiz as aQ, type LoginInput as aR, type LoyaltyBalance as aS, type LoyaltyNextTier as aT, type LoyaltyProgram as aU, type LoyaltyQuery as aV, type LoyaltyReferralResult as aW, type LoyaltySummary as aX, type LoyaltyTier as aY, type LoyaltyTierPerks as aZ, type LoyaltyTransaction as a_, type CookieConsentInput as aa, type CourseAttachment as ab, type CourseCertificate as ac, type CourseComment as ad, type CourseCommentReply as ae, type CourseCommentsList as af, type CourseDetail as ag, type CourseLesson as ah, type CourseListItem as ai, type CourseModule as aj, type CoursePostedComment as ak, type CourseProgress as al, type CourseTutorMessage as am, type CourseTutorThread as an, type CrossSellItem as ao, type CurrencyDisplayFormat as ap, type CustomerAddress as aq, type CustomerBadge as ar, type CustomerChallenge as as, type CustomerGamification as at, type CustomerGamificationQuery as au, type CustomerProfile as av, type DigitalDownload as aw, type DownloadUrl as ax, type Facet as ay, type FacetAvailability as az, type StorefrontFormFieldError as b, type RequestInterceptor as b$, type MenuItem as b0, type MenuItemRef as b1, type MenuItemType as b2, type MessageResponse as b3, type NewsletterOptInDefault as b4, type NewsletterSubscribeInput as b5, type NewsletterSubscribeResult as b6, type NewsletterUnsubscribeResult as b7, type OrderAccessRequestResponse as b8, type OrderAccessVerifyResponse as b9, type ProductAssetItem as bA, type ProductAvailability as bB, type ProductGroup as bC, type ProductLabel as bD, type ProductListItem as bE, type ProductMedia as bF, type ProductMediaVariant as bG, type ProductParameter as bH, type ProductParameterGroup as bI, type ProductParametersResponse as bJ, type ProductPrice as bK, type ProductPromotionSummary as bL, type ProductReview as bM, type ProductReviewsResponse as bN, type ProductSibling as bO, ProductSort as bP, type ProductSortValue as bQ, type ProductVolumePrice as bR, type ProductsQuery as bS, type QuizAnswerInput as bT, type QuizAnswerResult as bU, type QuizQuestion as bV, type QuizResult as bW, type QuoteItem as bX, type QuoteRequest as bY, type RegisterInput as bZ, type RegisterResult as b_, type OrderDetail as ba, type OrderDiscount as bb, type OrderDocument as bc, type OrderItem as bd, type OrderListItem as be, type OrderPaymentInstructions as bf, type OrderPickupPoint as bg, type OrderShipment as bh, type OrderStatus as bi, type OrderStatusHistory as bj, OrderStatuses as bk, type OrderTracking as bl, type Page as bm, type PageAttachment as bn, type PageDetail as bo, type PaginatedResponse as bp, type PaymentInstrument as bq, type PaymentStatus as br, PaymentStatuses as bs, type PaymentSwift as bt, type PickupPoint as bu, type PickupPointHours as bv, type PickupPointsInput as bw, type PickupWidgetConfig as bx, type PriceDisplay as by, type ProductAssetGroup as bz, type AddToCartInput as c, type WithdrawalWindow as c$, type RequestInterceptorConfig as c0, type ResponseInterceptor as c1, type ResponseInterceptorData as c2, type ReturnRequest as c3, type ReturnRequestItem as c4, type ReturnStatus as c5, type ReturnStatusItem as c6, type ReturnableOrder as c7, type ReturnableOrderItem as c8, type SdkError as c9, type StorefrontFaqGroupSummary as cA, type StorefrontFaqGroups as cB, type StorefrontFaqItem as cC, type StorefrontFaqQuery as cD, type StorefrontForm as cE, type StorefrontFormFieldErrorCode as cF, type StorefrontFormFile as cG, type StorefrontFormSettings as cH, type StorefrontFormSubmitInput as cI, type StorefrontFormSubmitResult as cJ, type StorefrontFormUpload as cK, type SubmitQuoteInput as cL, type SubmitReturnInput as cM, type SubmitReviewInput as cN, type SubmitWithdrawalInput as cO, type Subscription as cP, type SubscriptionAction as cQ, type SubscriptionFrequency as cR, type SubscriptionItem as cS, type SubscriptionStatus as cT, type TaxBreakdownLine as cU, type VariantAxis as cV, type VariantAxisValue as cW, type WishlistItem as cX, type WithdrawalAcknowledgement as cY, type WithdrawalFlag as cZ, type WithdrawalSettings as c_, type ShippingMethodSummary as ca, type ShippingPublicConfig as cb, type ShippingQuote as cc, type ShippingQuoteInput as cd, type ShopAppearance as ce, type ShopCommerce as cf, type ShopInfo as cg, type ShopScript as ch, type ShopScriptPlacement as ci, type ShopScriptType as cj, type ShopScripts as ck, type ShopSeo as cl, type ShopSeoIdentity as cm, type SiteFormField as cn, type SiteFormFieldOption as co, type SiteFormFieldType as cp, type Sitemap as cq, type SitemapEntry as cr, type StockBehavior as cs, type StockMode as ct, type StorefrontCollection as cu, type StorefrontCollectionField as cv, type StorefrontCollectionFieldType as cw, type StorefrontCollectionItem as cx, type StorefrontCollectionQuery as cy, type StorefrontFaqGroup as cz, type AddToCartItemsInput as d, clearCartSummary as d0, err as d1, ok as d2, publishCartSummary as d3, toSdkError as d4, type AddressDetail as e, type AddressSuggestion as f, type AddressType as g, AddressTypes as h, type AuthTokens as i, type BackInStockSubscription as j, type BadgeTone as k, BehioApiError as l, type BehioErrorCode as m, type BehioEventHandler as n, type BehioEventType as o, BehioNetworkError as p, type BehioStorefrontConfig as q, type Blog as r, type BlogPostDetail as s, type BlogPostListItem as t, type BlogPostsPage as u, type BlogPostsQuery as v, type BlogSettings as w, type BlogTag as x, type Booking as y, type BookingCategory 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
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-Bm8Fwcp7.mjs';
|
|
2
|
+
export { A as ActivePromotion, c as AddToCartInput, d as AddToCartItemsInput, e as AddressDetail, f as AddressSuggestion, g as AddressType, h as AddressTypes, i as AuthTokens, j as BackInStockSubscription, k as BadgeTone, l as BehioApiError, m as BehioErrorCode, n as BehioEventHandler, o as BehioEventType, p as BehioNetworkError, q as BehioStorefrontConfig, r as Blog, s as BlogPostDetail, t as BlogPostListItem, u as BlogPostsPage, v as BlogPostsQuery, w as BlogSettings, x as BlogTag, y as Booking, z as BookingCategory, D as BookingConfig, E as BookingCreateInput, F as BookingCreated, G as BookingLocale, H as BookingLocation, I as BookingManageSlotsQuery, J as BookingService, K as BookingSlot, L as BookingSlots, M as BookingSlotsQuery, N as BookingStaff, O as BookingStatus, Q as Bundle, R as BundleCatalogQuery, T as BundleItem, U as Cart, V as CartBundleLine, W as CartBundleLineItem, X as CartDiscount, Y as CartItem, Z as CartItemProduct, _ as CartLinkClaimed, $ as CartPromotion, a0 as CartSummaryEvent, a1 as Category, a2 as CategoryDetail, a3 as CertificateVerification, a4 as CheckoutAddress, a5 as CheckoutInput, a6 as CheckoutPaymentMethod, a7 as CheckoutPreview, a8 as CheckoutResult, a9 as CheckoutSettings, aa as CookieConsentInput, ab as CourseAttachment, ac as CourseCertificate, ad as CourseComment, ae as CourseCommentReply, af as CourseCommentsList, ag as CourseDetail, ah as CourseLesson, ai as CourseListItem, aj as CourseModule, ak as CoursePostedComment, al as CourseProgress, am as CourseTutorMessage, an as CourseTutorThread, ao as CrossSellItem, ap as CurrencyDisplayFormat, aq as CustomerAddress, ar as CustomerBadge, as as CustomerChallenge, at as CustomerGamification, au as CustomerGamificationQuery, av as CustomerProfile, aw as DigitalDownload, ax as DownloadUrl, ay as Facet, az as FacetAvailability, aA as FacetCategory, aB as FacetLabel, aC as FacetPriceRange, aD as FacetRange, aE as FacetRatingBucket, aF as FacetValue, aG as FacetsResponse, aH as FilterField, aI as FulfillmentStatus, aJ as FulfillmentStatuses, aK as GamificationRefreshResult, aL as GiftCardBalance, aM as GiftCardPurchaseInput, aN as GiftCardPurchaseResult, aO as GiftCardSummary, aP as LessonNote, aQ as LessonQuiz, aR as LoginInput, aS as LoyaltyBalance, aT as LoyaltyNextTier, aU as LoyaltyProgram, aV as LoyaltyQuery, aW as LoyaltyReferralResult, aX as LoyaltySummary, aY as LoyaltyTier, aZ as LoyaltyTierPerks, a_ as LoyaltyTransaction, a$ as Menu, b0 as MenuItem, b1 as MenuItemRef, b2 as MenuItemType, b3 as MessageResponse, b4 as NewsletterOptInDefault, b5 as NewsletterSubscribeInput, b6 as NewsletterSubscribeResult, b7 as NewsletterUnsubscribeResult, b8 as OrderAccessRequestResponse, b9 as OrderAccessVerifyResponse, ba as OrderDetail, bb as OrderDiscount, bc as OrderDocument, bd as OrderItem, be as OrderListItem, bf as OrderPaymentInstructions, bg as OrderPickupPoint, bh as OrderShipment, bi as OrderStatus, bj as OrderStatusHistory, bk as OrderStatuses, bl as OrderTracking, bm as Page, bn as PageAttachment, bo as PageDetail, bp as PaginatedResponse, bq as PaymentInstrument, br as PaymentStatus, bs as PaymentStatuses, bt as PaymentSwift, bu as PickupPoint, bv as PickupPointHours, bw as PickupPointsInput, bx as PickupWidgetConfig, by as PriceDisplay, bz as ProductAssetGroup, bA as ProductAssetItem, bB as ProductAvailability, bC as ProductGroup, bD as ProductLabel, bE as ProductListItem, bF as ProductMedia, bG as ProductMediaVariant, bH as ProductParameter, bI as ProductParameterGroup, bJ as ProductParametersResponse, bK as ProductPrice, bL as ProductPromotionSummary, bM as ProductReview, bN as ProductReviewsResponse, bO as ProductSibling, bP as ProductSort, bQ as ProductSortValue, bR as ProductVolumePrice, bS as ProductsQuery, bT as QuizAnswerInput, bU as QuizAnswerResult, bV as QuizQuestion, bW as QuizResult, bX as QuoteItem, bY as QuoteRequest, bZ as RegisterInput, b_ as RegisterResult, b$ as RequestInterceptor, c0 as RequestInterceptorConfig, c1 as ResponseInterceptor, c2 as ResponseInterceptorData, c3 as ReturnRequest, c4 as ReturnRequestItem, c5 as ReturnStatus, c6 as ReturnStatusItem, c7 as ReturnableOrder, c8 as ReturnableOrderItem, c9 as SdkError, ca as ShippingMethodSummary, cb as ShippingPublicConfig, cc as ShippingQuote, cd as ShippingQuoteInput, ce as ShopAppearance, cf as ShopCommerce, cg as ShopInfo, ch as ShopScript, ci as ShopScriptPlacement, cj as ShopScriptType, ck as ShopScripts, cl as ShopSeo, cm as ShopSeoIdentity, cn as SiteFormField, co as SiteFormFieldOption, cp as SiteFormFieldType, cq as Sitemap, cr as SitemapEntry, cs as StockBehavior, ct as StockMode, cu as StorefrontCollection, cv as StorefrontCollectionField, cw as StorefrontCollectionFieldType, cx as StorefrontCollectionItem, cy as StorefrontCollectionQuery, cz as StorefrontFaqGroup, cA as StorefrontFaqGroupSummary, cB as StorefrontFaqGroups, cC as StorefrontFaqItem, cD as StorefrontFaqQuery, cE as StorefrontForm, cF as StorefrontFormFieldErrorCode, cG as StorefrontFormFile, cH as StorefrontFormSettings, cI as StorefrontFormSubmitInput, cJ as StorefrontFormSubmitResult, cK as StorefrontFormUpload, cL as SubmitQuoteInput, cM as SubmitReturnInput, cN as SubmitReviewInput, cO as SubmitWithdrawalInput, cP as Subscription, cQ as SubscriptionAction, cR as SubscriptionFrequency, cS as SubscriptionItem, cT as SubscriptionStatus, cU as TaxBreakdownLine, cV as VariantAxis, cW as VariantAxisValue, cX as WishlistItem, cY as WithdrawalAcknowledgement, cZ as WithdrawalFlag, c_ as WithdrawalSettings, c$ as WithdrawalWindow, d0 as clearCartSummary, d1 as err, d2 as ok, d3 as publishCartSummary, d4 as toSdkError } from './client-Bm8Fwcp7.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
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError } from './client-Bm8Fwcp7.js';
|
|
2
|
+
export { A as ActivePromotion, c as AddToCartInput, d as AddToCartItemsInput, e as AddressDetail, f as AddressSuggestion, g as AddressType, h as AddressTypes, i as AuthTokens, j as BackInStockSubscription, k as BadgeTone, l as BehioApiError, m as BehioErrorCode, n as BehioEventHandler, o as BehioEventType, p as BehioNetworkError, q as BehioStorefrontConfig, r as Blog, s as BlogPostDetail, t as BlogPostListItem, u as BlogPostsPage, v as BlogPostsQuery, w as BlogSettings, x as BlogTag, y as Booking, z as BookingCategory, D as BookingConfig, E as BookingCreateInput, F as BookingCreated, G as BookingLocale, H as BookingLocation, I as BookingManageSlotsQuery, J as BookingService, K as BookingSlot, L as BookingSlots, M as BookingSlotsQuery, N as BookingStaff, O as BookingStatus, Q as Bundle, R as BundleCatalogQuery, T as BundleItem, U as Cart, V as CartBundleLine, W as CartBundleLineItem, X as CartDiscount, Y as CartItem, Z as CartItemProduct, _ as CartLinkClaimed, $ as CartPromotion, a0 as CartSummaryEvent, a1 as Category, a2 as CategoryDetail, a3 as CertificateVerification, a4 as CheckoutAddress, a5 as CheckoutInput, a6 as CheckoutPaymentMethod, a7 as CheckoutPreview, a8 as CheckoutResult, a9 as CheckoutSettings, aa as CookieConsentInput, ab as CourseAttachment, ac as CourseCertificate, ad as CourseComment, ae as CourseCommentReply, af as CourseCommentsList, ag as CourseDetail, ah as CourseLesson, ai as CourseListItem, aj as CourseModule, ak as CoursePostedComment, al as CourseProgress, am as CourseTutorMessage, an as CourseTutorThread, ao as CrossSellItem, ap as CurrencyDisplayFormat, aq as CustomerAddress, ar as CustomerBadge, as as CustomerChallenge, at as CustomerGamification, au as CustomerGamificationQuery, av as CustomerProfile, aw as DigitalDownload, ax as DownloadUrl, ay as Facet, az as FacetAvailability, aA as FacetCategory, aB as FacetLabel, aC as FacetPriceRange, aD as FacetRange, aE as FacetRatingBucket, aF as FacetValue, aG as FacetsResponse, aH as FilterField, aI as FulfillmentStatus, aJ as FulfillmentStatuses, aK as GamificationRefreshResult, aL as GiftCardBalance, aM as GiftCardPurchaseInput, aN as GiftCardPurchaseResult, aO as GiftCardSummary, aP as LessonNote, aQ as LessonQuiz, aR as LoginInput, aS as LoyaltyBalance, aT as LoyaltyNextTier, aU as LoyaltyProgram, aV as LoyaltyQuery, aW as LoyaltyReferralResult, aX as LoyaltySummary, aY as LoyaltyTier, aZ as LoyaltyTierPerks, a_ as LoyaltyTransaction, a$ as Menu, b0 as MenuItem, b1 as MenuItemRef, b2 as MenuItemType, b3 as MessageResponse, b4 as NewsletterOptInDefault, b5 as NewsletterSubscribeInput, b6 as NewsletterSubscribeResult, b7 as NewsletterUnsubscribeResult, b8 as OrderAccessRequestResponse, b9 as OrderAccessVerifyResponse, ba as OrderDetail, bb as OrderDiscount, bc as OrderDocument, bd as OrderItem, be as OrderListItem, bf as OrderPaymentInstructions, bg as OrderPickupPoint, bh as OrderShipment, bi as OrderStatus, bj as OrderStatusHistory, bk as OrderStatuses, bl as OrderTracking, bm as Page, bn as PageAttachment, bo as PageDetail, bp as PaginatedResponse, bq as PaymentInstrument, br as PaymentStatus, bs as PaymentStatuses, bt as PaymentSwift, bu as PickupPoint, bv as PickupPointHours, bw as PickupPointsInput, bx as PickupWidgetConfig, by as PriceDisplay, bz as ProductAssetGroup, bA as ProductAssetItem, bB as ProductAvailability, bC as ProductGroup, bD as ProductLabel, bE as ProductListItem, bF as ProductMedia, bG as ProductMediaVariant, bH as ProductParameter, bI as ProductParameterGroup, bJ as ProductParametersResponse, bK as ProductPrice, bL as ProductPromotionSummary, bM as ProductReview, bN as ProductReviewsResponse, bO as ProductSibling, bP as ProductSort, bQ as ProductSortValue, bR as ProductVolumePrice, bS as ProductsQuery, bT as QuizAnswerInput, bU as QuizAnswerResult, bV as QuizQuestion, bW as QuizResult, bX as QuoteItem, bY as QuoteRequest, bZ as RegisterInput, b_ as RegisterResult, b$ as RequestInterceptor, c0 as RequestInterceptorConfig, c1 as ResponseInterceptor, c2 as ResponseInterceptorData, c3 as ReturnRequest, c4 as ReturnRequestItem, c5 as ReturnStatus, c6 as ReturnStatusItem, c7 as ReturnableOrder, c8 as ReturnableOrderItem, c9 as SdkError, ca as ShippingMethodSummary, cb as ShippingPublicConfig, cc as ShippingQuote, cd as ShippingQuoteInput, ce as ShopAppearance, cf as ShopCommerce, cg as ShopInfo, ch as ShopScript, ci as ShopScriptPlacement, cj as ShopScriptType, ck as ShopScripts, cl as ShopSeo, cm as ShopSeoIdentity, cn as SiteFormField, co as SiteFormFieldOption, cp as SiteFormFieldType, cq as Sitemap, cr as SitemapEntry, cs as StockBehavior, ct as StockMode, cu as StorefrontCollection, cv as StorefrontCollectionField, cw as StorefrontCollectionFieldType, cx as StorefrontCollectionItem, cy as StorefrontCollectionQuery, cz as StorefrontFaqGroup, cA as StorefrontFaqGroupSummary, cB as StorefrontFaqGroups, cC as StorefrontFaqItem, cD as StorefrontFaqQuery, cE as StorefrontForm, cF as StorefrontFormFieldErrorCode, cG as StorefrontFormFile, cH as StorefrontFormSettings, cI as StorefrontFormSubmitInput, cJ as StorefrontFormSubmitResult, cK as StorefrontFormUpload, cL as SubmitQuoteInput, cM as SubmitReturnInput, cN as SubmitReviewInput, cO as SubmitWithdrawalInput, cP as Subscription, cQ as SubscriptionAction, cR as SubscriptionFrequency, cS as SubscriptionItem, cT as SubscriptionStatus, cU as TaxBreakdownLine, cV as VariantAxis, cW as VariantAxisValue, cX as WishlistItem, cY as WithdrawalAcknowledgement, cZ as WithdrawalFlag, c_ as WithdrawalSettings, c$ as WithdrawalWindow, d0 as clearCartSummary, d1 as err, d2 as ok, d3 as publishCartSummary, d4 as toSdkError } from './client-Bm8Fwcp7.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Format a price amount with currency using Intl.NumberFormat.
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkIB3DU7B6js = require('./chunk-IB3DU7B6.js');
|
|
16
16
|
|
|
17
17
|
// src/react/utils/format-price.ts
|
|
18
18
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -1106,7 +1106,7 @@ var GENERIC = {
|
|
|
1106
1106
|
en: "Something went wrong, please try again."
|
|
1107
1107
|
};
|
|
1108
1108
|
function bodyOf(err2) {
|
|
1109
|
-
const body = err2 instanceof
|
|
1109
|
+
const body = err2 instanceof _chunkIB3DU7B6js.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
|
|
1110
1110
|
return body && typeof body === "object" ? body : null;
|
|
1111
1111
|
}
|
|
1112
1112
|
function errorCode(err2) {
|
|
@@ -1223,4 +1223,4 @@ function formFieldErrors(err2) {
|
|
|
1223
1223
|
|
|
1224
1224
|
|
|
1225
1225
|
|
|
1226
|
-
exports.AddressTypes =
|
|
1226
|
+
exports.AddressTypes = _chunkIB3DU7B6js.AddressTypes; exports.BehioApiError = _chunkIB3DU7B6js.BehioApiError; exports.BehioNetworkError = _chunkIB3DU7B6js.BehioNetworkError; exports.BehioStorefront = _chunkIB3DU7B6js.BehioStorefront; exports.FulfillmentStatuses = _chunkIB3DU7B6js.FulfillmentStatuses; exports.OrderStatuses = _chunkIB3DU7B6js.OrderStatuses; exports.PaymentStatuses = _chunkIB3DU7B6js.PaymentStatuses; exports.ProductSort = _chunkIB3DU7B6js.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.clearCartSummary = _chunkIB3DU7B6js.clearCartSummary; exports.err = _chunkIB3DU7B6js.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 = _chunkIB3DU7B6js.ok; exports.publishCartSummary = _chunkIB3DU7B6js.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkIB3DU7B6js.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 {
|
|
1
|
+
import { q as BehioStorefrontConfig, B as BehioStorefront } from './client-Bm8Fwcp7.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 {
|
|
1
|
+
import { q as BehioStorefrontConfig, B as BehioStorefront } from './client-Bm8Fwcp7.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 _chunkIB3DU7B6js = require('./chunk-IB3DU7B6.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, _chunkIB3DU7B6js.BehioStorefront)({
|
|
23
23
|
apiKey,
|
|
24
24
|
...baseUrl ? { baseUrl } : {},
|
|
25
25
|
...locale ? { locale } : {},
|
package/dist/next.mjs
CHANGED
package/dist/react.d.mts
CHANGED
|
@@ -1427,6 +1427,11 @@ interface CartItemProduct {
|
|
|
1427
1427
|
orderQuantityStep?: number | null;
|
|
1428
1428
|
}
|
|
1429
1429
|
interface CartItem {
|
|
1430
|
+
/** Extras allocated to this exact main cart line. Older servers omit it. */
|
|
1431
|
+
addonSelections?: Array<{
|
|
1432
|
+
productId: string;
|
|
1433
|
+
quantity: number;
|
|
1434
|
+
}>;
|
|
1430
1435
|
id: string;
|
|
1431
1436
|
/** A retained row can be unavailable after the merchant changes its offer. */
|
|
1432
1437
|
isPurchasable: boolean;
|
|
@@ -1613,6 +1618,12 @@ interface GiftCardSummary {
|
|
|
1613
1618
|
balance: number;
|
|
1614
1619
|
currency: string;
|
|
1615
1620
|
}
|
|
1621
|
+
/** Atomic multi-product purchase; every product is validated before any line changes. */
|
|
1622
|
+
interface AddToCartItemsInput {
|
|
1623
|
+
items: Array<AddToCartInput & {
|
|
1624
|
+
assignToProductId?: string;
|
|
1625
|
+
}>;
|
|
1626
|
+
}
|
|
1616
1627
|
interface AddToCartInput {
|
|
1617
1628
|
/**
|
|
1618
1629
|
* Eshop product ID of the sellable unit. A variant is its own eshop product,
|
|
@@ -4010,6 +4021,12 @@ declare class CartModule {
|
|
|
4010
4021
|
addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
|
|
4011
4022
|
newSessionToken?: string;
|
|
4012
4023
|
}>>;
|
|
4024
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
4025
|
+
addItems(input: AddToCartItemsInput): Promise<SdkResult<Cart & {
|
|
4026
|
+
newSessionToken?: string;
|
|
4027
|
+
}>>;
|
|
4028
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
4029
|
+
setAddon(itemId: string, productId: string, selected: boolean): Promise<SdkResult<Cart>>;
|
|
4013
4030
|
/**
|
|
4014
4031
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
4015
4032
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -4819,6 +4836,14 @@ declare function useCart(options?: UseCartOptions): {
|
|
|
4819
4836
|
addItem: (productId: string, quantity?: number) => Promise<Cart & {
|
|
4820
4837
|
newSessionToken?: string;
|
|
4821
4838
|
}>;
|
|
4839
|
+
addItems: _tanstack_react_query.UseMutateAsyncFunction<Cart & {
|
|
4840
|
+
newSessionToken?: string;
|
|
4841
|
+
}, Error, AddToCartItemsInput, void>;
|
|
4842
|
+
setAddon: _tanstack_react_query.UseMutateAsyncFunction<Cart, Error, {
|
|
4843
|
+
itemId: string;
|
|
4844
|
+
productId: string;
|
|
4845
|
+
selected: boolean;
|
|
4846
|
+
}, void>;
|
|
4822
4847
|
updateQuantity: (itemId: string, quantity: number) => Promise<Cart>;
|
|
4823
4848
|
removeItem: (itemId: string) => Promise<Cart>;
|
|
4824
4849
|
clear: () => Promise<void>;
|
package/dist/react.d.ts
CHANGED
|
@@ -1427,6 +1427,11 @@ interface CartItemProduct {
|
|
|
1427
1427
|
orderQuantityStep?: number | null;
|
|
1428
1428
|
}
|
|
1429
1429
|
interface CartItem {
|
|
1430
|
+
/** Extras allocated to this exact main cart line. Older servers omit it. */
|
|
1431
|
+
addonSelections?: Array<{
|
|
1432
|
+
productId: string;
|
|
1433
|
+
quantity: number;
|
|
1434
|
+
}>;
|
|
1430
1435
|
id: string;
|
|
1431
1436
|
/** A retained row can be unavailable after the merchant changes its offer. */
|
|
1432
1437
|
isPurchasable: boolean;
|
|
@@ -1613,6 +1618,12 @@ interface GiftCardSummary {
|
|
|
1613
1618
|
balance: number;
|
|
1614
1619
|
currency: string;
|
|
1615
1620
|
}
|
|
1621
|
+
/** Atomic multi-product purchase; every product is validated before any line changes. */
|
|
1622
|
+
interface AddToCartItemsInput {
|
|
1623
|
+
items: Array<AddToCartInput & {
|
|
1624
|
+
assignToProductId?: string;
|
|
1625
|
+
}>;
|
|
1626
|
+
}
|
|
1616
1627
|
interface AddToCartInput {
|
|
1617
1628
|
/**
|
|
1618
1629
|
* Eshop product ID of the sellable unit. A variant is its own eshop product,
|
|
@@ -4010,6 +4021,12 @@ declare class CartModule {
|
|
|
4010
4021
|
addItem(input: AddToCartInput): Promise<SdkResult<Cart & {
|
|
4011
4022
|
newSessionToken?: string;
|
|
4012
4023
|
}>>;
|
|
4024
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
4025
|
+
addItems(input: AddToCartItemsInput): Promise<SdkResult<Cart & {
|
|
4026
|
+
newSessionToken?: string;
|
|
4027
|
+
}>>;
|
|
4028
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
4029
|
+
setAddon(itemId: string, productId: string, selected: boolean): Promise<SdkResult<Cart>>;
|
|
4013
4030
|
/**
|
|
4014
4031
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
4015
4032
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -4819,6 +4836,14 @@ declare function useCart(options?: UseCartOptions): {
|
|
|
4819
4836
|
addItem: (productId: string, quantity?: number) => Promise<Cart & {
|
|
4820
4837
|
newSessionToken?: string;
|
|
4821
4838
|
}>;
|
|
4839
|
+
addItems: _tanstack_react_query.UseMutateAsyncFunction<Cart & {
|
|
4840
|
+
newSessionToken?: string;
|
|
4841
|
+
}, Error, AddToCartItemsInput, void>;
|
|
4842
|
+
setAddon: _tanstack_react_query.UseMutateAsyncFunction<Cart, Error, {
|
|
4843
|
+
itemId: string;
|
|
4844
|
+
productId: string;
|
|
4845
|
+
selected: boolean;
|
|
4846
|
+
}, void>;
|
|
4822
4847
|
updateQuantity: (itemId: string, quantity: number) => Promise<Cart>;
|
|
4823
4848
|
removeItem: (itemId: string) => Promise<Cart>;
|
|
4824
4849
|
clear: () => Promise<void>;
|
package/dist/react.js
CHANGED
|
@@ -1273,6 +1273,22 @@ var CartModule = class {
|
|
|
1273
1273
|
this.client.emit("cart:updated", res.data);
|
|
1274
1274
|
return res;
|
|
1275
1275
|
}
|
|
1276
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
1277
|
+
async addItems(input) {
|
|
1278
|
+
const res = await this.client.request("POST", "/cart/items/batch", {
|
|
1279
|
+
body: { items: input.items.map((item) => ({ productId: item.productId, quantity: item.quantity, ...item.assignToProductId ? { assignToProductId: item.assignToProductId } : {} })) }
|
|
1280
|
+
});
|
|
1281
|
+
if (res.error) return res;
|
|
1282
|
+
if (res.data.newSessionToken) this.client.setCartSession(res.data.newSessionToken);
|
|
1283
|
+
this.client.emit("cart:updated", res.data);
|
|
1284
|
+
return res;
|
|
1285
|
+
}
|
|
1286
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
1287
|
+
async setAddon(itemId, productId, selected) {
|
|
1288
|
+
const res = await this.client.request("PUT", `/cart/items/${encodeURIComponent(itemId)}/addons/${encodeURIComponent(productId)}`, { body: { selected } });
|
|
1289
|
+
if (!res.error) this.client.emit("cart:updated", res.data);
|
|
1290
|
+
return res;
|
|
1291
|
+
}
|
|
1276
1292
|
/**
|
|
1277
1293
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
1278
1294
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -2952,6 +2968,19 @@ function useCart(options) {
|
|
|
2952
2968
|
await acceptCart(result);
|
|
2953
2969
|
}
|
|
2954
2970
|
});
|
|
2971
|
+
const addItemsMutation = (0, import_react_query12.useMutation)({
|
|
2972
|
+
mutationFn: (input) => unwrap(client.cart.addItems(input)),
|
|
2973
|
+
onMutate: cancelCartRead,
|
|
2974
|
+
onSuccess: async (result) => {
|
|
2975
|
+
if (result.newSessionToken) storage.set(STORAGE_KEYS.CART_SESSION, result.newSessionToken);
|
|
2976
|
+
await acceptCart(result);
|
|
2977
|
+
}
|
|
2978
|
+
});
|
|
2979
|
+
const setAddonMutation = (0, import_react_query12.useMutation)({
|
|
2980
|
+
mutationFn: ({ itemId, productId, selected }) => unwrap(client.cart.setAddon(itemId, productId, selected)),
|
|
2981
|
+
onMutate: cancelCartRead,
|
|
2982
|
+
onSuccess: acceptCart
|
|
2983
|
+
});
|
|
2955
2984
|
const updateMutation = (0, import_react_query12.useMutation)({
|
|
2956
2985
|
mutationFn: async ({ itemId, quantity }) => {
|
|
2957
2986
|
return unwrap(client.cart.updateQuantity(itemId, quantity));
|
|
@@ -3070,6 +3099,8 @@ function useCart(options) {
|
|
|
3070
3099
|
error,
|
|
3071
3100
|
// Actions
|
|
3072
3101
|
addItem,
|
|
3102
|
+
addItems: addItemsMutation.mutateAsync,
|
|
3103
|
+
setAddon: setAddonMutation.mutateAsync,
|
|
3073
3104
|
updateQuantity,
|
|
3074
3105
|
removeItem,
|
|
3075
3106
|
clear,
|
|
@@ -3083,8 +3114,8 @@ function useCart(options) {
|
|
|
3083
3114
|
itemCount: cart?.itemCount ?? 0,
|
|
3084
3115
|
isEmpty: !cart || cart.items.length === 0 && (cart.bundleLines?.length ?? 0) === 0,
|
|
3085
3116
|
// Mutation states
|
|
3086
|
-
isAdding: addMutation.isPending,
|
|
3087
|
-
isUpdating: updateMutation.isPending,
|
|
3117
|
+
isAdding: addMutation.isPending || addItemsMutation.isPending,
|
|
3118
|
+
isUpdating: updateMutation.isPending || setAddonMutation.isPending,
|
|
3088
3119
|
isRemoving: removeMutation.isPending,
|
|
3089
3120
|
isUpdatingBundle: addBundleMutation.isPending || updateBundleMutation.isPending || removeBundleMutation.isPending
|
|
3090
3121
|
};
|
package/dist/react.mjs
CHANGED
|
@@ -1150,6 +1150,22 @@ var CartModule = class {
|
|
|
1150
1150
|
this.client.emit("cart:updated", res.data);
|
|
1151
1151
|
return res;
|
|
1152
1152
|
}
|
|
1153
|
+
/** Add the complete selection atomically. Invalid/unavailable lines leave the cart unchanged. */
|
|
1154
|
+
async addItems(input) {
|
|
1155
|
+
const res = await this.client.request("POST", "/cart/items/batch", {
|
|
1156
|
+
body: { items: input.items.map((item) => ({ productId: item.productId, quantity: item.quantity, ...item.assignToProductId ? { assignToProductId: item.assignToProductId } : {} })) }
|
|
1157
|
+
});
|
|
1158
|
+
if (res.error) return res;
|
|
1159
|
+
if (res.data.newSessionToken) this.client.setCartSession(res.data.newSessionToken);
|
|
1160
|
+
this.client.emit("cart:updated", res.data);
|
|
1161
|
+
return res;
|
|
1162
|
+
}
|
|
1163
|
+
/** Idempotent selection of one extra package for a particular main cart line. */
|
|
1164
|
+
async setAddon(itemId, productId, selected) {
|
|
1165
|
+
const res = await this.client.request("PUT", `/cart/items/${encodeURIComponent(itemId)}/addons/${encodeURIComponent(productId)}`, { body: { selected } });
|
|
1166
|
+
if (!res.error) this.client.emit("cart:updated", res.data);
|
|
1167
|
+
return res;
|
|
1168
|
+
}
|
|
1153
1169
|
/**
|
|
1154
1170
|
* Switch the CART currency server-side. The backend re-prices every line in
|
|
1155
1171
|
* the new currency (no FX conversion: a product must have a price configured
|
|
@@ -2829,6 +2845,19 @@ function useCart(options) {
|
|
|
2829
2845
|
await acceptCart(result);
|
|
2830
2846
|
}
|
|
2831
2847
|
});
|
|
2848
|
+
const addItemsMutation = useMutation({
|
|
2849
|
+
mutationFn: (input) => unwrap(client.cart.addItems(input)),
|
|
2850
|
+
onMutate: cancelCartRead,
|
|
2851
|
+
onSuccess: async (result) => {
|
|
2852
|
+
if (result.newSessionToken) storage.set(STORAGE_KEYS.CART_SESSION, result.newSessionToken);
|
|
2853
|
+
await acceptCart(result);
|
|
2854
|
+
}
|
|
2855
|
+
});
|
|
2856
|
+
const setAddonMutation = useMutation({
|
|
2857
|
+
mutationFn: ({ itemId, productId, selected }) => unwrap(client.cart.setAddon(itemId, productId, selected)),
|
|
2858
|
+
onMutate: cancelCartRead,
|
|
2859
|
+
onSuccess: acceptCart
|
|
2860
|
+
});
|
|
2832
2861
|
const updateMutation = useMutation({
|
|
2833
2862
|
mutationFn: async ({ itemId, quantity }) => {
|
|
2834
2863
|
return unwrap(client.cart.updateQuantity(itemId, quantity));
|
|
@@ -2947,6 +2976,8 @@ function useCart(options) {
|
|
|
2947
2976
|
error,
|
|
2948
2977
|
// Actions
|
|
2949
2978
|
addItem,
|
|
2979
|
+
addItems: addItemsMutation.mutateAsync,
|
|
2980
|
+
setAddon: setAddonMutation.mutateAsync,
|
|
2950
2981
|
updateQuantity,
|
|
2951
2982
|
removeItem,
|
|
2952
2983
|
clear,
|
|
@@ -2960,8 +2991,8 @@ function useCart(options) {
|
|
|
2960
2991
|
itemCount: cart?.itemCount ?? 0,
|
|
2961
2992
|
isEmpty: !cart || cart.items.length === 0 && (cart.bundleLines?.length ?? 0) === 0,
|
|
2962
2993
|
// Mutation states
|
|
2963
|
-
isAdding: addMutation.isPending,
|
|
2964
|
-
isUpdating: updateMutation.isPending,
|
|
2994
|
+
isAdding: addMutation.isPending || addItemsMutation.isPending,
|
|
2995
|
+
isUpdating: updateMutation.isPending || setAddonMutation.isPending,
|
|
2965
2996
|
isRemoving: removeMutation.isPending,
|
|
2966
2997
|
isUpdatingBundle: addBundleMutation.isPending || updateBundleMutation.isPending || removeBundleMutation.isPending
|
|
2967
2998
|
};
|