@riverbankcms/sdk 0.180.0 → 0.181.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-DC_AvZwy.d.ts → BlocksIslandsHydrator-CVCasDPz.d.ts} +1 -1
- package/dist/_dts/{Page-DQOxVtp3.d.ts → Page-Dtj2Ui3S.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DrLgY9_f.d.ts → SdkPreviewMode-D1f_60WW.d.ts} +2 -2
- package/dist/_dts/{client-BP7VBRvs.d.ts → client-Chr9pNVW.d.ts} +58 -70
- package/dist/_dts/{content-types-1-K2qi__.d.ts → content-types-kjccgopX.d.ts} +2 -2
- package/dist/_dts/{contracts-Dfqz0Tcu.d.ts → contracts-BodaiS00.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CSfAqmry.d.ts → generatePageMetadata-BS6kaJFp.d.ts} +2 -2
- package/dist/_dts/{index-BeM5Ylwf.d.ts → index-Brl6_I2j.d.ts} +1 -2
- package/dist/_dts/{index-CB5Csefo.d.ts → index-CJkefwYh.d.ts} +2 -2
- package/dist/_dts/{index-DQBGwBPx.d.ts → index-D1WpKwQe.d.ts} +1 -1
- package/dist/_dts/{index-DQr358-m.d.ts → index-DG0OvBs0.d.ts} +8 -8
- package/dist/_dts/{index-Blrw2oVk.d.ts → index-Diqt0PvG.d.ts} +1 -1
- package/dist/_dts/{index-DCcxLa8p.d.ts → index-Dy50xUMK.d.ts} +2 -2
- package/dist/_dts/{loadContent-BG2tLGXj.d.ts → loadContent-BgxshKrA.d.ts} +7 -7
- package/dist/_dts/{request-P08l6mkr.d.ts → request-CA0izds5.d.ts} +2498 -1108
- package/dist/_dts/{resolveBlockData-BDHc8lFs.d.ts → resolveBlockData-ChQmwEd3.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-Y3IZBbtL.d.ts → resolvePageContent-BvGyvblj.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 -2
- package/dist/_dts/sdk/src/index.d.ts +104 -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 +83 -52
- 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 +43 -56
- package/dist/_dts/sdk/src/portal/index.d.ts +3 -18
- 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-BvtNagjw.d.ts → serviceBookingOutline-BgFbJQhU.d.ts} +6 -6
- package/dist/_dts/{types-HAy1-Jjo.d.ts → types-CQrsP1x_.d.ts} +3 -3
- package/dist/_dts/{types-DpEAnP4F.d.ts → types-CgS3xLk8.d.ts} +2 -2
- package/dist/_dts/{types-BrK6SS5c.d.ts → types-R65DKjPn.d.ts} +7 -7
- package/dist/_dts/{validation-D6q3tOBA.d.ts → validation-6LTIbuBA.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DJSmdNUJ.mjs → BlocksIslandsHydrator-DqZPz6oW.mjs} +19 -19
- package/dist/client/{BookingMailingListNote-CGxg37zx.mjs → BookingMailingListNote-uWfR2kaG.mjs} +93 -18
- package/dist/client/{BookingQuestionFields-DXegGSnS.mjs → BookingQuestionFields-CyNIKw6k.mjs} +7 -87
- package/dist/client/CalendarAction-D_Glwvz2.mjs +105 -0
- package/dist/client/{CalendarNavigationChevron-VfP50sYm.mjs → CalendarNavigationChevron-BGCX3zwG.mjs} +6 -6
- package/dist/client/{CheckboxChoice-BZPLCgTU.mjs → CheckboxChoice-C8i4NraK.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-0Ua44F1j.mjs → DemoBookingPortalAccess-DFLPyuqe.mjs} +9 -6
- package/dist/client/{EventCalendar.client-CrpiyDSP.mjs → EventCalendar.client-zDL4-t-B.mjs} +10 -10
- package/dist/client/{EventCombined.client-D0me9wnz.mjs → EventCombined.client-uciDKLID.mjs} +60 -10
- package/dist/client/{EventEmbeddedCheckoutStep-BDnicDM6.mjs → EventEmbeddedCheckoutStep-BGkbUhuw.mjs} +1 -1
- package/dist/client/{EventItem-CJITrGkF.mjs → EventItem-CwzrjcRw.mjs} +6 -6
- package/dist/client/{EventListWeekNavigation-BlEm_xjq.mjs → EventListWeekNavigation-ChvcnPma.mjs} +1 -1
- package/dist/client/{EventListing.client-BNM_HuS0.mjs → EventListing.client-DA57Qoyx.mjs} +3 -3
- package/dist/client/{EventListing.view-CXfb7RRy.mjs → EventListing.view-DZ0qMFF4.mjs} +6 -6
- package/dist/client/{EventRegistrationPayment-DiD9uYs6.mjs → EventRegistrationPayment-DSqCJL8E.mjs} +700 -514
- package/dist/client/{Page-bX7iy_MK.mjs → Page-C7mygH_f.mjs} +389 -248
- package/dist/client/{ProtectedSubmitButton-De6AzhE6.mjs → ProtectedSubmitButton-BNnKuir8.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-BAdW5DvE.mjs → SiteTermsAgreementField-B4z-e4Wq.mjs} +7 -11
- package/dist/client/{StepIndicator-DCfdcb7s.mjs → StepIndicator-Dn_DY4oY.mjs} +1 -1
- package/dist/client/{StepIndicator-DCqorVne.mjs → StepIndicator-atfDU82W.mjs} +21 -13
- package/dist/client/{ThemedButton-CnSa7o-I.mjs → ThemedButton-PFOhXktM.mjs} +1 -33
- package/dist/client/{accessibleSurfaces-Wl8-_OVJ.mjs → accessibleSurfaces-n6kS6Hct.mjs} +77 -1
- package/dist/client/{accordion-wofJY8xY.mjs → accordion-CsW8U3ff.mjs} +1 -1
- package/dist/client/{booking-form.client-CYl9NrqS.mjs → booking-form.client-cBWM392H.mjs} +52 -29
- package/dist/client/bookingCalendar--aWnqFDn.mjs +180 -0
- package/dist/client/{bookingForm-kgVWtuMe.mjs → bookingForm-DgySpp6C.mjs} +4 -4
- package/dist/client/bookings.mjs +17 -11
- package/dist/client/{boxStyleClassNames-CQHWz5gJ.mjs → boxStyleClassNames-BpGVdLFD.mjs} +2 -2
- package/dist/client/{carousel-BE1dEFsD.mjs → carousel-DJoleFV3.mjs} +2 -2
- package/dist/client/{carousel.client-DMtGYTTM.mjs → carousel.client-BtLwHefX.mjs} +1 -1
- package/dist/client/{cart-BsjsdGZE.mjs → cart-EO5o6uPH.mjs} +3 -3
- package/dist/client/{cart.client-DylGUWXY.mjs → cart.client-D_gPw45z.mjs} +1 -1
- package/dist/client/{checkout-B5KxEUDr.mjs → checkout-NVfZW0kR.mjs} +3 -3
- package/dist/client/{checkout.client-C98fhch3.mjs → checkout.client-DD3JuqOy.mjs} +1 -1
- package/dist/client/{checkoutUrls-BMLYTf38.mjs → checkoutUrls-z2gXvlGw.mjs} +1 -1
- package/dist/client/client.mjs +87 -43
- package/dist/client/{constants-PfYJsEZF.mjs → constants-CoOkvw__.mjs} +1 -2
- package/dist/client/{context-DtKdUdkO.mjs → context-CRhn9qzS.mjs} +732 -370
- package/dist/client/{dateFormatting-BaGPvQS3.mjs → dateFormatting-BnWB4L1s.mjs} +15 -25
- package/dist/client/{demoPortalMagicLink-B8eDjhuG.mjs → demoPortalMagicLink-CWDGSTBu.mjs} +2 -3
- package/dist/client/{enhanceHeaderSection-DvhD-8eE.mjs → enhanceHeaderSection-tdP_-Z9o.mjs} +4 -5
- package/dist/client/{event-registration.client-Du9a_xAN.mjs → event-registration.client-D7YYKySQ.mjs} +191 -210
- package/dist/client/{eventCalendar-Di9wDfzl.mjs → eventCalendar-CsAfu5d0.mjs} +4 -4
- package/dist/client/{eventCombined-CNW6nBsB.mjs → eventCombined-VXJB5CoS.mjs} +4 -4
- package/dist/client/{eventListing-CQMxQ8By.mjs → eventListing-B3KIZNfY.mjs} +4 -4
- package/dist/client/{eventRegistration-CprS9k1D.mjs → eventRegistration-BP-dEk1c.mjs} +4 -4
- package/dist/client/{form-Zl1_8RJ6.mjs → form-DM8Zbxbv.mjs} +3 -3
- package/dist/client/{form.client-TaMUys6I.mjs → form.client-e2z_Tlgk.mjs} +5 -5
- package/dist/client/{form.parts-CpNPbPPM.mjs → form.parts-Ctljy1a3.mjs} +3 -3
- package/dist/client/gifting/client.mjs +32 -29
- package/dist/client/{gifting-DNVa7-Wj.mjs → gifting-DWIsqQru.mjs} +4 -4
- package/dist/client/{gifting.client-CFUq3GVx.mjs → gifting.client-QsSWF0uA.mjs} +5 -5
- package/dist/client/{gifting.parts-CDQvxA4A.mjs → gifting.parts-CedLgwa_.mjs} +2 -2
- package/dist/client/{headerSection-Cg6083rn.mjs → headerSection-DAkRkwb-.mjs} +2 -2
- package/dist/client/{mediaAssets-B99AP7ai.mjs → mediaAssets-COfQolI3.mjs} +1 -1
- package/dist/client/{mediaContext-Fusweriw.mjs → mediaContext-DzvnjYXm.mjs} +1 -1
- package/dist/client/{newsletter-form.client-VuL9I96G.mjs → newsletter-form.client-WYja9-WN.mjs} +7 -7
- package/dist/client/{newsletter-form.interactive-7Of3eYn0.mjs → newsletter-form.interactive-RuM86VAv.mjs} +23 -24
- package/dist/client/{newsletter-form.parts-OBqsfT24.mjs → newsletter-form.parts-2petDnWv.mjs} +2 -2
- package/dist/client/{newsletterForm-BkJe_RTv.mjs → newsletterForm-BUbXdA_e.mjs} +3 -3
- package/dist/client/{lookSurfaces-gJ3OqPf9.mjs → noop-Dl4mZ-rr.mjs} +167 -49
- package/dist/client/portal/client.mjs +13040 -8190
- package/dist/client/portalOrders-COGn4BKG.mjs +596 -0
- package/dist/client/portalRoutes-D72yvtDh.mjs +862 -0
- package/dist/client/{product-detail.client-B2hdxqJN.mjs → product-detail.client-pOAryevt.mjs} +1 -1
- package/dist/client/{product-list.client-CCEgu9rx.mjs → product-list.client-CcUpUiud.mjs} +1 -1
- package/dist/client/{productDetail-CRX_ZRfS.mjs → productDetail-BZJCfqat.mjs} +3 -3
- package/dist/client/{productList-BAdJ6z5S.mjs → productList-CiRs3mNb.mjs} +3 -3
- package/dist/client/{propsDecoder-BLKAmX0S.mjs → propsDecoder--uHW4tFM.mjs} +2 -2
- package/dist/client/{registry.server-Bj9cmHHF.mjs → registry.server-CDNNd8wC.mjs} +247 -203
- package/dist/client/{renderableMediaAssetAdmission-BlfqYLJW.mjs → renderableMediaAssetAdmission-BsOWd9lf.mjs} +1 -1
- package/dist/client/rendering/client.mjs +26 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +16 -8
- package/dist/client/{richText-coerce-Z45OLLEX.mjs → richText-coerce-CQGE_wHV.mjs} +2 -1
- package/dist/client/{routeIslandApiConfig-DHpTTK77.mjs → routeIslandApiConfig-BtCg87-N.mjs} +1 -1
- package/dist/client/{runtimeResponse-D2j2-mOk.mjs → runtimeResponse-DL_ARBpa.mjs} +1 -1
- package/dist/client/{runtimeResponse-DtWSfWSZ.mjs → runtimeResponse-Ds9cmBUf.mjs} +1 -1
- package/dist/client/{shop-BKsgxm_-.mjs → shop-Rx_gEMK8.mjs} +3 -3
- package/dist/client/{shop-commerce-Cbtk_kUW.mjs → shop-commerce-D8evQnMT.mjs} +53 -16
- package/dist/client/{shop-commerce-store-B-rv2p5h.mjs → shop-commerce-store-C9PcsSTj.mjs} +22 -5
- package/dist/client/{shop-discount-apply.state-CiCDLNh7.mjs → shop-discount-apply.state-D5CtGfJI.mjs} +2 -2
- package/dist/client/{shop.client-Rnqa74Tk.mjs → shop.client-D4lzQ9oY.mjs} +17 -39
- package/dist/client/{shopShared-BaBfhjCq.mjs → shopShared-BVbq7Nm-.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/src-Al4ooTl_.mjs +164 -0
- package/dist/client/{src-o7WEvbK1.mjs → src-ZSqRK3dD.mjs} +228 -90
- package/dist/client/{timetableModel-BOff1Kk5.mjs → timetableModel-BQJrSK0K.mjs} +9 -78
- package/dist/client/{shop-add-feedback-DvC2kP1K.mjs → urlParams-C2QHo1Pa.mjs} +1 -42
- package/dist/client/{useAvailableSlots-DQJNh10g.mjs → useAvailableSlots-Dm3lKJKR.mjs} +2 -3
- package/dist/client/{useDiscountCodeUi-BcFQRI_7.mjs → useDiscountCodeUi-klgfGn7f.mjs} +1 -1
- package/dist/client/{useEventPagination-BvdcexDC.mjs → useEventPagination-Jnjt7_ly.mjs} +8 -8
- package/dist/client/{view-CTBwSpKv.mjs → view-CC_yQLSA.mjs} +4 -4
- package/dist/client/{wizardSteps-CWIQyRIw.mjs → wizardSteps-BliJOzEX.mjs} +953 -279
- package/dist/preview-next/client/{PageSectionToolbar-CG6KwITA.mjs → PageSectionToolbar-BhL0uADo.mjs} +3 -3
- package/dist/preview-next/client/{PreviewEditorSidebar-BGBqrC9m.mjs → PreviewEditorSidebar-Ct8eIm0i.mjs} +5 -5
- package/dist/preview-next/client/{PreviewEditorUI-Bwkyx28x.mjs → PreviewEditorUI-BS32G4V9.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-DB1l6JNU.mjs → PreviewShell-RL0WfZXD.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Bs6Cwzr3.mjs → SdkPreviewModeRuntime-MK_gHeGy.mjs} +29 -5
- package/dist/preview-next/client/{previewAssistantSlot-T-oDD_Dd.mjs → previewAssistantSlot-CQyS8pcq.mjs} +5011 -2074
- package/dist/preview-next/client/{previewChromeRoot-BeukcDRy.mjs → previewChromeRoot-BSxp3Mfu.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-ceDW_9q2.mjs → sdk-runtime-DKnTzy74.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-CCB9bScO.mjs → siteStyleAccess-BlmbvbLN.mjs} +3 -3
- package/dist/preview-next/client/{useAutosaveStatus-D4o0CKq7.mjs → useAutosaveStatus-D-7GwZOQ.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-Seccrvwu.mjs → useOpenBlockForSetup-BNZtGM5g.mjs} +1 -1
- package/dist/preview-next/container-responsive.css +203 -174
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-FwFj8zGL.mjs → route-contract-R3PcMmax.mjs} +71 -37
- package/dist/server/{Block.shared-D6WrRCxX.mjs → Block.shared-CniF9tSu.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BQzjDQ2q.mjs → ThemeScopeCore-BQWsnGT6.mjs} +126 -120
- package/dist/server/{accessibleSurfaces-CM3QANtw.mjs → accessibleSurfaces-WPzUAHp4.mjs} +33 -2
- package/dist/server/accordions-By_0Ykks.mjs +111 -0
- package/dist/server/{bindings-CS6ih1Yc.mjs → bindings-DxojjtK3.mjs} +7 -7
- package/dist/server/{client-m0ylCj_f.mjs → client-CDndhbYO.mjs} +86 -42
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/constants-VyF5nEhL.mjs +1474 -0
- package/dist/server/{customCss-BZ8YSrQg.mjs → customCss-C9kgPHvr.mjs} +41 -5
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-vgWMz1uD.mjs → loadContent-BKstMBmX.mjs} +5 -4
- package/dist/server/{loadPage-CIOL3-9t.mjs → loadPage-IgNnZaqr.mjs} +3 -3
- package/dist/server/{lookMediaFrame-m-91jGGn.mjs → lookMediaFrame-TFjgNG61.mjs} +38 -18
- package/dist/server/manifest.mjs +36 -25
- package/dist/server/{mapLocation-BM5WX7FY.mjs → mapLocation-MDDSubTp.mjs} +1 -1
- package/dist/server/media-BRmYrnzb.mjs +31 -0
- package/dist/server/{media-luf7RF22.mjs → media-gvfIw3z8.mjs} +2 -31
- package/dist/server/{navigation-BcNfYYuu.mjs → navigation-quBYlSKD.mjs} +2 -2
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +134 -81
- package/dist/server/{overrideResolution-BiHmsvTZ.mjs → overrideResolution-CCaAPpIa.mjs} +1 -1
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/{pageRenderPlan-DJo_obpi.mjs → pageRenderPlan-B7iULvKe.mjs} +8 -7
- package/dist/server/{pageRuntimeSupport-BnSuoHON.mjs → pageRuntimeSupport-BytMroxn.mjs} +5 -5
- package/dist/server/{pageShared-BJuOzxzn.mjs → pageShared-Dcs_XTIO.mjs} +243 -323
- package/dist/server/{parseThemeForPersistence-DOsfofCy.mjs → parseThemeForPersistence-Bihl4W5K.mjs} +3 -2
- package/dist/server/{portal-B4JVkdjc.mjs → portal-CMW_b9mG.mjs} +62 -46
- package/dist/server/portal.mjs +3 -3
- package/dist/server/portalQuestions-oUyohgL9.mjs +225 -0
- package/dist/server/{prebuild-Cr8p8T7V.mjs → prebuild-agaH-vZV.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BZh57-ua.mjs → prefetchBlockData-DwpRjqw4.mjs} +4 -3
- package/dist/server/{registry-CvhFwbXJ.mjs → registry-DM9dHfDC.mjs} +345 -449
- 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 +10 -9
- package/dist/server/{resolveBlockData-Cv_W1LVB.mjs → resolveBlockData-CinHGf8l.mjs} +2 -2
- package/dist/server/{resolveButtonColourStates--6yJp9Tq.mjs → resolveButtonColourStates-B0O1IM16.mjs} +2 -1028
- package/dist/server/{responseMedia-KRKguBC5.mjs → responseMedia-IfH65QAH.mjs} +1 -1
- package/dist/server/{schema-BpsqaSSU.mjs → schema-CwfxQjc4.mjs} +10 -113
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-CRKbTm_7.mjs → servicePageContent-BBBhOtdE.mjs} +21 -20
- package/dist/server/theme-bridge.mjs +3 -2
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-39SXCCnh.mjs → three-pass-converter-DPaUPTfl.mjs} +34 -16
- package/dist/server/titleSourceSchema-NhK6azFS.mjs +2018 -0
- package/dist/server/typeGuards-CTW_9AXq.mjs +413 -0
- package/dist/server/types-BKaBZFjD.mjs +1085 -0
- package/dist/server/{validation-DCl-FCk_.mjs → validation-DG5jX3jH.mjs} +70 -17
- package/dist/server/{version-DT_R5JAR.mjs → version-CipbxPHL.mjs} +1 -1
- package/dist/server/video-Cdr3wh-q.mjs +272 -0
- package/dist/styles/index.css +1013 -1840
- package/package.json +2 -1
- package/dist/_dts/index-B0_2-65A.d.ts +0 -101
- package/dist/client/TabBarFragment-DlKQRhP4.mjs +0 -56
- package/dist/client/checkoutRoute-DKlZRNZD.mjs +0 -22
- package/dist/client/creditProducts-BQ1t1erI.mjs +0 -266
- package/dist/client/formatDate-hhI1-tzt.mjs +0 -26
- package/dist/server/constants-Cj7hfbrA.mjs +0 -41
- package/dist/server/richTextSchema-QLaQrbII.mjs +0 -212
- package/dist/server/titleSourceSchema-Cu-3PRvv.mjs +0 -122
package/dist/client/{EventRegistrationPayment-DiD9uYs6.mjs → EventRegistrationPayment-DSqCJL8E.mjs}
RENAMED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import { m as ok, p as err } from "./renderableMediaAssetAdmission-BsOWd9lf.mjs";
|
|
3
|
+
import { An as formatCurrencyAmount, St as roomChoicesSchema, dn as inferSiteDateLocale, t as assertNever, wn as resolveBookingBusinessTimeZone, xt as reviewedRoomsSchema } from "./src-ZSqRK3dD.mjs";
|
|
4
|
+
import { $a as PAGE_NAVIGATION, $n as serverPricedTotalCents, $t as toWholeSeriesRegistrationEvents, A as ownCoverPaysEveryDate, Ar as normalizeTicketSelectionLines, As as eventRegistrationErrors, At as resolveEventRequiresPayment, Bt as defaultTicketOptions, C as currentSelectionFundingLookup, Cn as primarySelectionItem, Cr as withRegistrationAvailability, Ct as beginWaitlistInvitation, D as fundingOptionPick, Ds as decideSelectionAttendance, Dt as buildRegistrationSelectionRequest, E as fundingOptionKey, Et as withOfferedEvent, F as selectionFundingRequest, Ft as validateFormData, G as planRegistrationDetailsContinuation, Gn as combinationHintCopy, Gs as resolveWholeSeriesBookingPhase, Gt as selectRoomOffer, H as getTicketSelectionPurpose, Hn as severalRunsChoiceMessage, Ht as presentRoomChooser, I as buildEventRegistrationPaymentOptionsViewModel, J as resolveRegistrationAdmission, Jn as combinationWorking, Kt as isSameWaitlistClaim, L as buildSelectionCollectionOptions, Lt as bookingLines, M as selectionFundingBasis, Ms as parseEventRegistrationErrorReason, Mt as resolveRouteRequiresPayment, N as selectionFundingFetchWanted, Nn as selectionIncludes, Ns as EVENT_CHECKOUT_HOLD_DURATION_MS, Nt as toRegistrationRequestSubject, O as initialSelectionFundingLookup, P as selectionFundingReducer, Pn as selectionItemPrice, Ps as planCheckoutPaymentFlow, Pt as registrationQuestionsMessage, Q as visitorHoldsOwnPlace, Qn as selectionPreviewLines, R as decideEventRegistrationPayment, Rs as getStripeMinimumChargeRequirement, Rt as dayOptionsOf, S as chosenFundingOption, Sn as planSelectionPrice, Sr as shouldLoadRegistrationOptions, St as entryStart, T as fundingMoneyDates, Tr as getSingleSelectedPricingOptionId, Tt as invitationBooking, Un as summariseSelectionPayment, Ut as roomChoiceMessage, Vn as severalItemsOf, Vt as isRoomChoiceRefusal, W as planRegistrationDetailsCheck, Wn as toggleSelectionItem, Wr as appliedDiscountHint, Ws as orderedLiveRunSessions, Wt as roomSubmission, X as resolveRegistrationTicketContinuation, Xn as selectionCombinationHint, Xt as getRegistrationStartAt, Yn as paymentCaption, Ys as resolveBookingSignupOffer, Zr as formatCommercePrice, Zt as toRegistrationEvents, _ as pickCollections, _i as resolveEventRegistrationScopedEvents, _r as getSlidingScaleForEvent, _t as bookingOccurrenceContext, a as registrationPresentation, an as buildSelectionRequirementsSubmission, b as selectionPaysNothing, bn as effectiveSelection, br as parseCurrencyInputToCents, bt as entryPageEvent, cn as deriveRunRequirements, cr as getPortalSubjectEmail, ct as calculateEventRegistrationPreviewTotal, d as decideEventChoice, da as needsBookingQuestionsRefresh, di as closedDatesCopy, dn as runsKeepingAnswers, dt as paymentChoiceDetails, en as EVENT_SIGN_IN_FORM_ID, er as findSelectedTicketType, f as isRegistrationLocked, fi as closedRunCopy, fn as toRunRequirementsSnapshots, fr as transformRegistrationOptionsResponse, ft as paymentChoicePrice, g as paymentOptionFor, ga as formatPrice, gi as resolveEventRegistrationChoices, gr as getRegistrationOccurrenceId, gt as restorableBrowserDraftCode, h as moneyCollections, hn as ATTENDANCE_CHOICE_MESSAGE, hr as getCurrentTicketSelection, ht as registrationBrowserDraftSchema, i as registrationPaymentRoute, in as toEventSignInDraft, j as selectionDatesQuote, js as eventRegistrationRefusalMessage, jt as resolveRegistrationTarget, k as lookupChosenOption, ki as groupPublicEventsByRun, kr as hasValidPricingOptionSelection, ks as eventRegistrationErrorEndsCommand, kt as resolveDiscountContext, lc as publicEventPricingCurrency, ln as nextRunToRead, m as collectionsOf, ma as toBookingQuestionsPaymentSnapshot, mn as paymentReturnRestoration, mt as registrationBrowserDraft, nn as eventSignInEnds, nt as resolveEventRegistrationSubmitPlan, o as registrationRoute, on as checkRunRequirements, p as registrationFlowReducer, pi as closedDateCopy, pn as withoutKeptAnswers, q as resolveGuestNextStepCheck, qn as combinationOffersOf, qt as toWaitlistClaimResolveFailure, rn as eventSignInRestoration, ro as requestSignIn, sn as decideSelectionRequirementsLayout, sr as getImplicitSingleTicketType, tn as eventSignInDraftStore, to as leavePage, tr as formatBookingWhen, u as createInitialRegistrationFlowState, ua as deriveBookingQuestions, un as runFieldErrors, ur as getVisibleTicketTypes, v as runsSelectionPaymentRequest, vn as attendanceChoicePending, vr as getSlidingScaleSelectionMessage, vt as decideRegistrationEntry, w as fundingChoice, wn as quoteReductions, wt as invitationSubmission, x as cardStepServesDates, xn as incompleteRunChoiceMessage, xr as resolveHeldTicketPlaces, xt as entrySelectionMode, y as selectionItemLabels, yn as canToggleSelectionItem, yr as getTicketSelectionRemainingPlaces, yt as entryChoosesEvent, zn as selectionTicketInputs, zt as decideRoomStay } from "./wizardSteps-BliJOzEX.mjs";
|
|
5
|
+
import { i as portalPath } from "./portalRoutes-D72yvtDh.mjs";
|
|
6
|
+
import { c as checkBookingQuestionsAnswered } from "./bookingCalendar--aWnqFDn.mjs";
|
|
7
|
+
import { i as useSiteTermsAgreement, r as siteTermsFailureKind } from "./SiteTermsAgreementField-B4z-e4Wq.mjs";
|
|
7
8
|
import { t as generateUuidV4 } from "./uuid-BETKW8rS.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { i as BlockApiError, n as useBlockApi } from "./context-
|
|
10
|
-
import { n as EVENT_REGISTRATION_CHECKOUT_ATTEMPT_PARAM, r as paidInFullNote, t as EVENT_REGISTRATION_ANCHOR_ID } from "./constants-
|
|
9
|
+
import { s as indefiniteArticle } from "./BookingQuestionFields-CyNIKw6k.mjs";
|
|
10
|
+
import { i as BlockApiError, n as useBlockApi } from "./context-CRhn9qzS.mjs";
|
|
11
|
+
import { n as EVENT_REGISTRATION_CHECKOUT_ATTEMPT_PARAM, r as paidInFullNote, t as EVENT_REGISTRATION_ANCHOR_ID } from "./constants-CoOkvw__.mjs";
|
|
11
12
|
import { t as resolveDedicatedBookingHref } from "./bookingRoute-D6DlxYx6.mjs";
|
|
12
|
-
import { i as discountEmailProblem } from "./DemoBookingPortalAccess-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import { s as storeDemoBookingPass
|
|
13
|
+
import { i as discountEmailProblem } from "./DemoBookingPortalAccess-DFLPyuqe.mjs";
|
|
14
|
+
import { c as parseBookingSubmissionFailure, d as useSignInReturn, f as useBookingQuestionsRefresh, l as useBookingNowIso, s as usePolling, u as portalSessionIdentity } from "./BookingMailingListNote-uWfR2kaG.mjs";
|
|
15
|
+
import { t as useDiscountCodeUi } from "./useDiscountCodeUi-klgfGn7f.mjs";
|
|
16
|
+
import { s as storeDemoBookingPass } from "./demoPortalMagicLink-CWDGSTBu.mjs";
|
|
16
17
|
import { Suspense, lazy, useCallback, useEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
17
18
|
import { jsx } from "react/jsx-runtime";
|
|
18
19
|
import { z } from "zod";
|
|
@@ -244,238 +245,6 @@ function planEventRegistrationSurface(input) {
|
|
|
244
245
|
} : { kind: "unavailableWholeSeries" };
|
|
245
246
|
}
|
|
246
247
|
//#endregion
|
|
247
|
-
//#region ../blocks/src/system/runtime/nodes/event-registration/useSelectionFunding.state.ts
|
|
248
|
-
/**
|
|
249
|
-
* How the dates are paid, one date or several (issue 1767, sets 6 and 7). The server
|
|
250
|
-
* plans every option, its order and the one to select; the block keeps which one
|
|
251
|
-
* the visitor picked and sends that option back with the split it showed.
|
|
252
|
-
*/
|
|
253
|
-
/** The pass or membership an entitlement option uses, as the server names it on submit. */
|
|
254
|
-
function entitlementSource(entitlement) {
|
|
255
|
-
switch (entitlement.kind) {
|
|
256
|
-
case "ownedPass": return {
|
|
257
|
-
kind: "ownedPass",
|
|
258
|
-
passId: entitlement.passId
|
|
259
|
-
};
|
|
260
|
-
case "ownedMembership": return {
|
|
261
|
-
kind: "ownedMembership",
|
|
262
|
-
membershipId: entitlement.membershipId
|
|
263
|
-
};
|
|
264
|
-
case "buyPass": return {
|
|
265
|
-
kind: "buyPass",
|
|
266
|
-
productId: entitlement.productId
|
|
267
|
-
};
|
|
268
|
-
case "buyMembership": return {
|
|
269
|
-
kind: "buyMembership",
|
|
270
|
-
productId: entitlement.productId
|
|
271
|
-
};
|
|
272
|
-
default: return assertNever(entitlement);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
function sourceKey(source) {
|
|
276
|
-
switch (source.kind) {
|
|
277
|
-
case "ownedPass": return `ownedPass:${source.passId}`;
|
|
278
|
-
case "ownedMembership": return `ownedMembership:${source.membershipId}`;
|
|
279
|
-
case "buyPass": return `buyPass:${source.productId}`;
|
|
280
|
-
case "buyMembership": return `buyMembership:${source.productId}`;
|
|
281
|
-
default: return assertNever(source);
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
/** One key per option, so a pick survives a refetch that still offers it. */
|
|
285
|
-
function fundingPickKey(pick) {
|
|
286
|
-
switch (pick.kind) {
|
|
287
|
-
case "money": return "money";
|
|
288
|
-
case "entitlement": return sourceKey(pick.source);
|
|
289
|
-
default: return assertNever(pick);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function fundingOptionPick(option) {
|
|
293
|
-
switch (option.kind) {
|
|
294
|
-
case "money": return { kind: "money" };
|
|
295
|
-
case "entitlement": return {
|
|
296
|
-
kind: "entitlement",
|
|
297
|
-
source: entitlementSource(option.entitlement)
|
|
298
|
-
};
|
|
299
|
-
default: return assertNever(option);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
function fundingOptionKey(option) {
|
|
303
|
-
return fundingPickKey(fundingOptionPick(option));
|
|
304
|
-
}
|
|
305
|
-
function findOption(funding, pick) {
|
|
306
|
-
const key = fundingPickKey(pick);
|
|
307
|
-
return funding.options.find((option) => fundingOptionKey(option) === key);
|
|
308
|
-
}
|
|
309
|
-
/** The picked option, or the server's own selection when the pick isn't offered. */
|
|
310
|
-
function chosenFundingOption(funding, pick) {
|
|
311
|
-
return findOption(funding, pick) ?? findOption(funding, funding.selected) ?? funding.options[0];
|
|
312
|
-
}
|
|
313
|
-
/** The dates the option charges money for, earliest first. */
|
|
314
|
-
function fundingMoneyDates(option) {
|
|
315
|
-
switch (option.kind) {
|
|
316
|
-
case "money": return option.moneyDates;
|
|
317
|
-
case "entitlement": return option.uncovered.map((date) => date.occurrenceId);
|
|
318
|
-
default: return assertNever(option);
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
/** What submit sends: the option's source and the split the visitor saw. */
|
|
322
|
-
function fundingChoice(option) {
|
|
323
|
-
switch (option.kind) {
|
|
324
|
-
case "money": return { kind: "money" };
|
|
325
|
-
case "entitlement": return {
|
|
326
|
-
kind: "entitlement",
|
|
327
|
-
source: entitlementSource(option.entitlement),
|
|
328
|
-
expected: {
|
|
329
|
-
covered: [...option.covered],
|
|
330
|
-
moneyDates: [...fundingMoneyDates(option)]
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
default: return assertNever(option);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
/**
|
|
337
|
-
* The options request for the dates of one event, one date or several; null
|
|
338
|
-
* for anything else, which keeps its own payment step. A waitlist claim asks the
|
|
339
|
-
* same way: the claim admits the held place, and the funding pays for it.
|
|
340
|
-
*/
|
|
341
|
-
function selectionFundingRequest(input) {
|
|
342
|
-
const selection = input.target?.selection;
|
|
343
|
-
if (selection?.kind !== "dates") return null;
|
|
344
|
-
const eventSeriesId = datesSeries(selection, input.eventSeriesId);
|
|
345
|
-
const lines = normalizeTicketSelectionLines(input.ticketSelections);
|
|
346
|
-
if (!eventSeriesId || lines.length === 0) return null;
|
|
347
|
-
return {
|
|
348
|
-
subject: {
|
|
349
|
-
kind: "dates",
|
|
350
|
-
eventSeriesId,
|
|
351
|
-
occurrenceIds: selection.occurrenceIds,
|
|
352
|
-
...input.attendanceMode ? { attendanceMode: input.attendanceMode } : {}
|
|
353
|
-
},
|
|
354
|
-
selections: lines.map(({ pricingOptionId, quantity }) => ({
|
|
355
|
-
pricingOptionId,
|
|
356
|
-
quantity
|
|
357
|
-
})),
|
|
358
|
-
...input.selectedSlidingAmount !== null ? { selectedSlidingAmount: input.selectedSlidingAmount } : {}
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
/** Several dates name their series; one date's comes from the event being booked. */
|
|
362
|
-
function datesSeries(selection, eventSeriesId) {
|
|
363
|
-
return selection.eventSeriesId ?? (selection.occurrenceIds.length === 1 ? eventSeriesId : null);
|
|
364
|
-
}
|
|
365
|
-
/**
|
|
366
|
-
* What the quote prices for the dates: nothing while the ways to pay are on their way or when the
|
|
367
|
-
* visitor's own pass or membership covers every date, and otherwise the chosen option's whole order,
|
|
368
|
-
* which the server funds and prices itself. Null for anything that isn't dates. One date paid with
|
|
369
|
-
* money keeps its own booking's quote, so its card options, deposits and automatic discount stay
|
|
370
|
-
* as they are, and it waits for nothing.
|
|
371
|
-
*/
|
|
372
|
-
function selectionDatesQuote(lookup, request) {
|
|
373
|
-
if (request === null) return null;
|
|
374
|
-
const oneDate = request.subject.occurrenceIds.length === 1;
|
|
375
|
-
switch (lookup.tag) {
|
|
376
|
-
case "idle": return null;
|
|
377
|
-
case "loading":
|
|
378
|
-
case "failed": return oneDate ? null : { kind: "waiting" };
|
|
379
|
-
case "loaded": {
|
|
380
|
-
const option = chosenFundingOption(lookup.funding, lookup.pick);
|
|
381
|
-
if (oneDate && option.kind === "money") return null;
|
|
382
|
-
return ownCoverPaysEveryDate(option) ? { kind: "nothingToPay" } : {
|
|
383
|
-
kind: "order",
|
|
384
|
-
selection: {
|
|
385
|
-
...request,
|
|
386
|
-
funding: fundingChoice(option)
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
default: return assertNever(lookup);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
/** A pass or membership the visitor already has, covering every date: submit books them with no order. */
|
|
394
|
-
function ownCoverPaysEveryDate(option) {
|
|
395
|
-
if (option.kind === "money" || option.uncovered.length > 0) return false;
|
|
396
|
-
switch (option.entitlement.kind) {
|
|
397
|
-
case "ownedPass":
|
|
398
|
-
case "ownedMembership": return true;
|
|
399
|
-
case "buyPass":
|
|
400
|
-
case "buyMembership": return false;
|
|
401
|
-
default: return assertNever(option.entitlement);
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
/**
|
|
405
|
-
* One date with nothing but money to offer, no note and no change to explain keeps
|
|
406
|
-
* the card step it always had; anything else shows the ways to pay.
|
|
407
|
-
*/
|
|
408
|
-
function cardStepServesDates(lookup, dateCount) {
|
|
409
|
-
if (dateCount !== 1 || lookup.tag !== "loaded" || lookup.notice !== null) return false;
|
|
410
|
-
const { options, entitlementNote } = lookup.funding;
|
|
411
|
-
return options.length === 1 && options[0].kind === "money" && entitlementNote === "none";
|
|
412
|
-
}
|
|
413
|
-
/** The option the visitor has chosen, once the options are in. */
|
|
414
|
-
function lookupChosenOption(lookup) {
|
|
415
|
-
return lookup.tag === "loaded" ? chosenFundingOption(lookup.funding, lookup.pick) : null;
|
|
416
|
-
}
|
|
417
|
-
/** What the visitor is looking at now, for a quote or submit to say which options it was about. */
|
|
418
|
-
function selectionFundingBasis(lookup) {
|
|
419
|
-
return lookup.tag === "loaded" ? {
|
|
420
|
-
requestKey: lookup.requestKey,
|
|
421
|
-
pickKey: fundingPickKey(lookup.pick)
|
|
422
|
-
} : null;
|
|
423
|
-
}
|
|
424
|
-
const initialSelectionFundingLookup = { tag: "idle" };
|
|
425
|
-
function settles(state, requestKey) {
|
|
426
|
-
return state.tag === "loading" && state.requestKey === requestKey;
|
|
427
|
-
}
|
|
428
|
-
function stillCurrent(state, basis) {
|
|
429
|
-
const now = selectionFundingBasis(state);
|
|
430
|
-
return now !== null && basis !== null && now.requestKey === basis.requestKey && now.pickKey === basis.pickKey;
|
|
431
|
-
}
|
|
432
|
-
function selectionFundingReducer(state, action) {
|
|
433
|
-
switch (action.type) {
|
|
434
|
-
case "loading": return {
|
|
435
|
-
tag: "loading",
|
|
436
|
-
requestKey: action.requestKey
|
|
437
|
-
};
|
|
438
|
-
case "loaded": return settles(state, action.requestKey) ? {
|
|
439
|
-
tag: "loaded",
|
|
440
|
-
requestKey: action.requestKey,
|
|
441
|
-
funding: action.funding,
|
|
442
|
-
pick: action.funding.selected,
|
|
443
|
-
notice: null
|
|
444
|
-
} : state;
|
|
445
|
-
case "failed": return settles(state, action.requestKey) ? {
|
|
446
|
-
tag: "failed",
|
|
447
|
-
requestKey: action.requestKey
|
|
448
|
-
} : state;
|
|
449
|
-
case "picked": return state.tag === "loaded" && findOption(state.funding, action.pick) ? {
|
|
450
|
-
...state,
|
|
451
|
-
pick: action.pick,
|
|
452
|
-
notice: null
|
|
453
|
-
} : state;
|
|
454
|
-
case "changed": return stillCurrent(state, action.basis) ? {
|
|
455
|
-
tag: "loaded",
|
|
456
|
-
requestKey: state.requestKey,
|
|
457
|
-
funding: action.funding,
|
|
458
|
-
pick: action.funding.selected,
|
|
459
|
-
notice: action.message
|
|
460
|
-
} : state;
|
|
461
|
-
case "reset": return initialSelectionFundingLookup;
|
|
462
|
-
default: return assertNever(action);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
/** The lookup for this request: another request's answer, or none yet, is still loading. */
|
|
466
|
-
function currentSelectionFundingLookup(state, requestKey) {
|
|
467
|
-
if (requestKey === null) return initialSelectionFundingLookup;
|
|
468
|
-
if (state.tag !== "idle" && state.requestKey === requestKey) return state;
|
|
469
|
-
return {
|
|
470
|
-
tag: "loading",
|
|
471
|
-
requestKey
|
|
472
|
-
};
|
|
473
|
-
}
|
|
474
|
-
/** Whether the hook should ask the server now. */
|
|
475
|
-
function selectionFundingFetchWanted(state, requestKey, enabled) {
|
|
476
|
-
return enabled && requestKey !== null && (state.tag === "idle" || state.requestKey !== requestKey);
|
|
477
|
-
}
|
|
478
|
-
//#endregion
|
|
479
248
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountView.state.ts
|
|
480
249
|
/** The quote owns the code for one booking or several; one booking still finds out what's on offer from availability. */
|
|
481
250
|
function registrationDiscountView(input) {
|
|
@@ -502,12 +271,13 @@ function registrationDiscountView(input) {
|
|
|
502
271
|
};
|
|
503
272
|
}
|
|
504
273
|
/** A draft code must remain editable while its price is unresolved and payment choices are disabled. */
|
|
505
|
-
function registrationDiscountEntryVisible(view
|
|
506
|
-
return
|
|
274
|
+
function registrationDiscountEntryVisible(view) {
|
|
275
|
+
return view.manualCodeEntryAllowed || view.editingCode;
|
|
507
276
|
}
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
277
|
+
function registrationDiscountAccess(method, funding) {
|
|
278
|
+
if (method === "membership") return "notOffered";
|
|
279
|
+
if (funding.tag !== "loaded") return "card";
|
|
280
|
+
return chosenFundingOption(funding.funding, funding.pick).kind === "money" ? "card" : "notOffered";
|
|
511
281
|
}
|
|
512
282
|
//#endregion
|
|
513
283
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountCode.state.ts
|
|
@@ -582,25 +352,29 @@ function resolveRegistrationRecoveryAction(step, action) {
|
|
|
582
352
|
if (step === "verifying-payment" || step === "verifying-timeout" || step === "payment") return "none";
|
|
583
353
|
return action;
|
|
584
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* After the details check refuses the booker (an earlier unpaid booking of theirs stands, or it couldn't be
|
|
357
|
+
* found safely), Try again returns to their details so continuing runs the check again. Not 'retry', which
|
|
358
|
+
* goes straight to payment and is for a refused submission. Not 'places', which on a full event swaps the
|
|
359
|
+
* message for the waitlist offer.
|
|
360
|
+
*/
|
|
361
|
+
const DETAILS_CHECK_REFUSAL_RECOVERY = "details";
|
|
585
362
|
function shouldRefreshAfterRegistrationError(step, action, enabled) {
|
|
586
363
|
return enabled || step === "error" && action === "places";
|
|
587
364
|
}
|
|
365
|
+
/** A fresh booking where this page's bookings start; the reset owns the start item's own defaults. */
|
|
588
366
|
function resetRegistrationAfterExpiry(input) {
|
|
589
367
|
input.dispatchFlow({
|
|
590
368
|
type: "reset",
|
|
591
|
-
|
|
369
|
+
start: input.start
|
|
592
370
|
});
|
|
593
|
-
input.setSelectedTicketLines([]);
|
|
594
|
-
input.setSelectedSlidingAmountInput("");
|
|
595
|
-
const mode = input.preSelectedEvent?.deliveryMode;
|
|
596
|
-
input.setSelectedAttendanceMode(mode === "online" || mode === "in_person" ? mode : null);
|
|
597
371
|
input.setErrorMessage("");
|
|
598
372
|
}
|
|
599
373
|
/** Retry the retained submission in place; explicit payment uncertainty stays status-only. */
|
|
600
374
|
function recoverRegistrationError(action, handlers, navigation) {
|
|
601
375
|
switch (action) {
|
|
602
376
|
case "none": return { kind: "navigated" };
|
|
603
|
-
case "portal": return leavePage(
|
|
377
|
+
case "portal": return leavePage(portalPath({ page: "bookings" }), navigation);
|
|
604
378
|
case "event": return leavePage(window.location.pathname, navigation);
|
|
605
379
|
case "retry":
|
|
606
380
|
handlers.clearError();
|
|
@@ -679,7 +453,7 @@ function receiveHandOff(outcome, receive) {
|
|
|
679
453
|
}
|
|
680
454
|
//#endregion
|
|
681
455
|
//#region ../blocks/src/system/runtime/nodes/event-registration/sessionStorage.ts
|
|
682
|
-
const STORAGE_PREFIX = "riverbank:event-registration:";
|
|
456
|
+
const STORAGE_PREFIX$1 = "riverbank:event-registration:";
|
|
683
457
|
const STALE_THRESHOLD_MS = 1440 * 60 * 1e3;
|
|
684
458
|
const browserDraftEntry = z.object({
|
|
685
459
|
version: z.literal(1),
|
|
@@ -787,7 +561,7 @@ const version6Schema = z.object({
|
|
|
787
561
|
}));
|
|
788
562
|
const schema = z.union([currentSchema, version6Schema]);
|
|
789
563
|
function key(siteId, submissionId) {
|
|
790
|
-
return `${STORAGE_PREFIX}${siteId}:${submissionId}`;
|
|
564
|
+
return `${STORAGE_PREFIX$1}${siteId}:${submissionId}`;
|
|
791
565
|
}
|
|
792
566
|
function savePendingRegistration(siteId, submissionId, data) {
|
|
793
567
|
try {
|
|
@@ -821,7 +595,7 @@ function clearPendingRegistration(siteId, submissionId) {
|
|
|
821
595
|
}
|
|
822
596
|
function cleanupStaleRegistrations() {
|
|
823
597
|
try {
|
|
824
|
-
Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)).filter((item) => item !== null && item.startsWith(STORAGE_PREFIX)).forEach((item) => {
|
|
598
|
+
Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)).filter((item) => item !== null && item.startsWith(STORAGE_PREFIX$1)).forEach((item) => {
|
|
825
599
|
try {
|
|
826
600
|
const parsed = z.safeParse(schema, JSON.parse(sessionStorage.getItem(item) ?? "null"));
|
|
827
601
|
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) sessionStorage.removeItem(item);
|
|
@@ -1327,7 +1101,8 @@ function eligibilityLookupReducer(state, action) {
|
|
|
1327
1101
|
tag: "failed",
|
|
1328
1102
|
eligibility: null,
|
|
1329
1103
|
settledRequestKey: action.requestKey,
|
|
1330
|
-
error: action.message
|
|
1104
|
+
error: action.message,
|
|
1105
|
+
closed: action.closed
|
|
1331
1106
|
};
|
|
1332
1107
|
default: return assertNever(action);
|
|
1333
1108
|
}
|
|
@@ -1347,6 +1122,10 @@ function existingRegistrationLookupReducer(state, action) {
|
|
|
1347
1122
|
tag: "resolved",
|
|
1348
1123
|
registrations: action.registrations
|
|
1349
1124
|
};
|
|
1125
|
+
case "failed": return {
|
|
1126
|
+
tag: "failed",
|
|
1127
|
+
registrations: []
|
|
1128
|
+
};
|
|
1350
1129
|
default: return assertNever(action);
|
|
1351
1130
|
}
|
|
1352
1131
|
}
|
|
@@ -1376,27 +1155,28 @@ function usePortalAuthWithDeps(deps) {
|
|
|
1376
1155
|
useEffect(() => {
|
|
1377
1156
|
let cancelled = false;
|
|
1378
1157
|
async function checkPortalAuth() {
|
|
1379
|
-
|
|
1158
|
+
const visitor = api.portalVisitor;
|
|
1159
|
+
if (!visitor) {
|
|
1380
1160
|
setAuthState("unauthenticated");
|
|
1381
1161
|
setProfile(null);
|
|
1382
1162
|
return;
|
|
1383
1163
|
}
|
|
1384
1164
|
setAuthState("checking");
|
|
1385
1165
|
setProfile(null);
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
setProfile({
|
|
1390
|
-
email: me.profile.email,
|
|
1391
|
-
name: me.profile.name,
|
|
1392
|
-
phone: me.profile.phone || ""
|
|
1393
|
-
});
|
|
1394
|
-
setAuthState("authenticated");
|
|
1395
|
-
} catch {
|
|
1396
|
-
if (cancelled) return;
|
|
1166
|
+
const result = await visitor.profile();
|
|
1167
|
+
if (cancelled) return;
|
|
1168
|
+
if (!result.ok) {
|
|
1397
1169
|
setAuthState("unauthenticated");
|
|
1398
1170
|
setProfile(null);
|
|
1171
|
+
return;
|
|
1399
1172
|
}
|
|
1173
|
+
const { profile: me } = result.value;
|
|
1174
|
+
setProfile({
|
|
1175
|
+
email: me.email,
|
|
1176
|
+
name: me.name,
|
|
1177
|
+
phone: me.phone || ""
|
|
1178
|
+
});
|
|
1179
|
+
setAuthState("authenticated");
|
|
1400
1180
|
}
|
|
1401
1181
|
checkPortalAuth();
|
|
1402
1182
|
return () => {
|
|
@@ -1458,15 +1238,25 @@ async function loadEligibility(input) {
|
|
|
1458
1238
|
eligibility: transformRegistrationOptionsResponse(result),
|
|
1459
1239
|
requestKey: input.requestKey
|
|
1460
1240
|
});
|
|
1461
|
-
} catch {
|
|
1241
|
+
} catch (error) {
|
|
1462
1242
|
if (!input.isCurrent()) return;
|
|
1463
|
-
input.dispatch({
|
|
1243
|
+
input.dispatch(isBookingsClosedRefusal(error) ? {
|
|
1244
|
+
type: "failed",
|
|
1245
|
+
requestKey: input.requestKey,
|
|
1246
|
+
closed: true,
|
|
1247
|
+
message: "Bookings for this event have closed."
|
|
1248
|
+
} : {
|
|
1464
1249
|
type: "failed",
|
|
1465
1250
|
requestKey: input.requestKey,
|
|
1251
|
+
closed: false,
|
|
1466
1252
|
message: "We couldn’t load the booking options for this event. Try again, or contact the organiser if this keeps happening."
|
|
1467
1253
|
});
|
|
1468
1254
|
}
|
|
1469
1255
|
}
|
|
1256
|
+
/** The options route tags a refusal from an event that has stopped taking bookings. */
|
|
1257
|
+
function isBookingsClosedRefusal(error) {
|
|
1258
|
+
return error instanceof BlockApiError && error.tag === "REGISTRATION_OPTIONS_CLOSED";
|
|
1259
|
+
}
|
|
1470
1260
|
function useEligibilityWithDeps(params, deps) {
|
|
1471
1261
|
const api = deps.useBlockApi();
|
|
1472
1262
|
const request = eligibilityRequest(params);
|
|
@@ -1513,6 +1303,7 @@ function useEligibilityWithDeps(params, deps) {
|
|
|
1513
1303
|
requestKey,
|
|
1514
1304
|
isLoading: effectiveState.tag === "loading",
|
|
1515
1305
|
error: effectiveState.error,
|
|
1306
|
+
bookingsClosed: effectiveState.tag === "failed" && effectiveState.closed,
|
|
1516
1307
|
creditState: registrationOptionsCreditState(effectiveState, params.subjectEmail)
|
|
1517
1308
|
};
|
|
1518
1309
|
}
|
|
@@ -1533,13 +1324,10 @@ function registrationOptionsCreditState(state, subjectEmail) {
|
|
|
1533
1324
|
credit: state.eligibility.credit ?? null
|
|
1534
1325
|
};
|
|
1535
1326
|
}
|
|
1536
|
-
function useExistingEventRegistration(
|
|
1537
|
-
return useExistingEventRegistrationWithDeps(
|
|
1538
|
-
isAuthenticated,
|
|
1539
|
-
occurrenceId
|
|
1540
|
-
}, eventRegistrationHooksDeps);
|
|
1327
|
+
function useExistingEventRegistration(params) {
|
|
1328
|
+
return useExistingEventRegistrationWithDeps(params, eventRegistrationHooksDeps);
|
|
1541
1329
|
}
|
|
1542
|
-
function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId }, deps) {
|
|
1330
|
+
function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId, completedBookings }, deps) {
|
|
1543
1331
|
const api = deps.useBlockApi();
|
|
1544
1332
|
const [state, dispatch] = useReducer(existingRegistrationLookupReducer, initialExistingRegistrationLookupState);
|
|
1545
1333
|
const requestIdRef = useRef(0);
|
|
@@ -1551,23 +1339,20 @@ function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId },
|
|
|
1551
1339
|
dispatch({ type: "reset" });
|
|
1552
1340
|
return;
|
|
1553
1341
|
}
|
|
1342
|
+
const visitor = api.portalVisitor;
|
|
1554
1343
|
const requestId = requestIdRef.current + 1;
|
|
1555
1344
|
requestIdRef.current = requestId;
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
if (cancelled || requestIdRef.current !== requestId) return;
|
|
1560
|
-
dispatch({
|
|
1561
|
-
type: "resolved",
|
|
1562
|
-
registrations: events.filter((event) => event.occurrenceId === occurrenceId && event.status !== "cancelled" && event.transferState !== "transferred_out")
|
|
1563
|
-
});
|
|
1564
|
-
} catch {
|
|
1565
|
-
if (cancelled || requestIdRef.current !== requestId) return;
|
|
1566
|
-
dispatch({
|
|
1567
|
-
type: "resolved",
|
|
1568
|
-
registrations: []
|
|
1569
|
-
});
|
|
1345
|
+
if (!visitor) {
|
|
1346
|
+
dispatch({ type: "reset" });
|
|
1347
|
+
return;
|
|
1570
1348
|
}
|
|
1349
|
+
dispatch({ type: "loading-started" });
|
|
1350
|
+
const result = await visitor.occurrenceBookings(occurrenceId);
|
|
1351
|
+
if (cancelled || requestIdRef.current !== requestId) return;
|
|
1352
|
+
dispatch(result.ok ? {
|
|
1353
|
+
type: "resolved",
|
|
1354
|
+
registrations: result.value
|
|
1355
|
+
} : { type: "failed" });
|
|
1571
1356
|
}
|
|
1572
1357
|
fetchExistingRegistration();
|
|
1573
1358
|
return () => {
|
|
@@ -1576,7 +1361,8 @@ function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId },
|
|
|
1576
1361
|
}, [
|
|
1577
1362
|
api,
|
|
1578
1363
|
isAuthenticated,
|
|
1579
|
-
occurrenceId
|
|
1364
|
+
occurrenceId,
|
|
1365
|
+
completedBookings
|
|
1580
1366
|
]);
|
|
1581
1367
|
return {
|
|
1582
1368
|
state,
|
|
@@ -1709,6 +1495,69 @@ function useEventRegistrationStripeReturn(options) {
|
|
|
1709
1495
|
}, [options]);
|
|
1710
1496
|
}
|
|
1711
1497
|
//#endregion
|
|
1498
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/pendingCheckouts.ts
|
|
1499
|
+
const STORAGE_PREFIX = "riverbank:event-pending-checkouts:";
|
|
1500
|
+
const storedSchema = z.object({
|
|
1501
|
+
version: z.literal(1),
|
|
1502
|
+
checkouts: z.array(z.object({
|
|
1503
|
+
id: z.string().min(1),
|
|
1504
|
+
expiresAt: z.number().finite()
|
|
1505
|
+
}))
|
|
1506
|
+
});
|
|
1507
|
+
/** Pure: the checkouts still held at `now`, newest first, cut to what a request may name. */
|
|
1508
|
+
function currentPendingCheckouts(checkouts, now) {
|
|
1509
|
+
return checkouts.filter((checkout) => checkout.expiresAt > now).slice(0, 3);
|
|
1510
|
+
}
|
|
1511
|
+
/** Pure: the list with this checkout newest, holding its places for the hold window from `now`. */
|
|
1512
|
+
function withPendingCheckout(checkouts, commandId, now) {
|
|
1513
|
+
return currentPendingCheckouts([{
|
|
1514
|
+
id: commandId,
|
|
1515
|
+
expiresAt: now + EVENT_CHECKOUT_HOLD_DURATION_MS
|
|
1516
|
+
}, ...checkouts.filter((checkout) => checkout.id !== commandId)], now);
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* The store over one browser storage. `storage` is read on every use and may throw, as may anything
|
|
1520
|
+
* it returns; every access is wrapped, so a failure reads as an empty list and a write is dropped.
|
|
1521
|
+
*/
|
|
1522
|
+
function createPendingCheckoutStore(storage, clock = Date.now) {
|
|
1523
|
+
const key = (siteId) => `${STORAGE_PREFIX}${siteId}`;
|
|
1524
|
+
const read = (siteId) => {
|
|
1525
|
+
try {
|
|
1526
|
+
const stored = storage().getItem(key(siteId));
|
|
1527
|
+
const parsed = storedSchema.safeParse(stored ? JSON.parse(stored) : null);
|
|
1528
|
+
return parsed.success ? parsed.data.checkouts : [];
|
|
1529
|
+
} catch {
|
|
1530
|
+
return [];
|
|
1531
|
+
}
|
|
1532
|
+
};
|
|
1533
|
+
const write = (siteId, checkouts) => {
|
|
1534
|
+
try {
|
|
1535
|
+
if (checkouts.length === 0) storage().removeItem(key(siteId));
|
|
1536
|
+
else storage().setItem(key(siteId), JSON.stringify({
|
|
1537
|
+
version: 1,
|
|
1538
|
+
checkouts
|
|
1539
|
+
}));
|
|
1540
|
+
} catch {}
|
|
1541
|
+
};
|
|
1542
|
+
return {
|
|
1543
|
+
remember: (siteId, commandId) => {
|
|
1544
|
+
if (siteId) write(siteId, withPendingCheckout(read(siteId), commandId, clock()));
|
|
1545
|
+
},
|
|
1546
|
+
forget: (siteId, commandId) => {
|
|
1547
|
+
if (siteId) write(siteId, currentPendingCheckouts(read(siteId).filter((checkout) => checkout.id !== commandId), clock()));
|
|
1548
|
+
},
|
|
1549
|
+
ids: (siteId) => {
|
|
1550
|
+
if (!siteId) return [];
|
|
1551
|
+
const stored = read(siteId);
|
|
1552
|
+
const current = currentPendingCheckouts(stored, clock());
|
|
1553
|
+
if (current.length !== stored.length) write(siteId, current);
|
|
1554
|
+
return current.map((checkout) => checkout.id);
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
/** This browser's list, shared by every tab on the site's origin. */
|
|
1559
|
+
const browserPendingCheckouts = createPendingCheckoutStore(() => window.localStorage);
|
|
1560
|
+
//#endregion
|
|
1712
1561
|
//#region ../blocks/src/system/runtime/nodes/event-registration/paymentLocation.ts
|
|
1713
1562
|
function eventPaymentReturnUrl(submissionId) {
|
|
1714
1563
|
const url = new URL(window.location.href);
|
|
@@ -1718,24 +1567,43 @@ function eventPaymentReturnUrl(submissionId) {
|
|
|
1718
1567
|
url.hash = EVENT_REGISTRATION_ANCHOR_ID;
|
|
1719
1568
|
return url.toString();
|
|
1720
1569
|
}
|
|
1721
|
-
|
|
1570
|
+
/**
|
|
1571
|
+
* A checkout has reached payment. The tab's address carries it, so a reload or a return from the
|
|
1572
|
+
* bank finds it, and the browser's list carries it too, so a booking made in another tab can name it.
|
|
1573
|
+
*/
|
|
1574
|
+
function rememberEventPayment(siteId, submissionId, sessionId) {
|
|
1722
1575
|
const url = new URL(eventPaymentReturnUrl(submissionId));
|
|
1723
1576
|
url.searchParams.set("session_id", sessionId);
|
|
1724
1577
|
window.history.replaceState(window.history.state, "", url);
|
|
1578
|
+
browserPendingCheckouts.remember(siteId, submissionId);
|
|
1725
1579
|
}
|
|
1726
|
-
|
|
1580
|
+
/**
|
|
1581
|
+
* The tab has left that payment. `place` says what became of the booking: `finished` when it was paid,
|
|
1582
|
+
* abandoned or its places released, so the browser's list drops it; `held` when its places still
|
|
1583
|
+
* stand and the visitor is booking again, so another tab can still take it over.
|
|
1584
|
+
*/
|
|
1585
|
+
function clearEventPayment(siteId, place) {
|
|
1727
1586
|
const url = new URL(window.location.href);
|
|
1728
1587
|
const submissionId = url.searchParams.get(EVENT_REGISTRATION_CHECKOUT_ATTEMPT_PARAM);
|
|
1729
1588
|
if (siteId && submissionId) clearPendingRegistration(siteId, submissionId);
|
|
1589
|
+
if (submissionId && place === "finished") browserPendingCheckouts.forget(siteId, submissionId);
|
|
1730
1590
|
url.searchParams.delete("registration");
|
|
1731
1591
|
url.searchParams.delete(EVENT_REGISTRATION_CHECKOUT_ATTEMPT_PARAM);
|
|
1732
1592
|
url.searchParams.delete("session_id");
|
|
1733
1593
|
window.history.replaceState(window.history.state, "", url);
|
|
1734
1594
|
}
|
|
1735
1595
|
//#endregion
|
|
1596
|
+
//#region ../blocks/src/system/runtime/api/serverRefusal.ts
|
|
1597
|
+
/**
|
|
1598
|
+
* The server answered and refused the request (a 4xx), so nothing was written
|
|
1599
|
+
* and its message is meant for the person. A 5xx, no answer at all, or a 2xx
|
|
1600
|
+
* whose body couldn't be read leaves the outcome unknown.
|
|
1601
|
+
*/
|
|
1602
|
+
function isServerRefusal(error) {
|
|
1603
|
+
return error instanceof BlockApiError && error.status >= 400 && error.status < 500;
|
|
1604
|
+
}
|
|
1605
|
+
//#endregion
|
|
1736
1606
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorPresentation.ts
|
|
1737
|
-
/** The tag the server gives a refused booking request, with a message meant for the booker. */
|
|
1738
|
-
const REFUSED_INPUT_TAG = "REGISTRATION_INVALID_INPUT";
|
|
1739
1607
|
/**
|
|
1740
1608
|
* Public-site admission refusals: the site isn't open for online bookings.
|
|
1741
1609
|
* The booker's details were fine, so these never ask them to check them.
|
|
@@ -1749,15 +1617,14 @@ function parseEventRegistrationFailure(error) {
|
|
|
1749
1617
|
...parseBookingSubmissionFailure(error, "Something went wrong. Please try again."),
|
|
1750
1618
|
reason: !(error instanceof BlockApiError) ? null : siteUnavailable(error) ? "siteNotTakingBookings" : parseEventRegistrationErrorReason(error.tag),
|
|
1751
1619
|
siteTermsFailure: siteTermsFailureKind(error),
|
|
1752
|
-
isClientError: error
|
|
1753
|
-
discountRefused: error instanceof BlockApiError && error.fieldErrors.some((field) => field.field === "discountCode")
|
|
1754
|
-
refusedInput: error instanceof BlockApiError && error.tag === REFUSED_INPUT_TAG && error.message.trim().length > 0
|
|
1620
|
+
isClientError: isServerRefusal(error),
|
|
1621
|
+
discountRefused: error instanceof BlockApiError && error.fieldErrors.some((field) => field.field === "discountCode")
|
|
1755
1622
|
};
|
|
1756
1623
|
}
|
|
1757
1624
|
/**
|
|
1758
|
-
* What the booker reads when a booking is refused.
|
|
1759
|
-
*
|
|
1760
|
-
*
|
|
1625
|
+
* What the booker reads when a booking is refused. A known reason says its own message, or the
|
|
1626
|
+
* server's words where `eventRegistrationRefusalMessage` prefers them. A reason the form doesn't
|
|
1627
|
+
* know, as a form built before that reason was added won't, reads as a general refusal.
|
|
1761
1628
|
*/
|
|
1762
1629
|
function registrationErrorPresentation(failure, bookings = "one") {
|
|
1763
1630
|
if (failure.discountRefused) return {
|
|
@@ -1769,17 +1636,14 @@ function registrationErrorPresentation(failure, bookings = "one") {
|
|
|
1769
1636
|
action: "details"
|
|
1770
1637
|
};
|
|
1771
1638
|
const reason = failure.reason;
|
|
1772
|
-
if (reason) {
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
action
|
|
1777
|
-
};
|
|
1778
|
-
}
|
|
1639
|
+
if (reason) return {
|
|
1640
|
+
message: eventRegistrationRefusalMessage(reason, failure.message, bookings),
|
|
1641
|
+
action: eventRegistrationErrors[reason].action
|
|
1642
|
+
};
|
|
1779
1643
|
if (failure.isClientError) {
|
|
1780
1644
|
const { message, action } = eventRegistrationErrors.invalidCommitInput;
|
|
1781
1645
|
return {
|
|
1782
|
-
message
|
|
1646
|
+
message,
|
|
1783
1647
|
action
|
|
1784
1648
|
};
|
|
1785
1649
|
}
|
|
@@ -1810,9 +1674,64 @@ function toEventRunPayment(choice) {
|
|
|
1810
1674
|
function wantsMailingListSignup(options) {
|
|
1811
1675
|
return options.mailingListSignup !== null && options.formData.mailingListOptIn === true;
|
|
1812
1676
|
}
|
|
1677
|
+
/**
|
|
1678
|
+
* The earlier bookings from this browser that a submission may take over from. The server replaces an
|
|
1679
|
+
* unpaid booking only for the browser that can name it, and accepts any one of these that matches.
|
|
1680
|
+
* This is the one place the list is built, from three sources:
|
|
1681
|
+
*
|
|
1682
|
+
* - the booking whose payment the visitor came back from in this tab (`heldPlace`);
|
|
1683
|
+
* - the command a changed form left behind, and whatever that command named;
|
|
1684
|
+
* - the checkouts this browser took to payment in any tab (`browserCheckouts`, newest first), which
|
|
1685
|
+
* is how a new tab names a booking whose own tab was closed.
|
|
1686
|
+
*
|
|
1687
|
+
* It's a list because the form can't tell which of them holds the place. A refused command reserved
|
|
1688
|
+
* nothing, so the booking it was to replace still stands; a command whose response was lost may have
|
|
1689
|
+
* reserved. Every id is derived here, so nothing has to be remembered or forgotten as attempts fail.
|
|
1690
|
+
*
|
|
1691
|
+
* The order decides what survives the cut to what the server accepts. The held place leads, since the
|
|
1692
|
+
* server has said it stands. The command just left behind comes next, as the only one that may hold a
|
|
1693
|
+
* place nobody was told about. Then the browser's checkouts, which did reach payment, and last the
|
|
1694
|
+
* older guesses. An identical retry sends what it sent before.
|
|
1695
|
+
*/
|
|
1696
|
+
function replacedCommandIds(previous, intentChanged, heldPlace, browserCheckouts) {
|
|
1697
|
+
const held = heldPlace ? [heldPlace.submissionId] : [];
|
|
1698
|
+
const earlier = previous === null ? browserCheckouts : intentChanged ? [
|
|
1699
|
+
previous.id,
|
|
1700
|
+
...browserCheckouts,
|
|
1701
|
+
...previous.replaces
|
|
1702
|
+
] : [...previous.replaces, ...browserCheckouts];
|
|
1703
|
+
return [.../* @__PURE__ */ new Set([...held, ...earlier])].slice(0, 3);
|
|
1704
|
+
}
|
|
1705
|
+
/**
|
|
1706
|
+
* The earlier bookings this browser can name before it submits, the command it last sent among them, as
|
|
1707
|
+
* a changed submission would name them. The guest details check sends these, so the answer it gets
|
|
1708
|
+
* (go on to pay, or an earlier booking stands) is the one submitting would give.
|
|
1709
|
+
*/
|
|
1710
|
+
function earlierBookingsToName(previous, heldPlace, browserCheckouts) {
|
|
1711
|
+
return replacedCommandIds(previous, true, heldPlace, browserCheckouts);
|
|
1712
|
+
}
|
|
1713
|
+
/** The command this submission runs under: the same one for an identical retry, a new one once the details change. */
|
|
1714
|
+
function nextCommand(previous, submitted, earlier, createId) {
|
|
1715
|
+
const intentChanged = previous !== null && previous.intentKey !== submitted.intentKey;
|
|
1716
|
+
const id = intentChanged ? createId() : submitted.id;
|
|
1717
|
+
return {
|
|
1718
|
+
id,
|
|
1719
|
+
intentKey: submitted.intentKey,
|
|
1720
|
+
replaces: replacedCommandIds(previous, intentChanged, earlier.heldPlace, earlier.browserCheckouts).filter((named) => named !== id)
|
|
1721
|
+
};
|
|
1722
|
+
}
|
|
1723
|
+
/** The request under its command, naming the earlier bookings it may take over from when there are any. */
|
|
1724
|
+
function commandRequest(request, command) {
|
|
1725
|
+
return {
|
|
1726
|
+
...request,
|
|
1727
|
+
registrationCommandId: command.id,
|
|
1728
|
+
...command.replaces.length > 0 ? { replacesRegistrationCommandIds: command.replaces } : {}
|
|
1729
|
+
};
|
|
1730
|
+
}
|
|
1813
1731
|
const eventRegistrationSubmitDeps = {
|
|
1814
1732
|
savePendingRegistration,
|
|
1815
|
-
createClientCommandId: generateUuidV4
|
|
1733
|
+
createClientCommandId: generateUuidV4,
|
|
1734
|
+
pendingCheckouts: browserPendingCheckouts
|
|
1816
1735
|
};
|
|
1817
1736
|
function useEventRegistrationSubmit(options) {
|
|
1818
1737
|
return useEventRegistrationSubmitWithDeps(options, eventRegistrationSubmitDeps);
|
|
@@ -1872,19 +1791,19 @@ function useEventRegistrationSubmitWithDeps(options, deps) {
|
|
|
1872
1791
|
try {
|
|
1873
1792
|
const initialPrepared = prepareSubmitContext(options, registrationCommandId, target, method, membershipId, selection);
|
|
1874
1793
|
const intentKey = registrationRequestIntentKey(buildRegistrationRequest(options, initialPrepared, invitation, method, membershipId));
|
|
1875
|
-
const
|
|
1876
|
-
|
|
1877
|
-
registrationCommandId: deps.createClientCommandId()
|
|
1878
|
-
} : initialPrepared;
|
|
1879
|
-
const request = buildRegistrationRequest(options, prepared, invitation, method, membershipId);
|
|
1880
|
-
commandRef.current = {
|
|
1881
|
-
id: prepared.registrationCommandId,
|
|
1794
|
+
const command = nextCommand(commandRef.current, {
|
|
1795
|
+
id: registrationCommandId,
|
|
1882
1796
|
intentKey
|
|
1797
|
+
}, {
|
|
1798
|
+
heldPlace: options.heldPlace,
|
|
1799
|
+
browserCheckouts: deps.pendingCheckouts.ids(options.api.config.siteId)
|
|
1800
|
+
}, deps.createClientCommandId);
|
|
1801
|
+
const prepared = {
|
|
1802
|
+
...initialPrepared,
|
|
1803
|
+
registrationCommandId: command.id
|
|
1883
1804
|
};
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
registrationCommandId: prepared.registrationCommandId
|
|
1887
|
-
}));
|
|
1805
|
+
commandRef.current = command;
|
|
1806
|
+
return await completeRegistrationSubmission(options, deps, prepared, await options.api.registerForEvent(commandRequest(buildRegistrationRequest(options, prepared, invitation, method, membershipId), command)));
|
|
1888
1807
|
} catch (error) {
|
|
1889
1808
|
if (error instanceof BlockApiError && (eventRegistrationErrorEndsCommand(error.tag) || error.fieldErrors.some((field) => field.field === "discountCode"))) commandRef.current = null;
|
|
1890
1809
|
return reportFailedRegistration(options, error);
|
|
@@ -1915,6 +1834,7 @@ async function completeRegistrationSubmission(options, deps, prepared, result) {
|
|
|
1915
1834
|
outcome: { kind: "payment_status" }
|
|
1916
1835
|
};
|
|
1917
1836
|
case "checkoutRequired":
|
|
1837
|
+
forgetReplacedBooking(options, deps);
|
|
1918
1838
|
savePendingCheckout(options, deps, prepared, result.submissionId, result.mailingListSignupNote);
|
|
1919
1839
|
const subject = result.reference.scope === "occurrence" ? {
|
|
1920
1840
|
scope: "occurrence",
|
|
@@ -1953,6 +1873,7 @@ async function completeRegistrationSubmission(options, deps, prepared, result) {
|
|
|
1953
1873
|
message: result.message
|
|
1954
1874
|
};
|
|
1955
1875
|
case "bookingComplete":
|
|
1876
|
+
forgetReplacedBooking(options, deps);
|
|
1956
1877
|
options.complete(confirmedRegistration(result));
|
|
1957
1878
|
break;
|
|
1958
1879
|
default: return assertNever(result);
|
|
@@ -1964,6 +1885,14 @@ async function completeRegistrationSubmission(options, deps, prepared, result) {
|
|
|
1964
1885
|
};
|
|
1965
1886
|
}
|
|
1966
1887
|
/**
|
|
1888
|
+
* The server took this booking, so the one the visitor came back from has been replaced and the
|
|
1889
|
+
* browser's list drops it. An id the list supplied from another tab stays until its hold runs out:
|
|
1890
|
+
* it may belong to a different event, and the response doesn't say which bookings were replaced.
|
|
1891
|
+
*/
|
|
1892
|
+
function forgetReplacedBooking(options, deps) {
|
|
1893
|
+
if (options.heldPlace) deps.pendingCheckouts.forget(options.api.config.siteId, options.heldPlace.submissionId);
|
|
1894
|
+
}
|
|
1895
|
+
/**
|
|
1967
1896
|
* A completed booking as the finished screen reads it. One booking says its pass balance in the
|
|
1968
1897
|
* summary's message; several list it with how each date was paid, so the message would repeat it.
|
|
1969
1898
|
*/
|
|
@@ -2529,7 +2458,8 @@ const SELECTION_FUNDING_LOAD_FAILED = "We couldn’t load the ways to pay for th
|
|
|
2529
2458
|
const ONE_DATE_FUNDING_LOAD_FAILED = "We couldn’t load the ways to pay for this date. Try again, or refresh the page.";
|
|
2530
2459
|
/**
|
|
2531
2460
|
* The server's ways to pay for the dates, one or several, fetched when the
|
|
2532
|
-
*
|
|
2461
|
+
* wizard wants them: one date on its payment step, several once their tickets
|
|
2462
|
+
* are chosen. The key carries the dates, places and who's signed in, so any
|
|
2533
2463
|
* change asks again and the pick goes back to the server's default.
|
|
2534
2464
|
*/
|
|
2535
2465
|
function useSelectionFunding(input) {
|
|
@@ -2542,10 +2472,15 @@ function useSelectionFunding(input) {
|
|
|
2542
2472
|
type: "loading",
|
|
2543
2473
|
requestKey
|
|
2544
2474
|
});
|
|
2545
|
-
input.
|
|
2475
|
+
const severalDates = input.request.subject.occurrenceIds.length > 1;
|
|
2476
|
+
input.api.getSelectionFunding(input.request).then((response) => dispatch(severalDates && !response.payment ? {
|
|
2477
|
+
type: "failed",
|
|
2478
|
+
requestKey
|
|
2479
|
+
} : {
|
|
2546
2480
|
type: "loaded",
|
|
2547
2481
|
requestKey,
|
|
2548
|
-
funding: response.funding
|
|
2482
|
+
funding: response.funding,
|
|
2483
|
+
payment: response.payment ?? null
|
|
2549
2484
|
}), () => dispatch({
|
|
2550
2485
|
type: "failed",
|
|
2551
2486
|
requestKey
|
|
@@ -2569,6 +2504,75 @@ function useSelectionFunding(input) {
|
|
|
2569
2504
|
};
|
|
2570
2505
|
}
|
|
2571
2506
|
//#endregion
|
|
2507
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useRunsSelectionPayment.state.ts
|
|
2508
|
+
/**
|
|
2509
|
+
* The runs read's lookup: which request is being asked, and the answer it got.
|
|
2510
|
+
* Dates get their answer with their funding (useSelectionFunding.state).
|
|
2511
|
+
*/
|
|
2512
|
+
const RUNS_PAYMENT_LOAD_FAILED = "We couldn’t load the ways to pay for these runs. Refresh the page to try again.";
|
|
2513
|
+
const IDLE_SELECTION_PAYMENT = { tag: "idle" };
|
|
2514
|
+
/** An answer settles only the request it was sent for. */
|
|
2515
|
+
function selectionPaymentLookupReducer(state, action) {
|
|
2516
|
+
const settles = state.tag === "loading" && state.requestKey === action.requestKey;
|
|
2517
|
+
switch (action.type) {
|
|
2518
|
+
case "loading": return {
|
|
2519
|
+
tag: "loading",
|
|
2520
|
+
requestKey: action.requestKey
|
|
2521
|
+
};
|
|
2522
|
+
case "loaded": return settles ? {
|
|
2523
|
+
tag: "loaded",
|
|
2524
|
+
requestKey: action.requestKey,
|
|
2525
|
+
payment: action.payment
|
|
2526
|
+
} : state;
|
|
2527
|
+
case "failed": return settles ? {
|
|
2528
|
+
tag: "failed",
|
|
2529
|
+
requestKey: action.requestKey
|
|
2530
|
+
} : state;
|
|
2531
|
+
default: return assertNever(action);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
/** The lookup for this request: another request's answer, or none yet, is still loading. */
|
|
2535
|
+
function currentSelectionPaymentLookup(state, requestKey) {
|
|
2536
|
+
if (requestKey === null) return IDLE_SELECTION_PAYMENT;
|
|
2537
|
+
if (state.tag !== "idle" && state.requestKey === requestKey) return state;
|
|
2538
|
+
return {
|
|
2539
|
+
tag: "loading",
|
|
2540
|
+
requestKey
|
|
2541
|
+
};
|
|
2542
|
+
}
|
|
2543
|
+
/** Whether the hook should ask the server now. */
|
|
2544
|
+
function selectionPaymentFetchWanted(state, requestKey, enabled) {
|
|
2545
|
+
return enabled && requestKey !== null && (state.tag === "idle" || state.requestKey !== requestKey);
|
|
2546
|
+
}
|
|
2547
|
+
//#endregion
|
|
2548
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useRunsSelectionPayment.ts
|
|
2549
|
+
/**
|
|
2550
|
+
* How several runs can be paid, from the server, asked once the runs and
|
|
2551
|
+
* their tickets are chosen. The key carries the runs, tickets, places and who's
|
|
2552
|
+
* signed in, so any change asks again. Dates get theirs with their funding.
|
|
2553
|
+
*/
|
|
2554
|
+
function useRunsSelectionPayment(input) {
|
|
2555
|
+
const requestKey = input.request ? JSON.stringify([input.request, input.identity]) : null;
|
|
2556
|
+
const [state, dispatch] = useReducer(selectionPaymentLookupReducer, IDLE_SELECTION_PAYMENT);
|
|
2557
|
+
const wanted = selectionPaymentFetchWanted(state, requestKey, input.enabled);
|
|
2558
|
+
useEffect(() => {
|
|
2559
|
+
if (!wanted || requestKey === null || input.request === null) return;
|
|
2560
|
+
dispatch({
|
|
2561
|
+
type: "loading",
|
|
2562
|
+
requestKey
|
|
2563
|
+
});
|
|
2564
|
+
input.api.getRunsSelectionPayment(input.request).then((response) => dispatch({
|
|
2565
|
+
type: "loaded",
|
|
2566
|
+
requestKey,
|
|
2567
|
+
payment: response.payment
|
|
2568
|
+
}), () => dispatch({
|
|
2569
|
+
type: "failed",
|
|
2570
|
+
requestKey
|
|
2571
|
+
}));
|
|
2572
|
+
}, [wanted, requestKey]);
|
|
2573
|
+
return input.enabled || state.tag !== "idle" ? currentSelectionPaymentLookup(state, requestKey) : IDLE_SELECTION_PAYMENT;
|
|
2574
|
+
}
|
|
2575
|
+
//#endregion
|
|
2572
2576
|
//#region ../blocks/src/system/runtime/nodes/event-registration/selectionFundingView.ts
|
|
2573
2577
|
const SEVERAL_PLACES_ENTITLEMENT_NOTE = "Class passes and memberships can be used when you book one place on each date.";
|
|
2574
2578
|
const ONE_DATE_SEVERAL_PLACES_ENTITLEMENT_NOTE = "Class passes and memberships can be used when you book one place.";
|
|
@@ -2579,9 +2583,23 @@ function orderPrice(option, chosen, input) {
|
|
|
2579
2583
|
discountCents: 0
|
|
2580
2584
|
};
|
|
2581
2585
|
}
|
|
2582
|
-
/**
|
|
2583
|
-
|
|
2586
|
+
/**
|
|
2587
|
+
* The server's price for the option's order, with account credit taken off the whole of it, as checkout takes it.
|
|
2588
|
+
* Paid directly, nothing is taken online: the whole order is owed to the business.
|
|
2589
|
+
*/
|
|
2590
|
+
function decideCharge(option, order, input, collection) {
|
|
2584
2591
|
const moneyDateCount = fundingMoneyDates(option).length;
|
|
2592
|
+
if (collection === "deferred_manual") {
|
|
2593
|
+
const remainder = moneyDateCount === 0 ? "none" : order.totalCents === 0 ? "free" : "direct";
|
|
2594
|
+
return {
|
|
2595
|
+
moneyDateCount,
|
|
2596
|
+
boughtCents: boughtPriceCents(option),
|
|
2597
|
+
creditCents: 0,
|
|
2598
|
+
cardCents: 0,
|
|
2599
|
+
directCents: order.totalCents,
|
|
2600
|
+
remainder
|
|
2601
|
+
};
|
|
2602
|
+
}
|
|
2585
2603
|
const creditCents = planCheckoutPaymentFlow({
|
|
2586
2604
|
amountDueCents: order.totalCents,
|
|
2587
2605
|
discountCents: order.discountCents,
|
|
@@ -2596,6 +2614,7 @@ function decideCharge(option, order, input) {
|
|
|
2596
2614
|
boughtCents: boughtPriceCents(option),
|
|
2597
2615
|
creditCents,
|
|
2598
2616
|
cardCents,
|
|
2617
|
+
directCents: 0,
|
|
2599
2618
|
remainder
|
|
2600
2619
|
};
|
|
2601
2620
|
}
|
|
@@ -2625,7 +2644,14 @@ function theOther(count) {
|
|
|
2625
2644
|
}
|
|
2626
2645
|
/** Card wording only when a card is really charged. */
|
|
2627
2646
|
function payer(charge) {
|
|
2628
|
-
|
|
2647
|
+
switch (charge.remainder) {
|
|
2648
|
+
case "card": return "Card pays for";
|
|
2649
|
+
case "direct": return "You pay the business directly for";
|
|
2650
|
+
case "none":
|
|
2651
|
+
case "credit":
|
|
2652
|
+
case "free": return "You pay for";
|
|
2653
|
+
default: return assertNever(charge.remainder);
|
|
2654
|
+
}
|
|
2629
2655
|
}
|
|
2630
2656
|
/** Why a date isn't covered, under the date. */
|
|
2631
2657
|
const UNCOVERED_REASON_COPY = {
|
|
@@ -2640,6 +2666,7 @@ function partTitle(facts) {
|
|
|
2640
2666
|
case "none":
|
|
2641
2667
|
case "free": return facts.name;
|
|
2642
2668
|
case "card": return `${facts.name} and card`;
|
|
2669
|
+
case "direct": return `${facts.name} and pay the rest directly`;
|
|
2643
2670
|
case "credit": return `${facts.name} and account credit`;
|
|
2644
2671
|
default: return assertNever(facts.charge.remainder);
|
|
2645
2672
|
}
|
|
@@ -2661,6 +2688,17 @@ function boughtPassShortfall(facts) {
|
|
|
2661
2688
|
}
|
|
2662
2689
|
}
|
|
2663
2690
|
const membershipRenewal = (facts) => `${facts.boughtPrice ?? ""} a ${facts.interval ?? "month"}, renews ${facts.interval === "year" ? "yearly" : "monthly"}.`;
|
|
2691
|
+
/** The option's price when money is owed: today's card payment, or "£24.00 due" to the business. */
|
|
2692
|
+
function remainderPrice(facts) {
|
|
2693
|
+
switch (facts.charge.remainder) {
|
|
2694
|
+
case "card": return facts.toPay;
|
|
2695
|
+
case "direct": return `${facts.toPayDirectly} due`;
|
|
2696
|
+
case "none":
|
|
2697
|
+
case "credit":
|
|
2698
|
+
case "free": return null;
|
|
2699
|
+
default: return assertNever(facts.charge.remainder);
|
|
2700
|
+
}
|
|
2701
|
+
}
|
|
2664
2702
|
const passCredits = (facts) => `${facts.covered} pass ${facts.covered === 1 ? "credit" : "credits"}`;
|
|
2665
2703
|
/** Each kind's words. A new kind of pass or membership won't compile until it has its own. */
|
|
2666
2704
|
const ENTITLEMENT_COPY = {
|
|
@@ -2669,11 +2707,12 @@ const ENTITLEMENT_COPY = {
|
|
|
2669
2707
|
countsCredits: true,
|
|
2670
2708
|
title: partTitle,
|
|
2671
2709
|
detail: (facts) => facts.moneyDates === 0 ? `${credits(facts.creditsBefore ?? 0)} left, ${facts.creditsLeftAfter ?? 0} after this booking` : ownedPassShortfall(facts),
|
|
2672
|
-
price: (facts) => facts
|
|
2710
|
+
price: (facts) => remainderPrice(facts) ?? credits(facts.covered),
|
|
2673
2711
|
button: (facts) => {
|
|
2674
2712
|
switch (facts.charge.remainder) {
|
|
2675
2713
|
case "none": return `Book using ${passCredits(facts)}`;
|
|
2676
2714
|
case "card": return `Use ${passCredits(facts)} and pay ${facts.toPay}`;
|
|
2715
|
+
case "direct":
|
|
2677
2716
|
case "credit":
|
|
2678
2717
|
case "free": return `Use ${passCredits(facts)} and book`;
|
|
2679
2718
|
default: return assertNever(facts.charge.remainder);
|
|
@@ -2686,7 +2725,7 @@ const ENTITLEMENT_COPY = {
|
|
|
2686
2725
|
countsCredits: false,
|
|
2687
2726
|
title: partTitle,
|
|
2688
2727
|
detail: (facts) => facts.moneyDates === 0 ? facts.dateCount === 1 ? "Your membership covers this date" : `Your membership covers all ${facts.dateCount} dates` : `Your membership covers ${facts.covered} of these dates. ${payer(facts.charge)} ${theOther(facts.moneyDates)}.`,
|
|
2689
|
-
price: (facts) => facts
|
|
2728
|
+
price: (facts) => remainderPrice(facts) ?? "Included",
|
|
2690
2729
|
button: (facts) => facts.charge.remainder === "card" ? `Pay ${facts.toPay}` : facts.dateCount === 1 ? "Book your place" : "Book your places",
|
|
2691
2730
|
boughtLine: () => null
|
|
2692
2731
|
},
|
|
@@ -2773,6 +2812,7 @@ function optionFacts(option, charge, input) {
|
|
|
2773
2812
|
coveredDays: daysOf(option.covered, input.dates),
|
|
2774
2813
|
moneyDays: daysOf(fundingMoneyDates(option), input.dates),
|
|
2775
2814
|
toPay: formatPrice(charge.cardCents, input.currency),
|
|
2815
|
+
toPayDirectly: formatPrice(charge.directCents, input.currency),
|
|
2776
2816
|
charge
|
|
2777
2817
|
};
|
|
2778
2818
|
}
|
|
@@ -2794,17 +2834,21 @@ function optionRows(option, chosenKey, input) {
|
|
|
2794
2834
|
}));
|
|
2795
2835
|
}
|
|
2796
2836
|
case "entitlement": {
|
|
2797
|
-
const facts = optionFacts(option, decideCharge(option, orderPrice(option, selected, input), input), input);
|
|
2798
2837
|
const copy = ENTITLEMENT_COPY[option.entitlement.kind];
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2838
|
+
const ways = input.collectionsOf(pick);
|
|
2839
|
+
const chosenWay = collectionShown(ways, input.chosenCollection);
|
|
2840
|
+
return (ways.length > 1 ? ways : [chosenWay]).map((way) => {
|
|
2841
|
+
const facts = optionFacts(option, decideCharge(option, orderPrice(option, selected, input), input, way), input);
|
|
2842
|
+
return {
|
|
2843
|
+
key: ways.length > 1 ? `${key}:${way ?? ""}` : key,
|
|
2844
|
+
pick,
|
|
2845
|
+
card: ways.length > 1 ? way : null,
|
|
2846
|
+
selected: selected && way === chosenWay,
|
|
2847
|
+
label: copy.title(facts),
|
|
2848
|
+
details: [copy.detail(facts)],
|
|
2849
|
+
price: copy.price(facts)
|
|
2850
|
+
};
|
|
2851
|
+
});
|
|
2808
2852
|
}
|
|
2809
2853
|
default: return assertNever(option);
|
|
2810
2854
|
}
|
|
@@ -2828,8 +2872,12 @@ function dateLines(option, copy, charge, input) {
|
|
|
2828
2872
|
};
|
|
2829
2873
|
});
|
|
2830
2874
|
}
|
|
2831
|
-
|
|
2832
|
-
|
|
2875
|
+
/** The way an option's money is collected: the visitor's choice when the option offers it, otherwise its first. */
|
|
2876
|
+
function collectionShown(ways, chosen) {
|
|
2877
|
+
return chosen !== null && ways.includes(chosen) ? chosen : ways[0] ?? null;
|
|
2878
|
+
}
|
|
2879
|
+
function fundedSummary(option, collection, input) {
|
|
2880
|
+
const charge = decideCharge(option, orderPrice(option, true, input), input, collection);
|
|
2833
2881
|
const facts = optionFacts(option, charge, input);
|
|
2834
2882
|
const copy = ENTITLEMENT_COPY[option.entitlement.kind];
|
|
2835
2883
|
const money = (cents) => formatCurrencyAmount(cents, input.currency);
|
|
@@ -2860,12 +2908,7 @@ function fundedSummary(option, input) {
|
|
|
2860
2908
|
value: `−${money(charge.creditCents)}`,
|
|
2861
2909
|
total: false
|
|
2862
2910
|
}] : [],
|
|
2863
|
-
...owesMoney ? [{
|
|
2864
|
-
key: "to-pay",
|
|
2865
|
-
label: "To pay",
|
|
2866
|
-
value: money(charge.cardCents),
|
|
2867
|
-
total: true
|
|
2868
|
-
}] : copy.countsCredits ? [{
|
|
2911
|
+
...owesMoney ? [toPayTotal(charge, money)] : copy.countsCredits ? [{
|
|
2869
2912
|
key: "credits",
|
|
2870
2913
|
label: "From your pass",
|
|
2871
2914
|
value: credits(facts.covered),
|
|
@@ -2882,6 +2925,20 @@ function fundedSummary(option, input) {
|
|
|
2882
2925
|
copy
|
|
2883
2926
|
};
|
|
2884
2927
|
}
|
|
2928
|
+
/** What's left to pay: today by card, or to the business directly. */
|
|
2929
|
+
function toPayTotal(charge, money) {
|
|
2930
|
+
return charge.remainder === "direct" ? {
|
|
2931
|
+
key: "to-pay",
|
|
2932
|
+
label: "To pay directly",
|
|
2933
|
+
value: money(charge.directCents),
|
|
2934
|
+
total: true
|
|
2935
|
+
} : {
|
|
2936
|
+
key: "to-pay",
|
|
2937
|
+
label: "To pay",
|
|
2938
|
+
value: money(charge.cardCents),
|
|
2939
|
+
total: true
|
|
2940
|
+
};
|
|
2941
|
+
}
|
|
2885
2942
|
/**
|
|
2886
2943
|
* Whether the breakdown says something the chosen option's row and button don't:
|
|
2887
2944
|
* a code, a combination price or account credit coming off. One date shows it
|
|
@@ -2922,15 +2979,18 @@ function presentSelectionFunding(input) {
|
|
|
2922
2979
|
summary: null,
|
|
2923
2980
|
buttonText: null,
|
|
2924
2981
|
cardCents: null,
|
|
2982
|
+
collection: null,
|
|
2925
2983
|
takesPayment: orderPrice(option, true, input).totalCents > 0
|
|
2926
2984
|
};
|
|
2927
2985
|
case "entitlement": {
|
|
2928
|
-
const
|
|
2986
|
+
const collection = collectionShown(input.collectionsOf(fundingOptionPick(option)), input.chosenCollection);
|
|
2987
|
+
const { summary, facts, copy } = fundedSummary(option, collection, input);
|
|
2929
2988
|
return {
|
|
2930
2989
|
...common,
|
|
2931
2990
|
summary,
|
|
2932
2991
|
buttonText: copy.button(facts),
|
|
2933
2992
|
cardCents: facts.charge.cardCents,
|
|
2993
|
+
collection,
|
|
2934
2994
|
takesPayment: facts.charge.cardCents > 0
|
|
2935
2995
|
};
|
|
2936
2996
|
}
|
|
@@ -2974,6 +3034,11 @@ function fundingPaymentStepState(base, lookup, view, priced) {
|
|
|
2974
3034
|
canContinue: false
|
|
2975
3035
|
};
|
|
2976
3036
|
case "loaded":
|
|
3037
|
+
if (lookup.reload !== null) return {
|
|
3038
|
+
...base,
|
|
3039
|
+
status: base.status === "ready" ? "loading" : base.status,
|
|
3040
|
+
canContinue: false
|
|
3041
|
+
};
|
|
2977
3042
|
if (!view || view.buttonText === null) return base;
|
|
2978
3043
|
return {
|
|
2979
3044
|
...base,
|
|
@@ -2987,7 +3052,9 @@ function fundingPaymentStepState(base, lookup, view, priced) {
|
|
|
2987
3052
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useGuestDetailsCheck.ts
|
|
2988
3053
|
/** When a guest completes details on a full event with a waitlist, asks the
|
|
2989
3054
|
* server whether their email has an unfinished booking to pay for instead.
|
|
2990
|
-
*
|
|
3055
|
+
* Only one this browser can name is offered for payment (#1832), so the check
|
|
3056
|
+
* sends the same names a submission would. The answer is navigation only;
|
|
3057
|
+
* submission still owns the booking. */
|
|
2991
3058
|
function useGuestDetailsCheck(input) {
|
|
2992
3059
|
const [checkingNextStep, setCheckingNextStep] = useState(false);
|
|
2993
3060
|
const checkDetailsNextStep = () => checkGuestNextStep(input, guestNextStepRequest(input), setCheckingNextStep);
|
|
@@ -3020,7 +3087,9 @@ async function checkGuestNextStep(input, request, setCheckingNextStep) {
|
|
|
3020
3087
|
}
|
|
3021
3088
|
function guestNextStepRequest(input) {
|
|
3022
3089
|
const buyer = parseParticipantEmail(input.formData.email);
|
|
3023
|
-
|
|
3090
|
+
if (!input.registrationTarget) return null;
|
|
3091
|
+
const earlier = input.earlierBookings();
|
|
3092
|
+
return {
|
|
3024
3093
|
subject: toRegistrationRequestSubject(input.registrationTarget.subject, input.selectedAttendanceMode),
|
|
3025
3094
|
selections: input.ticketSelections,
|
|
3026
3095
|
selectedSlidingAmount: input.selectedSlidingAmount ?? void 0,
|
|
@@ -3029,8 +3098,9 @@ function guestNextStepRequest(input) {
|
|
|
3029
3098
|
kind: "email",
|
|
3030
3099
|
email: buyer.value
|
|
3031
3100
|
} : { kind: "unknown" },
|
|
3032
|
-
purchaseTarget: "eventTickets"
|
|
3033
|
-
|
|
3101
|
+
purchaseTarget: "eventTickets",
|
|
3102
|
+
...earlier.length > 0 ? { replacesRegistrationCommandIds: earlier } : {}
|
|
3103
|
+
};
|
|
3034
3104
|
}
|
|
3035
3105
|
//#endregion
|
|
3036
3106
|
//#region ../blocks/src/system/runtime/nodes/event-registration/paymentResponse.ts
|
|
@@ -3201,7 +3271,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
3201
3271
|
const { setState, note, generation, operation } = runtime;
|
|
3202
3272
|
const openPayment = useCallback((checkout, subject, mailingListSignupNote) => {
|
|
3203
3273
|
if (mailingListSignupNote) note.current = mailingListSignupNote;
|
|
3204
|
-
rememberEventPayment(subject.submissionId, checkout.sessionId);
|
|
3274
|
+
rememberEventPayment(options.api.config.siteId, subject.submissionId, checkout.sessionId);
|
|
3205
3275
|
setState({
|
|
3206
3276
|
kind: "payment",
|
|
3207
3277
|
checkout,
|
|
@@ -3209,6 +3279,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
3209
3279
|
});
|
|
3210
3280
|
options.setStep("payment");
|
|
3211
3281
|
}, [
|
|
3282
|
+
options.api.config.siteId,
|
|
3212
3283
|
options.setStep,
|
|
3213
3284
|
setState,
|
|
3214
3285
|
note
|
|
@@ -3229,7 +3300,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
3229
3300
|
setState
|
|
3230
3301
|
]);
|
|
3231
3302
|
const restartFrom = useCallback((step, heldPlaceRetry) => {
|
|
3232
|
-
clearEventPayment(options.api.config.siteId);
|
|
3303
|
+
clearEventPayment(options.api.config.siteId, heldPlaceRetry ? "held" : "finished");
|
|
3233
3304
|
runtime.setHeldTicketSelection(snapshotHeldTicketSelection(heldPlaceRetry, options.ticketSelection));
|
|
3234
3305
|
setState({
|
|
3235
3306
|
kind: "idle",
|
|
@@ -3251,7 +3322,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
3251
3322
|
...transition.outcomes ? { outcomes: transition.outcomes } : {},
|
|
3252
3323
|
mailingListSignupNote: note.current
|
|
3253
3324
|
});
|
|
3254
|
-
clearEventPayment(options.api.config.siteId);
|
|
3325
|
+
clearEventPayment(options.api.config.siteId, "finished");
|
|
3255
3326
|
setState({
|
|
3256
3327
|
kind: "idle",
|
|
3257
3328
|
heldPlaceRetry: null
|
|
@@ -3499,7 +3570,9 @@ function usePaymentStatusRecovery(options) {
|
|
|
3499
3570
|
if (recovery?.kind === "retryAvailable") transitions.resetBooking(heldPlaceRetry(recovery));
|
|
3500
3571
|
},
|
|
3501
3572
|
/** True while this tab books again on a place the server said is still its own. */
|
|
3502
|
-
retryingHeldPlace: state.kind === "idle" && state.heldPlaceRetry !== null
|
|
3573
|
+
retryingHeldPlace: state.kind === "idle" && state.heldPlaceRetry !== null,
|
|
3574
|
+
/** That booking, which the next submission names so the server lets it take the place over. */
|
|
3575
|
+
heldPlace: state.kind === "idle" ? state.heldPlaceRetry : null
|
|
3503
3576
|
};
|
|
3504
3577
|
}
|
|
3505
3578
|
function heldPlaceRetry(recovery) {
|
|
@@ -3534,22 +3607,16 @@ const eventRegistrationWizardDeps = {
|
|
|
3534
3607
|
*/
|
|
3535
3608
|
function presentWizardStep(facts) {
|
|
3536
3609
|
return registrationPresentation(facts.flow, registrationRoute({
|
|
3537
|
-
chooseEvent:
|
|
3610
|
+
chooseEvent: entryChoosesEvent(facts.entry),
|
|
3538
3611
|
payment: registrationPaymentRoute(facts)
|
|
3539
3612
|
}));
|
|
3540
3613
|
}
|
|
3541
|
-
/** The amount field starts at the suggested price on a sliding-scale event. */
|
|
3542
|
-
function initialSlidingAmountInput(event) {
|
|
3543
|
-
const suggested = getSlidingScaleForEvent(event)?.suggestedAmount;
|
|
3544
|
-
return suggested === null || suggested === void 0 ? "" : formatCentsAsCurrencyInput(suggested);
|
|
3545
|
-
}
|
|
3546
3614
|
function useEventRegistrationWizard(options) {
|
|
3547
3615
|
return useEventRegistrationWizardWithDeps(options, eventRegistrationWizardDeps);
|
|
3548
3616
|
}
|
|
3549
3617
|
const CHOOSER_CLOCK = { kind: "relative" };
|
|
3550
3618
|
/** The wizard owns the step, so it owns whether the clock has stopped this visitor starting a booking. */
|
|
3551
|
-
function useFreshBookingClosure(deps, options, events, step, visitorHoldsPlace) {
|
|
3552
|
-
const recoveryRequest = useEventRegistrationRecoveryRequest();
|
|
3619
|
+
function useFreshBookingClosure(deps, options, events, step, visitorHoldsPlace, recoveryRequest) {
|
|
3553
3620
|
const nextBoundary = useMemo(() => nextFreshBookingBoundary(events, options.occurrenceContext, options.subject), [
|
|
3554
3621
|
events,
|
|
3555
3622
|
options.occurrenceContext,
|
|
@@ -3572,6 +3639,10 @@ function useFreshBookingClosure(deps, options, events, step, visitorHoldsPlace)
|
|
|
3572
3639
|
function holdsPlace(claim, payment) {
|
|
3573
3640
|
return claim.kind !== "none" || payment.retryingHeldPlace;
|
|
3574
3641
|
}
|
|
3642
|
+
/** A hybrid event's places and prices depend on how they'll attend, so nothing is quoted until they've said. */
|
|
3643
|
+
function attendanceAllowsQuote(attendance, selected, wanted) {
|
|
3644
|
+
return wanted && !attendanceChoicePending(attendance, selected);
|
|
3645
|
+
}
|
|
3575
3646
|
/** A date that has closed has nothing to quote for a new booking. */
|
|
3576
3647
|
function bookingClosureAllowsQuote(closure, wanted) {
|
|
3577
3648
|
return closure.kind !== "closedEarly" && closure.kind !== "started" && wanted;
|
|
@@ -3678,15 +3749,27 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3678
3749
|
const arrivalCredential = deps.useWaitlistClaimCredential();
|
|
3679
3750
|
const nowIso = deps.useBookingNowIso(options.now);
|
|
3680
3751
|
const choiceNowIso = deps.useBookingNowIso(options.now, CHOOSER_CLOCK);
|
|
3681
|
-
const { events, registrationEvents, recoveryEvents, scopedEvents, claimEventSource } = useRegistrationEventSource(options, choiceNowIso);
|
|
3682
|
-
const
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3752
|
+
const { events, registrationEvents, recoveryEvents, scopedEvents: pageChoices, claimEventSource } = useRegistrationEventSource(options, choiceNowIso);
|
|
3753
|
+
const arrivedFor = useEventRegistrationRecoveryRequest();
|
|
3754
|
+
const [arrivalFinished, setArrivalFinished] = useState(false);
|
|
3755
|
+
const arrival = arrivalFinished ? "none" : arrivedFor;
|
|
3756
|
+
const entryFor = useCallback((request) => decideRegistrationEntry({
|
|
3757
|
+
events: pageChoices,
|
|
3758
|
+
occurrenceContext: options.occurrenceContext,
|
|
3759
|
+
offer: options.datePageOffer,
|
|
3760
|
+
arrival: request,
|
|
3761
|
+
now: new Date(choiceNowIso)
|
|
3762
|
+
}), [
|
|
3763
|
+
pageChoices,
|
|
3764
|
+
options.occurrenceContext,
|
|
3765
|
+
options.datePageOffer,
|
|
3766
|
+
choiceNowIso
|
|
3767
|
+
]);
|
|
3768
|
+
const entry = useMemo(() => entryFor(arrival), [entryFor, arrival]);
|
|
3769
|
+
const scopedEvents = entry.choices;
|
|
3770
|
+
const preSelectedEvent = entryPageEvent(entry);
|
|
3771
|
+
const [flowState, dispatchFlow] = useReducer(registrationFlowReducer, entryStart(entry), (start) => ({
|
|
3772
|
+
...createInitialRegistrationFlowState(start),
|
|
3690
3773
|
invitation: beginWaitlistInvitation(arrivalCredential)
|
|
3691
3774
|
}));
|
|
3692
3775
|
const [restoredCode, restoreDiscountCode] = useState(null);
|
|
@@ -3704,18 +3787,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3704
3787
|
const paymentIntent = flowState.paymentSelection;
|
|
3705
3788
|
const { selection, runChoices, formData: draftFormData, guests, selectedAttendanceMode, selectedTicketLines, roomChoices, selectedSlidingAmountInput: draftSlidingAmountInput } = flowState.draft;
|
|
3706
3789
|
const selectedEvent = primarySelectionItem(selection);
|
|
3707
|
-
const selectionMode =
|
|
3708
|
-
events: scopedEvents,
|
|
3709
|
-
hasPreSelectedContext
|
|
3710
|
-
});
|
|
3790
|
+
const selectionMode = entrySelectionMode(entry);
|
|
3711
3791
|
const several = severalItemsOf(selection);
|
|
3712
|
-
const setSelection = useCallback((value) => dispatchFlow({
|
|
3713
|
-
type: "draft-edited",
|
|
3714
|
-
edit: {
|
|
3715
|
-
field: "selection",
|
|
3716
|
-
value
|
|
3717
|
-
}
|
|
3718
|
-
}), []);
|
|
3719
3792
|
const setRunChoices = useCallback((value) => dispatchFlow({
|
|
3720
3793
|
type: "draft-edited",
|
|
3721
3794
|
edit: {
|
|
@@ -3816,10 +3889,11 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3816
3889
|
}));
|
|
3817
3890
|
}, [portalAuthState, portalProfile]);
|
|
3818
3891
|
const handleLogout = () => logoutPortal(options.anchorId);
|
|
3892
|
+
const bookingContext = bookingOccurrenceContext(options.occurrenceContext, preSelectedEvent, selection);
|
|
3819
3893
|
const registrationTarget = useMemo(() => resolveRegistrationTarget({
|
|
3820
|
-
occurrenceContext:
|
|
3894
|
+
occurrenceContext: bookingContext,
|
|
3821
3895
|
selection
|
|
3822
|
-
}), [
|
|
3896
|
+
}), [bookingContext, selection]);
|
|
3823
3897
|
const registrationOccurrenceId = getRegistrationOccurrenceId(registrationTarget);
|
|
3824
3898
|
const registrationNavigation = useRegistrationNavigation({
|
|
3825
3899
|
pageNavigation: options.pageNavigation,
|
|
@@ -3883,7 +3957,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3883
3957
|
detailsInPage: () => Object.keys(validateFormData(formData)).length === 0
|
|
3884
3958
|
});
|
|
3885
3959
|
const { recovery: paymentStatusRecovery, showRecovery: setPaymentStatusRecovery, check: handleCheckPaymentStatus, continuePayment: handleContinueExistingPayment, returnToPayment: handleReturnToPayment, returnToBooking: handleReturnToBooking } = paymentController;
|
|
3886
|
-
const bookingClosure = useFreshBookingClosure(deps, options, events, step, holdsPlace(waitlistClaim, paymentController));
|
|
3960
|
+
const bookingClosure = useFreshBookingClosure(deps, options, events, step, holdsPlace(waitlistClaim, paymentController), arrival);
|
|
3887
3961
|
const eligibilityResult = deps.useEligibility({
|
|
3888
3962
|
refreshKey: optionsRefreshKey,
|
|
3889
3963
|
buyerEmail: formData.email,
|
|
@@ -3894,7 +3968,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3894
3968
|
api.config.siteId,
|
|
3895
3969
|
portalIdentity
|
|
3896
3970
|
]),
|
|
3897
|
-
enabled: bookingClosureAllowsQuote(bookingClosure, shouldRefreshAfterRegistrationError(step, errorAction, shouldLoadRegistrationOptions(portalAuthState, step))),
|
|
3971
|
+
enabled: bookingClosureAllowsQuote(bookingClosure, attendanceAllowsQuote(attendance, selectedAttendanceMode, shouldRefreshAfterRegistrationError(step, errorAction, shouldLoadRegistrationOptions(portalAuthState, step)))),
|
|
3898
3972
|
subject: registrationTarget?.subject ?? null,
|
|
3899
3973
|
attendanceMode: selectedAttendanceMode,
|
|
3900
3974
|
ticketSelections: quoteSelections,
|
|
@@ -3904,7 +3978,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3904
3978
|
});
|
|
3905
3979
|
const existingRegistrationResult = deps.useExistingEventRegistration({
|
|
3906
3980
|
isAuthenticated: portalAuthState === "authenticated",
|
|
3907
|
-
occurrenceId: registrationOccurrenceId
|
|
3981
|
+
occurrenceId: registrationOccurrenceId,
|
|
3982
|
+
completedBookings: flowState.completedOutcomes.length
|
|
3908
3983
|
});
|
|
3909
3984
|
const existingRegistrations = useMemo(() => existingRegistrationResult.registrations.filter((registration) => registration.occurrenceId === registrationOccurrenceId), [existingRegistrationResult.registrations, registrationOccurrenceId]);
|
|
3910
3985
|
const registrationOptionsState = eligibilityResult.state;
|
|
@@ -4016,14 +4091,46 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4016
4091
|
selectedAttendanceMode,
|
|
4017
4092
|
usesTicketTypeSelections
|
|
4018
4093
|
]);
|
|
4019
|
-
const
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4094
|
+
const { selectionFunding, datesQuote } = useWizardSelectionFunding({
|
|
4095
|
+
api,
|
|
4096
|
+
target: registrationTarget,
|
|
4097
|
+
event: currentEvent,
|
|
4098
|
+
several,
|
|
4099
|
+
attendanceMode: selectedAttendanceMode,
|
|
4100
|
+
ticketSelections,
|
|
4101
|
+
selectedSlidingAmount,
|
|
4102
|
+
identity: getPortalSubjectEmail(portalProfile),
|
|
4103
|
+
step,
|
|
4104
|
+
portalAuthState
|
|
4023
4105
|
});
|
|
4106
|
+
const runsPayment = useRunsSelectionPayment({
|
|
4107
|
+
api,
|
|
4108
|
+
identity: getPortalSubjectEmail(portalProfile),
|
|
4109
|
+
...runsPaymentAsk({
|
|
4110
|
+
several,
|
|
4111
|
+
step,
|
|
4112
|
+
portalAuthState,
|
|
4113
|
+
selectionChoiceMessage,
|
|
4114
|
+
request: {
|
|
4115
|
+
selection,
|
|
4116
|
+
runChoices,
|
|
4117
|
+
places: ticketsCount,
|
|
4118
|
+
attendanceMode: selectedAttendanceMode
|
|
4119
|
+
}
|
|
4120
|
+
})
|
|
4121
|
+
});
|
|
4122
|
+
const severalAnswer = severalItemsPaymentAnswer(several, selectionFunding.lookup, runsPayment);
|
|
4123
|
+
const selectionPayment = answeredPayment(severalAnswer);
|
|
4124
|
+
useEffect(() => {
|
|
4125
|
+
dispatchFlow({
|
|
4126
|
+
type: "selection-payment-updated",
|
|
4127
|
+
payment: selectionPayment
|
|
4128
|
+
});
|
|
4129
|
+
}, [selectionPayment]);
|
|
4024
4130
|
const admission = resolveRegistrationAdmission({
|
|
4025
4131
|
eligibility,
|
|
4026
4132
|
eligibilityError,
|
|
4133
|
+
bookingsClosed: eligibilityResult.bookingsClosed,
|
|
4027
4134
|
eligibilityLoading,
|
|
4028
4135
|
holdsOwnPlace: visitorHoldsOwnPlace({
|
|
4029
4136
|
hasWaitlistClaim: waitlistClaim.kind === "ready",
|
|
@@ -4031,7 +4138,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4031
4138
|
}),
|
|
4032
4139
|
isAuthenticated: portalAuthState === "authenticated",
|
|
4033
4140
|
businessName: options.siteName,
|
|
4034
|
-
|
|
4141
|
+
selectionPayment
|
|
4035
4142
|
});
|
|
4036
4143
|
const ticketSelectionPurpose = getTicketSelectionPurpose({
|
|
4037
4144
|
admission,
|
|
@@ -4090,7 +4197,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4090
4197
|
setGuestSectionShake(false);
|
|
4091
4198
|
};
|
|
4092
4199
|
const eventRequiresPayment = useMemo(() => {
|
|
4093
|
-
if (
|
|
4200
|
+
if (several !== null) return !selectionPaysNothing(selectionPayment);
|
|
4094
4201
|
if (selectedEventSlidingScale) return (selectedSlidingAmount ?? 0) > 0;
|
|
4095
4202
|
return resolveEventRequiresPayment({
|
|
4096
4203
|
eligibility,
|
|
@@ -4103,6 +4210,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4103
4210
|
currentEvent,
|
|
4104
4211
|
selectedEventSlidingScale,
|
|
4105
4212
|
selectedSlidingAmount,
|
|
4213
|
+
several,
|
|
4106
4214
|
selectionPayment
|
|
4107
4215
|
]);
|
|
4108
4216
|
const { ticketContinuation, handleTicketsComplete } = useRegistrationAdmission({
|
|
@@ -4122,11 +4230,12 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4122
4230
|
registrationTarget,
|
|
4123
4231
|
selectedAttendanceMode,
|
|
4124
4232
|
ticketSelections,
|
|
4125
|
-
selectedSlidingAmount
|
|
4233
|
+
selectedSlidingAmount,
|
|
4234
|
+
earlierBookings: () => earlierBookingsToName(commandRef.current, paymentController.heldPlace, browserPendingCheckouts.ids(api.config.siteId))
|
|
4126
4235
|
});
|
|
4127
|
-
const blockDetailsCompletion = (blocker) => {
|
|
4236
|
+
const blockDetailsCompletion = (blocker, action = "places") => {
|
|
4128
4237
|
if (blocker.kind === "unavailable") {
|
|
4129
|
-
setErrorAction(
|
|
4238
|
+
setErrorAction(action);
|
|
4130
4239
|
setErrorMessage(blocker.message);
|
|
4131
4240
|
setStep("error");
|
|
4132
4241
|
}
|
|
@@ -4181,7 +4290,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4181
4290
|
kind: "unavailable",
|
|
4182
4291
|
reason: "closed",
|
|
4183
4292
|
message: continuation.message
|
|
4184
|
-
});
|
|
4293
|
+
}, DETAILS_CHECK_REFUSAL_RECOVERY);
|
|
4185
4294
|
case "payment-step":
|
|
4186
4295
|
setStep("select-payment");
|
|
4187
4296
|
return {
|
|
@@ -4210,10 +4319,17 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4210
4319
|
reason: "blocked",
|
|
4211
4320
|
message: "Agree to the terms of sale to continue."
|
|
4212
4321
|
};
|
|
4213
|
-
if (fundingView?.option.kind === "entitlement")
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4322
|
+
if (fundingView?.option.kind === "entitlement") {
|
|
4323
|
+
if (fundingView.collection === null && fundingView.takesPayment) return {
|
|
4324
|
+
ok: false,
|
|
4325
|
+
reason: "blocked",
|
|
4326
|
+
message: "Choose an available payment option."
|
|
4327
|
+
};
|
|
4328
|
+
return handleSubmit("stripe", void 0, {
|
|
4329
|
+
method: "stripe",
|
|
4330
|
+
collectionOptionKind: fundingView.collection ?? "upfront"
|
|
4331
|
+
});
|
|
4332
|
+
}
|
|
4217
4333
|
const submitPlan = resolveEventRegistrationSubmitPlan({
|
|
4218
4334
|
paymentSelection,
|
|
4219
4335
|
eventRequiresPayment,
|
|
@@ -4267,18 +4383,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4267
4383
|
runChoices,
|
|
4268
4384
|
primaryTicketUnits: ticketSelectionSummaryLines
|
|
4269
4385
|
});
|
|
4270
|
-
const
|
|
4271
|
-
api,
|
|
4272
|
-
target: registrationTarget,
|
|
4273
|
-
event: currentEvent,
|
|
4274
|
-
attendanceMode: selectedAttendanceMode,
|
|
4275
|
-
ticketSelections,
|
|
4276
|
-
selectedSlidingAmount,
|
|
4277
|
-
identity: getPortalSubjectEmail(portalProfile),
|
|
4278
|
-
step,
|
|
4279
|
-
portalAuthState
|
|
4280
|
-
});
|
|
4281
|
-
const pricedAsOrder = pricedAsWholeOrder(several, datesQuote);
|
|
4386
|
+
const pricedAsOrder = pricesAsOrder(several, datesQuote);
|
|
4282
4387
|
const reviseFunding = (revised, message) => {
|
|
4283
4388
|
setErrorMessage("");
|
|
4284
4389
|
selectionFunding.revise(revised, message);
|
|
@@ -4315,11 +4420,11 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4315
4420
|
context: discountContext
|
|
4316
4421
|
});
|
|
4317
4422
|
const { code: discountCode, editCode: setDiscountCode } = discountView;
|
|
4318
|
-
const
|
|
4423
|
+
const discountAccess = registrationDiscountAccess(paymentIntent.method, selectionFunding.lookup);
|
|
4319
4424
|
useEffect(() => {
|
|
4320
|
-
if (
|
|
4425
|
+
if (discountAccess !== "card" && discountCode) setDiscountCode("");
|
|
4321
4426
|
}, [
|
|
4322
|
-
|
|
4427
|
+
discountAccess,
|
|
4323
4428
|
discountCode,
|
|
4324
4429
|
setDiscountCode
|
|
4325
4430
|
]);
|
|
@@ -4349,29 +4454,37 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4349
4454
|
const directPaymentInput = {
|
|
4350
4455
|
eligibility,
|
|
4351
4456
|
currentEvent,
|
|
4352
|
-
occurrenceContext:
|
|
4353
|
-
ticketSelectionSubtotalCents:
|
|
4354
|
-
several,
|
|
4457
|
+
occurrenceContext: bookingContext,
|
|
4458
|
+
ticketSelectionSubtotalCents: oneBookingCardSubtotal({
|
|
4355
4459
|
datesQuote,
|
|
4356
4460
|
primarySubtotalCents,
|
|
4357
4461
|
ticketSelectionSubtotalCents
|
|
4358
4462
|
}),
|
|
4359
4463
|
automaticDiscount: singlePrices.automaticDiscount,
|
|
4360
|
-
nowIso
|
|
4361
|
-
selectionPayment
|
|
4464
|
+
nowIso
|
|
4362
4465
|
};
|
|
4363
|
-
const
|
|
4364
|
-
const
|
|
4466
|
+
const itemLabel = useMemo(() => selectionItemLabels(selection), [selection]);
|
|
4467
|
+
const { directPaymentOptions, moneyCardOptions, paymentInFullNote, paysNothing, paymentOptionsLoading, paymentOptionsError } = decideWizardPaymentOptions({
|
|
4468
|
+
several,
|
|
4469
|
+
severalAnswer,
|
|
4470
|
+
directPaymentInput,
|
|
4471
|
+
chosenFunding: chosenFundingPick(selectionFunding.lookup),
|
|
4472
|
+
orderTotalCents: ticketSelectionSubtotalCents,
|
|
4473
|
+
itemLabel,
|
|
4474
|
+
choiceNowIso,
|
|
4475
|
+
eligibility,
|
|
4476
|
+
eligibilityError,
|
|
4477
|
+
loading: anyLoading(eligibilityLoading, checkingNextStep, combinationPricing.quoting)
|
|
4478
|
+
});
|
|
4365
4479
|
const { paymentDecision, paymentSelection, paymentStepState: quotedPaymentStepState } = resolveWizardPaymentView({
|
|
4366
4480
|
directPaymentOptions,
|
|
4367
4481
|
paymentIntent,
|
|
4368
4482
|
eligibility,
|
|
4369
4483
|
admission,
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
eligibilityError,
|
|
4484
|
+
paysNothing,
|
|
4485
|
+
offersEntitlements: several === null,
|
|
4486
|
+
loading: paymentOptionsLoading,
|
|
4487
|
+
error: paymentOptionsError,
|
|
4375
4488
|
isAuthenticated: flowState.isAuthenticated,
|
|
4376
4489
|
portalCreditState,
|
|
4377
4490
|
discountCode: codeAwaitingApply ? discountCode : "",
|
|
@@ -4385,7 +4498,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4385
4498
|
places: ticketsCount,
|
|
4386
4499
|
eligibility,
|
|
4387
4500
|
event: currentEvent,
|
|
4388
|
-
|
|
4501
|
+
moneyCardOptions,
|
|
4502
|
+
several,
|
|
4389
4503
|
paymentDecision,
|
|
4390
4504
|
pricing: combinationPricing,
|
|
4391
4505
|
creditState: portalCreditState,
|
|
@@ -4400,8 +4514,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4400
4514
|
admission
|
|
4401
4515
|
}
|
|
4402
4516
|
});
|
|
4403
|
-
const
|
|
4404
|
-
const shouldShowDiscountToggle = registrationDiscountEntryVisible(discountView, selectionMethod);
|
|
4517
|
+
const shouldShowDiscountToggle = registrationDiscountEntryVisible(discountView);
|
|
4405
4518
|
const requirementsLayout = useMemo(() => decideSelectionRequirementsLayout(selection), [selection]);
|
|
4406
4519
|
const questions = useEventRegistrationQuestions({
|
|
4407
4520
|
api,
|
|
@@ -4430,6 +4543,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4430
4543
|
const handleSubmit = deps.useEventRegistrationSubmit({
|
|
4431
4544
|
openPayment: paymentController.openPayment,
|
|
4432
4545
|
commandRef,
|
|
4546
|
+
heldPlace: paymentController.heldPlace,
|
|
4433
4547
|
setSubmissionFailure: (failure) => {
|
|
4434
4548
|
if (failure.answersNeeded) requirements.keepRefused();
|
|
4435
4549
|
dispatchFlow({
|
|
@@ -4530,19 +4644,12 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4530
4644
|
*/
|
|
4531
4645
|
const handleBookAnother = () => {
|
|
4532
4646
|
clearWaitlistClaimLocation();
|
|
4647
|
+
setArrivalFinished(true);
|
|
4533
4648
|
resetRegistrationAfterExpiry({
|
|
4534
|
-
|
|
4535
|
-
preSelectedEvent,
|
|
4649
|
+
start: entryStart(entryFor("none")),
|
|
4536
4650
|
dispatchFlow,
|
|
4537
|
-
setSelectedTicketLines,
|
|
4538
|
-
setSelectedSlidingAmountInput,
|
|
4539
|
-
setSelectedAttendanceMode,
|
|
4540
4651
|
setErrorMessage
|
|
4541
4652
|
});
|
|
4542
|
-
setSelectedSlidingAmountInput(initialSlidingAmountInput(preSelectedEvent ?? null));
|
|
4543
|
-
setRoomChoices([]);
|
|
4544
|
-
setSelection(preSelectedEvent ? [preSelectedEvent] : []);
|
|
4545
|
-
setGuests([]);
|
|
4546
4653
|
setGuestErrors({});
|
|
4547
4654
|
combinationPricing.reset();
|
|
4548
4655
|
selectionFunding.reset();
|
|
@@ -4557,15 +4664,10 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4557
4664
|
reset: () => {
|
|
4558
4665
|
clearWaitlistClaimLocation();
|
|
4559
4666
|
resetRegistrationAfterExpiry({
|
|
4560
|
-
|
|
4561
|
-
preSelectedEvent,
|
|
4667
|
+
start: entryStart(entry),
|
|
4562
4668
|
dispatchFlow,
|
|
4563
|
-
setSelectedTicketLines,
|
|
4564
|
-
setSelectedSlidingAmountInput,
|
|
4565
|
-
setSelectedAttendanceMode,
|
|
4566
4669
|
setErrorMessage
|
|
4567
4670
|
});
|
|
4568
|
-
setRoomChoices([]);
|
|
4569
4671
|
}
|
|
4570
4672
|
});
|
|
4571
4673
|
const handlePaymentSelectionChange = useCallback((selection) => {
|
|
@@ -4578,7 +4680,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4578
4680
|
const presentation = presentWizardStep({
|
|
4579
4681
|
step,
|
|
4580
4682
|
flow: flowState,
|
|
4581
|
-
|
|
4683
|
+
entry,
|
|
4582
4684
|
admission,
|
|
4583
4685
|
eventRequiresPayment: resolveRouteRequiresPayment({
|
|
4584
4686
|
event: currentEvent,
|
|
@@ -4631,7 +4733,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4631
4733
|
/** Why one booking's card payment is the whole price although its terms offer a deposit; null otherwise. */
|
|
4632
4734
|
paymentInFullNote,
|
|
4633
4735
|
anchorId: options.anchorId,
|
|
4634
|
-
|
|
4736
|
+
/** The page's occurrence while the booking is for the page's date, otherwise null. */
|
|
4737
|
+
occurrenceContext: bookingContext,
|
|
4635
4738
|
registrationTarget,
|
|
4636
4739
|
subject: options.subject,
|
|
4637
4740
|
events,
|
|
@@ -4641,7 +4744,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4641
4744
|
/** Everything on this page a booking could be for, whether or not it's still a choice. */
|
|
4642
4745
|
recoveryEvents,
|
|
4643
4746
|
preSelectedEvent: preSelectedDisplayEvent(preSelectedEvent, currentEvent, displayEvent),
|
|
4644
|
-
|
|
4747
|
+
/** Where booking starts on this page, and what it chooses from. */
|
|
4748
|
+
entry,
|
|
4645
4749
|
presentation,
|
|
4646
4750
|
flow: flowState,
|
|
4647
4751
|
setStep: (next) => {
|
|
@@ -4662,8 +4766,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4662
4766
|
severalItems: several,
|
|
4663
4767
|
/** One way of attending for every chosen item. */
|
|
4664
4768
|
attendance,
|
|
4665
|
-
/** How the whole selection is paid. */
|
|
4666
|
-
selectionPayment,
|
|
4667
4769
|
/** What each run's ticket choice is checked against when booking several runs. */
|
|
4668
4770
|
runChoiceFacts,
|
|
4669
4771
|
selectionPrice,
|
|
@@ -4789,6 +4891,10 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4789
4891
|
registrationOptionsState,
|
|
4790
4892
|
eligibilityLoading: anyLoading(eligibilityLoading, checkingNextStep, combinationPricing.quoting),
|
|
4791
4893
|
eligibilityError,
|
|
4894
|
+
/** The payment step's own wait: the booking options, and several runs' ways to pay. */
|
|
4895
|
+
paymentOptionsLoading,
|
|
4896
|
+
/** Why the payment step can't show ways to pay, when the booking options or several runs' ways to pay didn't load. */
|
|
4897
|
+
paymentOptionsError,
|
|
4792
4898
|
/** Asks for the booking options again, after they failed to load. */
|
|
4793
4899
|
reloadOptions: () => setOptionsRefreshKey((value) => value + 1),
|
|
4794
4900
|
existingRegistrations,
|
|
@@ -4808,7 +4914,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
4808
4914
|
discountsAvailableLoading: discountView.discountsAvailableLoading,
|
|
4809
4915
|
discountContext,
|
|
4810
4916
|
shouldShowDiscountToggle,
|
|
4811
|
-
|
|
4917
|
+
discountAccess,
|
|
4812
4918
|
verification,
|
|
4813
4919
|
paymentController,
|
|
4814
4920
|
paymentStatusRecovery,
|
|
@@ -4863,7 +4969,7 @@ function roomChooserStep(input) {
|
|
|
4863
4969
|
function resolveSelectionChoiceMessages(input) {
|
|
4864
4970
|
if (input.several !== "runs") return {
|
|
4865
4971
|
slidingScaleSelectionMessage: getSlidingScaleSelectionMessage(input),
|
|
4866
|
-
selectionChoiceMessage: input.roomMessage
|
|
4972
|
+
selectionChoiceMessage: attendanceChoicePending(input.attendance, input.facts.attendanceMode) ? ATTENDANCE_CHOICE_MESSAGE : input.roomMessage
|
|
4867
4973
|
};
|
|
4868
4974
|
return {
|
|
4869
4975
|
slidingScaleSelectionMessage: incompleteRunChoiceMessage(input),
|
|
@@ -4940,43 +5046,118 @@ function registrationCodeField(field, quote) {
|
|
|
4940
5046
|
};
|
|
4941
5047
|
}
|
|
4942
5048
|
/**
|
|
4943
|
-
*
|
|
4944
|
-
*
|
|
4945
|
-
* anything is due (issue 1725); the first item's options don't decide it.
|
|
5049
|
+
* One booking's card options: what its own options allow, repriced with its
|
|
5050
|
+
* automatic discount. Several items take theirs from the server's answer.
|
|
4946
5051
|
*/
|
|
4947
|
-
function
|
|
4948
|
-
const { eligibility
|
|
4949
|
-
if (!eligibility) return [];
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
5052
|
+
function oneBookingCardOptions(input) {
|
|
5053
|
+
const { eligibility } = input;
|
|
5054
|
+
if (!eligibility || !eligibility.requiresPayment || !eligibility.price) return [];
|
|
5055
|
+
return buildDirectPaymentOptions(input, eligibility, {
|
|
5056
|
+
subtotalCents: input.ticketSelectionSubtotalCents ?? eligibility.price,
|
|
5057
|
+
approvedPaymentOptions: eligibility.paymentOptions,
|
|
5058
|
+
paymentTerms: eligibility.paymentTerms
|
|
5059
|
+
}, previewTotalWithAutomaticDiscount(input));
|
|
5060
|
+
}
|
|
5061
|
+
/** The steps where several items need the server's answer: their tickets are chosen from here on. */
|
|
5062
|
+
const SEVERAL_ANSWER_STEPS = /* @__PURE__ */ new Set([
|
|
5063
|
+
"select-tickets",
|
|
5064
|
+
"enter-details",
|
|
5065
|
+
"select-payment"
|
|
5066
|
+
]);
|
|
5067
|
+
/**
|
|
5068
|
+
* The payment step's options. One booking keeps its own card options and
|
|
5069
|
+
* paid-in-full note; several items offer the ways the server's answer collects
|
|
5070
|
+
* the chosen option's money.
|
|
5071
|
+
*/
|
|
5072
|
+
function decideWizardPaymentOptions(input) {
|
|
5073
|
+
return input.several === null ? oneBookingPaymentOptions(input) : severalItemsPaymentOptions(input);
|
|
5074
|
+
}
|
|
5075
|
+
function oneBookingPaymentOptions(input) {
|
|
5076
|
+
const directPaymentOptions = oneBookingCardOptions(input.directPaymentInput);
|
|
5077
|
+
return {
|
|
5078
|
+
directPaymentOptions,
|
|
5079
|
+
moneyCardOptions: directPaymentOptions,
|
|
5080
|
+
paymentInFullNote: decidePaidInFullNote(input.directPaymentInput, directPaymentOptions, input.choiceNowIso),
|
|
5081
|
+
paysNothing: input.eligibility?.isFree ?? false,
|
|
5082
|
+
paymentOptionsLoading: input.loading,
|
|
5083
|
+
paymentOptionsError: input.eligibilityError
|
|
5084
|
+
};
|
|
5085
|
+
}
|
|
5086
|
+
/** The chosen option's ways to pay, and the money option's own for its rows beside a pass or membership. */
|
|
5087
|
+
function severalItemsPaymentOptions(input) {
|
|
5088
|
+
const payment = answeredPayment(input.severalAnswer);
|
|
5089
|
+
const optionsFor = (collections, orderTotalCents) => buildSelectionCollectionOptions({
|
|
5090
|
+
collections,
|
|
5091
|
+
orderTotalCents,
|
|
5092
|
+
itemLabel: input.itemLabel
|
|
5093
|
+
});
|
|
5094
|
+
const runsStatus = input.several === "runs" ? input.severalAnswer.tag : "loaded";
|
|
5095
|
+
return {
|
|
5096
|
+
directPaymentOptions: optionsFor(pickCollections(payment, input.chosenFunding), input.orderTotalCents),
|
|
5097
|
+
moneyCardOptions: optionsFor(moneyCollections(payment), input.chosenFunding.kind === "money" ? input.orderTotalCents : null),
|
|
5098
|
+
paymentInFullNote: null,
|
|
5099
|
+
paysNothing: selectionPaysNothing(payment),
|
|
5100
|
+
paymentOptionsLoading: input.loading || runsStatus === "waiting",
|
|
5101
|
+
paymentOptionsError: input.eligibilityError ?? runsLoadError(runsStatus)
|
|
5102
|
+
};
|
|
5103
|
+
}
|
|
5104
|
+
function runsLoadError(status) {
|
|
5105
|
+
return status === "failed" ? RUNS_PAYMENT_LOAD_FAILED : null;
|
|
5106
|
+
}
|
|
5107
|
+
function answeredPayment(answer) {
|
|
5108
|
+
return answer.tag === "loaded" ? answer.payment : null;
|
|
5109
|
+
}
|
|
5110
|
+
/** Several runs ask how they can be paid once each run's ticket is chosen. */
|
|
5111
|
+
function runsPaymentAsk(input) {
|
|
5112
|
+
return {
|
|
5113
|
+
request: input.selectionChoiceMessage === null ? runsSelectionPaymentRequest(input.request) : null,
|
|
5114
|
+
enabled: input.several === "runs" && SEVERAL_ANSWER_STEPS.has(input.step) && input.portalAuthState !== "checking"
|
|
5115
|
+
};
|
|
5116
|
+
}
|
|
5117
|
+
/** Several items, and one date paid by a pass or membership, are priced as an order. */
|
|
5118
|
+
function pricesAsOrder(several, datesQuote) {
|
|
5119
|
+
return several !== null || datesQuote !== null;
|
|
5120
|
+
}
|
|
5121
|
+
/** One date's card options keep the date's own price while a pass or membership prices the order. */
|
|
5122
|
+
function oneBookingCardSubtotal(input) {
|
|
5123
|
+
return input.datesQuote !== null ? input.primarySubtotalCents : input.ticketSelectionSubtotalCents;
|
|
5124
|
+
}
|
|
5125
|
+
/** Dates have their answer with their funding; runs ask for theirs on their own. */
|
|
5126
|
+
function severalItemsPaymentAnswer(several, dates, runs) {
|
|
5127
|
+
switch (several) {
|
|
5128
|
+
case null: return { tag: "none" };
|
|
5129
|
+
case "dates": switch (dates.tag) {
|
|
5130
|
+
case "idle":
|
|
5131
|
+
case "loading": return { tag: "waiting" };
|
|
5132
|
+
case "failed": return { tag: "failed" };
|
|
5133
|
+
case "loaded": return dates.payment ? {
|
|
5134
|
+
tag: "loaded",
|
|
5135
|
+
payment: dates.payment
|
|
5136
|
+
} : { tag: "failed" };
|
|
5137
|
+
}
|
|
5138
|
+
case "runs": switch (runs.tag) {
|
|
5139
|
+
case "idle":
|
|
5140
|
+
case "loading": return { tag: "waiting" };
|
|
5141
|
+
case "failed": return { tag: "failed" };
|
|
5142
|
+
case "loaded": return {
|
|
5143
|
+
tag: "loaded",
|
|
5144
|
+
payment: runs.payment
|
|
5145
|
+
};
|
|
4970
5146
|
}
|
|
4971
5147
|
}
|
|
4972
5148
|
}
|
|
5149
|
+
/** The funding option the visitor has picked; money until a pass or membership is offered and picked. */
|
|
5150
|
+
function chosenFundingPick(lookup) {
|
|
5151
|
+
const option = lookupChosenOption(lookup);
|
|
5152
|
+
return option ? fundingOptionPick(option) : { kind: "money" };
|
|
5153
|
+
}
|
|
4973
5154
|
/**
|
|
4974
5155
|
* The payment step's sentence when one booking's card options, as shown
|
|
4975
5156
|
* (repriced, discounts included), have no deposit although its terms offer one.
|
|
4976
5157
|
*/
|
|
4977
5158
|
function decidePaidInFullNote(input, cardOptions, liveNowIso) {
|
|
4978
5159
|
const { eligibility } = input;
|
|
4979
|
-
if (!eligibility
|
|
5160
|
+
if (!eligibility) return null;
|
|
4980
5161
|
return paidInFullNote({
|
|
4981
5162
|
paymentTerms: eligibility.paymentTerms,
|
|
4982
5163
|
offeredKinds: cardOptions.map((option) => option.kind),
|
|
@@ -5029,11 +5210,12 @@ function resolveWizardPaymentView(input) {
|
|
|
5029
5210
|
const paymentDecision = decideEventRegistrationPayment({
|
|
5030
5211
|
directPaymentOptions: input.directPaymentOptions,
|
|
5031
5212
|
selection: input.paymentIntent,
|
|
5032
|
-
|
|
5213
|
+
paysNothing: input.paysNothing,
|
|
5214
|
+
offersEntitlements: input.offersEntitlements,
|
|
5033
5215
|
eligibility: input.eligibility,
|
|
5034
5216
|
admission: input.admission,
|
|
5035
|
-
loading:
|
|
5036
|
-
error: input.
|
|
5217
|
+
loading: input.loading,
|
|
5218
|
+
error: input.error,
|
|
5037
5219
|
isAuthenticated: input.isAuthenticated,
|
|
5038
5220
|
creditState: input.portalCreditState,
|
|
5039
5221
|
manualDiscountPending: Boolean(input.discountCode.trim())
|
|
@@ -5066,13 +5248,16 @@ function presentWizardSelectionFunding(input) {
|
|
|
5066
5248
|
const currency = input.eligibility?.currency;
|
|
5067
5249
|
if (input.lookup.tag !== "loaded" || !currency) return null;
|
|
5068
5250
|
const dates = fundingDatesOf(input.selection, input.itemPrice);
|
|
5251
|
+
const payment = input.lookup.payment;
|
|
5069
5252
|
return presentSelectionFunding({
|
|
5070
5253
|
funding: input.lookup.funding,
|
|
5071
5254
|
pick: input.lookup.pick,
|
|
5072
5255
|
dates,
|
|
5073
5256
|
places: input.places,
|
|
5074
5257
|
currency,
|
|
5075
|
-
moneyRows: moneyRows(input
|
|
5258
|
+
moneyRows: moneyRows(input),
|
|
5259
|
+
collectionsOf: (pick) => payment ? collectionsOf(paymentOptionFor(payment, pick)).map((collection) => collection.kind) : ["upfront"],
|
|
5260
|
+
chosenCollection: chosenCardKind(input.paymentDecision),
|
|
5076
5261
|
chosenOrder: input.pricing.ready ? quotedOrder(input.pricing.quote) : null,
|
|
5077
5262
|
reductions: quoteReductions(input.pricing.quote),
|
|
5078
5263
|
availableCreditCents: availableCreditCents(input.creditState, currency),
|
|
@@ -5080,32 +5265,38 @@ function presentWizardSelectionFunding(input) {
|
|
|
5080
5265
|
formatDay: fundingDayFormatter(input.event)
|
|
5081
5266
|
});
|
|
5082
5267
|
}
|
|
5268
|
+
/** The way to pay the visitor has chosen on the payment step, if it's one on offer. */
|
|
5269
|
+
function chosenCardKind(decision) {
|
|
5270
|
+
const state = decision.directPaymentSelectionState;
|
|
5271
|
+
return state.kind === "valid" ? state.selection.collectionOptionKind : null;
|
|
5272
|
+
}
|
|
5083
5273
|
/**
|
|
5084
|
-
* How the money option is offered
|
|
5085
|
-
*
|
|
5274
|
+
* How the money option is offered: each of its ways to pay (a deposit for one date,
|
|
5275
|
+
* say, or paying directly for several), so choosing money still chooses how. Paying
|
|
5276
|
+
* several dates in full shows the order's price, codes and combination prices included.
|
|
5086
5277
|
*/
|
|
5087
|
-
function moneyRows(input
|
|
5088
|
-
const {
|
|
5278
|
+
function moneyRows(input) {
|
|
5279
|
+
const { moneyCardOptions: cards, paymentDecision, lookup } = input;
|
|
5089
5280
|
const money = lookup.tag === "loaded" && lookup.pick.kind === "money";
|
|
5090
|
-
const chosen = paymentDecision
|
|
5091
|
-
if (
|
|
5092
|
-
|
|
5281
|
+
const chosen = chosenCardKind(paymentDecision);
|
|
5282
|
+
if (cards.length === 0) {
|
|
5283
|
+
if (input.several !== null && !(lookup.tag === "loaded" && selectionPaysNothing(lookup.payment))) return [];
|
|
5093
5284
|
return [{
|
|
5094
5285
|
key: "card",
|
|
5095
|
-
label: moneyRowLabel(
|
|
5096
|
-
details:
|
|
5286
|
+
label: moneyRowLabel(false, paymentDecision.preview, void 0),
|
|
5287
|
+
details: [],
|
|
5097
5288
|
price: null,
|
|
5098
5289
|
card: null,
|
|
5099
5290
|
current: true
|
|
5100
5291
|
}];
|
|
5101
5292
|
}
|
|
5102
|
-
return
|
|
5293
|
+
return cards.map((card) => ({
|
|
5103
5294
|
key: card.kind,
|
|
5104
5295
|
label: moneyRowLabel(money && chosen === card.kind, paymentDecision.preview, card.label),
|
|
5105
5296
|
details: paymentChoiceDetails(card),
|
|
5106
|
-
price: paymentChoicePrice(card.amounts),
|
|
5107
|
-
card:
|
|
5108
|
-
current:
|
|
5297
|
+
price: input.several !== null && card.kind === "upfront" ? null : paymentChoicePrice(card.amounts),
|
|
5298
|
+
card: cards.length > 1 ? card.kind : null,
|
|
5299
|
+
current: cards.length === 1 || chosen === card.kind
|
|
5109
5300
|
}));
|
|
5110
5301
|
}
|
|
5111
5302
|
/** A chosen money row says site credit when the credit preview spends it, as the card step does. */
|
|
@@ -5145,8 +5336,10 @@ function quotedOrder(quote) {
|
|
|
5145
5336
|
};
|
|
5146
5337
|
}
|
|
5147
5338
|
/**
|
|
5148
|
-
* Asks for the dates' ways to pay
|
|
5149
|
-
*
|
|
5339
|
+
* Asks for the dates' ways to pay, and what the quote then prices: the chosen
|
|
5340
|
+
* option's whole order. One date asks on its payment step; several dates as
|
|
5341
|
+
* soon as their tickets are chosen, since their answer decides whether there's
|
|
5342
|
+
* anything to pay and whether the site can take it.
|
|
5150
5343
|
*/
|
|
5151
5344
|
function useWizardSelectionFunding(input) {
|
|
5152
5345
|
const { target, attendanceMode, ticketSelections, selectedSlidingAmount } = input;
|
|
@@ -5164,25 +5357,18 @@ function useWizardSelectionFunding(input) {
|
|
|
5164
5357
|
ticketSelections,
|
|
5165
5358
|
selectedSlidingAmount
|
|
5166
5359
|
]);
|
|
5360
|
+
const wanted = input.step === "select-payment" || input.several === "dates" && SEVERAL_ANSWER_STEPS.has(input.step);
|
|
5167
5361
|
const selectionFunding = useSelectionFunding({
|
|
5168
5362
|
api: input.api,
|
|
5169
5363
|
request,
|
|
5170
5364
|
identity: input.identity,
|
|
5171
|
-
enabled:
|
|
5365
|
+
enabled: wanted && input.portalAuthState !== "checking"
|
|
5172
5366
|
});
|
|
5173
5367
|
return {
|
|
5174
5368
|
selectionFunding,
|
|
5175
5369
|
datesQuote: useMemo(() => selectionDatesQuote(selectionFunding.lookup, request), [selectionFunding.lookup, request])
|
|
5176
5370
|
};
|
|
5177
5371
|
}
|
|
5178
|
-
/** Several items, or one date paid with a pass or membership, are priced as one whole order. */
|
|
5179
|
-
function pricedAsWholeOrder(several, datesQuote) {
|
|
5180
|
-
return several !== null || datesQuote !== null;
|
|
5181
|
-
}
|
|
5182
|
-
/** One date's card options keep the date's own price while a pass or membership is picked. */
|
|
5183
|
-
function cardOptionsSubtotal(input) {
|
|
5184
|
-
return input.several === null && input.datesQuote !== null ? input.primarySubtotalCents : input.ticketSelectionSubtotalCents;
|
|
5185
|
-
}
|
|
5186
5372
|
/** How many dates the funding step's copy speaks of; 0 for anything that isn't dates. */
|
|
5187
5373
|
function fundingDateCount(target) {
|
|
5188
5374
|
return target?.selection.kind === "dates" ? target.selection.occurrenceIds.length : 0;
|
|
@@ -5195,7 +5381,7 @@ function availableCreditCents(state, currency) {
|
|
|
5195
5381
|
}
|
|
5196
5382
|
//#endregion
|
|
5197
5383
|
//#region ../blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.tsx
|
|
5198
|
-
const Payment = lazy(() => import("./EventEmbeddedCheckoutStep-
|
|
5384
|
+
const Payment = lazy(() => import("./EventEmbeddedCheckoutStep-BGkbUhuw.mjs"));
|
|
5199
5385
|
/** The one Stripe mount, shared by the standard wizard and headless arrangements. */
|
|
5200
5386
|
function EventPaymentMount({ state, onComplete, onRetry, onBack, buttonVariant }) {
|
|
5201
5387
|
if (state.kind === "abandoning") return /* @__PURE__ */ jsx("p", {
|