@riverbankcms/sdk 0.174.0 → 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-GqVX3I8E.d.ts → BlocksIslandsHydrator-hb2IWD8K.d.ts} +1 -1
- package/dist/_dts/{Page-BhUH31M-.d.ts → Page-BlY68ZF-.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DBn2x0UL.d.ts → SdkPreviewMode-CA8hU7hW.d.ts} +2 -2
- package/dist/_dts/{client-Cr-sOeSl.d.ts → client-B6tCvmG4.d.ts} +487 -11
- package/dist/_dts/{content-types-DKw1yJdN.d.ts → content-types-B9qryk4R.d.ts} +2 -2
- package/dist/_dts/{contracts-CJ2O03nB.d.ts → contracts-DWoaRxj1.d.ts} +3 -3
- package/dist/_dts/{footerPageOutline-DoGHHKr_.d.ts → footerPageOutline-Djdrhp5s.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-CJGu4hoa.d.ts → generatePageMetadata-CFi0vxov.d.ts} +2 -2
- package/dist/_dts/{index--39uLjrr.d.ts → index-Bl5_pjmq.d.ts} +1 -1
- package/dist/_dts/{index-DQZ5L0Gb.d.ts → index-Btp5nIoz.d.ts} +2 -2
- package/dist/_dts/{index-Bq-488M7.d.ts → index-CQUzwOxO.d.ts} +1 -1
- package/dist/_dts/{index-DYlfdT1O.d.ts → index-DmhFb6R1.d.ts} +1 -1
- package/dist/_dts/{index-3GzargmS.d.ts → index-OtazQE3U.d.ts} +2 -2
- package/dist/_dts/{index-DYsP4k6S.d.ts → index-YRQulWB4.d.ts} +3 -3
- package/dist/_dts/{index-DdEi2iXd.d.ts → index-_pXaCO12.d.ts} +4 -4
- package/dist/_dts/{loadContent-BVPagYmy.d.ts → loadContent-Hcuvs4pz.d.ts} +7 -7
- package/dist/_dts/{request-Be1E-H-V.d.ts → request-BT8i_vH-.d.ts} +2070 -503
- package/dist/_dts/{resolveBlockData-D1pL25bD.d.ts → resolveBlockData-B-dJrunl.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-B4sbTf96.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-Bm5_3VEd.d.ts → types-C0XZnjXz.d.ts} +3 -3
- package/dist/_dts/{types-5MeDI1w8.d.ts → types-CXL1QJSY.d.ts} +7 -7
- package/dist/_dts/{types-CVoCc_Ia.d.ts → types-OKzbqRBx.d.ts} +2 -2
- package/dist/_dts/{validation-lEtYD-Rh.d.ts → validation-Bxi66FtQ.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DkflFLGQ.mjs → BlocksIslandsHydrator-2xzlERTG.mjs} +17 -16
- package/dist/client/{BookingMailingListNote-CAyoiAGD.mjs → BookingMailingListNote-qsohSEdQ.mjs} +6 -6
- package/dist/client/{BookingPanelArrangement-C7yiJrxm.mjs → BookingPanelArrangement-DrdtON0q.mjs} +1 -1
- package/dist/client/{BookingQuestionFields-DZMrGvBh.mjs → BookingQuestionFields-CUFxBaTM.mjs} +3 -3
- package/dist/client/{CalendarNavigationChevron-BPQU5Snc.mjs → CalendarNavigationChevron-Ch0w0Utn.mjs} +34 -9
- package/dist/client/DemoBookingPortalAccess-DGgsjqXK.mjs +545 -0
- package/dist/client/{EventCalendar.client-BiWQc28-.mjs → EventCalendar.client-Dg4PHFJJ.mjs} +15 -25
- package/dist/client/{EventCombined.client-B_ytWQtn.mjs → EventCombined.client-tky8JcnQ.mjs} +25 -17
- package/dist/client/{EventItem-C-mxXpX_.mjs → EventItem-BybMSKNL.mjs} +4 -3
- package/dist/client/{EventListWeekNavigation-Bm3Ap1Rd.mjs → EventListWeekNavigation-uvWRE5wi.mjs} +1 -1
- package/dist/client/{EventListing.client-Bs_8im5_.mjs → EventListing.client-DQx9dohz.mjs} +3 -3
- package/dist/client/{EventListing.view-CN7BjGgC.mjs → EventListing.view-r31k8Icz.mjs} +8 -7
- package/dist/client/{EventRegistrationPayment-DPkRcSdw.mjs → EventRegistrationPayment-BMmPDmSf.mjs} +664 -362
- 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--xJ23nA5.mjs → Page-CWN_8cLZ.mjs} +736 -1667
- package/dist/client/{DemoBookingPortalAccess-BnEgvJas.mjs → SiteTermsAgreementField-Dr5lj4oY.mjs} +4 -301
- package/dist/client/{StepIndicator-D391QRNc.mjs → StepIndicator-C7RJBOW3.mjs} +37 -249
- package/dist/client/{accordion-BQtTkDN8.mjs → accordion-uUi_N6mZ.mjs} +1 -1
- package/dist/client/{booking-form.client-D9M7TKGV.mjs → booking-form.client-CKHgxvsh.mjs} +229 -42
- package/dist/client/{bookingForm-BsOS0sl9.mjs → bookingForm-Bi74dmiS.mjs} +4 -4
- package/dist/client/bookings.mjs +22 -15
- package/dist/client/{boxStyleClassNames-CNDLpT06.mjs → boxStyleClassNames-C-gFwhnO.mjs} +3 -29
- package/dist/client/{carousel-CPsW-FPh.mjs → carousel-C0_BqMA0.mjs} +1 -1
- package/dist/client/{cart-CwElmocm.mjs → cart-BOHuppVu.mjs} +3 -3
- package/dist/client/{cart.client-RpqI56w8.mjs → cart.client-IfJE1zAp.mjs} +1 -1
- package/dist/client/{checkout-CfMgqY8H.mjs → checkout-C3Aj-aNa.mjs} +3 -3
- package/dist/client/{checkout.client-BpuPyOuJ.mjs → checkout.client-Tg9lfeYf.mjs} +1 -1
- package/dist/client/{checkoutUrls-VeHY6WYj.mjs → checkoutUrls-OLqQdAXD.mjs} +1 -1
- package/dist/client/client.mjs +113 -21
- package/dist/client/{context-CNlesLfF.mjs → context-D8TpQXjX.mjs} +76 -58
- package/dist/client/{course-q1sA4Cj-.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-BzjY6AiY.mjs → enhanceHeaderSection-Ciuhsk0E.mjs} +3 -3
- package/dist/client/{event-details.client-CseTWUFC.mjs → event-details.client-CJapNbTv.mjs} +1 -1
- package/dist/client/{event-registration.client-b5TLxntR.mjs → event-registration.client-CAdcpnLc.mjs} +295 -188
- package/dist/client/{eventCalendar-C-kJNIc9.mjs → eventCalendar-BlsD5R8M.mjs} +4 -4
- package/dist/client/{eventCombined-BgHJGhwE.mjs → eventCombined-B9Ly3024.mjs} +4 -4
- package/dist/client/{eventDetails-CAwbreD0.mjs → eventDetails-CbEGI4jO.mjs} +2 -2
- package/dist/client/{eventListing-_14atrj8.mjs → eventListing-ZSmvhWII.mjs} +4 -4
- package/dist/client/{eventRegistration-BOqSdstJ.mjs → eventRegistration-D-yUcIyO.mjs} +4 -4
- package/dist/client/{form-DfAB-llc.mjs → form-DG_YZSNn.mjs} +3 -3
- package/dist/client/{form.client-DN-I9_qC.mjs → form.client-BU6dM0-C.mjs} +4 -4
- package/dist/client/{form.parts-t2Q1neM6.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-Dces54pb.mjs → headerSection-D91EzlOR.mjs} +2 -2
- package/dist/client/{display-D8MW2b0e.mjs → lookSurfaces-BDZLALxj.mjs} +3084 -12938
- package/dist/client/{newsletter-form.client-D_YFUlR2.mjs → newsletter-form.client-BMGRiRpo.mjs} +7 -5
- package/dist/client/{newsletter-form.parts-URO5Mn_I.mjs → newsletter-form.parts-D5UfUaD3.mjs} +3 -3
- package/dist/client/{newsletterForm-_c9fKIzS.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-CVW1UIxJ.mjs → product-detail.client-D-XNir0m.mjs} +1 -1
- package/dist/client/{product-list.client-CF9hO23G.mjs → product-list.client-BLfYQ-qi.mjs} +1 -1
- package/dist/client/{productDetail-C_qbmUuP.mjs → productDetail-W0_0lDGe.mjs} +3 -3
- package/dist/client/{productList-Df5qDD0z.mjs → productList-ayAtPJdb.mjs} +3 -3
- package/dist/client/{propsDecoder-BiEyK2ii.mjs → propsDecoder-ChYKWjLA.mjs} +4 -3
- package/dist/client/{registry.server-ClcfWpvM.mjs → registry.server-B1EEZkcr.mjs} +311 -262
- package/dist/client/rendering/client.mjs +25 -491
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +7 -7
- package/dist/client/{richText-coerce-C32cRQ03.mjs → richText-coerce-CDAfpMQU.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-DAypPzSo.mjs → routeIslandApiConfig-CcGWvyht.mjs} +1 -1
- package/dist/client/{shop-gteEpeO5.mjs → shop-DbUUoHFJ.mjs} +3 -3
- package/dist/client/{shop-discount-apply.state-DidgH7ow.mjs → shop-add-feedback-DvC2kP1K.mjs} +1 -78
- package/dist/client/{shop-commerce-Bw4_BXQg.mjs → shop-commerce-aQqcDmyZ.mjs} +64 -32
- package/dist/client/{shop-commerce-store-Da6Ah-_4.mjs → shop-commerce-store-Cd7USpuY.mjs} +1 -1
- package/dist/client/shop-discount-apply.state-DGvPBmVP.mjs +83 -0
- package/dist/client/{shop.client-CbbdjWWd.mjs → shop.client-BNZ9M8cG.mjs} +56 -19
- package/dist/client/{shop.interactive-CKFORzux.mjs → shop.interactive-CJAINJr3.mjs} +118 -39
- package/dist/client/{shopShared-C7QjoywZ.mjs → shopShared-DwVAuGsx.mjs} +2 -2
- package/dist/client/{timetableModel-CtZiIj9q.mjs → timetableModel-DBTIFWTb.mjs} +11 -148
- package/dist/client/{useAvailableSlots-CUVRD1nx.mjs → useAvailableSlots-BomyyKeo.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-BuLgof7O.mjs → useDiscountCodeUi-CCxHMWlU.mjs} +32 -17
- package/dist/client/{useEventPagination-B4VPtSEF.mjs → useEventPagination-Bjin_qaN.mjs} +7 -6
- package/dist/client/{view-CvlTplao.mjs → view-BTk470k0.mjs} +3 -2
- package/dist/client/{view-CxUpgcM6.mjs → view-Cw4EmEPv.mjs} +100 -32
- package/dist/preview-next/client/{PageSectionToolbar-BFbSrDbi.mjs → PageSectionToolbar-bq7gbKvn.mjs} +4 -4
- package/dist/preview-next/client/{PreviewEditorSidebar-BtpzqQ-i.mjs → PreviewEditorSidebar-DVsPNcos.mjs} +32 -29
- package/dist/preview-next/client/{PreviewEditorUI-z22h-CCY.mjs → PreviewEditorUI-B-pq3aZc.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-BW3Qpoa_.mjs → PreviewShell-ChyjB96e.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BvVeK1hR.mjs → SdkPreviewModeRuntime-D_czeC0l.mjs} +84 -101
- package/dist/preview-next/client/{previewAssistantSlot-BUqAh1FL.mjs → previewAssistantSlot-B61mZd81.mjs} +4981 -3275
- package/dist/preview-next/client/{previewChromeRoot-NCy5zHO8.mjs → previewChromeRoot-dwOn9XtM.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CxmKDVGZ.mjs → sdk-runtime-DZDfOxoW.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-B_UaDyJO.mjs → siteStyleAccess-BZDIC-fA.mjs} +529 -238
- package/dist/preview-next/client/{useAutosaveStatus-BqmWvPLY.mjs → useAutosaveStatus-BbzLMf-l.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-LAllV0rU.mjs → useOpenBlockForSetup-BEXcWQeI.mjs} +25 -5
- 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-DV6SeCNv.mjs → route-contract-0gSlK9S0.mjs} +87 -12
- package/dist/server/{Block.shared-Ch2FKAvU.mjs → Block.shared-DeXXycg8.mjs} +4 -4
- package/dist/server/{ThemeScopeCore-DFvjDVzi.mjs → ThemeScopeCore-DFEM1a85.mjs} +16 -2
- package/dist/server/{bindings-CQg2lzZn.mjs → bindings-7L3pC5Os.mjs} +13 -34
- package/dist/server/{client-aYRTVneD.mjs → client-CgghATBm.mjs} +112 -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-Cgpfr44e.mjs → loadContent-D7M5Vcug.mjs} +5 -5
- package/dist/server/{loadPage-RDk10NMP.mjs → loadPage-CiTId05y.mjs} +2 -2
- package/dist/server/{lookMediaFrame-CQtkvlDn.mjs → lookMediaFrame-CaH018pK.mjs} +129 -12
- package/dist/server/next.mjs +35 -9
- package/dist/server/{overrideResolution-VhhN94d8.mjs → overrideResolution-CJ3MRI5Q.mjs} +1 -1
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{pageRenderPlan-CkFTsxkd.mjs → pageRenderPlan-Cuos4Xcd.mjs} +105 -357
- package/dist/server/{pageRuntimeSupport-CpAtzNxD.mjs → pageRuntimeSupport-CuVj3bkd.mjs} +4 -3
- package/dist/server/{pageShared-B8yLPjs0.mjs → pageShared-JxlV8_Bo.mjs} +1707 -1811
- package/dist/server/{parseThemeForPersistence-Cwqb5pZx.mjs → parseThemeForPersistence-DOsfofCy.mjs} +1 -1
- package/dist/server/{prebuild-DOu6QceG.mjs → prebuild-BDhlJbAx.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CfOXFKYG.mjs → prefetchBlockData-kERh_c0v.mjs} +2 -2
- package/dist/server/{registry-34rkAfaU.mjs → registry-cQ9N5W-n.mjs} +21091 -20209
- 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-D7VeoWgr.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-CLVKoJrX.mjs → validation-3puM5SM8.mjs} +3 -3
- package/dist/server/{version-HVfdvBJ0.mjs → version-B8g-Wx57.mjs} +1 -1
- package/dist/styles/index.css +361 -57
- package/package.json +1 -1
- package/dist/client/bookability-CE637yDE.mjs +0 -17
- package/dist/client/useDiscountApply-BZU5DWZQ.mjs +0 -199
package/dist/client/{EventRegistrationPayment-DPkRcSdw.mjs → EventRegistrationPayment-BMmPDmSf.mjs}
RENAMED
|
@@ -1,127 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { $n as
|
|
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-BZU5DWZQ.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
|
-
paymentInvestigationRequired: {
|
|
36
|
-
endsCommand: false,
|
|
37
|
-
message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
|
|
38
|
-
action: "none"
|
|
39
|
-
},
|
|
40
|
-
paymentProviderUnavailable: {
|
|
41
|
-
endsCommand: false,
|
|
42
|
-
message: "We couldn’t reach the payment provider. Please try again in a minute.",
|
|
43
|
-
action: "retry"
|
|
44
|
-
},
|
|
45
|
-
paymentHostUnavailable: {
|
|
46
|
-
endsCommand: false,
|
|
47
|
-
message: "Card payments aren’t available on this web address yet. Please contact the organiser to book.",
|
|
48
|
-
action: "none"
|
|
49
|
-
},
|
|
50
|
-
paymentPageUnavailable: {
|
|
51
|
-
endsCommand: false,
|
|
52
|
-
message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
|
|
53
|
-
action: "retry"
|
|
54
|
-
},
|
|
55
|
-
paymentUnavailable: {
|
|
56
|
-
endsCommand: false,
|
|
57
|
-
message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
|
|
58
|
-
action: "none"
|
|
59
|
-
},
|
|
60
|
-
capacityChanged: {
|
|
61
|
-
endsCommand: false,
|
|
62
|
-
message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
|
|
63
|
-
action: "places"
|
|
64
|
-
},
|
|
65
|
-
selectionChanged: {
|
|
66
|
-
endsCommand: false,
|
|
67
|
-
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
68
|
-
action: "places"
|
|
69
|
-
},
|
|
70
|
-
paymentSetupFailed: {
|
|
71
|
-
endsCommand: true,
|
|
72
|
-
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.",
|
|
73
|
-
action: "retry"
|
|
74
|
-
},
|
|
75
|
-
registrationAttemptEnded: {
|
|
76
|
-
endsCommand: true,
|
|
77
|
-
message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
|
|
78
|
-
action: "start"
|
|
79
|
-
},
|
|
80
|
-
registrationPreparationChanged: {
|
|
81
|
-
endsCommand: true,
|
|
82
|
-
message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
|
|
83
|
-
action: "places"
|
|
84
|
-
},
|
|
85
|
-
registrationAlreadyExists: {
|
|
86
|
-
endsCommand: false,
|
|
87
|
-
message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
|
|
88
|
-
action: "portal"
|
|
89
|
-
},
|
|
90
|
-
holdExpired: {
|
|
91
|
-
endsCommand: false,
|
|
92
|
-
message: "Your reservation has timed out. Please check availability and choose your places again.",
|
|
93
|
-
action: "start"
|
|
94
|
-
},
|
|
95
|
-
waitlistUnavailable: {
|
|
96
|
-
endsCommand: false,
|
|
97
|
-
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.",
|
|
98
|
-
action: "event"
|
|
99
|
-
},
|
|
100
|
-
paymentContextMismatch: {
|
|
101
|
-
endsCommand: false,
|
|
102
|
-
message: "The payment options for this event have changed. Please check the latest options before continuing.",
|
|
103
|
-
action: "payment-options"
|
|
104
|
-
},
|
|
105
|
-
idempotencyConflict: {
|
|
106
|
-
endsCommand: false,
|
|
107
|
-
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.",
|
|
108
|
-
action: "portal"
|
|
109
|
-
},
|
|
110
|
-
invalidCommitInput: {
|
|
111
|
-
endsCommand: false,
|
|
112
|
-
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.",
|
|
113
|
-
action: "details"
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
function parseEventRegistrationErrorReason(value) {
|
|
117
|
-
return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
|
|
118
|
-
}
|
|
119
|
-
/** Only a server-confirmed refusal ends an identity; transport uncertainty retains it. */
|
|
120
|
-
function eventRegistrationErrorEndsCommand(value) {
|
|
121
|
-
const reason = parseEventRegistrationErrorReason(value);
|
|
122
|
-
return reason !== null && eventRegistrationErrors[reason].endsCommand;
|
|
123
|
-
}
|
|
124
|
-
//#endregion
|
|
125
18
|
//#region ../blocks/src/system/runtime/shared/utils/portalLogout.ts
|
|
126
19
|
/**
|
|
127
20
|
* Portal Logout Utility
|
|
@@ -148,32 +41,28 @@ function logoutPortal(anchorId) {
|
|
|
148
41
|
}
|
|
149
42
|
//#endregion
|
|
150
43
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationDiscountView.state.ts
|
|
151
|
-
/**
|
|
44
|
+
/** The quote owns the code for one booking or several; one booking still finds out what's on offer from availability. */
|
|
152
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
|
+
};
|
|
153
53
|
if (!input.several) return {
|
|
154
|
-
|
|
155
|
-
editCode: input.single.setDiscountCode,
|
|
156
|
-
submittedCode: input.single.discountCode,
|
|
157
|
-
paymentDraftCode: input.single.discountCode,
|
|
54
|
+
...shared,
|
|
158
55
|
manualCodeEntryAllowed: input.context !== null && input.single.manualCodeEntryAllowed,
|
|
159
56
|
discountsAvailableLoading: input.single.discountsAvailableLoading,
|
|
160
57
|
discountsAvailable: input.single.discountsAvailable,
|
|
161
|
-
|
|
162
|
-
several: false,
|
|
163
|
-
editingCode: false
|
|
58
|
+
several: false
|
|
164
59
|
};
|
|
165
|
-
const { selection } = input;
|
|
166
60
|
return {
|
|
167
|
-
|
|
168
|
-
editCode: selection.editCode,
|
|
169
|
-
submittedCode: selection.decidedCode ?? "",
|
|
170
|
-
paymentDraftCode: "",
|
|
61
|
+
...shared,
|
|
171
62
|
manualCodeEntryAllowed: selection.manualCodeEntryAllowed,
|
|
172
63
|
discountsAvailableLoading: selection.state.status === "pending" && !selection.draftCode.trim(),
|
|
173
64
|
discountsAvailable: selection.manualCodeEntryAllowed || selection.quote?.preview.type === "applied",
|
|
174
|
-
|
|
175
|
-
several: true,
|
|
176
|
-
editingCode: Boolean(selection.draftCode.trim())
|
|
65
|
+
several: true
|
|
177
66
|
};
|
|
178
67
|
}
|
|
179
68
|
/** A draft code must remain editable while its price is unresolved and payment choices are disabled. */
|
|
@@ -181,6 +70,91 @@ function registrationDiscountEntryVisible(view, method) {
|
|
|
181
70
|
return (view.manualCodeEntryAllowed || view.editingCode) && (view.several || method === "stripe" || method === "pass_bundle" || method === "membership_bundle");
|
|
182
71
|
}
|
|
183
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
|
|
184
158
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.ts
|
|
185
159
|
function resolveRegistrationRecoveryAction(step, action) {
|
|
186
160
|
if (step === "payment-failed") return "payment-options";
|
|
@@ -284,6 +258,335 @@ function receiveHandOff(outcome, receive) {
|
|
|
284
258
|
});
|
|
285
259
|
}
|
|
286
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
|
|
287
590
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useRegistrationAdmission.ts
|
|
288
591
|
/** Owns admission and its navigation commands; renderers receive decisions. */
|
|
289
592
|
function useRegistrationAdmission(input) {
|
|
@@ -569,7 +872,7 @@ function useRunQuestionsRefresh(input) {
|
|
|
569
872
|
function useTicketSelectionInitialization(input) {
|
|
570
873
|
const initializedSelection = useRef(null);
|
|
571
874
|
useEffect(() => {
|
|
572
|
-
if (input.locked) return;
|
|
875
|
+
if (input.locked || input.restoring) return;
|
|
573
876
|
if (!input.usesTicketTypes) {
|
|
574
877
|
if (input.lines.length > 0) input.setLines([]);
|
|
575
878
|
return;
|
|
@@ -855,25 +1158,6 @@ function useExistingEventRegistrationWithDeps({ isAuthenticated, occurrenceId },
|
|
|
855
1158
|
};
|
|
856
1159
|
}
|
|
857
1160
|
//#endregion
|
|
858
|
-
//#region ../blocks/src/system/runtime/shared/useWaitlistClaim.state.ts
|
|
859
|
-
const DEFAULT_WAITLIST_CLAIM_ERROR = "Online booking is unavailable right now. Please contact the organiser for help with booking.";
|
|
860
|
-
function toWaitlistClaimResolveFailure(error) {
|
|
861
|
-
if (isUnauthorizedBlockApiError(error)) return {
|
|
862
|
-
kind: "portal-login-required",
|
|
863
|
-
message: "Please log in to continue with your waiting list invitation."
|
|
864
|
-
};
|
|
865
|
-
return {
|
|
866
|
-
kind: "error",
|
|
867
|
-
message: hasStatus(error) && (error.status === 404 || error.status === 409 || error.status === 410) ? eventRegistrationErrors.waitlistUnavailable.message : DEFAULT_WAITLIST_CLAIM_ERROR
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
function isUnauthorizedBlockApiError(error) {
|
|
871
|
-
return error instanceof Error && error.name === "BlockApiError" && hasStatus(error) && error.status === 401;
|
|
872
|
-
}
|
|
873
|
-
function hasStatus(value) {
|
|
874
|
-
return typeof value === "object" && value !== null && "status" in value;
|
|
875
|
-
}
|
|
876
|
-
//#endregion
|
|
877
1161
|
//#region ../blocks/src/system/runtime/shared/useWaitlistClaim.ts
|
|
878
1162
|
const WAITLIST_CLAIM_LOCATION_EVENT = "riverbank:waitlist-claim-location-change";
|
|
879
1163
|
function emitWaitlistClaimLocationChange() {
|
|
@@ -973,148 +1257,6 @@ function useWaitlistClaimForRequestWithDeps(request, deps) {
|
|
|
973
1257
|
}, [lookup, request]);
|
|
974
1258
|
}
|
|
975
1259
|
//#endregion
|
|
976
|
-
//#region ../blocks/src/system/runtime/nodes/event-registration/sessionStorage.ts
|
|
977
|
-
const STORAGE_PREFIX = "riverbank:event-registration:";
|
|
978
|
-
const STALE_THRESHOLD_MS = 1440 * 60 * 1e3;
|
|
979
|
-
const paymentSelection = z.discriminatedUnion("method", [
|
|
980
|
-
z.object({ method: z.literal("free") }),
|
|
981
|
-
z.object({
|
|
982
|
-
method: z.literal("stripe"),
|
|
983
|
-
collectionOptionKind: z.enum([
|
|
984
|
-
"upfront",
|
|
985
|
-
"deferred_manual",
|
|
986
|
-
"instalment_plan",
|
|
987
|
-
"flexible_balance"
|
|
988
|
-
])
|
|
989
|
-
}),
|
|
990
|
-
z.object({
|
|
991
|
-
method: z.literal("pass"),
|
|
992
|
-
passId: z.string(),
|
|
993
|
-
productName: z.string().optional()
|
|
994
|
-
}),
|
|
995
|
-
z.object({
|
|
996
|
-
method: z.literal("membership"),
|
|
997
|
-
membershipId: z.string(),
|
|
998
|
-
productName: z.string().optional()
|
|
999
|
-
}),
|
|
1000
|
-
z.object({
|
|
1001
|
-
method: z.literal("pass_bundle"),
|
|
1002
|
-
bundlePassId: z.string(),
|
|
1003
|
-
productName: z.string().optional(),
|
|
1004
|
-
productDescription: z.string().optional(),
|
|
1005
|
-
productPrice: z.number().optional(),
|
|
1006
|
-
productCurrency: z.string().optional()
|
|
1007
|
-
}),
|
|
1008
|
-
z.object({
|
|
1009
|
-
method: z.literal("membership_bundle"),
|
|
1010
|
-
bundleMembershipId: z.string(),
|
|
1011
|
-
productName: z.string().optional(),
|
|
1012
|
-
productDescription: z.string().optional(),
|
|
1013
|
-
productPrice: z.number().optional(),
|
|
1014
|
-
productCurrency: z.string().optional(),
|
|
1015
|
-
productInterval: z.string().optional()
|
|
1016
|
-
})
|
|
1017
|
-
]);
|
|
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 = {
|
|
1026
|
-
formData: z.object({
|
|
1027
|
-
name: z.string(),
|
|
1028
|
-
email: z.string(),
|
|
1029
|
-
phone: z.string(),
|
|
1030
|
-
notes: z.string(),
|
|
1031
|
-
consentAccepted: z.boolean().optional(),
|
|
1032
|
-
mailingListOptIn: z.boolean().optional()
|
|
1033
|
-
}),
|
|
1034
|
-
ticketSelections: z.array(z.object({
|
|
1035
|
-
pricingOptionId: z.string().nullable(),
|
|
1036
|
-
quantity: z.number().int().positive()
|
|
1037
|
-
})).min(1),
|
|
1038
|
-
selectedAttendanceMode: z.enum(["in_person", "online"]).nullable().optional(),
|
|
1039
|
-
paymentSelection,
|
|
1040
|
-
guests: z.array(z.object({
|
|
1041
|
-
name: z.string(),
|
|
1042
|
-
email: z.string().nullable(),
|
|
1043
|
-
phone: z.string().nullable()
|
|
1044
|
-
})),
|
|
1045
|
-
selectedSlidingAmount: z.number().nullable(),
|
|
1046
|
-
discountCode: z.string(),
|
|
1047
|
-
mailingListSignupNote: z.enum(["confirmation_required", "not_confirmed"]).optional(),
|
|
1048
|
-
bookingQuestions: bookingQuestionsPaymentSnapshotSchema.optional(),
|
|
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()
|
|
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]);
|
|
1073
|
-
function key(siteId, submissionId) {
|
|
1074
|
-
return `${STORAGE_PREFIX}${siteId}:${submissionId}`;
|
|
1075
|
-
}
|
|
1076
|
-
function savePendingRegistration(siteId, submissionId, data) {
|
|
1077
|
-
try {
|
|
1078
|
-
const entry = z.safeParse(currentSchema, {
|
|
1079
|
-
...data,
|
|
1080
|
-
ticketSelections: normalizeTicketSelectionLines(data.ticketSelections),
|
|
1081
|
-
version: 7,
|
|
1082
|
-
timestamp: Date.now()
|
|
1083
|
-
});
|
|
1084
|
-
if (entry.success) sessionStorage.setItem(key(siteId, submissionId), JSON.stringify(entry.data));
|
|
1085
|
-
} catch {}
|
|
1086
|
-
}
|
|
1087
|
-
function getPendingRegistration(siteId, submissionId) {
|
|
1088
|
-
try {
|
|
1089
|
-
const stored = sessionStorage.getItem(key(siteId, submissionId));
|
|
1090
|
-
const parsed = z.safeParse(schema, stored ? JSON.parse(stored) : null);
|
|
1091
|
-
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) {
|
|
1092
|
-
clearPendingRegistration(siteId, submissionId);
|
|
1093
|
-
return null;
|
|
1094
|
-
}
|
|
1095
|
-
return parsed.data;
|
|
1096
|
-
} catch {
|
|
1097
|
-
return null;
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
function clearPendingRegistration(siteId, submissionId) {
|
|
1101
|
-
try {
|
|
1102
|
-
sessionStorage.removeItem(key(siteId, submissionId));
|
|
1103
|
-
} catch {}
|
|
1104
|
-
}
|
|
1105
|
-
function cleanupStaleRegistrations() {
|
|
1106
|
-
try {
|
|
1107
|
-
Array.from({ length: sessionStorage.length }, (_, index) => sessionStorage.key(index)).filter((item) => item !== null && item.startsWith(STORAGE_PREFIX)).forEach((item) => {
|
|
1108
|
-
try {
|
|
1109
|
-
const parsed = z.safeParse(schema, JSON.parse(sessionStorage.getItem(item) ?? "null"));
|
|
1110
|
-
if (!parsed.success || Date.now() - parsed.data.timestamp > STALE_THRESHOLD_MS) sessionStorage.removeItem(item);
|
|
1111
|
-
} catch {
|
|
1112
|
-
sessionStorage.removeItem(item);
|
|
1113
|
-
}
|
|
1114
|
-
});
|
|
1115
|
-
} catch {}
|
|
1116
|
-
}
|
|
1117
|
-
//#endregion
|
|
1118
1260
|
//#region ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.ts
|
|
1119
1261
|
/** A return URL asks the server to verify; it is never proof of payment. */
|
|
1120
1262
|
function eventRegistrationCheckoutReturnRequest(params) {
|
|
@@ -1167,12 +1309,21 @@ function clearEventPayment(siteId) {
|
|
|
1167
1309
|
//#region ../blocks/src/system/runtime/nodes/event-registration/registrationErrorPresentation.ts
|
|
1168
1310
|
/** The tag the server gives a refused booking request, with a message meant for the booker. */
|
|
1169
1311
|
const REFUSED_INPUT_TAG = "REGISTRATION_INVALID_INPUT";
|
|
1312
|
+
/**
|
|
1313
|
+
* Public-site admission refusals: the site isn't open for online bookings.
|
|
1314
|
+
* The booker's details were fine, so these never ask them to check them.
|
|
1315
|
+
*/
|
|
1316
|
+
const SITE_UNAVAILABLE_TAGS = /* @__PURE__ */ new Set(["PUBLIC_SITE_UNAVAILABLE", "PUBLIC_SITE_NOT_FOUND"]);
|
|
1317
|
+
function siteUnavailable(error) {
|
|
1318
|
+
return error.tag !== void 0 && SITE_UNAVAILABLE_TAGS.has(error.tag);
|
|
1319
|
+
}
|
|
1170
1320
|
function parseEventRegistrationFailure(error) {
|
|
1171
1321
|
return {
|
|
1172
1322
|
...parseBookingSubmissionFailure(error, "Something went wrong. Please try again."),
|
|
1173
|
-
reason: error instanceof BlockApiError ? parseEventRegistrationErrorReason(error.tag)
|
|
1323
|
+
reason: !(error instanceof BlockApiError) ? null : siteUnavailable(error) ? "siteNotTakingBookings" : parseEventRegistrationErrorReason(error.tag),
|
|
1174
1324
|
siteTermsFailure: siteTermsFailureKind(error),
|
|
1175
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"),
|
|
1176
1327
|
refusedInput: error instanceof BlockApiError && error.tag === REFUSED_INPUT_TAG && error.message.trim().length > 0
|
|
1177
1328
|
};
|
|
1178
1329
|
}
|
|
@@ -1182,6 +1333,10 @@ function parseEventRegistrationFailure(error) {
|
|
|
1182
1333
|
* this course.") rather than the general one, since it says what to change.
|
|
1183
1334
|
*/
|
|
1184
1335
|
function registrationErrorPresentation(failure, bookings = "one") {
|
|
1336
|
+
if (failure.discountRefused) return {
|
|
1337
|
+
message: failure.message,
|
|
1338
|
+
action: "payment-options"
|
|
1339
|
+
};
|
|
1185
1340
|
if (failure.reason === "invalidAnswers" || failure.answersNeeded || Object.keys(failure.questionFieldErrors).length > 0) return {
|
|
1186
1341
|
message: failure.message,
|
|
1187
1342
|
action: "details"
|
|
@@ -1287,7 +1442,7 @@ function useEventRegistrationSubmitWithDeps(options, deps) {
|
|
|
1287
1442
|
registrationCommandId: prepared.registrationCommandId
|
|
1288
1443
|
}));
|
|
1289
1444
|
} catch (error) {
|
|
1290
|
-
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;
|
|
1291
1446
|
return reportFailedRegistration(options, error, method);
|
|
1292
1447
|
}
|
|
1293
1448
|
};
|
|
@@ -1426,9 +1581,7 @@ function savePendingCheckout(options, deps, prepared, checkoutAttemptId, mailing
|
|
|
1426
1581
|
guests: options.guests,
|
|
1427
1582
|
selectedSlidingAmount: options.selectedSlidingAmount,
|
|
1428
1583
|
discountCode: options.discountCode,
|
|
1429
|
-
mailingListSignupNote
|
|
1430
|
-
...options.bookingQuestionsSnapshot ? { bookingQuestions: options.bookingQuestionsSnapshot } : {},
|
|
1431
|
-
...options.runRequirementsSnapshots ? { runRequirements: options.runRequirementsSnapshots } : {}
|
|
1584
|
+
mailingListSignupNote
|
|
1432
1585
|
});
|
|
1433
1586
|
}
|
|
1434
1587
|
function registrationRequestIntentKey(request) {
|
|
@@ -1485,6 +1638,7 @@ function invitationRequestCredential(credential) {
|
|
|
1485
1638
|
}
|
|
1486
1639
|
/** Legal rejection returns to the intact draft, before any payment effect. */
|
|
1487
1640
|
function failedRegistrationStep(failure, method) {
|
|
1641
|
+
if (failure.discountRefused) return "select-payment";
|
|
1488
1642
|
if (failure.reason === "paymentContextMismatch") return "select-payment";
|
|
1489
1643
|
if (failure.reason === "invalidAnswers") return "enter-details";
|
|
1490
1644
|
if (!failure.siteTermsFailure) return "error";
|
|
@@ -1503,6 +1657,7 @@ function reportFailedRegistration(options, error, method) {
|
|
|
1503
1657
|
questionFieldErrors: parsed.questionFieldErrors,
|
|
1504
1658
|
answersNeeded: parsed.answersNeeded
|
|
1505
1659
|
};
|
|
1660
|
+
if (parsed.discountRefused) options.onDiscountRefused?.(message);
|
|
1506
1661
|
options.setErrorAction?.(action);
|
|
1507
1662
|
options.setErrorMessage(message);
|
|
1508
1663
|
options.setSubmissionFailure(failure);
|
|
@@ -1526,9 +1681,13 @@ function quoteFeedback(state) {
|
|
|
1526
1681
|
tone: "error",
|
|
1527
1682
|
message: state.message
|
|
1528
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
|
+
};
|
|
1529
1688
|
return state.status === "priced" && state.draftCode.trim() ? {
|
|
1530
1689
|
tone: "success",
|
|
1531
|
-
message: "
|
|
1690
|
+
message: state.preview.type === "applied" ? `${state.preview.publicLabel} applied. You'll pay ${formatCommercePrice(state.preview.totalAfterDiscountCents, state.preview.currency)}.` : ""
|
|
1532
1691
|
} : null;
|
|
1533
1692
|
}
|
|
1534
1693
|
/** A quote belongs to the complete priced input and the customer, never just the draft code. */
|
|
@@ -1575,8 +1734,12 @@ function decideSelectionQuoteResponse(pending, result) {
|
|
|
1575
1734
|
* or before going to Stripe and coming back), which they've already applied
|
|
1576
1735
|
* as far as they know. A code typed here waits for Apply.
|
|
1577
1736
|
*/
|
|
1578
|
-
function automaticSelectionQuoteWanted(state,
|
|
1579
|
-
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;
|
|
1580
1743
|
}
|
|
1581
1744
|
/** Nothing to price: no code or automatic discount can change a free selection. */
|
|
1582
1745
|
function freeSelection(input) {
|
|
@@ -1599,8 +1762,8 @@ function pricedPreview(state) {
|
|
|
1599
1762
|
function decidedSelectionPricing(input, state, apply) {
|
|
1600
1763
|
const priced = state.status === "priced" ? state : null;
|
|
1601
1764
|
const fallback = priced === null ? pricedPreview(state) : null;
|
|
1602
|
-
const settled =
|
|
1603
|
-
const
|
|
1765
|
+
const settled = priced !== null || fallback !== null || freeSelection(input) || singleBookingNeedsNoAnswer(input, state);
|
|
1766
|
+
const waiting = quoteWaiting(input, state, settled);
|
|
1604
1767
|
return {
|
|
1605
1768
|
state,
|
|
1606
1769
|
quote: selectionQuoteOf(priced) ?? (fallback ? {
|
|
@@ -1611,11 +1774,40 @@ function decidedSelectionPricing(input, state, apply) {
|
|
|
1611
1774
|
decidedCode: priced?.decidedCode,
|
|
1612
1775
|
ready: settled,
|
|
1613
1776
|
payableCents: selectionPayable(input, state),
|
|
1614
|
-
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,
|
|
1615
1780
|
/** The visitor has to apply, change or remove the code, or try again, before there's a price. */
|
|
1616
|
-
awaitingVisitor:
|
|
1781
|
+
awaitingVisitor: waiting.awaitingVisitor,
|
|
1617
1782
|
manualCodeEntryAllowed: state.manualCodeEntryAllowed,
|
|
1618
|
-
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
|
|
1619
1811
|
};
|
|
1620
1812
|
}
|
|
1621
1813
|
/** A request is out, or about to go for the automatic code; the other states wait for the visitor. */
|
|
@@ -1628,13 +1820,13 @@ function selectionQuoteOf(priced) {
|
|
|
1628
1820
|
source: priced.draftCode.trim() ? "typed" : "automatic"
|
|
1629
1821
|
} : null;
|
|
1630
1822
|
}
|
|
1631
|
-
function codeFieldFor(state, apply) {
|
|
1823
|
+
function codeFieldFor(state, apply, settled) {
|
|
1632
1824
|
return {
|
|
1633
1825
|
apply,
|
|
1634
1826
|
applying: state.status === "pending",
|
|
1635
|
-
failed: state.status === "failed",
|
|
1827
|
+
failed: state.status === "failed" && !state.draftCode.trim() && !settled,
|
|
1636
1828
|
feedback: quoteFeedback(state),
|
|
1637
|
-
hint: "
|
|
1829
|
+
hint: state.status === "priced" && state.preview.totalAfterDiscountCents === 0 ? "There's nothing to pay. You won't need to enter card details." : ""
|
|
1638
1830
|
};
|
|
1639
1831
|
}
|
|
1640
1832
|
//#endregion
|
|
@@ -1688,12 +1880,13 @@ async function requestSelectionQuote(input) {
|
|
|
1688
1880
|
}
|
|
1689
1881
|
}
|
|
1690
1882
|
/**
|
|
1691
|
-
*
|
|
1692
|
-
*
|
|
1693
|
-
*
|
|
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.
|
|
1694
1887
|
*/
|
|
1695
1888
|
function useSelectionCombinationPricing(input) {
|
|
1696
|
-
const lines = input.several
|
|
1889
|
+
const lines = input.several !== null ? selectionPreviewLines(input) : input.singleLines.length > 0 ? input.singleLines : null;
|
|
1697
1890
|
const key = selectionQuoteKey(lines, input.email);
|
|
1698
1891
|
const [state, setState] = useState(() => emptyQuoteDraft(key));
|
|
1699
1892
|
const [carried, setCarried] = useState(false);
|
|
@@ -1723,10 +1916,11 @@ function useSelectionCombinationPricing(input) {
|
|
|
1723
1916
|
setState((previous) => previous === pending ? next : previous);
|
|
1724
1917
|
};
|
|
1725
1918
|
useEffect(() => {
|
|
1726
|
-
if (automaticSelectionQuoteWanted(current, input
|
|
1919
|
+
if (automaticSelectionQuoteWanted(current, input, carried)) apply();
|
|
1727
1920
|
}, [
|
|
1728
1921
|
key,
|
|
1729
1922
|
input.automaticWanted,
|
|
1923
|
+
input.automaticOffered,
|
|
1730
1924
|
current.status,
|
|
1731
1925
|
current.draftCode,
|
|
1732
1926
|
carried
|
|
@@ -1749,7 +1943,12 @@ function useSelectionCombinationPricing(input) {
|
|
|
1749
1943
|
...decidedSelectionPricing(input, current, apply),
|
|
1750
1944
|
editCode,
|
|
1751
1945
|
carryCode,
|
|
1752
|
-
reset
|
|
1946
|
+
reset,
|
|
1947
|
+
refuse: (message) => setState({
|
|
1948
|
+
...current,
|
|
1949
|
+
status: "refused",
|
|
1950
|
+
message
|
|
1951
|
+
})
|
|
1753
1952
|
};
|
|
1754
1953
|
}
|
|
1755
1954
|
//#endregion
|
|
@@ -2037,7 +2236,7 @@ function usePaymentTransitions(options, runtime) {
|
|
|
2037
2236
|
setState,
|
|
2038
2237
|
note
|
|
2039
2238
|
]);
|
|
2040
|
-
const verify = useCallback((request, resumePayment =
|
|
2239
|
+
const verify = useCallback((request, resumePayment = false) => {
|
|
2041
2240
|
if (operation.current) return;
|
|
2042
2241
|
generation.current += 1;
|
|
2043
2242
|
setState({
|
|
@@ -2369,21 +2568,34 @@ function initialSlidingAmountInput(event) {
|
|
|
2369
2568
|
function useEventRegistrationWizard(options) {
|
|
2370
2569
|
return useEventRegistrationWizardWithDeps(options, eventRegistrationWizardDeps);
|
|
2371
2570
|
}
|
|
2372
|
-
|
|
2373
|
-
|
|
2571
|
+
const CHOOSER_CLOCK = { kind: "relative" };
|
|
2572
|
+
/**
|
|
2573
|
+
* Preserve source availability through event adaptation and page scoping.
|
|
2574
|
+
*
|
|
2575
|
+
* `choiceNowIso` is the chooser's clock: it starts at the server snapshot so hydration matches, then
|
|
2576
|
+
* follows the browser, so a date that starts while the page is open leaves the chooser.
|
|
2577
|
+
* `registrationEvents` stays the full set, so payment recovery still finds a date that has started.
|
|
2578
|
+
*/
|
|
2579
|
+
function useRegistrationEventSource(options, choiceNowIso) {
|
|
2374
2580
|
const events = options.eventSource.kind === "ready" ? options.eventSource.events : NO_EVENTS;
|
|
2375
2581
|
const registrationEvents = useMemo(() => [...toRegistrationEvents(events), ...toWholeSeriesRegistrationEvents(events)], [events]);
|
|
2376
|
-
const
|
|
2377
|
-
|
|
2582
|
+
const choiceKey = useMemo(() => {
|
|
2583
|
+
const choices = resolveEventRegistrationChoices(events, {
|
|
2378
2584
|
occurrenceContext: options.occurrenceContext,
|
|
2379
2585
|
subject: options.subject
|
|
2380
|
-
});
|
|
2586
|
+
}, new Date(choiceNowIso));
|
|
2587
|
+
return [...toRegistrationEvents(choices), ...toWholeSeriesRegistrationEvents(choices)].map((event) => event.selectionId).join("\n");
|
|
2381
2588
|
}, [
|
|
2382
|
-
|
|
2589
|
+
events,
|
|
2590
|
+
choiceNowIso,
|
|
2383
2591
|
options.occurrenceContext?.seriesId,
|
|
2384
2592
|
options.subject?.kind,
|
|
2385
2593
|
options.subject?.kind === "eventSeries" ? options.subject.eventSeriesId : options.subject?.kind === "eventOffering" ? `${options.subject.eventOfferingId}:${options.subject.catalogueEventSeriesIds.join(",")}` : options.subject?.reason
|
|
2386
2594
|
]);
|
|
2595
|
+
const scopedEvents = useMemo(() => {
|
|
2596
|
+
const choiceIds = new Set(choiceKey.split("\n"));
|
|
2597
|
+
return registrationEvents.filter((event) => choiceIds.has(event.selectionId));
|
|
2598
|
+
}, [registrationEvents, choiceKey]);
|
|
2387
2599
|
return {
|
|
2388
2600
|
events,
|
|
2389
2601
|
registrationEvents,
|
|
@@ -2406,7 +2618,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2406
2618
|
const api = useBlockApi();
|
|
2407
2619
|
const arrivalCredential = deps.useWaitlistClaimCredential();
|
|
2408
2620
|
const nowIso = deps.useBookingNowIso(options.now);
|
|
2409
|
-
const { events, registrationEvents, scopedEvents, scopedEventSource } = useRegistrationEventSource(options);
|
|
2621
|
+
const { events, registrationEvents, scopedEvents, scopedEventSource } = useRegistrationEventSource(options, deps.useBookingNowIso(options.now, CHOOSER_CLOCK));
|
|
2410
2622
|
const preSelectedEvent = useMemo(() => findPreSelectedEvent({
|
|
2411
2623
|
scopedEvents,
|
|
2412
2624
|
occurrenceContext: options.occurrenceContext
|
|
@@ -2417,6 +2629,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2417
2629
|
draft: createRegistrationDraftData(preSelectedEvent ?? null),
|
|
2418
2630
|
invitation: beginWaitlistInvitation(arrivalCredential)
|
|
2419
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
|
+
});
|
|
2420
2642
|
const step = flowState.step;
|
|
2421
2643
|
const paymentIntent = flowState.paymentSelection;
|
|
2422
2644
|
const { selection, runChoices, formData: draftFormData, guests, selectedAttendanceMode, selectedTicketLines, selectedSlidingAmountInput: draftSlidingAmountInput } = flowState.draft;
|
|
@@ -2501,7 +2723,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2501
2723
|
type: "claim-arrived",
|
|
2502
2724
|
credential: arrivalCredential
|
|
2503
2725
|
});
|
|
2504
|
-
|
|
2726
|
+
if (isSameWaitlistClaim(arrivalCredential, flowState.spentClaim)) clearWaitlistClaimLocation();
|
|
2727
|
+
}, [arrivalCredential, flowState.spentClaim]);
|
|
2505
2728
|
useEffect(() => {
|
|
2506
2729
|
if (claimLookup) dispatchFlow({
|
|
2507
2730
|
type: "claim-updated",
|
|
@@ -2629,7 +2852,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2629
2852
|
}, [eligibility]);
|
|
2630
2853
|
const verification = paymentController.verification;
|
|
2631
2854
|
const [paymentReturn, setPaymentReturn] = useState(null);
|
|
2632
|
-
const [restoredCode, restoreDiscountCode] = useState(null);
|
|
2633
2855
|
deps.useEventRegistrationStripeReturn({
|
|
2634
2856
|
siteId: api.config.siteId,
|
|
2635
2857
|
verify: paymentController.verify,
|
|
@@ -2644,7 +2866,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2644
2866
|
setPaymentReturn(null);
|
|
2645
2867
|
dispatchFlow({
|
|
2646
2868
|
type: "payment-return-restored",
|
|
2647
|
-
restoration: paymentReturnRestoration(paymentReturn, registrationEvents
|
|
2869
|
+
restoration: paymentReturnRestoration(paymentReturn, registrationEvents)
|
|
2648
2870
|
});
|
|
2649
2871
|
}, [
|
|
2650
2872
|
options.eventSource.kind,
|
|
@@ -2738,6 +2960,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2738
2960
|
selectionId: currentTicketSelection.selectionId,
|
|
2739
2961
|
attendanceMode: selectedAttendanceMode,
|
|
2740
2962
|
locked: selectionLocked,
|
|
2963
|
+
restoring: !browserDraftReady,
|
|
2741
2964
|
usesTicketTypes: usesTicketTypeSelections,
|
|
2742
2965
|
lines: normalizedSelectedTicketLines,
|
|
2743
2966
|
visibleOptions: visibleTicketTypes,
|
|
@@ -2949,7 +3172,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2949
3172
|
itemPrice,
|
|
2950
3173
|
email: formData.email,
|
|
2951
3174
|
payment: paymentController.state,
|
|
2952
|
-
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)
|
|
2953
3185
|
});
|
|
2954
3186
|
const discountView = registrationDiscountView({
|
|
2955
3187
|
several: several !== null,
|
|
@@ -2958,35 +3190,38 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2958
3190
|
context: discountContext
|
|
2959
3191
|
});
|
|
2960
3192
|
const { code: discountCode, editCode: setDiscountCode } = discountView;
|
|
2961
|
-
/**
|
|
2962
|
-
* One item keeps a typed code in its discount box, several in their quote.
|
|
2963
|
-
* A code moving between them (or restored) stays the visitor's: one item
|
|
2964
|
-
* reads it as typed, and several price it without another Apply.
|
|
2965
|
-
*/
|
|
2966
|
-
const carryDiscountCode = (code, toSeveral) => {
|
|
2967
|
-
if (toSeveral) combinationPricing.carryCode(code);
|
|
2968
|
-
else discountUi.setDiscountCode(code);
|
|
2969
|
-
};
|
|
2970
3193
|
useEffect(() => {
|
|
2971
3194
|
if (restoredCode === null || paymentReturn) return;
|
|
2972
3195
|
restoreDiscountCode(null);
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
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;
|
|
2980
3215
|
const directPaymentOptions = resolveWizardDirectPaymentOptions({
|
|
2981
3216
|
eligibility,
|
|
2982
3217
|
currentEvent,
|
|
2983
3218
|
occurrenceContext: options.occurrenceContext,
|
|
2984
3219
|
ticketSelectionSubtotalCents,
|
|
2985
|
-
|
|
3220
|
+
automaticDiscount: singlePrices.automaticDiscount,
|
|
2986
3221
|
nowIso,
|
|
2987
3222
|
selectionPayment
|
|
2988
3223
|
});
|
|
2989
|
-
const { paymentDecision, paymentSelection, paymentStepState } = resolveWizardPaymentView({
|
|
3224
|
+
const { paymentDecision, paymentSelection, paymentStepState: quotedPaymentStepState } = resolveWizardPaymentView({
|
|
2990
3225
|
directPaymentOptions,
|
|
2991
3226
|
paymentIntent,
|
|
2992
3227
|
eligibility,
|
|
@@ -2998,9 +3233,10 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
2998
3233
|
eligibilityError,
|
|
2999
3234
|
isAuthenticated: flowState.isAuthenticated,
|
|
3000
3235
|
portalCreditState,
|
|
3001
|
-
discountCode:
|
|
3236
|
+
discountCode: codeAwaitingApply ? discountCode : "",
|
|
3002
3237
|
step
|
|
3003
3238
|
});
|
|
3239
|
+
const { state: paymentStepState, heldForCode: paymentHeldForCode } = holdPaymentForCode(quotedPaymentStepState, codeAwaitingApply);
|
|
3004
3240
|
const siteTerms = useSiteTermsAgreement({
|
|
3005
3241
|
terms: options.siteTerms,
|
|
3006
3242
|
context: {
|
|
@@ -3055,13 +3291,15 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3055
3291
|
runChoices,
|
|
3056
3292
|
formData,
|
|
3057
3293
|
bookingQuestions: questions.submission,
|
|
3058
|
-
bookingQuestionsSnapshot: questions.paymentSnapshot,
|
|
3059
3294
|
requirements: requirements.submission,
|
|
3060
|
-
runRequirementsSnapshots: requirements.runSnapshots,
|
|
3061
3295
|
mailingListSignup,
|
|
3062
3296
|
requireGuestDetails,
|
|
3063
3297
|
guests,
|
|
3064
3298
|
discountCode: discountView.submittedCode,
|
|
3299
|
+
onDiscountRefused: (message) => {
|
|
3300
|
+
discountUi.setDiscountUiOpen(true);
|
|
3301
|
+
combinationPricing.refuse(message);
|
|
3302
|
+
},
|
|
3065
3303
|
quoteReady: combinationPricing.ready,
|
|
3066
3304
|
invitation: invitationSubmission(waitlistClaim),
|
|
3067
3305
|
setStep,
|
|
@@ -3087,8 +3325,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3087
3325
|
/** Booking several: a row ticks or unticks without moving on. */
|
|
3088
3326
|
const handleSelectionToggle = (event) => {
|
|
3089
3327
|
if (selectionLocked) return;
|
|
3090
|
-
|
|
3091
|
-
if (toSeveral !== (several !== null)) carryDiscountCode(discountCode, toSeveral);
|
|
3328
|
+
if (severalItemsOf(toggleSelectionItem(selection, event)) !== null !== (several !== null)) combinationPricing.carryCode(discountCode);
|
|
3092
3329
|
dispatchFlow({
|
|
3093
3330
|
type: "selection-toggled",
|
|
3094
3331
|
event
|
|
@@ -3137,7 +3374,6 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3137
3374
|
setSelection(preSelectedEvent ? [preSelectedEvent] : []);
|
|
3138
3375
|
setGuests([]);
|
|
3139
3376
|
setGuestErrors({});
|
|
3140
|
-
discountUi.setDiscountCode("");
|
|
3141
3377
|
combinationPricing.reset();
|
|
3142
3378
|
commandRef.current = null;
|
|
3143
3379
|
setOptionsRefreshKey((value) => value + 1);
|
|
@@ -3179,6 +3415,16 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3179
3415
|
}),
|
|
3180
3416
|
paymentSelection
|
|
3181
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
|
+
});
|
|
3182
3428
|
const { hasEligibility, hasMembershipEligibility, isMembershipFastTrack } = getEligibilityFlowFlags({
|
|
3183
3429
|
eligibility,
|
|
3184
3430
|
portalAuthState,
|
|
@@ -3199,13 +3445,13 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3199
3445
|
events,
|
|
3200
3446
|
maxTicketsNum: waitlistClaim.kind === "ready" ? waitlistClaim.restoration.ticketsCount : options.maxTicketsNum,
|
|
3201
3447
|
scopedEvents,
|
|
3202
|
-
preSelectedEvent: preSelectedEvent
|
|
3448
|
+
preSelectedEvent: preSelectedDisplayEvent(preSelectedEvent, currentEvent, displayEvent),
|
|
3203
3449
|
hasPreSelectedContext,
|
|
3204
3450
|
presentation,
|
|
3205
3451
|
flow: flowState,
|
|
3206
3452
|
setStep: (next) => {
|
|
3207
3453
|
if (step === "success" || !selectionLocked) setStep(next);
|
|
3208
|
-
else if (step === "payment") paymentController.
|
|
3454
|
+
else if (step === "payment") paymentController.check();
|
|
3209
3455
|
},
|
|
3210
3456
|
admission,
|
|
3211
3457
|
ticketContinuation,
|
|
@@ -3233,8 +3479,8 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3233
3479
|
price: selectionPrice,
|
|
3234
3480
|
itemPrice
|
|
3235
3481
|
}),
|
|
3236
|
-
/** The code field
|
|
3237
|
-
combinationCodeField: combinationPricing.codeField,
|
|
3482
|
+
/** The code field shares the booking's server quote. */
|
|
3483
|
+
combinationCodeField: registrationCodeField(combinationPricing.codeField, combinationPricing.quote, paymentIntent),
|
|
3238
3484
|
combinationAwaitingVisitor: combinationPricing.awaitingVisitor,
|
|
3239
3485
|
/** The payment step's list of what several items cost; null for one item. */
|
|
3240
3486
|
selectionPaymentSummary: summariseSelectionPayment({
|
|
@@ -3316,6 +3562,12 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3316
3562
|
setShowMagicLinkModal,
|
|
3317
3563
|
handleLogout,
|
|
3318
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,
|
|
3319
3571
|
handlePaymentSelectionChange: (value) => {
|
|
3320
3572
|
if (!selectionLocked) handlePaymentSelectionChange(value);
|
|
3321
3573
|
},
|
|
@@ -3342,7 +3594,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
|
|
|
3342
3594
|
setDiscountUiOpen: discountUi.setDiscountUiOpen,
|
|
3343
3595
|
discountsAvailable: discountView.discountsAvailable,
|
|
3344
3596
|
manualCodeEntryAllowed: discountView.manualCodeEntryAllowed,
|
|
3345
|
-
autoAppliedDiscount:
|
|
3597
|
+
autoAppliedDiscount: singlePrices.automaticDiscount,
|
|
3346
3598
|
discountsAvailableLoading: discountView.discountsAvailableLoading,
|
|
3347
3599
|
discountContext,
|
|
3348
3600
|
shouldShowDiscountToggle,
|
|
@@ -3419,6 +3671,57 @@ function registrationCompletionState(state) {
|
|
|
3419
3671
|
registrationResult: null
|
|
3420
3672
|
};
|
|
3421
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
|
+
}
|
|
3422
3725
|
/**
|
|
3423
3726
|
* The card options on the payment step. One item offers what its own options
|
|
3424
3727
|
* allow. Several items offer one way, paying the whole total up front, when
|
|
@@ -3450,12 +3753,11 @@ function resolveWizardDirectPaymentOptions(input) {
|
|
|
3450
3753
|
}
|
|
3451
3754
|
}
|
|
3452
3755
|
}
|
|
3453
|
-
/** One item: its
|
|
3756
|
+
/** One item: its price less the automatic discount; a typed code is already out of the price. */
|
|
3454
3757
|
function previewTotalWithAutomaticDiscount(input) {
|
|
3455
3758
|
return (subtotalCents) => calculateEventRegistrationPreviewTotal({
|
|
3456
3759
|
subtotalCents,
|
|
3457
|
-
|
|
3458
|
-
automaticDiscount: input.discountUi.autoAppliedDiscount
|
|
3760
|
+
automaticDiscount: input.automaticDiscount
|
|
3459
3761
|
});
|
|
3460
3762
|
}
|
|
3461
3763
|
function buildDirectPaymentOptions(input, eligibility, priced, totalFor) {
|
|
@@ -3537,7 +3839,7 @@ function EventRegistrationPayment({ flow }) {
|
|
|
3537
3839
|
state: flow.payment.checkout,
|
|
3538
3840
|
onComplete: flow.actions.completePayment,
|
|
3539
3841
|
onRetry: flow.actions.retryPaymentLoad,
|
|
3540
|
-
onBack: flow.actions.
|
|
3842
|
+
onBack: flow.actions.back,
|
|
3541
3843
|
buttonVariant: "primary"
|
|
3542
3844
|
});
|
|
3543
3845
|
}
|