@riverbankcms/sdk 0.172.0 → 0.173.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-DtrzTJ77.d.ts → BlocksIslandsHydrator-O50mTMCY.d.ts} +1 -1
- package/dist/_dts/{Page-DViYbakk.d.ts → Page-Bk99sJwV.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-D-5OeDbT.d.ts → SdkPreviewMode-DzAue6Kj.d.ts} +2 -2
- package/dist/_dts/{client-DZBOzd3U.d.ts → client-ZlNEIvlU.d.ts} +1002 -139
- package/dist/_dts/{content-types-DS3DrYn_.d.ts → content-types-DBXPNc0h.d.ts} +2 -2
- package/dist/_dts/{contracts-C3QGPCUf.d.ts → contracts-D9bhu0bb.d.ts} +4 -3
- package/dist/_dts/{footerPageOutline-D9Q7VIul.d.ts → footerPageOutline-Bfap3soN.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-R7NeFT1u.d.ts → generatePageMetadata-DwCdg31h.d.ts} +2 -2
- package/dist/_dts/{index-CpOkfBt1.d.ts → index-BnatulTs.d.ts} +3 -3
- package/dist/_dts/{index-Dns7OHyl.d.ts → index-C611wjIL.d.ts} +1 -1
- package/dist/_dts/{index-Da4UMgbs.d.ts → index-CJzs-yIJ.d.ts} +2 -2
- package/dist/_dts/{index-MuMYjetm.d.ts → index-DW3eeNph.d.ts} +4 -4
- package/dist/_dts/{index-DkFV_1Bc.d.ts → index-Dq_AboWN.d.ts} +1 -1
- package/dist/_dts/{index-C0zjLMAW.d.ts → index-DutLU2d2.d.ts} +1 -1
- package/dist/_dts/{index-BnMavhoh.d.ts → index-KXh8FQ2s.d.ts} +2 -2
- package/dist/_dts/{loadContent-DJmXHzfi.d.ts → loadContent-Bde2y870.d.ts} +7 -7
- package/dist/_dts/{request-wQ28JWbr.d.ts → request-Bysk4QPI.d.ts} +1842 -262
- package/dist/_dts/{resolveBlockData-C-IP53u9.d.ts → resolveBlockData-ChbNvpSF.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-Cc4zqaEC.d.ts → resolvePageContent-CGa6QMgc.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +6 -2
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-DrinAfeW.d.ts → types-BoEk9ZON.d.ts} +3 -3
- package/dist/_dts/{types-CpjyP5I4.d.ts → types-BwitGNTl.d.ts} +7 -7
- package/dist/_dts/{types-ZuZoGsZV.d.ts → types-kpp8XyXv.d.ts} +2 -2
- package/dist/_dts/{validation-CIZ_fP5l.d.ts → validation-ChftKX-o.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-UFmQB1BE.mjs → BlocksIslandsHydrator-BnUeSE3d.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-VjRYhx1c.mjs → BookingMailingListNote-LHQMODqB.mjs} +13 -7
- package/dist/client/{BookingPanelArrangement-DpqnRo-t.mjs → BookingPanelArrangement-Be704P85.mjs} +1 -1
- package/dist/client/{BookingQuestionFields-CzOT8ZWo.mjs → BookingQuestionFields-BewbU_cV.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-CNckKZct.mjs → CalendarNavigationChevron-BMZp3RS3.mjs} +41 -34
- package/dist/client/{DemoBookingPortalAccess-CmZLVXOy.mjs → DemoBookingPortalAccess-CARUWQ_E.mjs} +21 -21
- package/dist/client/{EventCalendar.client-BU-SxLCn.mjs → EventCalendar.client-CaI6upCX.mjs} +11 -10
- package/dist/client/{EventCombined.client-f28VltfY.mjs → EventCombined.client-CoRUaYHY.mjs} +10 -9
- package/dist/client/{EventItem-sKBofjiW.mjs → EventItem-Doe4KodB.mjs} +25 -16
- package/dist/client/{EventListWeekNavigation-IAcax47T.mjs → EventListWeekNavigation-CXWLKDfa.mjs} +1 -1
- package/dist/client/{EventListing.client-BEtnRvZr.mjs → EventListing.client-DvJ5tGTx.mjs} +3 -3
- package/dist/client/{EventListing.view-BZ4l_rmT.mjs → EventListing.view-BmfyK7S5.mjs} +37 -14
- package/dist/client/{EventRegistrationPayment-BWb295cD.mjs → EventRegistrationPayment-DwMlJB2V.mjs} +846 -145
- package/dist/client/{LocationMapActions-Hsj2HC_1.mjs → LocationMapActions-CdRPU6gp.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-C7E7Lyfa.mjs → MapDrawingSvg-DCLtxOnt.mjs} +1 -1
- package/dist/client/{Page-Ds1s3DuC.mjs → Page-D46Dmr7b.mjs} +548 -44
- package/dist/client/{StepIndicator-CSCyAaKY.mjs → StepIndicator-CrSZCZn1.mjs} +82 -11
- package/dist/client/{accessibleSurfaces-OsAseM7H.mjs → accessibleSurfaces-D4DhWo9j.mjs} +1 -20
- package/dist/client/{accordion-DgwFZJSx.mjs → accordion-P8xcfKxq.mjs} +1 -1
- package/dist/client/bookability-SargNwlO.mjs +17 -0
- package/dist/client/{booking-form.client-CKY9oksp.mjs → booking-form.client-BM2s-NqR.mjs} +11 -11
- package/dist/client/{bookingForm-CsHhcdSF.mjs → bookingForm-JnaZPZge.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-B1Z_TGAe.mjs → boxStyleClassNames-Cahps5kR.mjs} +1 -1
- package/dist/client/{carousel-0sw2Kc3a.mjs → carousel-CQQ_m0KA.mjs} +1 -1
- package/dist/client/{cart-CPfvMDGJ.mjs → cart-0Q4fjw_K.mjs} +3 -3
- package/dist/client/{cart.client-BJBPUTmg.mjs → cart.client-BI0IaHX3.mjs} +1 -1
- package/dist/client/{checkout-DU4JFjGT.mjs → checkout-1J-3ftxF.mjs} +3 -3
- package/dist/client/{checkout.client-BbNCO4xa.mjs → checkout.client-DOGYDlDk.mjs} +1 -1
- package/dist/client/{checkoutUrls-BQ3OlWlM.mjs → checkoutUrls-CwHqcqzP.mjs} +1 -1
- package/dist/client/client.mjs +52 -4
- package/dist/client/{context-xNC1Cyjw.mjs → context-D0KCgbOq.mjs} +81 -14
- package/dist/client/{cta-CNVQHLKs.mjs → course-CmOuoZHN.mjs} +76 -2
- package/dist/client/{dateFormatting-B6ea-egy.mjs → dateFormatting-Dmfaczzq.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BhjGxhX3.mjs → demoPortalMagicLink-CL7KGRta.mjs} +1 -1
- package/dist/client/{display-B5DfNb6A.mjs → display-lL-YRApN.mjs} +2462 -426
- package/dist/client/{enhanceHeaderSection-BFcHLuqk.mjs → enhanceHeaderSection-B-eLGs2C.mjs} +3 -3
- package/dist/client/{event-details.client-WHT5GLn2.mjs → event-details.client-DH1-Jxsh.mjs} +1 -1
- package/dist/client/{event-registration.client-CmnRKELC.mjs → event-registration.client-GuuElczW.mjs} +1314 -552
- package/dist/client/{eventCalendar-2NbdCyov.mjs → eventCalendar-BiCINPkV.mjs} +4 -4
- package/dist/client/{eventCombined-D1lH1n2T.mjs → eventCombined-BtzmH6FW.mjs} +4 -4
- package/dist/client/{eventDetails-BHvnF2Tw.mjs → eventDetails-BJpAD10-.mjs} +2 -2
- package/dist/client/{eventListing-EhSDk4UL.mjs → eventListing-jLB8iRqp.mjs} +4 -4
- package/dist/client/{eventRegistration-z_0jN_KS.mjs → eventRegistration-WhtpDEbq.mjs} +4 -4
- package/dist/client/{form-BfChzSkS.mjs → form-DO6qKH3M.mjs} +3 -3
- package/dist/client/{form.client-D1zehtPk.mjs → form.client-D12ljYiX.mjs} +3 -3
- package/dist/client/{form.parts-rMDlUQIv.mjs → form.parts-C8QHaQOI.mjs} +1 -1
- package/dist/client/{formatDate-ymSVT9Y5.mjs → formatDate-BnhfIpCa.mjs} +1 -1
- package/dist/client/gifting/client.mjs +2 -2
- package/dist/client/{headerSection-BX9bQ84k.mjs → headerSection-BtFWtoUm.mjs} +2 -2
- package/dist/client/{newsletter-form.client-DMbuJCtJ.mjs → newsletter-form.client-oHrqM_Ao.mjs} +4 -4
- package/dist/client/{newsletter-form.parts-BxrVsoI0.mjs → newsletter-form.parts-D5U-FuVy.mjs} +1 -1
- package/dist/client/{newsletterForm-B_I3FJFS.mjs → newsletterForm-CBYbFxSx.mjs} +3 -3
- package/dist/client/{noop-CamIX2yK.mjs → noop-CN0o0yjH.mjs} +115 -12
- package/dist/client/portal/client.mjs +7 -7
- package/dist/client/{product-detail.client-qxuiYCof.mjs → product-detail.client-d_sNCapC.mjs} +1 -1
- package/dist/client/{product-list.client-CDL-jihv.mjs → product-list.client-DkSpw6WQ.mjs} +1 -1
- package/dist/client/{productDetail-B97m0uZy.mjs → productDetail-DaqM-LgL.mjs} +3 -3
- package/dist/client/{productList-DE4vSSG_.mjs → productList-CMx4-XlG.mjs} +3 -3
- package/dist/client/{propsDecoder-BTde6Syh.mjs → propsDecoder-BZbUKstC.mjs} +3 -3
- package/dist/client/{registry.server-Cn8XjRte.mjs → registry.server-Cdot3dMk.mjs} +85 -57
- package/dist/client/rendering/client.mjs +25 -25
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +24 -55
- package/dist/client/{richText-coerce-Bcl3vTb4.mjs → richText-coerce-ByApwB4q.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-BjRoLoMD.mjs → routeIslandApiConfig-DTET8f__.mjs} +1 -1
- package/dist/client/{runtimeResponse-B-lrAGhX.mjs → runtimeResponse-IkOwKZD0.mjs} +1 -1
- package/dist/client/runtimeResponse-Wd6kwhE_.mjs +3 -0
- package/dist/client/{shop-BC4H0oYT.mjs → shop-Cy6xXDM7.mjs} +3 -3
- package/dist/client/{shop-commerce-BsY7a71m.mjs → shop-commerce-oDR76k1q.mjs} +11 -10
- package/dist/client/{shop-commerce-store-BZ5j90HD.mjs → shop-commerce-store-DjoUpL3a.mjs} +1 -1
- package/dist/client/shop-discount-apply.state-WsGb9DD8.mjs +166 -0
- package/dist/client/{shop.client-WgGVGelc.mjs → shop.client-Brha4BSM.mjs} +11 -10
- package/dist/client/{shop.interactive-Bb67gPLL.mjs → shop.interactive-CXhYl0DW.mjs} +35 -12
- package/dist/client/{shopShared-BE6TEk2A.mjs → shopShared-JCa_SRhP.mjs} +2 -2
- package/dist/client/stable-json-D0XAEIXc.mjs +22 -0
- package/dist/client/{timetableModel-Bbz_ECL5.mjs → timetableModel-CZeJwMxP.mjs} +10 -10
- package/dist/client/{useAvailableSlots-CdP14E_b.mjs → useAvailableSlots-DfbSkWop.mjs} +17 -6
- package/dist/client/{useDiscountApply-DvOSso2l.mjs → useDiscountApply-Dq-wjb1d.mjs} +4 -167
- package/dist/client/{useDiscountCodeUi-B4fRd2jy.mjs → useDiscountCodeUi-Cyy0meCH.mjs} +1 -1
- package/dist/client/{useEventPagination-M3jC8lgP.mjs → useEventPagination-CCAGQHsD.mjs} +5 -5
- package/dist/client/{view-B0TFnP4y.mjs → view-D6yebI4r.mjs} +51 -31
- package/dist/client/{view-DNNNbnNj.mjs → view-Sw075FOY.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-D59tHj_L.mjs → PageSectionToolbar-DG2rXUmo.mjs} +26 -19
- package/dist/preview-next/client/{PreviewEditorSidebar-CjOIZlUk.mjs → PreviewEditorSidebar-BDY5vdHU.mjs} +27 -360
- package/dist/preview-next/client/{PreviewEditorUI--kS9Cwsc.mjs → PreviewEditorUI-CqZCfOaz.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-Bi8-rclb.mjs → PreviewShell-Bv2HZ7JY.mjs} +7 -7
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CWTUw-3L.mjs → SdkPreviewModeRuntime-BMTcR-MW.mjs} +5 -55
- package/dist/preview-next/client/{SiteChromeCustomizeButton-CrgS3I8d.mjs → SiteChromeCustomizeButton-D1MGyN_Z.mjs} +2668 -799
- package/dist/preview-next/client/{previewAssistantSlot-Caofnr1Z.mjs → previewAssistantSlot-La6MerV_.mjs} +3540 -684
- package/dist/preview-next/client/{previewChromeRoot-CbAI_jSH.mjs → previewChromeRoot-BcOQqJIP.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DY65_hLk.mjs → sdk-runtime-BkckHox4.mjs} +2 -2
- package/dist/preview-next/client/{useAutosaveStatus-CakNU3lp.mjs → useAutosaveStatus-CPAHgGqI.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-CCEMkosU.mjs → useOpenBlockForSetup-BDkuSZxQ.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-DsKDQoVW.mjs → route-contract-CPV30ABr.mjs} +48 -0
- package/dist/server/{Block.shared-D7Qy9F4a.mjs → Block.shared-BaMMstO1.mjs} +5 -5
- package/dist/server/{bindings-Bp6OnR3n.mjs → bindings-Dge4sqel.mjs} +4 -4
- package/dist/server/{client-dROAfMRa.mjs → client-VVIQjC4r.mjs} +51 -3
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/{identity-20XHqyuO.mjs → identity-DQD_8lNO.mjs} +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-zOIrtqz-.mjs → loadContent-BIJb3WAK.mjs} +5 -6
- package/dist/server/{loadPage-vwFiq1Rk.mjs → loadPage-DjTU19y7.mjs} +2 -2
- package/dist/server/{media-Brn9FW5s.mjs → media-luf7RF22.mjs} +2 -2
- package/dist/server/{navigation-DAwbICEL.mjs → navigation-iC_hXjJI.mjs} +3 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +6 -6
- package/dist/server/{overrideResolution-DjboggbB.mjs → overrideResolution-1Ru3NMQj.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-BR4t1rOw.mjs → pageRenderPlan-CytPhrI9.mjs} +143 -27
- package/dist/server/{pageRuntimeSupport-BKo6XVK-.mjs → pageRuntimeSupport-DWspU5EZ.mjs} +3 -3
- package/dist/server/{pageShared-BJjptSGp.mjs → pageShared-Bhx8bVe1.mjs} +166 -67
- package/dist/server/{parseThemeForPersistence-B18KDEue.mjs → parseThemeForPersistence-CtgRtvo3.mjs} +1 -1
- package/dist/server/{prebuild-CntSkZQI.mjs → prebuild-BjvFb0CA.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BM9Ds0OQ.mjs → prefetchBlockData-Db3stNpp.mjs} +3 -3
- package/dist/server/{registry-wYH0LH5f.mjs → registry-BMCfcev6.mjs} +809 -191
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +3 -3
- package/dist/server/rendering.mjs +8 -8
- package/dist/server/{resolveBlockData-Bu_p4HxZ.mjs → resolveBlockData--yUbI-Ll.mjs} +1 -1
- package/dist/server/{responseMedia-t6gs0cB7.mjs → responseMedia-DpBC1hTM.mjs} +1 -1
- package/dist/server/{schema-BFOqYIMQ.mjs → schema-D5Vfmqzw.mjs} +394 -1
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{validation-DAQdPDku.mjs → validation-EgTtnTcY.mjs} +4 -4
- package/dist/server/{version-DAB0O3yx.mjs → version-LjgU0Cq1.mjs} +1 -1
- package/dist/styles/index.css +174 -0
- package/package.json +1 -1
- package/dist/client/runtimeResponse-CPcA8xSm.mjs +0 -3
- package/dist/server/rich-text-CRcONdyM.mjs +0 -33
package/dist/client/{EventRegistrationPayment-BWb295cD.mjs → EventRegistrationPayment-DwMlJB2V.mjs}
RENAMED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $
|
|
3
|
-
import {
|
|
2
|
+
import { $n as getSingleSelectedPricingOptionId, A as createInitialRegistrationFlowState, Aa as requestSignIn, At as toEventSignInDraft, Bn as transformRegistrationOptionsResponse, Bt as toRunRequirementsSnapshots, Cn as selectionPreviewKey, Ct as toRegistrationEvents, Dt as eventSignInDraftStore, E as registrationRoute, Ea as PAGE_NAVIGATION, Ec as publicEventPricingCurrency, Et as EVENT_SIGN_IN_FORM_ID, F as buildEventRegistrationPaymentOptionsViewModel, Fn as getImplicitSingleTicketType, Ft as deriveRunRequirements, Gi as toBookingQuestionsPaymentSnapshot, Gn as getSlidingScaleForEvent, Gt as decideSelectionPayment, H as planRegistrationDetailsContinuation, Hi as needsBookingQuestionsRefresh, Hn as getCurrentTicketSelection, I as decideEventRegistrationPayment, In as getPortalSubjectEmail, It as nextRunToRead, J as visitorHoldsOwnPlace, Jn as parseCurrencyInputToCents, Jt as planSelectionPrice, K as resolveRegistrationTicketContinuation, Kn as getSlidingScaleSelectionMessage, Kt as effectiveSelection, La as resolveEventRegistrationScopedEvents, Lt as runFieldErrors, M as getDeclinedPass, Mt as buildSelectionRequirementsSubmission, N as isRegistrationLocked, Nt as checkRunRequirements, Oa as leavePage, Oi as formatCentsAsCurrencyInput, On as findSelectedTicketType, Ot as eventSignInEnds, P as registrationFlowReducer, Pt as decideSelectionRequirementsLayout, Q as resolveEventRegistrationSubmitPlan, Rn as getVisibleTicketTypes, Rt as runRequirementsSnapshotSchema, St as getRegistrationStartAt, T as registrationPresentation, Tn as serverPricedTotalCents, Tt as toWholeSeriesRegistrationEvents, U as resolveGuestNextStepCheck, Un as getEligibilityFlowFlags, V as planRegistrationDetailsCheck, Vi as deriveBookingQuestions, Vt as withoutKeptAnswers, W as resolveRegistrationAdmission, Wn as getRegistrationOccurrenceId, Wt as canToggleSelectionItem, Xn as shouldLoadRegistrationOptions, Xt as registrationSelectionMode, Yn as resolveHeldTicketPlaces, Yt as primarySelectionItem, Zn as withRegistrationAvailability, _n as combinationHintCopy, _t as invitationSubmission, an as selectionIncludes, bn as combinationWorking, ct as buildRegistrationSelectionRequest, dn as selectionTicketInputs, dt as resolveEventRequiresPayment, ft as resolveRegistrationTarget, gn as toggleSelectionItem, gt as createRegistrationDraftData, hn as summariseSelectionPayment, ht as beginWaitlistInvitation, ir as normalizeTicketSelectionLines, j as decideEventChoice, jt as paymentReturnRestoration, kt as eventSignInRestoration, lt as findPreSelectedEvent, mc as resolveBookingSignupOffer, mn as severalRunsChoiceMessage, mt as toRegistrationRequestSubject, oc as decideSelectionAttendance, on as selectionItemPrice, pn as severalItemsOf, pt as resolveRouteRequiresPayment, qn as getTicketSelectionRemainingPlaces, qt as incompleteRunChoiceMessage, rr as hasValidPricingOptionSelection, rt as calculateEventRegistrationPreviewTotal, ut as resolveDiscountContext, vt as registrationQuestionsMessage, w as registrationPaymentRoute, wn as selectionPreviewLines, xn as selectionCombinationHint, yn as combinationOffersOf, yt as validateFormData, z as getTicketSelectionPurpose, zi as bookingQuestionsPaymentSnapshotSchema, zt as runsKeepingAnswers } from "./display-lL-YRApN.mjs";
|
|
3
|
+
import { Gt as inferSiteDateLocale, rn as resolveBookingBusinessTimeZone } from "./noop-CN0o0yjH.mjs";
|
|
4
4
|
import { o as checkBookingQuestionsAnswered, p as assertNever } from "./creditProducts-BTRX4edc.mjs";
|
|
5
|
-
import { a as siteTermsFailureKind, o as useSiteTermsAgreement, s as eventSiteTermsSurface } from "./DemoBookingPortalAccess-
|
|
5
|
+
import { a as siteTermsFailureKind, o as useSiteTermsAgreement, s as eventSiteTermsSurface } from "./DemoBookingPortalAccess-CARUWQ_E.mjs";
|
|
6
6
|
import { t as generateUuidV4 } from "./uuid-BETKW8rS.mjs";
|
|
7
|
-
import { i as BlockApiError, n as useBlockApi } from "./context-
|
|
7
|
+
import { i as BlockApiError, n as useBlockApi } from "./context-D0KCgbOq.mjs";
|
|
8
8
|
import { t as resolveDedicatedBookingHref } from "./bookingRoute-D6DlxYx6.mjs";
|
|
9
|
-
import { i as useBookingNowIso, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-
|
|
10
|
-
import { t as useDiscountCodeUi } from "./useDiscountCodeUi-
|
|
11
|
-
import { a as usePolling, c as useBookingQuestionsRefresh, o as portalSessionIdentity, s as useSignInReturn } from "./BookingMailingListNote-
|
|
9
|
+
import { i as useBookingNowIso, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-BewbU_cV.mjs";
|
|
10
|
+
import { t as useDiscountCodeUi } from "./useDiscountCodeUi-Cyy0meCH.mjs";
|
|
11
|
+
import { a as usePolling, c as useBookingQuestionsRefresh, o as portalSessionIdentity, s as useSignInReturn } from "./BookingMailingListNote-LHQMODqB.mjs";
|
|
12
12
|
import { n as EVENT_REGISTRATION_CHECKOUT_ATTEMPT_PARAM, t as EVENT_REGISTRATION_ANCHOR_ID } from "./constants-4o4_hl34.mjs";
|
|
13
|
-
import { o as storeDemoBookingPass, t as CUSTOMER_PORTAL_PATH } from "./demoPortalMagicLink-
|
|
13
|
+
import { o as storeDemoBookingPass, t as CUSTOMER_PORTAL_PATH } from "./demoPortalMagicLink-CL7KGRta.mjs";
|
|
14
|
+
import { t as DISCOUNT_APPLY_MESSAGES } from "./useDiscountApply-Dq-wjb1d.mjs";
|
|
14
15
|
import { Suspense, lazy, useCallback, useEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
15
16
|
import { jsx } from "react/jsx-runtime";
|
|
16
17
|
import { z } from "zod";
|
|
@@ -146,6 +147,40 @@ function logoutPortal(anchorId) {
|
|
|
146
147
|
form.submit();
|
|
147
148
|
}
|
|
148
149
|
//#endregion
|
|
150
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountView.state.ts
|
|
151
|
+
/** One selection chooses one discount authority; singleton callers retain their existing discovery. */
|
|
152
|
+
function registrationDiscountView(input) {
|
|
153
|
+
if (!input.several) return {
|
|
154
|
+
code: input.single.discountCode,
|
|
155
|
+
editCode: input.single.setDiscountCode,
|
|
156
|
+
submittedCode: input.single.discountCode,
|
|
157
|
+
paymentDraftCode: input.single.discountCode,
|
|
158
|
+
manualCodeEntryAllowed: input.context !== null && input.single.manualCodeEntryAllowed,
|
|
159
|
+
discountsAvailableLoading: input.single.discountsAvailableLoading,
|
|
160
|
+
discountsAvailable: input.single.discountsAvailable,
|
|
161
|
+
autoAppliedDiscount: input.single.autoAppliedDiscount,
|
|
162
|
+
several: false,
|
|
163
|
+
editingCode: false
|
|
164
|
+
};
|
|
165
|
+
const { selection } = input;
|
|
166
|
+
return {
|
|
167
|
+
code: selection.draftCode,
|
|
168
|
+
editCode: selection.editCode,
|
|
169
|
+
submittedCode: selection.decidedCode ?? "",
|
|
170
|
+
paymentDraftCode: "",
|
|
171
|
+
manualCodeEntryAllowed: selection.manualCodeEntryAllowed,
|
|
172
|
+
discountsAvailableLoading: selection.state.status === "pending" && !selection.draftCode.trim(),
|
|
173
|
+
discountsAvailable: selection.manualCodeEntryAllowed || selection.quote?.preview.type === "applied",
|
|
174
|
+
autoAppliedDiscount: null,
|
|
175
|
+
several: true,
|
|
176
|
+
editingCode: Boolean(selection.draftCode.trim())
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
/** A draft code must remain editable while its price is unresolved and payment choices are disabled. */
|
|
180
|
+
function registrationDiscountEntryVisible(view, method) {
|
|
181
|
+
return (view.manualCodeEntryAllowed || view.editingCode) && (view.several || method === "stripe" || method === "pass_bundle" || method === "membership_bundle");
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
149
184
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.ts
|
|
150
185
|
function resolveRegistrationRecoveryAction(step, action) {
|
|
151
186
|
if (step === "payment-failed") return "payment-options";
|
|
@@ -255,8 +290,10 @@ function useRegistrationAdmission(input) {
|
|
|
255
290
|
const { admission, isAuthenticated, dispatchFlow } = input;
|
|
256
291
|
const ticketContinuation = resolveRegistrationTicketContinuation({
|
|
257
292
|
admission,
|
|
293
|
+
slidingScaleSelectionMessage: input.slidingScaleSelectionMessage,
|
|
258
294
|
ticketSelectionRequired: input.ticketSelectionRequired,
|
|
259
295
|
hasValidTicketSelection: input.hasValidTicketSelection,
|
|
296
|
+
selectionChoiceMessage: input.selectionChoiceMessage,
|
|
260
297
|
isCheckingExistingRegistration: isAuthenticated && input.existingRegistrationLoading
|
|
261
298
|
});
|
|
262
299
|
const handleTicketsComplete = () => {
|
|
@@ -290,7 +327,8 @@ function eventTarget(event) {
|
|
|
290
327
|
*/
|
|
291
328
|
function useEventRegistrationQuestions(input) {
|
|
292
329
|
const { api, flow, dispatch, event, identity } = input;
|
|
293
|
-
const
|
|
330
|
+
const stored = flow.draft.bookingQuestions;
|
|
331
|
+
const answers = useMemo(() => input.offersKeptAnswers ? stored : withoutKeptAnswers(stored), [stored, input.offersKeptAnswers]);
|
|
294
332
|
const target = useMemo(() => eventTarget(event), [event]);
|
|
295
333
|
const view = useMemo(() => deriveBookingQuestions(answers, target, identity), [
|
|
296
334
|
answers,
|
|
@@ -352,7 +390,7 @@ function useEventRegistrationQuestions(input) {
|
|
|
352
390
|
* be found again.
|
|
353
391
|
*/
|
|
354
392
|
function useEventSignInReturn(input) {
|
|
355
|
-
const { flow, discountCode, dispatch,
|
|
393
|
+
const { flow, discountCode, dispatch, restoreDiscountCode } = input;
|
|
356
394
|
const events = input.eventSource.kind === "ready" ? input.registrationEvents : null;
|
|
357
395
|
const source = useMemo(() => ({
|
|
358
396
|
flow,
|
|
@@ -364,11 +402,11 @@ function useEventSignInReturn(input) {
|
|
|
364
402
|
type: "sign-in-draft-restored",
|
|
365
403
|
restoration
|
|
366
404
|
});
|
|
367
|
-
if (restoration.selectionFound)
|
|
405
|
+
if (restoration.selectionFound) restoreDiscountCode(draft.discountCode);
|
|
368
406
|
}, [
|
|
369
407
|
dispatch,
|
|
370
408
|
events,
|
|
371
|
-
|
|
409
|
+
restoreDiscountCode
|
|
372
410
|
]);
|
|
373
411
|
return useSignInReturn({
|
|
374
412
|
siteId: input.siteId ?? "",
|
|
@@ -386,28 +424,145 @@ function useEventSignInReturn(input) {
|
|
|
386
424
|
});
|
|
387
425
|
}
|
|
388
426
|
//#endregion
|
|
389
|
-
//#region ../blocks/src/system/runtime/nodes/event-registration/
|
|
427
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useSelectionRequirements.ts
|
|
428
|
+
const NO_VIEWS = [];
|
|
390
429
|
/**
|
|
391
|
-
*
|
|
392
|
-
*
|
|
430
|
+
* Several runs' questions and agreement (issue 1725): one section per run
|
|
431
|
+
* when they differ, with each run's own signed-in read, and the requirements
|
|
432
|
+
* the booking request sends for any runs selection.
|
|
393
433
|
*/
|
|
394
|
-
function
|
|
434
|
+
function useSelectionRequirements(input) {
|
|
435
|
+
const { flow, dispatch, layout, identity } = input;
|
|
436
|
+
const state = flow.draft.runRequirements;
|
|
437
|
+
const runs = layout.kind === "per_run" ? layout.runs : null;
|
|
438
|
+
const views = useMemo(() => runs ? deriveRunRequirements(state, runs, identity) : NO_VIEWS, [
|
|
439
|
+
state,
|
|
440
|
+
runs,
|
|
441
|
+
identity
|
|
442
|
+
]);
|
|
443
|
+
useRunQuestionsRefresh({
|
|
444
|
+
api: input.api,
|
|
445
|
+
next: runs ? nextRunToRead(state, runs, identity) : null,
|
|
446
|
+
identity,
|
|
447
|
+
dispatch
|
|
448
|
+
});
|
|
449
|
+
const dispatchRun = useCallback((seriesId, event) => dispatch({
|
|
450
|
+
type: "run-requirements",
|
|
451
|
+
seriesId,
|
|
452
|
+
event
|
|
453
|
+
}), [dispatch]);
|
|
395
454
|
return {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
455
|
+
layout,
|
|
456
|
+
submission: buildSelectionRequirementsSubmission({
|
|
457
|
+
layout,
|
|
458
|
+
shared: {
|
|
459
|
+
questions: input.sharedQuestions,
|
|
460
|
+
consentAccepted: input.consentAccepted
|
|
461
|
+
},
|
|
462
|
+
runs: views
|
|
463
|
+
}),
|
|
464
|
+
runSnapshots: layout.kind === "per_run" ? toRunRequirementsSnapshots(state, views) : void 0,
|
|
465
|
+
checkRuns: () => layout.kind === "per_run" ? checkRunRequirements(views) : null,
|
|
466
|
+
sections: (consentErrors) => views.map((view) => runSection({
|
|
467
|
+
view,
|
|
468
|
+
consentErrors,
|
|
469
|
+
fieldErrors: flow.questionFieldErrors,
|
|
470
|
+
signIn: input.signIn,
|
|
471
|
+
identity,
|
|
472
|
+
dispatchRun
|
|
473
|
+
})),
|
|
474
|
+
keepRefused: () => {
|
|
475
|
+
if (layout.kind !== "per_run") return input.sharedKeepRefused();
|
|
476
|
+
for (const view of runsKeepingAnswers(views)) dispatchRun(view.run.seriesId, {
|
|
477
|
+
type: "questions",
|
|
478
|
+
event: {
|
|
479
|
+
type: "booking-questions-keep-refused",
|
|
480
|
+
scope: view.questions.scope
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}
|
|
409
484
|
};
|
|
410
485
|
}
|
|
486
|
+
function runSection(input) {
|
|
487
|
+
const { view, dispatchRun } = input;
|
|
488
|
+
const seriesId = view.run.seriesId;
|
|
489
|
+
const { questions } = view;
|
|
490
|
+
const answer = (event) => dispatchRun(seriesId, {
|
|
491
|
+
type: "questions",
|
|
492
|
+
event
|
|
493
|
+
});
|
|
494
|
+
const asks = questions.presentation.kind !== "none";
|
|
495
|
+
return {
|
|
496
|
+
seriesId,
|
|
497
|
+
title: view.run.title,
|
|
498
|
+
bookingQuestions: asks ? {
|
|
499
|
+
signInReturnPath: input.signIn.signInReturnPath,
|
|
500
|
+
endSignInReturn: input.signIn.endSignInReturn,
|
|
501
|
+
presentation: questions.presentation,
|
|
502
|
+
values: questions.values,
|
|
503
|
+
answerMode: questions.answerMode,
|
|
504
|
+
submission: questions.submission,
|
|
505
|
+
fieldErrors: runFieldErrors(input.fieldErrors, seriesId, questions.presentation),
|
|
506
|
+
answer: (fieldId, value) => answer({
|
|
507
|
+
type: "booking-question-answered",
|
|
508
|
+
scope: questions.scope,
|
|
509
|
+
fieldId,
|
|
510
|
+
value
|
|
511
|
+
}),
|
|
512
|
+
chooseAnswerMode: (mode) => answer({
|
|
513
|
+
type: "booking-questions-answer-mode-set",
|
|
514
|
+
scope: questions.scope,
|
|
515
|
+
mode
|
|
516
|
+
}),
|
|
517
|
+
keepRefused: () => answer({
|
|
518
|
+
type: "booking-questions-keep-refused",
|
|
519
|
+
scope: questions.scope
|
|
520
|
+
})
|
|
521
|
+
} : null,
|
|
522
|
+
consent: view.consent,
|
|
523
|
+
consentAccepted: view.consentAccepted,
|
|
524
|
+
consentError: view.consentAccepted ? void 0 : input.consentErrors[seriesId],
|
|
525
|
+
onConsentChange: (accepted) => dispatchRun(seriesId, accepted && view.consent ? {
|
|
526
|
+
type: "consent-accepted",
|
|
527
|
+
consent: view.consent,
|
|
528
|
+
identity: input.identity
|
|
529
|
+
} : { type: "consent-withdrawn" })
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Each run's signed-in read, one run at a time: once a run's read lands or
|
|
534
|
+
* fails, `nextRunToRead` moves on to the next run that still needs one.
|
|
535
|
+
*/
|
|
536
|
+
function useRunQuestionsRefresh(input) {
|
|
537
|
+
const { dispatch, identity, next } = input;
|
|
538
|
+
const dispatchRefreshed = useCallback((event) => dispatch({
|
|
539
|
+
type: "run-requirements",
|
|
540
|
+
seriesId: event.targetKey,
|
|
541
|
+
event: {
|
|
542
|
+
type: "questions",
|
|
543
|
+
event
|
|
544
|
+
}
|
|
545
|
+
}), [dispatch]);
|
|
546
|
+
const dispatchFailed = useCallback((failure) => dispatch({
|
|
547
|
+
type: "run-requirements",
|
|
548
|
+
seriesId: failure.targetKey,
|
|
549
|
+
event: {
|
|
550
|
+
type: "questions-read-failed",
|
|
551
|
+
identity: failure.identity
|
|
552
|
+
}
|
|
553
|
+
}), [dispatch]);
|
|
554
|
+
useBookingQuestionsRefresh({
|
|
555
|
+
api: input.api,
|
|
556
|
+
target: next ? {
|
|
557
|
+
kind: "event_series",
|
|
558
|
+
eventSeriesId: next
|
|
559
|
+
} : null,
|
|
560
|
+
targetKey: next,
|
|
561
|
+
identity,
|
|
562
|
+
dispatch: dispatchRefreshed,
|
|
563
|
+
onFailed: dispatchFailed
|
|
564
|
+
});
|
|
565
|
+
}
|
|
411
566
|
//#endregion
|
|
412
567
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useTicketSelectionInitialization.ts
|
|
413
568
|
/** Pick the single default once; removing or refreshing a line never picks it again. */
|
|
@@ -860,15 +1015,14 @@ const paymentSelection = z.discriminatedUnion("method", [
|
|
|
860
1015
|
productInterval: z.string().optional()
|
|
861
1016
|
})
|
|
862
1017
|
]);
|
|
863
|
-
const
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
})]),
|
|
1018
|
+
const reference = z.discriminatedUnion("scope", [z.object({
|
|
1019
|
+
scope: z.literal("occurrence"),
|
|
1020
|
+
attendeeId: z.string()
|
|
1021
|
+
}), z.object({
|
|
1022
|
+
scope: z.literal("wholeSeries"),
|
|
1023
|
+
registrationId: z.string()
|
|
1024
|
+
})]);
|
|
1025
|
+
const shared = {
|
|
872
1026
|
formData: z.object({
|
|
873
1027
|
name: z.string(),
|
|
874
1028
|
email: z.string(),
|
|
@@ -881,7 +1035,6 @@ const schema = z.object({
|
|
|
881
1035
|
pricingOptionId: z.string().nullable(),
|
|
882
1036
|
quantity: z.number().int().positive()
|
|
883
1037
|
})).min(1),
|
|
884
|
-
selectedEventId: z.string().nullable(),
|
|
885
1038
|
selectedAttendanceMode: z.enum(["in_person", "online"]).nullable().optional(),
|
|
886
1039
|
paymentSelection,
|
|
887
1040
|
guests: z.array(z.object({
|
|
@@ -894,16 +1047,38 @@ const schema = z.object({
|
|
|
894
1047
|
mailingListSignupNote: z.enum(["confirmation_required", "not_confirmed"]).optional(),
|
|
895
1048
|
bookingQuestions: bookingQuestionsPaymentSnapshotSchema.optional(),
|
|
896
1049
|
timestamp: z.number().finite()
|
|
1050
|
+
};
|
|
1051
|
+
const currentSchema = z.object({
|
|
1052
|
+
...shared,
|
|
1053
|
+
version: z.literal(7),
|
|
1054
|
+
selectedEventIds: z.array(z.string()),
|
|
1055
|
+
runChoices: z.record(z.string(), z.object({
|
|
1056
|
+
pricingOptionId: z.string().nullable(),
|
|
1057
|
+
slidingAmountInput: z.string()
|
|
1058
|
+
})).optional(),
|
|
1059
|
+
runRequirements: z.record(z.string(), runRequirementsSnapshotSchema).optional()
|
|
897
1060
|
});
|
|
1061
|
+
/** Saved before booking several existed: one reference and one event. */
|
|
1062
|
+
const version6Schema = z.object({
|
|
1063
|
+
...shared,
|
|
1064
|
+
version: z.literal(6),
|
|
1065
|
+
reference,
|
|
1066
|
+
selectedEventId: z.string().nullable()
|
|
1067
|
+
}).transform(({ reference: _reference, selectedEventId, ...rest }) => ({
|
|
1068
|
+
...rest,
|
|
1069
|
+
version: 7,
|
|
1070
|
+
selectedEventIds: selectedEventId === null ? [] : [selectedEventId]
|
|
1071
|
+
}));
|
|
1072
|
+
const schema = z.union([currentSchema, version6Schema]);
|
|
898
1073
|
function key(siteId, submissionId) {
|
|
899
1074
|
return `${STORAGE_PREFIX}${siteId}:${submissionId}`;
|
|
900
1075
|
}
|
|
901
1076
|
function savePendingRegistration(siteId, submissionId, data) {
|
|
902
1077
|
try {
|
|
903
|
-
const entry = z.safeParse(
|
|
1078
|
+
const entry = z.safeParse(currentSchema, {
|
|
904
1079
|
...data,
|
|
905
1080
|
ticketSelections: normalizeTicketSelectionLines(data.ticketSelections),
|
|
906
|
-
version:
|
|
1081
|
+
version: 7,
|
|
907
1082
|
timestamp: Date.now()
|
|
908
1083
|
});
|
|
909
1084
|
if (entry.success) sessionStorage.setItem(key(siteId, submissionId), JSON.stringify(entry.data));
|
|
@@ -990,15 +1165,23 @@ function clearEventPayment(siteId) {
|
|
|
990
1165
|
}
|
|
991
1166
|
//#endregion
|
|
992
1167
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorPresentation.ts
|
|
1168
|
+
/** The tag the server gives a refused booking request, with a message meant for the booker. */
|
|
1169
|
+
const REFUSED_INPUT_TAG = "REGISTRATION_INVALID_INPUT";
|
|
993
1170
|
function parseEventRegistrationFailure(error) {
|
|
994
1171
|
return {
|
|
995
1172
|
...parseBookingSubmissionFailure(error, "Something went wrong. Please try again."),
|
|
996
1173
|
reason: error instanceof BlockApiError ? parseEventRegistrationErrorReason(error.tag) : null,
|
|
997
1174
|
siteTermsFailure: siteTermsFailureKind(error),
|
|
998
|
-
isClientError: error instanceof BlockApiError && error.status < 500 && error.code !== "invalid_booking_response"
|
|
1175
|
+
isClientError: error instanceof BlockApiError && error.status < 500 && error.code !== "invalid_booking_response",
|
|
1176
|
+
refusedInput: error instanceof BlockApiError && error.tag === REFUSED_INPUT_TAG && error.message.trim().length > 0
|
|
999
1177
|
};
|
|
1000
1178
|
}
|
|
1001
|
-
|
|
1179
|
+
/**
|
|
1180
|
+
* What the booker reads when a booking is refused. Booking several items
|
|
1181
|
+
* (issue 1725) shows the server's own refusal ("Book one run at a time for
|
|
1182
|
+
* this course.") rather than the general one, since it says what to change.
|
|
1183
|
+
*/
|
|
1184
|
+
function registrationErrorPresentation(failure, bookings = "one") {
|
|
1002
1185
|
if (failure.reason === "invalidAnswers" || failure.answersNeeded || Object.keys(failure.questionFieldErrors).length > 0) return {
|
|
1003
1186
|
message: failure.message,
|
|
1004
1187
|
action: "details"
|
|
@@ -1014,7 +1197,7 @@ function registrationErrorPresentation(failure) {
|
|
|
1014
1197
|
if (failure.isClientError) {
|
|
1015
1198
|
const { message, action } = eventRegistrationErrors.invalidCommitInput;
|
|
1016
1199
|
return {
|
|
1017
|
-
message,
|
|
1200
|
+
message: bookings === "several" && failure.refusedInput ? failure.message : message,
|
|
1018
1201
|
action
|
|
1019
1202
|
};
|
|
1020
1203
|
}
|
|
@@ -1037,6 +1220,14 @@ function useEventRegistrationSubmit(options) {
|
|
|
1037
1220
|
}
|
|
1038
1221
|
/** Submission can only allocate a command after its target and invitation are decided. */
|
|
1039
1222
|
function resolveSubmissionStart(options) {
|
|
1223
|
+
if (options.quoteReady === false) return {
|
|
1224
|
+
kind: "blocked",
|
|
1225
|
+
result: {
|
|
1226
|
+
ok: false,
|
|
1227
|
+
reason: "blocked",
|
|
1228
|
+
message: "Apply your code before checkout."
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1040
1231
|
if (options.invitation.kind === "blocked") return {
|
|
1041
1232
|
kind: "blocked",
|
|
1042
1233
|
result: {
|
|
@@ -1125,7 +1316,7 @@ async function completeRegistrationSubmission(options, deps, prepared, result) {
|
|
|
1125
1316
|
outcome: { kind: "payment_status" }
|
|
1126
1317
|
};
|
|
1127
1318
|
case "checkoutRequired":
|
|
1128
|
-
savePendingCheckout(options, deps, prepared, result.submissionId, result.
|
|
1319
|
+
savePendingCheckout(options, deps, prepared, result.submissionId, result.mailingListSignupNote);
|
|
1129
1320
|
const subject = result.reference.scope === "occurrence" ? {
|
|
1130
1321
|
scope: "occurrence",
|
|
1131
1322
|
attendeeId: result.reference.attendeeId,
|
|
@@ -1156,6 +1347,7 @@ async function completeRegistrationSubmission(options, deps, prepared, result) {
|
|
|
1156
1347
|
options.complete({
|
|
1157
1348
|
status: "confirmed",
|
|
1158
1349
|
outcome: result.outcome,
|
|
1350
|
+
...result.outcomes ? { outcomes: result.outcomes } : {},
|
|
1159
1351
|
message: result.summary.passCreditsRemaining !== void 0 ? result.summary.message : void 0,
|
|
1160
1352
|
mailingListSignupNote: result.mailingListSignupNote
|
|
1161
1353
|
});
|
|
@@ -1191,7 +1383,13 @@ function prepareSubmitContext(options, registrationCommandId, target, method, pa
|
|
|
1191
1383
|
email: guest.email?.trim().toLowerCase() || void 0,
|
|
1192
1384
|
phone: guest.phone?.trim() || void 0
|
|
1193
1385
|
})) : void 0,
|
|
1194
|
-
|
|
1386
|
+
selection: buildRegistrationSelectionRequest({
|
|
1387
|
+
target,
|
|
1388
|
+
attendanceMode: options.selectedAttendanceMode,
|
|
1389
|
+
runChoices: options.runChoices,
|
|
1390
|
+
places: ticketSelections.reduce((sum, line) => sum + line.quantity, 0),
|
|
1391
|
+
requirements: options.requirements
|
|
1392
|
+
})
|
|
1195
1393
|
};
|
|
1196
1394
|
}
|
|
1197
1395
|
function resolveSelectionSnapshot(method, passId, membershipId, bundleProductId, selection) {
|
|
@@ -1215,21 +1413,22 @@ function resolveSelectionSnapshot(method, passId, membershipId, bundleProductId,
|
|
|
1215
1413
|
if (method === "free") return { method };
|
|
1216
1414
|
throw new Error("Choose an available payment option.");
|
|
1217
1415
|
}
|
|
1218
|
-
function savePendingCheckout(options, deps, prepared, checkoutAttemptId,
|
|
1416
|
+
function savePendingCheckout(options, deps, prepared, checkoutAttemptId, mailingListSignupNote) {
|
|
1219
1417
|
const siteId = options.api.config.siteId;
|
|
1220
1418
|
if (!siteId) return;
|
|
1221
1419
|
deps.savePendingRegistration(siteId, checkoutAttemptId, {
|
|
1222
|
-
reference,
|
|
1223
1420
|
formData: options.formData,
|
|
1224
1421
|
ticketSelections: prepared.ticketSelections,
|
|
1225
|
-
|
|
1422
|
+
selectedEventIds: options.registrationTarget?.selectedEventIds ?? [],
|
|
1423
|
+
runChoices: options.runChoices,
|
|
1226
1424
|
selectedAttendanceMode: options.selectedAttendanceMode,
|
|
1227
1425
|
paymentSelection: prepared.selectionSnapshot,
|
|
1228
1426
|
guests: options.guests,
|
|
1229
1427
|
selectedSlidingAmount: options.selectedSlidingAmount,
|
|
1230
1428
|
discountCode: options.discountCode,
|
|
1231
1429
|
mailingListSignupNote,
|
|
1232
|
-
...options.bookingQuestionsSnapshot ? { bookingQuestions: options.bookingQuestionsSnapshot } : {}
|
|
1430
|
+
...options.bookingQuestionsSnapshot ? { bookingQuestions: options.bookingQuestionsSnapshot } : {},
|
|
1431
|
+
...options.runRequirementsSnapshots ? { runRequirements: options.runRequirementsSnapshots } : {}
|
|
1233
1432
|
});
|
|
1234
1433
|
}
|
|
1235
1434
|
function registrationRequestIntentKey(request) {
|
|
@@ -1250,15 +1449,14 @@ function buildRegistrationRequest(options, prepared, invitation, method, passId,
|
|
|
1250
1449
|
discountCode: options.discountCode.trim() || void 0,
|
|
1251
1450
|
collectionOptionKind: prepared.selectionSnapshot.method === "stripe" ? prepared.selectionSnapshot.collectionOptionKind : void 0
|
|
1252
1451
|
},
|
|
1253
|
-
|
|
1452
|
+
selection: prepared.selection,
|
|
1254
1453
|
ticketSelections: toTicketSelectionRequests(prepared.ticketSelections),
|
|
1255
1454
|
selectedSlidingAmount: options.selectedSlidingAmount ?? void 0,
|
|
1256
1455
|
email: options.formData.email.trim().toLowerCase(),
|
|
1257
1456
|
name: options.formData.name.trim(),
|
|
1258
1457
|
phone: options.formData.phone.trim() || void 0,
|
|
1259
1458
|
notes: options.formData.notes.trim() || void 0,
|
|
1260
|
-
|
|
1261
|
-
bookingQuestions: options.bookingQuestions,
|
|
1459
|
+
...singleBookingRequirements(options, prepared),
|
|
1262
1460
|
mailingListOptIn: wantsMailingListSignup(options),
|
|
1263
1461
|
paymentMethod: method,
|
|
1264
1462
|
customerPassId: method === "pass" ? passId : void 0,
|
|
@@ -1268,6 +1466,16 @@ function buildRegistrationRequest(options, prepared, invitation, method, passId,
|
|
|
1268
1466
|
guests: prepared.guestsPayload
|
|
1269
1467
|
};
|
|
1270
1468
|
}
|
|
1469
|
+
/**
|
|
1470
|
+
* A single booking (or several dates) sends its answers and agreement at the
|
|
1471
|
+
* top of the request; several runs send theirs inside the selection instead.
|
|
1472
|
+
*/
|
|
1473
|
+
function singleBookingRequirements(options, prepared) {
|
|
1474
|
+
return prepared.selection.kind === "runs" && prepared.selection.requirements !== void 0 ? {} : {
|
|
1475
|
+
consentAccepted: options.formData.consentAccepted,
|
|
1476
|
+
bookingQuestions: options.bookingQuestions
|
|
1477
|
+
};
|
|
1478
|
+
}
|
|
1271
1479
|
function invitationRequestCredential(credential) {
|
|
1272
1480
|
if (!credential) return {};
|
|
1273
1481
|
switch (credential.kind) {
|
|
@@ -1281,10 +1489,14 @@ function failedRegistrationStep(failure, method) {
|
|
|
1281
1489
|
if (!failure.siteTermsFailure) return "error";
|
|
1282
1490
|
return method === "pass_bundle" || method === "membership_bundle" ? "select-payment" : "enter-details";
|
|
1283
1491
|
}
|
|
1492
|
+
function bookingCount(target) {
|
|
1493
|
+
const selection = target?.selection;
|
|
1494
|
+
return (selection?.kind === "runs" ? selection.eventSeriesIds.length : selection?.occurrenceIds.length ?? 1) > 1 ? "several" : "one";
|
|
1495
|
+
}
|
|
1284
1496
|
/** Keep feedback, field errors and navigation together when a submission fails. */
|
|
1285
1497
|
function reportFailedRegistration(options, error, method) {
|
|
1286
1498
|
const parsed = parseEventRegistrationFailure(error);
|
|
1287
|
-
const { message, action } = registrationErrorPresentation(parsed);
|
|
1499
|
+
const { message, action } = registrationErrorPresentation(parsed, bookingCount(options.registrationTarget));
|
|
1288
1500
|
const failure = {
|
|
1289
1501
|
message,
|
|
1290
1502
|
questionFieldErrors: parsed.questionFieldErrors,
|
|
@@ -1301,6 +1513,245 @@ function reportFailedRegistration(options, error, method) {
|
|
|
1301
1513
|
};
|
|
1302
1514
|
}
|
|
1303
1515
|
//#endregion
|
|
1516
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/selectionQuote.state.ts
|
|
1517
|
+
const emptyQuoteDraft = (key, draftCode = "") => ({
|
|
1518
|
+
key,
|
|
1519
|
+
draftCode,
|
|
1520
|
+
manualCodeEntryAllowed: false,
|
|
1521
|
+
status: "draft"
|
|
1522
|
+
});
|
|
1523
|
+
function quoteFeedback(state) {
|
|
1524
|
+
if (state.status === "refused") return {
|
|
1525
|
+
tone: "error",
|
|
1526
|
+
message: state.message
|
|
1527
|
+
};
|
|
1528
|
+
return state.status === "priced" && state.draftCode.trim() ? {
|
|
1529
|
+
tone: "success",
|
|
1530
|
+
message: "Code applied."
|
|
1531
|
+
} : null;
|
|
1532
|
+
}
|
|
1533
|
+
/** A quote belongs to the complete priced input and the customer, never just the draft code. */
|
|
1534
|
+
function selectionQuoteKey(lines, email) {
|
|
1535
|
+
return lines ? JSON.stringify([selectionPreviewKey(null, lines), email.trim().toLowerCase()]) : null;
|
|
1536
|
+
}
|
|
1537
|
+
function currentSelectionQuote(state, key) {
|
|
1538
|
+
return state.key === key ? state : emptyQuoteDraft(key, state.draftCode);
|
|
1539
|
+
}
|
|
1540
|
+
function editedSelectionCode(state, key, draftCode) {
|
|
1541
|
+
const same = state.key === key;
|
|
1542
|
+
return {
|
|
1543
|
+
...emptyQuoteDraft(key, draftCode),
|
|
1544
|
+
manualCodeEntryAllowed: same && state.manualCodeEntryAllowed,
|
|
1545
|
+
...same && state.uncoded ? { uncoded: state.uncoded } : {}
|
|
1546
|
+
};
|
|
1547
|
+
}
|
|
1548
|
+
function decideSelectionQuoteResponse(pending, result) {
|
|
1549
|
+
const typed = Boolean(pending.draftCode.trim());
|
|
1550
|
+
if (result.type === "rejected") return typed && result.reason === "invalid_or_not_applicable" ? {
|
|
1551
|
+
...pending,
|
|
1552
|
+
status: "refused",
|
|
1553
|
+
message: result.message
|
|
1554
|
+
} : {
|
|
1555
|
+
...pending,
|
|
1556
|
+
status: "failed"
|
|
1557
|
+
};
|
|
1558
|
+
if (typed && result.type !== "applied") return {
|
|
1559
|
+
...pending,
|
|
1560
|
+
status: "failed"
|
|
1561
|
+
};
|
|
1562
|
+
return {
|
|
1563
|
+
...pending,
|
|
1564
|
+
status: "priced",
|
|
1565
|
+
preview: result,
|
|
1566
|
+
...typed ? {} : { uncoded: result },
|
|
1567
|
+
manualCodeEntryAllowed: result.manualCodeEntryAllowed ?? pending.manualCodeEntryAllowed,
|
|
1568
|
+
decidedCode: typed && result.type === "applied" ? result.code : void 0
|
|
1569
|
+
};
|
|
1570
|
+
}
|
|
1571
|
+
/**
|
|
1572
|
+
* Whether to ask the server now, without the visitor pressing Apply: for the
|
|
1573
|
+
* automatic code, or for a code the visitor typed before (in one item's box,
|
|
1574
|
+
* or before going to Stripe and coming back), which they've already applied
|
|
1575
|
+
* as far as they know. A code typed here waits for Apply.
|
|
1576
|
+
*/
|
|
1577
|
+
function automaticSelectionQuoteWanted(state, wanted, carried = false) {
|
|
1578
|
+
return wanted && state.status === "draft" && (carried || !state.draftCode.trim());
|
|
1579
|
+
}
|
|
1580
|
+
/** Nothing to price: no code or automatic discount can change a free selection. */
|
|
1581
|
+
function freeSelection(input) {
|
|
1582
|
+
return input.several !== null && input.price.listTotalCents === 0;
|
|
1583
|
+
}
|
|
1584
|
+
function selectionPayable(input, state) {
|
|
1585
|
+
if (input.several === null || freeSelection(input)) return input.price.totalCents;
|
|
1586
|
+
if (input.payment.kind === "payment") return serverPricedTotalCents({
|
|
1587
|
+
listTotalCents: input.price.listTotalCents,
|
|
1588
|
+
reductions: input.payment.checkout.priceReductions ?? []
|
|
1589
|
+
});
|
|
1590
|
+
return pricedPreview(state)?.totalAfterDiscountCents ?? null;
|
|
1591
|
+
}
|
|
1592
|
+
/** The price to show and charge: the decided quote, or after a refused code, the price without it. */
|
|
1593
|
+
function pricedPreview(state) {
|
|
1594
|
+
if (state.status === "priced") return state.preview;
|
|
1595
|
+
return state.status === "refused" ? state.uncoded ?? null : null;
|
|
1596
|
+
}
|
|
1597
|
+
/** The only projection that can expose a selection's payable total and submitted code. */
|
|
1598
|
+
function decidedSelectionPricing(input, state, apply) {
|
|
1599
|
+
const priced = state.status === "priced" ? state : null;
|
|
1600
|
+
const fallback = priced === null ? pricedPreview(state) : null;
|
|
1601
|
+
const settled = input.several === null || priced !== null || fallback !== null || freeSelection(input);
|
|
1602
|
+
const quoting = !settled && input.automaticWanted && serverDeciding(state);
|
|
1603
|
+
return {
|
|
1604
|
+
state,
|
|
1605
|
+
quote: selectionQuoteOf(priced) ?? (fallback ? {
|
|
1606
|
+
preview: fallback,
|
|
1607
|
+
source: "automatic"
|
|
1608
|
+
} : null),
|
|
1609
|
+
draftCode: state.draftCode,
|
|
1610
|
+
decidedCode: priced?.decidedCode,
|
|
1611
|
+
ready: settled,
|
|
1612
|
+
payableCents: selectionPayable(input, state),
|
|
1613
|
+
quoting,
|
|
1614
|
+
/** The visitor has to apply, change or remove the code, or try again, before there's a price. */
|
|
1615
|
+
awaitingVisitor: !settled && input.automaticWanted && !quoting,
|
|
1616
|
+
manualCodeEntryAllowed: state.manualCodeEntryAllowed,
|
|
1617
|
+
codeField: input.several === null ? null : codeFieldFor(state, apply)
|
|
1618
|
+
};
|
|
1619
|
+
}
|
|
1620
|
+
/** A request is out, or about to go for the automatic code; the other states wait for the visitor. */
|
|
1621
|
+
function serverDeciding(state) {
|
|
1622
|
+
return state.status === "pending" || state.status === "draft" && !state.draftCode.trim();
|
|
1623
|
+
}
|
|
1624
|
+
function selectionQuoteOf(priced) {
|
|
1625
|
+
return priced ? {
|
|
1626
|
+
preview: priced.preview,
|
|
1627
|
+
source: priced.draftCode.trim() ? "typed" : "automatic"
|
|
1628
|
+
} : null;
|
|
1629
|
+
}
|
|
1630
|
+
function codeFieldFor(state, apply) {
|
|
1631
|
+
return {
|
|
1632
|
+
apply,
|
|
1633
|
+
applying: state.status === "pending",
|
|
1634
|
+
failed: state.status === "failed",
|
|
1635
|
+
feedback: quoteFeedback(state),
|
|
1636
|
+
hint: "Apply your code before checkout."
|
|
1637
|
+
};
|
|
1638
|
+
}
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useSelectionCombinationPricing.ts
|
|
1641
|
+
const NOTHING = {
|
|
1642
|
+
working: null,
|
|
1643
|
+
hint: null
|
|
1644
|
+
};
|
|
1645
|
+
/** The working and the hint, from the planner, for a page that books several with combination prices. */
|
|
1646
|
+
function presentSelectionCombination(input) {
|
|
1647
|
+
if (input.mode.kind !== "several") return NOTHING;
|
|
1648
|
+
const pricing = input.selection[0]?.pricing ?? input.scopedEvents[0]?.pricing;
|
|
1649
|
+
const currency = pricing ? publicEventPricingCurrency(pricing) : null;
|
|
1650
|
+
if (currency === null) return NOTHING;
|
|
1651
|
+
const working = input.several === null ? null : combinationWorking({
|
|
1652
|
+
plan: input.price.combination,
|
|
1653
|
+
several: input.several,
|
|
1654
|
+
currency
|
|
1655
|
+
});
|
|
1656
|
+
const hint = selectionCombinationHint({
|
|
1657
|
+
offers: combinationOffersOf(input.scopedEvents),
|
|
1658
|
+
selection: input.selection,
|
|
1659
|
+
addable: input.scopedEvents.filter((event) => !selectionIncludes(input.selection, event) && canToggleSelectionItem(input.selection, event)),
|
|
1660
|
+
places: input.places,
|
|
1661
|
+
itemPrice: input.itemPrice
|
|
1662
|
+
});
|
|
1663
|
+
return {
|
|
1664
|
+
working,
|
|
1665
|
+
hint: hint ? combinationHintCopy({
|
|
1666
|
+
hint,
|
|
1667
|
+
several: input.mode.items,
|
|
1668
|
+
currency
|
|
1669
|
+
}) : null
|
|
1670
|
+
};
|
|
1671
|
+
}
|
|
1672
|
+
/** The checkout and quote both consume the code decided by this response. */
|
|
1673
|
+
async function requestSelectionQuote(input) {
|
|
1674
|
+
try {
|
|
1675
|
+
const code = input.pending.draftCode.trim();
|
|
1676
|
+
const result = await input.api.applyDiscountCode({
|
|
1677
|
+
customerEmail: input.email.trim(),
|
|
1678
|
+
lines: input.lines,
|
|
1679
|
+
...code ? { discountCode: code } : {}
|
|
1680
|
+
});
|
|
1681
|
+
return decideSelectionQuoteResponse(input.pending, result);
|
|
1682
|
+
} catch {
|
|
1683
|
+
return {
|
|
1684
|
+
...input.pending,
|
|
1685
|
+
status: "failed"
|
|
1686
|
+
};
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
/**
|
|
1690
|
+
* Several items have no settled total until the server prices them. Editing the
|
|
1691
|
+
* code invalidates that decision; Continue submits only a current priced code.
|
|
1692
|
+
* A failed request remains unresolved and can be retried explicitly.
|
|
1693
|
+
*/
|
|
1694
|
+
function useSelectionCombinationPricing(input) {
|
|
1695
|
+
const lines = input.several === null ? null : selectionPreviewLines(input);
|
|
1696
|
+
const key = selectionQuoteKey(lines, input.email);
|
|
1697
|
+
const [state, setState] = useState(() => emptyQuoteDraft(key));
|
|
1698
|
+
const [carried, setCarried] = useState(false);
|
|
1699
|
+
const current = currentSelectionQuote(state, key);
|
|
1700
|
+
const apply = async () => {
|
|
1701
|
+
if (key === null || lines === null) return;
|
|
1702
|
+
if (current.draftCode.trim() && !input.email.trim()) {
|
|
1703
|
+
setState({
|
|
1704
|
+
...current,
|
|
1705
|
+
status: "refused",
|
|
1706
|
+
message: DISCOUNT_APPLY_MESSAGES.emailRequired
|
|
1707
|
+
});
|
|
1708
|
+
return;
|
|
1709
|
+
}
|
|
1710
|
+
const pending = {
|
|
1711
|
+
...current,
|
|
1712
|
+
status: "pending"
|
|
1713
|
+
};
|
|
1714
|
+
setCarried(false);
|
|
1715
|
+
setState(pending);
|
|
1716
|
+
const next = await requestSelectionQuote({
|
|
1717
|
+
api: input.api,
|
|
1718
|
+
email: input.email,
|
|
1719
|
+
lines,
|
|
1720
|
+
pending
|
|
1721
|
+
});
|
|
1722
|
+
setState((previous) => previous === pending ? next : previous);
|
|
1723
|
+
};
|
|
1724
|
+
useEffect(() => {
|
|
1725
|
+
if (automaticSelectionQuoteWanted(current, input.automaticWanted, carried)) apply();
|
|
1726
|
+
}, [
|
|
1727
|
+
key,
|
|
1728
|
+
input.automaticWanted,
|
|
1729
|
+
current.status,
|
|
1730
|
+
current.draftCode,
|
|
1731
|
+
carried
|
|
1732
|
+
]);
|
|
1733
|
+
const editCode = (draftCode) => {
|
|
1734
|
+
setCarried(false);
|
|
1735
|
+
setState((previous) => editedSelectionCode(previous, key, draftCode));
|
|
1736
|
+
};
|
|
1737
|
+
/** A code typed in one item's box, or restored after Stripe: priced as soon as payment wants a price. */
|
|
1738
|
+
const carryCode = (draftCode) => {
|
|
1739
|
+
setCarried(Boolean(draftCode.trim()));
|
|
1740
|
+
setState((previous) => editedSelectionCode(previous, key, draftCode));
|
|
1741
|
+
};
|
|
1742
|
+
/** A new booking starts with no code and no earlier price. */
|
|
1743
|
+
const reset = () => {
|
|
1744
|
+
setCarried(false);
|
|
1745
|
+
setState(emptyQuoteDraft(key));
|
|
1746
|
+
};
|
|
1747
|
+
return {
|
|
1748
|
+
...decidedSelectionPricing(input, current, apply),
|
|
1749
|
+
editCode,
|
|
1750
|
+
carryCode,
|
|
1751
|
+
reset
|
|
1752
|
+
};
|
|
1753
|
+
}
|
|
1754
|
+
//#endregion
|
|
1304
1755
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useSettledCommerceView.ts
|
|
1305
1756
|
function buildCandidate(input) {
|
|
1306
1757
|
if (!input.eligibilityIsSettled || !input.eligibility || !input.currentEvent) return null;
|
|
@@ -1331,8 +1782,8 @@ function viewIsStale(view, currentEvent, eligibilityState) {
|
|
|
1331
1782
|
function requestIsSettled(discountUi) {
|
|
1332
1783
|
return discountUi.discountAvailabilityRequestKey === "disabled" || discountUi.settledDiscountAvailabilityRequestKey === discountUi.discountAvailabilityRequestKey;
|
|
1333
1784
|
}
|
|
1334
|
-
function discountRequest(view) {
|
|
1335
|
-
const discountContext = view?.discountContext ?? null;
|
|
1785
|
+
function discountRequest(view, several = false) {
|
|
1786
|
+
const discountContext = several ? null : view?.discountContext ?? null;
|
|
1336
1787
|
return {
|
|
1337
1788
|
discountContext,
|
|
1338
1789
|
subtotalCents: discountContext?.type === "event" && view?.subtotalCents !== null ? view?.subtotalCents : void 0
|
|
@@ -1352,7 +1803,7 @@ function useSettledCommerceView(input) {
|
|
|
1352
1803
|
const requestView = candidate ?? settledRef.current;
|
|
1353
1804
|
const discountUi = input.useDiscountCodeUi({
|
|
1354
1805
|
api: input.api,
|
|
1355
|
-
...discountRequest(requestView)
|
|
1806
|
+
...discountRequest(requestView, input.several)
|
|
1356
1807
|
});
|
|
1357
1808
|
if (candidate && requestIsSettled(discountUi)) settledRef.current = candidate;
|
|
1358
1809
|
return {
|
|
@@ -1433,7 +1884,8 @@ function planCheckoutOutcome({ outcome, subject }, intent) {
|
|
|
1433
1884
|
switch (outcome.kind) {
|
|
1434
1885
|
case "resolved": return {
|
|
1435
1886
|
kind: "confirmed",
|
|
1436
|
-
outcome: outcome.outcome
|
|
1887
|
+
outcome: outcome.outcome,
|
|
1888
|
+
...outcome.outcomes ? { outcomes: outcome.outcomes } : {}
|
|
1437
1889
|
};
|
|
1438
1890
|
case "paymentAvailable": return intent === "resume" ? {
|
|
1439
1891
|
kind: "payment",
|
|
@@ -1618,6 +2070,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
1618
2070
|
options.complete({
|
|
1619
2071
|
status: "confirmed",
|
|
1620
2072
|
outcome: transition.outcome,
|
|
2073
|
+
...transition.outcomes ? { outcomes: transition.outcomes } : {},
|
|
1621
2074
|
mailingListSignupNote: note.current
|
|
1622
2075
|
});
|
|
1623
2076
|
clearEventPayment(options.api.config.siteId);
|
|
@@ -1885,15 +2338,6 @@ function currentHeldTicketSelection(state, held) {
|
|
|
1885
2338
|
}
|
|
1886
2339
|
//#endregion
|
|
1887
2340
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.ts
|
|
1888
|
-
function resolveAvailableAttendanceMode(event, selected) {
|
|
1889
|
-
if (!event) return null;
|
|
1890
|
-
const mode = event.deliveryMode ?? "in_person";
|
|
1891
|
-
if (mode === "online" || mode === "in_person") return mode;
|
|
1892
|
-
return selected && event.attendanceModes?.some((item) => item.mode === selected) ? selected : null;
|
|
1893
|
-
}
|
|
1894
|
-
function usesTieredPricing(event) {
|
|
1895
|
-
return event !== null && event !== void 0 ? publicEventPricingStrategy(event.pricing) === "tiered" : false;
|
|
1896
|
-
}
|
|
1897
2341
|
const NO_EVENTS = [];
|
|
1898
2342
|
const eventRegistrationWizardDeps = {
|
|
1899
2343
|
usePortalAuth,
|
|
@@ -1974,11 +2418,24 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
1974
2418
|
}));
|
|
1975
2419
|
const step = flowState.step;
|
|
1976
2420
|
const paymentIntent = flowState.paymentSelection;
|
|
1977
|
-
const {
|
|
1978
|
-
const
|
|
2421
|
+
const { selection, runChoices, formData: draftFormData, guests, selectedAttendanceMode, selectedTicketLines, selectedSlidingAmountInput: draftSlidingAmountInput } = flowState.draft;
|
|
2422
|
+
const selectedEvent = primarySelectionItem(selection);
|
|
2423
|
+
const selectionMode = registrationSelectionMode({
|
|
2424
|
+
events: scopedEvents,
|
|
2425
|
+
hasPreSelectedContext
|
|
2426
|
+
});
|
|
2427
|
+
const several = severalItemsOf(selection);
|
|
2428
|
+
const setSelection = useCallback((value) => dispatchFlow({
|
|
1979
2429
|
type: "draft-edited",
|
|
1980
2430
|
edit: {
|
|
1981
|
-
field: "
|
|
2431
|
+
field: "selection",
|
|
2432
|
+
value
|
|
2433
|
+
}
|
|
2434
|
+
}), []);
|
|
2435
|
+
const setRunChoices = useCallback((value) => dispatchFlow({
|
|
2436
|
+
type: "draft-edited",
|
|
2437
|
+
edit: {
|
|
2438
|
+
field: "runChoices",
|
|
1982
2439
|
value
|
|
1983
2440
|
}
|
|
1984
2441
|
}), []);
|
|
@@ -2020,6 +2477,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2020
2477
|
const mailingListSignup = resolveBookingSignupOffer(options.mailingList, options.siteName);
|
|
2021
2478
|
const [errors, setErrors] = useState({});
|
|
2022
2479
|
const [guestErrors, setGuestErrors] = useState({});
|
|
2480
|
+
/** Several runs asked separately: each run's agreement still to tick, by series ID. */
|
|
2481
|
+
const [runConsentErrors, setRunConsentErrors] = useState({});
|
|
2023
2482
|
const [guestSectionShake, setGuestSectionShake] = useState(false);
|
|
2024
2483
|
const complete = useCallback((result) => {
|
|
2025
2484
|
dispatchFlow({
|
|
@@ -2068,8 +2527,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2068
2527
|
const handleLogout = () => logoutPortal(options.anchorId);
|
|
2069
2528
|
const registrationTarget = useMemo(() => resolveRegistrationTarget({
|
|
2070
2529
|
occurrenceContext: options.occurrenceContext,
|
|
2071
|
-
|
|
2072
|
-
}), [options.occurrenceContext,
|
|
2530
|
+
selection
|
|
2531
|
+
}), [options.occurrenceContext, selection]);
|
|
2073
2532
|
const registrationOccurrenceId = getRegistrationOccurrenceId(registrationTarget);
|
|
2074
2533
|
const registrationNavigation = useRegistrationNavigation({
|
|
2075
2534
|
pageNavigation: options.pageNavigation,
|
|
@@ -2079,6 +2538,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2079
2538
|
});
|
|
2080
2539
|
const { showMagicLinkModal, changeSignInVisibility: setShowMagicLinkModal, interceptPaymentSelection } = registrationNavigation;
|
|
2081
2540
|
const currentEvent = selectedEvent ?? preSelectedEvent;
|
|
2541
|
+
const attendance = useMemo(() => decideSelectionAttendance(effectiveSelection(selection, preSelectedEvent ?? null)), [selection, preSelectedEvent]);
|
|
2082
2542
|
const commandRef = useRef(null);
|
|
2083
2543
|
const setStep = useCallback((nextStep) => {
|
|
2084
2544
|
dispatchFlow({
|
|
@@ -2086,19 +2546,29 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2086
2546
|
step: nextStep
|
|
2087
2547
|
});
|
|
2088
2548
|
}, []);
|
|
2089
|
-
const
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2549
|
+
const ticketInputs = useMemo(() => selectionTicketInputs({
|
|
2550
|
+
several,
|
|
2551
|
+
primary: currentEvent,
|
|
2552
|
+
lines: selectedTicketLines,
|
|
2553
|
+
slidingAmountInput: draftSlidingAmountInput,
|
|
2554
|
+
placeCount: flowState.placeCount,
|
|
2555
|
+
runChoices,
|
|
2556
|
+
invitation: waitlistClaim
|
|
2557
|
+
}), [
|
|
2558
|
+
several,
|
|
2559
|
+
currentEvent,
|
|
2560
|
+
selectedTicketLines,
|
|
2561
|
+
draftSlidingAmountInput,
|
|
2562
|
+
flowState.placeCount,
|
|
2563
|
+
runChoices,
|
|
2564
|
+
waitlistClaim
|
|
2101
2565
|
]);
|
|
2566
|
+
const usesTicketTypeSelections = ticketInputs.usesTicketLines;
|
|
2567
|
+
const selectedSlidingAmountInput = ticketInputs.slidingAmountInput;
|
|
2568
|
+
const normalizedSelectedTicketLines = useMemo(() => normalizeTicketSelectionLines(selectedTicketLines), [selectedTicketLines]);
|
|
2569
|
+
const primaryLines = useMemo(() => normalizeTicketSelectionLines(ticketInputs.lines), [ticketInputs.lines]);
|
|
2570
|
+
const ticketsCount = ticketInputs.ticketsCount;
|
|
2571
|
+
const ticketSelections = useMemo(() => waitlistClaim.kind === "ready" ? [...waitlistClaim.restoration.ticketSelections] : primaryLines, [waitlistClaim, primaryLines]);
|
|
2102
2572
|
const currentTicketSelection = getCurrentTicketSelection(currentEvent, selectedAttendanceMode, ticketSelections);
|
|
2103
2573
|
const paymentController = usePaymentStatusRecovery({
|
|
2104
2574
|
api,
|
|
@@ -2113,13 +2583,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2113
2583
|
detailsInPage: () => Object.keys(validateFormData(formData)).length === 0
|
|
2114
2584
|
});
|
|
2115
2585
|
const { recovery: paymentStatusRecovery, showRecovery: setPaymentStatusRecovery, check: handleCheckPaymentStatus, continuePayment: handleContinueExistingPayment, returnToPayment: handleReturnToPayment, returnToBooking: handleReturnToBooking } = paymentController;
|
|
2116
|
-
useEffect(() => {
|
|
2117
|
-
if (flowState.ticketsCount === ticketsCount) return;
|
|
2118
|
-
dispatchFlow({
|
|
2119
|
-
type: "set-tickets-count",
|
|
2120
|
-
ticketsCount
|
|
2121
|
-
});
|
|
2122
|
-
}, [flowState.ticketsCount, ticketsCount]);
|
|
2123
2586
|
const eligibilityResult = deps.useEligibility({
|
|
2124
2587
|
refreshKey: optionsRefreshKey,
|
|
2125
2588
|
enabled: shouldRefreshAfterRegistrationError(step, errorAction, shouldLoadRegistrationOptions(portalAuthState, step)),
|
|
@@ -2157,16 +2620,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2157
2620
|
isAuthenticated: portalAuthState === "authenticated"
|
|
2158
2621
|
});
|
|
2159
2622
|
}, [portalAuthState]);
|
|
2160
|
-
useEffect(() => {
|
|
2161
|
-
if (selectionLocked) return;
|
|
2162
|
-
const next = resolveAvailableAttendanceMode(selectedEvent ?? preSelectedEvent, selectedAttendanceMode);
|
|
2163
|
-
if (next !== selectedAttendanceMode) setSelectedAttendanceMode(next);
|
|
2164
|
-
}, [
|
|
2165
|
-
preSelectedEvent,
|
|
2166
|
-
selectedAttendanceMode,
|
|
2167
|
-
selectedEvent,
|
|
2168
|
-
selectionLocked
|
|
2169
|
-
]);
|
|
2170
2623
|
useEffect(() => {
|
|
2171
2624
|
dispatchFlow({
|
|
2172
2625
|
type: "eligibility-updated",
|
|
@@ -2175,12 +2628,13 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2175
2628
|
}, [eligibility]);
|
|
2176
2629
|
const verification = paymentController.verification;
|
|
2177
2630
|
const [paymentReturn, setPaymentReturn] = useState(null);
|
|
2631
|
+
const [restoredCode, restoreDiscountCode] = useState(null);
|
|
2178
2632
|
deps.useEventRegistrationStripeReturn({
|
|
2179
2633
|
siteId: api.config.siteId,
|
|
2180
2634
|
verify: paymentController.verify,
|
|
2181
2635
|
restore: (pending) => {
|
|
2182
2636
|
paymentController.restoreMailingListNote(pending.mailingListSignupNote);
|
|
2183
|
-
|
|
2637
|
+
restoreDiscountCode(pending.discountCode);
|
|
2184
2638
|
setPaymentReturn(pending);
|
|
2185
2639
|
}
|
|
2186
2640
|
});
|
|
@@ -2224,17 +2678,31 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2224
2678
|
singleSelectedPricingOptionId
|
|
2225
2679
|
]);
|
|
2226
2680
|
const selectedSlidingAmount = useMemo(() => parseCurrencyInputToCents(selectedSlidingAmountInput), [selectedSlidingAmountInput]);
|
|
2227
|
-
const selectedEventSlidingScale = useMemo(() => getSlidingScaleForEvent(
|
|
2228
|
-
const
|
|
2681
|
+
const selectedEventSlidingScale = useMemo(() => several === "runs" ? null : getSlidingScaleForEvent(currentEvent), [several, currentEvent]);
|
|
2682
|
+
const runChoiceFacts = {
|
|
2683
|
+
places: ticketsCount,
|
|
2684
|
+
maxTickets: options.maxTicketsNum,
|
|
2685
|
+
attendanceMode: selectedAttendanceMode
|
|
2686
|
+
};
|
|
2687
|
+
const { slidingScaleSelectionMessage, selectionChoiceMessage } = resolveSelectionChoiceMessages({
|
|
2688
|
+
several,
|
|
2689
|
+
attendance,
|
|
2690
|
+
selection,
|
|
2691
|
+
runChoices,
|
|
2692
|
+
facts: runChoiceFacts,
|
|
2229
2693
|
slidingScale: selectedEventSlidingScale,
|
|
2230
2694
|
selectedAmount: selectedSlidingAmount
|
|
2231
2695
|
});
|
|
2232
2696
|
const ticketTypeSelectionRequired = useMemo(() => {
|
|
2233
2697
|
const event = currentEvent;
|
|
2234
|
-
if (!
|
|
2698
|
+
if (!event || !usesTicketTypeSelections) return false;
|
|
2235
2699
|
if ((event.deliveryMode ?? "in_person") === "hybrid" && !selectedAttendanceMode) return false;
|
|
2236
2700
|
return true;
|
|
2237
|
-
}, [
|
|
2701
|
+
}, [
|
|
2702
|
+
currentEvent,
|
|
2703
|
+
selectedAttendanceMode,
|
|
2704
|
+
usesTicketTypeSelections
|
|
2705
|
+
]);
|
|
2238
2706
|
const admission = resolveRegistrationAdmission({
|
|
2239
2707
|
eligibility,
|
|
2240
2708
|
eligibilityError,
|
|
@@ -2256,7 +2724,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2256
2724
|
attendanceMode: selectedAttendanceMode
|
|
2257
2725
|
});
|
|
2258
2726
|
const heldPlacesBySelection = resolveHeldTicketPlaces(currentTicketSelection, waitlistClaim, paymentController.heldTicketSelection);
|
|
2259
|
-
const hasValidTicketSelection = hasValidPricingOptionSelection({
|
|
2727
|
+
const hasValidTicketSelection = selectionChoiceMessage === null && hasValidPricingOptionSelection({
|
|
2260
2728
|
selectionRequired: ticketTypeSelectionRequired,
|
|
2261
2729
|
purpose: ticketSelectionPurpose,
|
|
2262
2730
|
lines: normalizedSelectedTicketLines,
|
|
@@ -2300,7 +2768,13 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2300
2768
|
const handleGuestShakeEnd = () => {
|
|
2301
2769
|
setGuestSectionShake(false);
|
|
2302
2770
|
};
|
|
2771
|
+
const selectionPayment = decideSelectionPayment({
|
|
2772
|
+
selection,
|
|
2773
|
+
runChoices,
|
|
2774
|
+
eligibility
|
|
2775
|
+
});
|
|
2303
2776
|
const eventRequiresPayment = useMemo(() => {
|
|
2777
|
+
if (selectionPayment.kind === "several") return selectionPayment.due === "card";
|
|
2304
2778
|
if (selectedEventSlidingScale) return (selectedSlidingAmount ?? 0) > 0;
|
|
2305
2779
|
return resolveEventRequiresPayment({
|
|
2306
2780
|
eligibility,
|
|
@@ -2312,14 +2786,17 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2312
2786
|
selectedTicketType,
|
|
2313
2787
|
currentEvent,
|
|
2314
2788
|
selectedEventSlidingScale,
|
|
2315
|
-
selectedSlidingAmount
|
|
2789
|
+
selectedSlidingAmount,
|
|
2790
|
+
selectionPayment
|
|
2316
2791
|
]);
|
|
2317
2792
|
const { ticketContinuation, handleTicketsComplete } = useRegistrationAdmission({
|
|
2318
2793
|
admission,
|
|
2319
2794
|
isAuthenticated: portalAuthState === "authenticated",
|
|
2320
2795
|
existingRegistrationLoading: existingRegistrationResult.isLoading,
|
|
2796
|
+
slidingScaleSelectionMessage,
|
|
2321
2797
|
ticketSelectionRequired: ticketTypeSelectionRequired,
|
|
2322
2798
|
hasValidTicketSelection,
|
|
2799
|
+
selectionChoiceMessage,
|
|
2323
2800
|
dispatchFlow
|
|
2324
2801
|
});
|
|
2325
2802
|
const { checkingNextStep, checkDetailsNextStep } = useGuestDetailsCheck({
|
|
@@ -2350,14 +2827,14 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2350
2827
|
hasValidSelection: hasValidTicketSelection,
|
|
2351
2828
|
slidingScaleSelectionMessage,
|
|
2352
2829
|
formData,
|
|
2353
|
-
requiresConsent: Boolean(currentEvent?.consent),
|
|
2354
2830
|
requireGuestDetails,
|
|
2355
2831
|
guests,
|
|
2356
|
-
questions
|
|
2832
|
+
...detailsRequirementsCheck(requirements.checkRuns(), questions, currentEvent)
|
|
2357
2833
|
});
|
|
2358
2834
|
if (check.kind === "blocked") return blockDetailsCompletion(check.blocker);
|
|
2359
2835
|
setErrors(check.errors);
|
|
2360
2836
|
setGuestErrors(check.guestErrors);
|
|
2837
|
+
setRunConsentErrors(check.runConsentErrors);
|
|
2361
2838
|
dispatchFlow({
|
|
2362
2839
|
type: "question-errors-set",
|
|
2363
2840
|
fieldErrors: check.questionFieldErrors
|
|
@@ -2380,7 +2857,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2380
2857
|
const continuation = planRegistrationDetailsContinuation({
|
|
2381
2858
|
next: await checkDetailsNextStep(),
|
|
2382
2859
|
eventRequiresPayment,
|
|
2383
|
-
paymentSelection
|
|
2860
|
+
paymentSelection,
|
|
2861
|
+
quoteReady: combinationPricing.ready
|
|
2384
2862
|
});
|
|
2385
2863
|
switch (continuation.kind) {
|
|
2386
2864
|
case "blocked": return blockDetailsCompletion({
|
|
@@ -2436,7 +2914,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2436
2914
|
}
|
|
2437
2915
|
setStep("select-tickets");
|
|
2438
2916
|
};
|
|
2439
|
-
const { discountUi, discountContext, ticketSelectionSubtotalCents, ticketSelectionSummaryLines } = useSettledCommerceView({
|
|
2917
|
+
const { discountUi, discountContext, ticketSelectionSubtotalCents: primarySubtotalCents, ticketSelectionSummaryLines } = useSettledCommerceView({
|
|
2440
2918
|
api,
|
|
2441
2919
|
useDiscountCodeUi: deps.useDiscountCodeUi,
|
|
2442
2920
|
eligibilityResult,
|
|
@@ -2444,27 +2922,82 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2444
2922
|
currentEvent,
|
|
2445
2923
|
eventRequiresPayment,
|
|
2446
2924
|
paymentSelection: paymentIntent,
|
|
2447
|
-
ticketsCount
|
|
2925
|
+
ticketsCount,
|
|
2926
|
+
several: several !== null
|
|
2448
2927
|
});
|
|
2928
|
+
const selectionPrice = planSelectionPrice({
|
|
2929
|
+
several,
|
|
2930
|
+
selection,
|
|
2931
|
+
places: ticketsCount,
|
|
2932
|
+
primarySubtotalCents,
|
|
2933
|
+
runChoices
|
|
2934
|
+
});
|
|
2935
|
+
const itemPrice = selectionItemPrice({
|
|
2936
|
+
several,
|
|
2937
|
+
places: ticketsCount,
|
|
2938
|
+
primarySubtotalCents,
|
|
2939
|
+
runChoices,
|
|
2940
|
+
primaryTicketUnits: ticketSelectionSummaryLines
|
|
2941
|
+
});
|
|
2942
|
+
const combinationPricing = useSelectionCombinationPricing({
|
|
2943
|
+
api,
|
|
2944
|
+
selection,
|
|
2945
|
+
several,
|
|
2946
|
+
places: ticketsCount,
|
|
2947
|
+
price: selectionPrice,
|
|
2948
|
+
itemPrice,
|
|
2949
|
+
email: formData.email,
|
|
2950
|
+
payment: paymentController.state,
|
|
2951
|
+
automaticWanted: step === "select-payment"
|
|
2952
|
+
});
|
|
2953
|
+
const discountView = registrationDiscountView({
|
|
2954
|
+
several: several !== null,
|
|
2955
|
+
single: discountUi,
|
|
2956
|
+
selection: combinationPricing,
|
|
2957
|
+
context: discountContext
|
|
2958
|
+
});
|
|
2959
|
+
const { code: discountCode, editCode: setDiscountCode } = discountView;
|
|
2960
|
+
/**
|
|
2961
|
+
* One item keeps a typed code in its discount box, several in their quote.
|
|
2962
|
+
* A code moving between them (or restored) stays the visitor's: one item
|
|
2963
|
+
* reads it as typed, and several price it without another Apply.
|
|
2964
|
+
*/
|
|
2965
|
+
const carryDiscountCode = (code, toSeveral) => {
|
|
2966
|
+
if (toSeveral) combinationPricing.carryCode(code);
|
|
2967
|
+
else discountUi.setDiscountCode(code);
|
|
2968
|
+
};
|
|
2969
|
+
useEffect(() => {
|
|
2970
|
+
if (restoredCode === null || paymentReturn) return;
|
|
2971
|
+
restoreDiscountCode(null);
|
|
2972
|
+
carryDiscountCode(restoredCode, several !== null);
|
|
2973
|
+
}, [
|
|
2974
|
+
paymentReturn,
|
|
2975
|
+
restoredCode,
|
|
2976
|
+
several
|
|
2977
|
+
]);
|
|
2978
|
+
const ticketSelectionSubtotalCents = combinationPricing.payableCents;
|
|
2449
2979
|
const directPaymentOptions = resolveWizardDirectPaymentOptions({
|
|
2450
2980
|
eligibility,
|
|
2451
2981
|
currentEvent,
|
|
2452
2982
|
occurrenceContext: options.occurrenceContext,
|
|
2453
2983
|
ticketSelectionSubtotalCents,
|
|
2454
2984
|
discountUi,
|
|
2455
|
-
nowIso
|
|
2985
|
+
nowIso,
|
|
2986
|
+
selectionPayment
|
|
2456
2987
|
});
|
|
2457
2988
|
const { paymentDecision, paymentSelection, paymentStepState } = resolveWizardPaymentView({
|
|
2458
2989
|
directPaymentOptions,
|
|
2459
2990
|
paymentIntent,
|
|
2460
2991
|
eligibility,
|
|
2461
2992
|
admission,
|
|
2993
|
+
selectionPayment,
|
|
2462
2994
|
eligibilityLoading,
|
|
2995
|
+
quoting: combinationPricing.quoting,
|
|
2463
2996
|
checkingNextStep,
|
|
2464
2997
|
eligibilityError,
|
|
2465
2998
|
isAuthenticated: flowState.isAuthenticated,
|
|
2466
2999
|
portalCreditState,
|
|
2467
|
-
discountCode:
|
|
3000
|
+
discountCode: discountView.paymentDraftCode,
|
|
2468
3001
|
step
|
|
2469
3002
|
});
|
|
2470
3003
|
const siteTerms = useSiteTermsAgreement({
|
|
@@ -2476,24 +3009,37 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2476
3009
|
}
|
|
2477
3010
|
});
|
|
2478
3011
|
const selectionMethod = paymentSelection.method;
|
|
2479
|
-
const shouldShowDiscountToggle =
|
|
3012
|
+
const shouldShowDiscountToggle = registrationDiscountEntryVisible(discountView, selectionMethod);
|
|
3013
|
+
const requirementsLayout = useMemo(() => decideSelectionRequirementsLayout(selection), [selection]);
|
|
2480
3014
|
const questions = useEventRegistrationQuestions({
|
|
2481
3015
|
api,
|
|
2482
3016
|
siteId: api.config.siteId,
|
|
2483
3017
|
flow: flowState,
|
|
2484
3018
|
dispatch: dispatchFlow,
|
|
2485
|
-
event: currentEvent,
|
|
3019
|
+
event: onceAskedEvent(requirementsLayout, currentEvent),
|
|
3020
|
+
offersKeptAnswers: requirementsLayout.kind !== "shared",
|
|
2486
3021
|
identity: portalIdentity,
|
|
2487
3022
|
eventSource: options.eventSource,
|
|
2488
3023
|
registrationEvents,
|
|
2489
|
-
discountCode
|
|
2490
|
-
|
|
3024
|
+
discountCode,
|
|
3025
|
+
restoreDiscountCode
|
|
3026
|
+
});
|
|
3027
|
+
const requirements = useSelectionRequirements({
|
|
3028
|
+
api,
|
|
3029
|
+
flow: flowState,
|
|
3030
|
+
dispatch: dispatchFlow,
|
|
3031
|
+
layout: requirementsLayout,
|
|
3032
|
+
identity: portalIdentity,
|
|
3033
|
+
sharedQuestions: questions.submission,
|
|
3034
|
+
consentAccepted: formData.consentAccepted === true,
|
|
3035
|
+
signIn: questions,
|
|
3036
|
+
sharedKeepRefused: questions.keepRefused
|
|
2491
3037
|
});
|
|
2492
3038
|
const handleSubmit = deps.useEventRegistrationSubmit({
|
|
2493
3039
|
openPayment: paymentController.openPayment,
|
|
2494
3040
|
commandRef,
|
|
2495
3041
|
setSubmissionFailure: (failure) => {
|
|
2496
|
-
if (failure.answersNeeded)
|
|
3042
|
+
if (failure.answersNeeded) requirements.keepRefused();
|
|
2497
3043
|
dispatchFlow({
|
|
2498
3044
|
type: "submission-failed",
|
|
2499
3045
|
failure
|
|
@@ -2505,13 +3051,17 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2505
3051
|
selectedAttendanceMode,
|
|
2506
3052
|
ticketSelections,
|
|
2507
3053
|
selectedSlidingAmount,
|
|
3054
|
+
runChoices,
|
|
2508
3055
|
formData,
|
|
2509
3056
|
bookingQuestions: questions.submission,
|
|
2510
3057
|
bookingQuestionsSnapshot: questions.paymentSnapshot,
|
|
3058
|
+
requirements: requirements.submission,
|
|
3059
|
+
runRequirementsSnapshots: requirements.runSnapshots,
|
|
2511
3060
|
mailingListSignup,
|
|
2512
3061
|
requireGuestDetails,
|
|
2513
3062
|
guests,
|
|
2514
|
-
discountCode:
|
|
3063
|
+
discountCode: discountView.submittedCode,
|
|
3064
|
+
quoteReady: combinationPricing.ready,
|
|
2515
3065
|
invitation: invitationSubmission(waitlistClaim),
|
|
2516
3066
|
setStep,
|
|
2517
3067
|
complete,
|
|
@@ -2533,6 +3083,40 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2533
3083
|
const handleEventSelect = (event) => applyEventChoice(event, "advance");
|
|
2534
3084
|
/** The date rows choose without moving on; Continue advances the same draft. */
|
|
2535
3085
|
const handleEventChoose = (event) => applyEventChoice(event, "choose");
|
|
3086
|
+
/** Booking several: a row ticks or unticks without moving on. */
|
|
3087
|
+
const handleSelectionToggle = (event) => {
|
|
3088
|
+
if (selectionLocked) return;
|
|
3089
|
+
const toSeveral = severalItemsOf(toggleSelectionItem(selection, event)) !== null;
|
|
3090
|
+
if (toSeveral !== (several !== null)) carryDiscountCode(discountCode, toSeveral);
|
|
3091
|
+
dispatchFlow({
|
|
3092
|
+
type: "selection-toggled",
|
|
3093
|
+
event
|
|
3094
|
+
});
|
|
3095
|
+
};
|
|
3096
|
+
/** Booking several: Continue moves on with whatever is ticked. */
|
|
3097
|
+
const handleSelectionContinue = () => {
|
|
3098
|
+
if (selection.length > 0) dispatchFlow({
|
|
3099
|
+
type: "event-continued",
|
|
3100
|
+
navigation: "advance"
|
|
3101
|
+
});
|
|
3102
|
+
};
|
|
3103
|
+
/** A full row's waitlist books that one item on its own, as a single booking. */
|
|
3104
|
+
const handleWaitlistChoose = (event) => {
|
|
3105
|
+
if (selectionLocked) return;
|
|
3106
|
+
dispatchFlow({
|
|
3107
|
+
type: "event-replaced",
|
|
3108
|
+
event,
|
|
3109
|
+
navigation: "advance"
|
|
3110
|
+
});
|
|
3111
|
+
clearWaitlistClaimLocation();
|
|
3112
|
+
setPaymentStatusRecovery(null);
|
|
3113
|
+
};
|
|
3114
|
+
const setRunChoice = (run, choice) => {
|
|
3115
|
+
if (!selectionLocked) setRunChoices((current) => ({
|
|
3116
|
+
...current,
|
|
3117
|
+
[run.selectionId]: choice
|
|
3118
|
+
}));
|
|
3119
|
+
};
|
|
2536
3120
|
/**
|
|
2537
3121
|
* Start another booking after one finished: the booking choices reset, the
|
|
2538
3122
|
* visitor stays signed in and their name and email stay filled in.
|
|
@@ -2549,9 +3133,11 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2549
3133
|
setErrorMessage
|
|
2550
3134
|
});
|
|
2551
3135
|
setSelectedSlidingAmountInput(initialSlidingAmountInput(preSelectedEvent ?? null));
|
|
2552
|
-
|
|
3136
|
+
setSelection(preSelectedEvent ? [preSelectedEvent] : []);
|
|
2553
3137
|
setGuests([]);
|
|
2554
3138
|
setGuestErrors({});
|
|
3139
|
+
discountUi.setDiscountCode("");
|
|
3140
|
+
combinationPricing.reset();
|
|
2555
3141
|
commandRef.current = null;
|
|
2556
3142
|
setOptionsRefreshKey((value) => value + 1);
|
|
2557
3143
|
};
|
|
@@ -2624,9 +3210,47 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2624
3210
|
ticketContinuation,
|
|
2625
3211
|
handleTicketsComplete,
|
|
2626
3212
|
selectedEvent: selectedEvent ? displayEvent : null,
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
3213
|
+
/** Every chosen item, in date order; the first is `selectedEvent`. */
|
|
3214
|
+
selection,
|
|
3215
|
+
selectionMode,
|
|
3216
|
+
/** The kind of several items chosen, or null for a selection of one. */
|
|
3217
|
+
severalItems: several,
|
|
3218
|
+
/** One way of attending for every chosen item. */
|
|
3219
|
+
attendance,
|
|
3220
|
+
/** How the whole selection is paid. */
|
|
3221
|
+
selectionPayment,
|
|
3222
|
+
/** What each run's ticket choice is checked against when booking several runs. */
|
|
3223
|
+
runChoiceFacts,
|
|
3224
|
+
selectionPrice,
|
|
3225
|
+
/** Combination prices' working and next saving for the summary bar (issue 1725). */
|
|
3226
|
+
selectionCombination: presentSelectionCombination({
|
|
3227
|
+
mode: selectionMode,
|
|
3228
|
+
scopedEvents,
|
|
3229
|
+
selection,
|
|
3230
|
+
several,
|
|
3231
|
+
places: ticketsCount,
|
|
3232
|
+
price: selectionPrice,
|
|
3233
|
+
itemPrice
|
|
3234
|
+
}),
|
|
3235
|
+
/** The code field's apply-and-preview, while combination prices apply; null keeps the field as it was. */
|
|
3236
|
+
combinationCodeField: combinationPricing.codeField,
|
|
3237
|
+
combinationAwaitingVisitor: combinationPricing.awaitingVisitor,
|
|
3238
|
+
/** The payment step's list of what several items cost; null for one item. */
|
|
3239
|
+
selectionPaymentSummary: summariseSelectionPayment({
|
|
3240
|
+
ready: combinationPricing.ready,
|
|
3241
|
+
several,
|
|
3242
|
+
selection,
|
|
3243
|
+
places: ticketsCount,
|
|
3244
|
+
runChoices,
|
|
3245
|
+
primarySubtotalCents,
|
|
3246
|
+
price: selectionPrice,
|
|
3247
|
+
quote: combinationPricing.quote
|
|
3248
|
+
}),
|
|
3249
|
+
runChoices,
|
|
3250
|
+
setRunChoice,
|
|
3251
|
+
handleSelectionToggle,
|
|
3252
|
+
handleSelectionContinue,
|
|
3253
|
+
handleWaitlistChoose,
|
|
2630
3254
|
ticketsCount,
|
|
2631
3255
|
setTicketsCount: (value) => {
|
|
2632
3256
|
if (!selectionLocked) setTicketsCount(value);
|
|
@@ -2675,6 +3299,10 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2675
3299
|
errorMessage,
|
|
2676
3300
|
questionFieldErrors: flowState.questionFieldErrors,
|
|
2677
3301
|
bookingQuestions: questions,
|
|
3302
|
+
/** How the selection's questions and agreement are asked: once, or once per run. */
|
|
3303
|
+
requirementsLayout,
|
|
3304
|
+
/** One section per run when several runs ask different questions or agreements. */
|
|
3305
|
+
runRequirementSections: requirements.sections(runConsentErrors),
|
|
2678
3306
|
/** Where a sign-in link brings the booker back to, keeping this booking for that attempt. */
|
|
2679
3307
|
signInReturnPath: questions.signInReturnPath,
|
|
2680
3308
|
/** The message under the details form while questions there need attention. */
|
|
@@ -2696,7 +3324,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2696
3324
|
waitlistClaim,
|
|
2697
3325
|
eligibility,
|
|
2698
3326
|
registrationOptionsState: eligibilityResult.state,
|
|
2699
|
-
eligibilityLoading: eligibilityLoading
|
|
3327
|
+
eligibilityLoading: anyLoading(eligibilityLoading, checkingNextStep, combinationPricing.quoting),
|
|
2700
3328
|
eligibilityError,
|
|
2701
3329
|
existingRegistrations,
|
|
2702
3330
|
existingRegistrationLoading: existingRegistrationResult.isLoading || portalAuthState === "authenticated" && eligibilityLoading,
|
|
@@ -2705,16 +3333,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2705
3333
|
hasEligibility,
|
|
2706
3334
|
hasMembershipEligibility,
|
|
2707
3335
|
requireGuestDetails,
|
|
2708
|
-
discountCode
|
|
3336
|
+
discountCode,
|
|
2709
3337
|
setDiscountCode: (value) => {
|
|
2710
|
-
if (!selectionLocked)
|
|
3338
|
+
if (!selectionLocked) setDiscountCode(value);
|
|
2711
3339
|
},
|
|
2712
3340
|
discountUiOpen: discountUi.discountUiOpen,
|
|
2713
3341
|
setDiscountUiOpen: discountUi.setDiscountUiOpen,
|
|
2714
|
-
discountsAvailable:
|
|
2715
|
-
manualCodeEntryAllowed:
|
|
2716
|
-
autoAppliedDiscount:
|
|
2717
|
-
discountsAvailableLoading:
|
|
3342
|
+
discountsAvailable: discountView.discountsAvailable,
|
|
3343
|
+
manualCodeEntryAllowed: discountView.manualCodeEntryAllowed,
|
|
3344
|
+
autoAppliedDiscount: discountView.autoAppliedDiscount,
|
|
3345
|
+
discountsAvailableLoading: discountView.discountsAvailableLoading,
|
|
2718
3346
|
discountContext,
|
|
2719
3347
|
shouldShowDiscountToggle,
|
|
2720
3348
|
verification,
|
|
@@ -2746,6 +3374,41 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2746
3374
|
...registrationCompletionState(flowState)
|
|
2747
3375
|
};
|
|
2748
3376
|
}
|
|
3377
|
+
/**
|
|
3378
|
+
* What still needs choosing. Several runs need one way of attending and a
|
|
3379
|
+
* usable ticket or amount for each run before the tickets step goes on; one
|
|
3380
|
+
* item, or several dates, has one amount to check.
|
|
3381
|
+
*/
|
|
3382
|
+
function resolveSelectionChoiceMessages(input) {
|
|
3383
|
+
if (input.several !== "runs") return {
|
|
3384
|
+
slidingScaleSelectionMessage: getSlidingScaleSelectionMessage(input),
|
|
3385
|
+
selectionChoiceMessage: null
|
|
3386
|
+
};
|
|
3387
|
+
return {
|
|
3388
|
+
slidingScaleSelectionMessage: incompleteRunChoiceMessage(input),
|
|
3389
|
+
selectionChoiceMessage: severalRunsChoiceMessage(input)
|
|
3390
|
+
};
|
|
3391
|
+
}
|
|
3392
|
+
/** The event whose questions are asked once; none when runs are asked separately. */
|
|
3393
|
+
function onceAskedEvent(layout, currentEvent) {
|
|
3394
|
+
return layout.kind === "per_run" ? null : currentEvent;
|
|
3395
|
+
}
|
|
3396
|
+
/**
|
|
3397
|
+
* What the details step checks for questions and agreement: each run's own
|
|
3398
|
+
* when runs are asked separately, otherwise the once-asked questions and the
|
|
3399
|
+
* event's agreement.
|
|
3400
|
+
*/
|
|
3401
|
+
function detailsRequirementsCheck(runs, questions, currentEvent) {
|
|
3402
|
+
return runs ? {
|
|
3403
|
+
requiresConsent: false,
|
|
3404
|
+
questions: runs.questions,
|
|
3405
|
+
runConsentErrors: runs.consentErrors
|
|
3406
|
+
} : {
|
|
3407
|
+
requiresConsent: Boolean(currentEvent?.consent),
|
|
3408
|
+
questions: checkBookingQuestionsAnswered(questions),
|
|
3409
|
+
runConsentErrors: {}
|
|
3410
|
+
};
|
|
3411
|
+
}
|
|
2749
3412
|
function registrationCompletionState(state) {
|
|
2750
3413
|
return state.step === "success" ? {
|
|
2751
3414
|
step: state.step,
|
|
@@ -2755,29 +3418,66 @@ function registrationCompletionState(state) {
|
|
|
2755
3418
|
registrationResult: null
|
|
2756
3419
|
};
|
|
2757
3420
|
}
|
|
3421
|
+
/**
|
|
3422
|
+
* The card options on the payment step. One item offers what its own options
|
|
3423
|
+
* allow. Several items offer one way, paying the whole total up front, when
|
|
3424
|
+
* anything is due (issue 1725); the first item's options don't decide it.
|
|
3425
|
+
*/
|
|
2758
3426
|
function resolveWizardDirectPaymentOptions(input) {
|
|
2759
|
-
const { eligibility } = input;
|
|
2760
|
-
if (!eligibility
|
|
3427
|
+
const { eligibility, selectionPayment } = input;
|
|
3428
|
+
if (!eligibility) return [];
|
|
3429
|
+
switch (selectionPayment.kind) {
|
|
3430
|
+
case "one-item":
|
|
3431
|
+
if (!eligibility.requiresPayment || !eligibility.price) return [];
|
|
3432
|
+
return buildDirectPaymentOptions(input, eligibility, {
|
|
3433
|
+
subtotalCents: input.ticketSelectionSubtotalCents ?? eligibility.price,
|
|
3434
|
+
approvedPaymentOptions: eligibility.paymentOptions,
|
|
3435
|
+
paymentTerms: eligibility.paymentTerms
|
|
3436
|
+
}, previewTotalWithAutomaticDiscount(input));
|
|
3437
|
+
case "several": {
|
|
3438
|
+
const subtotalCents = input.ticketSelectionSubtotalCents;
|
|
3439
|
+
if (selectionPayment.due === "nothing" || subtotalCents === null) return [];
|
|
3440
|
+
return buildDirectPaymentOptions(input, eligibility, {
|
|
3441
|
+
subtotalCents,
|
|
3442
|
+
approvedPaymentOptions: [{
|
|
3443
|
+
kind: "payInFull",
|
|
3444
|
+
amountCents: subtotalCents,
|
|
3445
|
+
currency: eligibility.currency
|
|
3446
|
+
}],
|
|
3447
|
+
paymentTerms: { allowedOptions: [{ kind: "upfront" }] }
|
|
3448
|
+
}, (decided) => decided);
|
|
3449
|
+
}
|
|
3450
|
+
}
|
|
3451
|
+
}
|
|
3452
|
+
/** One item: its quote less the automatic code previewed for it, unless a code is typed. */
|
|
3453
|
+
function previewTotalWithAutomaticDiscount(input) {
|
|
3454
|
+
return (subtotalCents) => calculateEventRegistrationPreviewTotal({
|
|
3455
|
+
subtotalCents,
|
|
3456
|
+
manualDiscountCode: input.discountUi.discountCode,
|
|
3457
|
+
automaticDiscount: input.discountUi.autoAppliedDiscount
|
|
3458
|
+
});
|
|
3459
|
+
}
|
|
3460
|
+
function buildDirectPaymentOptions(input, eligibility, priced, totalFor) {
|
|
3461
|
+
const timeZone = resolveBookingBusinessTimeZone(input.currentEvent?.siteTimeZone);
|
|
2761
3462
|
return buildEventRegistrationPaymentOptionsViewModel({
|
|
2762
3463
|
dateContext: {
|
|
2763
|
-
timeZone
|
|
2764
|
-
locale: inferSiteDateLocale(
|
|
3464
|
+
timeZone,
|
|
3465
|
+
locale: inferSiteDateLocale(timeZone)
|
|
2765
3466
|
},
|
|
2766
3467
|
eventTitle: input.currentEvent?.title ?? "Event",
|
|
2767
|
-
approvedPaymentOptions:
|
|
2768
|
-
paymentTerms:
|
|
3468
|
+
approvedPaymentOptions: priced.approvedPaymentOptions,
|
|
3469
|
+
paymentTerms: priced.paymentTerms,
|
|
2769
3470
|
currency: eligibility.currency,
|
|
2770
3471
|
instalmentCollectionDeadlineAt: eligibility.instalmentCollectionDeadlineAt,
|
|
2771
|
-
quotedSubtotalCents:
|
|
2772
|
-
totalPriceCents:
|
|
2773
|
-
subtotalCents: input.ticketSelectionSubtotalCents ?? eligibility.price,
|
|
2774
|
-
manualDiscountCode: input.discountUi.discountCode,
|
|
2775
|
-
automaticDiscount: input.discountUi.autoAppliedDiscount
|
|
2776
|
-
}),
|
|
3472
|
+
quotedSubtotalCents: priced.subtotalCents,
|
|
3473
|
+
totalPriceCents: totalFor(priced.subtotalCents),
|
|
2777
3474
|
startsAt: getRegistrationStartAt(input.currentEvent, input.occurrenceContext),
|
|
2778
3475
|
nowIso: input.nowIso
|
|
2779
3476
|
}).options;
|
|
2780
3477
|
}
|
|
3478
|
+
function anyLoading(...flags) {
|
|
3479
|
+
return flags.some(Boolean);
|
|
3480
|
+
}
|
|
2781
3481
|
function resolveRegistrationPhaseSelection(step, intent, current) {
|
|
2782
3482
|
return [
|
|
2783
3483
|
"payment",
|
|
@@ -2791,9 +3491,10 @@ function resolveWizardPaymentView(input) {
|
|
|
2791
3491
|
const paymentDecision = decideEventRegistrationPayment({
|
|
2792
3492
|
directPaymentOptions: input.directPaymentOptions,
|
|
2793
3493
|
selection: input.paymentIntent,
|
|
3494
|
+
selectionPayment: input.selectionPayment,
|
|
2794
3495
|
eligibility: input.eligibility,
|
|
2795
3496
|
admission: input.admission,
|
|
2796
|
-
loading: input.eligibilityLoading
|
|
3497
|
+
loading: anyLoading(input.eligibilityLoading, input.checkingNextStep, input.quoting),
|
|
2797
3498
|
error: input.eligibilityError,
|
|
2798
3499
|
isAuthenticated: input.isAuthenticated,
|
|
2799
3500
|
creditState: input.portalCreditState,
|