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