@riverbankcms/sdk 0.174.1 → 0.176.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/_dts/{BlocksIslandsHydrator-YRmc-Yxz.d.ts → BlocksIslandsHydrator-DvoTk7Py.d.ts} +1 -1
- package/dist/_dts/{Page-Du0zX1B-.d.ts → Page-D-l374tU.d.ts} +8 -16
- package/dist/_dts/{SdkPreviewMode-4L8v3FkY.d.ts → SdkPreviewMode-22DdQAj5.d.ts} +2 -2
- package/dist/_dts/{client-B1J6Akyf.d.ts → client-D4p0J1lK.d.ts} +487 -11
- package/dist/_dts/{content-types-CGGYI0u_.d.ts → content-types-0WWR6dC4.d.ts} +2 -2
- package/dist/_dts/{contracts-CHMlw9hT.d.ts → contracts-f_ZG_SwY.d.ts} +8 -8
- package/dist/_dts/{footerPageOutline-DIHSU1Vr.d.ts → footerPageOutline-DSeZvOaj.d.ts} +85 -8
- package/dist/_dts/{generatePageMetadata-JITXD6BU.d.ts → generatePageMetadata-BlitPA2D.d.ts} +2 -2
- package/dist/_dts/{index-BLEKFHt1.d.ts → index-CKkkCgb6.d.ts} +1 -1
- package/dist/_dts/{index-yWDbUojb.d.ts → index-CoLcwjqJ.d.ts} +1 -1
- package/dist/_dts/{index-DpJm0NpL.d.ts → index-D-ai8IQd.d.ts} +4 -4
- package/dist/_dts/{index-CXZSy_9M.d.ts → index-DDsfmM4d.d.ts} +2 -2
- package/dist/_dts/{index-CF62FntA.d.ts → index-EJMo-KSo.d.ts} +2 -2
- package/dist/_dts/{index-D9ZYmGAJ.d.ts → index-ZKEDvLuN.d.ts} +1 -1
- package/dist/_dts/{index-BgOr1Xyz.d.ts → index-tcPtGdag.d.ts} +3 -3
- package/dist/_dts/{loadContent-M-s0p0rq.d.ts → loadContent-Ci932ORy.d.ts} +7 -7
- package/dist/_dts/{request-BK-pHf0P.d.ts → request-B8jVdvgI.d.ts} +1993 -407
- package/dist/_dts/{resolveBlockData-DZAlnhwt.d.ts → resolveBlockData-DrSMuD76.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-DXUCWJ3y.d.ts → resolvePageContent-Be4iL6-F.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +13 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +3 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +5 -177
- package/dist/_dts/sdk/src/rendering/index.d.ts +7 -7
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +2 -1
- package/dist/_dts/{types-CwmB2NHU.d.ts → types-BXMX4z2j.d.ts} +7 -7
- package/dist/_dts/{types-DjVNADXR.d.ts → types-DXY64Xh4.d.ts} +4 -4
- package/dist/_dts/{types-Dmow_FI6.d.ts → types-lwSgCWZ4.d.ts} +11 -2
- package/dist/_dts/{validation-h8t1HLlL.d.ts → validation-C5xp--Fu.d.ts} +7 -4
- package/dist/client/{BlocksIslandsHydrator-DRVx_XLi.mjs → BlocksIslandsHydrator-CeYQQQs7.mjs} +17 -16
- package/dist/client/{BookingMailingListNote-CwrMzj-k.mjs → BookingMailingListNote-CDDWrY_W.mjs} +6 -6
- package/dist/client/{BookingPanelArrangement-C2_hFT6K.mjs → BookingPanelArrangement-BShQSial.mjs} +1 -1
- package/dist/client/{BookingQuestionFields-DZMrGvBh.mjs → BookingQuestionFields-MbvIo2jS.mjs} +3 -3
- package/dist/client/{CalendarNavigationChevron-Az1-TIEI.mjs → CalendarNavigationChevron-C6CSVfEB.mjs} +36 -11
- package/dist/client/DemoBookingPortalAccess-C9Ggcfx3.mjs +545 -0
- package/dist/client/{EventCalendar.client-CDkkP-Lv.mjs → EventCalendar.client-BSMuSqg0.mjs} +15 -25
- package/dist/client/{EventCombined.client-DK3aaz62.mjs → EventCombined.client-BTrmSyUB.mjs} +25 -17
- package/dist/client/{EventItem-WeUipfIP.mjs → EventItem-B0WjGXsH.mjs} +4 -3
- package/dist/client/{EventListWeekNavigation-D3sbAeDo.mjs → EventListWeekNavigation-8Ij7vuxY.mjs} +1 -1
- package/dist/client/{EventListing.client-DL3gGGmF.mjs → EventListing.client-CWk2NEwd.mjs} +3 -3
- package/dist/client/{EventListing.view-DKFImKOx.mjs → EventListing.view-BEH4UbSL.mjs} +18 -8
- package/dist/client/{EventRegistrationPayment-Dn9TpWyL.mjs → EventRegistrationPayment-B2EikR3f.mjs} +635 -359
- package/dist/client/{LocationMapActions-BJT7MqP2.mjs → LocationMapActions-myIQIvQL.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-DCIwlON6.mjs → MapDrawingSvg-BfsVyPvB.mjs} +2 -22
- package/dist/client/{Page-BpeP9xdt.mjs → Page-F3lhDvw1.mjs} +1036 -953
- package/dist/client/{DemoBookingPortalAccess-1p-pJ1lg.mjs → SiteTermsAgreementField-BYACYP0T.mjs} +4 -301
- package/dist/client/{StepIndicator-CP6zrwkl.mjs → StepIndicator-Bb7rPtSq.mjs} +37 -12
- package/dist/client/{accordion-nR7D4m1a.mjs → accordion-BfsOiweL.mjs} +1 -1
- package/dist/client/{booking-form.client-Ce-mQZ7W.mjs → booking-form.client-B8ohIj13.mjs} +229 -42
- package/dist/client/{bookingForm-B-qT_AQB.mjs → bookingForm-CXsck2oH.mjs} +4 -4
- package/dist/client/bookings.mjs +22 -15
- package/dist/client/{boxStyleClassNames-CrE3TDpW.mjs → boxStyleClassNames-B_hcuT06.mjs} +2 -1
- package/dist/client/{carousel-CVUOatsY.mjs → carousel-Cz5Ddbsx.mjs} +1 -1
- package/dist/client/{cart-DE0K6E0R.mjs → cart-CTC2oS3p.mjs} +3 -3
- package/dist/client/{cart.client-C23E6WQ5.mjs → cart.client-c1YkTC-Q.mjs} +1 -1
- package/dist/client/{checkout-76cdHyPL.mjs → checkout-BeW1ufaH.mjs} +3 -3
- package/dist/client/{checkout.client-DJOzqb26.mjs → checkout.client-BeU32khQ.mjs} +1 -1
- package/dist/client/{checkoutUrls-CvIP5DCO.mjs → checkoutUrls-DVfSUSKp.mjs} +1 -1
- package/dist/client/client.mjs +145 -21
- package/dist/client/{context-CNlesLfF.mjs → context-R9p5c8IH.mjs} +76 -58
- package/dist/client/{course-DHIrXqNT.mjs → course-CUFVJEAc.mjs} +2 -2
- package/dist/client/{creditProducts-KYMVIH3J.mjs → creditProducts-BQ1t1erI.mjs} +14 -61
- package/dist/client/{dateFormatting-B73Ll0s4.mjs → dateFormatting-CF6FWCoo.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BVbLD4pi.mjs → demoPortalMagicLink-tZxIm3RL.mjs} +1 -1
- package/dist/client/display-4HYOb-AK.mjs +11844 -0
- package/dist/client/{enhanceHeaderSection-5GD5o4Mt.mjs → enhanceHeaderSection-DEYDI54E.mjs} +3 -3
- package/dist/client/{event-details.client-D7Oz1q2L.mjs → event-details.client-BwjBJP-f.mjs} +1 -1
- package/dist/client/{event-registration.client-zbuX36aA.mjs → event-registration.client-DWvSODTI.mjs} +176 -75
- package/dist/client/{eventCalendar-uZrksODt.mjs → eventCalendar-C9Pn9eeZ.mjs} +4 -4
- package/dist/client/{eventCombined-DxhvNAx8.mjs → eventCombined-Bdhk0fp0.mjs} +4 -4
- package/dist/client/{eventDetails-DCIH4BYG.mjs → eventDetails-C2LfNW_o.mjs} +2 -2
- package/dist/client/{eventListing-B9KrnPvc.mjs → eventListing-B-bJOQUk.mjs} +4 -4
- package/dist/client/{eventRegistration-TjnURMKl.mjs → eventRegistration-CbdmUiDT.mjs} +4 -4
- package/dist/client/{form-CfqIAhfN.mjs → form-BbUUt784.mjs} +3 -3
- package/dist/client/{form.client-CL6fF0cW.mjs → form.client-BVlz-9_t.mjs} +4 -4
- package/dist/client/{form.parts-Bf-L66Gg.mjs → form.parts-TB4UIrML.mjs} +1 -1
- package/dist/client/{formatDate-Dp7POa9Y.mjs → formatDate-TDHhFjFN.mjs} +1 -1
- package/dist/client/gifting/client.mjs +5 -3
- package/dist/client/gifting-CbNSrp7C.mjs +28 -0
- package/dist/client/gifting.client-B__bGhFc.mjs +404 -0
- package/dist/client/gifting.parts-CTA1sDW6.mjs +86 -0
- package/dist/client/{headerSection-WVXtOcuW.mjs → headerSection-5Wn9nUW_.mjs} +2 -2
- package/dist/client/{display-Cf_j5stk.mjs → lookSurfaces-BwiNdgMU.mjs} +2951 -14395
- package/dist/client/{newsletter-form.client-Bb7GAZpO.mjs → newsletter-form.client-B17WYHxZ.mjs} +7 -5
- package/dist/client/{newsletter-form.parts-BqOVRdIc.mjs → newsletter-form.parts-DN9wD1ZG.mjs} +3 -3
- package/dist/client/{newsletterForm-DOVe-qY3.mjs → newsletterForm-DLMlxInp.mjs} +3 -3
- package/dist/client/{noop-D5mFWXtN.mjs → noop-CaQxI-Js.mjs} +94 -36
- package/dist/client/portal/client.mjs +313 -148
- package/dist/client/{product-detail.client-CNzeFnFf.mjs → product-detail.client-Di_anRGR.mjs} +1 -1
- package/dist/client/{product-list.client-LKpzC7pj.mjs → product-list.client-Duhl6rtL.mjs} +1 -1
- package/dist/client/{productDetail-D2JNeEgx.mjs → productDetail-BgKmCwA8.mjs} +3 -3
- package/dist/client/{productList-DTgZXOEq.mjs → productList-C_wMKsYS.mjs} +3 -3
- package/dist/client/{propsDecoder-mpBQt2AT.mjs → propsDecoder-y3LvxaiG.mjs} +4 -3
- package/dist/client/{registry.server-DdTJyar2.mjs → registry.server-CIWYKz1V.mjs} +369 -246
- package/dist/client/rendering/client.mjs +25 -491
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +87 -21
- package/dist/client/{richText-coerce-C32cRQ03.mjs → richText-coerce-DkPBFb_a.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-8cfSgT0E.mjs → routeIslandApiConfig-BgO0rZce.mjs} +1 -1
- package/dist/client/{shop-5LBhftWx.mjs → shop-CFbWlv_W.mjs} +3 -3
- package/dist/client/{shop-discount-apply.state-D0ifS6KX.mjs → shop-add-feedback-DvC2kP1K.mjs} +1 -78
- package/dist/client/{shop-commerce-DkValjZj.mjs → shop-commerce-C-I29eaA.mjs} +64 -32
- package/dist/client/{shop-commerce-store-BOmXFmk_.mjs → shop-commerce-store-DGcc7twO.mjs} +1 -1
- package/dist/client/shop-discount-apply.state-DOm7vx0X.mjs +83 -0
- package/dist/client/{shop.client-BTtZqNmv.mjs → shop.client-GHTWUKD6.mjs} +56 -19
- package/dist/client/{shop.interactive-DNRqG4aX.mjs → shop.interactive-CxDJ8P2r.mjs} +113 -35
- package/dist/client/{shopShared-Nky6kPYr.mjs → shopShared-Be9QJJpT.mjs} +2 -2
- package/dist/client/{timetableModel-DZArznD_.mjs → timetableModel--R0zVzZO.mjs} +10 -10
- package/dist/client/{useAvailableSlots-CUVRD1nx.mjs → useAvailableSlots-BGu_2F50.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-d7viY_mu.mjs → useDiscountCodeUi-I_mXI9Yd.mjs} +32 -17
- package/dist/client/{useEventPagination-Da2JqxGC.mjs → useEventPagination-DxIJ--JZ.mjs} +7 -6
- package/dist/client/{view-BvuYmQJ5.mjs → view-3foOzGWR.mjs} +3 -2
- package/dist/client/{view-D9ObkFtz.mjs → view-BbzH5MQb.mjs} +128 -32
- package/dist/preview-next/client/{PageSectionToolbar-DwxHT-2k.mjs → PageSectionToolbar-0xyUPWUB.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-D4SBxGU6.mjs → PreviewEditorSidebar-D8vUzXtI.mjs} +61 -55
- package/dist/preview-next/client/{PreviewEditorUI-D8mUct32.mjs → PreviewEditorUI-CRjS4gAu.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-L2AEdNUQ.mjs → PreviewShell-BvdBdeH_.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-bhVAU2D2.mjs → SdkPreviewModeRuntime-DWTyKbFj.mjs} +156 -143
- package/dist/preview-next/client/{previewAssistantSlot-Jpj_HDra.mjs → previewAssistantSlot-BqY2TTcZ.mjs} +4535 -2913
- package/dist/preview-next/client/{previewChromeRoot-CYTDvx4u.mjs → previewChromeRoot-BuRYe2iL.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CZHX6J_4.mjs → sdk-runtime-BnK5kH9f.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-DmGIG9Hk.mjs → siteStyleAccess-DbKozRSn.mjs} +527 -236
- package/dist/preview-next/client/{useAutosaveStatus-DQCyswQ-.mjs → useAutosaveStatus-D9s6dyMW.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-LwE5yXvL.mjs → useOpenBlockForSetup-Ce4WCxpT.mjs} +28 -5
- package/dist/preview-next/container-responsive.css +51 -3
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BOuNcOcN.mjs → route-contract-BYezcMx5.mjs} +94 -12
- package/dist/server/{Block.shared-wfJfhs08.mjs → Block.shared-Cn7gg13_.mjs} +84 -16
- package/dist/server/{ThemeScopeCore-BtrJNHTB.mjs → ThemeScopeCore-DFEM1a85.mjs} +16 -2
- package/dist/server/{bindings-P1CF2Gm6.mjs → bindings-VGgS6UvF.mjs} +13 -34
- package/dist/server/{client-CGtU5fHI.mjs → client-Bvag5OtW.mjs} +145 -22
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{customCss-BGB8gMVb.mjs → customCss-BZ8YSrQg.mjs} +1 -0
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-ChnkJSay.mjs → loadContent-CxASA3PE.mjs} +6 -9
- package/dist/server/{loadPage-DesHhgxj.mjs → loadPage-CQgde5DN.mjs} +2 -2
- package/dist/server/{lookMediaFrame-BBr0mkze.mjs → lookMediaFrame-CaH018pK.mjs} +24 -5
- package/dist/server/mapLocation-BM5WX7FY.mjs +315 -0
- package/dist/server/next.mjs +35 -9
- package/dist/server/{overrideResolution-DHEkHcZs.mjs → overrideResolution-BqVLO4gX.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-0jvm0RBk.mjs → pageRenderPlan-CfSnAkCO.mjs} +67 -40
- package/dist/server/{pageRuntimeSupport-8-f1Zr9e.mjs → pageRuntimeSupport-uz4gzBOo.mjs} +7 -15
- package/dist/server/{pageShared-CuVFoV4z.mjs → pageShared-D23o5QgC.mjs} +1068 -891
- package/dist/server/{parseThemeForPersistence-Cwqb5pZx.mjs → parseThemeForPersistence-DOsfofCy.mjs} +1 -1
- package/dist/server/{prebuild-Bms_Y7wQ.mjs → prebuild-BuoXWT9y.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-5oC5kyHe.mjs → prefetchBlockData-CCiYV8_s.mjs} +21 -6
- package/dist/server/{registry-DmqxC8th.mjs → registry-CXRXsFSx.mjs} +19721 -19621
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-EYogtwQc.mjs → resolveBlockData-yfe8WLEA.mjs} +1 -1
- package/dist/server/{responseMedia-DpBC1hTM.mjs → responseMedia-F-ElH2Rd.mjs} +1 -0
- package/dist/server/{schema-CUDHMirj.mjs → schema-BpsqaSSU.mjs} +2 -2
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{validation-Bt_8IL1g.mjs → validation-CozQ7wE0.mjs} +4 -4
- package/dist/server/{version-DT_efohp.mjs → version-CgCWRFEY.mjs} +1 -1
- package/dist/styles/index.css +295 -37
- package/package.json +1 -1
- package/dist/client/useDiscountApply-BBnStWXU.mjs +0 -199
- package/dist/server/identity-DQD_8lNO.mjs +0 -6
|
@@ -0,0 +1,545 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { f as err, p as ok } from "./renderableMediaAssetAdmission-BlfqYLJW.mjs";
|
|
3
|
+
import { Ha as leavePage } from "./display-4HYOb-AK.mjs";
|
|
4
|
+
import { i as BlockApiError, n as useBlockApi } from "./context-R9p5c8IH.mjs";
|
|
5
|
+
import { r as ThemedButton } from "./ThemedButton-DuaYtnvG.mjs";
|
|
6
|
+
import { n as buildPortalCallbackUrl, r as requestDemoPortalMagicLink, t as CUSTOMER_PORTAL_PATH } from "./demoPortalMagicLink-tZxIm3RL.mjs";
|
|
7
|
+
import React, { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region ../blocks/src/system/runtime/api/types/discounts.ts
|
|
10
|
+
function discountAvailabilityHasDiscounts(availability) {
|
|
11
|
+
return availability.type !== "none";
|
|
12
|
+
}
|
|
13
|
+
function discountAvailabilityAllowsManualEntry(availability) {
|
|
14
|
+
return "manualCodeEntryAllowed" in availability && availability.manualCodeEntryAllowed;
|
|
15
|
+
}
|
|
16
|
+
function getAutoAppliedDiscountPreview(availability) {
|
|
17
|
+
switch (availability.type) {
|
|
18
|
+
case "none":
|
|
19
|
+
case "manual": return null;
|
|
20
|
+
case "auto":
|
|
21
|
+
case "auto_and_manual": return availability.autoAppliedDiscount;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region ../blocks/src/system/runtime/shared/components/DiscountCodeDisclosure.tsx
|
|
26
|
+
const BLOCK_DISCOUNT_CODE_DISCLOSURE_CLASSES = { "event-registration": {
|
|
27
|
+
root: "er-discount",
|
|
28
|
+
toggle: "er-discount__toggle",
|
|
29
|
+
form: "er-discount__form",
|
|
30
|
+
label: "er-discount__label",
|
|
31
|
+
row: "er-discount__row",
|
|
32
|
+
input: "er-discount__input",
|
|
33
|
+
apply: "er-discount__apply",
|
|
34
|
+
remove: "er-discount__remove",
|
|
35
|
+
hint: "er-discount__hint",
|
|
36
|
+
feedback: "er-discount__feedback"
|
|
37
|
+
} };
|
|
38
|
+
const textLinkButtonClassName = ["button", "link"].join("-");
|
|
39
|
+
const themeFormClasses = {
|
|
40
|
+
root: "rb-flex rb-flex-col rb-gap-2 rb-mb-4",
|
|
41
|
+
toggle: `${textLinkButtonClassName} rb-self-start`,
|
|
42
|
+
form: "rb-flex rb-flex-col rb-gap-2",
|
|
43
|
+
label: "form-label",
|
|
44
|
+
row: "rb-flex rb-flex-col rb-gap-2 rb-sm-flex-row",
|
|
45
|
+
input: "form-input",
|
|
46
|
+
apply: "",
|
|
47
|
+
remove: "",
|
|
48
|
+
hint: "rb-caption status-muted",
|
|
49
|
+
feedback: "rb-caption"
|
|
50
|
+
};
|
|
51
|
+
function getDiscountCodeDisclosureClasses(surface) {
|
|
52
|
+
if (surface === "theme-form") return themeFormClasses;
|
|
53
|
+
return BLOCK_DISCOUNT_CODE_DISCLOSURE_CLASSES[surface];
|
|
54
|
+
}
|
|
55
|
+
function DiscountActionButton(props) {
|
|
56
|
+
return props.surface === "theme-form" ? /* @__PURE__ */ jsx(ThemedButton, {
|
|
57
|
+
type: "button",
|
|
58
|
+
variant: "secondary",
|
|
59
|
+
size: "sm",
|
|
60
|
+
label: props.label,
|
|
61
|
+
onClick: props.onClick,
|
|
62
|
+
disabled: props.disabled
|
|
63
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
64
|
+
type: "button",
|
|
65
|
+
className: props.className,
|
|
66
|
+
onClick: props.onClick,
|
|
67
|
+
disabled: props.disabled,
|
|
68
|
+
children: props.label
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const feedbackMessage = (feedback) => feedback?.message ?? null;
|
|
72
|
+
/** The booking panel scrolls in a short box, so what just appeared may be below its edge. */
|
|
73
|
+
function bringIntoView(element) {
|
|
74
|
+
const reducedMotion = window.matchMedia?.("(prefers-reduced-motion: reduce)").matches ?? false;
|
|
75
|
+
element?.scrollIntoView?.({
|
|
76
|
+
block: "nearest",
|
|
77
|
+
behavior: reducedMotion ? "auto" : "smooth"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
/** Runs when the value changes to something set, not on mount, so a field already on screen never moves the page. */
|
|
81
|
+
function useBringIntoViewOnChange(value) {
|
|
82
|
+
const ref = useRef(null);
|
|
83
|
+
const previous = useRef(value);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
if (previous.current === value) return;
|
|
86
|
+
previous.current = value;
|
|
87
|
+
if (value) bringIntoView(ref.current);
|
|
88
|
+
}, [value]);
|
|
89
|
+
return ref;
|
|
90
|
+
}
|
|
91
|
+
function DiscountFeedbackLine({ feedback, className, elementRef }) {
|
|
92
|
+
return /* @__PURE__ */ jsx("p", {
|
|
93
|
+
ref: elementRef,
|
|
94
|
+
className: `${className} status-${feedback.tone}`,
|
|
95
|
+
role: feedback.tone === "error" ? "alert" : "status",
|
|
96
|
+
children: feedback.message
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/** Remove shows once there's a code to clear; a surface with no Apply button has nothing to hold Pay back. */
|
|
100
|
+
function canRemoveCode(applied, onApply, code) {
|
|
101
|
+
return applied || Boolean(onApply) && code.trim() !== "";
|
|
102
|
+
}
|
|
103
|
+
function DiscountCodeDisclosure({ surface, isOpen, code, onOpen, onChange, onRemove, onApply, applied = false, id, toggleLabel = "Have a discount code?", label = "Discount code", placeholder = "Enter code", applyLabel = "Apply", removeLabel = "Remove", hint, feedback = null, isApplying = false, applyDisabled = false, disabled = false }) {
|
|
104
|
+
const generatedId = useId();
|
|
105
|
+
const inputId = id ?? `discount-code-${generatedId}`;
|
|
106
|
+
const classes = getDiscountCodeDisclosureClasses(surface);
|
|
107
|
+
const formRef = useBringIntoViewOnChange(isOpen);
|
|
108
|
+
const feedbackRef = useBringIntoViewOnChange(feedbackMessage(feedback));
|
|
109
|
+
const handleChange = (event) => {
|
|
110
|
+
onChange(event.target.value);
|
|
111
|
+
};
|
|
112
|
+
const handleKeyDown = (event) => {
|
|
113
|
+
if (!onApply || event.key !== "Enter") return;
|
|
114
|
+
event.preventDefault();
|
|
115
|
+
if (!disabled && !isApplying && !applyDisabled) onApply();
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ jsx("div", {
|
|
118
|
+
className: classes.root,
|
|
119
|
+
children: !isOpen ? /* @__PURE__ */ jsx("button", {
|
|
120
|
+
type: "button",
|
|
121
|
+
className: classes.toggle,
|
|
122
|
+
onClick: onOpen,
|
|
123
|
+
children: toggleLabel
|
|
124
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
125
|
+
ref: formRef,
|
|
126
|
+
className: classes.form,
|
|
127
|
+
children: [
|
|
128
|
+
/* @__PURE__ */ jsx("label", {
|
|
129
|
+
htmlFor: inputId,
|
|
130
|
+
className: classes.label,
|
|
131
|
+
children: label
|
|
132
|
+
}),
|
|
133
|
+
/* @__PURE__ */ jsxs("div", {
|
|
134
|
+
className: classes.row,
|
|
135
|
+
children: [
|
|
136
|
+
/* @__PURE__ */ jsx("input", {
|
|
137
|
+
id: inputId,
|
|
138
|
+
className: classes.input,
|
|
139
|
+
value: code,
|
|
140
|
+
onChange: handleChange,
|
|
141
|
+
onKeyDown: handleKeyDown,
|
|
142
|
+
placeholder,
|
|
143
|
+
autoComplete: "off",
|
|
144
|
+
disabled: disabled || isApplying
|
|
145
|
+
}),
|
|
146
|
+
onApply ? /* @__PURE__ */ jsx(DiscountActionButton, {
|
|
147
|
+
surface,
|
|
148
|
+
className: classes.apply,
|
|
149
|
+
label: isApplying ? "Applying..." : applyLabel,
|
|
150
|
+
onClick: onApply,
|
|
151
|
+
disabled: disabled || isApplying || applyDisabled
|
|
152
|
+
}) : null,
|
|
153
|
+
canRemoveCode(applied, onApply, code) ? /* @__PURE__ */ jsx("button", {
|
|
154
|
+
type: "button",
|
|
155
|
+
className: `${classes.remove} ${textLinkButtonClassName}`,
|
|
156
|
+
onClick: onRemove,
|
|
157
|
+
disabled: disabled || isApplying,
|
|
158
|
+
children: removeLabel
|
|
159
|
+
}) : null
|
|
160
|
+
]
|
|
161
|
+
}),
|
|
162
|
+
hint ? /* @__PURE__ */ jsx("p", {
|
|
163
|
+
className: classes.hint,
|
|
164
|
+
children: hint
|
|
165
|
+
}) : null,
|
|
166
|
+
feedback ? /* @__PURE__ */ jsx(DiscountFeedbackLine, {
|
|
167
|
+
feedback,
|
|
168
|
+
className: classes.feedback,
|
|
169
|
+
elementRef: feedbackRef
|
|
170
|
+
}) : null
|
|
171
|
+
]
|
|
172
|
+
})
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
//#region ../blocks/src/system/runtime/shared/navigation/NavigationHandOffPanel.tsx
|
|
177
|
+
function NavigationHandOffPanel(props) {
|
|
178
|
+
const [opened, setOpened] = useState(false);
|
|
179
|
+
const payment = props.purpose === "payment";
|
|
180
|
+
const offering = props.offeringLabel?.toLowerCase() ?? "event";
|
|
181
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
182
|
+
className: "rb-reg-stack er-stack",
|
|
183
|
+
"aria-live": "polite",
|
|
184
|
+
children: [
|
|
185
|
+
/* @__PURE__ */ jsx("h3", {
|
|
186
|
+
className: "er-title",
|
|
187
|
+
children: opened ? "Finish booking in the new tab" : payment ? "Finish paying in a new tab" : "Continue in a new tab"
|
|
188
|
+
}),
|
|
189
|
+
!opened && /* @__PURE__ */ jsx("p", {
|
|
190
|
+
className: "er-text",
|
|
191
|
+
children: handOffDescription(props, offering)
|
|
192
|
+
}),
|
|
193
|
+
opened && /* @__PURE__ */ jsxs("p", { children: ["Tab didn't open? ", /* @__PURE__ */ jsx("a", {
|
|
194
|
+
href: props.handOff.url,
|
|
195
|
+
target: "_blank",
|
|
196
|
+
rel: "noopener",
|
|
197
|
+
children: "Open the booking page"
|
|
198
|
+
})] }),
|
|
199
|
+
!opened && /* @__PURE__ */ jsx("a", {
|
|
200
|
+
className: "rb-button",
|
|
201
|
+
href: props.handOff.url,
|
|
202
|
+
target: "_blank",
|
|
203
|
+
rel: "noopener",
|
|
204
|
+
onClick: () => setOpened(true),
|
|
205
|
+
children: payment ? "Pay in a new tab" : "Continue in a new tab"
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ jsx("button", {
|
|
208
|
+
type: "button",
|
|
209
|
+
className: "er-portal-auth-link",
|
|
210
|
+
onClick: props.onBack,
|
|
211
|
+
children: props.purpose === "signIn" ? `Back to pay for this ${offering} instead` : "Back to my booking"
|
|
212
|
+
})
|
|
213
|
+
]
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
function handOffDescription(props, offering) {
|
|
217
|
+
if (props.purpose === "payment") return "We'll open a secure payment page in a new tab. Your booking is confirmed once you've paid.";
|
|
218
|
+
if (props.purpose === "signIn") return `You'll need to sign in to use a pass or membership. We'll open ${props.businessName ?? "the business"}'s booking page in a new tab, with this ${offering} already picked, and you can finish booking there. You'll need to enter your booking details again.`;
|
|
219
|
+
return "Open the booking page in a new tab to continue.";
|
|
220
|
+
}
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region ../blocks/src/system/runtime/nodes/shop-checkout-form.ts
|
|
223
|
+
const EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
224
|
+
function normalizeManualDiscountCode(raw) {
|
|
225
|
+
const trimmed = raw.trim();
|
|
226
|
+
return trimmed ? trimmed : null;
|
|
227
|
+
}
|
|
228
|
+
function normalizeCheckoutEmail(raw) {
|
|
229
|
+
const email = raw.trim().toLowerCase();
|
|
230
|
+
if (!email) return err({
|
|
231
|
+
type: "missing_contact",
|
|
232
|
+
message: "Please enter your email"
|
|
233
|
+
});
|
|
234
|
+
if (!EMAIL_PATTERN.test(email)) return err({
|
|
235
|
+
type: "invalid_email",
|
|
236
|
+
message: "Please enter a valid email address"
|
|
237
|
+
});
|
|
238
|
+
return ok(email);
|
|
239
|
+
}
|
|
240
|
+
function normalizeCheckoutContactForm(form) {
|
|
241
|
+
const emailValue = form.email.trim().toLowerCase();
|
|
242
|
+
const name = form.name.trim();
|
|
243
|
+
if (!emailValue || !name) return err({
|
|
244
|
+
type: "missing_contact",
|
|
245
|
+
message: "Please enter your email and name"
|
|
246
|
+
});
|
|
247
|
+
const email = normalizeCheckoutEmail(emailValue);
|
|
248
|
+
if (!email.ok) return email;
|
|
249
|
+
return ok({
|
|
250
|
+
email: email.value,
|
|
251
|
+
name
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function planDirectShopCheckoutRequest(input) {
|
|
255
|
+
const contact = normalizeCheckoutContactForm(input.form);
|
|
256
|
+
if (!contact.ok) return contact;
|
|
257
|
+
const discountCode = normalizeManualDiscountCode(input.form.discountCode);
|
|
258
|
+
return ok({
|
|
259
|
+
productType: input.productType,
|
|
260
|
+
productId: input.productId,
|
|
261
|
+
...input.teamMemberId ? { teamMemberId: input.teamMemberId } : {},
|
|
262
|
+
customerEmail: contact.value.email,
|
|
263
|
+
customerName: contact.value.name,
|
|
264
|
+
...discountCode ? { discountCode } : {},
|
|
265
|
+
successUrl: input.successUrl,
|
|
266
|
+
cancelUrl: input.cancelUrl,
|
|
267
|
+
...input.confirmDuplicate ? { confirmDuplicate: true } : {}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
function buildUnifiedCheckoutItems(checkout) {
|
|
271
|
+
return checkout.items.map((item) => item.kind === "product" ? {
|
|
272
|
+
type: "product",
|
|
273
|
+
productId: item.productId,
|
|
274
|
+
...item.variantId ? { variantId: item.variantId } : {},
|
|
275
|
+
quantity: item.quantity
|
|
276
|
+
} : {
|
|
277
|
+
type: "pass",
|
|
278
|
+
passId: item.passId,
|
|
279
|
+
...item.teamMember ? { teamMemberId: item.teamMember.id } : {}
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
function planUnifiedCheckoutRequest(input) {
|
|
283
|
+
if (input.checkout.kind === "empty") return err({
|
|
284
|
+
type: "empty_cart",
|
|
285
|
+
message: "Your cart is empty"
|
|
286
|
+
});
|
|
287
|
+
if (input.checkout.kind === "blocked") return err({
|
|
288
|
+
type: "blocked_cart",
|
|
289
|
+
reason: input.checkout.reason,
|
|
290
|
+
message: "Your cart contains items with different currencies"
|
|
291
|
+
});
|
|
292
|
+
const contact = normalizeCheckoutContactForm(input.form);
|
|
293
|
+
if (!contact.ok) return contact;
|
|
294
|
+
const discountCode = normalizeManualDiscountCode(input.form.discountCode);
|
|
295
|
+
return ok({
|
|
296
|
+
mode: "one_time",
|
|
297
|
+
items: buildUnifiedCheckoutItems(input.checkout),
|
|
298
|
+
customer: contact.value,
|
|
299
|
+
...discountCode ? { discountCode } : {},
|
|
300
|
+
successUrl: input.successUrl,
|
|
301
|
+
cancelUrl: input.cancelUrl
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
function planCartDiscountAvailabilityRequests(checkout) {
|
|
305
|
+
if (checkout.kind === "empty") return err({
|
|
306
|
+
type: "empty_cart",
|
|
307
|
+
message: "Your cart is empty"
|
|
308
|
+
});
|
|
309
|
+
if (checkout.kind === "blocked") return err({
|
|
310
|
+
type: "blocked_cart",
|
|
311
|
+
reason: checkout.reason,
|
|
312
|
+
message: "Your cart contains items with different currencies"
|
|
313
|
+
});
|
|
314
|
+
return ok(checkout.items.map((item) => {
|
|
315
|
+
const subtotalCents = Math.max(0, item.unitPriceCents * item.quantity);
|
|
316
|
+
if (item.kind === "product") return {
|
|
317
|
+
context: {
|
|
318
|
+
type: "product",
|
|
319
|
+
productId: item.productId,
|
|
320
|
+
productCategoryId: item.productCategoryId
|
|
321
|
+
},
|
|
322
|
+
subtotalCents,
|
|
323
|
+
currency: item.currency
|
|
324
|
+
};
|
|
325
|
+
return {
|
|
326
|
+
context: {
|
|
327
|
+
type: "pass",
|
|
328
|
+
passId: item.passId
|
|
329
|
+
},
|
|
330
|
+
subtotalCents,
|
|
331
|
+
currency: item.currency
|
|
332
|
+
};
|
|
333
|
+
}));
|
|
334
|
+
}
|
|
335
|
+
function aggregateCartDiscountUiState(availability) {
|
|
336
|
+
if (!availability.some(discountAvailabilityHasDiscounts)) return { type: "unavailable" };
|
|
337
|
+
if (availability.some(discountAvailabilityAllowsManualEntry)) return { type: "manual-allowed" };
|
|
338
|
+
return {
|
|
339
|
+
type: "auto-only",
|
|
340
|
+
autoAppliedDiscount: availability.map(getAutoAppliedDiscountPreview).find((discount) => discount !== null) ?? null
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
function checkoutFormForDiscountUiState(form, discountUiState) {
|
|
344
|
+
if (discountUiState.type === "manual-allowed") return form;
|
|
345
|
+
return {
|
|
346
|
+
...form,
|
|
347
|
+
discountCode: ""
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
//#endregion
|
|
351
|
+
//#region ../blocks/src/system/runtime/nodes/useDiscountApply.ts
|
|
352
|
+
const DISCOUNT_APPLY_MESSAGES = {
|
|
353
|
+
emptyCode: "Enter a discount code first.",
|
|
354
|
+
emailRequired: "Enter your email before applying a code.",
|
|
355
|
+
unavailable: "This code doesn't work for this booking.",
|
|
356
|
+
unknown: "We couldn't check that code. Try again."
|
|
357
|
+
};
|
|
358
|
+
/** A code the server refused at checkout, as opposed to the checkout itself failing. */
|
|
359
|
+
function isDiscountCodeRefusal(error) {
|
|
360
|
+
return error instanceof BlockApiError && error.fieldErrors.some((field) => field.field === "discountCode");
|
|
361
|
+
}
|
|
362
|
+
function refusedDiscountApply(reason, message) {
|
|
363
|
+
return {
|
|
364
|
+
kind: "refused",
|
|
365
|
+
action: {
|
|
366
|
+
type: "applyRejected",
|
|
367
|
+
reason,
|
|
368
|
+
message
|
|
369
|
+
}
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
/** What's needed before asking the server, in the order a visitor would be told about it. */
|
|
373
|
+
function planDiscountApplyRequest(options) {
|
|
374
|
+
const discountCode = normalizeManualDiscountCode(options.state.draftCode);
|
|
375
|
+
if (!discountCode) return refusedDiscountApply("empty_code", DISCOUNT_APPLY_MESSAGES.emptyCode);
|
|
376
|
+
const email = normalizeCheckoutEmail(options.getCustomerEmail());
|
|
377
|
+
if (!email.ok) return refusedDiscountApply("email_required", DISCOUNT_APPLY_MESSAGES.emailRequired);
|
|
378
|
+
const linesPlan = options.getLines();
|
|
379
|
+
if (!linesPlan.ok || linesPlan.lines.length === 0) return refusedDiscountApply("unavailable", DISCOUNT_APPLY_MESSAGES.unavailable);
|
|
380
|
+
return {
|
|
381
|
+
kind: "request",
|
|
382
|
+
request: {
|
|
383
|
+
discountCode,
|
|
384
|
+
customerEmail: email.value,
|
|
385
|
+
lines: linesPlan.lines
|
|
386
|
+
}
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function discountApplyResultAction(result) {
|
|
390
|
+
if (result.type === "applied") return {
|
|
391
|
+
type: "applySucceeded",
|
|
392
|
+
discount: result
|
|
393
|
+
};
|
|
394
|
+
return {
|
|
395
|
+
type: "applyRejected",
|
|
396
|
+
reason: result.type === "rejected" ? result.reason : "unavailable",
|
|
397
|
+
message: result.type === "rejected" ? result.message : DISCOUNT_APPLY_MESSAGES.unavailable
|
|
398
|
+
};
|
|
399
|
+
}
|
|
400
|
+
function useDiscountApply(options) {
|
|
401
|
+
const requestKey = JSON.stringify([
|
|
402
|
+
options.state.draftCode,
|
|
403
|
+
options.getCustomerEmail(),
|
|
404
|
+
options.getLines()
|
|
405
|
+
]);
|
|
406
|
+
const latestKey = useRef(requestKey);
|
|
407
|
+
latestKey.current = requestKey;
|
|
408
|
+
return useCallback(async () => {
|
|
409
|
+
const plan = planDiscountApplyRequest(options);
|
|
410
|
+
if (plan.kind === "refused") {
|
|
411
|
+
options.dispatch(plan.action);
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
options.dispatch({ type: "applyStarted" });
|
|
415
|
+
try {
|
|
416
|
+
const result = await options.api.applyDiscountCode(plan.request);
|
|
417
|
+
if (latestKey.current !== requestKey) return;
|
|
418
|
+
options.dispatch(discountApplyResultAction(result));
|
|
419
|
+
} catch {
|
|
420
|
+
if (latestKey.current !== requestKey) return;
|
|
421
|
+
options.dispatch({
|
|
422
|
+
type: "applyRejected",
|
|
423
|
+
reason: "unknown",
|
|
424
|
+
message: DISCOUNT_APPLY_MESSAGES.unknown
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
}, [options, requestKey]);
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region ../blocks/src/system/runtime/shared/components/DemoBookingPortalAccess.tsx
|
|
431
|
+
const SUPPRESSED_CONFIRMATION_NOTE = "This is a demo, so we haven’t sent a confirmation email. You can still see your booking in the customer portal.";
|
|
432
|
+
function BookingConfirmation(props) {
|
|
433
|
+
const content = renderConfirmationMessage((props.demoEmailSuppressed ? [props.copy.message] : [props.copy.message, props.copy.defaultEmailSentence ?? ""]).filter((part) => part.trim().length > 0).join(" "), props.messagePresentation);
|
|
434
|
+
if (!props.demoEmailSuppressed) return content;
|
|
435
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [content, /* @__PURE__ */ jsx(DemoBookingPortalAccess, {
|
|
436
|
+
email: props.email,
|
|
437
|
+
noteClassName: props.noteClassName,
|
|
438
|
+
showConfirmationNote: props.showConfirmationNote
|
|
439
|
+
})] });
|
|
440
|
+
}
|
|
441
|
+
function DemoBookingPortalAccess(props) {
|
|
442
|
+
const { state, openPortal, back } = useDemoBookingPortalAccess(props.email);
|
|
443
|
+
if (state.tag === "handOff") return /* @__PURE__ */ jsx(NavigationHandOffPanel, {
|
|
444
|
+
handOff: state.handOff,
|
|
445
|
+
onBack: back
|
|
446
|
+
});
|
|
447
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
448
|
+
className: "rb-mt-4 rb-flex rb-flex-col rb-items-start rb-gap-3",
|
|
449
|
+
"data-testid": "demo-booking-portal-access",
|
|
450
|
+
children: [
|
|
451
|
+
props.showConfirmationNote === false ? null : /* @__PURE__ */ jsx("p", {
|
|
452
|
+
className: props.noteClassName ?? "ab-text",
|
|
453
|
+
children: SUPPRESSED_CONFIRMATION_NOTE
|
|
454
|
+
}),
|
|
455
|
+
/* @__PURE__ */ jsx(ThemedButton, {
|
|
456
|
+
type: "button",
|
|
457
|
+
variant: "default",
|
|
458
|
+
size: "md",
|
|
459
|
+
label: state.tag === "opening" ? "Opening…" : "Open the customer portal",
|
|
460
|
+
disabled: state.tag === "opening",
|
|
461
|
+
onClick: openPortal
|
|
462
|
+
}),
|
|
463
|
+
state.tag === "refused" ? /* @__PURE__ */ jsx("p", {
|
|
464
|
+
role: "alert",
|
|
465
|
+
children: state.message
|
|
466
|
+
}) : null,
|
|
467
|
+
state.tag === "error" ? /* @__PURE__ */ jsx("p", {
|
|
468
|
+
role: "alert",
|
|
469
|
+
children: state.message
|
|
470
|
+
}) : null
|
|
471
|
+
]
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
function renderConfirmationMessage(message, presentation) {
|
|
475
|
+
if (!message) return null;
|
|
476
|
+
switch (presentation.kind) {
|
|
477
|
+
case "paragraph": return /* @__PURE__ */ jsx("p", {
|
|
478
|
+
className: presentation.className,
|
|
479
|
+
children: message
|
|
480
|
+
});
|
|
481
|
+
case "plain": return message;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function useDemoBookingPortalAccess(email) {
|
|
485
|
+
const api = useBlockApi();
|
|
486
|
+
const [state, setState] = React.useState({ tag: "idle" });
|
|
487
|
+
const openPortal = async () => {
|
|
488
|
+
if (state.tag === "opening") return;
|
|
489
|
+
if (!email) {
|
|
490
|
+
setState({
|
|
491
|
+
tag: "error",
|
|
492
|
+
message: "We couldn’t open the customer portal. Please try again."
|
|
493
|
+
});
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
setState({ tag: "opening" });
|
|
497
|
+
try {
|
|
498
|
+
const result = await requestDemoPortalMagicLink({
|
|
499
|
+
email,
|
|
500
|
+
redirectUrl: buildPortalCallbackUrl(window.location.origin, CUSTOMER_PORTAL_PATH),
|
|
501
|
+
send: (request) => api.sendMagicLink(request)
|
|
502
|
+
});
|
|
503
|
+
switch (result.kind) {
|
|
504
|
+
case "demo_sign_in":
|
|
505
|
+
const outcome = leavePage(result.url, api.config.pageNavigation);
|
|
506
|
+
if (outcome.kind === "handOff") setState({
|
|
507
|
+
tag: "handOff",
|
|
508
|
+
handOff: outcome
|
|
509
|
+
});
|
|
510
|
+
return;
|
|
511
|
+
case "refused":
|
|
512
|
+
setState({
|
|
513
|
+
tag: "refused",
|
|
514
|
+
message: result.message
|
|
515
|
+
});
|
|
516
|
+
return;
|
|
517
|
+
case "email_sent":
|
|
518
|
+
setState({ tag: "idle" });
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
521
|
+
} catch (error) {
|
|
522
|
+
setState(handlePortalAccessError(error));
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
return {
|
|
526
|
+
state,
|
|
527
|
+
openPortal,
|
|
528
|
+
back: () => setState({ tag: "idle" })
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
function handlePortalAccessError(error) {
|
|
532
|
+
if (error instanceof BlockApiError && error.tag === "demo_email_not_booked_here") return {
|
|
533
|
+
tag: "refused",
|
|
534
|
+
message: error.message
|
|
535
|
+
};
|
|
536
|
+
return error instanceof BlockApiError ? {
|
|
537
|
+
tag: "error",
|
|
538
|
+
message: error.message
|
|
539
|
+
} : {
|
|
540
|
+
tag: "error",
|
|
541
|
+
message: "We couldn’t open the customer portal. Please try again."
|
|
542
|
+
};
|
|
543
|
+
}
|
|
544
|
+
//#endregion
|
|
545
|
+
export { useDiscountApply as a, normalizeManualDiscountCode as c, planUnifiedCheckoutRequest as d, NavigationHandOffPanel as f, getAutoAppliedDiscountPreview as g, discountAvailabilityHasDiscounts as h, isDiscountCodeRefusal as i, planCartDiscountAvailabilityRequests as l, discountAvailabilityAllowsManualEntry as m, DemoBookingPortalAccess as n, aggregateCartDiscountUiState as o, DiscountCodeDisclosure as p, DISCOUNT_APPLY_MESSAGES as r, checkoutFormForDiscountUiState as s, BookingConfirmation as t, planDirectShopCheckoutRequest as u };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { a as CalendarRecurringWeek, i as buildWeekBoardViewProps, n as WeekBoardView, r as buildWeekBoardNavigationState, t as buildTimetableModel } from "./timetableModel
|
|
2
|
+
import { It as buildEventRuntimeFilters, en as buildEventListWeek, tn as eventListWeekDays, yt as buildEventCalendarListingRender } from "./shop.interactive-CxDJ8P2r.mjs";
|
|
3
|
+
import { _i as groupEventsByDate, di as formatEventHourLabel } from "./display-4HYOb-AK.mjs";
|
|
4
|
+
import { S as resolveCalendarReadProfile } from "./noop-CaQxI-Js.mjs";
|
|
5
|
+
import { a as CalendarRecurringWeek, i as buildWeekBoardViewProps, n as WeekBoardView, r as buildWeekBoardNavigationState, t as buildTimetableModel } from "./timetableModel--R0zVzZO.mjs";
|
|
6
6
|
import { d as formatDateKey, m as getOrderedDayNames } from "./src-xrjaKaCj.mjs";
|
|
7
7
|
import { r as ThemedButton } from "./ThemedButton-DuaYtnvG.mjs";
|
|
8
|
-
import { n as eventDisplayTitleText } from "./course-
|
|
9
|
-
import {
|
|
10
|
-
import { i as useEventCollectionFilters } from "./useEventPagination-
|
|
11
|
-
import { n as EventListingController } from "./EventListing.client-
|
|
12
|
-
import { a as CalendarDayCell, c as MonthLookClient, d as useCalendarToday, i as useHydrationReady, l as EventModalProvider, o as useCalendarEvents, r as EventModals, s as useCalendarViewport, t as EventCombinedClient, u as useEventModal } from "./EventCombined.client-
|
|
8
|
+
import { n as eventDisplayTitleText } from "./course-CUFVJEAc.mjs";
|
|
9
|
+
import { f as resolveMonthSelectedDay, i as WeekAgendaView, r as CalendarLoadFailure, t as CalendarNavigationChevron, u as CalendarDayHeaders } from "./CalendarNavigationChevron-C6CSVfEB.mjs";
|
|
10
|
+
import { i as useEventCollectionFilters } from "./useEventPagination-DxIJ--JZ.mjs";
|
|
11
|
+
import { n as EventListingController } from "./EventListing.client-CWk2NEwd.mjs";
|
|
12
|
+
import { a as CalendarDayCell, c as MonthLookClient, d as useCalendarToday, i as useHydrationReady, l as EventModalProvider, o as useCalendarEvents, r as EventModals, s as useCalendarViewport, t as EventCombinedClient, u as useEventModal } from "./EventCombined.client-BTrmSyUB.mjs";
|
|
13
13
|
import { useEffect, useMemo, useState } from "react";
|
|
14
14
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
15
15
|
//#region ../blocks/src/system/runtime/nodes/events/shared/WeekTimetableView.tsx
|
|
@@ -195,8 +195,7 @@ function EventCalendarCombinedClient({ render }) {
|
|
|
195
195
|
buttonText: display.buttonText,
|
|
196
196
|
emptyMessage: display.emptyMessage,
|
|
197
197
|
className: display.className ?? void 0,
|
|
198
|
-
calendarContext: hydration.calendarContext
|
|
199
|
-
calendarWindow: hydration.calendarWindow
|
|
198
|
+
calendarContext: hydration.calendarContext
|
|
200
199
|
});
|
|
201
200
|
}
|
|
202
201
|
const EventCalendarWeekBoardClient = ({ render }) => {
|
|
@@ -434,20 +433,11 @@ const EventCalendarChrome = ({ children, display, calendarView, className, loadS
|
|
|
434
433
|
label: "Today"
|
|
435
434
|
})]
|
|
436
435
|
}),
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
children: "Failed to load events"
|
|
443
|
-
}), /* @__PURE__ */ jsx(ThemedButton, {
|
|
444
|
-
type: "button",
|
|
445
|
-
onClick: onRetry,
|
|
446
|
-
variant: display.buttonVariant,
|
|
447
|
-
size: "sm",
|
|
448
|
-
label: "Try again"
|
|
449
|
-
})]
|
|
450
|
-
}) : null
|
|
436
|
+
loadState.kind === "error" ? /* @__PURE__ */ jsx(CalendarLoadFailure, {
|
|
437
|
+
buttonVariant: display.buttonVariant,
|
|
438
|
+
onRetry
|
|
439
|
+
}) : null,
|
|
440
|
+
children
|
|
451
441
|
]
|
|
452
442
|
});
|
|
453
443
|
/** Weekly list navigation changes the bounds on the existing cursor pager. */
|