@riverbankcms/sdk 0.168.0 → 0.169.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-CiD_VVGM.d.ts → BlocksIslandsHydrator-DpROiz12.d.ts} +1 -1
- package/dist/_dts/{Page-Bj6VJRS5.d.ts → Page-DHBBDRC_.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-ChpsnwDX.d.ts → SdkPreviewMode-CG7Qib7u.d.ts} +2 -2
- package/dist/_dts/{client-C8mfUxrJ.d.ts → client-MURxFla9.d.ts} +39 -397
- package/dist/_dts/{content-types-_vXZyR4H.d.ts → content-types-ClBGjxBV.d.ts} +2 -2
- package/dist/_dts/{contracts-CJFfrVKU.d.ts → contracts-CHNvzh0y.d.ts} +4 -3
- package/dist/_dts/{footerPageOutline-CMegb23G.d.ts → footerPageOutline-DQM934Fm.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-D9YdAIMh.d.ts → generatePageMetadata-ConZaEqB.d.ts} +2 -2
- package/dist/_dts/{index-BQXaZ7aY.d.ts → index-BaDqRekr.d.ts} +4 -4
- package/dist/_dts/{index-vR3p9Bu-.d.ts → index-CVB5wgbz.d.ts} +2 -2
- package/dist/_dts/{index-Cx2BQlHL.d.ts → index-CiR_oPYT.d.ts} +1 -1
- package/dist/_dts/{index-Bpr-wT5k.d.ts → index-CovKPftP.d.ts} +2 -2
- package/dist/_dts/{index-Dgz6yhsy.d.ts → index-DCw8LO4M.d.ts} +1 -1
- package/dist/_dts/{index-Vh8B9FSa.d.ts → index-DDaX-K2D.d.ts} +1 -1
- package/dist/_dts/{index-C7_Rz8EY.d.ts → index-rfAssXq0.d.ts} +3 -3
- package/dist/_dts/{loadContent-dhWSgLeS.d.ts → loadContent-CRLKVVDP.d.ts} +7 -7
- package/dist/_dts/{request-BrYhNV9Z.d.ts → request-DeVetKBr.d.ts} +1840 -599
- package/dist/_dts/{resolveBlockData-BfSHm8Ms.d.ts → resolveBlockData-C5KYFeig.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-gZJ4i1wN.d.ts → resolvePageContent-D8MZWyNO.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/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 +2 -2
- 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 +1 -1
- 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 +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- 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 +1 -1
- package/dist/_dts/{types-FOsJ-KYb.d.ts → types-B4MBlP_B.d.ts} +2 -2
- package/dist/_dts/{types-BVFXYtRg.d.ts → types-Fj31kIi2.d.ts} +7 -7
- package/dist/_dts/{types-BB33-Spd.d.ts → types-OwqfS8Gn.d.ts} +3 -3
- package/dist/_dts/{validation-DckTc6TQ.d.ts → validation-B1Fa8o_b.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DcwEaliO.mjs → BlocksIslandsHydrator-qq4Vhs7k.mjs} +16 -16
- package/dist/client/{BookingMailingListNote-Dsugoe-n.mjs → BookingMailingListNote-y3qWjnOo.mjs} +17 -6
- package/dist/client/{BookingQuestionFields-Bhh0cvsl.mjs → BookingQuestionFields-DjLjd0vc.mjs} +3 -3
- package/dist/client/{CalendarNavigationChevron-CNe3ZjdC.mjs → CalendarNavigationChevron-VM7C2fdh.mjs} +7 -7
- package/dist/client/{DemoBookingPortalAccess-BeiZxEUJ.mjs → DemoBookingPortalAccess-C2QCj_Ta.mjs} +65 -9
- package/dist/client/{EventCalendar.client-BL943-tl.mjs → EventCalendar.client-DDjz7tuX.mjs} +9 -9
- package/dist/client/{EventCombined.client-BFVxECTp.mjs → EventCombined.client-CeYbNsch.mjs} +7 -7
- package/dist/client/{EventItem-BIc4gjiD.mjs → EventItem-B5J0IeF4.mjs} +3 -3
- package/dist/client/{EventListWeekNavigation-a0QEIEf0.mjs → EventListWeekNavigation-eH04D8-V.mjs} +1 -1
- package/dist/client/{EventListing.client-CEFTC3jH.mjs → EventListing.client-slpvrTrM.mjs} +3 -3
- package/dist/client/{EventListing.view-Bt2sBBms.mjs → EventListing.view-BYBaElec.mjs} +5 -5
- package/dist/client/{EventRegistrationPayment-D9YBNb_E.mjs → EventRegistrationPayment-Do7Q0wRG.mjs} +121 -59
- package/dist/client/{LocationMapActions-gqzt5gkW.mjs → LocationMapActions-BFp2uQQQ.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-13JQI7_z.mjs → MapDrawingSvg-DDWfmgpA.mjs} +1 -1
- package/dist/client/{Page-D_M2Vxz3.mjs → Page-Dv9eIOGr.mjs} +20 -15
- package/dist/client/{StepIndicator-CaN8snZ8.mjs → StepIndicator-BZNUd0-v.mjs} +2 -2
- package/dist/client/{accordion-DE7OG--d.mjs → accordion-BCtVxnDZ.mjs} +1 -1
- package/dist/client/{booking-form.client-CS1PPjw7.mjs → booking-form.client-Cr5G-HHO.mjs} +504 -216
- package/dist/client/{bookingForm-DE2CwIU9.mjs → bookingForm-B1Fc62Sl.mjs} +8 -5
- package/dist/client/{bookingRoute-Bqlyu5Vb.mjs → bookingRoute-D6DlxYx6.mjs} +6 -2
- package/dist/client/bookings.mjs +16 -13
- package/dist/client/{carousel-DZyUdnFh.mjs → carousel-DW-HgjvT.mjs} +1 -1
- package/dist/client/{cart-D7HkkNwe.mjs → cart-D1zWe4R7.mjs} +3 -3
- package/dist/client/{cart.client-H4sv2TpD.mjs → cart.client-CIfbTLHS.mjs} +1 -1
- package/dist/client/{checkout-2qVyG-Sh.mjs → checkout-fDCNZ3IT.mjs} +3 -3
- package/dist/client/{checkout.client-DAjrBZ74.mjs → checkout.client-C4l2KjtV.mjs} +1 -1
- package/dist/client/{checkoutUrls-CYj06rX1.mjs → checkoutUrls-cWL6I-Vz.mjs} +3 -2
- package/dist/client/client.mjs +50 -3
- package/dist/client/{context-DXmIbXCK.mjs → context-DQnTyApV.mjs} +24 -2
- package/dist/client/{bookingQuestionValues-BjcyCru5.mjs → creditProducts-CMOmhWm2.mjs} +71 -11
- package/dist/client/{cta-DP_IBnq3.mjs → cta-Bj5WHgcv.mjs} +2 -2
- package/dist/client/{dateFormatting-CwrkFZTr.mjs → dateFormatting-Bv6kjUW3.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-DQXK-Fh6.mjs → demoPortalMagicLink-3uVu3WgG.mjs} +1 -1
- package/dist/client/{wizardSteps-CFulHWnT.mjs → display-CT8KMSpH.mjs} +893 -68
- package/dist/client/{enhanceHeaderSection-DheQj7rg.mjs → enhanceHeaderSection-B27KFGDv.mjs} +3 -2
- package/dist/client/{event-details.client-C5UufcRp.mjs → event-details.client-CL4Lqz2c.mjs} +1 -1
- package/dist/client/{event-registration.client-CMGg63IU.mjs → event-registration.client-Dj3Kyp5X.mjs} +56 -16
- package/dist/client/{eventCalendar-DlD0GCEy.mjs → eventCalendar-DGsdSF8J.mjs} +4 -4
- package/dist/client/{eventCombined-DoSi8p_l.mjs → eventCombined-DFSVDJ3D.mjs} +4 -4
- package/dist/client/{eventDetails-DzuQYgmO.mjs → eventDetails-DzMskXYA.mjs} +2 -2
- package/dist/client/{eventListing-CkiMjl0g.mjs → eventListing-CpFFcAUr.mjs} +4 -4
- package/dist/client/{eventRegistration-CjS3Zpjp.mjs → eventRegistration-BipMUOCw.mjs} +8 -5
- package/dist/client/{form-DgQqm7T2.mjs → form-57k2JQnm.mjs} +3 -3
- package/dist/client/{form.client-BI9Dcsq5.mjs → form.client-CCl6CpRJ.mjs} +4 -4
- package/dist/client/{form.parts-DevF0L_A.mjs → form.parts-BOJ1yDDf.mjs} +1 -1
- package/dist/client/{formatDate-DDyURjoe.mjs → formatDate-BGlhrmhF.mjs} +1 -1
- package/dist/client/gifting/client.mjs +2 -2
- package/dist/client/{headerSection-DYIG6Pwb.mjs → headerSection-q_bEzfhW.mjs} +2 -2
- package/dist/client/{newsletter-form.client-BWp7Y1e1.mjs → newsletter-form.client-CiqKAmPs.mjs} +5 -5
- package/dist/client/{newsletter-form.parts-Dg8s9NwJ.mjs → newsletter-form.parts-x1RzAMNO.mjs} +1 -1
- package/dist/client/{newsletterForm-DnPraMzx.mjs → newsletterForm-Cn7h4zFe.mjs} +3 -3
- package/dist/client/{noop-ByFRHYQ2.mjs → noop-B_f7RqLD.mjs} +111 -2
- package/dist/client/portal/client.mjs +20 -12
- package/dist/client/{product-detail.client-BFAgHrdg.mjs → product-detail.client-rWUvpVvZ.mjs} +1 -1
- package/dist/client/{product-list.client-DVrs_DyY.mjs → product-list.client-J0wDOmKv.mjs} +1 -1
- package/dist/client/{productDetail-D4rvl6Xg.mjs → productDetail-LtCkMrJ0.mjs} +3 -3
- package/dist/client/{productList-B8o5AOMX.mjs → productList-C0MLeh-v.mjs} +3 -3
- package/dist/client/{propsDecoder-hhotPP6P.mjs → propsDecoder-CAmEkJ6Y.mjs} +3 -3
- package/dist/client/{registry.server-Ch3EpupA.mjs → registry.server-Bf2YX_4v.mjs} +22 -19
- package/dist/client/rendering/client.mjs +25 -25
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +4 -4
- package/dist/client/{richText-coerce-C3LabQ1O.mjs → richText-coerce-BTurYEao.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CQGlxId8.mjs → routeIslandApiConfig-UdAlnZGQ.mjs} +1 -1
- package/dist/client/{shop-rRXplPGZ.mjs → shop-Dkn6EasY.mjs} +3 -3
- package/dist/client/{shop-commerce-VDbVaKY-.mjs → shop-commerce-bo0Z6kwf.mjs} +11 -11
- package/dist/client/{shop-commerce-store-DqdgJ8Zw.mjs → shop-commerce-store-Ckxa4_jI.mjs} +1 -1
- package/dist/client/{shop.client-DdwvMvaK.mjs → shop.client-B_GqU6_U.mjs} +109 -30
- package/dist/client/{shop.interactive-C8OvFY06.mjs → shop.interactive-C6L_Ig5F.mjs} +7 -523
- package/dist/client/{shopShared-BeuJiGPU.mjs → shopShared-CO1Y8lFd.mjs} +2 -2
- package/dist/client/src-BozhJ43Z.mjs +3 -0
- package/dist/client/{src-1PJxc8KO.mjs → src-xrjaKaCj.mjs} +6 -8
- package/dist/client/{timetableModel-Cko9LRKy.mjs → timetableModel-D62jfOxZ.mjs} +10 -10
- package/dist/client/{useAvailableSlots-M6QIEiWf.mjs → useAvailableSlots-CStfVmyY.mjs} +3 -3
- package/dist/client/{useDiscountApply-BJSnyO0f.mjs → useDiscountApply-Ca2pHUDu.mjs} +5 -3
- package/dist/client/{useDiscountCodeUi-D3XnOSCi.mjs → useDiscountCodeUi-AEifktGO.mjs} +1 -1
- package/dist/client/{useEventPagination-PhTIoFVX.mjs → useEventPagination-uxnUWI2v.mjs} +6 -6
- package/dist/client/{view-448wvvEY.mjs → view-B6KSxQMO.mjs} +7 -7
- package/dist/client/{view-L_mkgtnk.mjs → view-SVnWic7i.mjs} +2 -3
- package/dist/preview-next/client/{ArrangementLookControls-BpvnOGlN.mjs → ArrangementLookControls-kbdqYkWM.mjs} +3 -3
- package/dist/preview-next/client/{PreviewEditorSidebar-C0OtdWu_.mjs → PreviewEditorSidebar-DI_LhsMQ.mjs} +89 -39
- package/dist/preview-next/client/{PreviewEditorUI-Csc5vH5k.mjs → PreviewEditorUI-yyD-ZREP.mjs} +5 -5
- package/dist/preview-next/client/{PreviewShell-BOLH_pm-.mjs → PreviewShell-YauP65Gi.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CKodLReY.mjs → SdkPreviewModeRuntime-Bl7jQMI1.mjs} +8 -7
- package/dist/preview-next/client/{SiteChromeCustomizeButton-BeEZpeKn.mjs → SiteChromeCustomizeButton-CQFRP9aM.mjs} +1057 -316
- package/dist/preview-next/client/{previewAssistantSlot-BBdN5kfY.mjs → previewAssistantSlot-DSR0IdAw.mjs} +417 -56
- package/dist/preview-next/client/{previewChromeSurface-VZtGwPuH.mjs → previewChromeSurface-uSnVzeNs.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-kiZkMcuR.mjs → sdk-runtime-6Q0RVJTQ.mjs} +2 -2
- package/dist/preview-next/client/{src-DY8JCJdE.mjs → src-DzXUmsyK.mjs} +6 -8
- package/dist/preview-next/client/src-LUhVXBEQ.mjs +3 -0
- package/dist/preview-next/client/{useAutosaveStatus-BiIHEeE0.mjs → useAutosaveStatus-Cdx3kAGm.mjs} +1 -1
- package/dist/preview-next/client/{useBlockCustomizeControls-BuFLIpmX.mjs → useBlockCustomizeControls-ZrWdhcB6.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-DlxYgmh_.mjs → useOpenBlockForSetup-CK-GWb9k.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-C0sCvCYL.mjs → route-contract-BU1m9SV3.mjs} +47 -0
- package/dist/server/{Block.shared-Dnhc0Wu5.mjs → Block.shared-4vx7wzxj.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-NAQ_zsFu.mjs → ThemeScopeCore-C3HLgqBF.mjs} +6 -3
- package/dist/server/{bindings-DLoZYUxG.mjs → bindings-TAQbo2P5.mjs} +1 -1
- package/dist/server/{booking-form.reserved-fields-BWRF7509.mjs → booking-form.reserved-fields-Cqp13TKc.mjs} +1 -0
- package/dist/server/{client-Bc8jI8zN.mjs → client-DzCxEl3L.mjs} +48 -1
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +1 -1
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/{headerVariant-BwR9NV4b.mjs → headerVariant-8O5MvxIU.mjs} +2 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-D61gpqHB.mjs → loadContent-BO1M9Hdf.mjs} +4 -4
- package/dist/server/{loadPage-B4ZYpIcd.mjs → loadPage-BvWzmZcD.mjs} +2 -2
- package/dist/server/next.mjs +6 -6
- package/dist/server/{overrideResolution-CDReKy2P.mjs → overrideResolution-fxuB1zZg.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-ByVTA7-4.mjs → pageRenderPlan-DzduDSqY.mjs} +2 -2
- package/dist/server/{pageRuntimeSupport-Dzz_Dze6.mjs → pageRuntimeSupport-BU8pwTNx.mjs} +2 -2
- package/dist/server/{pageShared-Dk5Ku6hs.mjs → pageShared-CSOJ8p8E.mjs} +24 -16
- package/dist/server/{parseThemeForPersistence-pJPGfMrf.mjs → parseThemeForPersistence-BebSeE17.mjs} +1 -1
- package/dist/server/{prebuild-CW4M0WEZ.mjs → prebuild-C5ZYo7wA.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-Bvx0SiIM.mjs → prefetchBlockData-BvbxqeKn.mjs} +2 -2
- package/dist/server/{registry-Bh0Y25zH.mjs → registry-Fv-7D8o2.mjs} +264 -48
- 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 +3 -3
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-CnHHst9r.mjs → resolveBlockData-xPgkvoWS.mjs} +1 -1
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{validation-D2bHWSxJ.mjs → validation-DddhgNdb.mjs} +4 -4
- package/dist/server/{version-DkM1eAxG.mjs → version-D_W2mt8w.mjs} +1 -1
- package/dist/styles/index.css +6 -3
- package/package.json +1 -1
- package/dist/client/creditProducts-BOWi1QLp.mjs +0 -62
- package/dist/client/src-CdRISvQp.mjs +0 -3
- package/dist/preview-next/client/src-BP8771hw.mjs +0 -3
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as formatTime$1, c as unsafeAsAppointmentServiceId, i as formatDatePillParts, n as useAvailableDates, o as getRuntimeTimeZone, r as formatDate$1, s as unsafeAsAppointmentResourceId, t as useAvailableSlots } from "./useAvailableSlots-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { $r as bookingRequiresResourceSelection, Ai as leavePage, Ar as selectedBookingCollectionOptionKind, Br as bookingQuestionsAnswerDraftSchema, Ci as readRuntimeNow, Cr as parseBookingCurrencyInputToCents, Dr as resolveBookingSelectedService, Er as resolveBookingPaymentStep, Fr as applyAppointmentBookingQuestionsEvent, Gr as restoreBookingQuestionsAnswers, Hr as decideBookingQuestionsRestoration, Ir as appointmentQuestionsRefusal, Jr as BOOKING_FORM_DATA_RESERVED_KEYS, Kr as toBookingQuestionsAnswerDraft, Lr as deriveAppointmentBookingQuestions, Mr as projectSelectedAppointmentConsentIntoForm, Nr as resolveSelectedAppointmentConsent, Or as resolveBookingSiteId, Pr as EMPTY_APPOINTMENT_BOOKING_QUESTIONS, Qr as bookingPackageRequestKey, Rr as isAppointmentBookingQuestionsEvent, So as resolveBookingSignupOffer, Sr as normalizeBookingServices, Tr as resolveAppointmentCheckoutVerificationState, Xr as applyBookingPaymentAdmission, Zr as bookingHasPackagePaymentChoices, _r as getBookingSuccessCopy, ai as resolveBookingPaymentMode, at as buildReviewedBookingPaymentViewModel, br as isBookingServiceSlidingAmountInRange, ci as getBookingServiceSlidingScale, dr as buildBookingFormInteractiveIslandProps, ei as reconcileBookingPackagePurchase, fr as readOverrideServiceCategories, gr as getBookingRedirectStateFromLocation, hr as formatBookingSubmissionPreparationError, ii as resolveBookingPaymentChoice, it as buildBookingPaymentSelectionViewModel, jr as toSelectedCollectionOptionKind, kr as resolveDefaultBookingServiceId, l as formatValidity, mr as formatBookingCentsAsCurrencyInput, ni as resolveBookingPackageSources, oi as resolveBookingPurchasablePackages, ot as paymentChoiceDetails, pn as createSignInReturnDraftStore, pr as deriveBookingFormViewState, ri as resolveBookingPaymentAvailability, si as toBookingPurchasablePackages, st as paymentChoicePrice, ti as resolveBookingPackagePaymentSelection, wi as resolveDateRuntimeContext, wr as prepareBookingSubmission, xr as normalizeBookingFormConfig, zo as unsafeAsSiteId, zr as needsAppointmentQuestionsRefresh } from "./display-CT8KMSpH.mjs";
|
|
3
|
+
import { Bt as resolveBookingDisplayContext, Ft as formatDateTimeRange, It as formatTime, Mt as formatDate, Qt as resolveBookingTimeZoneId, Rt as formatTimeZoneCityLabel, U as isBookingRequirementConsentFieldId, Zt as resolveBookingBusinessTimeZone, en as parseUtcIsoDateTimeString, on as formatCurrencyAmount, t as logger, tn as toUtcIsoDateTimeString } from "./noop-B_f7RqLD.mjs";
|
|
4
|
+
import { a as formatTime$1, c as unsafeAsAppointmentServiceId, i as formatDatePillParts, n as useAvailableDates, o as getRuntimeTimeZone, r as formatDate$1, s as unsafeAsAppointmentResourceId, t as useAvailableSlots } from "./useAvailableSlots-CStfVmyY.mjs";
|
|
5
|
+
import { b as reportWorkflowError, c as checkBookingQuestionsAnswered, g as err, h as assertNever, v as okWith, x as reportWorkflowSuccess, y as clearWorkflowFeedback } from "./creditProducts-CMOmhWm2.mjs";
|
|
6
|
+
import { c as NavigationHandOffPanel, f as DiscountCodeDisclosure, i as SiteTermsChangedNotice, o as useSiteTermsAgreement, r as SiteTermsAgreementField, t as BookingConfirmation } from "./DemoBookingPortalAccess-C2QCj_Ta.mjs";
|
|
7
7
|
import { t as layoutServicesByCategory } from "./appointment-service-categories-Cl2pqw-z.mjs";
|
|
8
|
-
import { n as useBlockApi, t as BlockApiProvider } from "./context-
|
|
8
|
+
import { n as useBlockApi, t as BlockApiProvider } from "./context-DQnTyApV.mjs";
|
|
9
9
|
import { l as SpinnerNode, r as ThemedButton } from "./ThemedButton-BdnEwA38.mjs";
|
|
10
|
-
import { t as buildCheckoutReturnUrls } from "./checkoutUrls-
|
|
10
|
+
import { t as buildCheckoutReturnUrls } from "./checkoutUrls-cWL6I-Vz.mjs";
|
|
11
11
|
import { t as scrollToBlock } from "./scrollToBlock-DrgKE0qZ.mjs";
|
|
12
12
|
import { t as CheckboxChoice } from "./CheckboxChoice-W_uiRgDK.mjs";
|
|
13
13
|
import { t as CheckIcon } from "./CheckIcon-CVcKteXH.mjs";
|
|
14
14
|
import { n as getFieldValidationControlProps, t as FieldValidationMessage } from "./FieldValidationMessage-CsqxShw4.mjs";
|
|
15
15
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
16
|
-
import { i as useBookingNowIso, n as OptionalMark, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-
|
|
17
|
-
import { n as TerminalPanel, r as StateIcon, t as useDiscountCodeUi } from "./useDiscountCodeUi-
|
|
18
|
-
import { a as usePolling, c as useBookingQuestionsRefresh, i as BookingConsentAgreement, l as PaymentChoiceRows, n as BookingQuestionSections, o as portalSessionIdentity, s as useSignInReturn, t as BookingMailingListNote } from "./BookingMailingListNote-
|
|
16
|
+
import { i as useBookingNowIso, n as OptionalMark, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-DjLjd0vc.mjs";
|
|
17
|
+
import { n as TerminalPanel, r as StateIcon, t as useDiscountCodeUi } from "./useDiscountCodeUi-AEifktGO.mjs";
|
|
18
|
+
import { a as usePolling, c as useBookingQuestionsRefresh, i as BookingConsentAgreement, l as PaymentChoiceRows, n as BookingQuestionSections, o as portalSessionIdentity, s as useSignInReturn, t as BookingMailingListNote } from "./BookingMailingListNote-y3qWjnOo.mjs";
|
|
19
19
|
import { t as StepIndicator } from "./StepIndicator-BK0GEDoP.mjs";
|
|
20
|
-
import { s as storeDemoBookingPassIfAvailable } from "./demoPortalMagicLink-
|
|
20
|
+
import { s as storeDemoBookingPassIfAvailable } from "./demoPortalMagicLink-3uVu3WgG.mjs";
|
|
21
21
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
22
22
|
import { z } from "zod";
|
|
23
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -83,6 +83,23 @@ function omitBookingConsentEntries(record) {
|
|
|
83
83
|
function isBookingFieldValue(value) {
|
|
84
84
|
return value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean" || Array.isArray(value) && value.every((item) => typeof item === "string");
|
|
85
85
|
}
|
|
86
|
+
//#endregion
|
|
87
|
+
//#region ../blocks/src/system/runtime/nodes/booking-form.sign-in-return.ts
|
|
88
|
+
const packagePurchaseSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("none") }), z.object({
|
|
89
|
+
kind: z.literal("selected"),
|
|
90
|
+
package: z.object({
|
|
91
|
+
id: z.string(),
|
|
92
|
+
name: z.string(),
|
|
93
|
+
price: z.number(),
|
|
94
|
+
currency: z.string(),
|
|
95
|
+
creditsTotal: z.number(),
|
|
96
|
+
validDays: z.number().nullable(),
|
|
97
|
+
heldWithTeamMember: z.object({
|
|
98
|
+
id: z.string(),
|
|
99
|
+
name: z.string()
|
|
100
|
+
}).nullable()
|
|
101
|
+
})
|
|
102
|
+
})]);
|
|
86
103
|
/** The appointment form's drafts, for the shared `useSignInReturn` owner. */
|
|
87
104
|
const bookingSignInDraftStore = createSignInReturnDraftStore(z.object({
|
|
88
105
|
nonce: z.string().min(1),
|
|
@@ -118,6 +135,8 @@ const bookingSignInDraftStore = createSignInReturnDraftStore(z.object({
|
|
|
118
135
|
"instalment_plan",
|
|
119
136
|
"flexible_balance"
|
|
120
137
|
]).optional(),
|
|
138
|
+
selectedAppointmentPackageId: z.string().optional(),
|
|
139
|
+
packagePurchase: packagePurchaseSchema,
|
|
121
140
|
discountCode: z.string(),
|
|
122
141
|
questions: bookingQuestionsAnswerDraftSchema
|
|
123
142
|
}));
|
|
@@ -141,6 +160,8 @@ function toBookingSignInDraft(state, attempt) {
|
|
|
141
160
|
mailingListOptIn: state.mailingListOptIn,
|
|
142
161
|
selectedSlidingAmountInput: state.selectedSlidingAmountInput,
|
|
143
162
|
selectedCollectionOptionKind: state.selectedCollectionOptionKind,
|
|
163
|
+
selectedAppointmentPackageId: state.selectedAppointmentPackageId,
|
|
164
|
+
packagePurchase: state.packagePurchase,
|
|
144
165
|
discountCode: state.discountCode,
|
|
145
166
|
questions: toBookingQuestionsAnswerDraft(state.bookingQuestions)
|
|
146
167
|
};
|
|
@@ -171,6 +192,8 @@ function restoreBookingSignInDraft(state, draft, questions) {
|
|
|
171
192
|
mailingListOptIn: draft.mailingListOptIn,
|
|
172
193
|
selectedSlidingAmountInput: draft.selectedSlidingAmountInput,
|
|
173
194
|
selectedCollectionOptionKind: draft.selectedCollectionOptionKind,
|
|
195
|
+
selectedAppointmentPackageId: draft.selectedAppointmentPackageId ? unsafeAsCustomerPassId(draft.selectedAppointmentPackageId) : void 0,
|
|
196
|
+
packagePurchase: draft.packagePurchase,
|
|
174
197
|
discountCode: draft.discountCode,
|
|
175
198
|
bookingQuestions: restoreBookingQuestionsAnswers(state.bookingQuestions, questions)
|
|
176
199
|
};
|
|
@@ -389,6 +412,7 @@ function executeBookingSubmission$1(api, data) {
|
|
|
389
412
|
bookingQuestions: data.bookingQuestions,
|
|
390
413
|
mailingListOptIn: data.mailingListOptIn,
|
|
391
414
|
timezone: data.timezone,
|
|
415
|
+
...data.kind === "package_purchase" ? { purchasePassId: data.purchasePassId } : {},
|
|
392
416
|
shownTerms: data.shownTerms,
|
|
393
417
|
discountCode: data.discountCode,
|
|
394
418
|
selectedSlidingAmount: data.selectedSlidingAmount,
|
|
@@ -478,6 +502,7 @@ const unsafeAsBookingFieldId = (id) => id;
|
|
|
478
502
|
function createInitialBookingFlowReducerState(input) {
|
|
479
503
|
const initialData = input.initialData ?? {};
|
|
480
504
|
return {
|
|
505
|
+
packagePurchase: { kind: "none" },
|
|
481
506
|
phase: "editing",
|
|
482
507
|
currentStepId: "service-selection",
|
|
483
508
|
selectedServiceId: toOptionalAppointmentServiceId(toOptionalString(initialData.serviceId) ?? input.defaultServiceId),
|
|
@@ -548,6 +573,11 @@ function reduceBookingFlowEvent(state, event) {
|
|
|
548
573
|
...event,
|
|
549
574
|
state
|
|
550
575
|
}).reduce(reduceBookingFlowEvent, state);
|
|
576
|
+
case "purchasable-packages-received": return applyBookingPackagePurchaseRefresh(state, event.packages);
|
|
577
|
+
case "unrestricted-held-packages-received": return {
|
|
578
|
+
...state,
|
|
579
|
+
unrestrictedHeldPackageServiceId: event.serviceId
|
|
580
|
+
};
|
|
551
581
|
case "packages-received": return planBookingPackageAcceptance({
|
|
552
582
|
...event,
|
|
553
583
|
state
|
|
@@ -556,6 +586,7 @@ function reduceBookingFlowEvent(state, event) {
|
|
|
556
586
|
case "resource-selected": return {
|
|
557
587
|
...state,
|
|
558
588
|
selectedResourceId: event.resourceId ?? void 0,
|
|
589
|
+
packagePurchase: { kind: "none" },
|
|
559
590
|
selectedDate: void 0,
|
|
560
591
|
selectedSlot: null,
|
|
561
592
|
validationErrors: clearBookingFormError(state.validationErrors)
|
|
@@ -623,6 +654,7 @@ function reduceBookingFlowEvent(state, event) {
|
|
|
623
654
|
review: null,
|
|
624
655
|
paymentChoices: event.paymentChoices,
|
|
625
656
|
selectedCollectionOptionKind: void 0,
|
|
657
|
+
packagePurchase: { kind: "none" },
|
|
626
658
|
currentStepId: "payment-selection",
|
|
627
659
|
feedback: {
|
|
628
660
|
kind: "error",
|
|
@@ -644,6 +676,15 @@ function reduceBookingFlowEvent(state, event) {
|
|
|
644
676
|
default: return assertNever(event);
|
|
645
677
|
}
|
|
646
678
|
}
|
|
679
|
+
/** Changed purchase facts invalidate a price review; identical refreshes preserve the current intent. */
|
|
680
|
+
function applyBookingPackagePurchaseRefresh(state, packages) {
|
|
681
|
+
const packagePurchase = reconcileBookingPackagePurchase(state.packagePurchase, packages);
|
|
682
|
+
return packagePurchase === state.packagePurchase ? state : {
|
|
683
|
+
...state,
|
|
684
|
+
packagePurchase,
|
|
685
|
+
review: null
|
|
686
|
+
};
|
|
687
|
+
}
|
|
647
688
|
/** Answering a question clears the server's complaint about that question. */
|
|
648
689
|
function applyBookingQuestionsFlowEvent(state, event) {
|
|
649
690
|
const bookingQuestions = applyAppointmentBookingQuestionsEvent(state.bookingQuestions, event);
|
|
@@ -661,9 +702,11 @@ function applyBookingQuestionsFlowEvent(state, event) {
|
|
|
661
702
|
function applyBookingServiceSelection(state, serviceId) {
|
|
662
703
|
return {
|
|
663
704
|
...state,
|
|
705
|
+
packagePurchase: { kind: "none" },
|
|
664
706
|
bookingQuestions: EMPTY_APPOINTMENT_BOOKING_QUESTIONS,
|
|
665
707
|
questionFieldErrors: {},
|
|
666
708
|
selectedServiceId: serviceId,
|
|
709
|
+
unrestrictedHeldPackageServiceId: void 0,
|
|
667
710
|
selectedResourceId: void 0,
|
|
668
711
|
selectedDate: void 0,
|
|
669
712
|
selectedSlot: null,
|
|
@@ -734,6 +777,7 @@ function toBookingFormData(state) {
|
|
|
734
777
|
discountCode: state.discountCode || void 0,
|
|
735
778
|
selectedSlidingAmountInput: state.selectedSlidingAmountInput || void 0,
|
|
736
779
|
selectedCollectionOptionKind: state.selectedCollectionOptionKind,
|
|
780
|
+
...state.packagePurchase.kind === "selected" ? { packagePurchase: state.packagePurchase } : {},
|
|
737
781
|
selectedAppointmentPackageId: state.selectedAppointmentPackageId
|
|
738
782
|
};
|
|
739
783
|
}
|
|
@@ -778,10 +822,14 @@ function buildBookingStepResolution(input) {
|
|
|
778
822
|
}
|
|
779
823
|
function resolveBookingStepVisibility(input, defaultServiceId, payment) {
|
|
780
824
|
const hasValidConfiguredService = Boolean(defaultServiceId) && input.services.some((service) => service.id === defaultServiceId);
|
|
825
|
+
const service = resolveBookingSelectedService({
|
|
826
|
+
...input,
|
|
827
|
+
defaultServiceId
|
|
828
|
+
});
|
|
781
829
|
return {
|
|
782
830
|
needsServiceSelection: [
|
|
783
831
|
input.requiresServiceSelection,
|
|
784
|
-
input.requiresResourceSelection,
|
|
832
|
+
bookingRequiresResourceSelection(service, input.requiresResourceSelection),
|
|
785
833
|
!hasValidConfiguredService && input.services.length > 1,
|
|
786
834
|
(input.form?.settings?.serviceIds?.length ?? 0) > 1
|
|
787
835
|
].some(Boolean),
|
|
@@ -790,11 +838,17 @@ function resolveBookingStepVisibility(input, defaultServiceId, payment) {
|
|
|
790
838
|
};
|
|
791
839
|
}
|
|
792
840
|
function needsBookingPaymentStep(input, payment) {
|
|
793
|
-
|
|
841
|
+
if (input.form?.settings?.requiresApproval) return false;
|
|
842
|
+
return [
|
|
843
|
+
bookingHasPackagePaymentChoices(payment.service),
|
|
844
|
+
getBookingServiceSlidingScale(payment.service),
|
|
845
|
+
payment.mode !== "hidden",
|
|
846
|
+
input.enableAppointmentPackages && (payment.service?.priceAmount ?? 0) > 0
|
|
847
|
+
].some(Boolean);
|
|
794
848
|
}
|
|
795
849
|
/** The service step needs a service, and a practitioner when the form insists on one. */
|
|
796
850
|
function serviceSelectionMessage(input) {
|
|
797
|
-
if (input.requiresResourceSelection && !(input.data.resourceId ?? input.defaultResourceId)) return "Please select a practitioner";
|
|
851
|
+
if (bookingRequiresResourceSelection(resolveBookingSelectedService(input), input.requiresResourceSelection) && !(input.data.resourceId ?? input.defaultResourceId)) return "Please select a practitioner";
|
|
798
852
|
return input.data.serviceId ? null : "Please select a service";
|
|
799
853
|
}
|
|
800
854
|
function validateBookingStep(input) {
|
|
@@ -823,7 +877,8 @@ function bookingStepValidationFromMessage(message) {
|
|
|
823
877
|
} : { ok: true };
|
|
824
878
|
}
|
|
825
879
|
function validateBookingPaymentStep(input) {
|
|
826
|
-
|
|
880
|
+
const packageValidation = validateBookingPackagePayment(input);
|
|
881
|
+
if (packageValidation) return packageValidation;
|
|
827
882
|
const resolution = input.paymentResolution ?? resolveBookingPaymentStep(input);
|
|
828
883
|
const slidingScale = getBookingServiceSlidingScale(resolution.service);
|
|
829
884
|
if (slidingScale && !isBookingServiceSlidingAmountInRange(slidingScale, parseBookingCurrencyInputToCents(input.data.selectedSlidingAmountInput))) return bookingStepValidationFromMessage("Please choose an amount within the sliding scale");
|
|
@@ -994,12 +1049,15 @@ function buildBookingSubmitPlan(input) {
|
|
|
994
1049
|
}
|
|
995
1050
|
return {
|
|
996
1051
|
ok: true,
|
|
997
|
-
redirect: input.redirect,
|
|
998
1052
|
value: finalizeBookingSubmissionCommand(prepared.value, input)
|
|
999
1053
|
};
|
|
1000
1054
|
}
|
|
1001
1055
|
function validateBookingSubmissionContact(input) {
|
|
1002
|
-
if (
|
|
1056
|
+
if (bookingRequiresResourceSelection(resolveBookingSelectedService({
|
|
1057
|
+
services: input.services,
|
|
1058
|
+
data: toBookingFormData(input.state),
|
|
1059
|
+
defaultServiceId: input.defaultServiceId
|
|
1060
|
+
}), input.requiresResourceSelection) && !(input.state.selectedResourceId ?? input.defaultResourceId)) {
|
|
1003
1061
|
const message = "Please select a practitioner";
|
|
1004
1062
|
return {
|
|
1005
1063
|
ok: false,
|
|
@@ -1403,7 +1461,7 @@ function planBookingPackageAcceptance(input) {
|
|
|
1403
1461
|
}] : [];
|
|
1404
1462
|
}
|
|
1405
1463
|
function isBookingPaymentEvent(event) {
|
|
1406
|
-
return event.type === "payment-option-selected" || event.type === "sliding-amount-changed" || event.type === "appointment-package-selected" || event.type === "discount-code-changed";
|
|
1464
|
+
return event.type === "payment-option-selected" || event.type === "sliding-amount-changed" || event.type === "appointment-package-selected" || event.type === "purchase-package-selected" || event.type === "discount-code-changed";
|
|
1407
1465
|
}
|
|
1408
1466
|
function applyBookingPaymentEvent(state, event) {
|
|
1409
1467
|
const change = bookingPaymentEventChange(event);
|
|
@@ -1416,17 +1474,28 @@ function applyBookingPaymentEvent(state, event) {
|
|
|
1416
1474
|
function bookingPaymentEventChange(event) {
|
|
1417
1475
|
switch (event.type) {
|
|
1418
1476
|
case "payment-option-selected": return {
|
|
1477
|
+
packagePurchase: { kind: "none" },
|
|
1419
1478
|
selectedCollectionOptionKind: event.kind ?? void 0,
|
|
1420
1479
|
selectedAppointmentPackageId: void 0
|
|
1421
1480
|
};
|
|
1422
1481
|
case "sliding-amount-changed": return {
|
|
1482
|
+
packagePurchase: { kind: "none" },
|
|
1423
1483
|
selectedSlidingAmountInput: event.value,
|
|
1424
1484
|
selectedAppointmentPackageId: void 0
|
|
1425
1485
|
};
|
|
1426
1486
|
case "appointment-package-selected": return {
|
|
1487
|
+
packagePurchase: { kind: "none" },
|
|
1427
1488
|
selectedAppointmentPackageId: event.packageId ?? void 0,
|
|
1428
1489
|
selectedCollectionOptionKind: void 0
|
|
1429
1490
|
};
|
|
1491
|
+
case "purchase-package-selected": return {
|
|
1492
|
+
packagePurchase: event.package ? {
|
|
1493
|
+
kind: "selected",
|
|
1494
|
+
package: event.package
|
|
1495
|
+
} : { kind: "none" },
|
|
1496
|
+
selectedAppointmentPackageId: void 0,
|
|
1497
|
+
selectedCollectionOptionKind: void 0
|
|
1498
|
+
};
|
|
1430
1499
|
case "discount-code-changed": return { discountCode: event.code };
|
|
1431
1500
|
}
|
|
1432
1501
|
}
|
|
@@ -1434,7 +1503,8 @@ function changesBookingIntent(event) {
|
|
|
1434
1503
|
return changesBookingPaymentFacts(event) || [
|
|
1435
1504
|
"field-updated",
|
|
1436
1505
|
"discount-code-changed",
|
|
1437
|
-
"appointment-package-selected"
|
|
1506
|
+
"appointment-package-selected",
|
|
1507
|
+
"purchase-package-selected"
|
|
1438
1508
|
].includes(event.type);
|
|
1439
1509
|
}
|
|
1440
1510
|
/** Applies server-owned recovery facts to the existing catalogue model. */
|
|
@@ -1444,6 +1514,13 @@ function applyBookingPaymentChoices(services, choices) {
|
|
|
1444
1514
|
...choices
|
|
1445
1515
|
} : service) : services;
|
|
1446
1516
|
}
|
|
1517
|
+
function validateBookingPackagePayment(input) {
|
|
1518
|
+
switch (resolveBookingPackagePaymentSelection(input.data, resolveBookingSelectedService(input))) {
|
|
1519
|
+
case "selected": return { ok: true };
|
|
1520
|
+
case "required": return bookingStepValidationFromMessage("Please choose a payment option");
|
|
1521
|
+
case "per_session": return null;
|
|
1522
|
+
}
|
|
1523
|
+
}
|
|
1447
1524
|
//#endregion
|
|
1448
1525
|
//#region ../blocks/src/system/runtime/hooks/useBookingChoices.ts
|
|
1449
1526
|
const NO_PACKAGES = { packages: [] };
|
|
@@ -1459,18 +1536,23 @@ function useBookingChoices(input) {
|
|
|
1459
1536
|
label: item.label
|
|
1460
1537
|
}));
|
|
1461
1538
|
}, [input.api]);
|
|
1462
|
-
const
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
serviceId,
|
|
1539
|
+
const loadPurchasablePackages = useCallback(async (_key) => {
|
|
1540
|
+
if (!input.serviceId) return [];
|
|
1541
|
+
return toBookingPurchasablePackages((await input.api.listPublicPasses({
|
|
1542
|
+
serviceId: input.serviceId,
|
|
1467
1543
|
...input.selectedResourceId ? { teamMemberId: input.selectedResourceId } : {}
|
|
1468
|
-
});
|
|
1544
|
+
})).passes);
|
|
1469
1545
|
}, [
|
|
1470
1546
|
input.api,
|
|
1471
1547
|
input.serviceId,
|
|
1472
1548
|
input.selectedResourceId
|
|
1473
1549
|
]);
|
|
1550
|
+
const acceptPurchasablePackages = useCallback((packages) => {
|
|
1551
|
+
latest.current.dispatch({
|
|
1552
|
+
type: "purchasable-packages-received",
|
|
1553
|
+
packages
|
|
1554
|
+
});
|
|
1555
|
+
}, []);
|
|
1474
1556
|
const acceptResources = useCallback((resources) => {
|
|
1475
1557
|
const current = latest.current;
|
|
1476
1558
|
current.dispatch({
|
|
@@ -1480,23 +1562,19 @@ function useBookingChoices(input) {
|
|
|
1480
1562
|
autoSelect: current.autoSelectSingleResource
|
|
1481
1563
|
});
|
|
1482
1564
|
}, []);
|
|
1483
|
-
const acceptPackages = useCallback((response) => {
|
|
1484
|
-
latest.current.dispatch({
|
|
1485
|
-
type: "packages-received",
|
|
1486
|
-
packages: response.packages
|
|
1487
|
-
});
|
|
1488
|
-
}, []);
|
|
1489
1565
|
const resources = useBookingChoicesRequest(input.serviceId ?? null, loadResources, acceptResources, "Failed to load booking resources.");
|
|
1490
|
-
const packagesResponse =
|
|
1566
|
+
const packagesResponse = useBookingPackageEligibility(input);
|
|
1567
|
+
const purchasablePackages = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPurchasablePackages, input.serviceId, input.selectedResourceId), loadPurchasablePackages, acceptPurchasablePackages, "Failed to load packages.");
|
|
1491
1568
|
useEffect(() => {
|
|
1492
|
-
if (!input.
|
|
1493
|
-
}, [input.
|
|
1569
|
+
if (!input.canLoadPurchasablePackages) acceptPurchasablePackages([]);
|
|
1570
|
+
}, [input.canLoadPurchasablePackages, acceptPurchasablePackages]);
|
|
1494
1571
|
return {
|
|
1495
1572
|
resources,
|
|
1496
1573
|
packages: useMemo(() => packagesResponse.tag === "loaded" ? {
|
|
1497
1574
|
tag: "loaded",
|
|
1498
1575
|
value: packagesResponse.value.packages
|
|
1499
1576
|
} : packagesResponse, [packagesResponse]),
|
|
1577
|
+
purchasablePackages,
|
|
1500
1578
|
heldPackageTeamMembers: packagesResponse.tag === "loaded" && !input.selectedResourceId ? packagesResponse.value.heldPackageTeamMembers ?? [] : [],
|
|
1501
1579
|
resourceFacts: input.serviceId && resources.tag === "loaded" ? {
|
|
1502
1580
|
serviceId: input.serviceId,
|
|
@@ -1504,6 +1582,56 @@ function useBookingChoices(input) {
|
|
|
1504
1582
|
} : null
|
|
1505
1583
|
};
|
|
1506
1584
|
}
|
|
1585
|
+
/** Unscoped eligibility resolves practitioner admission independently of the selected practitioner. */
|
|
1586
|
+
function useBookingPackageEligibility(input) {
|
|
1587
|
+
const latest = useRef(input);
|
|
1588
|
+
useLayoutEffect(() => {
|
|
1589
|
+
latest.current = input;
|
|
1590
|
+
}, [input]);
|
|
1591
|
+
const loadAny = useCallback(async () => input.serviceId ? input.api.getEligibleAppointmentPackages({ serviceId: input.serviceId }) : NO_PACKAGES, [input.api, input.serviceId]);
|
|
1592
|
+
const loadScoped = useCallback(async () => input.serviceId && input.selectedResourceId ? input.api.getEligibleAppointmentPackages({
|
|
1593
|
+
serviceId: input.serviceId,
|
|
1594
|
+
teamMemberId: input.selectedResourceId
|
|
1595
|
+
}) : NO_PACKAGES, [
|
|
1596
|
+
input.api,
|
|
1597
|
+
input.serviceId,
|
|
1598
|
+
input.selectedResourceId
|
|
1599
|
+
]);
|
|
1600
|
+
const accept = useCallback((response) => {
|
|
1601
|
+
latest.current.dispatch({
|
|
1602
|
+
type: "packages-received",
|
|
1603
|
+
packages: response.packages
|
|
1604
|
+
});
|
|
1605
|
+
}, []);
|
|
1606
|
+
const acceptAny = useCallback((response) => {
|
|
1607
|
+
const current = latest.current;
|
|
1608
|
+
current.dispatch({
|
|
1609
|
+
type: "unrestricted-held-packages-received",
|
|
1610
|
+
serviceId: response.packages.length ? current.serviceId : void 0
|
|
1611
|
+
});
|
|
1612
|
+
if (!current.selectedResourceId) accept(response);
|
|
1613
|
+
}, [accept]);
|
|
1614
|
+
const any = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages, input.serviceId, null), loadAny, acceptAny, "Could not check package credits.");
|
|
1615
|
+
const scoped = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages && !!input.selectedResourceId, input.serviceId, input.selectedResourceId), loadScoped, accept, "Could not check package credits.");
|
|
1616
|
+
useEffect(() => {
|
|
1617
|
+
if (!input.canLoadPackages) {
|
|
1618
|
+
accept(NO_PACKAGES);
|
|
1619
|
+
acceptAny(NO_PACKAGES);
|
|
1620
|
+
}
|
|
1621
|
+
}, [
|
|
1622
|
+
input.canLoadPackages,
|
|
1623
|
+
accept,
|
|
1624
|
+
acceptAny
|
|
1625
|
+
]);
|
|
1626
|
+
useEffect(() => {
|
|
1627
|
+
if (!input.selectedResourceId && any.tag === "loaded") accept(any.value);
|
|
1628
|
+
}, [
|
|
1629
|
+
input.selectedResourceId,
|
|
1630
|
+
any,
|
|
1631
|
+
accept
|
|
1632
|
+
]);
|
|
1633
|
+
return input.selectedResourceId ? scoped : any;
|
|
1634
|
+
}
|
|
1507
1635
|
function useBookingChoicesRequest(key, load, accept, errorMessage) {
|
|
1508
1636
|
const [receipt, setReceipt] = useState({
|
|
1509
1637
|
key: null,
|
|
@@ -1553,7 +1681,6 @@ function useBookingChoicesRequest(key, load, accept, errorMessage) {
|
|
|
1553
1681
|
function planBookingSubmissionCompletion(input) {
|
|
1554
1682
|
const { data } = input;
|
|
1555
1683
|
if (data.type === "review_required") return {
|
|
1556
|
-
navigation: { kind: "none" },
|
|
1557
1684
|
events: [{
|
|
1558
1685
|
type: "review-required",
|
|
1559
1686
|
review: data.review
|
|
@@ -1565,7 +1692,6 @@ function planBookingSubmissionCompletion(input) {
|
|
|
1565
1692
|
}
|
|
1566
1693
|
};
|
|
1567
1694
|
if (data.type === "payment_choice_required") return {
|
|
1568
|
-
navigation: { kind: "none" },
|
|
1569
1695
|
events: [{
|
|
1570
1696
|
type: "payment-choice-required",
|
|
1571
1697
|
paymentChoices: data.paymentChoices
|
|
@@ -1583,10 +1709,6 @@ function planBookingSubmissionCompletion(input) {
|
|
|
1583
1709
|
};
|
|
1584
1710
|
if (data.type === "checkout_redirect") return {
|
|
1585
1711
|
events: [],
|
|
1586
|
-
navigation: input.redirect === "auto" ? {
|
|
1587
|
-
kind: "checkout",
|
|
1588
|
-
url: data.checkoutUrl
|
|
1589
|
-
} : { kind: "none" },
|
|
1590
1712
|
result: {
|
|
1591
1713
|
ok: true,
|
|
1592
1714
|
outcome: {
|
|
@@ -1598,7 +1720,6 @@ function planBookingSubmissionCompletion(input) {
|
|
|
1598
1720
|
}
|
|
1599
1721
|
};
|
|
1600
1722
|
if (data.type === "requested") return {
|
|
1601
|
-
navigation: { kind: "none" },
|
|
1602
1723
|
events: [{
|
|
1603
1724
|
type: "feedback-set",
|
|
1604
1725
|
feedback: {
|
|
@@ -1623,7 +1744,6 @@ function planBookingSubmissionCompletion(input) {
|
|
|
1623
1744
|
}
|
|
1624
1745
|
};
|
|
1625
1746
|
return {
|
|
1626
|
-
navigation: { kind: "none" },
|
|
1627
1747
|
events: [{
|
|
1628
1748
|
type: "feedback-set",
|
|
1629
1749
|
feedback: bookingSuccessFeedback(data, input.successMessage)
|
|
@@ -1652,7 +1772,6 @@ function bookingSuccessFeedback(data, successMessage) {
|
|
|
1652
1772
|
function completeBookingSubmission(input) {
|
|
1653
1773
|
const plan = planBookingSubmissionCompletion(input);
|
|
1654
1774
|
plan.events.forEach(input.dispatch);
|
|
1655
|
-
if (plan.navigation.kind === "checkout" && typeof window !== "undefined") input.navigateToCheckout(plan.navigation.url);
|
|
1656
1775
|
return plan.result;
|
|
1657
1776
|
}
|
|
1658
1777
|
//#endregion
|
|
@@ -1675,6 +1794,14 @@ function useBookingFlowController(input) {
|
|
|
1675
1794
|
}, [latestRef]);
|
|
1676
1795
|
return useMemo(() => ({
|
|
1677
1796
|
...bookingEditActions(input.dispatch),
|
|
1797
|
+
selectPackageToBuy: (passId) => {
|
|
1798
|
+
const source = latestRef.current.purchasablePackages;
|
|
1799
|
+
const product = source.tag === "loaded" ? source.value.find((product) => product.id === passId) ?? null : null;
|
|
1800
|
+
input.dispatch({
|
|
1801
|
+
type: "purchase-package-selected",
|
|
1802
|
+
package: product
|
|
1803
|
+
});
|
|
1804
|
+
},
|
|
1678
1805
|
next: async () => navigate("next"),
|
|
1679
1806
|
back: () => {
|
|
1680
1807
|
navigate("back");
|
|
@@ -1729,7 +1856,6 @@ function useBookingSubmitAction(latestRef) {
|
|
|
1729
1856
|
...latest.state,
|
|
1730
1857
|
discountCode: latest.discountCode
|
|
1731
1858
|
},
|
|
1732
|
-
redirect: options?.redirect ?? "manual",
|
|
1733
1859
|
successUrl: options?.successUrl,
|
|
1734
1860
|
cancelUrl: options?.cancelUrl
|
|
1735
1861
|
});
|
|
@@ -1765,9 +1891,7 @@ async function executeBookingSubmission(start, latest, latestRef) {
|
|
|
1765
1891
|
if (result.data.type !== "review_required" && result.data.type !== "payment_choice_required") latest.endSignInReturn?.();
|
|
1766
1892
|
return completeBookingSubmission({
|
|
1767
1893
|
data: result.data,
|
|
1768
|
-
redirect: start.plan.redirect,
|
|
1769
1894
|
successMessage: latest.successMessage,
|
|
1770
|
-
navigateToCheckout: latest.navigateToCheckout,
|
|
1771
1895
|
dispatch: latest.dispatch
|
|
1772
1896
|
});
|
|
1773
1897
|
}
|
|
@@ -1828,7 +1952,17 @@ function failBookingSubmission(failure, dispatch) {
|
|
|
1828
1952
|
};
|
|
1829
1953
|
}
|
|
1830
1954
|
function sameBookingIntent(left, right) {
|
|
1831
|
-
return
|
|
1955
|
+
return [
|
|
1956
|
+
left.selectedServiceId === right.selectedServiceId,
|
|
1957
|
+
left.selectedResourceId === right.selectedResourceId,
|
|
1958
|
+
left.selectedSlot?.key === right.selectedSlot?.key,
|
|
1959
|
+
left.selectedSlidingAmountInput === right.selectedSlidingAmountInput,
|
|
1960
|
+
left.selectedCollectionOptionKind === right.selectedCollectionOptionKind,
|
|
1961
|
+
left.selectedAppointmentPackageId === right.selectedAppointmentPackageId,
|
|
1962
|
+
left.packagePurchase === right.packagePurchase,
|
|
1963
|
+
left.discountCode === right.discountCode,
|
|
1964
|
+
left.fieldValues === right.fieldValues
|
|
1965
|
+
].every(Boolean);
|
|
1832
1966
|
}
|
|
1833
1967
|
function isOutdatedBookingReview(result, submitted, current) {
|
|
1834
1968
|
return result.ok && (result.data.type === "review_required" || result.data.type === "payment_choice_required") && !sameBookingIntent(submitted, current);
|
|
@@ -1860,14 +1994,19 @@ function useHeadlessBookingFlow(options) {
|
|
|
1860
1994
|
options.services
|
|
1861
1995
|
]);
|
|
1862
1996
|
const [state, dispatch] = useReducer((previous, event) => bookingFlowReducer(previous, event, {
|
|
1863
|
-
services: applyBookingPaymentChoices(options.services, previous.paymentChoices),
|
|
1997
|
+
services: applyBookingPaymentAdmission(applyBookingPaymentChoices(options.services, previous.paymentChoices), Boolean(options.form?.settings?.requiresApproval), previous.unrestrictedHeldPackageServiceId),
|
|
1864
1998
|
defaultServiceId,
|
|
1865
1999
|
nowIso: bookingNowIso
|
|
1866
2000
|
}), initialState);
|
|
1867
2001
|
const api = useBlockApi();
|
|
1868
2002
|
const selectedServiceId = state.selectedServiceId ?? defaultServiceId;
|
|
1869
2003
|
const selectedResourceId = state.selectedResourceId ?? defaultResourceId;
|
|
1870
|
-
const services = useMemo(() => applyBookingPaymentChoices(options.services, state.paymentChoices),
|
|
2004
|
+
const services = useMemo(() => applyBookingPaymentAdmission(applyBookingPaymentChoices(options.services, state.paymentChoices), Boolean(options.form?.settings?.requiresApproval), state.unrestrictedHeldPackageServiceId), [
|
|
2005
|
+
options.services,
|
|
2006
|
+
options.form?.settings?.requiresApproval,
|
|
2007
|
+
state.paymentChoices,
|
|
2008
|
+
state.unrestrictedHeldPackageServiceId
|
|
2009
|
+
]);
|
|
1871
2010
|
const selectedService = services.find((service) => service.id === selectedServiceId) ?? null;
|
|
1872
2011
|
const siteTerms = useSiteTermsAgreement({
|
|
1873
2012
|
terms: options.siteTerms,
|
|
@@ -1889,32 +2028,36 @@ function useHeadlessBookingFlow(options) {
|
|
|
1889
2028
|
dispatch
|
|
1890
2029
|
});
|
|
1891
2030
|
const questionsRefusal = appointmentQuestionsRefusal(questions.presentation);
|
|
2031
|
+
const requiresResourceSelection = bookingRequiresResourceSelection(selectedService, options.requiresResourceSelection);
|
|
2032
|
+
const packageSources = resolveBookingPackageSources(selectedService, Boolean(options.enableAppointmentPackages), hasPortalBearerAuth);
|
|
2033
|
+
const { packageOnly, canBuy: canLoadPurchasablePackages } = packageSources;
|
|
1892
2034
|
const selectedServiceSlidingScale = getBookingServiceSlidingScale(selectedService);
|
|
1893
2035
|
const selectedSlidingAmount = parseBookingCurrencyInputToCents(state.selectedSlidingAmountInput);
|
|
1894
2036
|
const selectedAppointmentPriceAmount = selectedServiceSlidingScale && selectedSlidingAmount !== null ? selectedSlidingAmount : selectedService?.priceAmount ?? 0;
|
|
1895
|
-
const canLoadAppointmentPackages =
|
|
1896
|
-
const appointmentPackagesUnavailableReason =
|
|
2037
|
+
const canLoadAppointmentPackages = packageSources.held === "enabled";
|
|
2038
|
+
const appointmentPackagesUnavailableReason = packageSources.held === "enabled" ? null : packageSources.held;
|
|
1897
2039
|
const data = useMemo(() => toBookingFormData(state), [state]);
|
|
1898
2040
|
const mailingList = resolveBookingSignupOffer(options.mailingList, options.siteName);
|
|
1899
2041
|
const mailingListEligible = mailingList !== null;
|
|
2042
|
+
const availabilityServiceId = requiresResourceSelection && !selectedResourceId ? void 0 : selectedServiceId;
|
|
1900
2043
|
const availabilityDatesQuery = useMemo(() => buildBookingAvailabilityQuery({
|
|
1901
|
-
serviceId:
|
|
2044
|
+
serviceId: availabilityServiceId,
|
|
1902
2045
|
resourceId: selectedResourceId,
|
|
1903
2046
|
timezone: availabilityTimeZone
|
|
1904
2047
|
}), [
|
|
1905
2048
|
selectedResourceId,
|
|
1906
|
-
|
|
2049
|
+
availabilityServiceId,
|
|
1907
2050
|
availabilityTimeZone
|
|
1908
2051
|
]);
|
|
1909
2052
|
const availabilitySlotsQuery = useMemo(() => buildBookingAvailabilityQuery({
|
|
1910
|
-
serviceId:
|
|
2053
|
+
serviceId: availabilityServiceId,
|
|
1911
2054
|
resourceId: selectedResourceId,
|
|
1912
2055
|
selectedDate: state.selectedDate,
|
|
1913
2056
|
timezone: availabilityTimeZone,
|
|
1914
2057
|
requireDate: true
|
|
1915
2058
|
}), [
|
|
1916
2059
|
selectedResourceId,
|
|
1917
|
-
|
|
2060
|
+
availabilityServiceId,
|
|
1918
2061
|
state.selectedDate,
|
|
1919
2062
|
availabilityTimeZone
|
|
1920
2063
|
]);
|
|
@@ -1928,7 +2071,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
1928
2071
|
defaultResourceId,
|
|
1929
2072
|
currentStepId: state.currentStepId,
|
|
1930
2073
|
requiresServiceSelection: options.requiresServiceSelection,
|
|
1931
|
-
requiresResourceSelection
|
|
2074
|
+
requiresResourceSelection,
|
|
1932
2075
|
enableAppointmentPackages: options.enableAppointmentPackages,
|
|
1933
2076
|
attemptedStepIds: state.attemptedStepIds,
|
|
1934
2077
|
questionsRefusal
|
|
@@ -1941,7 +2084,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
1941
2084
|
defaultResourceId,
|
|
1942
2085
|
options.enableAppointmentPackages,
|
|
1943
2086
|
runtimeForm,
|
|
1944
|
-
|
|
2087
|
+
requiresResourceSelection,
|
|
1945
2088
|
options.requiresServiceSelection,
|
|
1946
2089
|
services,
|
|
1947
2090
|
state.paymentChoices,
|
|
@@ -2012,19 +2155,29 @@ function useHeadlessBookingFlow(options) {
|
|
|
2012
2155
|
selectedResourceId: selectedResourceId ?? null,
|
|
2013
2156
|
defaultResourceId,
|
|
2014
2157
|
canLoadPackages: canLoadAppointmentPackages,
|
|
2158
|
+
canLoadPurchasablePackages,
|
|
2015
2159
|
autoSelectSingleResource: options.shouldAutoSelectSingleResource !== false,
|
|
2016
2160
|
dispatch
|
|
2017
2161
|
});
|
|
2018
2162
|
const resourcesState = choices.resources;
|
|
2019
2163
|
const appointmentPackages = choices.packages;
|
|
2020
2164
|
const resources = resourcesState.tag === "loaded" ? resourcesState.value : [];
|
|
2165
|
+
const purchase = state.packagePurchase;
|
|
2166
|
+
const paymentPriceAmount = purchase.kind === "selected" ? purchase.package.price : selectedAppointmentPriceAmount;
|
|
2021
2167
|
const discountUi = useDiscountCodeUi({
|
|
2022
2168
|
api,
|
|
2023
|
-
discountContext: useMemo(() =>
|
|
2169
|
+
discountContext: useMemo(() => purchase.kind === "selected" ? {
|
|
2170
|
+
type: "pass",
|
|
2171
|
+
passId: purchase.package.id
|
|
2172
|
+
} : selectedService && selectedAppointmentPriceAmount > 0 ? {
|
|
2024
2173
|
type: "appointment",
|
|
2025
2174
|
serviceId: selectedService.id
|
|
2026
|
-
} : null, [
|
|
2027
|
-
|
|
2175
|
+
} : null, [
|
|
2176
|
+
purchase,
|
|
2177
|
+
selectedAppointmentPriceAmount,
|
|
2178
|
+
selectedService?.id
|
|
2179
|
+
]),
|
|
2180
|
+
subtotalCents: paymentPriceAmount
|
|
2028
2181
|
});
|
|
2029
2182
|
const { submit, clearFeedback } = useBookingSubmission(options.siteId, siteTerms);
|
|
2030
2183
|
const actions = useBookingFlowController({
|
|
@@ -2034,9 +2187,10 @@ function useHeadlessBookingFlow(options) {
|
|
|
2034
2187
|
formId: formKey,
|
|
2035
2188
|
services,
|
|
2036
2189
|
promisedDiscountId: resolveDisclosedBookingDiscountId(discountUi),
|
|
2190
|
+
purchasablePackages: choices.purchasablePackages,
|
|
2037
2191
|
defaultServiceId,
|
|
2038
2192
|
defaultResourceId,
|
|
2039
|
-
requiresResourceSelection
|
|
2193
|
+
requiresResourceSelection,
|
|
2040
2194
|
successMessage: options.successMessage,
|
|
2041
2195
|
viewerTimeZone,
|
|
2042
2196
|
discountCode: discountUi.discountCode,
|
|
@@ -2044,7 +2198,6 @@ function useHeadlessBookingFlow(options) {
|
|
|
2044
2198
|
requireSiteTerms: siteTerms.requireAgreement,
|
|
2045
2199
|
clearFeedback,
|
|
2046
2200
|
setDiscountCode: discountUi.setDiscountCode,
|
|
2047
|
-
navigateToCheckout: options.navigateToCheckout ?? navigateToCheckout,
|
|
2048
2201
|
steps: stepState.steps,
|
|
2049
2202
|
currentStep: stepState.currentStep,
|
|
2050
2203
|
currentStepIndex: stepState.currentStepIndex,
|
|
@@ -2078,7 +2231,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
2078
2231
|
const paymentConfirmationSummary = resolveBookingPaymentConfirmationSummary({
|
|
2079
2232
|
service: selectedService,
|
|
2080
2233
|
priceAmount: selectedAppointmentPriceAmount,
|
|
2081
|
-
hasSelectedAppointmentPackage: Boolean(state.selectedAppointmentPackageId),
|
|
2234
|
+
hasSelectedAppointmentPackage: Boolean(state.selectedAppointmentPackageId) || purchase.kind === "selected",
|
|
2082
2235
|
paymentResolution
|
|
2083
2236
|
});
|
|
2084
2237
|
const availabilityDisplay = resolveBookingFormDateDisplay({
|
|
@@ -2097,7 +2250,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
2097
2250
|
feedback: state.feedback
|
|
2098
2251
|
});
|
|
2099
2252
|
const appointmentPackagesModel = resolveAppointmentPackagesModel({
|
|
2100
|
-
enabled:
|
|
2253
|
+
enabled: packageSources.held !== "disabled",
|
|
2101
2254
|
canLoad: canLoadAppointmentPackages,
|
|
2102
2255
|
unavailableReason: appointmentPackagesUnavailableReason,
|
|
2103
2256
|
state: appointmentPackages,
|
|
@@ -2105,7 +2258,14 @@ function useHeadlessBookingFlow(options) {
|
|
|
2105
2258
|
selected: selectedAppointmentPackage,
|
|
2106
2259
|
heldWithTeamMembers: choices.heldPackageTeamMembers
|
|
2107
2260
|
});
|
|
2108
|
-
const
|
|
2261
|
+
const purchasablePackages = resolveBookingPurchasablePackages(canLoadPurchasablePackages, choices.purchasablePackages);
|
|
2262
|
+
const packagePaymentModel = {
|
|
2263
|
+
choice: resolveBookingPaymentChoice(state.packagePurchase, state.selectedAppointmentPackageId, packageOnly ? void 0 : selectedCollectionOptionKind),
|
|
2264
|
+
purchasablePackages,
|
|
2265
|
+
availability: resolveBookingPaymentAvailability(!packageOnly && paymentResolution.kind !== "unavailable", appointmentPackagesModel, purchasablePackages)
|
|
2266
|
+
};
|
|
2267
|
+
const payment = paymentResolution.kind === "unavailable" && packagePaymentModel.availability.kind === "no_choices" ? {
|
|
2268
|
+
...packagePaymentModel,
|
|
2109
2269
|
kind: "unsupported",
|
|
2110
2270
|
mode: "unsupported",
|
|
2111
2271
|
selection: null,
|
|
@@ -2118,8 +2278,9 @@ function useHeadlessBookingFlow(options) {
|
|
|
2118
2278
|
errorMessage: paymentResolution.errorMessage,
|
|
2119
2279
|
confirmationSummary: null
|
|
2120
2280
|
} : {
|
|
2281
|
+
...packagePaymentModel,
|
|
2121
2282
|
kind: "ok",
|
|
2122
|
-
mode: paymentResolution
|
|
2283
|
+
mode: resolveBookingPaymentMode(selectedService, paymentResolution),
|
|
2123
2284
|
selection: paymentSelection,
|
|
2124
2285
|
selectedCollectionOptionKind,
|
|
2125
2286
|
selectedAppointmentPackageId: state.selectedAppointmentPackageId,
|
|
@@ -2153,7 +2314,8 @@ function useHeadlessBookingFlow(options) {
|
|
|
2153
2314
|
selected: resources.find((resource) => resource.id === selectedResourceId) ?? null,
|
|
2154
2315
|
selectedResourceId,
|
|
2155
2316
|
state: resourcesState,
|
|
2156
|
-
requiresSelection:
|
|
2317
|
+
requiresSelection: requiresResourceSelection,
|
|
2318
|
+
configuredRequiresSelection: Boolean(options.requiresResourceSelection)
|
|
2157
2319
|
},
|
|
2158
2320
|
availability: {
|
|
2159
2321
|
selectedDate: state.selectedDate,
|
|
@@ -2208,9 +2370,6 @@ const EMPTY_SERVICE_CATEGORIES = [];
|
|
|
2208
2370
|
function readServiceCategories(options) {
|
|
2209
2371
|
return options.serviceCategories ?? EMPTY_SERVICE_CATEGORIES;
|
|
2210
2372
|
}
|
|
2211
|
-
function navigateToCheckout(checkoutUrl) {
|
|
2212
|
-
window.location.href = checkoutUrl;
|
|
2213
|
-
}
|
|
2214
2373
|
function resolveDisclosedBookingDiscountId(discount) {
|
|
2215
2374
|
return discount.discountsAvailableLoading || discount.discountCode.trim() ? void 0 : discount.autoAppliedDiscount?.id;
|
|
2216
2375
|
}
|
|
@@ -2697,6 +2856,84 @@ function BookingReviewIdentity({ booking }) {
|
|
|
2697
2856
|
});
|
|
2698
2857
|
}
|
|
2699
2858
|
//#endregion
|
|
2859
|
+
//#region ../blocks/src/system/runtime/nodes/booking-form.payment-packages.tsx
|
|
2860
|
+
/** Copy for one package the client can buy and use for this booking. */
|
|
2861
|
+
function purchasablePackageRowCopy(item, serviceTitle) {
|
|
2862
|
+
const heldWith = item.heldWithTeamMember;
|
|
2863
|
+
const sessions = item.creditsTotal === 1 ? "1 session" : `${item.creditsTotal} sessions`;
|
|
2864
|
+
return {
|
|
2865
|
+
label: heldWith ? `${item.name} with ${heldWith.name}` : item.name,
|
|
2866
|
+
details: [
|
|
2867
|
+
`${sessions}. This booking uses one.`,
|
|
2868
|
+
heldWith ? `Use them with ${heldWith.name}.` : `Use them with anyone who offers ${serviceTitle}.`,
|
|
2869
|
+
...item.validDays ? [`${formatValidity(item.validDays)} from when you buy it.`] : []
|
|
2870
|
+
],
|
|
2871
|
+
price: formatCurrencyAmount(item.price, item.currency, { decimals: "auto" })
|
|
2872
|
+
};
|
|
2873
|
+
}
|
|
2874
|
+
function heldPackageRows(booking) {
|
|
2875
|
+
return booking.payment.appointmentPackages.items.map((held) => ({
|
|
2876
|
+
id: held.customerPassId,
|
|
2877
|
+
label: held.passName,
|
|
2878
|
+
details: ["Use 1 package credit", `Balance: ${held.creditsRemaining} of ${held.creditsTotal} credits remaining`],
|
|
2879
|
+
price: "1 credit",
|
|
2880
|
+
selected: booking.payment.choice.kind === "held_package" && booking.payment.choice.customerPassId === held.customerPassId,
|
|
2881
|
+
onSelect: () => booking.actions.selectAppointmentPackage(held.customerPassId)
|
|
2882
|
+
}));
|
|
2883
|
+
}
|
|
2884
|
+
function purchasableItems(payment) {
|
|
2885
|
+
return payment.purchasablePackages.kind === "ready" ? payment.purchasablePackages.items : [];
|
|
2886
|
+
}
|
|
2887
|
+
function hasPurchasablePackages(payment) {
|
|
2888
|
+
return purchasableItems(payment).length > 0;
|
|
2889
|
+
}
|
|
2890
|
+
/** "Or buy a package and use it now", below the other ways to pay. */
|
|
2891
|
+
function PurchasablePackageChoices(props) {
|
|
2892
|
+
const { payment, actions } = props.booking;
|
|
2893
|
+
const items = purchasableItems(payment);
|
|
2894
|
+
if (items.length === 0) return null;
|
|
2895
|
+
const heading = props.hasOtherChoices ? "Or buy a package and use it now" : "Buy a package to book this";
|
|
2896
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2897
|
+
className: "rb-reg-stack rb-reg-stack--sm",
|
|
2898
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2899
|
+
className: "ab-subtitle",
|
|
2900
|
+
children: heading
|
|
2901
|
+
}), /* @__PURE__ */ jsx(PaymentChoiceRows, {
|
|
2902
|
+
label: heading,
|
|
2903
|
+
rows: items.map((item) => ({
|
|
2904
|
+
id: item.id,
|
|
2905
|
+
...purchasablePackageRowCopy(item, props.serviceTitle),
|
|
2906
|
+
selected: payment.choice.kind === "buy_package" && payment.choice.package.id === item.id,
|
|
2907
|
+
onSelect: () => actions.selectPackageToBuy(item.id)
|
|
2908
|
+
}))
|
|
2909
|
+
})]
|
|
2910
|
+
});
|
|
2911
|
+
}
|
|
2912
|
+
/** Explains a packages-only service while packages load, or when there's nothing to use or buy. */
|
|
2913
|
+
function PackagePaymentAvailabilityNotice(props) {
|
|
2914
|
+
switch (props.payment.availability.kind) {
|
|
2915
|
+
case "available": return null;
|
|
2916
|
+
case "loading": return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
2917
|
+
tone: "info",
|
|
2918
|
+
className: "alert alert-info",
|
|
2919
|
+
role: "status",
|
|
2920
|
+
children: "Checking packages..."
|
|
2921
|
+
});
|
|
2922
|
+
case "load_error": return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
2923
|
+
tone: "error",
|
|
2924
|
+
className: "alert alert-error",
|
|
2925
|
+
role: "alert",
|
|
2926
|
+
children: "We couldn't load the packages for this booking. Please try again in a moment."
|
|
2927
|
+
});
|
|
2928
|
+
case "no_choices": return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
2929
|
+
tone: "info",
|
|
2930
|
+
className: "alert alert-info",
|
|
2931
|
+
role: "status",
|
|
2932
|
+
children: "You need a package to book this, and there isn't one you can buy online at the moment. Please get in touch and we'll help you book."
|
|
2933
|
+
});
|
|
2934
|
+
}
|
|
2935
|
+
}
|
|
2936
|
+
//#endregion
|
|
2700
2937
|
//#region ../blocks/src/system/runtime/nodes/booking-form.mailing-list-choice.tsx
|
|
2701
2938
|
function BookingMailingListChoice({ booking }) {
|
|
2702
2939
|
const id = React.useId();
|
|
@@ -3207,35 +3444,39 @@ function DefaultResourceChoices({ allowAnyResource, booking, resources, selected
|
|
|
3207
3444
|
className: "rb-reg-stack rb-reg-stack--sm",
|
|
3208
3445
|
role: "group",
|
|
3209
3446
|
"aria-labelledby": headingId,
|
|
3210
|
-
children: [
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
"aria-pressed": !selectedResourceId,
|
|
3221
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
3222
|
-
className: "rb-flex-1 ab-subtitle",
|
|
3223
|
-
children: "Anyone available"
|
|
3224
|
-
}), !selectedResourceId ? /* @__PURE__ */ jsx(SelectedCheck, {}) : null]
|
|
3225
|
-
}) : null, resources.map((resource) => {
|
|
3226
|
-
const isSelected = selectedResourceId === resource.id;
|
|
3227
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
3447
|
+
children: [
|
|
3448
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
3449
|
+
id: headingId,
|
|
3450
|
+
className: "ab-subtitle",
|
|
3451
|
+
children: ["Who would you like to see?", booking.resources.requiresSelection ? null : /* @__PURE__ */ jsx(OptionalMark, {})]
|
|
3452
|
+
}),
|
|
3453
|
+
/* @__PURE__ */ jsx(PackageOnlyResourceNote, { booking }),
|
|
3454
|
+
/* @__PURE__ */ jsxs("div", {
|
|
3455
|
+
className: "rb-reg-grid",
|
|
3456
|
+
children: [allowAnyResource ? /* @__PURE__ */ jsxs("button", {
|
|
3228
3457
|
type: "button",
|
|
3229
|
-
onClick: () => booking.actions.selectResource(
|
|
3230
|
-
className: optionCardClassName(
|
|
3231
|
-
"aria-pressed":
|
|
3458
|
+
onClick: () => booking.actions.selectResource(null),
|
|
3459
|
+
className: optionCardClassName(!selectedResourceId),
|
|
3460
|
+
"aria-pressed": !selectedResourceId,
|
|
3232
3461
|
children: [/* @__PURE__ */ jsx("div", {
|
|
3233
3462
|
className: "rb-flex-1 ab-subtitle",
|
|
3234
|
-
children:
|
|
3235
|
-
}),
|
|
3236
|
-
}, resource
|
|
3237
|
-
|
|
3238
|
-
|
|
3463
|
+
children: "Anyone available"
|
|
3464
|
+
}), !selectedResourceId ? /* @__PURE__ */ jsx(SelectedCheck, {}) : null]
|
|
3465
|
+
}) : null, resources.map((resource) => {
|
|
3466
|
+
const isSelected = selectedResourceId === resource.id;
|
|
3467
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
3468
|
+
type: "button",
|
|
3469
|
+
onClick: () => booking.actions.selectResource(resource.id),
|
|
3470
|
+
className: optionCardClassName(isSelected),
|
|
3471
|
+
"aria-pressed": isSelected,
|
|
3472
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
3473
|
+
className: "rb-flex-1 ab-subtitle",
|
|
3474
|
+
children: resource.label
|
|
3475
|
+
}), isSelected ? /* @__PURE__ */ jsx(SelectedCheck, {}) : null]
|
|
3476
|
+
}, resource.id);
|
|
3477
|
+
})]
|
|
3478
|
+
})
|
|
3479
|
+
]
|
|
3239
3480
|
});
|
|
3240
3481
|
}
|
|
3241
3482
|
function BookingSelectedServiceSummary({ services }) {
|
|
@@ -3315,24 +3556,45 @@ function DefaultDateTimeSelectionStep({ booking, errorSummaryId }) {
|
|
|
3315
3556
|
]
|
|
3316
3557
|
});
|
|
3317
3558
|
}
|
|
3559
|
+
/** Which ways to pay the step lists: held packages and per-session options, but no per-session payment for a packages-only service. */
|
|
3560
|
+
function planPaymentStepChoices(booking) {
|
|
3561
|
+
const viewModel = booking.payment.selection;
|
|
3562
|
+
const perSessionOffered = booking.services.selected?.onlinePaymentChoices?.perSession !== false;
|
|
3563
|
+
const perSessionOptions = perSessionOffered && viewModel ? viewModel.options : [];
|
|
3564
|
+
const choice = booking.payment.choice;
|
|
3565
|
+
const otherRows = [...heldPackageRows(booking), ...perSessionOptions.map((option) => ({
|
|
3566
|
+
id: option.kind,
|
|
3567
|
+
label: option.title,
|
|
3568
|
+
details: paymentChoiceDetails(option),
|
|
3569
|
+
price: paymentChoicePrice(option.amounts),
|
|
3570
|
+
selected: choice.kind === "per_session" ? choice.option === option.kind : choice.kind === "unselected" && viewModel?.mode === "single_option",
|
|
3571
|
+
onSelect: () => booking.actions.selectPaymentOption(option.kind)
|
|
3572
|
+
}))];
|
|
3573
|
+
return {
|
|
3574
|
+
perSessionOffered,
|
|
3575
|
+
perSessionOptions,
|
|
3576
|
+
otherRows,
|
|
3577
|
+
onlyOneWayToPay: viewModel?.mode === "single_option" && otherRows.length === perSessionOptions.length && !hasPurchasablePackages(booking.payment)
|
|
3578
|
+
};
|
|
3579
|
+
}
|
|
3580
|
+
function paymentStepUnavailableMessage(booking) {
|
|
3581
|
+
if (booking.payment.kind === "unsupported") return booking.payment.errorMessage;
|
|
3582
|
+
if (!booking.services.selected) return "Payment options are unavailable for this service right now.";
|
|
3583
|
+
return null;
|
|
3584
|
+
}
|
|
3585
|
+
function paymentStepTitle(booking) {
|
|
3586
|
+
return booking.payment.selection?.sectionTitle ?? "How would you like to pay?";
|
|
3587
|
+
}
|
|
3318
3588
|
function HeadlessBookingPaymentSelectionStep({ booking }) {
|
|
3319
3589
|
const service = booking.services.selected;
|
|
3320
|
-
const
|
|
3321
|
-
|
|
3590
|
+
const { perSessionOffered, perSessionOptions, otherRows, onlyOneWayToPay } = planPaymentStepChoices(booking);
|
|
3591
|
+
const unavailableMessage = paymentStepUnavailableMessage(booking);
|
|
3592
|
+
if (unavailableMessage !== null || !service) return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
3322
3593
|
tone: "error",
|
|
3323
3594
|
className: "alert alert-error",
|
|
3324
3595
|
role: "alert",
|
|
3325
|
-
children:
|
|
3596
|
+
children: unavailableMessage
|
|
3326
3597
|
});
|
|
3327
|
-
if (!service || !viewModel) return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
3328
|
-
tone: "error",
|
|
3329
|
-
className: "alert alert-error",
|
|
3330
|
-
role: "alert",
|
|
3331
|
-
children: "Payment options are unavailable for this service right now."
|
|
3332
|
-
});
|
|
3333
|
-
const packageOptions = booking.payment.appointmentPackages.items;
|
|
3334
|
-
const hasPackageOptions = packageOptions.length > 0;
|
|
3335
|
-
const slidingScale = booking.payment.slidingScale;
|
|
3336
3598
|
return /* @__PURE__ */ jsxs("div", {
|
|
3337
3599
|
className: "rb-reg-stack",
|
|
3338
3600
|
children: [
|
|
@@ -3340,76 +3602,16 @@ function HeadlessBookingPaymentSelectionStep({ booking }) {
|
|
|
3340
3602
|
className: "rb-reg-summary",
|
|
3341
3603
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
3342
3604
|
className: "ab-subtitle",
|
|
3343
|
-
children:
|
|
3605
|
+
children: paymentStepTitle(booking)
|
|
3344
3606
|
}), /* @__PURE__ */ jsx("p", {
|
|
3345
3607
|
className: "ab-text rb-on-surface--muted",
|
|
3346
3608
|
children: service.title
|
|
3347
3609
|
})]
|
|
3348
3610
|
}),
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
children: "Checking package credits..."
|
|
3354
|
-
}) : null,
|
|
3355
|
-
booking.payment.appointmentPackages.state.tag === "error" ? /* @__PURE__ */ jsxs(FeedbackMessage, {
|
|
3356
|
-
tone: "info",
|
|
3357
|
-
className: "alert alert-info",
|
|
3358
|
-
role: "status",
|
|
3359
|
-
children: [booking.payment.appointmentPackages.state.message, " You can continue with the normal payment option."]
|
|
3360
|
-
}) : null,
|
|
3361
|
-
booking.payment.appointmentPackages.kind === "ready" ? booking.payment.appointmentPackages.heldWithTeamMembers.map((member) => /* @__PURE__ */ jsxs("div", {
|
|
3362
|
-
className: "rb-reg-summary rb-space-y-2",
|
|
3363
|
-
children: [/* @__PURE__ */ jsxs("p", {
|
|
3364
|
-
className: "ab-text",
|
|
3365
|
-
children: [
|
|
3366
|
-
"You have sessions with ",
|
|
3367
|
-
member.name,
|
|
3368
|
-
". Book with ",
|
|
3369
|
-
member.name,
|
|
3370
|
-
" to use them."
|
|
3371
|
-
]
|
|
3372
|
-
}), /* @__PURE__ */ jsx(ThemedButton, {
|
|
3373
|
-
type: "button",
|
|
3374
|
-
variant: "secondary",
|
|
3375
|
-
size: "sm",
|
|
3376
|
-
label: `Book with ${member.name}`,
|
|
3377
|
-
onClick: () => {
|
|
3378
|
-
booking.actions.selectResource(member.id);
|
|
3379
|
-
booking.actions.goToStep("datetime-selection");
|
|
3380
|
-
}
|
|
3381
|
-
})]
|
|
3382
|
-
}, member.id)) : null,
|
|
3383
|
-
slidingScale ? /* @__PURE__ */ jsxs("div", {
|
|
3384
|
-
className: "rb-space-y-2",
|
|
3385
|
-
children: [
|
|
3386
|
-
/* @__PURE__ */ jsx("label", {
|
|
3387
|
-
htmlFor: "appointment-sliding-amount",
|
|
3388
|
-
className: "form-label",
|
|
3389
|
-
children: "Choose your price"
|
|
3390
|
-
}),
|
|
3391
|
-
/* @__PURE__ */ jsxs("p", {
|
|
3392
|
-
className: "rb-caption status-muted",
|
|
3393
|
-
children: [
|
|
3394
|
-
formatBookingAmount(slidingScale.minAmount, slidingScale.currency),
|
|
3395
|
-
" to ",
|
|
3396
|
-
formatBookingAmount(slidingScale.maxAmount, slidingScale.currency),
|
|
3397
|
-
slidingScale.suggestedAmount !== null ? `, suggested ${formatBookingAmount(slidingScale.suggestedAmount, slidingScale.currency)}` : ""
|
|
3398
|
-
]
|
|
3399
|
-
}),
|
|
3400
|
-
/* @__PURE__ */ jsx("input", {
|
|
3401
|
-
id: "appointment-sliding-amount",
|
|
3402
|
-
type: "number",
|
|
3403
|
-
className: "form-input",
|
|
3404
|
-
min: slidingScale.minAmount / 100,
|
|
3405
|
-
max: slidingScale.maxAmount / 100,
|
|
3406
|
-
step: "0.01",
|
|
3407
|
-
value: booking.payment.selectedSlidingAmountInput,
|
|
3408
|
-
onChange: (event) => booking.actions.setSlidingAmountInput(event.target.value)
|
|
3409
|
-
})
|
|
3410
|
-
]
|
|
3411
|
-
}) : null,
|
|
3412
|
-
viewModel.mode === "single_option" && !hasPackageOptions ? viewModel.options.map((option) => /* @__PURE__ */ jsx("div", {
|
|
3611
|
+
/* @__PURE__ */ jsx(HeldPackageStatus, { booking }),
|
|
3612
|
+
/* @__PURE__ */ jsx(PackagePaymentAvailabilityNotice, { payment: booking.payment }),
|
|
3613
|
+
perSessionOffered ? /* @__PURE__ */ jsx(SlidingScaleField, { booking }) : null,
|
|
3614
|
+
onlyOneWayToPay ? perSessionOptions.map((option) => /* @__PURE__ */ jsx("div", {
|
|
3413
3615
|
className: "rb-reg-summary",
|
|
3414
3616
|
children: /* @__PURE__ */ jsx(PaymentOptionContent, {
|
|
3415
3617
|
id: option.kind,
|
|
@@ -3418,23 +3620,93 @@ function HeadlessBookingPaymentSelectionStep({ booking }) {
|
|
|
3418
3620
|
summaryRows: option.summaryRows,
|
|
3419
3621
|
helperText: option.helperText
|
|
3420
3622
|
})
|
|
3421
|
-
}, option.kind)) : /* @__PURE__ */ jsx(PaymentChoiceRows, {
|
|
3623
|
+
}, option.kind)) : otherRows.length > 0 ? /* @__PURE__ */ jsx(PaymentChoiceRows, {
|
|
3422
3624
|
label: "Payment options",
|
|
3423
|
-
rows:
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
|
|
3625
|
+
rows: otherRows
|
|
3626
|
+
}) : null,
|
|
3627
|
+
/* @__PURE__ */ jsx(PurchasablePackageChoices, {
|
|
3628
|
+
booking,
|
|
3629
|
+
serviceTitle: service.title,
|
|
3630
|
+
hasOtherChoices: otherRows.length > 0
|
|
3631
|
+
})
|
|
3632
|
+
]
|
|
3633
|
+
});
|
|
3634
|
+
}
|
|
3635
|
+
function PackageOnlyResourceNote({ booking }) {
|
|
3636
|
+
if (booking.services.selected?.onlinePaymentChoices?.anyAvailable !== false) return null;
|
|
3637
|
+
return /* @__PURE__ */ jsx("p", {
|
|
3638
|
+
className: "ab-text rb-on-surface--muted",
|
|
3639
|
+
children: "You book this with a package, and each package is with one practitioner. Choose who you'd like to see, and you'll see their packages when you pay."
|
|
3640
|
+
});
|
|
3641
|
+
}
|
|
3642
|
+
function HeldPackageStatus({ booking }) {
|
|
3643
|
+
const held = booking.payment.appointmentPackages;
|
|
3644
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3645
|
+
held.state.tag === "loading" ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
3646
|
+
tone: "info",
|
|
3647
|
+
className: "alert alert-info",
|
|
3648
|
+
role: "status",
|
|
3649
|
+
children: "Checking package credits..."
|
|
3650
|
+
}) : null,
|
|
3651
|
+
held.state.tag === "error" ? /* @__PURE__ */ jsxs(FeedbackMessage, {
|
|
3652
|
+
tone: "info",
|
|
3653
|
+
className: "alert alert-info",
|
|
3654
|
+
role: "status",
|
|
3655
|
+
children: [held.state.message, " You can continue with the normal payment option."]
|
|
3656
|
+
}) : null,
|
|
3657
|
+
held.kind === "ready" ? held.heldWithTeamMembers.map((member) => /* @__PURE__ */ jsxs("div", {
|
|
3658
|
+
className: "rb-reg-summary rb-space-y-2",
|
|
3659
|
+
children: [/* @__PURE__ */ jsxs("p", {
|
|
3660
|
+
className: "ab-text",
|
|
3661
|
+
children: [
|
|
3662
|
+
"You have sessions with ",
|
|
3663
|
+
member.name,
|
|
3664
|
+
". Book with ",
|
|
3665
|
+
member.name,
|
|
3666
|
+
" to use them."
|
|
3667
|
+
]
|
|
3668
|
+
}), /* @__PURE__ */ jsx(ThemedButton, {
|
|
3669
|
+
type: "button",
|
|
3670
|
+
variant: "secondary",
|
|
3671
|
+
size: "sm",
|
|
3672
|
+
label: `Book with ${member.name}`,
|
|
3673
|
+
onClick: () => {
|
|
3674
|
+
booking.actions.selectResource(member.id);
|
|
3675
|
+
booking.actions.goToStep("datetime-selection");
|
|
3676
|
+
}
|
|
3677
|
+
})]
|
|
3678
|
+
}, member.id)) : null
|
|
3679
|
+
] });
|
|
3680
|
+
}
|
|
3681
|
+
function SlidingScaleField({ booking }) {
|
|
3682
|
+
const slidingScale = booking.payment.slidingScale;
|
|
3683
|
+
if (!slidingScale) return null;
|
|
3684
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
3685
|
+
className: "rb-space-y-2",
|
|
3686
|
+
children: [
|
|
3687
|
+
/* @__PURE__ */ jsx("label", {
|
|
3688
|
+
htmlFor: "appointment-sliding-amount",
|
|
3689
|
+
className: "form-label",
|
|
3690
|
+
children: "Choose your price"
|
|
3691
|
+
}),
|
|
3692
|
+
/* @__PURE__ */ jsxs("p", {
|
|
3693
|
+
className: "rb-caption status-muted",
|
|
3694
|
+
children: [
|
|
3695
|
+
formatBookingAmount(slidingScale.minAmount, slidingScale.currency),
|
|
3696
|
+
" to ",
|
|
3697
|
+
formatBookingAmount(slidingScale.maxAmount, slidingScale.currency),
|
|
3698
|
+
slidingScale.suggestedAmount !== null ? `, suggested ${formatBookingAmount(slidingScale.suggestedAmount, slidingScale.currency)}` : ""
|
|
3699
|
+
]
|
|
3700
|
+
}),
|
|
3701
|
+
/* @__PURE__ */ jsx("input", {
|
|
3702
|
+
id: "appointment-sliding-amount",
|
|
3703
|
+
type: "number",
|
|
3704
|
+
className: "form-input",
|
|
3705
|
+
min: slidingScale.minAmount / 100,
|
|
3706
|
+
max: slidingScale.maxAmount / 100,
|
|
3707
|
+
step: "0.01",
|
|
3708
|
+
value: booking.payment.selectedSlidingAmountInput,
|
|
3709
|
+
onChange: (event) => booking.actions.setSlidingAmountInput(event.target.value)
|
|
3438
3710
|
})
|
|
3439
3711
|
]
|
|
3440
3712
|
});
|
|
@@ -3710,9 +3982,8 @@ function appendRebookFlag(url, enabled) {
|
|
|
3710
3982
|
}
|
|
3711
3983
|
function createBookingFormSubmitHandler(input) {
|
|
3712
3984
|
return async () => {
|
|
3713
|
-
const { successUrl, cancelUrl } = buildCheckoutReturnUrls("booking", input.bookingAnchorId);
|
|
3985
|
+
const { successUrl, cancelUrl } = buildCheckoutReturnUrls("booking", input.bookingAnchorId, {}, input.pageNavigation);
|
|
3714
3986
|
const options = {
|
|
3715
|
-
redirect: "manual",
|
|
3716
3987
|
successUrl: appendRebookFlag(successUrl, input.isPortalRebook),
|
|
3717
3988
|
cancelUrl: appendRebookFlag(cancelUrl, input.isPortalRebook)
|
|
3718
3989
|
};
|
|
@@ -3724,7 +3995,10 @@ function createBookingFormSubmitHandler(input) {
|
|
|
3724
3995
|
customerEmail: result.outcome.customerEmail,
|
|
3725
3996
|
mailingListNote: result.outcome.mailingListSignupNote ?? null
|
|
3726
3997
|
});
|
|
3727
|
-
|
|
3998
|
+
const outcome = leavePage(result.outcome.checkoutUrl, input.pageNavigation, (url) => {
|
|
3999
|
+
window.location.href = url;
|
|
4000
|
+
});
|
|
4001
|
+
if (outcome.kind === "handOff") input.onHandOff(outcome);
|
|
3728
4002
|
return;
|
|
3729
4003
|
}
|
|
3730
4004
|
input.setLocalMailingListNote(result.outcome.mailingListSignupNote ?? null);
|
|
@@ -3770,6 +4044,7 @@ const BookingFormClient = ({ siteId: siteIdProp, render }) => {
|
|
|
3770
4044
|
const [localMailingListNote, setLocalMailingListNote] = useState(null);
|
|
3771
4045
|
const [localCustomerEmail, setLocalCustomerEmail] = useState(null);
|
|
3772
4046
|
const api = useBlockApi();
|
|
4047
|
+
const [handOff, setHandOff] = useState(null);
|
|
3773
4048
|
const hasPortalAuth = api.config.auth.type === "bearer" || api.config.authOverrides?.portal?.type === "bearer";
|
|
3774
4049
|
const formId = render.hydration.formId ?? form?.id ?? "booking-form";
|
|
3775
4050
|
const booking = useHeadlessBookingFlow({
|
|
@@ -3854,6 +4129,8 @@ const BookingFormClient = ({ siteId: siteIdProp, render }) => {
|
|
|
3854
4129
|
})
|
|
3855
4130
|
});
|
|
3856
4131
|
const handleComplete = createBookingFormSubmitHandler({
|
|
4132
|
+
pageNavigation: render.hydration.pageNavigation,
|
|
4133
|
+
onHandOff: setHandOff,
|
|
3857
4134
|
booking,
|
|
3858
4135
|
bookingAnchorId,
|
|
3859
4136
|
isPortalRebook,
|
|
@@ -3907,33 +4184,37 @@ const BookingFormClient = ({ siteId: siteIdProp, render }) => {
|
|
|
3907
4184
|
onClick: verification.retry
|
|
3908
4185
|
})]
|
|
3909
4186
|
});
|
|
3910
|
-
return /* @__PURE__ */
|
|
4187
|
+
return /* @__PURE__ */ jsx(BookingSurface, {
|
|
3911
4188
|
id: bookingAnchorId,
|
|
3912
4189
|
className: render.display.className,
|
|
3913
|
-
children:
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
className: "
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
className: "
|
|
3929
|
-
|
|
4190
|
+
children: /* @__PURE__ */ jsxs(AppointmentNavigationContent, {
|
|
4191
|
+
handOff,
|
|
4192
|
+
onBack: () => setHandOff(null),
|
|
4193
|
+
children: [
|
|
4194
|
+
render.hydration.noticeMessage ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
4195
|
+
tone: "info",
|
|
4196
|
+
className: "alert alert-info rb-mb-4",
|
|
4197
|
+
role: "status",
|
|
4198
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
4199
|
+
className: "ab-text",
|
|
4200
|
+
children: render.hydration.noticeMessage
|
|
4201
|
+
})
|
|
4202
|
+
}) : null,
|
|
4203
|
+
viewState.kind === "error" ? /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
4204
|
+
tone: "error",
|
|
4205
|
+
className: "alert alert-error rb-mb-4",
|
|
4206
|
+
role: "alert",
|
|
4207
|
+
children: /* @__PURE__ */ jsx("p", {
|
|
4208
|
+
className: "ab-text",
|
|
4209
|
+
children: viewState.message
|
|
4210
|
+
})
|
|
4211
|
+
}) : null,
|
|
4212
|
+
/* @__PURE__ */ jsx(HeadlessBookingDefaultForm, {
|
|
4213
|
+
booking,
|
|
4214
|
+
onSubmit: handleComplete
|
|
3930
4215
|
})
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
booking,
|
|
3934
|
-
onSubmit: handleComplete
|
|
3935
|
-
})
|
|
3936
|
-
]
|
|
4216
|
+
]
|
|
4217
|
+
})
|
|
3937
4218
|
});
|
|
3938
4219
|
};
|
|
3939
4220
|
/**
|
|
@@ -3948,5 +4229,12 @@ const BookingFormNodeClient = (props) => /* @__PURE__ */ jsx(BookingFormClient,
|
|
|
3948
4229
|
function buildBookingFormNodeClientProps(props) {
|
|
3949
4230
|
return buildBookingFormInteractiveIslandProps(props);
|
|
3950
4231
|
}
|
|
4232
|
+
function AppointmentNavigationContent(props) {
|
|
4233
|
+
return props.handOff ? /* @__PURE__ */ jsx(NavigationHandOffPanel, {
|
|
4234
|
+
handOff: props.handOff,
|
|
4235
|
+
purpose: "payment",
|
|
4236
|
+
onBack: props.onBack
|
|
4237
|
+
}) : props.children;
|
|
4238
|
+
}
|
|
3951
4239
|
//#endregion
|
|
3952
4240
|
export { useHeadlessBookingFlow as a, HeadlessBookingProvider as i, BookingFormNodeClient as n, createBookingBlockApiConfig as o, HeadlessBookingPaymentSelectionStep as r, getAppointmentBookingOverrideInput as s, BookingFormClient as t };
|