@behio/storefront-sdk 2.30.0 → 2.32.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-OUPCGMSR.js → chunk-ESGGBGDU.js} +37 -6
- package/dist/{chunk-25UM2XCS.mjs → chunk-RRYPFOL7.mjs} +37 -6
- package/dist/{client-DtAz0rDJ.d.mts → client-Bpefn9PP.d.mts} +24 -6
- package/dist/{client-DtAz0rDJ.d.ts → client-Bpefn9PP.d.ts} +24 -6
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +5 -3
- package/dist/index.mjs +4 -2
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +5 -6
- package/dist/next.mjs +4 -5
- package/dist/react.d.mts +26 -8
- package/dist/react.d.ts +26 -8
- package/dist/react.js +27 -11
- package/dist/react.mjs +27 -11
- package/package.json +1 -1
|
@@ -1957,14 +1957,15 @@ var FormsModule = class {
|
|
|
1957
1957
|
this.client = client;
|
|
1958
1958
|
}
|
|
1959
1959
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
1960
|
-
async placements() {
|
|
1961
|
-
return this.client.request("GET", "/forms");
|
|
1960
|
+
async placements(locale) {
|
|
1961
|
+
return this.client.request("GET", "/forms", { query: { locale } });
|
|
1962
1962
|
}
|
|
1963
1963
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
1964
|
-
async get(slug) {
|
|
1964
|
+
async get(slug, locale) {
|
|
1965
1965
|
return this.client.request(
|
|
1966
1966
|
"GET",
|
|
1967
|
-
`/forms/${encodeURIComponent(slug)}
|
|
1967
|
+
`/forms/${encodeURIComponent(slug)}`,
|
|
1968
|
+
{ query: { locale } }
|
|
1968
1969
|
);
|
|
1969
1970
|
}
|
|
1970
1971
|
/**
|
|
@@ -2326,12 +2327,23 @@ var NewsletterModule = class {
|
|
|
2326
2327
|
auth: false
|
|
2327
2328
|
});
|
|
2328
2329
|
}
|
|
2330
|
+
/**
|
|
2331
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
2332
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
2333
|
+
*/
|
|
2329
2334
|
async unsubscribe(email) {
|
|
2335
|
+
return this.requestUnsubscribe({ email });
|
|
2336
|
+
}
|
|
2337
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
2338
|
+
async unsubscribeWithToken(token) {
|
|
2339
|
+
return this.requestUnsubscribe({ token });
|
|
2340
|
+
}
|
|
2341
|
+
requestUnsubscribe(input) {
|
|
2330
2342
|
return this.client.request(
|
|
2331
2343
|
"POST",
|
|
2332
2344
|
"/newsletter/unsubscribe",
|
|
2333
2345
|
{
|
|
2334
|
-
body:
|
|
2346
|
+
body: input,
|
|
2335
2347
|
auth: false
|
|
2336
2348
|
}
|
|
2337
2349
|
);
|
|
@@ -2379,6 +2391,25 @@ function emitCartEvent(data) {
|
|
|
2379
2391
|
publishCartSummary({ total: cart.grandTotal, currency: typeof cart.currency === "string" ? cart.currency : null, itemCount: cart.itemCount });
|
|
2380
2392
|
}
|
|
2381
2393
|
|
|
2394
|
+
// src/visitor-ip.ts
|
|
2395
|
+
var IP_SHAPE = /^[0-9a-fA-F:.]{3,45}$/;
|
|
2396
|
+
function ipOf(value) {
|
|
2397
|
+
const trimmed = _optionalChain([value, 'optionalAccess', _58 => _58.trim, 'call', _59 => _59()]);
|
|
2398
|
+
return trimmed && IP_SHAPE.test(trimmed) ? trimmed : void 0;
|
|
2399
|
+
}
|
|
2400
|
+
function sameSecret(given, secret) {
|
|
2401
|
+
if (typeof given !== "string" || given.length !== secret.length) return false;
|
|
2402
|
+
let diff = 0;
|
|
2403
|
+
for (let i = 0; i < secret.length; i++) diff |= given.charCodeAt(i) ^ secret.charCodeAt(i);
|
|
2404
|
+
return diff === 0;
|
|
2405
|
+
}
|
|
2406
|
+
function trustedVisitorIp(headers, originSecret) {
|
|
2407
|
+
const realIp = ipOf(headers.get("x-real-ip"));
|
|
2408
|
+
if (originSecret && !sameSecret(headers.get("x-behio-origin"), originSecret)) return realIp;
|
|
2409
|
+
return _nullishCoalesce(ipOf(headers.get("cf-connecting-ip")), () => ( realIp));
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
|
|
2382
2413
|
|
|
2383
2414
|
|
|
2384
2415
|
|
|
@@ -2393,4 +2424,4 @@ function emitCartEvent(data) {
|
|
|
2393
2424
|
|
|
2394
2425
|
|
|
2395
2426
|
|
|
2396
|
-
exports.ProductSort = ProductSort; exports.OrderStatuses = OrderStatuses; exports.PaymentStatuses = PaymentStatuses; exports.FulfillmentStatuses = FulfillmentStatuses; exports.AddressTypes = AddressTypes; exports.BehioApiError = BehioApiError; exports.BehioNetworkError = BehioNetworkError; exports.ok = ok; exports.err = err; exports.toSdkError = toSdkError; exports.BehioStorefront = BehioStorefront; exports.clearCartSummary = clearCartSummary; exports.publishCartSummary = publishCartSummary;
|
|
2427
|
+
exports.ProductSort = ProductSort; exports.OrderStatuses = OrderStatuses; exports.PaymentStatuses = PaymentStatuses; exports.FulfillmentStatuses = FulfillmentStatuses; exports.AddressTypes = AddressTypes; exports.BehioApiError = BehioApiError; exports.BehioNetworkError = BehioNetworkError; exports.ok = ok; exports.err = err; exports.toSdkError = toSdkError; exports.BehioStorefront = BehioStorefront; exports.clearCartSummary = clearCartSummary; exports.publishCartSummary = publishCartSummary; exports.trustedVisitorIp = trustedVisitorIp;
|
|
@@ -1957,14 +1957,15 @@ var FormsModule = class {
|
|
|
1957
1957
|
this.client = client;
|
|
1958
1958
|
}
|
|
1959
1959
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
1960
|
-
async placements() {
|
|
1961
|
-
return this.client.request("GET", "/forms");
|
|
1960
|
+
async placements(locale) {
|
|
1961
|
+
return this.client.request("GET", "/forms", { query: { locale } });
|
|
1962
1962
|
}
|
|
1963
1963
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
1964
|
-
async get(slug) {
|
|
1964
|
+
async get(slug, locale) {
|
|
1965
1965
|
return this.client.request(
|
|
1966
1966
|
"GET",
|
|
1967
|
-
`/forms/${encodeURIComponent(slug)}
|
|
1967
|
+
`/forms/${encodeURIComponent(slug)}`,
|
|
1968
|
+
{ query: { locale } }
|
|
1968
1969
|
);
|
|
1969
1970
|
}
|
|
1970
1971
|
/**
|
|
@@ -2326,12 +2327,23 @@ var NewsletterModule = class {
|
|
|
2326
2327
|
auth: false
|
|
2327
2328
|
});
|
|
2328
2329
|
}
|
|
2330
|
+
/**
|
|
2331
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
2332
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
2333
|
+
*/
|
|
2329
2334
|
async unsubscribe(email) {
|
|
2335
|
+
return this.requestUnsubscribe({ email });
|
|
2336
|
+
}
|
|
2337
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
2338
|
+
async unsubscribeWithToken(token) {
|
|
2339
|
+
return this.requestUnsubscribe({ token });
|
|
2340
|
+
}
|
|
2341
|
+
requestUnsubscribe(input) {
|
|
2330
2342
|
return this.client.request(
|
|
2331
2343
|
"POST",
|
|
2332
2344
|
"/newsletter/unsubscribe",
|
|
2333
2345
|
{
|
|
2334
|
-
body:
|
|
2346
|
+
body: input,
|
|
2335
2347
|
auth: false
|
|
2336
2348
|
}
|
|
2337
2349
|
);
|
|
@@ -2379,6 +2391,24 @@ function emitCartEvent(data) {
|
|
|
2379
2391
|
publishCartSummary({ total: cart.grandTotal, currency: typeof cart.currency === "string" ? cart.currency : null, itemCount: cart.itemCount });
|
|
2380
2392
|
}
|
|
2381
2393
|
|
|
2394
|
+
// src/visitor-ip.ts
|
|
2395
|
+
var IP_SHAPE = /^[0-9a-fA-F:.]{3,45}$/;
|
|
2396
|
+
function ipOf(value) {
|
|
2397
|
+
const trimmed = value?.trim();
|
|
2398
|
+
return trimmed && IP_SHAPE.test(trimmed) ? trimmed : void 0;
|
|
2399
|
+
}
|
|
2400
|
+
function sameSecret(given, secret) {
|
|
2401
|
+
if (typeof given !== "string" || given.length !== secret.length) return false;
|
|
2402
|
+
let diff = 0;
|
|
2403
|
+
for (let i = 0; i < secret.length; i++) diff |= given.charCodeAt(i) ^ secret.charCodeAt(i);
|
|
2404
|
+
return diff === 0;
|
|
2405
|
+
}
|
|
2406
|
+
function trustedVisitorIp(headers, originSecret) {
|
|
2407
|
+
const realIp = ipOf(headers.get("x-real-ip"));
|
|
2408
|
+
if (originSecret && !sameSecret(headers.get("x-behio-origin"), originSecret)) return realIp;
|
|
2409
|
+
return ipOf(headers.get("cf-connecting-ip")) ?? realIp;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2382
2412
|
export {
|
|
2383
2413
|
ProductSort,
|
|
2384
2414
|
OrderStatuses,
|
|
@@ -2392,5 +2422,6 @@ export {
|
|
|
2392
2422
|
toSdkError,
|
|
2393
2423
|
BehioStorefront,
|
|
2394
2424
|
clearCartSummary,
|
|
2395
|
-
publishCartSummary
|
|
2425
|
+
publishCartSummary,
|
|
2426
|
+
trustedVisitorIp
|
|
2396
2427
|
};
|
|
@@ -300,12 +300,14 @@ interface NewsletterSubscribeInput {
|
|
|
300
300
|
source?: string;
|
|
301
301
|
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
302
302
|
website?: string;
|
|
303
|
+
/** The consent wording shown to the visitor. Only its hash is stored, as proof. */
|
|
304
|
+
consentText?: string;
|
|
303
305
|
}
|
|
304
306
|
interface NewsletterSubscribeResult {
|
|
305
307
|
success: boolean;
|
|
306
308
|
/** Confirm the email before the subscription becomes active. */
|
|
307
309
|
confirmationRequired?: boolean;
|
|
308
|
-
/**
|
|
310
|
+
/** Always false: the answer never reveals who is on the list. */
|
|
309
311
|
alreadySubscribed: boolean;
|
|
310
312
|
}
|
|
311
313
|
interface NewsletterConfirmResult {
|
|
@@ -313,8 +315,15 @@ interface NewsletterConfirmResult {
|
|
|
313
315
|
/** The actual code is delivered by email, never returned to the browser. */
|
|
314
316
|
welcomeDiscountIssued: boolean;
|
|
315
317
|
}
|
|
318
|
+
/** Send exactly one: `token` unsubscribes, `email` only mails a signed link. */
|
|
319
|
+
interface NewsletterUnsubscribeInput {
|
|
320
|
+
email?: string;
|
|
321
|
+
token?: string;
|
|
322
|
+
}
|
|
316
323
|
interface NewsletterUnsubscribeResult {
|
|
317
324
|
success: boolean;
|
|
325
|
+
/** True for a bare email: its owner gets a signed link, nothing has changed yet. */
|
|
326
|
+
confirmationRequired: boolean;
|
|
318
327
|
}
|
|
319
328
|
interface ShopSeo {
|
|
320
329
|
robotsTxt?: string | null;
|
|
@@ -1624,6 +1633,8 @@ interface CheckoutInput {
|
|
|
1624
1633
|
termsConsent?: boolean;
|
|
1625
1634
|
gdprConsent?: boolean;
|
|
1626
1635
|
newsletterOptIn?: boolean;
|
|
1636
|
+
/** Wording of the newsletter checkbox as the customer saw it. Only its hash is stored, as proof of consent. */
|
|
1637
|
+
newsletterConsentText?: string;
|
|
1627
1638
|
/**
|
|
1628
1639
|
* Consent to start delivering digital content (courses, downloads,
|
|
1629
1640
|
* services) before the withdrawal period ends, which waives the right of
|
|
@@ -4456,11 +4467,11 @@ declare class FormsModule {
|
|
|
4456
4467
|
private client;
|
|
4457
4468
|
constructor(client: BehioStorefront);
|
|
4458
4469
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
4459
|
-
placements(): Promise<SdkResult<{
|
|
4470
|
+
placements(locale?: string): Promise<SdkResult<{
|
|
4460
4471
|
items: StorefrontForm[];
|
|
4461
4472
|
}>>;
|
|
4462
4473
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
4463
|
-
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
4474
|
+
get(slug: string, locale?: string): Promise<SdkResult<StorefrontForm>>;
|
|
4464
4475
|
/**
|
|
4465
4476
|
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
4466
4477
|
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
@@ -4658,8 +4669,8 @@ declare class ShippingModule {
|
|
|
4658
4669
|
/**
|
|
4659
4670
|
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
4660
4671
|
* checkout newsletter checkbox (render its default from
|
|
4661
|
-
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
4662
|
-
*
|
|
4672
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and the
|
|
4673
|
+
* answer never reveals who is on the list. Pass the hidden `website`
|
|
4663
4674
|
* honeypot field straight through from your form: a filled value is silently
|
|
4664
4675
|
* accepted but stored nowhere.
|
|
4665
4676
|
*/
|
|
@@ -4668,7 +4679,14 @@ declare class NewsletterModule {
|
|
|
4668
4679
|
constructor(client: BehioStorefront);
|
|
4669
4680
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
4670
4681
|
confirm(token: string): Promise<SdkResult<NewsletterConfirmResult>>;
|
|
4682
|
+
/**
|
|
4683
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
4684
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
4685
|
+
*/
|
|
4671
4686
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4687
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
4688
|
+
unsubscribeWithToken(token: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4689
|
+
private requestUnsubscribe;
|
|
4672
4690
|
}
|
|
4673
4691
|
/** Souhrn kosiku pro skripty na strance (Behio Chat, analytika). */
|
|
4674
4692
|
interface CartSummaryEvent {
|
|
@@ -4681,4 +4699,4 @@ declare function clearCartSummary(): void;
|
|
|
4681
4699
|
/** Publish only authoritative current totals; server cart consumers call this after hydration and revalidation. */
|
|
4682
4700
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
4683
4701
|
|
|
4684
|
-
export { type CartLinkClaimed as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingCategory as D, type BookingConfig as E, type BookingCreateInput as F, type BookingCreated as G, type BookingLocale as H, type BookingLocation as I, type BookingManageSlotsQuery as J, type BookingService as K, type BookingSlot as L, type BookingSlots as M, type BookingSlotsQuery as N, type BookingStaff as O, type ProductDetail as P, type BookingStatus as Q, type Bundle as R, type SdkResult as S, type BundleCatalogQuery as T, type BundleItem as U, type Cart as V, type CartBundleLine as W, type CartBundleLineItem as X, type CartDiscount as Y, type CartItem as Z, type CartItemProduct as _, type ProductVariant as a, type LoyaltyTransaction as a$, type CartPromotion as a0, type CartSummaryEvent as a1, type Category as a2, type CategoryDetail as a3, type CertificateVerification as a4, type CheckoutAddress as a5, type CheckoutInput as a6, type CheckoutPaymentMethod as a7, type CheckoutPreview as a8, type CheckoutResult as a9, type FacetAvailability as aA, type FacetCategory as aB, type FacetLabel as aC, type FacetPriceRange as aD, type FacetRange as aE, type FacetRatingBucket as aF, type FacetValue as aG, type FacetsResponse as aH, type FilterField as aI, type FulfillmentStatus as aJ, FulfillmentStatuses as aK, type GamificationRefreshResult as aL, type GiftCardBalance as aM, type GiftCardPurchaseInput as aN, type GiftCardPurchaseResult as aO, type GiftCardSummary as aP, type LessonNote as aQ, type LessonQuiz as aR, type LoginInput as aS, type LoyaltyBalance as aT, type LoyaltyNextTier as aU, type LoyaltyProgram as aV, type LoyaltyQuery as aW, type LoyaltyReferralResult as aX, type LoyaltySummary as aY, type LoyaltyTier as aZ, type LoyaltyTierPerks as a_, type CheckoutSettings as aa, type CookieConsentInput as ab, type CourseAttachment as ac, type CourseCertificate as ad, type CourseComment as ae, type CourseCommentReply as af, type CourseCommentsList as ag, type CourseDetail as ah, type CourseLesson as ai, type CourseListItem as aj, type CourseModule as ak, type CoursePostedComment as al, type CourseProgress as am, type CourseTutorMessage as an, type CourseTutorThread as ao, type CrossSellItem as ap, type CurrencyDisplayFormat as aq, type CustomerAddress as ar, type CustomerBadge as as, type CustomerChallenge as at, type CustomerGamification as au, type CustomerGamificationQuery as av, type CustomerProfile as aw, type DigitalDownload as ax, type DownloadUrl as ay, type Facet as az, type StorefrontFormFieldError as b, type
|
|
4702
|
+
export { type CartLinkClaimed as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingCategory as D, type BookingConfig as E, type BookingCreateInput as F, type BookingCreated as G, type BookingLocale as H, type BookingLocation as I, type BookingManageSlotsQuery as J, type BookingService as K, type BookingSlot as L, type BookingSlots as M, type BookingSlotsQuery as N, type BookingStaff as O, type ProductDetail as P, type BookingStatus as Q, type Bundle as R, type SdkResult as S, type BundleCatalogQuery as T, type BundleItem as U, type Cart as V, type CartBundleLine as W, type CartBundleLineItem as X, type CartDiscount as Y, type CartItem as Z, type CartItemProduct as _, type ProductVariant as a, type LoyaltyTransaction as a$, type CartPromotion as a0, type CartSummaryEvent as a1, type Category as a2, type CategoryDetail as a3, type CertificateVerification as a4, type CheckoutAddress as a5, type CheckoutInput as a6, type CheckoutPaymentMethod as a7, type CheckoutPreview as a8, type CheckoutResult as a9, type FacetAvailability as aA, type FacetCategory as aB, type FacetLabel as aC, type FacetPriceRange as aD, type FacetRange as aE, type FacetRatingBucket as aF, type FacetValue as aG, type FacetsResponse as aH, type FilterField as aI, type FulfillmentStatus as aJ, FulfillmentStatuses as aK, type GamificationRefreshResult as aL, type GiftCardBalance as aM, type GiftCardPurchaseInput as aN, type GiftCardPurchaseResult as aO, type GiftCardSummary as aP, type LessonNote as aQ, type LessonQuiz as aR, type LoginInput as aS, type LoyaltyBalance as aT, type LoyaltyNextTier as aU, type LoyaltyProgram as aV, type LoyaltyQuery as aW, type LoyaltyReferralResult as aX, type LoyaltySummary as aY, type LoyaltyTier as aZ, type LoyaltyTierPerks as a_, type CheckoutSettings as aa, type CookieConsentInput as ab, type CourseAttachment as ac, type CourseCertificate as ad, type CourseComment as ae, type CourseCommentReply as af, type CourseCommentsList as ag, type CourseDetail as ah, type CourseLesson as ai, type CourseListItem as aj, type CourseModule as ak, type CoursePostedComment as al, type CourseProgress as am, type CourseTutorMessage as an, type CourseTutorThread as ao, type CrossSellItem as ap, type CurrencyDisplayFormat as aq, type CustomerAddress as ar, type CustomerBadge as as, type CustomerChallenge as at, type CustomerGamification as au, type CustomerGamificationQuery as av, type CustomerProfile as aw, type DigitalDownload as ax, type DownloadUrl as ay, type Facet as az, type StorefrontFormFieldError as b, type QuoteRequest as b$, type Menu as b0, type MenuItem as b1, type MenuItemRef as b2, type MenuItemType as b3, type MessageResponse as b4, type NewsletterConfirmResult as b5, type NewsletterOptInDefault as b6, type NewsletterSubscribeInput as b7, type NewsletterSubscribeResult as b8, type NewsletterUnsubscribeInput as b9, type PickupWidgetConfig as bA, type PriceDisplay as bB, type ProductAssetGroup as bC, type ProductAssetItem as bD, type ProductAvailability as bE, type ProductGroup as bF, type ProductLabel as bG, type ProductListItem as bH, type ProductMedia as bI, type ProductMediaVariant as bJ, type ProductParameter as bK, type ProductParameterGroup as bL, type ProductParametersResponse as bM, type ProductPrice as bN, type ProductPromotionSummary as bO, type ProductReview as bP, type ProductReviewsResponse as bQ, type ProductSibling as bR, ProductSort as bS, type ProductSortValue as bT, type ProductVolumePrice as bU, type ProductsQuery as bV, type QuizAnswerInput as bW, type QuizAnswerResult as bX, type QuizQuestion as bY, type QuizResult as bZ, type QuoteItem as b_, type NewsletterUnsubscribeResult as ba, type OrderAccessRequestResponse as bb, type OrderAccessVerifyResponse as bc, type OrderDetail as bd, type OrderDiscount as be, type OrderDocument as bf, type OrderItem as bg, type OrderListItem as bh, type OrderPaymentInstructions as bi, type OrderPickupPoint as bj, type OrderShipment as bk, type OrderStatus as bl, type OrderStatusHistory as bm, OrderStatuses as bn, type OrderTracking as bo, type Page as bp, type PageAttachment as bq, type PageDetail as br, type PaginatedResponse as bs, type PaymentInstrument as bt, type PaymentStatus as bu, PaymentStatuses as bv, type PaymentSwift as bw, type PickupPoint as bx, type PickupPointHours as by, type PickupPointsInput as bz, type StorefrontFormPlacement as c, type WishlistItem as c$, type RegisterInput as c0, type RegisterResult as c1, type RequestInterceptor as c2, type RequestInterceptorConfig as c3, type ResponseInterceptor as c4, type ResponseInterceptorData as c5, type ReturnRequest as c6, type ReturnRequestItem as c7, type ReturnStatus as c8, type ReturnStatusItem as c9, type StorefrontCollectionItem as cA, type StorefrontCollectionQuery as cB, type StorefrontFaqGroup as cC, type StorefrontFaqGroupSummary as cD, type StorefrontFaqGroups as cE, type StorefrontFaqItem as cF, type StorefrontFaqQuery as cG, type StorefrontForm as cH, type StorefrontFormFieldErrorCode as cI, type StorefrontFormFile as cJ, type StorefrontFormPresentation as cK, type StorefrontFormSettings as cL, type StorefrontFormSubmitInput as cM, type StorefrontFormSubmitResult as cN, type StorefrontFormUpload as cO, type SubmitQuoteInput as cP, type SubmitReturnInput as cQ, type SubmitReviewInput as cR, type SubmitWithdrawalInput as cS, type Subscription as cT, type SubscriptionAction as cU, type SubscriptionFrequency as cV, type SubscriptionItem as cW, type SubscriptionStatus as cX, type TaxBreakdownLine as cY, type VariantAxis as cZ, type VariantAxisValue as c_, type ReturnableOrder as ca, type ReturnableOrderItem as cb, type SdkError as cc, type ShippingMethodSummary as cd, type ShippingPublicConfig as ce, type ShippingQuote as cf, type ShippingQuoteInput as cg, type ShopAppearance as ch, type ShopCommerce as ci, type ShopInfo as cj, type ShopScript as ck, type ShopScriptPlacement as cl, type ShopScriptType as cm, type ShopScripts as cn, type ShopSeo as co, type ShopSeoIdentity as cp, type SiteFormField as cq, type SiteFormFieldOption as cr, type SiteFormFieldType as cs, type Sitemap as ct, type SitemapEntry as cu, type StockBehavior as cv, type StockMode as cw, type StorefrontCollection as cx, type StorefrontCollectionField as cy, type StorefrontCollectionFieldType as cz, type AddToCartInput as d, type WithdrawalAcknowledgement as d0, type WithdrawalFlag as d1, type WithdrawalSettings as d2, type WithdrawalWindow as d3, clearCartSummary as d4, err as d5, ok as d6, publishCartSummary as d7, toSdkError as d8, type AddToCartItemsInput as e, type AddressDetail as f, type AddressSuggestion as g, type AddressType as h, AddressTypes as i, type AuthTokens as j, type BackInStockSubscription as k, type BadgeTone as l, BehioApiError as m, type BehioErrorCode as n, type BehioEventHandler as o, type BehioEventType as p, BehioNetworkError as q, type BehioStorefrontConfig as r, type Blog as s, type BlogPostDetail as t, type BlogPostListItem as u, type BlogPostsPage as v, type BlogPostsQuery as w, type BlogSettings as x, type BlogTag as y, type Booking as z };
|
|
@@ -300,12 +300,14 @@ interface NewsletterSubscribeInput {
|
|
|
300
300
|
source?: string;
|
|
301
301
|
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
302
302
|
website?: string;
|
|
303
|
+
/** The consent wording shown to the visitor. Only its hash is stored, as proof. */
|
|
304
|
+
consentText?: string;
|
|
303
305
|
}
|
|
304
306
|
interface NewsletterSubscribeResult {
|
|
305
307
|
success: boolean;
|
|
306
308
|
/** Confirm the email before the subscription becomes active. */
|
|
307
309
|
confirmationRequired?: boolean;
|
|
308
|
-
/**
|
|
310
|
+
/** Always false: the answer never reveals who is on the list. */
|
|
309
311
|
alreadySubscribed: boolean;
|
|
310
312
|
}
|
|
311
313
|
interface NewsletterConfirmResult {
|
|
@@ -313,8 +315,15 @@ interface NewsletterConfirmResult {
|
|
|
313
315
|
/** The actual code is delivered by email, never returned to the browser. */
|
|
314
316
|
welcomeDiscountIssued: boolean;
|
|
315
317
|
}
|
|
318
|
+
/** Send exactly one: `token` unsubscribes, `email` only mails a signed link. */
|
|
319
|
+
interface NewsletterUnsubscribeInput {
|
|
320
|
+
email?: string;
|
|
321
|
+
token?: string;
|
|
322
|
+
}
|
|
316
323
|
interface NewsletterUnsubscribeResult {
|
|
317
324
|
success: boolean;
|
|
325
|
+
/** True for a bare email: its owner gets a signed link, nothing has changed yet. */
|
|
326
|
+
confirmationRequired: boolean;
|
|
318
327
|
}
|
|
319
328
|
interface ShopSeo {
|
|
320
329
|
robotsTxt?: string | null;
|
|
@@ -1624,6 +1633,8 @@ interface CheckoutInput {
|
|
|
1624
1633
|
termsConsent?: boolean;
|
|
1625
1634
|
gdprConsent?: boolean;
|
|
1626
1635
|
newsletterOptIn?: boolean;
|
|
1636
|
+
/** Wording of the newsletter checkbox as the customer saw it. Only its hash is stored, as proof of consent. */
|
|
1637
|
+
newsletterConsentText?: string;
|
|
1627
1638
|
/**
|
|
1628
1639
|
* Consent to start delivering digital content (courses, downloads,
|
|
1629
1640
|
* services) before the withdrawal period ends, which waives the right of
|
|
@@ -4456,11 +4467,11 @@ declare class FormsModule {
|
|
|
4456
4467
|
private client;
|
|
4457
4468
|
constructor(client: BehioStorefront);
|
|
4458
4469
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
4459
|
-
placements(): Promise<SdkResult<{
|
|
4470
|
+
placements(locale?: string): Promise<SdkResult<{
|
|
4460
4471
|
items: StorefrontForm[];
|
|
4461
4472
|
}>>;
|
|
4462
4473
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
4463
|
-
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
4474
|
+
get(slug: string, locale?: string): Promise<SdkResult<StorefrontForm>>;
|
|
4464
4475
|
/**
|
|
4465
4476
|
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
4466
4477
|
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
@@ -4658,8 +4669,8 @@ declare class ShippingModule {
|
|
|
4658
4669
|
/**
|
|
4659
4670
|
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
4660
4671
|
* checkout newsletter checkbox (render its default from
|
|
4661
|
-
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
4662
|
-
*
|
|
4672
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and the
|
|
4673
|
+
* answer never reveals who is on the list. Pass the hidden `website`
|
|
4663
4674
|
* honeypot field straight through from your form: a filled value is silently
|
|
4664
4675
|
* accepted but stored nowhere.
|
|
4665
4676
|
*/
|
|
@@ -4668,7 +4679,14 @@ declare class NewsletterModule {
|
|
|
4668
4679
|
constructor(client: BehioStorefront);
|
|
4669
4680
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
4670
4681
|
confirm(token: string): Promise<SdkResult<NewsletterConfirmResult>>;
|
|
4682
|
+
/**
|
|
4683
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
4684
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
4685
|
+
*/
|
|
4671
4686
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4687
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
4688
|
+
unsubscribeWithToken(token: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4689
|
+
private requestUnsubscribe;
|
|
4672
4690
|
}
|
|
4673
4691
|
/** Souhrn kosiku pro skripty na strance (Behio Chat, analytika). */
|
|
4674
4692
|
interface CartSummaryEvent {
|
|
@@ -4681,4 +4699,4 @@ declare function clearCartSummary(): void;
|
|
|
4681
4699
|
/** Publish only authoritative current totals; server cart consumers call this after hydration and revalidation. */
|
|
4682
4700
|
declare function publishCartSummary(summary: CartSummaryEvent): void;
|
|
4683
4701
|
|
|
4684
|
-
export { type CartLinkClaimed as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingCategory as D, type BookingConfig as E, type BookingCreateInput as F, type BookingCreated as G, type BookingLocale as H, type BookingLocation as I, type BookingManageSlotsQuery as J, type BookingService as K, type BookingSlot as L, type BookingSlots as M, type BookingSlotsQuery as N, type BookingStaff as O, type ProductDetail as P, type BookingStatus as Q, type Bundle as R, type SdkResult as S, type BundleCatalogQuery as T, type BundleItem as U, type Cart as V, type CartBundleLine as W, type CartBundleLineItem as X, type CartDiscount as Y, type CartItem as Z, type CartItemProduct as _, type ProductVariant as a, type LoyaltyTransaction as a$, type CartPromotion as a0, type CartSummaryEvent as a1, type Category as a2, type CategoryDetail as a3, type CertificateVerification as a4, type CheckoutAddress as a5, type CheckoutInput as a6, type CheckoutPaymentMethod as a7, type CheckoutPreview as a8, type CheckoutResult as a9, type FacetAvailability as aA, type FacetCategory as aB, type FacetLabel as aC, type FacetPriceRange as aD, type FacetRange as aE, type FacetRatingBucket as aF, type FacetValue as aG, type FacetsResponse as aH, type FilterField as aI, type FulfillmentStatus as aJ, FulfillmentStatuses as aK, type GamificationRefreshResult as aL, type GiftCardBalance as aM, type GiftCardPurchaseInput as aN, type GiftCardPurchaseResult as aO, type GiftCardSummary as aP, type LessonNote as aQ, type LessonQuiz as aR, type LoginInput as aS, type LoyaltyBalance as aT, type LoyaltyNextTier as aU, type LoyaltyProgram as aV, type LoyaltyQuery as aW, type LoyaltyReferralResult as aX, type LoyaltySummary as aY, type LoyaltyTier as aZ, type LoyaltyTierPerks as a_, type CheckoutSettings as aa, type CookieConsentInput as ab, type CourseAttachment as ac, type CourseCertificate as ad, type CourseComment as ae, type CourseCommentReply as af, type CourseCommentsList as ag, type CourseDetail as ah, type CourseLesson as ai, type CourseListItem as aj, type CourseModule as ak, type CoursePostedComment as al, type CourseProgress as am, type CourseTutorMessage as an, type CourseTutorThread as ao, type CrossSellItem as ap, type CurrencyDisplayFormat as aq, type CustomerAddress as ar, type CustomerBadge as as, type CustomerChallenge as at, type CustomerGamification as au, type CustomerGamificationQuery as av, type CustomerProfile as aw, type DigitalDownload as ax, type DownloadUrl as ay, type Facet as az, type StorefrontFormFieldError as b, type
|
|
4702
|
+
export { type CartLinkClaimed as $, type ActivePromotion as A, BehioStorefront as B, type CookieConsent as C, type BookingCategory as D, type BookingConfig as E, type BookingCreateInput as F, type BookingCreated as G, type BookingLocale as H, type BookingLocation as I, type BookingManageSlotsQuery as J, type BookingService as K, type BookingSlot as L, type BookingSlots as M, type BookingSlotsQuery as N, type BookingStaff as O, type ProductDetail as P, type BookingStatus as Q, type Bundle as R, type SdkResult as S, type BundleCatalogQuery as T, type BundleItem as U, type Cart as V, type CartBundleLine as W, type CartBundleLineItem as X, type CartDiscount as Y, type CartItem as Z, type CartItemProduct as _, type ProductVariant as a, type LoyaltyTransaction as a$, type CartPromotion as a0, type CartSummaryEvent as a1, type Category as a2, type CategoryDetail as a3, type CertificateVerification as a4, type CheckoutAddress as a5, type CheckoutInput as a6, type CheckoutPaymentMethod as a7, type CheckoutPreview as a8, type CheckoutResult as a9, type FacetAvailability as aA, type FacetCategory as aB, type FacetLabel as aC, type FacetPriceRange as aD, type FacetRange as aE, type FacetRatingBucket as aF, type FacetValue as aG, type FacetsResponse as aH, type FilterField as aI, type FulfillmentStatus as aJ, FulfillmentStatuses as aK, type GamificationRefreshResult as aL, type GiftCardBalance as aM, type GiftCardPurchaseInput as aN, type GiftCardPurchaseResult as aO, type GiftCardSummary as aP, type LessonNote as aQ, type LessonQuiz as aR, type LoginInput as aS, type LoyaltyBalance as aT, type LoyaltyNextTier as aU, type LoyaltyProgram as aV, type LoyaltyQuery as aW, type LoyaltyReferralResult as aX, type LoyaltySummary as aY, type LoyaltyTier as aZ, type LoyaltyTierPerks as a_, type CheckoutSettings as aa, type CookieConsentInput as ab, type CourseAttachment as ac, type CourseCertificate as ad, type CourseComment as ae, type CourseCommentReply as af, type CourseCommentsList as ag, type CourseDetail as ah, type CourseLesson as ai, type CourseListItem as aj, type CourseModule as ak, type CoursePostedComment as al, type CourseProgress as am, type CourseTutorMessage as an, type CourseTutorThread as ao, type CrossSellItem as ap, type CurrencyDisplayFormat as aq, type CustomerAddress as ar, type CustomerBadge as as, type CustomerChallenge as at, type CustomerGamification as au, type CustomerGamificationQuery as av, type CustomerProfile as aw, type DigitalDownload as ax, type DownloadUrl as ay, type Facet as az, type StorefrontFormFieldError as b, type QuoteRequest as b$, type Menu as b0, type MenuItem as b1, type MenuItemRef as b2, type MenuItemType as b3, type MessageResponse as b4, type NewsletterConfirmResult as b5, type NewsletterOptInDefault as b6, type NewsletterSubscribeInput as b7, type NewsletterSubscribeResult as b8, type NewsletterUnsubscribeInput as b9, type PickupWidgetConfig as bA, type PriceDisplay as bB, type ProductAssetGroup as bC, type ProductAssetItem as bD, type ProductAvailability as bE, type ProductGroup as bF, type ProductLabel as bG, type ProductListItem as bH, type ProductMedia as bI, type ProductMediaVariant as bJ, type ProductParameter as bK, type ProductParameterGroup as bL, type ProductParametersResponse as bM, type ProductPrice as bN, type ProductPromotionSummary as bO, type ProductReview as bP, type ProductReviewsResponse as bQ, type ProductSibling as bR, ProductSort as bS, type ProductSortValue as bT, type ProductVolumePrice as bU, type ProductsQuery as bV, type QuizAnswerInput as bW, type QuizAnswerResult as bX, type QuizQuestion as bY, type QuizResult as bZ, type QuoteItem as b_, type NewsletterUnsubscribeResult as ba, type OrderAccessRequestResponse as bb, type OrderAccessVerifyResponse as bc, type OrderDetail as bd, type OrderDiscount as be, type OrderDocument as bf, type OrderItem as bg, type OrderListItem as bh, type OrderPaymentInstructions as bi, type OrderPickupPoint as bj, type OrderShipment as bk, type OrderStatus as bl, type OrderStatusHistory as bm, OrderStatuses as bn, type OrderTracking as bo, type Page as bp, type PageAttachment as bq, type PageDetail as br, type PaginatedResponse as bs, type PaymentInstrument as bt, type PaymentStatus as bu, PaymentStatuses as bv, type PaymentSwift as bw, type PickupPoint as bx, type PickupPointHours as by, type PickupPointsInput as bz, type StorefrontFormPlacement as c, type WishlistItem as c$, type RegisterInput as c0, type RegisterResult as c1, type RequestInterceptor as c2, type RequestInterceptorConfig as c3, type ResponseInterceptor as c4, type ResponseInterceptorData as c5, type ReturnRequest as c6, type ReturnRequestItem as c7, type ReturnStatus as c8, type ReturnStatusItem as c9, type StorefrontCollectionItem as cA, type StorefrontCollectionQuery as cB, type StorefrontFaqGroup as cC, type StorefrontFaqGroupSummary as cD, type StorefrontFaqGroups as cE, type StorefrontFaqItem as cF, type StorefrontFaqQuery as cG, type StorefrontForm as cH, type StorefrontFormFieldErrorCode as cI, type StorefrontFormFile as cJ, type StorefrontFormPresentation as cK, type StorefrontFormSettings as cL, type StorefrontFormSubmitInput as cM, type StorefrontFormSubmitResult as cN, type StorefrontFormUpload as cO, type SubmitQuoteInput as cP, type SubmitReturnInput as cQ, type SubmitReviewInput as cR, type SubmitWithdrawalInput as cS, type Subscription as cT, type SubscriptionAction as cU, type SubscriptionFrequency as cV, type SubscriptionItem as cW, type SubscriptionStatus as cX, type TaxBreakdownLine as cY, type VariantAxis as cZ, type VariantAxisValue as c_, type ReturnableOrder as ca, type ReturnableOrderItem as cb, type SdkError as cc, type ShippingMethodSummary as cd, type ShippingPublicConfig as ce, type ShippingQuote as cf, type ShippingQuoteInput as cg, type ShopAppearance as ch, type ShopCommerce as ci, type ShopInfo as cj, type ShopScript as ck, type ShopScriptPlacement as cl, type ShopScriptType as cm, type ShopScripts as cn, type ShopSeo as co, type ShopSeoIdentity as cp, type SiteFormField as cq, type SiteFormFieldOption as cr, type SiteFormFieldType as cs, type Sitemap as ct, type SitemapEntry as cu, type StockBehavior as cv, type StockMode as cw, type StorefrontCollection as cx, type StorefrontCollectionField as cy, type StorefrontCollectionFieldType as cz, type AddToCartInput as d, type WithdrawalAcknowledgement as d0, type WithdrawalFlag as d1, type WithdrawalSettings as d2, type WithdrawalWindow as d3, clearCartSummary as d4, err as d5, ok as d6, publishCartSummary as d7, toSdkError as d8, type AddToCartItemsInput as e, type AddressDetail as f, type AddressSuggestion as g, type AddressType as h, AddressTypes as i, type AuthTokens as j, type BackInStockSubscription as k, type BadgeTone as l, BehioApiError as m, type BehioErrorCode as n, type BehioEventHandler as o, type BehioEventType as p, BehioNetworkError as q, type BehioStorefrontConfig as r, type Blog as s, type BlogPostDetail as t, type BlogPostListItem as u, type BlogPostsPage as v, type BlogPostsQuery as w, type BlogSettings as x, type BlogTag as y, type Booking as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError, c as StorefrontFormPlacement } from './client-
|
|
2
|
-
export { A as ActivePromotion, d as AddToCartInput, e as AddToCartItemsInput, f as AddressDetail, g as AddressSuggestion, h as AddressType, i as AddressTypes, j as AuthTokens, k as BackInStockSubscription, l as BadgeTone, m as BehioApiError, n as BehioErrorCode, o as BehioEventHandler, p as BehioEventType, q as BehioNetworkError, r as BehioStorefrontConfig, s as Blog, t as BlogPostDetail, u as BlogPostListItem, v as BlogPostsPage, w as BlogPostsQuery, x as BlogSettings, y as BlogTag, z as Booking, D as BookingCategory, E as BookingConfig, F as BookingCreateInput, G as BookingCreated, H as BookingLocale, I as BookingLocation, J as BookingManageSlotsQuery, K as BookingService, L as BookingSlot, M as BookingSlots, N as BookingSlotsQuery, O as BookingStaff, Q as BookingStatus, R as Bundle, T as BundleCatalogQuery, U as BundleItem, V as Cart, W as CartBundleLine, X as CartBundleLineItem, Y as CartDiscount, Z as CartItem, _ as CartItemProduct, $ as CartLinkClaimed, a0 as CartPromotion, a1 as CartSummaryEvent, a2 as Category, a3 as CategoryDetail, a4 as CertificateVerification, a5 as CheckoutAddress, a6 as CheckoutInput, a7 as CheckoutPaymentMethod, a8 as CheckoutPreview, a9 as CheckoutResult, aa as CheckoutSettings, ab as CookieConsentInput, ac as CourseAttachment, ad as CourseCertificate, ae as CourseComment, af as CourseCommentReply, ag as CourseCommentsList, ah as CourseDetail, ai as CourseLesson, aj as CourseListItem, ak as CourseModule, al as CoursePostedComment, am as CourseProgress, an as CourseTutorMessage, ao as CourseTutorThread, ap as CrossSellItem, aq as CurrencyDisplayFormat, ar as CustomerAddress, as as CustomerBadge, at as CustomerChallenge, au as CustomerGamification, av as CustomerGamificationQuery, aw as CustomerProfile, ax as DigitalDownload, ay as DownloadUrl, az as Facet, aA as FacetAvailability, aB as FacetCategory, aC as FacetLabel, aD as FacetPriceRange, aE as FacetRange, aF as FacetRatingBucket, aG as FacetValue, aH as FacetsResponse, aI as FilterField, aJ as FulfillmentStatus, aK as FulfillmentStatuses, aL as GamificationRefreshResult, aM as GiftCardBalance, aN as GiftCardPurchaseInput, aO as GiftCardPurchaseResult, aP as GiftCardSummary, aQ as LessonNote, aR as LessonQuiz, aS as LoginInput, aT as LoyaltyBalance, aU as LoyaltyNextTier, aV as LoyaltyProgram, aW as LoyaltyQuery, aX as LoyaltyReferralResult, aY as LoyaltySummary, aZ as LoyaltyTier, a_ as LoyaltyTierPerks, a$ as LoyaltyTransaction, b0 as Menu, b1 as MenuItem, b2 as MenuItemRef, b3 as MenuItemType, b4 as MessageResponse, b5 as NewsletterConfirmResult, b6 as NewsletterOptInDefault, b7 as NewsletterSubscribeInput, b8 as NewsletterSubscribeResult, b9 as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError, c as StorefrontFormPlacement } from './client-Bpefn9PP.mjs';
|
|
2
|
+
export { A as ActivePromotion, d as AddToCartInput, e as AddToCartItemsInput, f as AddressDetail, g as AddressSuggestion, h as AddressType, i as AddressTypes, j as AuthTokens, k as BackInStockSubscription, l as BadgeTone, m as BehioApiError, n as BehioErrorCode, o as BehioEventHandler, p as BehioEventType, q as BehioNetworkError, r as BehioStorefrontConfig, s as Blog, t as BlogPostDetail, u as BlogPostListItem, v as BlogPostsPage, w as BlogPostsQuery, x as BlogSettings, y as BlogTag, z as Booking, D as BookingCategory, E as BookingConfig, F as BookingCreateInput, G as BookingCreated, H as BookingLocale, I as BookingLocation, J as BookingManageSlotsQuery, K as BookingService, L as BookingSlot, M as BookingSlots, N as BookingSlotsQuery, O as BookingStaff, Q as BookingStatus, R as Bundle, T as BundleCatalogQuery, U as BundleItem, V as Cart, W as CartBundleLine, X as CartBundleLineItem, Y as CartDiscount, Z as CartItem, _ as CartItemProduct, $ as CartLinkClaimed, a0 as CartPromotion, a1 as CartSummaryEvent, a2 as Category, a3 as CategoryDetail, a4 as CertificateVerification, a5 as CheckoutAddress, a6 as CheckoutInput, a7 as CheckoutPaymentMethod, a8 as CheckoutPreview, a9 as CheckoutResult, aa as CheckoutSettings, ab as CookieConsentInput, ac as CourseAttachment, ad as CourseCertificate, ae as CourseComment, af as CourseCommentReply, ag as CourseCommentsList, ah as CourseDetail, ai as CourseLesson, aj as CourseListItem, ak as CourseModule, al as CoursePostedComment, am as CourseProgress, an as CourseTutorMessage, ao as CourseTutorThread, ap as CrossSellItem, aq as CurrencyDisplayFormat, ar as CustomerAddress, as as CustomerBadge, at as CustomerChallenge, au as CustomerGamification, av as CustomerGamificationQuery, aw as CustomerProfile, ax as DigitalDownload, ay as DownloadUrl, az as Facet, aA as FacetAvailability, aB as FacetCategory, aC as FacetLabel, aD as FacetPriceRange, aE as FacetRange, aF as FacetRatingBucket, aG as FacetValue, aH as FacetsResponse, aI as FilterField, aJ as FulfillmentStatus, aK as FulfillmentStatuses, aL as GamificationRefreshResult, aM as GiftCardBalance, aN as GiftCardPurchaseInput, aO as GiftCardPurchaseResult, aP as GiftCardSummary, aQ as LessonNote, aR as LessonQuiz, aS as LoginInput, aT as LoyaltyBalance, aU as LoyaltyNextTier, aV as LoyaltyProgram, aW as LoyaltyQuery, aX as LoyaltyReferralResult, aY as LoyaltySummary, aZ as LoyaltyTier, a_ as LoyaltyTierPerks, a$ as LoyaltyTransaction, b0 as Menu, b1 as MenuItem, b2 as MenuItemRef, b3 as MenuItemType, b4 as MessageResponse, b5 as NewsletterConfirmResult, b6 as NewsletterOptInDefault, b7 as NewsletterSubscribeInput, b8 as NewsletterSubscribeResult, b9 as NewsletterUnsubscribeInput, ba as NewsletterUnsubscribeResult, bb as OrderAccessRequestResponse, bc as OrderAccessVerifyResponse, bd as OrderDetail, be as OrderDiscount, bf as OrderDocument, bg as OrderItem, bh as OrderListItem, bi as OrderPaymentInstructions, bj as OrderPickupPoint, bk as OrderShipment, bl as OrderStatus, bm as OrderStatusHistory, bn as OrderStatuses, bo as OrderTracking, bp as Page, bq as PageAttachment, br as PageDetail, bs as PaginatedResponse, bt as PaymentInstrument, bu as PaymentStatus, bv as PaymentStatuses, bw as PaymentSwift, bx as PickupPoint, by as PickupPointHours, bz as PickupPointsInput, bA as PickupWidgetConfig, bB as PriceDisplay, bC as ProductAssetGroup, bD as ProductAssetItem, bE as ProductAvailability, bF as ProductGroup, bG as ProductLabel, bH as ProductListItem, bI as ProductMedia, bJ as ProductMediaVariant, bK as ProductParameter, bL as ProductParameterGroup, bM as ProductParametersResponse, bN as ProductPrice, bO as ProductPromotionSummary, bP as ProductReview, bQ as ProductReviewsResponse, bR as ProductSibling, bS as ProductSort, bT as ProductSortValue, bU as ProductVolumePrice, bV as ProductsQuery, bW as QuizAnswerInput, bX as QuizAnswerResult, bY as QuizQuestion, bZ as QuizResult, b_ as QuoteItem, b$ as QuoteRequest, c0 as RegisterInput, c1 as RegisterResult, c2 as RequestInterceptor, c3 as RequestInterceptorConfig, c4 as ResponseInterceptor, c5 as ResponseInterceptorData, c6 as ReturnRequest, c7 as ReturnRequestItem, c8 as ReturnStatus, c9 as ReturnStatusItem, ca as ReturnableOrder, cb as ReturnableOrderItem, cc as SdkError, cd as ShippingMethodSummary, ce as ShippingPublicConfig, cf as ShippingQuote, cg as ShippingQuoteInput, ch as ShopAppearance, ci as ShopCommerce, cj as ShopInfo, ck as ShopScript, cl as ShopScriptPlacement, cm as ShopScriptType, cn as ShopScripts, co as ShopSeo, cp as ShopSeoIdentity, cq as SiteFormField, cr as SiteFormFieldOption, cs as SiteFormFieldType, ct as Sitemap, cu as SitemapEntry, cv as StockBehavior, cw as StockMode, cx as StorefrontCollection, cy as StorefrontCollectionField, cz as StorefrontCollectionFieldType, cA as StorefrontCollectionItem, cB as StorefrontCollectionQuery, cC as StorefrontFaqGroup, cD as StorefrontFaqGroupSummary, cE as StorefrontFaqGroups, cF as StorefrontFaqItem, cG as StorefrontFaqQuery, cH as StorefrontForm, cI as StorefrontFormFieldErrorCode, cJ as StorefrontFormFile, cK as StorefrontFormPresentation, cL as StorefrontFormSettings, cM as StorefrontFormSubmitInput, cN as StorefrontFormSubmitResult, cO as StorefrontFormUpload, cP as SubmitQuoteInput, cQ as SubmitReturnInput, cR as SubmitReviewInput, cS as SubmitWithdrawalInput, cT as Subscription, cU as SubscriptionAction, cV as SubscriptionFrequency, cW as SubscriptionItem, cX as SubscriptionStatus, cY as TaxBreakdownLine, cZ as VariantAxis, c_ as VariantAxisValue, c$ as WishlistItem, d0 as WithdrawalAcknowledgement, d1 as WithdrawalFlag, d2 as WithdrawalSettings, d3 as WithdrawalWindow, d4 as clearCartSummary, d5 as err, d6 as ok, d7 as publishCartSummary, d8 as toSdkError } from './client-Bpefn9PP.mjs';
|
|
3
|
+
|
|
4
|
+
interface HeaderReader {
|
|
5
|
+
get(name: string): string | null;
|
|
6
|
+
}
|
|
7
|
+
declare function trustedVisitorIp(headers: HeaderReader, originSecret?: string | null): string | undefined;
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -303,4 +308,4 @@ declare class FormPopupPreferences {
|
|
|
303
308
|
dismiss(slug: string, days: number): void;
|
|
304
309
|
}
|
|
305
310
|
|
|
306
|
-
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, FormPopupClock, FormPopupPreferences, NEWSLETTER_REQUESTED_EVENT, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, StorefrontFormPlacement, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formPopupRouteAllowed, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, markNewsletterRequested, matchesFormPath, newsletterWasRequested, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, validationFieldMessages, variantFromQuery, variantHref };
|
|
311
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, FormPopupClock, FormPopupPreferences, type HeaderReader, NEWSLETTER_REQUESTED_EVENT, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, StorefrontFormPlacement, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formPopupRouteAllowed, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, markNewsletterRequested, matchesFormPath, newsletterWasRequested, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, trustedVisitorIp, validationFieldMessages, variantFromQuery, variantHref };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError, c as StorefrontFormPlacement } from './client-
|
|
2
|
-
export { A as ActivePromotion, d as AddToCartInput, e as AddToCartItemsInput, f as AddressDetail, g as AddressSuggestion, h as AddressType, i as AddressTypes, j as AuthTokens, k as BackInStockSubscription, l as BadgeTone, m as BehioApiError, n as BehioErrorCode, o as BehioEventHandler, p as BehioEventType, q as BehioNetworkError, r as BehioStorefrontConfig, s as Blog, t as BlogPostDetail, u as BlogPostListItem, v as BlogPostsPage, w as BlogPostsQuery, x as BlogSettings, y as BlogTag, z as Booking, D as BookingCategory, E as BookingConfig, F as BookingCreateInput, G as BookingCreated, H as BookingLocale, I as BookingLocation, J as BookingManageSlotsQuery, K as BookingService, L as BookingSlot, M as BookingSlots, N as BookingSlotsQuery, O as BookingStaff, Q as BookingStatus, R as Bundle, T as BundleCatalogQuery, U as BundleItem, V as Cart, W as CartBundleLine, X as CartBundleLineItem, Y as CartDiscount, Z as CartItem, _ as CartItemProduct, $ as CartLinkClaimed, a0 as CartPromotion, a1 as CartSummaryEvent, a2 as Category, a3 as CategoryDetail, a4 as CertificateVerification, a5 as CheckoutAddress, a6 as CheckoutInput, a7 as CheckoutPaymentMethod, a8 as CheckoutPreview, a9 as CheckoutResult, aa as CheckoutSettings, ab as CookieConsentInput, ac as CourseAttachment, ad as CourseCertificate, ae as CourseComment, af as CourseCommentReply, ag as CourseCommentsList, ah as CourseDetail, ai as CourseLesson, aj as CourseListItem, ak as CourseModule, al as CoursePostedComment, am as CourseProgress, an as CourseTutorMessage, ao as CourseTutorThread, ap as CrossSellItem, aq as CurrencyDisplayFormat, ar as CustomerAddress, as as CustomerBadge, at as CustomerChallenge, au as CustomerGamification, av as CustomerGamificationQuery, aw as CustomerProfile, ax as DigitalDownload, ay as DownloadUrl, az as Facet, aA as FacetAvailability, aB as FacetCategory, aC as FacetLabel, aD as FacetPriceRange, aE as FacetRange, aF as FacetRatingBucket, aG as FacetValue, aH as FacetsResponse, aI as FilterField, aJ as FulfillmentStatus, aK as FulfillmentStatuses, aL as GamificationRefreshResult, aM as GiftCardBalance, aN as GiftCardPurchaseInput, aO as GiftCardPurchaseResult, aP as GiftCardSummary, aQ as LessonNote, aR as LessonQuiz, aS as LoginInput, aT as LoyaltyBalance, aU as LoyaltyNextTier, aV as LoyaltyProgram, aW as LoyaltyQuery, aX as LoyaltyReferralResult, aY as LoyaltySummary, aZ as LoyaltyTier, a_ as LoyaltyTierPerks, a$ as LoyaltyTransaction, b0 as Menu, b1 as MenuItem, b2 as MenuItemRef, b3 as MenuItemType, b4 as MessageResponse, b5 as NewsletterConfirmResult, b6 as NewsletterOptInDefault, b7 as NewsletterSubscribeInput, b8 as NewsletterSubscribeResult, b9 as
|
|
1
|
+
import { P as ProductDetail, a as ProductVariant, B as BehioStorefront, S as SdkResult, C as CookieConsent, b as StorefrontFormFieldError, c as StorefrontFormPlacement } from './client-Bpefn9PP.js';
|
|
2
|
+
export { A as ActivePromotion, d as AddToCartInput, e as AddToCartItemsInput, f as AddressDetail, g as AddressSuggestion, h as AddressType, i as AddressTypes, j as AuthTokens, k as BackInStockSubscription, l as BadgeTone, m as BehioApiError, n as BehioErrorCode, o as BehioEventHandler, p as BehioEventType, q as BehioNetworkError, r as BehioStorefrontConfig, s as Blog, t as BlogPostDetail, u as BlogPostListItem, v as BlogPostsPage, w as BlogPostsQuery, x as BlogSettings, y as BlogTag, z as Booking, D as BookingCategory, E as BookingConfig, F as BookingCreateInput, G as BookingCreated, H as BookingLocale, I as BookingLocation, J as BookingManageSlotsQuery, K as BookingService, L as BookingSlot, M as BookingSlots, N as BookingSlotsQuery, O as BookingStaff, Q as BookingStatus, R as Bundle, T as BundleCatalogQuery, U as BundleItem, V as Cart, W as CartBundleLine, X as CartBundleLineItem, Y as CartDiscount, Z as CartItem, _ as CartItemProduct, $ as CartLinkClaimed, a0 as CartPromotion, a1 as CartSummaryEvent, a2 as Category, a3 as CategoryDetail, a4 as CertificateVerification, a5 as CheckoutAddress, a6 as CheckoutInput, a7 as CheckoutPaymentMethod, a8 as CheckoutPreview, a9 as CheckoutResult, aa as CheckoutSettings, ab as CookieConsentInput, ac as CourseAttachment, ad as CourseCertificate, ae as CourseComment, af as CourseCommentReply, ag as CourseCommentsList, ah as CourseDetail, ai as CourseLesson, aj as CourseListItem, ak as CourseModule, al as CoursePostedComment, am as CourseProgress, an as CourseTutorMessage, ao as CourseTutorThread, ap as CrossSellItem, aq as CurrencyDisplayFormat, ar as CustomerAddress, as as CustomerBadge, at as CustomerChallenge, au as CustomerGamification, av as CustomerGamificationQuery, aw as CustomerProfile, ax as DigitalDownload, ay as DownloadUrl, az as Facet, aA as FacetAvailability, aB as FacetCategory, aC as FacetLabel, aD as FacetPriceRange, aE as FacetRange, aF as FacetRatingBucket, aG as FacetValue, aH as FacetsResponse, aI as FilterField, aJ as FulfillmentStatus, aK as FulfillmentStatuses, aL as GamificationRefreshResult, aM as GiftCardBalance, aN as GiftCardPurchaseInput, aO as GiftCardPurchaseResult, aP as GiftCardSummary, aQ as LessonNote, aR as LessonQuiz, aS as LoginInput, aT as LoyaltyBalance, aU as LoyaltyNextTier, aV as LoyaltyProgram, aW as LoyaltyQuery, aX as LoyaltyReferralResult, aY as LoyaltySummary, aZ as LoyaltyTier, a_ as LoyaltyTierPerks, a$ as LoyaltyTransaction, b0 as Menu, b1 as MenuItem, b2 as MenuItemRef, b3 as MenuItemType, b4 as MessageResponse, b5 as NewsletterConfirmResult, b6 as NewsletterOptInDefault, b7 as NewsletterSubscribeInput, b8 as NewsletterSubscribeResult, b9 as NewsletterUnsubscribeInput, ba as NewsletterUnsubscribeResult, bb as OrderAccessRequestResponse, bc as OrderAccessVerifyResponse, bd as OrderDetail, be as OrderDiscount, bf as OrderDocument, bg as OrderItem, bh as OrderListItem, bi as OrderPaymentInstructions, bj as OrderPickupPoint, bk as OrderShipment, bl as OrderStatus, bm as OrderStatusHistory, bn as OrderStatuses, bo as OrderTracking, bp as Page, bq as PageAttachment, br as PageDetail, bs as PaginatedResponse, bt as PaymentInstrument, bu as PaymentStatus, bv as PaymentStatuses, bw as PaymentSwift, bx as PickupPoint, by as PickupPointHours, bz as PickupPointsInput, bA as PickupWidgetConfig, bB as PriceDisplay, bC as ProductAssetGroup, bD as ProductAssetItem, bE as ProductAvailability, bF as ProductGroup, bG as ProductLabel, bH as ProductListItem, bI as ProductMedia, bJ as ProductMediaVariant, bK as ProductParameter, bL as ProductParameterGroup, bM as ProductParametersResponse, bN as ProductPrice, bO as ProductPromotionSummary, bP as ProductReview, bQ as ProductReviewsResponse, bR as ProductSibling, bS as ProductSort, bT as ProductSortValue, bU as ProductVolumePrice, bV as ProductsQuery, bW as QuizAnswerInput, bX as QuizAnswerResult, bY as QuizQuestion, bZ as QuizResult, b_ as QuoteItem, b$ as QuoteRequest, c0 as RegisterInput, c1 as RegisterResult, c2 as RequestInterceptor, c3 as RequestInterceptorConfig, c4 as ResponseInterceptor, c5 as ResponseInterceptorData, c6 as ReturnRequest, c7 as ReturnRequestItem, c8 as ReturnStatus, c9 as ReturnStatusItem, ca as ReturnableOrder, cb as ReturnableOrderItem, cc as SdkError, cd as ShippingMethodSummary, ce as ShippingPublicConfig, cf as ShippingQuote, cg as ShippingQuoteInput, ch as ShopAppearance, ci as ShopCommerce, cj as ShopInfo, ck as ShopScript, cl as ShopScriptPlacement, cm as ShopScriptType, cn as ShopScripts, co as ShopSeo, cp as ShopSeoIdentity, cq as SiteFormField, cr as SiteFormFieldOption, cs as SiteFormFieldType, ct as Sitemap, cu as SitemapEntry, cv as StockBehavior, cw as StockMode, cx as StorefrontCollection, cy as StorefrontCollectionField, cz as StorefrontCollectionFieldType, cA as StorefrontCollectionItem, cB as StorefrontCollectionQuery, cC as StorefrontFaqGroup, cD as StorefrontFaqGroupSummary, cE as StorefrontFaqGroups, cF as StorefrontFaqItem, cG as StorefrontFaqQuery, cH as StorefrontForm, cI as StorefrontFormFieldErrorCode, cJ as StorefrontFormFile, cK as StorefrontFormPresentation, cL as StorefrontFormSettings, cM as StorefrontFormSubmitInput, cN as StorefrontFormSubmitResult, cO as StorefrontFormUpload, cP as SubmitQuoteInput, cQ as SubmitReturnInput, cR as SubmitReviewInput, cS as SubmitWithdrawalInput, cT as Subscription, cU as SubscriptionAction, cV as SubscriptionFrequency, cW as SubscriptionItem, cX as SubscriptionStatus, cY as TaxBreakdownLine, cZ as VariantAxis, c_ as VariantAxisValue, c$ as WishlistItem, d0 as WithdrawalAcknowledgement, d1 as WithdrawalFlag, d2 as WithdrawalSettings, d3 as WithdrawalWindow, d4 as clearCartSummary, d5 as err, d6 as ok, d7 as publishCartSummary, d8 as toSdkError } from './client-Bpefn9PP.js';
|
|
3
|
+
|
|
4
|
+
interface HeaderReader {
|
|
5
|
+
get(name: string): string | null;
|
|
6
|
+
}
|
|
7
|
+
declare function trustedVisitorIp(headers: HeaderReader, originSecret?: string | null): string | undefined;
|
|
3
8
|
|
|
4
9
|
/**
|
|
5
10
|
* Format a price amount with currency using Intl.NumberFormat.
|
|
@@ -303,4 +308,4 @@ declare class FormPopupPreferences {
|
|
|
303
308
|
dismiss(slug: string, days: number): void;
|
|
304
309
|
}
|
|
305
310
|
|
|
306
|
-
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, FormPopupClock, FormPopupPreferences, NEWSLETTER_REQUESTED_EVENT, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, StorefrontFormPlacement, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formPopupRouteAllowed, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, markNewsletterRequested, matchesFormPath, newsletterWasRequested, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, validationFieldMessages, variantFromQuery, variantHref };
|
|
311
|
+
export { BehioStorefront, CookieConsent, type EcommerceEventName, type EcommerceItem, type EcommercePayload, type ErrorMessageLocale, FormPopupClock, FormPopupPreferences, type HeaderReader, NEWSLETTER_REQUESTED_EVENT, ProductDetail, ProductVariant, type ResolvedVariantContent, SdkResult, StorefrontFormFieldError, StorefrontFormPlacement, VARIANT_QUERY_PARAM, type VariantComparisonRow, availableAxisValues, buildVariantComparison, errorCode, errorMessage, errorParams, findVariantByAttributes, formFieldErrors, formPopupRouteAllowed, formatPrice, generateVisitorId, getStoredVisitorId, grantAnalyticsConsent, markNewsletterRequested, matchesFormPath, newsletterWasRequested, resolveVariantContent, revokeAnalyticsConsent, trackEcommerceEvent, trustedVisitorIp, validationFieldMessages, variantFromQuery, variantHref };
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
var _chunkESGGBGDUjs = require('./chunk-ESGGBGDU.js');
|
|
16
17
|
|
|
17
18
|
// src/react/utils/format-price.ts
|
|
18
19
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -1118,7 +1119,7 @@ var GENERIC = {
|
|
|
1118
1119
|
en: "Something went wrong, please try again."
|
|
1119
1120
|
};
|
|
1120
1121
|
function bodyOf(err2) {
|
|
1121
|
-
const body = err2 instanceof
|
|
1122
|
+
const body = err2 instanceof _chunkESGGBGDUjs.BehioApiError ? err2.body : err2 && typeof err2 === "object" && "body" in err2 ? err2.body : err2;
|
|
1122
1123
|
return body && typeof body === "object" ? body : null;
|
|
1123
1124
|
}
|
|
1124
1125
|
function errorCode(err2) {
|
|
@@ -1384,4 +1385,5 @@ var FormPopupPreferences = class {
|
|
|
1384
1385
|
|
|
1385
1386
|
|
|
1386
1387
|
|
|
1387
|
-
|
|
1388
|
+
|
|
1389
|
+
exports.AddressTypes = _chunkESGGBGDUjs.AddressTypes; exports.BehioApiError = _chunkESGGBGDUjs.BehioApiError; exports.BehioNetworkError = _chunkESGGBGDUjs.BehioNetworkError; exports.BehioStorefront = _chunkESGGBGDUjs.BehioStorefront; exports.FormPopupClock = FormPopupClock; exports.FormPopupPreferences = FormPopupPreferences; exports.FulfillmentStatuses = _chunkESGGBGDUjs.FulfillmentStatuses; exports.NEWSLETTER_REQUESTED_EVENT = NEWSLETTER_REQUESTED_EVENT; exports.OrderStatuses = _chunkESGGBGDUjs.OrderStatuses; exports.PaymentStatuses = _chunkESGGBGDUjs.PaymentStatuses; exports.ProductSort = _chunkESGGBGDUjs.ProductSort; exports.VARIANT_QUERY_PARAM = VARIANT_QUERY_PARAM; exports.availableAxisValues = availableAxisValues; exports.buildVariantComparison = buildVariantComparison; exports.clearCartSummary = _chunkESGGBGDUjs.clearCartSummary; exports.err = _chunkESGGBGDUjs.err; exports.errorCode = errorCode; exports.errorMessage = errorMessage; exports.errorParams = errorParams; exports.findVariantByAttributes = findVariantByAttributes; exports.formFieldErrors = formFieldErrors; exports.formPopupRouteAllowed = formPopupRouteAllowed; exports.formatPrice = formatPrice; exports.generateVisitorId = generateVisitorId; exports.getStoredVisitorId = getStoredVisitorId; exports.grantAnalyticsConsent = grantAnalyticsConsent; exports.markNewsletterRequested = markNewsletterRequested; exports.matchesFormPath = matchesFormPath; exports.newsletterWasRequested = newsletterWasRequested; exports.ok = _chunkESGGBGDUjs.ok; exports.publishCartSummary = _chunkESGGBGDUjs.publishCartSummary; exports.resolveVariantContent = resolveVariantContent; exports.revokeAnalyticsConsent = revokeAnalyticsConsent; exports.toSdkError = _chunkESGGBGDUjs.toSdkError; exports.trackEcommerceEvent = trackEcommerceEvent; exports.trustedVisitorIp = _chunkESGGBGDUjs.trustedVisitorIp; exports.validationFieldMessages = validationFieldMessages; exports.variantFromQuery = variantFromQuery; exports.variantHref = variantHref;
|
package/dist/index.mjs
CHANGED
|
@@ -11,8 +11,9 @@ import {
|
|
|
11
11
|
err,
|
|
12
12
|
ok,
|
|
13
13
|
publishCartSummary,
|
|
14
|
-
toSdkError
|
|
15
|
-
|
|
14
|
+
toSdkError,
|
|
15
|
+
trustedVisitorIp
|
|
16
|
+
} from "./chunk-RRYPFOL7.mjs";
|
|
16
17
|
|
|
17
18
|
// src/react/utils/format-price.ts
|
|
18
19
|
function formatPrice(amount, currency, locale, display) {
|
|
@@ -1381,6 +1382,7 @@ export {
|
|
|
1381
1382
|
revokeAnalyticsConsent,
|
|
1382
1383
|
toSdkError,
|
|
1383
1384
|
trackEcommerceEvent,
|
|
1385
|
+
trustedVisitorIp,
|
|
1384
1386
|
validationFieldMessages,
|
|
1385
1387
|
variantFromQuery,
|
|
1386
1388
|
variantHref
|
package/dist/next.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { r as BehioStorefrontConfig, B as BehioStorefront } from './client-Bpefn9PP.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 { r as BehioStorefrontConfig, B as BehioStorefront } from './client-
|
|
1
|
+
import { r as BehioStorefrontConfig, B as BehioStorefront } from './client-Bpefn9PP.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,7 @@
|
|
|
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
|
-
|
|
3
|
+
|
|
4
|
+
var _chunkESGGBGDUjs = require('./chunk-ESGGBGDU.js');
|
|
4
5
|
|
|
5
6
|
// src/next.ts
|
|
6
7
|
var _headers = require('next/headers');
|
|
@@ -19,7 +20,7 @@ async function getBehio(options = {}) {
|
|
|
19
20
|
const locale = _nullishCoalesce(options.locale, () => ( process.env.BEHIO_LOCALE));
|
|
20
21
|
const currency = _nullishCoalesce(options.currency, () => ( process.env.BEHIO_CURRENCY));
|
|
21
22
|
const cookieName = _nullishCoalesce(options.cartCookieName, () => ( CART_COOKIE_NAME));
|
|
22
|
-
const client = new (0,
|
|
23
|
+
const client = new (0, _chunkESGGBGDUjs.BehioStorefront)({
|
|
23
24
|
apiKey,
|
|
24
25
|
...baseUrl ? { baseUrl } : {},
|
|
25
26
|
...locale ? { locale } : {},
|
|
@@ -36,16 +37,14 @@ async function getBehio(options = {}) {
|
|
|
36
37
|
}
|
|
37
38
|
if (!options.visitorIp) {
|
|
38
39
|
try {
|
|
39
|
-
const
|
|
40
|
-
const xff = h.get("x-forwarded-for");
|
|
41
|
-
const ip = (_nullishCoalesce(_nullishCoalesce(_optionalChain([xff, 'optionalAccess', _7 => _7.split, 'call', _8 => _8(","), 'access', _9 => _9[0]]), () => ( h.get("x-real-ip"))), () => ( ""))).trim();
|
|
40
|
+
const ip = _chunkESGGBGDUjs.trustedVisitorIp.call(void 0, await _headers.headers.call(void 0, ), process.env.CF_ORIGIN_SECRET);
|
|
42
41
|
if (ip) client.setVisitorIp(ip);
|
|
43
42
|
} catch (e) {
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
if (!currency) {
|
|
47
46
|
const currencyCookieName = _nullishCoalesce(options.currencyCookieName, () => ( CURRENCY_COOKIE_NAME));
|
|
48
|
-
const chosenCurrency = _optionalChain([cookieStore, 'access',
|
|
47
|
+
const chosenCurrency = _optionalChain([cookieStore, 'access', _7 => _7.get, 'call', _8 => _8(currencyCookieName), 'optionalAccess', _9 => _9.value]);
|
|
49
48
|
if (chosenCurrency) {
|
|
50
49
|
client.setCurrency(chosenCurrency);
|
|
51
50
|
}
|
package/dist/next.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
BehioStorefront
|
|
3
|
-
|
|
2
|
+
BehioStorefront,
|
|
3
|
+
trustedVisitorIp
|
|
4
|
+
} from "./chunk-RRYPFOL7.mjs";
|
|
4
5
|
|
|
5
6
|
// src/next.ts
|
|
6
7
|
import { cookies, headers } from "next/headers";
|
|
@@ -36,9 +37,7 @@ async function getBehio(options = {}) {
|
|
|
36
37
|
}
|
|
37
38
|
if (!options.visitorIp) {
|
|
38
39
|
try {
|
|
39
|
-
const
|
|
40
|
-
const xff = h.get("x-forwarded-for");
|
|
41
|
-
const ip = (xff?.split(",")[0] ?? h.get("x-real-ip") ?? "").trim();
|
|
40
|
+
const ip = trustedVisitorIp(await headers(), process.env.CF_ORIGIN_SECRET);
|
|
42
41
|
if (ip) client.setVisitorIp(ip);
|
|
43
42
|
} catch {
|
|
44
43
|
}
|
package/dist/react.d.mts
CHANGED
|
@@ -357,12 +357,14 @@ interface NewsletterSubscribeInput {
|
|
|
357
357
|
source?: string;
|
|
358
358
|
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
359
359
|
website?: string;
|
|
360
|
+
/** The consent wording shown to the visitor. Only its hash is stored, as proof. */
|
|
361
|
+
consentText?: string;
|
|
360
362
|
}
|
|
361
363
|
interface NewsletterSubscribeResult {
|
|
362
364
|
success: boolean;
|
|
363
365
|
/** Confirm the email before the subscription becomes active. */
|
|
364
366
|
confirmationRequired?: boolean;
|
|
365
|
-
/**
|
|
367
|
+
/** Always false: the answer never reveals who is on the list. */
|
|
366
368
|
alreadySubscribed: boolean;
|
|
367
369
|
}
|
|
368
370
|
interface NewsletterConfirmResult {
|
|
@@ -372,6 +374,8 @@ interface NewsletterConfirmResult {
|
|
|
372
374
|
}
|
|
373
375
|
interface NewsletterUnsubscribeResult {
|
|
374
376
|
success: boolean;
|
|
377
|
+
/** True for a bare email: its owner gets a signed link, nothing has changed yet. */
|
|
378
|
+
confirmationRequired: boolean;
|
|
375
379
|
}
|
|
376
380
|
interface ShopSeo {
|
|
377
381
|
robotsTxt?: string | null;
|
|
@@ -1681,6 +1685,8 @@ interface CheckoutInput {
|
|
|
1681
1685
|
termsConsent?: boolean;
|
|
1682
1686
|
gdprConsent?: boolean;
|
|
1683
1687
|
newsletterOptIn?: boolean;
|
|
1688
|
+
/** Wording of the newsletter checkbox as the customer saw it. Only its hash is stored, as proof of consent. */
|
|
1689
|
+
newsletterConsentText?: string;
|
|
1684
1690
|
/**
|
|
1685
1691
|
* Consent to start delivering digital content (courses, downloads,
|
|
1686
1692
|
* services) before the withdrawal period ends, which waives the right of
|
|
@@ -4493,11 +4499,11 @@ declare class FormsModule {
|
|
|
4493
4499
|
private client;
|
|
4494
4500
|
constructor(client: BehioStorefront);
|
|
4495
4501
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
4496
|
-
placements(): Promise<SdkResult<{
|
|
4502
|
+
placements(locale?: string): Promise<SdkResult<{
|
|
4497
4503
|
items: StorefrontForm[];
|
|
4498
4504
|
}>>;
|
|
4499
4505
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
4500
|
-
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
4506
|
+
get(slug: string, locale?: string): Promise<SdkResult<StorefrontForm>>;
|
|
4501
4507
|
/**
|
|
4502
4508
|
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
4503
4509
|
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
@@ -4695,8 +4701,8 @@ declare class ShippingModule {
|
|
|
4695
4701
|
/**
|
|
4696
4702
|
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
4697
4703
|
* checkout newsletter checkbox (render its default from
|
|
4698
|
-
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
4699
|
-
*
|
|
4704
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and the
|
|
4705
|
+
* answer never reveals who is on the list. Pass the hidden `website`
|
|
4700
4706
|
* honeypot field straight through from your form: a filled value is silently
|
|
4701
4707
|
* accepted but stored nowhere.
|
|
4702
4708
|
*/
|
|
@@ -4705,7 +4711,14 @@ declare class NewsletterModule {
|
|
|
4705
4711
|
constructor(client: BehioStorefront);
|
|
4706
4712
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
4707
4713
|
confirm(token: string): Promise<SdkResult<NewsletterConfirmResult>>;
|
|
4714
|
+
/**
|
|
4715
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
4716
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
4717
|
+
*/
|
|
4708
4718
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4719
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
4720
|
+
unsubscribeWithToken(token: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4721
|
+
private requestUnsubscribe;
|
|
4709
4722
|
}
|
|
4710
4723
|
|
|
4711
4724
|
interface BehioContextValue {
|
|
@@ -5416,11 +5429,16 @@ declare function useAnalyticsEvents(): {
|
|
|
5416
5429
|
* Subscribe an email to the shop newsletter (first-party opt-in, GAP-08).
|
|
5417
5430
|
* Use for the footer signup block; the checkout opt-in checkbox goes through
|
|
5418
5431
|
* the checkout input's `newsletterOptIn` instead. Subscribing is idempotent
|
|
5419
|
-
* and
|
|
5432
|
+
* and the answer never reveals who is on the list.
|
|
5420
5433
|
*/
|
|
5421
5434
|
declare function useNewsletterSubscribe(): _tanstack_react_query.UseMutationResult<NewsletterSubscribeResult, Error, NewsletterSubscribeInput, unknown>;
|
|
5422
|
-
/**
|
|
5423
|
-
|
|
5435
|
+
/**
|
|
5436
|
+
* Opt-out. An email only sends its owner a signed link; `{token}` from a
|
|
5437
|
+
* newsletter e-mail unsubscribes at once.
|
|
5438
|
+
*/
|
|
5439
|
+
declare function useNewsletterUnsubscribe(): _tanstack_react_query.UseMutationResult<NewsletterUnsubscribeResult, Error, string | {
|
|
5440
|
+
token: string;
|
|
5441
|
+
}, unknown>;
|
|
5424
5442
|
/** Explicit confirmation only. Never call on page load or link prefetch. */
|
|
5425
5443
|
declare function useNewsletterConfirm(): _tanstack_react_query.UseMutationResult<NewsletterConfirmResult, Error, string, unknown>;
|
|
5426
5444
|
|
package/dist/react.d.ts
CHANGED
|
@@ -357,12 +357,14 @@ interface NewsletterSubscribeInput {
|
|
|
357
357
|
source?: string;
|
|
358
358
|
/** Honeypot: keep empty. A filled value is treated as a bot and ignored. */
|
|
359
359
|
website?: string;
|
|
360
|
+
/** The consent wording shown to the visitor. Only its hash is stored, as proof. */
|
|
361
|
+
consentText?: string;
|
|
360
362
|
}
|
|
361
363
|
interface NewsletterSubscribeResult {
|
|
362
364
|
success: boolean;
|
|
363
365
|
/** Confirm the email before the subscription becomes active. */
|
|
364
366
|
confirmationRequired?: boolean;
|
|
365
|
-
/**
|
|
367
|
+
/** Always false: the answer never reveals who is on the list. */
|
|
366
368
|
alreadySubscribed: boolean;
|
|
367
369
|
}
|
|
368
370
|
interface NewsletterConfirmResult {
|
|
@@ -372,6 +374,8 @@ interface NewsletterConfirmResult {
|
|
|
372
374
|
}
|
|
373
375
|
interface NewsletterUnsubscribeResult {
|
|
374
376
|
success: boolean;
|
|
377
|
+
/** True for a bare email: its owner gets a signed link, nothing has changed yet. */
|
|
378
|
+
confirmationRequired: boolean;
|
|
375
379
|
}
|
|
376
380
|
interface ShopSeo {
|
|
377
381
|
robotsTxt?: string | null;
|
|
@@ -1681,6 +1685,8 @@ interface CheckoutInput {
|
|
|
1681
1685
|
termsConsent?: boolean;
|
|
1682
1686
|
gdprConsent?: boolean;
|
|
1683
1687
|
newsletterOptIn?: boolean;
|
|
1688
|
+
/** Wording of the newsletter checkbox as the customer saw it. Only its hash is stored, as proof of consent. */
|
|
1689
|
+
newsletterConsentText?: string;
|
|
1684
1690
|
/**
|
|
1685
1691
|
* Consent to start delivering digital content (courses, downloads,
|
|
1686
1692
|
* services) before the withdrawal period ends, which waives the right of
|
|
@@ -4493,11 +4499,11 @@ declare class FormsModule {
|
|
|
4493
4499
|
private client;
|
|
4494
4500
|
constructor(client: BehioStorefront);
|
|
4495
4501
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
4496
|
-
placements(): Promise<SdkResult<{
|
|
4502
|
+
placements(locale?: string): Promise<SdkResult<{
|
|
4497
4503
|
items: StorefrontForm[];
|
|
4498
4504
|
}>>;
|
|
4499
4505
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
4500
|
-
get(slug: string): Promise<SdkResult<StorefrontForm>>;
|
|
4506
|
+
get(slug: string, locale?: string): Promise<SdkResult<StorefrontForm>>;
|
|
4501
4507
|
/**
|
|
4502
4508
|
* Submit a response. On `be.forms.validationFailed` the returned error
|
|
4503
4509
|
* carries per-field codes: read them with `formFieldErrors(error)`. Other
|
|
@@ -4695,8 +4701,8 @@ declare class ShippingModule {
|
|
|
4695
4701
|
/**
|
|
4696
4702
|
* First-party newsletter opt-in. Use for the footer signup block and the
|
|
4697
4703
|
* checkout newsletter checkbox (render its default from
|
|
4698
|
-
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and
|
|
4699
|
-
*
|
|
4704
|
+
* `ShopInfo.checkout.newsletterOptInDefault`). Subscribing is idempotent and the
|
|
4705
|
+
* answer never reveals who is on the list. Pass the hidden `website`
|
|
4700
4706
|
* honeypot field straight through from your form: a filled value is silently
|
|
4701
4707
|
* accepted but stored nowhere.
|
|
4702
4708
|
*/
|
|
@@ -4705,7 +4711,14 @@ declare class NewsletterModule {
|
|
|
4705
4711
|
constructor(client: BehioStorefront);
|
|
4706
4712
|
subscribe(input: NewsletterSubscribeInput): Promise<SdkResult<NewsletterSubscribeResult>>;
|
|
4707
4713
|
confirm(token: string): Promise<SdkResult<NewsletterConfirmResult>>;
|
|
4714
|
+
/**
|
|
4715
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
4716
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
4717
|
+
*/
|
|
4708
4718
|
unsubscribe(email: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4719
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
4720
|
+
unsubscribeWithToken(token: string): Promise<SdkResult<NewsletterUnsubscribeResult>>;
|
|
4721
|
+
private requestUnsubscribe;
|
|
4709
4722
|
}
|
|
4710
4723
|
|
|
4711
4724
|
interface BehioContextValue {
|
|
@@ -5416,11 +5429,16 @@ declare function useAnalyticsEvents(): {
|
|
|
5416
5429
|
* Subscribe an email to the shop newsletter (first-party opt-in, GAP-08).
|
|
5417
5430
|
* Use for the footer signup block; the checkout opt-in checkbox goes through
|
|
5418
5431
|
* the checkout input's `newsletterOptIn` instead. Subscribing is idempotent
|
|
5419
|
-
* and
|
|
5432
|
+
* and the answer never reveals who is on the list.
|
|
5420
5433
|
*/
|
|
5421
5434
|
declare function useNewsletterSubscribe(): _tanstack_react_query.UseMutationResult<NewsletterSubscribeResult, Error, NewsletterSubscribeInput, unknown>;
|
|
5422
|
-
/**
|
|
5423
|
-
|
|
5435
|
+
/**
|
|
5436
|
+
* Opt-out. An email only sends its owner a signed link; `{token}` from a
|
|
5437
|
+
* newsletter e-mail unsubscribes at once.
|
|
5438
|
+
*/
|
|
5439
|
+
declare function useNewsletterUnsubscribe(): _tanstack_react_query.UseMutationResult<NewsletterUnsubscribeResult, Error, string | {
|
|
5440
|
+
token: string;
|
|
5441
|
+
}, unknown>;
|
|
5424
5442
|
/** Explicit confirmation only. Never call on page load or link prefetch. */
|
|
5425
5443
|
declare function useNewsletterConfirm(): _tanstack_react_query.UseMutationResult<NewsletterConfirmResult, Error, string, unknown>;
|
|
5426
5444
|
|
package/dist/react.js
CHANGED
|
@@ -2052,14 +2052,15 @@ var FormsModule = class {
|
|
|
2052
2052
|
this.client = client;
|
|
2053
2053
|
}
|
|
2054
2054
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
2055
|
-
async placements() {
|
|
2056
|
-
return this.client.request("GET", "/forms");
|
|
2055
|
+
async placements(locale) {
|
|
2056
|
+
return this.client.request("GET", "/forms", { query: { locale } });
|
|
2057
2057
|
}
|
|
2058
2058
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
2059
|
-
async get(slug) {
|
|
2059
|
+
async get(slug, locale) {
|
|
2060
2060
|
return this.client.request(
|
|
2061
2061
|
"GET",
|
|
2062
|
-
`/forms/${encodeURIComponent(slug)}
|
|
2062
|
+
`/forms/${encodeURIComponent(slug)}`,
|
|
2063
|
+
{ query: { locale } }
|
|
2063
2064
|
);
|
|
2064
2065
|
}
|
|
2065
2066
|
/**
|
|
@@ -2421,12 +2422,23 @@ var NewsletterModule = class {
|
|
|
2421
2422
|
auth: false
|
|
2422
2423
|
});
|
|
2423
2424
|
}
|
|
2425
|
+
/**
|
|
2426
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
2427
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
2428
|
+
*/
|
|
2424
2429
|
async unsubscribe(email) {
|
|
2430
|
+
return this.requestUnsubscribe({ email });
|
|
2431
|
+
}
|
|
2432
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
2433
|
+
async unsubscribeWithToken(token) {
|
|
2434
|
+
return this.requestUnsubscribe({ token });
|
|
2435
|
+
}
|
|
2436
|
+
requestUnsubscribe(input) {
|
|
2425
2437
|
return this.client.request(
|
|
2426
2438
|
"POST",
|
|
2427
2439
|
"/newsletter/unsubscribe",
|
|
2428
2440
|
{
|
|
2429
|
-
body:
|
|
2441
|
+
body: input,
|
|
2430
2442
|
auth: false
|
|
2431
2443
|
}
|
|
2432
2444
|
);
|
|
@@ -4108,7 +4120,9 @@ function useNewsletterSubscribe() {
|
|
|
4108
4120
|
function useNewsletterUnsubscribe() {
|
|
4109
4121
|
const { client } = useBehio();
|
|
4110
4122
|
return (0, import_react_query30.useMutation)({
|
|
4111
|
-
mutationFn: (
|
|
4123
|
+
mutationFn: (input) => unwrap(
|
|
4124
|
+
typeof input === "string" ? client.newsletter.unsubscribe(input) : client.newsletter.unsubscribeWithToken(input.token)
|
|
4125
|
+
)
|
|
4112
4126
|
});
|
|
4113
4127
|
}
|
|
4114
4128
|
function useNewsletterConfirm() {
|
|
@@ -4445,9 +4459,10 @@ function formFieldErrors(err) {
|
|
|
4445
4459
|
// src/react/hooks/use-site-form.ts
|
|
4446
4460
|
function useSiteForm(slug, options) {
|
|
4447
4461
|
const { client } = useBehio();
|
|
4462
|
+
const locale = client.getLocale();
|
|
4448
4463
|
return (0, import_react_query39.useQuery)({
|
|
4449
|
-
queryKey: ["behio", "form", slug],
|
|
4450
|
-
queryFn: () => unwrap(client.forms.get(slug)),
|
|
4464
|
+
queryKey: ["behio", "form", slug, locale],
|
|
4465
|
+
queryFn: () => unwrap(client.forms.get(slug, locale)),
|
|
4451
4466
|
enabled: options?.enabled !== false && !!slug
|
|
4452
4467
|
});
|
|
4453
4468
|
}
|
|
@@ -4492,7 +4507,8 @@ function useSiteFormSubmit(slug) {
|
|
|
4492
4507
|
}
|
|
4493
4508
|
function useFormPlacements(options) {
|
|
4494
4509
|
const { client } = useBehio();
|
|
4495
|
-
|
|
4510
|
+
const locale = client.getLocale();
|
|
4511
|
+
return (0, import_react_query39.useQuery)({ queryKey: ["behio", "form-placements", locale], queryFn: () => unwrap(client.forms.placements(locale)), initialData: options?.initialData, enabled: options?.enabled !== false, staleTime: 3e5 });
|
|
4496
4512
|
}
|
|
4497
4513
|
|
|
4498
4514
|
// src/react/hooks/use-bookings.ts
|
|
@@ -5403,7 +5419,7 @@ function useFormPopup({ forms, locales, pathname }) {
|
|
|
5403
5419
|
if (blocked(dialog.current)) continue;
|
|
5404
5420
|
opening = true;
|
|
5405
5421
|
try {
|
|
5406
|
-
const fresh = await client.forms.get(form.slug);
|
|
5422
|
+
const fresh = await client.forms.get(form.slug, client.getLocale());
|
|
5407
5423
|
if (disposed || document.hidden || fresh.error || fresh.data?.revision !== form.revision || blocked(dialog.current) || !formPopupRouteAllowed(publicPath(current.current.locales), placement)) return;
|
|
5408
5424
|
const open = async () => {
|
|
5409
5425
|
if (disposed || prefs.suppressed(form.slug, form.presentation?.purpose === "newsletter") || blocked(dialog.current)) return false;
|
|
@@ -5411,7 +5427,7 @@ function useFormPopup({ forms, locales, pathname }) {
|
|
|
5411
5427
|
returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
5412
5428
|
return new Promise((resolve) => {
|
|
5413
5429
|
mountedOffer.current = resolve;
|
|
5414
|
-
setActive(
|
|
5430
|
+
setActive({ form: fresh.data, placement });
|
|
5415
5431
|
});
|
|
5416
5432
|
};
|
|
5417
5433
|
const opened = navigator.locks ? await navigator.locks.request("behio-form-popup", { ifAvailable: true }, async (lock) => lock ? await open() : false) : await open();
|
package/dist/react.mjs
CHANGED
|
@@ -1926,14 +1926,15 @@ var FormsModule = class {
|
|
|
1926
1926
|
this.client = client;
|
|
1927
1927
|
}
|
|
1928
1928
|
/** Only active, published placements. Internal delivery/CRM settings never leave the server. */
|
|
1929
|
-
async placements() {
|
|
1930
|
-
return this.client.request("GET", "/forms");
|
|
1929
|
+
async placements(locale) {
|
|
1930
|
+
return this.client.request("GET", "/forms", { query: { locale } });
|
|
1931
1931
|
}
|
|
1932
1932
|
/** Public definition of one form (fields + settings). 404 for an unknown or inactive slug. */
|
|
1933
|
-
async get(slug) {
|
|
1933
|
+
async get(slug, locale) {
|
|
1934
1934
|
return this.client.request(
|
|
1935
1935
|
"GET",
|
|
1936
|
-
`/forms/${encodeURIComponent(slug)}
|
|
1936
|
+
`/forms/${encodeURIComponent(slug)}`,
|
|
1937
|
+
{ query: { locale } }
|
|
1937
1938
|
);
|
|
1938
1939
|
}
|
|
1939
1940
|
/**
|
|
@@ -2295,12 +2296,23 @@ var NewsletterModule = class {
|
|
|
2295
2296
|
auth: false
|
|
2296
2297
|
});
|
|
2297
2298
|
}
|
|
2299
|
+
/**
|
|
2300
|
+
* An address proves nothing, so this changes nothing yet: if the address is on
|
|
2301
|
+
* the list, its owner receives a signed link. The answer is the same either way.
|
|
2302
|
+
*/
|
|
2298
2303
|
async unsubscribe(email) {
|
|
2304
|
+
return this.requestUnsubscribe({ email });
|
|
2305
|
+
}
|
|
2306
|
+
/** Unsubscribes at once with the signed token from a newsletter e-mail. */
|
|
2307
|
+
async unsubscribeWithToken(token) {
|
|
2308
|
+
return this.requestUnsubscribe({ token });
|
|
2309
|
+
}
|
|
2310
|
+
requestUnsubscribe(input) {
|
|
2299
2311
|
return this.client.request(
|
|
2300
2312
|
"POST",
|
|
2301
2313
|
"/newsletter/unsubscribe",
|
|
2302
2314
|
{
|
|
2303
|
-
body:
|
|
2315
|
+
body: input,
|
|
2304
2316
|
auth: false
|
|
2305
2317
|
}
|
|
2306
2318
|
);
|
|
@@ -3982,7 +3994,9 @@ function useNewsletterSubscribe() {
|
|
|
3982
3994
|
function useNewsletterUnsubscribe() {
|
|
3983
3995
|
const { client } = useBehio();
|
|
3984
3996
|
return useMutation11({
|
|
3985
|
-
mutationFn: (
|
|
3997
|
+
mutationFn: (input) => unwrap(
|
|
3998
|
+
typeof input === "string" ? client.newsletter.unsubscribe(input) : client.newsletter.unsubscribeWithToken(input.token)
|
|
3999
|
+
)
|
|
3986
4000
|
});
|
|
3987
4001
|
}
|
|
3988
4002
|
function useNewsletterConfirm() {
|
|
@@ -4319,9 +4333,10 @@ function formFieldErrors(err) {
|
|
|
4319
4333
|
// src/react/hooks/use-site-form.ts
|
|
4320
4334
|
function useSiteForm(slug, options) {
|
|
4321
4335
|
const { client } = useBehio();
|
|
4336
|
+
const locale = client.getLocale();
|
|
4322
4337
|
return useQuery33({
|
|
4323
|
-
queryKey: ["behio", "form", slug],
|
|
4324
|
-
queryFn: () => unwrap(client.forms.get(slug)),
|
|
4338
|
+
queryKey: ["behio", "form", slug, locale],
|
|
4339
|
+
queryFn: () => unwrap(client.forms.get(slug, locale)),
|
|
4325
4340
|
enabled: options?.enabled !== false && !!slug
|
|
4326
4341
|
});
|
|
4327
4342
|
}
|
|
@@ -4366,7 +4381,8 @@ function useSiteFormSubmit(slug) {
|
|
|
4366
4381
|
}
|
|
4367
4382
|
function useFormPlacements(options) {
|
|
4368
4383
|
const { client } = useBehio();
|
|
4369
|
-
|
|
4384
|
+
const locale = client.getLocale();
|
|
4385
|
+
return useQuery33({ queryKey: ["behio", "form-placements", locale], queryFn: () => unwrap(client.forms.placements(locale)), initialData: options?.initialData, enabled: options?.enabled !== false, staleTime: 3e5 });
|
|
4370
4386
|
}
|
|
4371
4387
|
|
|
4372
4388
|
// src/react/hooks/use-bookings.ts
|
|
@@ -5277,7 +5293,7 @@ function useFormPopup({ forms, locales, pathname }) {
|
|
|
5277
5293
|
if (blocked(dialog.current)) continue;
|
|
5278
5294
|
opening = true;
|
|
5279
5295
|
try {
|
|
5280
|
-
const fresh = await client.forms.get(form.slug);
|
|
5296
|
+
const fresh = await client.forms.get(form.slug, client.getLocale());
|
|
5281
5297
|
if (disposed || document.hidden || fresh.error || fresh.data?.revision !== form.revision || blocked(dialog.current) || !formPopupRouteAllowed(publicPath(current.current.locales), placement)) return;
|
|
5282
5298
|
const open = async () => {
|
|
5283
5299
|
if (disposed || prefs.suppressed(form.slug, form.presentation?.purpose === "newsletter") || blocked(dialog.current)) return false;
|
|
@@ -5285,7 +5301,7 @@ function useFormPopup({ forms, locales, pathname }) {
|
|
|
5285
5301
|
returnFocus.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
|
|
5286
5302
|
return new Promise((resolve) => {
|
|
5287
5303
|
mountedOffer.current = resolve;
|
|
5288
|
-
setActive(
|
|
5304
|
+
setActive({ form: fresh.data, placement });
|
|
5289
5305
|
});
|
|
5290
5306
|
};
|
|
5291
5307
|
const opened = navigator.locks ? await navigator.locks.request("behio-form-popup", { ifAvailable: true }, async (lock) => lock ? await open() : false) : await open();
|