@riverbankcms/sdk 0.179.0 → 0.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/_dts/{BlocksIslandsHydrator-DKwgs95u.d.ts → BlocksIslandsHydrator-DC_AvZwy.d.ts} +1 -1
- package/dist/_dts/{Page-lWenra5i.d.ts → Page-DQOxVtp3.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-BRxhRw4I.d.ts → SdkPreviewMode-DrLgY9_f.d.ts} +3 -2
- package/dist/_dts/{client-qWn7xAwJ.d.ts → client-BP7VBRvs.d.ts} +235 -56
- package/dist/_dts/{content-types-DL6GIvTm.d.ts → content-types-1-K2qi__.d.ts} +2 -2
- package/dist/_dts/{contracts-CzWyAiJj.d.ts → contracts-Dfqz0Tcu.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CBKd0cJ4.d.ts → generatePageMetadata-CSfAqmry.d.ts} +2 -2
- package/dist/_dts/{index-DVSipdrT.d.ts → index-B0_2-65A.d.ts} +3 -3
- package/dist/_dts/{index-DCiSHd-C.d.ts → index-BeM5Ylwf.d.ts} +5 -3
- package/dist/_dts/{index-BYnG_vF5.d.ts → index-Blrw2oVk.d.ts} +1 -1
- package/dist/_dts/{index-CaCum9mM.d.ts → index-CB5Csefo.d.ts} +2 -2
- package/dist/_dts/{index-CZgJrhzT.d.ts → index-DCcxLa8p.d.ts} +2 -2
- package/dist/_dts/{index-7CDBZGb-.d.ts → index-DQBGwBPx.d.ts} +1 -1
- package/dist/_dts/{index-BU9uAkHB.d.ts → index-DQr358-m.d.ts} +4 -4
- package/dist/_dts/{loadContent-CPKbFQyq.d.ts → loadContent-BG2tLGXj.d.ts} +7 -7
- package/dist/_dts/{request-BjKBCS7t.d.ts → request-P08l6mkr.d.ts} +2602 -821
- package/dist/_dts/{resolveBlockData-DupbMCup.d.ts → resolveBlockData-BDHc8lFs.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-BqNyCHi8.d.ts → resolvePageContent-Y3IZBbtL.d.ts} +1 -1
- 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 +1 -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 +8 -8
- 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 -3
- 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 +6 -6
- 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/{serviceBookingOutline-YcsIjvn1.d.ts → serviceBookingOutline-BvtNagjw.d.ts} +8 -7
- package/dist/_dts/{types-BOxSq-Bq.d.ts → types-BrK6SS5c.d.ts} +9 -8
- package/dist/_dts/{types-CT-KOxl_.d.ts → types-DpEAnP4F.d.ts} +7 -2
- package/dist/_dts/{types-B7e6Lmo5.d.ts → types-HAy1-Jjo.d.ts} +3 -3
- package/dist/_dts/{validation-Dz6qccue.d.ts → validation-D6q3tOBA.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-1XifJg6V.mjs → BlocksIslandsHydrator-DJSmdNUJ.mjs} +16 -16
- package/dist/client/{BookingMailingListNote-BsbEgagJ.mjs → BookingMailingListNote-CGxg37zx.mjs} +91 -59
- package/dist/client/{BookingQuestionFields-C8IbeLHj.mjs → BookingQuestionFields-DXegGSnS.mjs} +24 -3
- package/dist/client/{CalendarNavigationChevron-Bbqij1XQ.mjs → CalendarNavigationChevron-VfP50sYm.mjs} +5 -5
- package/dist/client/{DemoBookingPortalAccess-uA9H8LIL.mjs → DemoBookingPortalAccess-0Ua44F1j.mjs} +12 -7
- package/dist/client/{EventCalendar.client-yoSI77ov.mjs → EventCalendar.client-CrpiyDSP.mjs} +9 -9
- package/dist/client/{EventCombined.client-HeCNlliq.mjs → EventCombined.client-D0me9wnz.mjs} +8 -8
- package/dist/client/{EventItem-Duhk1vnF.mjs → EventItem-CJITrGkF.mjs} +5 -4
- package/dist/client/{EventListWeekNavigation-BiutEqPK.mjs → EventListWeekNavigation-BlEm_xjq.mjs} +1 -1
- package/dist/client/{EventListing.client-B5ln77jG.mjs → EventListing.client-BNM_HuS0.mjs} +3 -3
- package/dist/client/{EventListing.view-hUDhNtMv.mjs → EventListing.view-CXfb7RRy.mjs} +7 -210
- package/dist/client/{EventRegistrationPayment-DqtX1vB2.mjs → EventRegistrationPayment-DiD9uYs6.mjs} +1292 -224
- package/dist/client/{Page-ChJ2TGVk.mjs → Page-bX7iy_MK.mjs} +158 -50
- package/dist/client/{SiteTermsAgreementField-CDBU31xW.mjs → SiteTermsAgreementField-BAdW5DvE.mjs} +22 -15
- package/dist/client/{StepIndicator-JQA-VuEH.mjs → StepIndicator-DCfdcb7s.mjs} +1 -1
- package/dist/client/{StepIndicator-2Dl9zon2.mjs → StepIndicator-DCqorVne.mjs} +6 -6
- package/dist/client/{accordion-B6SqU49k.mjs → accordion-wofJY8xY.mjs} +1 -1
- package/dist/client/{booking-form.client-DrEOjQ3N.mjs → booking-form.client-CYl9NrqS.mjs} +410 -77
- package/dist/client/{bookingForm-drZBwEZW.mjs → bookingForm-kgVWtuMe.mjs} +4 -4
- package/dist/client/bookings.mjs +40 -10
- package/dist/client/{boxStyleClassNames-DEh45w16.mjs → boxStyleClassNames-CQHWz5gJ.mjs} +2 -2
- package/dist/client/{carousel-C-YJliD-.mjs → carousel-BE1dEFsD.mjs} +1 -1
- package/dist/client/{cart-acGFWK9R.mjs → cart-BsjsdGZE.mjs} +3 -3
- package/dist/client/{cart.client-BzlOGP2j.mjs → cart.client-DylGUWXY.mjs} +1 -1
- package/dist/client/{checkout-SEontwhy.mjs → checkout-B5KxEUDr.mjs} +3 -3
- package/dist/client/{checkout.client-C0Qvh-d4.mjs → checkout.client-C98fhch3.mjs} +1 -1
- package/dist/client/{checkoutUrls-yUKeq1N9.mjs → checkoutUrls-BMLYTf38.mjs} +1 -1
- package/dist/client/client.mjs +224 -158
- package/dist/client/constants-PfYJsEZF.mjs +101 -0
- package/dist/client/{context-DTrwaQtg.mjs → context-DtKdUdkO.mjs} +199 -27
- package/dist/client/{dateFormatting-Cg8E1r9l.mjs → dateFormatting-BaGPvQS3.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-D0kOJYOX.mjs → demoPortalMagicLink-B8eDjhuG.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-DyrpZ7ks.mjs → enhanceHeaderSection-DvhD-8eE.mjs} +3 -3
- package/dist/client/{event-registration.client-RLZQWi2V.mjs → event-registration.client-Du9a_xAN.mjs} +1980 -1517
- package/dist/client/{eventCalendar-CphYnImh.mjs → eventCalendar-Di9wDfzl.mjs} +4 -4
- package/dist/client/{eventCombined-BvqjASB_.mjs → eventCombined-CNW6nBsB.mjs} +4 -4
- package/dist/client/{eventListing-BaNAoC_M.mjs → eventListing-CQMxQ8By.mjs} +4 -4
- package/dist/client/{eventRegistration-COMHoRl6.mjs → eventRegistration-CprS9k1D.mjs} +4 -4
- package/dist/client/{form-DyH2juYT.mjs → form-Zl1_8RJ6.mjs} +3 -3
- package/dist/client/{form.client-DBwzkB0M.mjs → form.client-TaMUys6I.mjs} +4 -4
- package/dist/client/{form.parts-CY4kX3mh.mjs → form.parts-CpNPbPPM.mjs} +1 -1
- package/dist/client/{formatDate-CTEN7gxW.mjs → formatDate-hhI1-tzt.mjs} +1 -1
- package/dist/client/gifting/client.mjs +5 -5
- package/dist/client/{gifting-CIx4V378.mjs → gifting-DNVa7-Wj.mjs} +4 -4
- package/dist/client/{gifting.client-BEVPpzJM.mjs → gifting.client-CFUq3GVx.mjs} +4 -4
- package/dist/client/{gifting.parts-VnORjnZK.mjs → gifting.parts-CDQvxA4A.mjs} +2 -2
- package/dist/client/{headerSection-DGcJfRS8.mjs → headerSection-Cg6083rn.mjs} +2 -2
- package/dist/client/{lookSurfaces-IqT_SVnX.mjs → lookSurfaces-gJ3OqPf9.mjs} +92 -2
- package/dist/client/{newsletter-form.client-BvEDkjiD.mjs → newsletter-form.client-VuL9I96G.mjs} +5 -5
- package/dist/client/{newsletter-form.interactive-DCO1lErD.mjs → newsletter-form.interactive-7Of3eYn0.mjs} +18 -24
- package/dist/client/{newsletter-form.parts-BIy4IUT3.mjs → newsletter-form.parts-OBqsfT24.mjs} +1 -1
- package/dist/client/{newsletterForm-CoTXDNFS.mjs → newsletterForm-BkJe_RTv.mjs} +3 -3
- package/dist/client/portal/client.mjs +299 -115
- package/dist/client/{product-detail.client-YHQ2aKX1.mjs → product-detail.client-B2hdxqJN.mjs} +1 -1
- package/dist/client/{product-list.client-DxoZw1vF.mjs → product-list.client-CCEgu9rx.mjs} +1 -1
- package/dist/client/{productDetail-DjuFvkey.mjs → productDetail-CRX_ZRfS.mjs} +3 -3
- package/dist/client/{productList-DE9GEFoZ.mjs → productList-BAdJ6z5S.mjs} +3 -3
- package/dist/client/{propsDecoder-Cyag_HOs.mjs → propsDecoder-BLKAmX0S.mjs} +2 -2
- package/dist/client/{registry.server-BPwV-0Pp.mjs → registry.server-Bj9cmHHF.mjs} +89 -50
- package/dist/client/rendering/client.mjs +22 -22
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +4 -4
- package/dist/client/{richText-coerce-NrRqDeOg.mjs → richText-coerce-Z45OLLEX.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-BWq5gKFK.mjs → routeIslandApiConfig-DHpTTK77.mjs} +1 -1
- package/dist/client/{shop-C3wM0Hr4.mjs → shop-BKsgxm_-.mjs} +3 -3
- package/dist/client/{shop-commerce-34YvcpbX.mjs → shop-commerce-Cbtk_kUW.mjs} +12 -12
- package/dist/client/{shop-commerce-store-B7xHksOs.mjs → shop-commerce-store-B-rv2p5h.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-BiBnozfO.mjs → shop-discount-apply.state-CiCDLNh7.mjs} +2 -2
- package/dist/client/{shop.client-C0v88nLd.mjs → shop.client-Rnqa74Tk.mjs} +12 -12
- package/dist/client/{shopShared-Ct-BRNez.mjs → shopShared-BaBfhjCq.mjs} +2 -2
- package/dist/client/{src-CCtanNlD.mjs → src-o7WEvbK1.mjs} +118 -3
- package/dist/client/{timetableModel-lhE29TNT.mjs → timetableModel-BOff1Kk5.mjs} +201 -7
- package/dist/client/{useAvailableSlots-BelJviOT.mjs → useAvailableSlots-DQJNh10g.mjs} +3 -23
- package/dist/client/{useDiscountCodeUi-rQRE1-Ho.mjs → useDiscountCodeUi-BcFQRI_7.mjs} +1 -1
- package/dist/client/{useEventPagination-C4rS2Xxl.mjs → useEventPagination-BvdcexDC.mjs} +7 -7
- package/dist/client/{view-LJVHVqsy.mjs → view-CTBwSpKv.mjs} +3 -3
- package/dist/client/{wizardSteps-CNDsxeJH.mjs → wizardSteps-CWIQyRIw.mjs} +1605 -442
- package/dist/preview-next/before-render.mjs +1 -0
- package/dist/preview-next/client/{LocationPickerEnvironment-BHAT81Wx.mjs → LocationPickerEnvironment-BW3dRFIv.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-B52hkdIZ.mjs → MapLibreEditMap-Db9BHyXh.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-C4TtBPN-.mjs → PageSectionToolbar-CG6KwITA.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-D6fkE59-.mjs → PreviewEditorSidebar-BGBqrC9m.mjs} +8 -7
- package/dist/preview-next/client/{PreviewEditorUI-amcDlj0O.mjs → PreviewEditorUI-Bwkyx28x.mjs} +5 -5
- package/dist/preview-next/client/{PreviewShell-DeQjx4zk.mjs → PreviewShell-DB1l6JNU.mjs} +7 -7
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Cx0SXnoX.mjs → SdkPreviewModeRuntime-Bs6Cwzr3.mjs} +15 -7
- package/dist/preview-next/client/{lucide-react-McYZeSMb.mjs → lucide-react-00FF_oar.mjs} +13 -1
- package/dist/preview-next/client/{previewAssistantSlot-aqpU34WI.mjs → previewAssistantSlot-T-oDD_Dd.mjs} +5735 -2073
- package/dist/preview-next/client/{previewChromeRoot-D3Gy_Rs0.mjs → previewChromeRoot-BeukcDRy.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-Dzx_RrN7.mjs → sdk-runtime-ceDW_9q2.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-LHedw83e.mjs → siteStyleAccess-CCB9bScO.mjs} +35 -23
- package/dist/preview-next/client/{useAutosaveStatus-DpSd9aVk.mjs → useAutosaveStatus-D4o0CKq7.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-BGZn5AT1.mjs → useOpenBlockForSetup-Seccrvwu.mjs} +2 -2
- package/dist/preview-next/container-responsive.css +103 -10
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-DnL-FgSV.mjs → route-contract-FwFj8zGL.mjs} +43 -0
- package/dist/server/{Block.shared-BEbq6EwO.mjs → Block.shared-D6WrRCxX.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-DFEM1a85.mjs → ThemeScopeCore-BQzjDQ2q.mjs} +8 -1
- package/dist/server/{bindings-Bly0dRs7.mjs → bindings-CS6ih1Yc.mjs} +4 -4
- package/dist/server/{client-CGJ2ztYp.mjs → client-m0ylCj_f.mjs} +847 -786
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-BkK1w3QQ.mjs → loadContent-vgWMz1uD.mjs} +6 -4
- package/dist/server/{loadPage-DTLe0FEs.mjs → loadPage-CIOL3-9t.mjs} +3 -3
- package/dist/server/{lookMediaFrame-CaH018pK.mjs → lookMediaFrame-m-91jGGn.mjs} +36 -0
- package/dist/server/next.mjs +43 -30
- package/dist/server/{overrideResolution-Uy9Zp2Ks.mjs → overrideResolution-BiHmsvTZ.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-JzxBnqfV.mjs → pageRenderPlan-DJo_obpi.mjs} +9 -7
- package/dist/server/{pageRuntimeSupport-DyNSd2Yj.mjs → pageRuntimeSupport-BnSuoHON.mjs} +5 -1
- package/dist/server/{pageShared-DU4ETFPS.mjs → pageShared-BJuOzxzn.mjs} +550 -258
- package/dist/server/{prebuild-8jNtDXmS.mjs → prebuild-Cr8p8T7V.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-xeMG42aw.mjs → prefetchBlockData-BZh57-ua.mjs} +4 -3
- package/dist/server/{registry-DH1VrsCl.mjs → registry-CvhFwbXJ.mjs} +240 -80
- 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 +8 -8
- package/dist/server/{resolveBlockData-BN8tweTx.mjs → resolveBlockData-Cv_W1LVB.mjs} +39 -31
- package/dist/server/{resolvePageContent-DnM16_f9.mjs → resolvePageContent-BWKUZUIn.mjs} +1 -1
- package/dist/server/{responseMedia-F-ElH2Rd.mjs → responseMedia-KRKguBC5.mjs} +56 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-B-FezJmH.mjs → servicePageContent-CRKbTm_7.mjs} +14 -10
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/{validation-3jOzYdPL.mjs → validation-DCl-FCk_.mjs} +4 -4
- package/dist/server/{version-8t0o6_jd.mjs → version-DT_R5JAR.mjs} +1 -1
- package/dist/styles/index.css +504 -27
- package/package.json +1 -1
- package/dist/client/constants-4o4_hl34.mjs +0 -6
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $
|
|
3
|
-
import { Kt as
|
|
4
|
-
import { D as unsafeAsAppointmentResourceId, O as unsafeAsAppointmentServiceId, g as formatCreditProductUnits, h as formatCreditProductPayment, m as formatCreditProductBalance, o as checkBookingQuestionsAnswered } from "./creditProducts-BQ1t1erI.mjs";
|
|
5
|
-
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-
|
|
2
|
+
import { $i as resolveBookingPaymentChoice, Ai as appointmentQuestionsRefusal, Bn as isEmailAddress, Ci as selectedBookingCollectionOptionKind, Cr as formatCommercePrice, Da as leavePage, Di as resolveSelectedAppointmentConsent, Ei as projectSelectedAppointmentConsentIntoForm, Fi as decideBookingQuestionsRestoration, Gi as applyBookingPaymentAdmission, H as buildReviewedBookingPaymentViewModel, Is as unsafeAsSiteId, Ji as bookingRequiresResourceSelection, Jo as resolveDateRuntimeContext, Ki as bookingHasPackagePaymentChoices, Mi as isAppointmentBookingQuestionsEvent, Ni as needsAppointmentQuestionsRefresh, Oi as EMPTY_APPOINTMENT_BOOKING_QUESTIONS, Pi as bookingQuestionsAnswerDraftSchema, Qi as resolveBookingPaymentAvailability, Ri as restoreBookingQuestionsAnswers, Si as resolveLowestBookingPaymentStep, Ti as toSelectedCollectionOptionKind, Tr as formatValidity, U as paymentChoiceDetails, Ui as BOOKING_FORM_DATA_RESERVED_KEYS, V as buildBookingPaymentSelectionViewModel, Vi as formatCentsAsCurrencyInput, W as paymentChoicePrice, Xi as resolveBookingPackagePaymentSelection, Yi as reconcileBookingPackagePurchase, Zi as resolveBookingPackageSources, _i as resolveAppointmentCheckoutVerificationState, ai as deriveBookingFormViewState, bi as resolveBookingSiteId, ci as getBookingSuccessCopy, di as isBookingServiceSlidingAmountInRange, ea as resolveBookingPaymentMode, fi as isSameOpenCheckout, gi as prepareBookingSubmission, gs as resolveBookingSignupOffer, hi as parseBookingCurrencyInputToCents, ii as readOverrideServiceCategories, ja as bookingPresentation, ji as deriveAppointmentBookingQuestions, ki as applyAppointmentBookingQuestionsEvent, mi as normalizeBookingServices, na as toBookingPurchasablePackages, oi as formatBookingSubmissionPreparationError, or as createSignInReturnDraftStore, pi as normalizeBookingFormConfig, qi as bookingPackageRequestKey, qo as readRuntimeNow, ra as getBookingServiceSlidingScale, ri as buildBookingFormInteractiveIslandProps, si as getBookingRedirectStateFromLocation, ss as repriceBookingCollectionOptions, ta as resolveBookingPurchasablePackages, vi as resolveBookingPaymentStep, wi as snapshotBookingShownTerms, xi as resolveDefaultBookingServiceId, yi as resolveBookingSelectedService, z as onlineBookingUnavailableMessage, zi as toBookingQuestionsAnswerDraft } from "./wizardSteps-CWIQyRIw.mjs";
|
|
3
|
+
import { Kt as hasText, Tn as formatCurrencyAmount, Zt as formatDate, _n as parseUtcIsoDateTimeString, a as clearWorkflowFeedback, an as formatTimeZoneCityLabel, bn as resolveBookingTimeZoneId, en as formatDateTimeRange, i as okWith, k as isBookingRequirementConsentFieldId, n as err, o as reportWorkflowError, on as inferSiteDateLocale, rn as formatTime, s as reportWorkflowSuccess, sn as resolveBookingDisplayContext, t as assertNever, u as logger, vn as toUtcIsoDateTimeString, yn as resolveBookingBusinessTimeZone } from "./src-o7WEvbK1.mjs";
|
|
4
|
+
import { D as unsafeAsAppointmentResourceId, O as unsafeAsAppointmentServiceId, T as assertNever$1, g as formatCreditProductUnits, h as formatCreditProductPayment, m as formatCreditProductBalance, o as checkBookingQuestionsAnswered } from "./creditProducts-BQ1t1erI.mjs";
|
|
5
|
+
import { i as useSiteTermsAgreement, n as SiteTermsChangedNotice, t as SiteTermsAgreementField } from "./SiteTermsAgreementField-BAdW5DvE.mjs";
|
|
6
6
|
import { t as layoutServicesByCategory } from "./appointment-service-categories-Cl2pqw-z.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import { i as BlockApiError, n as useBlockApi, t as BlockApiProvider } from "./context-
|
|
7
|
+
import { i as useBookingNowIso, n as OptionalMark, o as clientPersonPhrases, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-DXegGSnS.mjs";
|
|
8
|
+
import { i as BlockApiError, n as useBlockApi, t as BlockApiProvider } from "./context-DtKdUdkO.mjs";
|
|
9
9
|
import { r as ThemedButton, x as SpinnerNode } from "./ThemedButton-CnSa7o-I.mjs";
|
|
10
|
-
import { n as BookingPanelArrangement, t as StepIndicator } from "./StepIndicator-
|
|
11
|
-
import {
|
|
12
|
-
import { t as buildCheckoutReturnUrls } from "./checkoutUrls-
|
|
10
|
+
import { n as BookingPanelArrangement, t as StepIndicator } from "./StepIndicator-DCfdcb7s.mjs";
|
|
11
|
+
import { i as discountEmailProblem, m as DiscountCodeDisclosure, p as NavigationHandOffPanel, r as DISCOUNT_APPLY_MESSAGES, t as BookingConfirmation } from "./DemoBookingPortalAccess-0Ua44F1j.mjs";
|
|
12
|
+
import { t as buildCheckoutReturnUrls } from "./checkoutUrls-BMLYTf38.mjs";
|
|
13
13
|
import { t as scrollToBlock } from "./scrollToBlock-DrgKE0qZ.mjs";
|
|
14
14
|
import { t as CheckboxChoice } from "./CheckboxChoice-BZPLCgTU.mjs";
|
|
15
15
|
import { t as CheckIcon } from "./CheckIcon-CVcKteXH.mjs";
|
|
16
16
|
import { n as getFieldValidationControlProps, t as FieldValidationMessage } from "./FieldValidationMessage-CsqxShw4.mjs";
|
|
17
17
|
import { t as FeedbackMessage } from "./FeedbackMessage-CSJrAuXH.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { n as
|
|
20
|
-
import { a as
|
|
21
|
-
import { c as storeDemoBookingPassIfAvailable } from "./demoPortalMagicLink-
|
|
22
|
-
import { i as getDiscountApplyFeedback } from "./shop-discount-apply.state-
|
|
18
|
+
import { n as TerminalPanel, r as StateIcon, t as useDiscountCodeUi } from "./useDiscountCodeUi-BcFQRI_7.mjs";
|
|
19
|
+
import { c as portalSessionIdentity, d as PaymentChoiceRows, i as SignInNotice, l as useSignInReturn, n as OrganiserContactLine, o as BookingConsentAgreement, r as BookingQuestionSections, s as usePolling, t as BookingMailingListNote, u as useBookingQuestionsRefresh } from "./BookingMailingListNote-CGxg37zx.mjs";
|
|
20
|
+
import { a as formatTime$1, i as formatDatePillParts, n as useAvailableDates, o as getRuntimeTimeZone, r as formatDate$1, t as useAvailableSlots } from "./useAvailableSlots-DQJNh10g.mjs";
|
|
21
|
+
import { c as storeDemoBookingPassIfAvailable } from "./demoPortalMagicLink-B8eDjhuG.mjs";
|
|
22
|
+
import { i as getDiscountApplyFeedback } from "./shop-discount-apply.state-CiCDLNh7.mjs";
|
|
23
23
|
import React, { useCallback, useEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
24
24
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
25
25
|
import { z } from "zod";
|
|
@@ -30,6 +30,111 @@ const unsafeAsCustomerPassId = (id) => id;
|
|
|
30
30
|
//#region ../core/src/branded/communications.ts
|
|
31
31
|
const unsafeAsFormId = (id) => id;
|
|
32
32
|
//#endregion
|
|
33
|
+
//#region ../core/src/booking-payment-copy.ts
|
|
34
|
+
function siteDay(dueAt, context) {
|
|
35
|
+
const parsed = parseUtcIsoDateTimeString(dueAt);
|
|
36
|
+
return parsed.ok ? formatDate({
|
|
37
|
+
kind: "instant",
|
|
38
|
+
value: parsed.value
|
|
39
|
+
}, {
|
|
40
|
+
timeZone: context.siteTimezone,
|
|
41
|
+
locale: context.locale
|
|
42
|
+
}) : null;
|
|
43
|
+
}
|
|
44
|
+
/** Balance deadlines name their payable instant's site-local calendar day. */
|
|
45
|
+
function formatManagedBalanceDueText(dueAt, context) {
|
|
46
|
+
const date = dueAt === null ? null : siteDay(dueAt, context);
|
|
47
|
+
return date === null ? "Remaining balance due before the due date" : `Remaining balance due by ${date}`;
|
|
48
|
+
}
|
|
49
|
+
/** "£20.00 paid, £80.00 due by 5 Dec 2026", for a balance the client pays on the site later. */
|
|
50
|
+
function managedBalanceText(summary, context) {
|
|
51
|
+
const outstanding = formatCurrencyAmount(summary.amountOutstandingCents, summary.currency);
|
|
52
|
+
const date = summary.dueAt === null ? null : siteDay(summary.dueAt, context);
|
|
53
|
+
const due = date === null ? `${outstanding} still to pay` : `${outstanding} due by ${date}`;
|
|
54
|
+
return summary.amountPaidCents > 0 ? `${formatCurrencyAmount(summary.amountPaidCents, summary.currency)} paid, ${due}` : due;
|
|
55
|
+
}
|
|
56
|
+
/** Zero and unavailable counts do not describe credits consumed. */
|
|
57
|
+
function hasUsedPassCredits(credits) {
|
|
58
|
+
return credits !== void 0 && credits !== 0 && !Number.isNaN(credits);
|
|
59
|
+
}
|
|
60
|
+
/** Older stored emails have no balance; zero is a known balance, not missing data. */
|
|
61
|
+
function remainingPassCredits(summary) {
|
|
62
|
+
return summary.passCreditsRemaining === void 0 ? "" : ` (${summary.passCreditsRemaining} left)`;
|
|
63
|
+
}
|
|
64
|
+
function withDiscount(payment, text) {
|
|
65
|
+
if (payment?.discount === void 0) return text;
|
|
66
|
+
const discount = `Discount code ${payment.discount.code}: ${formatCurrencyAmount(payment.discount.savingCents, payment.discount.currency)} off`;
|
|
67
|
+
return text !== null && text.length > 0 ? `${text}. ${discount}` : discount;
|
|
68
|
+
}
|
|
69
|
+
function baseConfirmationEmailPaymentInfo(summary, context) {
|
|
70
|
+
if (summary === void 0) return null;
|
|
71
|
+
switch (summary.kind) {
|
|
72
|
+
case "free":
|
|
73
|
+
case "waived": return null;
|
|
74
|
+
case "manual_due": return `${formatCurrencyAmount(summary.amountDueCents, summary.currency)} to be paid directly`;
|
|
75
|
+
case "managed_balance_due": return managedBalanceText(summary, context);
|
|
76
|
+
case "pass":
|
|
77
|
+
if (!hasText(summary.passName)) return null;
|
|
78
|
+
return (hasUsedPassCredits(summary.passCreditsUsed) ? `${summary.passName} (${summary.passCreditsUsed} credit${summary.passCreditsUsed === 1 ? "" : "s"} used)` : summary.passName) + remainingPassCredits(summary);
|
|
79
|
+
case "membership": return `${summary.membershipName ?? "Membership"} membership`;
|
|
80
|
+
case "monetary":
|
|
81
|
+
if (summary.amountOutstandingCents == null || summary.amountOutstandingCents === 0) return formatCurrencyAmount(summary.amountPaidCents, summary.currency);
|
|
82
|
+
return `${formatCurrencyAmount(summary.amountPaidCents, summary.currency)} paid. ${formatCurrencyAmount(summary.amountOutstandingCents, summary.currency)} remaining${hasText(summary.dueAt) ? ` — ${formatManagedBalanceDueText(summary.dueAt, context)}` : ""}`;
|
|
83
|
+
}
|
|
84
|
+
return assertNever$1(summary);
|
|
85
|
+
}
|
|
86
|
+
/** How a paid booking was paid, as the customer shell's Payment row says it. */
|
|
87
|
+
function paidWith(method) {
|
|
88
|
+
switch (method) {
|
|
89
|
+
case "stripe": return "by card";
|
|
90
|
+
case "store_credit": return "with your account credit";
|
|
91
|
+
case "mixed": return "by card and account credit";
|
|
92
|
+
case "manual": return "";
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/** What's owed outside the site, and what was paid already: nothing either way says arrival. */
|
|
96
|
+
function directBalance(summary) {
|
|
97
|
+
if (summary?.kind === "manual_due") return {
|
|
98
|
+
paidCents: 0,
|
|
99
|
+
owedCents: summary.amountDueCents,
|
|
100
|
+
currency: summary.currency
|
|
101
|
+
};
|
|
102
|
+
if (summary?.kind !== "monetary" || summary.paymentMethod !== "manual" || (summary.amountOutstandingCents ?? 0) === 0) return null;
|
|
103
|
+
return {
|
|
104
|
+
paidCents: summary.amountPaidCents,
|
|
105
|
+
owedCents: summary.amountOutstandingCents ?? 0,
|
|
106
|
+
currency: summary.currency
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/** A balance agreed outside the system has no link or portal payment, so say who it goes to. */
|
|
110
|
+
function directBalanceSentence(summary, context) {
|
|
111
|
+
const balance = directBalance(summary);
|
|
112
|
+
if (balance === null) return null;
|
|
113
|
+
const owed = formatCurrencyAmount(balance.owedCents, balance.currency);
|
|
114
|
+
return `${balance.paidCents > 0 ? `${formatCurrencyAmount(balance.paidCents, balance.currency)} paid. ` : ""}${owed} to pay directly to ${hasText(context.siteTitle) ? context.siteTitle : "the business"}.${context.surface === "email" ? " If you have any questions, just reply to this email." : ""}`;
|
|
115
|
+
}
|
|
116
|
+
/** Customer payment copy shared by built-in confirmations, editable wording and the success page. */
|
|
117
|
+
function formatBookingPaymentSentence(summary, context) {
|
|
118
|
+
return withDiscount(summary, baseBookingPaymentSentence(summary, context));
|
|
119
|
+
}
|
|
120
|
+
function baseBookingPaymentSentence(summary, context) {
|
|
121
|
+
if (summary === void 0) return null;
|
|
122
|
+
const direct = directBalanceSentence(summary, context);
|
|
123
|
+
if (direct !== null) return direct;
|
|
124
|
+
switch (summary.kind) {
|
|
125
|
+
case "free": return "Free";
|
|
126
|
+
case "waived": return "Nothing to pay";
|
|
127
|
+
case "pass":
|
|
128
|
+
if (!hasText(summary.passName)) return null;
|
|
129
|
+
return `Paid with your ${summary.passName}${context.passNoun ? ` ${context.passNoun}` : ""}${remainingPassCredits(summary)}`;
|
|
130
|
+
case "membership": return hasText(summary.membershipName) ? `Included in your ${summary.membershipName} membership` : "Included in your membership";
|
|
131
|
+
case "monetary": return summary.amountOutstandingCents == null || summary.amountOutstandingCents === 0 ? `Paid ${formatCurrencyAmount(summary.amountPaidCents, summary.currency, { decimals: "auto" })}${paidWith(summary.paymentMethod) ? ` ${paidWith(summary.paymentMethod)}` : ""}` : baseConfirmationEmailPaymentInfo(summary, context);
|
|
132
|
+
case "manual_due": return null;
|
|
133
|
+
case "managed_balance_due": return managedBalanceText(summary, context);
|
|
134
|
+
}
|
|
135
|
+
return assertNever$1(summary);
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
33
138
|
//#region ../blocks/src/system/runtime/nodes/booking-form.checkout-return-session.ts
|
|
34
139
|
/** Each cancellation URL names its own browser-held session, even with several checkouts open. */
|
|
35
140
|
function appointmentCheckoutCancelUrl(cancelUrl, returnKey) {
|
|
@@ -225,16 +330,98 @@ function resolveBookingFormDateDisplay(input) {
|
|
|
225
330
|
};
|
|
226
331
|
}
|
|
227
332
|
//#endregion
|
|
333
|
+
//#region ../blocks/src/system/runtime/nodes/booking-form.admission.ts
|
|
334
|
+
const BOOKABLE = { kind: "bookable" };
|
|
335
|
+
const CHECKING = { kind: "checking" };
|
|
336
|
+
/**
|
|
337
|
+
* The one decision on whether a site without card payments can take this
|
|
338
|
+
* booking, from every way the client could pay: a request for approval pays
|
|
339
|
+
* nothing now; a per-session choice the site can take without a card (free,
|
|
340
|
+
* the free end of a sliding scale, or paid to the business directly); or a
|
|
341
|
+
* package the client already holds, including one held with a single team
|
|
342
|
+
* member. Nothing can be bought without cards, so a package purchase never
|
|
343
|
+
* counts.
|
|
344
|
+
*
|
|
345
|
+
* `payment` is the collection decision at the lowest price the client can
|
|
346
|
+
* choose (`resolveLowestBookingPaymentStep`), so what they've typed into a
|
|
347
|
+
* sliding scale doesn't change the answer.
|
|
348
|
+
*/
|
|
349
|
+
function decideBookingAdmission(input) {
|
|
350
|
+
const { payment } = input;
|
|
351
|
+
const service = payment.service;
|
|
352
|
+
if (!service || service.requiresApproval || !needsCardTheSiteCantTake(service, payment)) return BOOKABLE;
|
|
353
|
+
const contact = (service.onlinePayments?.kind === "unavailable" ? service.onlinePayments.organiserContact : void 0) ?? null;
|
|
354
|
+
const refused = (message, recovery) => ({
|
|
355
|
+
kind: "refused",
|
|
356
|
+
message,
|
|
357
|
+
contact,
|
|
358
|
+
recovery
|
|
359
|
+
});
|
|
360
|
+
switch (input.heldPackages) {
|
|
361
|
+
case "some": return BOOKABLE;
|
|
362
|
+
case "checking": return CHECKING;
|
|
363
|
+
case "none": return refused(onlineBookingUnavailableMessage(input.businessName), "none");
|
|
364
|
+
case "signedOut": return refused(onlineBookingUnavailableMessage(input.businessName), "signIn");
|
|
365
|
+
case "unreadable": return refused(packagesUnreadableMessage(input.businessName), "retry");
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function packagesUnreadableMessage(businessName) {
|
|
369
|
+
return `We couldn’t check your packages just now. Please try again, or contact ${businessName?.trim() || "the organiser"} to book.`;
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Without a package of their own, the client would have to pay by card and the
|
|
373
|
+
* site can't take cards. A package-only service has nothing else to pay with;
|
|
374
|
+
* otherwise the collection decision says whether even its cheapest choice
|
|
375
|
+
* needs a card.
|
|
376
|
+
*/
|
|
377
|
+
function needsCardTheSiteCantTake(service, payment) {
|
|
378
|
+
if (service.onlinePaymentChoices?.perSession === false) return service.onlinePayments?.kind === "unavailable";
|
|
379
|
+
return payment.kind === "unavailable" && payment.reason === "cardPaymentsUnavailable";
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* The client's own packages, from the eligibility read: those that pay for
|
|
383
|
+
* this booking as it stands, and, booking with anyone, the team members they
|
|
384
|
+
* hold packages with.
|
|
385
|
+
*/
|
|
386
|
+
function summariseBookingHeldPackages(source, packages, heldWithTeamMembers) {
|
|
387
|
+
switch (source) {
|
|
388
|
+
case "disabled":
|
|
389
|
+
case "missing-priced-service": return "none";
|
|
390
|
+
case "missing-portal-auth": return "signedOut";
|
|
391
|
+
case "enabled": break;
|
|
392
|
+
}
|
|
393
|
+
switch (packages.tag) {
|
|
394
|
+
case "idle":
|
|
395
|
+
case "loading": return "checking";
|
|
396
|
+
case "loaded": return packages.value.length > 0 || heldWithTeamMembers.length > 0 ? "some" : "none";
|
|
397
|
+
case "error": return "unreadable";
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
//#endregion
|
|
228
401
|
//#region ../blocks/src/system/runtime/nodes/booking-form.payment-confirmation.ts
|
|
229
402
|
function resolveBookingPaymentConfirmationSummary(input) {
|
|
230
403
|
const service = input.service;
|
|
231
|
-
if (!service ||
|
|
232
|
-
|
|
404
|
+
if (!service || !service.durationMinutes || !Number.isFinite(input.priceAmount) || input.priceAmount <= 0) return null;
|
|
405
|
+
const base = {
|
|
233
406
|
serviceTitle: service.title,
|
|
234
407
|
durationMinutes: service.durationMinutes,
|
|
235
|
-
priceAmount: input.priceAmount
|
|
236
|
-
priceCurrency: service.priceCurrency ?? service.pricing?.currency ?? "USD"
|
|
408
|
+
priceAmount: input.priceAmount
|
|
237
409
|
};
|
|
410
|
+
switch (input.choice.kind) {
|
|
411
|
+
case "buy_package": return {
|
|
412
|
+
...base,
|
|
413
|
+
kind: "buy_package",
|
|
414
|
+
packageName: input.choice.package.name,
|
|
415
|
+
priceCurrency: input.choice.package.currency
|
|
416
|
+
};
|
|
417
|
+
case "held_package": return null;
|
|
418
|
+
case "per_session":
|
|
419
|
+
case "unselected": return bookingPaymentNeedsCardConfirmation(input.paymentResolution) ? {
|
|
420
|
+
...base,
|
|
421
|
+
kind: "per_session",
|
|
422
|
+
priceCurrency: service.priceCurrency ?? service.pricing?.currency ?? "USD"
|
|
423
|
+
} : null;
|
|
424
|
+
}
|
|
238
425
|
}
|
|
239
426
|
function bookingPaymentNeedsCardConfirmation(payment) {
|
|
240
427
|
return payment.kind === "ready" && payment.choice.kind === "selected" && payment.choice.option.kind !== "deferred_manual";
|
|
@@ -633,7 +820,10 @@ function executeBookingSubmission$1(api, data, resumeSessionId) {
|
|
|
633
820
|
bookingQuestions: data.bookingQuestions,
|
|
634
821
|
mailingListOptIn: data.mailingListOptIn,
|
|
635
822
|
timezone: data.timezone,
|
|
636
|
-
...data.kind === "package_purchase" ? {
|
|
823
|
+
...data.kind === "package_purchase" ? { purchase: {
|
|
824
|
+
kind: "pass",
|
|
825
|
+
productId: data.passProductId
|
|
826
|
+
} } : {},
|
|
637
827
|
shownTerms: data.shownTerms,
|
|
638
828
|
discountCode: data.discountCode,
|
|
639
829
|
selectedSlidingAmount: data.selectedSlidingAmount,
|
|
@@ -1004,16 +1194,19 @@ function toBookingFormData(state) {
|
|
|
1004
1194
|
}
|
|
1005
1195
|
function buildBookingStepResolution(input) {
|
|
1006
1196
|
const defaultServiceId = input.defaultServiceId ?? resolveDefaultBookingServiceId(input.form, input.services);
|
|
1007
|
-
const
|
|
1197
|
+
const paymentInput = {
|
|
1008
1198
|
data: input.data,
|
|
1009
1199
|
nowIso: input.nowIso,
|
|
1010
1200
|
timeZone: input.timeZone,
|
|
1011
1201
|
services: input.services,
|
|
1012
1202
|
defaultServiceId
|
|
1013
|
-
}
|
|
1203
|
+
};
|
|
1204
|
+
const paymentResolution = resolveBookingPaymentStep(paymentInput);
|
|
1205
|
+
const lowestPaymentResolution = resolveLowestBookingPaymentStep(paymentInput);
|
|
1014
1206
|
if (!input.form) return {
|
|
1015
1207
|
steps: [],
|
|
1016
|
-
paymentResolution
|
|
1208
|
+
paymentResolution,
|
|
1209
|
+
lowestPaymentResolution
|
|
1017
1210
|
};
|
|
1018
1211
|
const { needsServiceSelection, needsPayment, hasFields } = resolveBookingStepVisibility(input, defaultServiceId, paymentResolution);
|
|
1019
1212
|
return {
|
|
@@ -1039,7 +1232,8 @@ function buildBookingStepResolution(input) {
|
|
|
1039
1232
|
visible: hasFields
|
|
1040
1233
|
}
|
|
1041
1234
|
],
|
|
1042
|
-
paymentResolution
|
|
1235
|
+
paymentResolution,
|
|
1236
|
+
lowestPaymentResolution
|
|
1043
1237
|
};
|
|
1044
1238
|
}
|
|
1045
1239
|
function resolveBookingStepVisibility(input, defaultServiceId, payment) {
|
|
@@ -1076,7 +1270,7 @@ function serviceSelectionMessage(input) {
|
|
|
1076
1270
|
return input.data.serviceId ? null : "Please select a service";
|
|
1077
1271
|
}
|
|
1078
1272
|
function validateBookingStep(input) {
|
|
1079
|
-
const refusal = input
|
|
1273
|
+
const refusal = bookingRefusal(input);
|
|
1080
1274
|
switch (input.stepId) {
|
|
1081
1275
|
case "service-selection": return bookingStepValidationFromMessage(refusal ?? serviceSelectionMessage(input));
|
|
1082
1276
|
case "datetime-selection": return bookingStepValidationFromMessage(refusal ?? (input.data.selectedSlot ? null : "Please select a date and time"));
|
|
@@ -1094,6 +1288,10 @@ function validateBookingStep(input) {
|
|
|
1094
1288
|
default: return assertNever(input.stepId);
|
|
1095
1289
|
}
|
|
1096
1290
|
}
|
|
1291
|
+
/** Why the selected service can't be booked at all, if it can't. */
|
|
1292
|
+
function bookingRefusal(input) {
|
|
1293
|
+
return input.questionsRefusal ?? (input.admission?.kind === "refused" ? input.admission.message : null);
|
|
1294
|
+
}
|
|
1097
1295
|
function bookingStepValidationFromMessage(message) {
|
|
1098
1296
|
return message ? {
|
|
1099
1297
|
ok: false,
|
|
@@ -1106,7 +1304,7 @@ function validateBookingPaymentStep(input) {
|
|
|
1106
1304
|
const resolution = input.paymentResolution ?? resolveBookingPaymentStep(input);
|
|
1107
1305
|
const slidingScale = getBookingServiceSlidingScale(resolution.service);
|
|
1108
1306
|
if (slidingScale && !isBookingServiceSlidingAmountInRange(slidingScale, parseBookingCurrencyInputToCents(input.data.selectedSlidingAmountInput))) return bookingStepValidationFromMessage("Please choose an amount within the sliding scale");
|
|
1109
|
-
if (resolution.kind === "unavailable") return bookingStepValidationFromMessage(resolution.
|
|
1307
|
+
if (resolution.kind === "unavailable") return bookingStepValidationFromMessage(resolution.reason === "cardPaymentsUnavailable" ? "Please choose a payment option" : resolution.errorMessage);
|
|
1110
1308
|
switch (resolution.kind) {
|
|
1111
1309
|
case "not_required": return { ok: true };
|
|
1112
1310
|
case "ready": return bookingStepValidationFromMessage(resolution.choice.kind === "selected" ? null : "Please choose a payment option");
|
|
@@ -1125,7 +1323,7 @@ function validateBookingField(field, value) {
|
|
|
1125
1323
|
if (requiredError) return requiredError;
|
|
1126
1324
|
if (isBlankFieldValue(value)) return null;
|
|
1127
1325
|
const strValue = typeof value === "string" ? value : String(value);
|
|
1128
|
-
if (field.type === "email") return
|
|
1326
|
+
if (field.type === "email") return isEmailAddress(strValue) ? null : "Please enter a valid email address";
|
|
1129
1327
|
if (field.type === "url") try {
|
|
1130
1328
|
new URL(strValue);
|
|
1131
1329
|
return null;
|
|
@@ -1157,12 +1355,18 @@ function validateRequiredBookingField(field, value) {
|
|
|
1157
1355
|
}
|
|
1158
1356
|
function deriveBookingFlowSteps(input) {
|
|
1159
1357
|
const stepResolution = buildBookingStepResolution(input);
|
|
1358
|
+
const admission = decideBookingAdmission({
|
|
1359
|
+
payment: stepResolution.lowestPaymentResolution,
|
|
1360
|
+
heldPackages: input.heldPackages ?? "none",
|
|
1361
|
+
businessName: input.businessName
|
|
1362
|
+
});
|
|
1160
1363
|
const stepPlan = stepResolution.steps.filter((step) => step.visible);
|
|
1161
1364
|
const currentStepIndex = Math.max(0, stepPlan.findIndex((step) => step.id === input.currentStepId));
|
|
1162
1365
|
const validations = new Map(stepPlan.map((step) => [step.id, validateBookingStep({
|
|
1163
1366
|
...input,
|
|
1164
1367
|
stepId: step.id,
|
|
1165
|
-
paymentResolution: stepResolution.paymentResolution
|
|
1368
|
+
paymentResolution: stepResolution.paymentResolution,
|
|
1369
|
+
admission
|
|
1166
1370
|
})]));
|
|
1167
1371
|
const attemptedStepIds = input.attemptedStepIds ?? {};
|
|
1168
1372
|
const steps = stepPlan.map((step, index) => {
|
|
@@ -1185,6 +1389,7 @@ function deriveBookingFlowSteps(input) {
|
|
|
1185
1389
|
currentStep: steps[currentStepIndex] ?? null,
|
|
1186
1390
|
stepIds: steps.map((step) => step.id),
|
|
1187
1391
|
paymentResolution: stepResolution.paymentResolution,
|
|
1392
|
+
admission,
|
|
1188
1393
|
validations
|
|
1189
1394
|
};
|
|
1190
1395
|
}
|
|
@@ -1680,7 +1885,14 @@ function planBookingResourceAcceptance(input) {
|
|
|
1680
1885
|
}] : [];
|
|
1681
1886
|
}
|
|
1682
1887
|
function planBookingPackageAcceptance(input) {
|
|
1683
|
-
|
|
1888
|
+
const { state, packages } = input;
|
|
1889
|
+
if (state.phase !== "editing" || state.packagePurchase.kind === "selected" || state.selectedCollectionOptionKind) return [];
|
|
1890
|
+
if (packages.some((item) => item.customerPassId === state.selectedAppointmentPackageId)) return [];
|
|
1891
|
+
const [first] = packages;
|
|
1892
|
+
return first ? [{
|
|
1893
|
+
type: "appointment-package-selected",
|
|
1894
|
+
packageId: unsafeAsCustomerPassId(first.customerPassId)
|
|
1895
|
+
}] : state.selectedAppointmentPackageId ? [{
|
|
1684
1896
|
type: "appointment-package-selected",
|
|
1685
1897
|
packageId: null
|
|
1686
1898
|
}] : [];
|
|
@@ -1788,7 +2000,7 @@ function useBookingChoices(input) {
|
|
|
1788
2000
|
});
|
|
1789
2001
|
}, []);
|
|
1790
2002
|
const resources = useBookingChoicesRequest(input.serviceId ?? null, loadResources, acceptResources, "Failed to load booking resources.");
|
|
1791
|
-
const packagesResponse = useBookingPackageEligibility(input);
|
|
2003
|
+
const { state: packagesResponse, retry: retryPackages } = useBookingPackageEligibility(input);
|
|
1792
2004
|
const purchasablePackages = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPurchasablePackages, input.serviceId, input.selectedResourceId), loadPurchasablePackages, acceptPurchasablePackages, "Failed to load packages.");
|
|
1793
2005
|
useEffect(() => {
|
|
1794
2006
|
if (!input.canLoadPurchasablePackages) acceptPurchasablePackages([]);
|
|
@@ -1799,6 +2011,7 @@ function useBookingChoices(input) {
|
|
|
1799
2011
|
tag: "loaded",
|
|
1800
2012
|
value: packagesResponse.value.packages
|
|
1801
2013
|
} : packagesResponse, [packagesResponse]),
|
|
2014
|
+
retryPackages,
|
|
1802
2015
|
purchasablePackages,
|
|
1803
2016
|
heldPackageTeamMembers: packagesResponse.tag === "loaded" && !input.selectedResourceId ? packagesResponse.value.heldPackageTeamMembers ?? [] : [],
|
|
1804
2017
|
resourceFacts: input.serviceId && resources.tag === "loaded" ? {
|
|
@@ -1809,6 +2022,8 @@ function useBookingChoices(input) {
|
|
|
1809
2022
|
}
|
|
1810
2023
|
/** Unscoped eligibility resolves practitioner admission independently of the selected practitioner. */
|
|
1811
2024
|
function useBookingPackageEligibility(input) {
|
|
2025
|
+
const [attempt, setAttempt] = useState(0);
|
|
2026
|
+
const retry = useCallback(() => setAttempt((previous) => previous + 1), []);
|
|
1812
2027
|
const latest = useRef(input);
|
|
1813
2028
|
useLayoutEffect(() => {
|
|
1814
2029
|
latest.current = input;
|
|
@@ -1836,8 +2051,8 @@ function useBookingPackageEligibility(input) {
|
|
|
1836
2051
|
});
|
|
1837
2052
|
if (!current.selectedResourceId) accept(response);
|
|
1838
2053
|
}, [accept]);
|
|
1839
|
-
const any = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages, input.serviceId, null), loadAny, acceptAny, "Could not check package credits.");
|
|
1840
|
-
const scoped = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages && !!input.selectedResourceId, input.serviceId, input.selectedResourceId), loadScoped, accept, "Could not check package credits.");
|
|
2054
|
+
const any = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages, input.serviceId, null), loadAny, acceptAny, "Could not check package credits.", attempt);
|
|
2055
|
+
const scoped = useBookingChoicesRequest(bookingPackageRequestKey(input.canLoadPackages && !!input.selectedResourceId, input.serviceId, input.selectedResourceId), loadScoped, accept, "Could not check package credits.", attempt);
|
|
1841
2056
|
useEffect(() => {
|
|
1842
2057
|
if (!input.canLoadPackages) {
|
|
1843
2058
|
accept(NO_PACKAGES);
|
|
@@ -1855,9 +2070,13 @@ function useBookingPackageEligibility(input) {
|
|
|
1855
2070
|
any,
|
|
1856
2071
|
accept
|
|
1857
2072
|
]);
|
|
1858
|
-
return
|
|
2073
|
+
return {
|
|
2074
|
+
state: input.selectedResourceId ? scoped : any,
|
|
2075
|
+
retry
|
|
2076
|
+
};
|
|
1859
2077
|
}
|
|
1860
|
-
|
|
2078
|
+
/** `attempt` asks again for the same key: a retry after a failed read. */
|
|
2079
|
+
function useBookingChoicesRequest(key, load, accept, errorMessage, attempt = 0) {
|
|
1861
2080
|
const [receipt, setReceipt] = useState({
|
|
1862
2081
|
key: null,
|
|
1863
2082
|
state: { tag: "idle" }
|
|
@@ -1897,7 +2116,8 @@ function useBookingChoicesRequest(key, load, accept, errorMessage) {
|
|
|
1897
2116
|
key,
|
|
1898
2117
|
load,
|
|
1899
2118
|
accept,
|
|
1900
|
-
errorMessage
|
|
2119
|
+
errorMessage,
|
|
2120
|
+
attempt
|
|
1901
2121
|
]);
|
|
1902
2122
|
return receipt.key === key ? receipt.state : key ? { tag: "loading" } : { tag: "idle" };
|
|
1903
2123
|
}
|
|
@@ -2029,6 +2249,7 @@ function useBookingFlowController(input) {
|
|
|
2029
2249
|
package: product
|
|
2030
2250
|
});
|
|
2031
2251
|
},
|
|
2252
|
+
retryPackages: () => latestRef.current.retryPackages(),
|
|
2032
2253
|
next: async () => navigate("next"),
|
|
2033
2254
|
back: () => {
|
|
2034
2255
|
navigate("back");
|
|
@@ -2216,7 +2437,8 @@ function useManualDiscountPreview(input) {
|
|
|
2216
2437
|
const apply = async () => {
|
|
2217
2438
|
if (status.type === "applying") return;
|
|
2218
2439
|
if (!input.code.trim()) return refuse(DISCOUNT_APPLY_MESSAGES.emptyCode);
|
|
2219
|
-
|
|
2440
|
+
const emailProblem = discountEmailProblem(input.email);
|
|
2441
|
+
if (emailProblem) return refuse(emailProblem);
|
|
2220
2442
|
if (!input.lines.length) return refuse(DISCOUNT_APPLY_MESSAGES.unavailable);
|
|
2221
2443
|
const pending = {
|
|
2222
2444
|
key,
|
|
@@ -2379,6 +2601,17 @@ function useHeadlessBookingFlow(options) {
|
|
|
2379
2601
|
state.selectedDate,
|
|
2380
2602
|
availabilityTimeZone
|
|
2381
2603
|
]);
|
|
2604
|
+
const choices = useBookingChoices({
|
|
2605
|
+
api,
|
|
2606
|
+
serviceId: selectedServiceId,
|
|
2607
|
+
selectedResourceId: selectedResourceId ?? null,
|
|
2608
|
+
defaultResourceId,
|
|
2609
|
+
canLoadPackages: canLoadAppointmentPackages,
|
|
2610
|
+
canLoadPurchasablePackages,
|
|
2611
|
+
autoSelectSingleResource: options.shouldAutoSelectSingleResource !== false,
|
|
2612
|
+
dispatch
|
|
2613
|
+
});
|
|
2614
|
+
const heldPackages = summariseBookingHeldPackages(packageSources.held, choices.packages, choices.heldPackageTeamMembers);
|
|
2382
2615
|
const stepState = useMemo(() => deriveBookingFlowSteps({
|
|
2383
2616
|
form: runtimeForm,
|
|
2384
2617
|
nowIso: bookingNowIso,
|
|
@@ -2393,9 +2626,13 @@ function useHeadlessBookingFlow(options) {
|
|
|
2393
2626
|
requiresResourceSelection,
|
|
2394
2627
|
enableAppointmentPackages: options.enableAppointmentPackages,
|
|
2395
2628
|
attemptedStepIds: state.attemptedStepIds,
|
|
2396
|
-
questionsRefusal
|
|
2629
|
+
questionsRefusal,
|
|
2630
|
+
businessName: options.siteName,
|
|
2631
|
+
heldPackages
|
|
2397
2632
|
}), [
|
|
2398
2633
|
questionsRefusal,
|
|
2634
|
+
options.siteName,
|
|
2635
|
+
heldPackages,
|
|
2399
2636
|
options.dateContext.timeZone,
|
|
2400
2637
|
data,
|
|
2401
2638
|
bookingNowIso,
|
|
@@ -2469,16 +2706,6 @@ function useHeadlessBookingFlow(options) {
|
|
|
2469
2706
|
state.touchedFields,
|
|
2470
2707
|
state.validationErrors.fieldErrors
|
|
2471
2708
|
]);
|
|
2472
|
-
const choices = useBookingChoices({
|
|
2473
|
-
api,
|
|
2474
|
-
serviceId: selectedServiceId,
|
|
2475
|
-
selectedResourceId: selectedResourceId ?? null,
|
|
2476
|
-
defaultResourceId,
|
|
2477
|
-
canLoadPackages: canLoadAppointmentPackages,
|
|
2478
|
-
canLoadPurchasablePackages,
|
|
2479
|
-
autoSelectSingleResource: options.shouldAutoSelectSingleResource !== false,
|
|
2480
|
-
dispatch
|
|
2481
|
-
});
|
|
2482
2709
|
const resourcesState = choices.resources;
|
|
2483
2710
|
const appointmentPackages = choices.packages;
|
|
2484
2711
|
const resources = resourcesState.tag === "loaded" ? resourcesState.value : [];
|
|
@@ -2570,6 +2797,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
2570
2797
|
mailingListEligible,
|
|
2571
2798
|
bookingQuestions: questions,
|
|
2572
2799
|
endSignInReturn: questions.endSignInReturn,
|
|
2800
|
+
retryPackages: choices.retryPackages,
|
|
2573
2801
|
dispatch
|
|
2574
2802
|
});
|
|
2575
2803
|
const paymentResolution = stepState.paymentResolution;
|
|
@@ -2589,10 +2817,11 @@ function useHeadlessBookingFlow(options) {
|
|
|
2589
2817
|
selectedService,
|
|
2590
2818
|
state.selectedSlot?.startAt
|
|
2591
2819
|
]);
|
|
2820
|
+
const paymentChoice = resolveBookingPaymentChoice(state.packagePurchase, state.selectedAppointmentPackageId, packageOnly ? void 0 : selectedCollectionOptionKind);
|
|
2592
2821
|
const paymentConfirmationSummary = resolveBookingPaymentConfirmationSummary({
|
|
2593
2822
|
service: selectedService,
|
|
2594
|
-
priceAmount: discountedPriceAmount(manualDiscount.discount,
|
|
2595
|
-
|
|
2823
|
+
priceAmount: discountedPriceAmount(manualDiscount.discount, paymentPriceAmount),
|
|
2824
|
+
choice: paymentChoice,
|
|
2596
2825
|
paymentResolution
|
|
2597
2826
|
});
|
|
2598
2827
|
const availabilityDisplay = resolveBookingFormDateDisplay({
|
|
@@ -2621,7 +2850,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
2621
2850
|
});
|
|
2622
2851
|
const purchasablePackages = resolveBookingPurchasablePackages(canLoadPurchasablePackages, choices.purchasablePackages);
|
|
2623
2852
|
const packagePaymentModel = {
|
|
2624
|
-
choice:
|
|
2853
|
+
choice: paymentChoice,
|
|
2625
2854
|
purchasablePackages,
|
|
2626
2855
|
availability: resolveBookingPaymentAvailability(!packageOnly && paymentResolution.kind !== "unavailable", appointmentPackagesModel, purchasablePackages)
|
|
2627
2856
|
};
|
|
@@ -2653,6 +2882,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
2653
2882
|
};
|
|
2654
2883
|
return {
|
|
2655
2884
|
review: state.review,
|
|
2885
|
+
admission: stepState.admission,
|
|
2656
2886
|
dateContext: options.dateContext,
|
|
2657
2887
|
paymentAnchorAt: bookingNowIso,
|
|
2658
2888
|
siteTerms,
|
|
@@ -3149,16 +3379,35 @@ function formatBookingConfirmationDateTime(booking, includeSelection = false) {
|
|
|
3149
3379
|
function BookingPaymentConfirmationText({ booking, summary }) {
|
|
3150
3380
|
if (!summary) return null;
|
|
3151
3381
|
const dateTime = formatBookingConfirmationDateTime(booking);
|
|
3382
|
+
const price = formatCurrencyAmount(summary.priceAmount, summary.priceCurrency, { decimals: "auto" });
|
|
3383
|
+
const when = dateTime ? ` · ${dateTime}` : "";
|
|
3384
|
+
if (summary.kind === "buy_package") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
|
|
3385
|
+
className: "ab-text rb-on-surface--muted",
|
|
3386
|
+
children: [
|
|
3387
|
+
summary.serviceTitle,
|
|
3388
|
+
" · ",
|
|
3389
|
+
summary.durationMinutes,
|
|
3390
|
+
" min",
|
|
3391
|
+
when
|
|
3392
|
+
]
|
|
3393
|
+
}), /* @__PURE__ */ jsxs("p", {
|
|
3394
|
+
className: "ab-text rb-on-surface--muted",
|
|
3395
|
+
children: [
|
|
3396
|
+
"Buying ",
|
|
3397
|
+
summary.packageName,
|
|
3398
|
+
" · ",
|
|
3399
|
+
price
|
|
3400
|
+
]
|
|
3401
|
+
})] });
|
|
3152
3402
|
return /* @__PURE__ */ jsxs("p", {
|
|
3153
3403
|
className: "ab-text rb-on-surface--muted",
|
|
3154
3404
|
children: [
|
|
3155
3405
|
summary.serviceTitle,
|
|
3156
3406
|
" · ",
|
|
3157
3407
|
summary.durationMinutes,
|
|
3158
|
-
" min ·",
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
dateTime ? ` · ${dateTime}` : ""
|
|
3408
|
+
" min · ",
|
|
3409
|
+
price,
|
|
3410
|
+
when
|
|
3162
3411
|
]
|
|
3163
3412
|
});
|
|
3164
3413
|
}
|
|
@@ -3171,11 +3420,12 @@ function BookingFormSubmitActions({ booking, onSubmit }) {
|
|
|
3171
3420
|
const handlePrimaryAction = async () => {
|
|
3172
3421
|
if ((await booking.actions.next()).ok && isLastStep) await onSubmit();
|
|
3173
3422
|
};
|
|
3423
|
+
const refused = booking.admission.kind === "refused";
|
|
3174
3424
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BookingSubmissionSummary, {
|
|
3175
3425
|
booking,
|
|
3176
3426
|
isLastStep,
|
|
3177
3427
|
summary: paymentSummary
|
|
3178
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
3428
|
+
}), !isFirstStep || !refused ? /* @__PURE__ */ jsxs("div", {
|
|
3179
3429
|
className: "rb-wizard-actions",
|
|
3180
3430
|
children: [!isFirstStep ? /* @__PURE__ */ jsx(ThemedButton, {
|
|
3181
3431
|
type: "button",
|
|
@@ -3183,7 +3433,7 @@ function BookingFormSubmitActions({ booking, onSubmit }) {
|
|
|
3183
3433
|
variant: "outline",
|
|
3184
3434
|
size: "md",
|
|
3185
3435
|
label: "Back"
|
|
3186
|
-
}) : null, /* @__PURE__ */ jsx(ThemedButton, {
|
|
3436
|
+
}) : null, refused ? null : /* @__PURE__ */ jsx(ThemedButton, {
|
|
3187
3437
|
type: "button",
|
|
3188
3438
|
onClick: () => {
|
|
3189
3439
|
handlePrimaryAction();
|
|
@@ -3197,7 +3447,7 @@ function BookingFormSubmitActions({ booking, onSubmit }) {
|
|
|
3197
3447
|
srLabel: "Submitting"
|
|
3198
3448
|
} : void 0
|
|
3199
3449
|
})]
|
|
3200
|
-
})] });
|
|
3450
|
+
}) : null] });
|
|
3201
3451
|
}
|
|
3202
3452
|
function reviewedActionLabel(review) {
|
|
3203
3453
|
if (review.terms.dueNowCents > 0) return "Continue to payment";
|
|
@@ -3240,11 +3490,15 @@ function BookingOfferReview({ review, booking }) {
|
|
|
3240
3490
|
});
|
|
3241
3491
|
}
|
|
3242
3492
|
function bookingPrimaryActionLabel(booking, isLastStep, summary) {
|
|
3243
|
-
|
|
3244
|
-
|
|
3493
|
+
return isLastStep ? lastStepActionLabel(booking, summary) : resolvePrimaryActionLabel(false, Boolean(summary));
|
|
3494
|
+
}
|
|
3495
|
+
function lastStepActionLabel(booking, summary) {
|
|
3496
|
+
if (booking.services.selected?.requiresApproval) return "Send request";
|
|
3497
|
+
if (booking.review) return reviewedActionLabel(booking.review);
|
|
3498
|
+
if (summary?.kind === "buy_package") return resolvePrimaryActionLabel(true, true);
|
|
3245
3499
|
const discount = booking.discount.preview?.discount;
|
|
3246
|
-
if (
|
|
3247
|
-
return resolvePrimaryActionLabel(
|
|
3500
|
+
if (discount) return discountedActionLabel(booking, discount);
|
|
3501
|
+
return resolvePrimaryActionLabel(true, Boolean(summary));
|
|
3248
3502
|
}
|
|
3249
3503
|
function discountedActionLabel(booking, discount) {
|
|
3250
3504
|
if (discount.totalAfterDiscountCents === 0) return "Confirm booking";
|
|
@@ -3783,6 +4037,7 @@ function HeadlessBookingDefaultForm({ booking, onSubmit, pageKind }) {
|
|
|
3783
4037
|
labelAs: presentation.stepLabelAs
|
|
3784
4038
|
}) : null,
|
|
3785
4039
|
/* @__PURE__ */ jsx(DefaultQuestionsRefusal, { booking }),
|
|
4040
|
+
/* @__PURE__ */ jsx(DefaultAdmissionRefusal, { booking }),
|
|
3786
4041
|
/* @__PURE__ */ jsx("div", {
|
|
3787
4042
|
className: "step-content",
|
|
3788
4043
|
children: /* @__PURE__ */ jsx(DefaultBookingStepContent, {
|
|
@@ -3791,7 +4046,7 @@ function HeadlessBookingDefaultForm({ booking, onSubmit, pageKind }) {
|
|
|
3791
4046
|
presentation
|
|
3792
4047
|
})
|
|
3793
4048
|
}),
|
|
3794
|
-
/* @__PURE__ */ jsx(DefaultBookingErrorSummary, {
|
|
4049
|
+
admissionRefused(booking) ? null : /* @__PURE__ */ jsx(DefaultBookingErrorSummary, {
|
|
3795
4050
|
errors: currentStep.errors,
|
|
3796
4051
|
id: errorSummaryId
|
|
3797
4052
|
}),
|
|
@@ -3813,12 +4068,57 @@ function DefaultQuestionsRefusal({ booking }) {
|
|
|
3813
4068
|
const presentation = booking.questions.presentation;
|
|
3814
4069
|
if (presentation.kind !== "unavailable" || booking.currentStep?.id === "custom-fields") return null;
|
|
3815
4070
|
return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
3816
|
-
tone: "
|
|
3817
|
-
className: "alert alert-
|
|
3818
|
-
role: "
|
|
4071
|
+
tone: "info",
|
|
4072
|
+
className: "alert alert-info rb-mb-4",
|
|
4073
|
+
role: "status",
|
|
3819
4074
|
children: presentation.message
|
|
3820
4075
|
});
|
|
3821
4076
|
}
|
|
4077
|
+
/**
|
|
4078
|
+
* A booking the admission decision turns away: it needs a card payment the
|
|
4079
|
+
* site can't take, and the client has no package we know of to pay with. Say
|
|
4080
|
+
* so once, as soon as the service is chosen, with how to reach the business
|
|
4081
|
+
* and, while we don't know what packages they hold, a way to find out. On the
|
|
4082
|
+
* payment step the notice stands in place of the ways to pay instead.
|
|
4083
|
+
*/
|
|
4084
|
+
function DefaultAdmissionRefusal({ booking }) {
|
|
4085
|
+
if (booking.currentStep?.id === "payment-selection") return null;
|
|
4086
|
+
return /* @__PURE__ */ jsx(AdmissionRefusalNotice, { booking });
|
|
4087
|
+
}
|
|
4088
|
+
function AdmissionRefusalNotice({ booking }) {
|
|
4089
|
+
const admission = booking.admission;
|
|
4090
|
+
if (admission.kind !== "refused") return null;
|
|
4091
|
+
const email = booking.fields.values.email;
|
|
4092
|
+
return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
4093
|
+
tone: "info",
|
|
4094
|
+
className: "alert alert-info rb-mb-4",
|
|
4095
|
+
role: "status",
|
|
4096
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
4097
|
+
className: "rb-space-y-2",
|
|
4098
|
+
children: [
|
|
4099
|
+
/* @__PURE__ */ jsx("p", { children: admission.message }),
|
|
4100
|
+
admission.contact ? /* @__PURE__ */ jsx(OrganiserContactLine, { contact: admission.contact }) : null,
|
|
4101
|
+
admission.recovery === "signIn" ? /* @__PURE__ */ jsx(SignInNotice, {
|
|
4102
|
+
lead: "Already have a package?",
|
|
4103
|
+
after: "to use it.",
|
|
4104
|
+
email: typeof email === "string" && email.trim() ? email.trim() : void 0,
|
|
4105
|
+
returnPath: booking.questions.signInReturnPath
|
|
4106
|
+
}) : null,
|
|
4107
|
+
admission.recovery === "retry" ? /* @__PURE__ */ jsx(ThemedButton, {
|
|
4108
|
+
type: "button",
|
|
4109
|
+
variant: "secondary",
|
|
4110
|
+
size: "sm",
|
|
4111
|
+
label: "Try again",
|
|
4112
|
+
onClick: booking.actions.retryPackages
|
|
4113
|
+
}) : null
|
|
4114
|
+
]
|
|
4115
|
+
})
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
/** Refused, nothing on the form leads anywhere but the notice and choosing another service. */
|
|
4119
|
+
function admissionRefused(booking) {
|
|
4120
|
+
return booking.admission.kind === "refused";
|
|
4121
|
+
}
|
|
3822
4122
|
function DefaultBookingStepContent({ booking, errorSummaryId, presentation }) {
|
|
3823
4123
|
const stepId = booking.currentStep?.id;
|
|
3824
4124
|
if (!stepId) return null;
|
|
@@ -3840,12 +4140,19 @@ function DefaultBookingStepContent({ booking, errorSummaryId, presentation }) {
|
|
|
3840
4140
|
default: return assertNever(stepId);
|
|
3841
4141
|
}
|
|
3842
4142
|
}
|
|
4143
|
+
/**
|
|
4144
|
+
* Ask who to see when there's a choice to make, refused or not: a package held
|
|
4145
|
+
* with one team member can reopen a refused booking once they're chosen.
|
|
4146
|
+
*/
|
|
4147
|
+
function shouldChooseResource(booking) {
|
|
4148
|
+
return booking.resources.requiresSelection || booking.resources.items.length > 1;
|
|
4149
|
+
}
|
|
3843
4150
|
function DefaultServiceSelectionStep({ booking, presentation }) {
|
|
3844
4151
|
const services = booking.services.items;
|
|
3845
4152
|
const resources = booking.resources.items;
|
|
3846
4153
|
const selectedResourceId = booking.resources.selectedResourceId;
|
|
3847
4154
|
const showServiceSelect = booking.services.requiresSelection || services.length > 1;
|
|
3848
|
-
const showResourceSelect = booking
|
|
4155
|
+
const showResourceSelect = shouldChooseResource(booking);
|
|
3849
4156
|
const allowAnyResource = !booking.resources.requiresSelection;
|
|
3850
4157
|
return /* @__PURE__ */ jsxs("div", {
|
|
3851
4158
|
className: "rb-reg-stack",
|
|
@@ -4042,6 +4349,7 @@ function HeadlessBookingPaymentSelectionStep({ booking, presentation = bookingPr
|
|
|
4042
4349
|
const service = booking.services.selected;
|
|
4043
4350
|
const { perSessionOffered, perSessionOptions, otherRows, onlyOneWayToPay } = planPaymentStepChoices(booking);
|
|
4044
4351
|
const unavailableMessage = paymentStepUnavailableMessage(booking);
|
|
4352
|
+
if (admissionRefused(booking)) return /* @__PURE__ */ jsx(AdmissionRefusalNotice, { booking });
|
|
4045
4353
|
if (unavailableMessage !== null || !service) return /* @__PURE__ */ jsx(FeedbackMessage, {
|
|
4046
4354
|
tone: "error",
|
|
4047
4355
|
className: "alert alert-error",
|
|
@@ -4136,6 +4444,10 @@ function HeldPackageStatus({ booking }) {
|
|
|
4136
4444
|
function SlidingScaleField({ booking }) {
|
|
4137
4445
|
const slidingScale = booking.payment.slidingScale;
|
|
4138
4446
|
if (!slidingScale) return null;
|
|
4447
|
+
if (slidingScale.minAmount === slidingScale.maxAmount) return /* @__PURE__ */ jsx("p", {
|
|
4448
|
+
className: "ab-text",
|
|
4449
|
+
children: slidingScale.maxAmount === 0 ? "You can book this for free online." : `The price is ${formatBookingAmount(slidingScale.maxAmount, slidingScale.currency)}.`
|
|
4450
|
+
});
|
|
4139
4451
|
return /* @__PURE__ */ jsxs("div", {
|
|
4140
4452
|
className: "rb-space-y-2",
|
|
4141
4453
|
children: [
|
|
@@ -4311,21 +4623,42 @@ function AppointmentDetails({ appointment, dateContext, resourceName, person })
|
|
|
4311
4623
|
}),
|
|
4312
4624
|
appointment.resourceName ? /* @__PURE__ */ jsx("p", { children: person.withName(appointment.resourceName) }) : null,
|
|
4313
4625
|
appointment.location ? /* @__PURE__ */ jsx("p", { children: appointment.location }) : null,
|
|
4314
|
-
appointment.
|
|
4315
|
-
"Discount code ",
|
|
4316
|
-
appointment.paymentSummary.discount.code,
|
|
4317
|
-
": ",
|
|
4318
|
-
formatCommercePrice(appointment.paymentSummary.discount.savingCents, appointment.paymentSummary.discount.currency),
|
|
4319
|
-
" off"
|
|
4320
|
-
] }) : null,
|
|
4321
|
-
appointment.paymentSummary?.kind === "pass" ? /* @__PURE__ */ jsx("p", { children: formatCreditProductPayment({
|
|
4322
|
-
name: appointment.paymentSummary.passName ?? "package",
|
|
4323
|
-
creditsUsed: appointment.paymentSummary.passCreditsUsed,
|
|
4324
|
-
creditsRemaining: appointment.paymentSummary.passCreditsRemaining
|
|
4325
|
-
}) }) : null
|
|
4626
|
+
appointmentPaymentLines(appointment, dateContext).map((line) => /* @__PURE__ */ jsx("p", { children: line }, line))
|
|
4326
4627
|
]
|
|
4327
4628
|
});
|
|
4328
4629
|
}
|
|
4630
|
+
function discountLine(payment) {
|
|
4631
|
+
return payment.discount ? [`Discount code ${payment.discount.code}: ${formatCommercePrice(payment.discount.savingCents, payment.discount.currency)} off`] : [];
|
|
4632
|
+
}
|
|
4633
|
+
/**
|
|
4634
|
+
* What was paid, in the confirmation email's words ("Paid £40 by card"). Package and
|
|
4635
|
+
* free bookings keep their own lines: the credits used, and any discount code.
|
|
4636
|
+
*/
|
|
4637
|
+
function appointmentPaymentLines(appointment, dateContext) {
|
|
4638
|
+
const payment = appointment.paymentSummary;
|
|
4639
|
+
if (!payment) return [];
|
|
4640
|
+
switch (payment.kind) {
|
|
4641
|
+
case "free": return discountLine(payment);
|
|
4642
|
+
case "pass": return [...discountLine(payment), formatCreditProductPayment({
|
|
4643
|
+
name: payment.passName ?? "package",
|
|
4644
|
+
creditsUsed: payment.passCreditsUsed,
|
|
4645
|
+
creditsRemaining: payment.passCreditsRemaining
|
|
4646
|
+
})];
|
|
4647
|
+
case "waived":
|
|
4648
|
+
case "membership":
|
|
4649
|
+
case "monetary":
|
|
4650
|
+
case "manual_due":
|
|
4651
|
+
case "managed_balance_due": {
|
|
4652
|
+
const sentence = formatBookingPaymentSentence(payment, {
|
|
4653
|
+
siteTimezone: dateContext?.timeZone ?? resolveBookingTimeZoneId(appointment.timezone),
|
|
4654
|
+
locale: dateContext?.locale ?? inferSiteDateLocale(appointment.timezone),
|
|
4655
|
+
siteTitle: null,
|
|
4656
|
+
surface: "page"
|
|
4657
|
+
});
|
|
4658
|
+
return sentence === null ? [] : [sentence];
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
}
|
|
4329
4662
|
function AppointmentDateTime({ appointment, dateContext }) {
|
|
4330
4663
|
if (!dateContext) return null;
|
|
4331
4664
|
const start = parseUtcIsoDateTimeString(appointment.startAt);
|