@riverbankcms/sdk 0.174.1 → 0.175.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_dts/{BlocksIslandsHydrator-YRmc-Yxz.d.ts → BlocksIslandsHydrator-hb2IWD8K.d.ts} +1 -1
- package/dist/_dts/{Page-Du0zX1B-.d.ts → Page-BlY68ZF-.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-4L8v3FkY.d.ts → SdkPreviewMode-CA8hU7hW.d.ts} +2 -2
- package/dist/_dts/{client-B1J6Akyf.d.ts → client-B6tCvmG4.d.ts} +487 -11
- package/dist/_dts/{content-types-CGGYI0u_.d.ts → content-types-B9qryk4R.d.ts} +2 -2
- package/dist/_dts/{contracts-CHMlw9hT.d.ts → contracts-DWoaRxj1.d.ts} +3 -3
- package/dist/_dts/{footerPageOutline-DIHSU1Vr.d.ts → footerPageOutline-Djdrhp5s.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-JITXD6BU.d.ts → generatePageMetadata-CFi0vxov.d.ts} +2 -2
- package/dist/_dts/{index-yWDbUojb.d.ts → index-Bl5_pjmq.d.ts} +1 -1
- package/dist/_dts/{index-CF62FntA.d.ts → index-Btp5nIoz.d.ts} +2 -2
- package/dist/_dts/{index-BLEKFHt1.d.ts → index-CQUzwOxO.d.ts} +1 -1
- package/dist/_dts/{index-D9ZYmGAJ.d.ts → index-DmhFb6R1.d.ts} +1 -1
- package/dist/_dts/{index-CXZSy_9M.d.ts → index-OtazQE3U.d.ts} +2 -2
- package/dist/_dts/{index-BgOr1Xyz.d.ts → index-YRQulWB4.d.ts} +3 -3
- package/dist/_dts/{index-DpJm0NpL.d.ts → index-_pXaCO12.d.ts} +4 -4
- package/dist/_dts/{loadContent-M-s0p0rq.d.ts → loadContent-Hcuvs4pz.d.ts} +7 -7
- package/dist/_dts/{request-BK-pHf0P.d.ts → request-BT8i_vH-.d.ts} +1621 -385
- package/dist/_dts/{resolveBlockData-DZAlnhwt.d.ts → resolveBlockData-B-dJrunl.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-DXUCWJ3y.d.ts → resolvePageContent-CVLYWcoI.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +13 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +3 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +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 +2 -1
- package/dist/_dts/{types-DjVNADXR.d.ts → types-C0XZnjXz.d.ts} +3 -3
- package/dist/_dts/{types-CwmB2NHU.d.ts → types-CXL1QJSY.d.ts} +7 -7
- package/dist/_dts/{types-Dmow_FI6.d.ts → types-OKzbqRBx.d.ts} +2 -2
- package/dist/_dts/{validation-h8t1HLlL.d.ts → validation-Bxi66FtQ.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DRVx_XLi.mjs → BlocksIslandsHydrator-2xzlERTG.mjs} +17 -16
- package/dist/client/{BookingMailingListNote-CwrMzj-k.mjs → BookingMailingListNote-qsohSEdQ.mjs} +6 -6
- package/dist/client/{BookingPanelArrangement-C2_hFT6K.mjs → BookingPanelArrangement-DrdtON0q.mjs} +1 -1
- package/dist/client/{BookingQuestionFields-DZMrGvBh.mjs → BookingQuestionFields-CUFxBaTM.mjs} +3 -3
- package/dist/client/{CalendarNavigationChevron-Az1-TIEI.mjs → CalendarNavigationChevron-Ch0w0Utn.mjs} +34 -9
- package/dist/client/DemoBookingPortalAccess-DGgsjqXK.mjs +545 -0
- package/dist/client/{EventCalendar.client-CDkkP-Lv.mjs → EventCalendar.client-Dg4PHFJJ.mjs} +15 -25
- package/dist/client/{EventCombined.client-DK3aaz62.mjs → EventCombined.client-tky8JcnQ.mjs} +25 -17
- package/dist/client/{EventItem-WeUipfIP.mjs → EventItem-BybMSKNL.mjs} +4 -3
- package/dist/client/{EventListWeekNavigation-D3sbAeDo.mjs → EventListWeekNavigation-uvWRE5wi.mjs} +1 -1
- package/dist/client/{EventListing.client-DL3gGGmF.mjs → EventListing.client-DQx9dohz.mjs} +3 -3
- package/dist/client/{EventListing.view-DKFImKOx.mjs → EventListing.view-r31k8Icz.mjs} +8 -7
- package/dist/client/{EventRegistrationPayment-Dn9TpWyL.mjs → EventRegistrationPayment-BMmPDmSf.mjs} +635 -359
- package/dist/client/{LocationMapActions-BJT7MqP2.mjs → LocationMapActions-BecH-qhI.mjs} +1 -1
- package/dist/client/{MapDrawingSvg-DCIwlON6.mjs → MapDrawingSvg-BJzmFdcn.mjs} +18 -3
- package/dist/client/{Page-BpeP9xdt.mjs → Page-CWN_8cLZ.mjs} +601 -579
- package/dist/client/{DemoBookingPortalAccess-1p-pJ1lg.mjs → SiteTermsAgreementField-Dr5lj4oY.mjs} +4 -301
- package/dist/client/{StepIndicator-CP6zrwkl.mjs → StepIndicator-C7RJBOW3.mjs} +37 -12
- package/dist/client/{accordion-nR7D4m1a.mjs → accordion-uUi_N6mZ.mjs} +1 -1
- package/dist/client/{booking-form.client-Ce-mQZ7W.mjs → booking-form.client-CKHgxvsh.mjs} +229 -42
- package/dist/client/{bookingForm-B-qT_AQB.mjs → bookingForm-Bi74dmiS.mjs} +4 -4
- package/dist/client/bookings.mjs +22 -15
- package/dist/client/{boxStyleClassNames-CrE3TDpW.mjs → boxStyleClassNames-C-gFwhnO.mjs} +2 -1
- package/dist/client/{carousel-CVUOatsY.mjs → carousel-C0_BqMA0.mjs} +1 -1
- package/dist/client/{cart-DE0K6E0R.mjs → cart-BOHuppVu.mjs} +3 -3
- package/dist/client/{cart.client-C23E6WQ5.mjs → cart.client-IfJE1zAp.mjs} +1 -1
- package/dist/client/{checkout-76cdHyPL.mjs → checkout-C3Aj-aNa.mjs} +3 -3
- package/dist/client/{checkout.client-DJOzqb26.mjs → checkout.client-Tg9lfeYf.mjs} +1 -1
- package/dist/client/{checkoutUrls-CvIP5DCO.mjs → checkoutUrls-OLqQdAXD.mjs} +1 -1
- package/dist/client/client.mjs +112 -21
- package/dist/client/{context-CNlesLfF.mjs → context-D8TpQXjX.mjs} +76 -58
- package/dist/client/{course-DHIrXqNT.mjs → course-DHmeQAvq.mjs} +2 -2
- package/dist/client/{creditProducts-KYMVIH3J.mjs → creditProducts-BQ1t1erI.mjs} +14 -61
- package/dist/client/{dateFormatting-B73Ll0s4.mjs → dateFormatting-ABCZWkpT.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BVbLD4pi.mjs → demoPortalMagicLink-BdcuW_pa.mjs} +1 -1
- package/dist/client/display-DMqotaGU.mjs +11797 -0
- package/dist/client/{enhanceHeaderSection-5GD5o4Mt.mjs → enhanceHeaderSection-Ciuhsk0E.mjs} +3 -3
- package/dist/client/{event-details.client-D7Oz1q2L.mjs → event-details.client-CJapNbTv.mjs} +1 -1
- package/dist/client/{event-registration.client-zbuX36aA.mjs → event-registration.client-CAdcpnLc.mjs} +176 -75
- package/dist/client/{eventCalendar-uZrksODt.mjs → eventCalendar-BlsD5R8M.mjs} +4 -4
- package/dist/client/{eventCombined-DxhvNAx8.mjs → eventCombined-B9Ly3024.mjs} +4 -4
- package/dist/client/{eventDetails-DCIH4BYG.mjs → eventDetails-CbEGI4jO.mjs} +2 -2
- package/dist/client/{eventListing-B9KrnPvc.mjs → eventListing-ZSmvhWII.mjs} +4 -4
- package/dist/client/{eventRegistration-TjnURMKl.mjs → eventRegistration-D-yUcIyO.mjs} +4 -4
- package/dist/client/{form-CfqIAhfN.mjs → form-DG_YZSNn.mjs} +3 -3
- package/dist/client/{form.client-CL6fF0cW.mjs → form.client-BU6dM0-C.mjs} +4 -4
- package/dist/client/{form.parts-Bf-L66Gg.mjs → form.parts-Db0Iq7nx.mjs} +1 -1
- package/dist/client/{formatDate-Dp7POa9Y.mjs → formatDate-DFfWHpQB.mjs} +1 -1
- package/dist/client/gifting/client.mjs +5 -3
- package/dist/client/gifting-DMrsN4B4.mjs +28 -0
- package/dist/client/gifting.client-BVa2XYJB.mjs +404 -0
- package/dist/client/gifting.parts-C2u4Y-pf.mjs +86 -0
- package/dist/client/{headerSection-WVXtOcuW.mjs → headerSection-D91EzlOR.mjs} +2 -2
- package/dist/client/{display-Cf_j5stk.mjs → lookSurfaces-BDZLALxj.mjs} +2951 -14395
- package/dist/client/{newsletter-form.client-Bb7GAZpO.mjs → newsletter-form.client-BMGRiRpo.mjs} +7 -5
- package/dist/client/{newsletter-form.parts-BqOVRdIc.mjs → newsletter-form.parts-D5UfUaD3.mjs} +3 -3
- package/dist/client/{newsletterForm-DOVe-qY3.mjs → newsletterForm-B_67sNwa.mjs} +3 -3
- package/dist/client/{noop-D5mFWXtN.mjs → noop-DF8_EiFt.mjs} +93 -28
- package/dist/client/portal/client.mjs +313 -148
- package/dist/client/{product-detail.client-CNzeFnFf.mjs → product-detail.client-D-XNir0m.mjs} +1 -1
- package/dist/client/{product-list.client-LKpzC7pj.mjs → product-list.client-BLfYQ-qi.mjs} +1 -1
- package/dist/client/{productDetail-D2JNeEgx.mjs → productDetail-W0_0lDGe.mjs} +3 -3
- package/dist/client/{productList-DTgZXOEq.mjs → productList-ayAtPJdb.mjs} +3 -3
- package/dist/client/{propsDecoder-mpBQt2AT.mjs → propsDecoder-ChYKWjLA.mjs} +4 -3
- package/dist/client/{registry.server-DdTJyar2.mjs → registry.server-B1EEZkcr.mjs} +307 -240
- package/dist/client/rendering/client.mjs +25 -491
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +7 -6
- package/dist/client/{richText-coerce-C32cRQ03.mjs → richText-coerce-CDAfpMQU.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-8cfSgT0E.mjs → routeIslandApiConfig-CcGWvyht.mjs} +1 -1
- package/dist/client/{shop-5LBhftWx.mjs → shop-DbUUoHFJ.mjs} +3 -3
- package/dist/client/{shop-discount-apply.state-D0ifS6KX.mjs → shop-add-feedback-DvC2kP1K.mjs} +1 -78
- package/dist/client/{shop-commerce-DkValjZj.mjs → shop-commerce-aQqcDmyZ.mjs} +64 -32
- package/dist/client/{shop-commerce-store-BOmXFmk_.mjs → shop-commerce-store-Cd7USpuY.mjs} +1 -1
- package/dist/client/shop-discount-apply.state-DGvPBmVP.mjs +83 -0
- package/dist/client/{shop.client-BTtZqNmv.mjs → shop.client-BNZ9M8cG.mjs} +56 -19
- package/dist/client/{shop.interactive-DNRqG4aX.mjs → shop.interactive-CJAINJr3.mjs} +113 -35
- package/dist/client/{shopShared-Nky6kPYr.mjs → shopShared-DwVAuGsx.mjs} +2 -2
- package/dist/client/{timetableModel-DZArznD_.mjs → timetableModel-DBTIFWTb.mjs} +10 -10
- package/dist/client/{useAvailableSlots-CUVRD1nx.mjs → useAvailableSlots-BomyyKeo.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-d7viY_mu.mjs → useDiscountCodeUi-CCxHMWlU.mjs} +32 -17
- package/dist/client/{useEventPagination-Da2JqxGC.mjs → useEventPagination-Bjin_qaN.mjs} +7 -6
- package/dist/client/{view-BvuYmQJ5.mjs → view-BTk470k0.mjs} +3 -2
- package/dist/client/{view-D9ObkFtz.mjs → view-Cw4EmEPv.mjs} +99 -30
- package/dist/preview-next/client/{PageSectionToolbar-DwxHT-2k.mjs → PageSectionToolbar-bq7gbKvn.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-D4SBxGU6.mjs → PreviewEditorSidebar-DVsPNcos.mjs} +28 -25
- package/dist/preview-next/client/{PreviewEditorUI-D8mUct32.mjs → PreviewEditorUI-B-pq3aZc.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-L2AEdNUQ.mjs → PreviewShell-ChyjB96e.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-bhVAU2D2.mjs → SdkPreviewModeRuntime-D_czeC0l.mjs} +84 -101
- package/dist/preview-next/client/{previewAssistantSlot-Jpj_HDra.mjs → previewAssistantSlot-B61mZd81.mjs} +4141 -2677
- package/dist/preview-next/client/{previewChromeRoot-CYTDvx4u.mjs → previewChromeRoot-dwOn9XtM.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CZHX6J_4.mjs → sdk-runtime-DZDfOxoW.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-DmGIG9Hk.mjs → siteStyleAccess-BZDIC-fA.mjs} +527 -236
- package/dist/preview-next/client/{useAutosaveStatus-DQCyswQ-.mjs → useAutosaveStatus-BbzLMf-l.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-LwE5yXvL.mjs → useOpenBlockForSetup-BEXcWQeI.mjs} +13 -4
- package/dist/preview-next/container-responsive.css +51 -3
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BOuNcOcN.mjs → route-contract-0gSlK9S0.mjs} +86 -12
- package/dist/server/{Block.shared-wfJfhs08.mjs → Block.shared-DeXXycg8.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-BtrJNHTB.mjs → ThemeScopeCore-DFEM1a85.mjs} +16 -2
- package/dist/server/{bindings-P1CF2Gm6.mjs → bindings-7L3pC5Os.mjs} +13 -34
- package/dist/server/{client-CGtU5fHI.mjs → client-CgghATBm.mjs} +111 -20
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{customCss-BGB8gMVb.mjs → customCss-BZ8YSrQg.mjs} +1 -0
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-ChnkJSay.mjs → loadContent-D7M5Vcug.mjs} +5 -5
- package/dist/server/{loadPage-DesHhgxj.mjs → loadPage-CiTId05y.mjs} +2 -2
- package/dist/server/{lookMediaFrame-BBr0mkze.mjs → lookMediaFrame-CaH018pK.mjs} +24 -5
- package/dist/server/next.mjs +35 -9
- package/dist/server/{overrideResolution-DHEkHcZs.mjs → overrideResolution-CJ3MRI5Q.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-0jvm0RBk.mjs → pageRenderPlan-Cuos4Xcd.mjs} +97 -39
- package/dist/server/{pageRuntimeSupport-8-f1Zr9e.mjs → pageRuntimeSupport-CuVj3bkd.mjs} +4 -3
- package/dist/server/{pageShared-CuVFoV4z.mjs → pageShared-JxlV8_Bo.mjs} +1261 -1129
- package/dist/server/{parseThemeForPersistence-Cwqb5pZx.mjs → parseThemeForPersistence-DOsfofCy.mjs} +1 -1
- package/dist/server/{prebuild-Bms_Y7wQ.mjs → prebuild-BDhlJbAx.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-5oC5kyHe.mjs → prefetchBlockData-kERh_c0v.mjs} +2 -2
- package/dist/server/{registry-DmqxC8th.mjs → registry-cQ9N5W-n.mjs} +20432 -20165
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +3 -3
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-EYogtwQc.mjs → resolveBlockData-CN4UmmTK.mjs} +1 -1
- package/dist/server/{schema-CUDHMirj.mjs → schema-BpsqaSSU.mjs} +2 -2
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{validation-Bt_8IL1g.mjs → validation-3puM5SM8.mjs} +3 -3
- package/dist/server/{version-DT_efohp.mjs → version-B8g-Wx57.mjs} +1 -1
- package/dist/styles/index.css +295 -37
- package/package.json +1 -1
- package/dist/client/useDiscountApply-BBnStWXU.mjs +0 -199
package/dist/client/{EventRegistrationPayment-Dn9TpWyL.mjs → EventRegistrationPayment-BMmPDmSf.mjs}
RENAMED
|
@@ -1,132 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $
|
|
3
|
-
import {
|
|
4
|
-
import { o as checkBookingQuestionsAnswered
|
|
5
|
-
import { a as
|
|
2
|
+
import { $ as resolveEventRegistrationSubmitPlan, $n as parseCurrencyInputToCents, $o as publicEventPricingCurrency, $t as planSelectionPrice, An as serverPricedTotalCents, Ao as eventRegistrationErrorEndsCommand, B as getTicketSelectionPurpose, Ba as requestSignIn, Bn as getImplicitSingleTicketType, Bt as deriveRunRequirements, Ct as validateFormData, D as registrationRoute, E as registrationPresentation, En as selectionCombinationHint, F as registrationFlowReducer, Ft as eventSignInRestoration, G as resolveRegistrationAdmission, Gn as transformRegistrationOptionsResponse, Gt as withoutKeptAnswers, H as planRegistrationDetailsCheck, Ht as runFieldErrors, I as buildEventRegistrationPaymentOptionsViewModel, Ia as PAGE_NAVIGATION, It as toEventSignInDraft, Jn as getEligibilityFlowFlags, Kt as paymentReturnRestoration, L as decideEventRegistrationPayment, Lt as buildSelectionRequirementsSubmission, M as decideEventChoice, Mo as parseEventRegistrationErrorReason, Mt as EVENT_SIGN_IN_FORM_ID, N as getDeclinedPass, Nn as findSelectedTicketType, Nt as eventSignInDraftStore, On as selectionPreviewKey, Ot as getRegistrationStartAt, P as isRegistrationLocked, Pt as eventSignInEnds, Qi as needsBookingQuestionsRefresh, Qn as getTicketSelectionRemainingPlaces, Qt as incompleteRunChoiceMessage, Ra as leavePage, Rt as checkRunRequirements, Sn as combinationHintCopy, St as registrationQuestionsMessage, T as registrationPaymentRoute, Tn as combinationWorking, Tt as toWaitlistClaimResolveFailure, U as planRegistrationDetailsContinuation, Un as getVisibleTicketTypes, Ut as runsKeepingAnswers, Vn as getPortalSubjectEmail, Vo as resolveBookingSignupOffer, Vt as nextRunToRead, W as resolveGuestNextStepCheck, Wt as toRunRequirementsSnapshots, Xn as getSlidingScaleForEvent, Xt as decideSelectionPayment, Y as visitorHoldsOwnPlace, Yn as getRegistrationOccurrenceId, Yt as canToggleSelectionItem, Zi as deriveBookingQuestions, Zn as getSlidingScaleSelectionMessage, Zt as effectiveSelection, _t as resolveRouteRequiresPayment, bn as summariseSelectionPayment, bt as createRegistrationDraftData, c as formatCommercePrice, cr as hasValidPricingOptionSelection, dn as selectionItemPrice, dt as restorableBrowserDraftCode, en as primarySelectionItem, er as resolveHeldTicketPlaces, ft as buildRegistrationSelectionRequest, gn as selectionTicketInputs, gt as resolveRegistrationTarget, ht as resolveEventRequiresPayment, ir as getSingleSelectedPricingOptionId, it as calculateEventRegistrationPreviewTotal, j as createInitialRegistrationFlowState, jo as eventRegistrationErrors, jt as toWholeSeriesRegistrationEvents, kn as selectionPreviewLines, ko as decideSelectionAttendance, kt as toRegistrationEvents, lr as normalizeTicketSelectionLines, lt as registrationBrowserDraft, mt as resolveDiscountContext, nr as withRegistrationAvailability, pt as findPreSelectedEvent, q as resolveRegistrationTicketContinuation, qa as resolveEventRegistrationChoices, qn as getCurrentTicketSelection, t as appliedDiscountHint, ta as toBookingQuestionsPaymentSnapshot, tn as registrationSelectionMode, tr as shouldLoadRegistrationOptions, un as selectionIncludes, ut as registrationBrowserDraftSchema, vn as severalItemsOf, vt as toRegistrationRequestSubject, wn as combinationOffersOf, wt as isSameWaitlistClaim, xn as toggleSelectionItem, xt as invitationSubmission, yn as severalRunsChoiceMessage, yt as beginWaitlistInvitation, zi as formatCentsAsCurrencyInput, zt as decideSelectionRequirementsLayout } from "./display-DMqotaGU.mjs";
|
|
3
|
+
import { en as inferSiteDateLocale, fn as resolveBookingBusinessTimeZone, n as assertNever } from "./noop-DF8_EiFt.mjs";
|
|
4
|
+
import { o as checkBookingQuestionsAnswered } from "./creditProducts-BQ1t1erI.mjs";
|
|
5
|
+
import { a as eventSiteTermsSurface, i as useSiteTermsAgreement, r as siteTermsFailureKind } from "./SiteTermsAgreementField-Dr5lj4oY.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-D8TpQXjX.mjs";
|
|
8
8
|
import { t as resolveDedicatedBookingHref } from "./bookingRoute-D6DlxYx6.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { r as DISCOUNT_APPLY_MESSAGES } from "./DemoBookingPortalAccess-DGgsjqXK.mjs";
|
|
10
|
+
import { i as useBookingNowIso, r as parseBookingSubmissionFailure } from "./BookingQuestionFields-CUFxBaTM.mjs";
|
|
11
|
+
import { t as useDiscountCodeUi } from "./useDiscountCodeUi-CCxHMWlU.mjs";
|
|
12
|
+
import { a as usePolling, c as useBookingQuestionsRefresh, o as portalSessionIdentity, s as useSignInReturn } from "./BookingMailingListNote-qsohSEdQ.mjs";
|
|
12
13
|
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-
|
|
14
|
-
import { t as DISCOUNT_APPLY_MESSAGES } from "./useDiscountApply-BBnStWXU.mjs";
|
|
14
|
+
import { o as storeDemoBookingPass, t as CUSTOMER_PORTAL_PATH } from "./demoPortalMagicLink-BdcuW_pa.mjs";
|
|
15
15
|
import { Suspense, lazy, useCallback, useEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
16
16
|
import { jsx } from "react/jsx-runtime";
|
|
17
17
|
import { z } from "zod";
|
|
18
|
-
//#region ../commerce/src/purchase/event-registration-errors.ts
|
|
19
|
-
const eventRegistrationErrors = {
|
|
20
|
-
invalidAnswers: {
|
|
21
|
-
endsCommand: false,
|
|
22
|
-
message: "Some questions still need an answer.",
|
|
23
|
-
action: "details"
|
|
24
|
-
},
|
|
25
|
-
wholeCourseOnly: {
|
|
26
|
-
endsCommand: false,
|
|
27
|
-
message: "This course is booked as a whole course, so single dates can’t be booked on their own. Please go back to the event and book the full course.",
|
|
28
|
-
action: "event"
|
|
29
|
-
},
|
|
30
|
-
registrationClosed: {
|
|
31
|
-
endsCommand: false,
|
|
32
|
-
message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
|
|
33
|
-
action: "none"
|
|
34
|
-
},
|
|
35
|
-
siteNotTakingBookings: {
|
|
36
|
-
endsCommand: false,
|
|
37
|
-
message: "This business isn’t taking online bookings right now. Please contact them if you’d like to book.",
|
|
38
|
-
action: "none"
|
|
39
|
-
},
|
|
40
|
-
paymentInvestigationRequired: {
|
|
41
|
-
endsCommand: false,
|
|
42
|
-
message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
|
|
43
|
-
action: "none"
|
|
44
|
-
},
|
|
45
|
-
paymentProviderUnavailable: {
|
|
46
|
-
endsCommand: false,
|
|
47
|
-
message: "We couldn’t reach the payment provider. Please try again in a minute.",
|
|
48
|
-
action: "retry"
|
|
49
|
-
},
|
|
50
|
-
paymentHostUnavailable: {
|
|
51
|
-
endsCommand: false,
|
|
52
|
-
message: "Card payments aren’t available on this web address yet. Please contact the organiser to book.",
|
|
53
|
-
action: "none"
|
|
54
|
-
},
|
|
55
|
-
paymentPageUnavailable: {
|
|
56
|
-
endsCommand: false,
|
|
57
|
-
message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
|
|
58
|
-
action: "retry"
|
|
59
|
-
},
|
|
60
|
-
paymentUnavailable: {
|
|
61
|
-
endsCommand: false,
|
|
62
|
-
message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
|
|
63
|
-
action: "none"
|
|
64
|
-
},
|
|
65
|
-
capacityChanged: {
|
|
66
|
-
endsCommand: false,
|
|
67
|
-
message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
|
|
68
|
-
action: "places"
|
|
69
|
-
},
|
|
70
|
-
selectionChanged: {
|
|
71
|
-
endsCommand: false,
|
|
72
|
-
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
73
|
-
action: "places"
|
|
74
|
-
},
|
|
75
|
-
paymentSetupFailed: {
|
|
76
|
-
endsCommand: true,
|
|
77
|
-
message: "We couldn't set up payment for this booking, so your place hasn't been reserved and you haven't been charged. Please try again in a few minutes, or contact the organiser if it keeps happening.",
|
|
78
|
-
action: "retry"
|
|
79
|
-
},
|
|
80
|
-
registrationAttemptEnded: {
|
|
81
|
-
endsCommand: true,
|
|
82
|
-
message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
|
|
83
|
-
action: "start"
|
|
84
|
-
},
|
|
85
|
-
registrationPreparationChanged: {
|
|
86
|
-
endsCommand: true,
|
|
87
|
-
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
88
|
-
action: "places"
|
|
89
|
-
},
|
|
90
|
-
registrationAlreadyExists: {
|
|
91
|
-
endsCommand: false,
|
|
92
|
-
message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
|
|
93
|
-
action: "portal"
|
|
94
|
-
},
|
|
95
|
-
holdExpired: {
|
|
96
|
-
endsCommand: false,
|
|
97
|
-
message: "Your reservation has timed out. Please check availability and choose your places again.",
|
|
98
|
-
action: "start"
|
|
99
|
-
},
|
|
100
|
-
waitlistUnavailable: {
|
|
101
|
-
endsCommand: false,
|
|
102
|
-
message: "Sorry, the waiting list place offered in this invitation is no longer available. Please check the event for available places or contact the organiser for help.",
|
|
103
|
-
action: "event"
|
|
104
|
-
},
|
|
105
|
-
paymentContextMismatch: {
|
|
106
|
-
endsCommand: false,
|
|
107
|
-
message: "The payment options for this event have changed. Please check the latest options before continuing.",
|
|
108
|
-
action: "payment-options"
|
|
109
|
-
},
|
|
110
|
-
idempotencyConflict: {
|
|
111
|
-
endsCommand: false,
|
|
112
|
-
message: "You’ve already started booking this event. Please finish in the other tab if it’s still open, or check your booking status before starting again.",
|
|
113
|
-
action: "portal"
|
|
114
|
-
},
|
|
115
|
-
invalidCommitInput: {
|
|
116
|
-
endsCommand: false,
|
|
117
|
-
message: "We couldn’t accept your booking details. Please check the information you entered and try again. If this keeps happening, contact the organiser for help.",
|
|
118
|
-
action: "details"
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
function parseEventRegistrationErrorReason(value) {
|
|
122
|
-
return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
|
|
123
|
-
}
|
|
124
|
-
/** Only a server-confirmed refusal ends an identity; transport uncertainty retains it. */
|
|
125
|
-
function eventRegistrationErrorEndsCommand(value) {
|
|
126
|
-
const reason = parseEventRegistrationErrorReason(value);
|
|
127
|
-
return reason !== null && eventRegistrationErrors[reason].endsCommand;
|
|
128
|
-
}
|
|
129
|
-
//#endregion
|
|
130
18
|
//#region ../blocks/src/system/runtime/shared/utils/portalLogout.ts
|
|
131
19
|
/**
|
|
132
20
|
* Portal Logout Utility
|
|
@@ -153,32 +41,28 @@ function logoutPortal(anchorId) {
|
|
|
153
41
|
}
|
|
154
42
|
//#endregion
|
|
155
43
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountView.state.ts
|
|
156
|
-
/**
|
|
44
|
+
/** The quote owns the code for one booking or several; one booking still finds out what's on offer from availability. */
|
|
157
45
|
function registrationDiscountView(input) {
|
|
46
|
+
const { selection } = input;
|
|
47
|
+
const shared = {
|
|
48
|
+
code: selection.draftCode,
|
|
49
|
+
editCode: selection.editCode,
|
|
50
|
+
submittedCode: selection.decidedCode ?? "",
|
|
51
|
+
editingCode: Boolean(selection.draftCode.trim())
|
|
52
|
+
};
|
|
158
53
|
if (!input.several) return {
|
|
159
|
-
|
|
160
|
-
editCode: input.single.setDiscountCode,
|
|
161
|
-
submittedCode: input.single.discountCode,
|
|
162
|
-
paymentDraftCode: input.single.discountCode,
|
|
54
|
+
...shared,
|
|
163
55
|
manualCodeEntryAllowed: input.context !== null && input.single.manualCodeEntryAllowed,
|
|
164
56
|
discountsAvailableLoading: input.single.discountsAvailableLoading,
|
|
165
57
|
discountsAvailable: input.single.discountsAvailable,
|
|
166
|
-
|
|
167
|
-
several: false,
|
|
168
|
-
editingCode: false
|
|
58
|
+
several: false
|
|
169
59
|
};
|
|
170
|
-
const { selection } = input;
|
|
171
60
|
return {
|
|
172
|
-
|
|
173
|
-
editCode: selection.editCode,
|
|
174
|
-
submittedCode: selection.decidedCode ?? "",
|
|
175
|
-
paymentDraftCode: "",
|
|
61
|
+
...shared,
|
|
176
62
|
manualCodeEntryAllowed: selection.manualCodeEntryAllowed,
|
|
177
63
|
discountsAvailableLoading: selection.state.status === "pending" && !selection.draftCode.trim(),
|
|
178
64
|
discountsAvailable: selection.manualCodeEntryAllowed || selection.quote?.preview.type === "applied",
|
|
179
|
-
|
|
180
|
-
several: true,
|
|
181
|
-
editingCode: Boolean(selection.draftCode.trim())
|
|
65
|
+
several: true
|
|
182
66
|
};
|
|
183
67
|
}
|
|
184
68
|
/** A draft code must remain editable while its price is unresolved and payment choices are disabled. */
|
|
@@ -186,6 +70,91 @@ function registrationDiscountEntryVisible(view, method) {
|
|
|
186
70
|
return (view.manualCodeEntryAllowed || view.editingCode) && (view.several || method === "stripe" || method === "pass_bundle" || method === "membership_bundle");
|
|
187
71
|
}
|
|
188
72
|
//#endregion
|
|
73
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountCode.state.ts
|
|
74
|
+
const NO_REDUCTION = {
|
|
75
|
+
bookingTotalCents: null,
|
|
76
|
+
automaticDiscount: null,
|
|
77
|
+
passTotalCents: null,
|
|
78
|
+
membershipFirstPaymentCents: null
|
|
79
|
+
};
|
|
80
|
+
function decideSingleBookingPrices(input) {
|
|
81
|
+
const { context, quote } = input;
|
|
82
|
+
if (input.several || !context) return NO_REDUCTION;
|
|
83
|
+
if (context.type === "event") return eventPrices(input, quote);
|
|
84
|
+
if (!quote) return NO_REDUCTION;
|
|
85
|
+
if (context.type === "pass") return {
|
|
86
|
+
...NO_REDUCTION,
|
|
87
|
+
passTotalCents: reducedTotal(quote)
|
|
88
|
+
};
|
|
89
|
+
return context.type === "membership" ? {
|
|
90
|
+
...NO_REDUCTION,
|
|
91
|
+
membershipFirstPaymentCents: reducedTotal(quote)
|
|
92
|
+
} : NO_REDUCTION;
|
|
93
|
+
}
|
|
94
|
+
function eventPrices(input, quote) {
|
|
95
|
+
if (!quote) return input.typedCode.trim() || input.lookupFailed ? NO_REDUCTION : {
|
|
96
|
+
...NO_REDUCTION,
|
|
97
|
+
automaticDiscount: input.advertisedAutomatic
|
|
98
|
+
};
|
|
99
|
+
if (quote.preview.type !== "applied") return NO_REDUCTION;
|
|
100
|
+
return quote.source === "typed" ? {
|
|
101
|
+
...NO_REDUCTION,
|
|
102
|
+
bookingTotalCents: quote.preview.totalAfterDiscountCents
|
|
103
|
+
} : {
|
|
104
|
+
...NO_REDUCTION,
|
|
105
|
+
automaticDiscount: automaticFromQuote(quote.preview, input.advertisedAutomatic)
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
function reducedTotal(quote) {
|
|
109
|
+
return quote.preview.type === "applied" ? quote.preview.totalAfterDiscountCents : null;
|
|
110
|
+
}
|
|
111
|
+
/** The discount the server chose for this customer, which may not be the one advertised to everyone. */
|
|
112
|
+
function automaticFromQuote(preview, advertised) {
|
|
113
|
+
const shared = {
|
|
114
|
+
code: preview.code,
|
|
115
|
+
publicLabel: preview.publicLabel,
|
|
116
|
+
description: preview.description,
|
|
117
|
+
computedAmountCents: preview.discountCents
|
|
118
|
+
};
|
|
119
|
+
return advertised?.code === preview.code ? {
|
|
120
|
+
...advertised,
|
|
121
|
+
...shared
|
|
122
|
+
} : {
|
|
123
|
+
...shared,
|
|
124
|
+
id: preview.code,
|
|
125
|
+
discountType: "fixed",
|
|
126
|
+
discountPercent: null,
|
|
127
|
+
discountAmountCents: preview.discountCents
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
/** What an applied code does to this purchase, said beside the code. */
|
|
131
|
+
function appliedCodeHint(selection, discount) {
|
|
132
|
+
if (!discount) return "";
|
|
133
|
+
if (selection.method !== "membership_bundle") return appliedDiscountHint({
|
|
134
|
+
...discount,
|
|
135
|
+
membership: null
|
|
136
|
+
}) ?? "";
|
|
137
|
+
const { productPrice, productInterval } = selection;
|
|
138
|
+
if (!productPrice || productInterval !== "month" && productInterval !== "year") return "";
|
|
139
|
+
return appliedDiscountHint({
|
|
140
|
+
...discount,
|
|
141
|
+
membership: {
|
|
142
|
+
priceCents: productPrice,
|
|
143
|
+
billingInterval: productInterval
|
|
144
|
+
}
|
|
145
|
+
}) ?? "";
|
|
146
|
+
}
|
|
147
|
+
/** Holds Pay for a code awaiting Apply, and says whether that's the only thing holding it. */
|
|
148
|
+
function holdPaymentForCode(state, awaitingApply) {
|
|
149
|
+
return {
|
|
150
|
+
state: awaitingApply ? {
|
|
151
|
+
...state,
|
|
152
|
+
canContinue: false
|
|
153
|
+
} : state,
|
|
154
|
+
heldForCode: awaitingApply && state.canContinue
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
189
158
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.ts
|
|
190
159
|
function resolveRegistrationRecoveryAction(step, action) {
|
|
191
160
|
if (step === "payment-failed") return "payment-options";
|
|
@@ -289,6 +258,335 @@ function receiveHandOff(outcome, receive) {
|
|
|
289
258
|
});
|
|
290
259
|
}
|
|
291
260
|
//#endregion
|
|
261
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/sessionStorage.ts
|
|
262
|
+
const STORAGE_PREFIX = "riverbank:event-registration:";
|
|
263
|
+
const STALE_THRESHOLD_MS = 1440 * 60 * 1e3;
|
|
264
|
+
const browserDraftEntry = z.object({
|
|
265
|
+
version: z.literal(1),
|
|
266
|
+
timestamp: z.number().finite(),
|
|
267
|
+
draft: registrationBrowserDraftSchema
|
|
268
|
+
});
|
|
269
|
+
/** This tab's unfinished form is scoped to the site and booking surface, not a checkout attempt. */
|
|
270
|
+
function saveRegistrationBrowserDraft(scope, draft) {
|
|
271
|
+
try {
|
|
272
|
+
const entry = browserDraftEntry.parse({
|
|
273
|
+
version: 1,
|
|
274
|
+
timestamp: Date.now(),
|
|
275
|
+
draft
|
|
276
|
+
});
|
|
277
|
+
sessionStorage.setItem(`riverbank:event-draft:${scope}`, JSON.stringify(entry));
|
|
278
|
+
} catch {}
|
|
279
|
+
}
|
|
280
|
+
function getRegistrationBrowserDraft(scope) {
|
|
281
|
+
try {
|
|
282
|
+
const stored = sessionStorage.getItem(`riverbank:event-draft:${scope}`);
|
|
283
|
+
const entry = browserDraftEntry.safeParse(stored ? JSON.parse(stored) : null);
|
|
284
|
+
if (entry.success && Date.now() - entry.data.timestamp <= STALE_THRESHOLD_MS) return entry.data.draft;
|
|
285
|
+
clearRegistrationBrowserDraft(scope);
|
|
286
|
+
} catch {}
|
|
287
|
+
return null;
|
|
288
|
+
}
|
|
289
|
+
function clearRegistrationBrowserDraft(scope) {
|
|
290
|
+
try {
|
|
291
|
+
sessionStorage.removeItem(`riverbank:event-draft:${scope}`);
|
|
292
|
+
} catch {}
|
|
293
|
+
}
|
|
294
|
+
const paymentSelection = z.discriminatedUnion("method", [
|
|
295
|
+
z.object({ method: z.literal("free") }),
|
|
296
|
+
z.object({
|
|
297
|
+
method: z.literal("stripe"),
|
|
298
|
+
collectionOptionKind: z.enum([
|
|
299
|
+
"upfront",
|
|
300
|
+
"deferred_manual",
|
|
301
|
+
"instalment_plan",
|
|
302
|
+
"flexible_balance"
|
|
303
|
+
])
|
|
304
|
+
}),
|
|
305
|
+
z.object({
|
|
306
|
+
method: z.literal("pass"),
|
|
307
|
+
passId: z.string(),
|
|
308
|
+
productName: z.string().optional()
|
|
309
|
+
}),
|
|
310
|
+
z.object({
|
|
311
|
+
method: z.literal("membership"),
|
|
312
|
+
membershipId: z.string(),
|
|
313
|
+
productName: z.string().optional()
|
|
314
|
+
}),
|
|
315
|
+
z.object({
|
|
316
|
+
method: z.literal("pass_bundle"),
|
|
317
|
+
bundlePassId: z.string(),
|
|
318
|
+
productName: z.string().optional(),
|
|
319
|
+
productDescription: z.string().optional(),
|
|
320
|
+
productPrice: z.number().optional(),
|
|
321
|
+
productCurrency: z.string().optional()
|
|
322
|
+
}),
|
|
323
|
+
z.object({
|
|
324
|
+
method: z.literal("membership_bundle"),
|
|
325
|
+
bundleMembershipId: z.string(),
|
|
326
|
+
productName: z.string().optional(),
|
|
327
|
+
productDescription: z.string().optional(),
|
|
328
|
+
productPrice: z.number().optional(),
|
|
329
|
+
productCurrency: z.string().optional(),
|
|
330
|
+
productInterval: z.string().optional()
|
|
331
|
+
})
|
|
332
|
+
]);
|
|
333
|
+
const reference = z.discriminatedUnion("scope", [z.object({
|
|
334
|
+
scope: z.literal("occurrence"),
|
|
335
|
+
attendeeId: z.string()
|
|
336
|
+
}), z.object({
|
|
337
|
+
scope: z.literal("wholeSeries"),
|
|
338
|
+
registrationId: z.string()
|
|
339
|
+
})]);
|
|
340
|
+
const shared = {
|
|
341
|
+
formData: z.object({
|
|
342
|
+
name: z.string(),
|
|
343
|
+
email: z.string(),
|
|
344
|
+
phone: z.string()
|
|
345
|
+
}),
|
|
346
|
+
ticketSelections: z.array(z.object({
|
|
347
|
+
pricingOptionId: z.string().nullable(),
|
|
348
|
+
quantity: z.number().int().positive()
|
|
349
|
+
})).min(1),
|
|
350
|
+
selectedAttendanceMode: z.enum(["in_person", "online"]).nullable().optional(),
|
|
351
|
+
paymentSelection,
|
|
352
|
+
guests: z.array(z.object({
|
|
353
|
+
name: z.string(),
|
|
354
|
+
email: z.string().nullable(),
|
|
355
|
+
phone: z.string().nullable()
|
|
356
|
+
})),
|
|
357
|
+
selectedSlidingAmount: z.number().nullable(),
|
|
358
|
+
discountCode: z.string(),
|
|
359
|
+
mailingListSignupNote: z.enum(["confirmation_required", "not_confirmed"]).optional(),
|
|
360
|
+
timestamp: z.number().finite()
|
|
361
|
+
};
|
|
362
|
+
const currentSchema = z.object({
|
|
363
|
+
...shared,
|
|
364
|
+
version: z.literal(7),
|
|
365
|
+
selectedEventIds: z.array(z.string()),
|
|
366
|
+
runChoices: z.record(z.string(), z.object({
|
|
367
|
+
pricingOptionId: z.string().nullable(),
|
|
368
|
+
slidingAmountInput: z.string()
|
|
369
|
+
})).optional()
|
|
370
|
+
});
|
|
371
|
+
/** Saved before booking several existed: one reference and one event. */
|
|
372
|
+
const version6Schema = z.object({
|
|
373
|
+
...shared,
|
|
374
|
+
version: z.literal(6),
|
|
375
|
+
reference,
|
|
376
|
+
selectedEventId: z.string().nullable()
|
|
377
|
+
}).transform(({ reference: _reference, selectedEventId, ...rest }) => ({
|
|
378
|
+
...rest,
|
|
379
|
+
version: 7,
|
|
380
|
+
selectedEventIds: selectedEventId === null ? [] : [selectedEventId]
|
|
381
|
+
}));
|
|
382
|
+
const schema = z.union([currentSchema, version6Schema]);
|
|
383
|
+
function key(siteId, submissionId) {
|
|
384
|
+
return `${STORAGE_PREFIX}${siteId}:${submissionId}`;
|
|
385
|
+
}
|
|
386
|
+
function savePendingRegistration(siteId, submissionId, data) {
|
|
387
|
+
try {
|
|
388
|
+
const entry = z.safeParse(currentSchema, {
|
|
389
|
+
...data,
|
|
390
|
+
ticketSelections: normalizeTicketSelectionLines(data.ticketSelections),
|
|
391
|
+
version: 7,
|
|
392
|
+
timestamp: Date.now()
|
|
393
|
+
});
|
|
394
|
+
if (entry.success) sessionStorage.setItem(key(siteId, submissionId), JSON.stringify(entry.data));
|
|
395
|
+
} catch {}
|
|
396
|
+
}
|
|
397
|
+
function getPendingRegistration(siteId, submissionId) {
|
|
398
|
+
try {
|
|
399
|
+
const stored = sessionStorage.getItem(key(siteId, submissionId));
|
|
400
|
+
const parsed = z.safeParse(schema, stored ? JSON.parse(stored) : null);
|
|
401
|
+
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) {
|
|
402
|
+
clearPendingRegistration(siteId, submissionId);
|
|
403
|
+
return null;
|
|
404
|
+
}
|
|
405
|
+
sessionStorage.setItem(key(siteId, submissionId), JSON.stringify(parsed.data));
|
|
406
|
+
return parsed.data;
|
|
407
|
+
} catch {
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
function clearPendingRegistration(siteId, submissionId) {
|
|
412
|
+
try {
|
|
413
|
+
sessionStorage.removeItem(key(siteId, submissionId));
|
|
414
|
+
} catch {}
|
|
415
|
+
}
|
|
416
|
+
function cleanupStaleRegistrations() {
|
|
417
|
+
try {
|
|
418
|
+
Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)).filter((item) => item !== null && item.startsWith(STORAGE_PREFIX)).forEach((item) => {
|
|
419
|
+
try {
|
|
420
|
+
const parsed = z.safeParse(schema, JSON.parse(sessionStorage.getItem(item) ?? "null"));
|
|
421
|
+
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) sessionStorage.removeItem(item);
|
|
422
|
+
else sessionStorage.setItem(item, JSON.stringify(parsed.data));
|
|
423
|
+
} catch {
|
|
424
|
+
sessionStorage.removeItem(item);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
} catch {}
|
|
428
|
+
}
|
|
429
|
+
//#endregion
|
|
430
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useRegistrationBrowserDraft.ts
|
|
431
|
+
/** One form per site, path and booking context; SDK pages use the same browser key. */
|
|
432
|
+
function registrationBrowserScope(siteId, surface) {
|
|
433
|
+
return JSON.stringify([
|
|
434
|
+
siteId,
|
|
435
|
+
surface.anchorId,
|
|
436
|
+
surface.occurrenceContext?.id,
|
|
437
|
+
surface.subject,
|
|
438
|
+
typeof window === "undefined" ? "" : window.location.pathname
|
|
439
|
+
]);
|
|
440
|
+
}
|
|
441
|
+
/** Payment, sign-in and waiting-list returns keep their existing authority. */
|
|
442
|
+
function hasRegistrationReturn(flow) {
|
|
443
|
+
const params = new URLSearchParams(window.location.search);
|
|
444
|
+
return flow.invitation.kind !== "none" || params.has("registration") || params.has("rb_booking_sign_in");
|
|
445
|
+
}
|
|
446
|
+
/** Only the allowlisted contact, ticket and code draft survives a reload in this tab. */
|
|
447
|
+
function useRegistrationBrowserDraft(input) {
|
|
448
|
+
const [ready, setReady] = useState(false);
|
|
449
|
+
const restored = useRef(false);
|
|
450
|
+
useEffect(() => {
|
|
451
|
+
if (restored.current || !input.eventsReady) return;
|
|
452
|
+
restored.current = true;
|
|
453
|
+
const saved = hasRegistrationReturn(input.flow) ? null : getRegistrationBrowserDraft(input.scope);
|
|
454
|
+
if (saved) {
|
|
455
|
+
input.dispatch({
|
|
456
|
+
type: "browser-draft-restored",
|
|
457
|
+
draft: saved,
|
|
458
|
+
events: input.events
|
|
459
|
+
});
|
|
460
|
+
const code = restorableBrowserDraftCode(saved, input.events);
|
|
461
|
+
if (code.trim()) input.onDiscountCodeRestored(code);
|
|
462
|
+
}
|
|
463
|
+
setReady(true);
|
|
464
|
+
}, [input]);
|
|
465
|
+
return ready;
|
|
466
|
+
}
|
|
467
|
+
/** Called once the code is known, which is later in the wizard than the restore above. */
|
|
468
|
+
function useSaveRegistrationBrowserDraft(input) {
|
|
469
|
+
const { ready } = input;
|
|
470
|
+
useEffect(() => {
|
|
471
|
+
if (!ready) return;
|
|
472
|
+
if (input.flow.step === "success" || input.flow.step === "payment") {
|
|
473
|
+
clearRegistrationBrowserDraft(input.scope);
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
if (hasRegistrationReturn(input.flow)) return;
|
|
477
|
+
const draft = registrationBrowserDraft(input.flow, input.discountCode);
|
|
478
|
+
if (draft) saveRegistrationBrowserDraft(input.scope, draft);
|
|
479
|
+
}, [input, ready]);
|
|
480
|
+
}
|
|
481
|
+
//#endregion
|
|
482
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationBrowserHistory.ts
|
|
483
|
+
const entrySchema = z.object({
|
|
484
|
+
scope: z.string(),
|
|
485
|
+
trail: z.array(z.enum([
|
|
486
|
+
"select-event",
|
|
487
|
+
"select-tickets",
|
|
488
|
+
"enter-details",
|
|
489
|
+
"select-payment",
|
|
490
|
+
"payment"
|
|
491
|
+
])).min(1).readonly()
|
|
492
|
+
});
|
|
493
|
+
function readRegistrationHistory(state, scope) {
|
|
494
|
+
const container = z.object({ riverbankEventRegistration: entrySchema }).safeParse(state);
|
|
495
|
+
return container.success && container.data.riverbankEventRegistration.scope === scope ? container.data.riverbankEventRegistration : null;
|
|
496
|
+
}
|
|
497
|
+
/** Once checkout exists, history can check or resume it, never reopen an editable draft. */
|
|
498
|
+
function registrationHistoryNavigation(current, target, locked) {
|
|
499
|
+
if (target === "payment") return current === "payment-status" ? "continuePayment" : "stay";
|
|
500
|
+
if (current === "payment") return "checkPayment";
|
|
501
|
+
if (current === "payment-status") return "stay";
|
|
502
|
+
return locked ? "stay" : "navigate";
|
|
503
|
+
}
|
|
504
|
+
/** History contains step names only. Forward never submits, and Back never abandons checkout. */
|
|
505
|
+
function registrationHistoryChange(entry, step, route) {
|
|
506
|
+
if (!entry) return {
|
|
507
|
+
kind: "start",
|
|
508
|
+
steps: route.slice(0, route.indexOf(step) + 1)
|
|
509
|
+
};
|
|
510
|
+
if (entry.trail.at(-1) === step) return { kind: "stay" };
|
|
511
|
+
const previous = entry.trail.lastIndexOf(step);
|
|
512
|
+
return previous < 0 ? {
|
|
513
|
+
kind: "push",
|
|
514
|
+
trail: [...entry.trail, step]
|
|
515
|
+
} : {
|
|
516
|
+
kind: "back",
|
|
517
|
+
distance: previous - (entry.trail.length - 1)
|
|
518
|
+
};
|
|
519
|
+
}
|
|
520
|
+
//#endregion
|
|
521
|
+
//#region ../blocks/src/system/runtime/nodes/event-registration/useRegistrationBrowserHistory.ts
|
|
522
|
+
function historyRoute(presentation) {
|
|
523
|
+
return presentation.layout === "steps" ? presentation.progress?.steps ?? [] : [];
|
|
524
|
+
}
|
|
525
|
+
function writeHistory(entry, method) {
|
|
526
|
+
const previous = window.history.state;
|
|
527
|
+
const shared = previous !== null && typeof previous === "object" ? previous : {};
|
|
528
|
+
window.history[method]({
|
|
529
|
+
...shared,
|
|
530
|
+
riverbankEventRegistration: entry
|
|
531
|
+
}, "", window.location.href);
|
|
532
|
+
}
|
|
533
|
+
function navigateHistory(input, step) {
|
|
534
|
+
switch (registrationHistoryNavigation(input.step, step, input.locked ?? false)) {
|
|
535
|
+
case "checkPayment": return input.payment.check();
|
|
536
|
+
case "continuePayment": return input.payment.continuePayment();
|
|
537
|
+
case "navigate":
|
|
538
|
+
if (historyRoute(input.presentation).includes(step)) input.navigate(step);
|
|
539
|
+
return;
|
|
540
|
+
case "stay": return;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
/** Uses the browser API shared by managed and SDK sites; host-router state is retained. */
|
|
544
|
+
function useRegistrationBrowserHistory(input) {
|
|
545
|
+
const current = useRef({
|
|
546
|
+
input,
|
|
547
|
+
url: ""
|
|
548
|
+
});
|
|
549
|
+
current.current = {
|
|
550
|
+
input,
|
|
551
|
+
url: typeof window === "undefined" ? "" : window.location.href
|
|
552
|
+
};
|
|
553
|
+
const traversing = useRef(false);
|
|
554
|
+
useEffect(() => {
|
|
555
|
+
const pop = () => {
|
|
556
|
+
traversing.current = false;
|
|
557
|
+
const { input: active, url } = current.current;
|
|
558
|
+
const entry = readRegistrationHistory(window.history.state, active.scope);
|
|
559
|
+
const step = entry?.trail.at(-1);
|
|
560
|
+
if (entry && active.keepCurrentUrl) window.history.replaceState(window.history.state, "", url);
|
|
561
|
+
if (active.ready && step) navigateHistory(active, step);
|
|
562
|
+
};
|
|
563
|
+
window.addEventListener("popstate", pop);
|
|
564
|
+
return () => window.removeEventListener("popstate", pop);
|
|
565
|
+
}, []);
|
|
566
|
+
useEffect(() => {
|
|
567
|
+
if (!input.ready || traversing.current) return;
|
|
568
|
+
const route = historyRoute(input.presentation);
|
|
569
|
+
const step = route.find((candidate) => candidate === input.step);
|
|
570
|
+
if (!step) return;
|
|
571
|
+
const change = registrationHistoryChange(readRegistrationHistory(window.history.state, input.scope), step, route);
|
|
572
|
+
switch (change.kind) {
|
|
573
|
+
case "stay": return;
|
|
574
|
+
case "back":
|
|
575
|
+
traversing.current = true;
|
|
576
|
+
window.history.go(change.distance);
|
|
577
|
+
return;
|
|
578
|
+
case "push": return writeHistory({
|
|
579
|
+
scope: input.scope,
|
|
580
|
+
trail: change.trail
|
|
581
|
+
}, "pushState");
|
|
582
|
+
case "start": return change.steps.forEach((_, index) => writeHistory({
|
|
583
|
+
scope: input.scope,
|
|
584
|
+
trail: change.steps.slice(0, index + 1)
|
|
585
|
+
}, index === 0 ? "replaceState" : "pushState"));
|
|
586
|
+
}
|
|
587
|
+
}, [input]);
|
|
588
|
+
}
|
|
589
|
+
//#endregion
|
|
292
590
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useRegistrationAdmission.ts
|
|
293
591
|
/** Owns admission and its navigation commands; renderers receive decisions. */
|
|
294
592
|
function useRegistrationAdmission(input) {
|
|
@@ -574,7 +872,7 @@ function useRunQuestionsRefresh(input) {
|
|
|
574
872
|
function useTicketSelectionInitialization(input) {
|
|
575
873
|
const initializedSelection = useRef(null);
|
|
576
874
|
useEffect(() => {
|
|
577
|
-
if (input.locked) return;
|
|
875
|
+
if (input.locked || input.restoring) return;
|
|
578
876
|
if (!input.usesTicketTypes) {
|
|
579
877
|
if (input.lines.length > 0) input.setLines([]);
|
|
580
878
|
return;
|
|
@@ -860,25 +1158,6 @@ function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId },
|
|
|
860
1158
|
};
|
|
861
1159
|
}
|
|
862
1160
|
//#endregion
|
|
863
|
-
//#region ../blocks/src/system/runtime/shared/useWaitlistClaim.state.ts
|
|
864
|
-
const DEFAULT_WAITLIST_CLAIM_ERROR = "Online booking is unavailable right now. Please contact the organiser for help with booking.";
|
|
865
|
-
function toWaitlistClaimResolveFailure(error) {
|
|
866
|
-
if (isUnauthorizedBlockApiError(error)) return {
|
|
867
|
-
kind: "portal-login-required",
|
|
868
|
-
message: "Please log in to continue with your waiting list invitation."
|
|
869
|
-
};
|
|
870
|
-
return {
|
|
871
|
-
kind: "error",
|
|
872
|
-
message: hasStatus(error) && (error.status === 404 || error.status === 409 || error.status === 410) ? eventRegistrationErrors.waitlistUnavailable.message : DEFAULT_WAITLIST_CLAIM_ERROR
|
|
873
|
-
};
|
|
874
|
-
}
|
|
875
|
-
function isUnauthorizedBlockApiError(error) {
|
|
876
|
-
return error instanceof Error && error.name === "BlockApiError" && hasStatus(error) && error.status === 401;
|
|
877
|
-
}
|
|
878
|
-
function hasStatus(value) {
|
|
879
|
-
return typeof value === "object" && value !== null && "status" in value;
|
|
880
|
-
}
|
|
881
|
-
//#endregion
|
|
882
1161
|
//#region ../blocks/src/system/runtime/shared/useWaitlistClaim.ts
|
|
883
1162
|
const WAITLIST_CLAIM_LOCATION_EVENT = "riverbank:waitlist-claim-location-change";
|
|
884
1163
|
function emitWaitlistClaimLocationChange() {
|
|
@@ -978,148 +1257,6 @@ function useWaitlistClaimForRequestWithDeps(request, deps) {
|
|
|
978
1257
|
}, [lookup, request]);
|
|
979
1258
|
}
|
|
980
1259
|
//#endregion
|
|
981
|
-
//#region ../blocks/src/system/runtime/nodes/event-registration/sessionStorage.ts
|
|
982
|
-
const STORAGE_PREFIX = "riverbank:event-registration:";
|
|
983
|
-
const STALE_THRESHOLD_MS = 1440 * 60 * 1e3;
|
|
984
|
-
const paymentSelection = z.discriminatedUnion("method", [
|
|
985
|
-
z.object({ method: z.literal("free") }),
|
|
986
|
-
z.object({
|
|
987
|
-
method: z.literal("stripe"),
|
|
988
|
-
collectionOptionKind: z.enum([
|
|
989
|
-
"upfront",
|
|
990
|
-
"deferred_manual",
|
|
991
|
-
"instalment_plan",
|
|
992
|
-
"flexible_balance"
|
|
993
|
-
])
|
|
994
|
-
}),
|
|
995
|
-
z.object({
|
|
996
|
-
method: z.literal("pass"),
|
|
997
|
-
passId: z.string(),
|
|
998
|
-
productName: z.string().optional()
|
|
999
|
-
}),
|
|
1000
|
-
z.object({
|
|
1001
|
-
method: z.literal("membership"),
|
|
1002
|
-
membershipId: z.string(),
|
|
1003
|
-
productName: z.string().optional()
|
|
1004
|
-
}),
|
|
1005
|
-
z.object({
|
|
1006
|
-
method: z.literal("pass_bundle"),
|
|
1007
|
-
bundlePassId: z.string(),
|
|
1008
|
-
productName: z.string().optional(),
|
|
1009
|
-
productDescription: z.string().optional(),
|
|
1010
|
-
productPrice: z.number().optional(),
|
|
1011
|
-
productCurrency: z.string().optional()
|
|
1012
|
-
}),
|
|
1013
|
-
z.object({
|
|
1014
|
-
method: z.literal("membership_bundle"),
|
|
1015
|
-
bundleMembershipId: z.string(),
|
|
1016
|
-
productName: z.string().optional(),
|
|
1017
|
-
productDescription: z.string().optional(),
|
|
1018
|
-
productPrice: z.number().optional(),
|
|
1019
|
-
productCurrency: z.string().optional(),
|
|
1020
|
-
productInterval: z.string().optional()
|
|
1021
|
-
})
|
|
1022
|
-
]);
|
|
1023
|
-
const reference = z.discriminatedUnion("scope", [z.object({
|
|
1024
|
-
scope: z.literal("occurrence"),
|
|
1025
|
-
attendeeId: z.string()
|
|
1026
|
-
}), z.object({
|
|
1027
|
-
scope: z.literal("wholeSeries"),
|
|
1028
|
-
registrationId: z.string()
|
|
1029
|
-
})]);
|
|
1030
|
-
const shared = {
|
|
1031
|
-
formData: z.object({
|
|
1032
|
-
name: z.string(),
|
|
1033
|
-
email: z.string(),
|
|
1034
|
-
phone: z.string(),
|
|
1035
|
-
notes: z.string(),
|
|
1036
|
-
consentAccepted: z.boolean().optional(),
|
|
1037
|
-
mailingListOptIn: z.boolean().optional()
|
|
1038
|
-
}),
|
|
1039
|
-
ticketSelections: z.array(z.object({
|
|
1040
|
-
pricingOptionId: z.string().nullable(),
|
|
1041
|
-
quantity: z.number().int().positive()
|
|
1042
|
-
})).min(1),
|
|
1043
|
-
selectedAttendanceMode: z.enum(["in_person", "online"]).nullable().optional(),
|
|
1044
|
-
paymentSelection,
|
|
1045
|
-
guests: z.array(z.object({
|
|
1046
|
-
name: z.string(),
|
|
1047
|
-
email: z.string().nullable(),
|
|
1048
|
-
phone: z.string().nullable()
|
|
1049
|
-
})),
|
|
1050
|
-
selectedSlidingAmount: z.number().nullable(),
|
|
1051
|
-
discountCode: z.string(),
|
|
1052
|
-
mailingListSignupNote: z.enum(["confirmation_required", "not_confirmed"]).optional(),
|
|
1053
|
-
bookingQuestions: bookingQuestionsPaymentSnapshotSchema.optional(),
|
|
1054
|
-
timestamp: z.number().finite()
|
|
1055
|
-
};
|
|
1056
|
-
const currentSchema = z.object({
|
|
1057
|
-
...shared,
|
|
1058
|
-
version: z.literal(7),
|
|
1059
|
-
selectedEventIds: z.array(z.string()),
|
|
1060
|
-
runChoices: z.record(z.string(), z.object({
|
|
1061
|
-
pricingOptionId: z.string().nullable(),
|
|
1062
|
-
slidingAmountInput: z.string()
|
|
1063
|
-
})).optional(),
|
|
1064
|
-
runRequirements: z.record(z.string(), runRequirementsSnapshotSchema).optional()
|
|
1065
|
-
});
|
|
1066
|
-
/** Saved before booking several existed: one reference and one event. */
|
|
1067
|
-
const version6Schema = z.object({
|
|
1068
|
-
...shared,
|
|
1069
|
-
version: z.literal(6),
|
|
1070
|
-
reference,
|
|
1071
|
-
selectedEventId: z.string().nullable()
|
|
1072
|
-
}).transform(({ reference: _reference, selectedEventId, ...rest }) => ({
|
|
1073
|
-
...rest,
|
|
1074
|
-
version: 7,
|
|
1075
|
-
selectedEventIds: selectedEventId === null ? [] : [selectedEventId]
|
|
1076
|
-
}));
|
|
1077
|
-
const schema = z.union([currentSchema, version6Schema]);
|
|
1078
|
-
function key(siteId, submissionId) {
|
|
1079
|
-
return `${STORAGE_PREFIX}${siteId}:${submissionId}`;
|
|
1080
|
-
}
|
|
1081
|
-
function savePendingRegistration(siteId, submissionId, data) {
|
|
1082
|
-
try {
|
|
1083
|
-
const entry = z.safeParse(currentSchema, {
|
|
1084
|
-
...data,
|
|
1085
|
-
ticketSelections: normalizeTicketSelectionLines(data.ticketSelections),
|
|
1086
|
-
version: 7,
|
|
1087
|
-
timestamp: Date.now()
|
|
1088
|
-
});
|
|
1089
|
-
if (entry.success) sessionStorage.setItem(key(siteId, submissionId), JSON.stringify(entry.data));
|
|
1090
|
-
} catch {}
|
|
1091
|
-
}
|
|
1092
|
-
function getPendingRegistration(siteId, submissionId) {
|
|
1093
|
-
try {
|
|
1094
|
-
const stored = sessionStorage.getItem(key(siteId, submissionId));
|
|
1095
|
-
const parsed = z.safeParse(schema, stored ? JSON.parse(stored) : null);
|
|
1096
|
-
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) {
|
|
1097
|
-
clearPendingRegistration(siteId, submissionId);
|
|
1098
|
-
return null;
|
|
1099
|
-
}
|
|
1100
|
-
return parsed.data;
|
|
1101
|
-
} catch {
|
|
1102
|
-
return null;
|
|
1103
|
-
}
|
|
1104
|
-
}
|
|
1105
|
-
function clearPendingRegistration(siteId, submissionId) {
|
|
1106
|
-
try {
|
|
1107
|
-
sessionStorage.removeItem(key(siteId, submissionId));
|
|
1108
|
-
} catch {}
|
|
1109
|
-
}
|
|
1110
|
-
function cleanupStaleRegistrations() {
|
|
1111
|
-
try {
|
|
1112
|
-
Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)).filter((item) => item !== null && item.startsWith(STORAGE_PREFIX)).forEach((item) => {
|
|
1113
|
-
try {
|
|
1114
|
-
const parsed = z.safeParse(schema, JSON.parse(sessionStorage.getItem(item) ?? "null"));
|
|
1115
|
-
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) sessionStorage.removeItem(item);
|
|
1116
|
-
} catch {
|
|
1117
|
-
sessionStorage.removeItem(item);
|
|
1118
|
-
}
|
|
1119
|
-
});
|
|
1120
|
-
} catch {}
|
|
1121
|
-
}
|
|
1122
|
-
//#endregion
|
|
1123
1260
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.ts
|
|
1124
1261
|
/** A return URL asks the server to verify; it is never proof of payment. */
|
|
1125
1262
|
function eventRegistrationCheckoutReturnRequest(params) {
|
|
@@ -1186,6 +1323,7 @@ function parseEventRegistrationFailure(error) {
|
|
|
1186
1323
|
reason: !(error instanceof BlockApiError) ? null : siteUnavailable(error) ? "siteNotTakingBookings" : parseEventRegistrationErrorReason(error.tag),
|
|
1187
1324
|
siteTermsFailure: siteTermsFailureKind(error),
|
|
1188
1325
|
isClientError: error instanceof BlockApiError && error.status < 500 && error.code !== "invalid_booking_response",
|
|
1326
|
+
discountRefused: error instanceof BlockApiError && error.fieldErrors.some((field) => field.field === "discountCode"),
|
|
1189
1327
|
refusedInput: error instanceof BlockApiError && error.tag === REFUSED_INPUT_TAG && error.message.trim().length > 0
|
|
1190
1328
|
};
|
|
1191
1329
|
}
|
|
@@ -1195,6 +1333,10 @@ function parseEventRegistrationFailure(error) {
|
|
|
1195
1333
|
* this course.") rather than the general one, since it says what to change.
|
|
1196
1334
|
*/
|
|
1197
1335
|
function registrationErrorPresentation(failure, bookings = "one") {
|
|
1336
|
+
if (failure.discountRefused) return {
|
|
1337
|
+
message: failure.message,
|
|
1338
|
+
action: "payment-options"
|
|
1339
|
+
};
|
|
1198
1340
|
if (failure.reason === "invalidAnswers" || failure.answersNeeded || Object.keys(failure.questionFieldErrors).length > 0) return {
|
|
1199
1341
|
message: failure.message,
|
|
1200
1342
|
action: "details"
|
|
@@ -1300,7 +1442,7 @@ function useEventRegistrationSubmitWithDeps(options, deps) {
|
|
|
1300
1442
|
registrationCommandId: prepared.registrationCommandId
|
|
1301
1443
|
}));
|
|
1302
1444
|
} catch (error) {
|
|
1303
|
-
if (error instanceof BlockApiError && eventRegistrationErrorEndsCommand(error.tag)) commandRef.current = null;
|
|
1445
|
+
if (error instanceof BlockApiError && (eventRegistrationErrorEndsCommand(error.tag) || error.fieldErrors.some((field) => field.field === "discountCode"))) commandRef.current = null;
|
|
1304
1446
|
return reportFailedRegistration(options, error, method);
|
|
1305
1447
|
}
|
|
1306
1448
|
};
|
|
@@ -1439,9 +1581,7 @@ function savePendingCheckout(options, deps, prepared, checkoutAttemptId, mailing
|
|
|
1439
1581
|
guests: options.guests,
|
|
1440
1582
|
selectedSlidingAmount: options.selectedSlidingAmount,
|
|
1441
1583
|
discountCode: options.discountCode,
|
|
1442
|
-
mailingListSignupNote
|
|
1443
|
-
...options.bookingQuestionsSnapshot ? { bookingQuestions: options.bookingQuestionsSnapshot } : {},
|
|
1444
|
-
...options.runRequirementsSnapshots ? { runRequirements: options.runRequirementsSnapshots } : {}
|
|
1584
|
+
mailingListSignupNote
|
|
1445
1585
|
});
|
|
1446
1586
|
}
|
|
1447
1587
|
function registrationRequestIntentKey(request) {
|
|
@@ -1498,6 +1638,7 @@ function invitationRequestCredential(credential) {
|
|
|
1498
1638
|
}
|
|
1499
1639
|
/** Legal rejection returns to the intact draft, before any payment effect. */
|
|
1500
1640
|
function failedRegistrationStep(failure, method) {
|
|
1641
|
+
if (failure.discountRefused) return "select-payment";
|
|
1501
1642
|
if (failure.reason === "paymentContextMismatch") return "select-payment";
|
|
1502
1643
|
if (failure.reason === "invalidAnswers") return "enter-details";
|
|
1503
1644
|
if (!failure.siteTermsFailure) return "error";
|
|
@@ -1516,6 +1657,7 @@ function reportFailedRegistration(options, error, method) {
|
|
|
1516
1657
|
questionFieldErrors: parsed.questionFieldErrors,
|
|
1517
1658
|
answersNeeded: parsed.answersNeeded
|
|
1518
1659
|
};
|
|
1660
|
+
if (parsed.discountRefused) options.onDiscountRefused?.(message);
|
|
1519
1661
|
options.setErrorAction?.(action);
|
|
1520
1662
|
options.setErrorMessage(message);
|
|
1521
1663
|
options.setSubmissionFailure(failure);
|
|
@@ -1539,9 +1681,13 @@ function quoteFeedback(state) {
|
|
|
1539
1681
|
tone: "error",
|
|
1540
1682
|
message: state.message
|
|
1541
1683
|
};
|
|
1684
|
+
if (state.status === "failed" && state.draftCode.trim()) return {
|
|
1685
|
+
tone: "error",
|
|
1686
|
+
message: "We couldn't check your price. Try again, or remove the code to carry on."
|
|
1687
|
+
};
|
|
1542
1688
|
return state.status === "priced" && state.draftCode.trim() ? {
|
|
1543
1689
|
tone: "success",
|
|
1544
|
-
message: "
|
|
1690
|
+
message: state.preview.type === "applied" ? `${state.preview.publicLabel} applied. You'll pay ${formatCommercePrice(state.preview.totalAfterDiscountCents, state.preview.currency)}.` : ""
|
|
1545
1691
|
} : null;
|
|
1546
1692
|
}
|
|
1547
1693
|
/** A quote belongs to the complete priced input and the customer, never just the draft code. */
|
|
@@ -1588,8 +1734,12 @@ function decideSelectionQuoteResponse(pending, result) {
|
|
|
1588
1734
|
* or before going to Stripe and coming back), which they've already applied
|
|
1589
1735
|
* as far as they know. A code typed here waits for Apply.
|
|
1590
1736
|
*/
|
|
1591
|
-
function automaticSelectionQuoteWanted(state,
|
|
1592
|
-
return
|
|
1737
|
+
function automaticSelectionQuoteWanted(state, input, carried = false) {
|
|
1738
|
+
return input.automaticWanted && state.status === "draft" && (carried || uncodedQuoteWanted(input) && !state.draftCode.trim());
|
|
1739
|
+
}
|
|
1740
|
+
/** Several items have no total until the server prices them; one booking has a price already. */
|
|
1741
|
+
function uncodedQuoteWanted(input) {
|
|
1742
|
+
return input.several !== null || input.automaticOffered;
|
|
1593
1743
|
}
|
|
1594
1744
|
/** Nothing to price: no code or automatic discount can change a free selection. */
|
|
1595
1745
|
function freeSelection(input) {
|
|
@@ -1612,8 +1762,8 @@ function pricedPreview(state) {
|
|
|
1612
1762
|
function decidedSelectionPricing(input, state, apply) {
|
|
1613
1763
|
const priced = state.status === "priced" ? state : null;
|
|
1614
1764
|
const fallback = priced === null ? pricedPreview(state) : null;
|
|
1615
|
-
const settled =
|
|
1616
|
-
const
|
|
1765
|
+
const settled = priced !== null || fallback !== null || freeSelection(input) || singleBookingNeedsNoAnswer(input, state);
|
|
1766
|
+
const waiting = quoteWaiting(input, state, settled);
|
|
1617
1767
|
return {
|
|
1618
1768
|
state,
|
|
1619
1769
|
quote: selectionQuoteOf(priced) ?? (fallback ? {
|
|
@@ -1624,11 +1774,40 @@ function decidedSelectionPricing(input, state, apply) {
|
|
|
1624
1774
|
decidedCode: priced?.decidedCode,
|
|
1625
1775
|
ready: settled,
|
|
1626
1776
|
payableCents: selectionPayable(input, state),
|
|
1627
|
-
quoting,
|
|
1777
|
+
quoting: waiting.quoting,
|
|
1778
|
+
/** Pay waits on a typed code for one booking, while it's checked or until the visitor does something about it. */
|
|
1779
|
+
codeHoldingOne: waiting.codeHoldingOne,
|
|
1628
1780
|
/** The visitor has to apply, change or remove the code, or try again, before there's a price. */
|
|
1629
|
-
awaitingVisitor:
|
|
1781
|
+
awaitingVisitor: waiting.awaitingVisitor,
|
|
1630
1782
|
manualCodeEntryAllowed: state.manualCodeEntryAllowed,
|
|
1631
|
-
codeField:
|
|
1783
|
+
codeField: state.key === null ? null : codeFieldFor(state, apply, settled)
|
|
1784
|
+
};
|
|
1785
|
+
}
|
|
1786
|
+
/**
|
|
1787
|
+
* One booking can go on without a quote when nothing can be priced, when it has no
|
|
1788
|
+
* automatic discount to look up, or when looking one up failed: checkout decides the
|
|
1789
|
+
* price anyway, so a preview that failed never stops a booking. A typed code always waits.
|
|
1790
|
+
*/
|
|
1791
|
+
function singleBookingNeedsNoAnswer(input, state) {
|
|
1792
|
+
if (input.several !== null) return false;
|
|
1793
|
+
if (state.key === null) return true;
|
|
1794
|
+
if (state.draftCode.trim()) return false;
|
|
1795
|
+
if (state.status === "failed") return true;
|
|
1796
|
+
return state.status === "draft" && !(uncodedQuoteWanted(input) && input.automaticWanted);
|
|
1797
|
+
}
|
|
1798
|
+
/** What the payment step is waiting for. Checking a typed code on one booking leaves its choices on screen, with Pay held. */
|
|
1799
|
+
function quoteWaiting(input, state, settled) {
|
|
1800
|
+
if (settled || !input.automaticWanted) return {
|
|
1801
|
+
quoting: false,
|
|
1802
|
+
awaitingVisitor: false,
|
|
1803
|
+
codeHoldingOne: false
|
|
1804
|
+
};
|
|
1805
|
+
const typedOnOne = input.several === null && Boolean(state.draftCode.trim());
|
|
1806
|
+
const deciding = serverDeciding(state);
|
|
1807
|
+
return {
|
|
1808
|
+
quoting: deciding && !typedOnOne,
|
|
1809
|
+
awaitingVisitor: !deciding,
|
|
1810
|
+
codeHoldingOne: typedOnOne
|
|
1632
1811
|
};
|
|
1633
1812
|
}
|
|
1634
1813
|
/** A request is out, or about to go for the automatic code; the other states wait for the visitor. */
|
|
@@ -1641,13 +1820,13 @@ function selectionQuoteOf(priced) {
|
|
|
1641
1820
|
source: priced.draftCode.trim() ? "typed" : "automatic"
|
|
1642
1821
|
} : null;
|
|
1643
1822
|
}
|
|
1644
|
-
function codeFieldFor(state, apply) {
|
|
1823
|
+
function codeFieldFor(state, apply, settled) {
|
|
1645
1824
|
return {
|
|
1646
1825
|
apply,
|
|
1647
1826
|
applying: state.status === "pending",
|
|
1648
|
-
failed: state.status === "failed",
|
|
1827
|
+
failed: state.status === "failed" && !state.draftCode.trim() && !settled,
|
|
1649
1828
|
feedback: quoteFeedback(state),
|
|
1650
|
-
hint: "
|
|
1829
|
+
hint: state.status === "priced" && state.preview.totalAfterDiscountCents === 0 ? "There's nothing to pay. You won't need to enter card details." : ""
|
|
1651
1830
|
};
|
|
1652
1831
|
}
|
|
1653
1832
|
//#endregion
|
|
@@ -1701,12 +1880,13 @@ async function requestSelectionQuote(input) {
|
|
|
1701
1880
|
}
|
|
1702
1881
|
}
|
|
1703
1882
|
/**
|
|
1704
|
-
*
|
|
1705
|
-
*
|
|
1706
|
-
*
|
|
1883
|
+
* The one code and the server's price for it, for one booking or several. Several
|
|
1884
|
+
* items have no settled total until the server prices them. Editing the code
|
|
1885
|
+
* invalidates that decision; Continue submits only a current priced code. A failed
|
|
1886
|
+
* request remains unresolved and can be retried explicitly.
|
|
1707
1887
|
*/
|
|
1708
1888
|
function useSelectionCombinationPricing(input) {
|
|
1709
|
-
const lines = input.several
|
|
1889
|
+
const lines = input.several !== null ? selectionPreviewLines(input) : input.singleLines.length > 0 ? input.singleLines : null;
|
|
1710
1890
|
const key = selectionQuoteKey(lines, input.email);
|
|
1711
1891
|
const [state, setState] = useState(() => emptyQuoteDraft(key));
|
|
1712
1892
|
const [carried, setCarried] = useState(false);
|
|
@@ -1736,10 +1916,11 @@ function useSelectionCombinationPricing(input) {
|
|
|
1736
1916
|
setState((previous) => previous === pending ? next : previous);
|
|
1737
1917
|
};
|
|
1738
1918
|
useEffect(() => {
|
|
1739
|
-
if (automaticSelectionQuoteWanted(current, input
|
|
1919
|
+
if (automaticSelectionQuoteWanted(current, input, carried)) apply();
|
|
1740
1920
|
}, [
|
|
1741
1921
|
key,
|
|
1742
1922
|
input.automaticWanted,
|
|
1923
|
+
input.automaticOffered,
|
|
1743
1924
|
current.status,
|
|
1744
1925
|
current.draftCode,
|
|
1745
1926
|
carried
|
|
@@ -1762,7 +1943,12 @@ function useSelectionCombinationPricing(input) {
|
|
|
1762
1943
|
...decidedSelectionPricing(input, current, apply),
|
|
1763
1944
|
editCode,
|
|
1764
1945
|
carryCode,
|
|
1765
|
-
reset
|
|
1946
|
+
reset,
|
|
1947
|
+
refuse: (message) => setState({
|
|
1948
|
+
...current,
|
|
1949
|
+
status: "refused",
|
|
1950
|
+
message
|
|
1951
|
+
})
|
|
1766
1952
|
};
|
|
1767
1953
|
}
|
|
1768
1954
|
//#endregion
|
|
@@ -2050,7 +2236,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
2050
2236
|
setState,
|
|
2051
2237
|
note
|
|
2052
2238
|
]);
|
|
2053
|
-
const verify = useCallback((request, resumePayment =
|
|
2239
|
+
const verify = useCallback((request, resumePayment = false) => {
|
|
2054
2240
|
if (operation.current) return;
|
|
2055
2241
|
generation.current += 1;
|
|
2056
2242
|
setState({
|
|
@@ -2443,6 +2629,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2443
2629
|
draft: createRegistrationDraftData(preSelectedEvent ?? null),
|
|
2444
2630
|
invitation: beginWaitlistInvitation(arrivalCredential)
|
|
2445
2631
|
}));
|
|
2632
|
+
const [restoredCode, restoreDiscountCode] = useState(null);
|
|
2633
|
+
const browserScope = registrationBrowserScope(api.config.siteId, options);
|
|
2634
|
+
const browserDraftReady = useRegistrationBrowserDraft({
|
|
2635
|
+
scope: browserScope,
|
|
2636
|
+
flow: flowState,
|
|
2637
|
+
dispatch: dispatchFlow,
|
|
2638
|
+
events: scopedEvents,
|
|
2639
|
+
eventsReady: options.eventSource.kind === "ready",
|
|
2640
|
+
onDiscountCodeRestored: restoreDiscountCode
|
|
2641
|
+
});
|
|
2446
2642
|
const step = flowState.step;
|
|
2447
2643
|
const paymentIntent = flowState.paymentSelection;
|
|
2448
2644
|
const { selection, runChoices, formData: draftFormData, guests, selectedAttendanceMode, selectedTicketLines, selectedSlidingAmountInput: draftSlidingAmountInput } = flowState.draft;
|
|
@@ -2527,7 +2723,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2527
2723
|
type: "claim-arrived",
|
|
2528
2724
|
credential: arrivalCredential
|
|
2529
2725
|
});
|
|
2530
|
-
|
|
2726
|
+
if (isSameWaitlistClaim(arrivalCredential, flowState.spentClaim)) clearWaitlistClaimLocation();
|
|
2727
|
+
}, [arrivalCredential, flowState.spentClaim]);
|
|
2531
2728
|
useEffect(() => {
|
|
2532
2729
|
if (claimLookup) dispatchFlow({
|
|
2533
2730
|
type: "claim-updated",
|
|
@@ -2655,7 +2852,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2655
2852
|
}, [eligibility]);
|
|
2656
2853
|
const verification = paymentController.verification;
|
|
2657
2854
|
const [paymentReturn, setPaymentReturn] = useState(null);
|
|
2658
|
-
const [restoredCode, restoreDiscountCode] = useState(null);
|
|
2659
2855
|
deps.useEventRegistrationStripeReturn({
|
|
2660
2856
|
siteId: api.config.siteId,
|
|
2661
2857
|
verify: paymentController.verify,
|
|
@@ -2670,7 +2866,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2670
2866
|
setPaymentReturn(null);
|
|
2671
2867
|
dispatchFlow({
|
|
2672
2868
|
type: "payment-return-restored",
|
|
2673
|
-
restoration: paymentReturnRestoration(paymentReturn, registrationEvents
|
|
2869
|
+
restoration: paymentReturnRestoration(paymentReturn, registrationEvents)
|
|
2674
2870
|
});
|
|
2675
2871
|
}, [
|
|
2676
2872
|
options.eventSource.kind,
|
|
@@ -2764,6 +2960,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2764
2960
|
selectionId: currentTicketSelection.selectionId,
|
|
2765
2961
|
attendanceMode: selectedAttendanceMode,
|
|
2766
2962
|
locked: selectionLocked,
|
|
2963
|
+
restoring: !browserDraftReady,
|
|
2767
2964
|
usesTicketTypes: usesTicketTypeSelections,
|
|
2768
2965
|
lines: normalizedSelectedTicketLines,
|
|
2769
2966
|
visibleOptions: visibleTicketTypes,
|
|
@@ -2975,7 +3172,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2975
3172
|
itemPrice,
|
|
2976
3173
|
email: formData.email,
|
|
2977
3174
|
payment: paymentController.state,
|
|
2978
|
-
automaticWanted: step === "select-payment"
|
|
3175
|
+
automaticWanted: step === "select-payment",
|
|
3176
|
+
singleLines: singleBookingDiscountLines({
|
|
3177
|
+
discountContext,
|
|
3178
|
+
eligibility,
|
|
3179
|
+
primarySubtotalCents,
|
|
3180
|
+
ticketsCount,
|
|
3181
|
+
ticketLines: ticketSelectionSummaryLines,
|
|
3182
|
+
currentEvent
|
|
3183
|
+
}),
|
|
3184
|
+
automaticOffered: automaticQuoteOffered(discountUi.autoAppliedDiscount, discountContext)
|
|
2979
3185
|
});
|
|
2980
3186
|
const discountView = registrationDiscountView({
|
|
2981
3187
|
several: several !== null,
|
|
@@ -2984,35 +3190,38 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2984
3190
|
context: discountContext
|
|
2985
3191
|
});
|
|
2986
3192
|
const { code: discountCode, editCode: setDiscountCode } = discountView;
|
|
2987
|
-
/**
|
|
2988
|
-
* One item keeps a typed code in its discount box, several in their quote.
|
|
2989
|
-
* A code moving between them (or restored) stays the visitor's: one item
|
|
2990
|
-
* reads it as typed, and several price it without another Apply.
|
|
2991
|
-
*/
|
|
2992
|
-
const carryDiscountCode = (code, toSeveral) => {
|
|
2993
|
-
if (toSeveral) combinationPricing.carryCode(code);
|
|
2994
|
-
else discountUi.setDiscountCode(code);
|
|
2995
|
-
};
|
|
2996
3193
|
useEffect(() => {
|
|
2997
3194
|
if (restoredCode === null || paymentReturn) return;
|
|
2998
3195
|
restoreDiscountCode(null);
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3196
|
+
combinationPricing.carryCode(restoredCode);
|
|
3197
|
+
if (restoredCode.trim()) discountUi.setDiscountUiOpen(true);
|
|
3198
|
+
}, [paymentReturn, restoredCode]);
|
|
3199
|
+
useSaveRegistrationBrowserDraft({
|
|
3200
|
+
scope: browserScope,
|
|
3201
|
+
ready: browserDraftReady,
|
|
3202
|
+
flow: flowState,
|
|
3203
|
+
discountCode
|
|
3204
|
+
});
|
|
3205
|
+
const singlePrices = decideSingleBookingPrices({
|
|
3206
|
+
several: !(several === null),
|
|
3207
|
+
context: discountContext,
|
|
3208
|
+
quote: combinationPricing.quote,
|
|
3209
|
+
typedCode: discountCode,
|
|
3210
|
+
advertisedAutomatic: discountUi.autoAppliedDiscount,
|
|
3211
|
+
lookupFailed: combinationPricing.state.status === "failed"
|
|
3212
|
+
});
|
|
3213
|
+
const codeAwaitingApply = combinationPricing.codeHoldingOne;
|
|
3214
|
+
const ticketSelectionSubtotalCents = singlePrices.bookingTotalCents ?? combinationPricing.payableCents;
|
|
3006
3215
|
const directPaymentOptions = resolveWizardDirectPaymentOptions({
|
|
3007
3216
|
eligibility,
|
|
3008
3217
|
currentEvent,
|
|
3009
3218
|
occurrenceContext: options.occurrenceContext,
|
|
3010
3219
|
ticketSelectionSubtotalCents,
|
|
3011
|
-
|
|
3220
|
+
automaticDiscount: singlePrices.automaticDiscount,
|
|
3012
3221
|
nowIso,
|
|
3013
3222
|
selectionPayment
|
|
3014
3223
|
});
|
|
3015
|
-
const { paymentDecision, paymentSelection, paymentStepState } = resolveWizardPaymentView({
|
|
3224
|
+
const { paymentDecision, paymentSelection, paymentStepState: quotedPaymentStepState } = resolveWizardPaymentView({
|
|
3016
3225
|
directPaymentOptions,
|
|
3017
3226
|
paymentIntent,
|
|
3018
3227
|
eligibility,
|
|
@@ -3024,9 +3233,10 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3024
3233
|
eligibilityError,
|
|
3025
3234
|
isAuthenticated: flowState.isAuthenticated,
|
|
3026
3235
|
portalCreditState,
|
|
3027
|
-
discountCode:
|
|
3236
|
+
discountCode: codeAwaitingApply ? discountCode : "",
|
|
3028
3237
|
step
|
|
3029
3238
|
});
|
|
3239
|
+
const { state: paymentStepState, heldForCode: paymentHeldForCode } = holdPaymentForCode(quotedPaymentStepState, codeAwaitingApply);
|
|
3030
3240
|
const siteTerms = useSiteTermsAgreement({
|
|
3031
3241
|
terms: options.siteTerms,
|
|
3032
3242
|
context: {
|
|
@@ -3081,13 +3291,15 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3081
3291
|
runChoices,
|
|
3082
3292
|
formData,
|
|
3083
3293
|
bookingQuestions: questions.submission,
|
|
3084
|
-
bookingQuestionsSnapshot: questions.paymentSnapshot,
|
|
3085
3294
|
requirements: requirements.submission,
|
|
3086
|
-
runRequirementsSnapshots: requirements.runSnapshots,
|
|
3087
3295
|
mailingListSignup,
|
|
3088
3296
|
requireGuestDetails,
|
|
3089
3297
|
guests,
|
|
3090
3298
|
discountCode: discountView.submittedCode,
|
|
3299
|
+
onDiscountRefused: (message) => {
|
|
3300
|
+
discountUi.setDiscountUiOpen(true);
|
|
3301
|
+
combinationPricing.refuse(message);
|
|
3302
|
+
},
|
|
3091
3303
|
quoteReady: combinationPricing.ready,
|
|
3092
3304
|
invitation: invitationSubmission(waitlistClaim),
|
|
3093
3305
|
setStep,
|
|
@@ -3113,8 +3325,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3113
3325
|
/** Booking several: a row ticks or unticks without moving on. */
|
|
3114
3326
|
const handleSelectionToggle = (event) => {
|
|
3115
3327
|
if (selectionLocked) return;
|
|
3116
|
-
|
|
3117
|
-
if (toSeveral !== (several !== null)) carryDiscountCode(discountCode, toSeveral);
|
|
3328
|
+
if (severalItemsOf(toggleSelectionItem(selection, event)) !== null !== (several !== null)) combinationPricing.carryCode(discountCode);
|
|
3118
3329
|
dispatchFlow({
|
|
3119
3330
|
type: "selection-toggled",
|
|
3120
3331
|
event
|
|
@@ -3163,7 +3374,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3163
3374
|
setSelection(preSelectedEvent ? [preSelectedEvent] : []);
|
|
3164
3375
|
setGuests([]);
|
|
3165
3376
|
setGuestErrors({});
|
|
3166
|
-
discountUi.setDiscountCode("");
|
|
3167
3377
|
combinationPricing.reset();
|
|
3168
3378
|
commandRef.current = null;
|
|
3169
3379
|
setOptionsRefreshKey((value) => value + 1);
|
|
@@ -3205,6 +3415,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3205
3415
|
}),
|
|
3206
3416
|
paymentSelection
|
|
3207
3417
|
});
|
|
3418
|
+
useRegistrationBrowserHistory({
|
|
3419
|
+
scope: browserScope,
|
|
3420
|
+
ready: browserDraftReady,
|
|
3421
|
+
step,
|
|
3422
|
+
presentation,
|
|
3423
|
+
locked: selectionLocked,
|
|
3424
|
+
keepCurrentUrl: paymentController.state.kind !== "idle",
|
|
3425
|
+
navigate: setStep,
|
|
3426
|
+
payment: paymentController
|
|
3427
|
+
});
|
|
3208
3428
|
const { hasEligibility, hasMembershipEligibility, isMembershipFastTrack } = getEligibilityFlowFlags({
|
|
3209
3429
|
eligibility,
|
|
3210
3430
|
portalAuthState,
|
|
@@ -3225,13 +3445,13 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3225
3445
|
events,
|
|
3226
3446
|
maxTicketsNum: waitlistClaim.kind === "ready" ? waitlistClaim.restoration.ticketsCount : options.maxTicketsNum,
|
|
3227
3447
|
scopedEvents,
|
|
3228
|
-
preSelectedEvent: preSelectedEvent
|
|
3448
|
+
preSelectedEvent: preSelectedDisplayEvent(preSelectedEvent, currentEvent, displayEvent),
|
|
3229
3449
|
hasPreSelectedContext,
|
|
3230
3450
|
presentation,
|
|
3231
3451
|
flow: flowState,
|
|
3232
3452
|
setStep: (next) => {
|
|
3233
3453
|
if (step === "success" || !selectionLocked) setStep(next);
|
|
3234
|
-
else if (step === "payment") paymentController.
|
|
3454
|
+
else if (step === "payment") paymentController.check();
|
|
3235
3455
|
},
|
|
3236
3456
|
admission,
|
|
3237
3457
|
ticketContinuation,
|
|
@@ -3259,8 +3479,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3259
3479
|
price: selectionPrice,
|
|
3260
3480
|
itemPrice
|
|
3261
3481
|
}),
|
|
3262
|
-
/** The code field
|
|
3263
|
-
combinationCodeField: combinationPricing.codeField,
|
|
3482
|
+
/** The code field shares the booking's server quote. */
|
|
3483
|
+
combinationCodeField: registrationCodeField(combinationPricing.codeField, combinationPricing.quote, paymentIntent),
|
|
3264
3484
|
combinationAwaitingVisitor: combinationPricing.awaitingVisitor,
|
|
3265
3485
|
/** The payment step's list of what several items cost; null for one item. */
|
|
3266
3486
|
selectionPaymentSummary: summariseSelectionPayment({
|
|
@@ -3342,6 +3562,12 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3342
3562
|
setShowMagicLinkModal,
|
|
3343
3563
|
handleLogout,
|
|
3344
3564
|
paymentStepState,
|
|
3565
|
+
/** Pay is off only because a typed code hasn't been applied yet, which the customer needs telling. */
|
|
3566
|
+
paymentHeldForCode: paymentHeldForCode && combinationPricing.awaitingVisitor,
|
|
3567
|
+
/** What the pass costs once an applied code is taken off; null when no code applies. */
|
|
3568
|
+
passPriceAfterCodeCents: singlePrices.passTotalCents,
|
|
3569
|
+
/** A membership's first payment after its discount; it renews at the regular price. */
|
|
3570
|
+
membershipFirstPaymentCents: singlePrices.membershipFirstPaymentCents,
|
|
3345
3571
|
handlePaymentSelectionChange: (value) => {
|
|
3346
3572
|
if (!selectionLocked) handlePaymentSelectionChange(value);
|
|
3347
3573
|
},
|
|
@@ -3368,7 +3594,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3368
3594
|
setDiscountUiOpen: discountUi.setDiscountUiOpen,
|
|
3369
3595
|
discountsAvailable: discountView.discountsAvailable,
|
|
3370
3596
|
manualCodeEntryAllowed: discountView.manualCodeEntryAllowed,
|
|
3371
|
-
autoAppliedDiscount:
|
|
3597
|
+
autoAppliedDiscount: singlePrices.automaticDiscount,
|
|
3372
3598
|
discountsAvailableLoading: discountView.discountsAvailableLoading,
|
|
3373
3599
|
discountContext,
|
|
3374
3600
|
shouldShowDiscountToggle,
|
|
@@ -3445,6 +3671,57 @@ function registrationCompletionState(state) {
|
|
|
3445
3671
|
registrationResult: null
|
|
3446
3672
|
};
|
|
3447
3673
|
}
|
|
3674
|
+
/** The pre-selected event shows live availability once it's the one being booked. */
|
|
3675
|
+
function preSelectedDisplayEvent(preSelected, current, display) {
|
|
3676
|
+
return preSelected?.selectionId === current?.selectionId ? display : preSelected;
|
|
3677
|
+
}
|
|
3678
|
+
/** What a single booking's typed code is checked against. Several items have their own quote. */
|
|
3679
|
+
function singleBookingDiscountLines(input) {
|
|
3680
|
+
const { discountContext, eligibility } = input;
|
|
3681
|
+
if (!discountContext || !eligibility) return [];
|
|
3682
|
+
const product = bundleProductPrice(discountContext, eligibility);
|
|
3683
|
+
return [{
|
|
3684
|
+
context: discountContext,
|
|
3685
|
+
subtotalCents: product ? product.price : input.primarySubtotalCents ?? 0,
|
|
3686
|
+
currency: product ? product.currency : eligibility.currency,
|
|
3687
|
+
...singleBookingTicketDetails(discountContext.type, input)
|
|
3688
|
+
}];
|
|
3689
|
+
}
|
|
3690
|
+
/** What the pass or membership being bought costs, from the server's options, so a caller only has to name it. */
|
|
3691
|
+
function bundleProductPrice(context, eligibility) {
|
|
3692
|
+
if (context.type === "pass") return eligibility.availablePasses.find((pass) => pass.id === context.passId) ?? null;
|
|
3693
|
+
if (context.type === "membership") return eligibility.availableMemberships.find((membership) => membership.id === context.membershipId) ?? null;
|
|
3694
|
+
return null;
|
|
3695
|
+
}
|
|
3696
|
+
function singleBookingTicketDetails(contextType, input) {
|
|
3697
|
+
const ticketUnits = input.ticketLines.map((line) => ({
|
|
3698
|
+
unitPriceCents: line.unitPriceCents,
|
|
3699
|
+
quantity: line.quantity
|
|
3700
|
+
}));
|
|
3701
|
+
if (contextType === "whole_series") return {
|
|
3702
|
+
quantity: input.ticketsCount,
|
|
3703
|
+
ticketUnits
|
|
3704
|
+
};
|
|
3705
|
+
if (contextType !== "event") return {};
|
|
3706
|
+
const subject = input.currentEvent?.registrationSubject;
|
|
3707
|
+
return {
|
|
3708
|
+
occurrenceId: subject?.kind === "occurrence" ? subject.occurrenceId : void 0,
|
|
3709
|
+
ticketUnits
|
|
3710
|
+
};
|
|
3711
|
+
}
|
|
3712
|
+
/** The server can't yet preview an automatic discount on a membership, so its summary shows the regular price and checkout takes the discount off. */
|
|
3713
|
+
function automaticQuoteOffered(automatic, context) {
|
|
3714
|
+
return automatic !== null && context?.type !== "membership";
|
|
3715
|
+
}
|
|
3716
|
+
/** The quote's field, saying beside an applied code what it does to this purchase. */
|
|
3717
|
+
function registrationCodeField(field, quote, paymentIntent) {
|
|
3718
|
+
if (!field) return null;
|
|
3719
|
+
const applied = quote?.source === "typed" && quote.preview.type === "applied" ? quote.preview : null;
|
|
3720
|
+
return {
|
|
3721
|
+
...field,
|
|
3722
|
+
hint: appliedCodeHint(paymentIntent, applied)
|
|
3723
|
+
};
|
|
3724
|
+
}
|
|
3448
3725
|
/**
|
|
3449
3726
|
* The card options on the payment step. One item offers what its own options
|
|
3450
3727
|
* allow. Several items offer one way, paying the whole total up front, when
|
|
@@ -3476,12 +3753,11 @@ function resolveWizardDirectPaymentOptions(input) {
|
|
|
3476
3753
|
}
|
|
3477
3754
|
}
|
|
3478
3755
|
}
|
|
3479
|
-
/** One item: its
|
|
3756
|
+
/** One item: its price less the automatic discount; a typed code is already out of the price. */
|
|
3480
3757
|
function previewTotalWithAutomaticDiscount(input) {
|
|
3481
3758
|
return (subtotalCents) => calculateEventRegistrationPreviewTotal({
|
|
3482
3759
|
subtotalCents,
|
|
3483
|
-
|
|
3484
|
-
automaticDiscount: input.discountUi.autoAppliedDiscount
|
|
3760
|
+
automaticDiscount: input.automaticDiscount
|
|
3485
3761
|
});
|
|
3486
3762
|
}
|
|
3487
3763
|
function buildDirectPaymentOptions(input, eligibility, priced, totalFor) {
|
|
@@ -3563,7 +3839,7 @@ function EventRegistrationPayment({ flow }) {
|
|
|
3563
3839
|
state: flow.payment.checkout,
|
|
3564
3840
|
onComplete: flow.actions.completePayment,
|
|
3565
3841
|
onRetry: flow.actions.retryPaymentLoad,
|
|
3566
|
-
onBack: flow.actions.
|
|
3842
|
+
onBack: flow.actions.back,
|
|
3567
3843
|
buttonVariant: "primary"
|
|
3568
3844
|
});
|
|
3569
3845
|
}
|