@riverbankcms/sdk 0.180.0 → 0.182.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_dts/{BlocksIslandsHydrator-DC_AvZwy.d.ts → BlocksIslandsHydrator-Bvw2bUif.d.ts} +1 -1
- package/dist/_dts/{Page-DQOxVtp3.d.ts → Page-B2EAT-bE.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DrLgY9_f.d.ts → SdkPreviewMode-D0vww6rh.d.ts} +2 -2
- package/dist/_dts/{client-BP7VBRvs.d.ts → client-D6T430bk.d.ts} +56 -70
- package/dist/_dts/{content-types-1-K2qi__.d.ts → content-types-wZVWccC6.d.ts} +2 -2
- package/dist/_dts/{contracts-Dfqz0Tcu.d.ts → contracts-B-vtOcr8.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-CSfAqmry.d.ts → generatePageMetadata-CxfwHE6z.d.ts} +2 -2
- package/dist/_dts/{index-BeM5Ylwf.d.ts → index-CEyYMhLJ.d.ts} +1 -2
- package/dist/_dts/{index-DQr358-m.d.ts → index-CQrb3Ccc.d.ts} +8 -8
- package/dist/_dts/{index-DCcxLa8p.d.ts → index-CciRW_w1.d.ts} +2 -2
- package/dist/_dts/{index-Blrw2oVk.d.ts → index-Cqxis-nv.d.ts} +1 -1
- package/dist/_dts/{index-CB5Csefo.d.ts → index-DIU-wL1M.d.ts} +2 -2
- package/dist/_dts/{index-DQBGwBPx.d.ts → index-DqPKdeTk.d.ts} +1 -1
- package/dist/_dts/{loadContent-BG2tLGXj.d.ts → loadContent-D0wrxiSp.d.ts} +7 -7
- package/dist/_dts/{request-P08l6mkr.d.ts → request-DEwxUSw8.d.ts} +2375 -883
- package/dist/_dts/{resolveBlockData-BDHc8lFs.d.ts → resolveBlockData-VaG_MYbN.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-Y3IZBbtL.d.ts → resolvePageContent-DTwklC_v.d.ts} +1 -1
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +7 -7
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
- package/dist/_dts/sdk/src/data/types.d.ts +2 -2
- package/dist/_dts/sdk/src/gifting/client.d.ts +1 -2
- package/dist/_dts/sdk/src/index.d.ts +104 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +83 -52
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +43 -56
- package/dist/_dts/sdk/src/portal/index.d.ts +3 -18
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{serviceBookingOutline-BvtNagjw.d.ts → serviceBookingOutline-DtQuFlID.d.ts} +6 -6
- package/dist/_dts/{types-DpEAnP4F.d.ts → types-B3RjeBLV.d.ts} +2 -2
- package/dist/_dts/{types-HAy1-Jjo.d.ts → types-BvUSGQrw.d.ts} +3 -3
- package/dist/_dts/{types-BrK6SS5c.d.ts → types-CkRFtBqd.d.ts} +7 -7
- package/dist/_dts/{validation-D6q3tOBA.d.ts → validation-BZA3DhcV.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-DJSmdNUJ.mjs → BlocksIslandsHydrator-CQMf0HdN.mjs} +19 -19
- package/dist/client/{BookingMailingListNote-CGxg37zx.mjs → BookingMailingListNote-7kdvuPow.mjs} +93 -18
- package/dist/client/{BookingQuestionFields-DXegGSnS.mjs → BookingQuestionFields-BJI7mZuV.mjs} +7 -87
- package/dist/client/CalendarAction-D_Glwvz2.mjs +105 -0
- package/dist/client/{CalendarNavigationChevron-VfP50sYm.mjs → CalendarNavigationChevron-DPUD6wjy.mjs} +8 -8
- package/dist/client/{CheckboxChoice-BZPLCgTU.mjs → CheckboxChoice-C8i4NraK.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-0Ua44F1j.mjs → DemoBookingPortalAccess-8kwNF9HN.mjs} +9 -6
- package/dist/client/{EventCalendar.client-CrpiyDSP.mjs → EventCalendar.client-Dhb14bcC.mjs} +10 -10
- package/dist/client/{EventCombined.client-D0me9wnz.mjs → EventCombined.client-C1jEZBN9.mjs} +60 -10
- package/dist/client/{EventEmbeddedCheckoutStep-BDnicDM6.mjs → EventEmbeddedCheckoutStep-BGkbUhuw.mjs} +1 -1
- package/dist/client/{EventItem-CJITrGkF.mjs → EventItem-Bb0ppG2N.mjs} +9 -177
- package/dist/client/{EventListWeekNavigation-BlEm_xjq.mjs → EventListWeekNavigation-DMryCaNV.mjs} +1 -1
- package/dist/client/{EventListing.client-BNM_HuS0.mjs → EventListing.client-BuH5kKA3.mjs} +3 -3
- package/dist/client/{EventListing.view-CXfb7RRy.mjs → EventListing.view-DsqvuulZ.mjs} +8 -8
- package/dist/client/{EventRegistrationPayment-DiD9uYs6.mjs → EventRegistrationPayment-D4FvQSFF.mjs} +555 -502
- package/dist/client/{Page-bX7iy_MK.mjs → Page-sV6BJkXX.mjs} +550 -339
- package/dist/client/{ProtectedSubmitButton-De6AzhE6.mjs → ProtectedSubmitButton-BNnKuir8.mjs} +1 -1
- package/dist/client/{SiteTermsAgreementField-BAdW5DvE.mjs → SiteTermsAgreementField-VfSd6JU-.mjs} +7 -11
- package/dist/client/{StepIndicator-DCfdcb7s.mjs → StepIndicator-B6o5B7g3.mjs} +1 -1
- package/dist/client/{StepIndicator-DCqorVne.mjs → StepIndicator-BTqO7cJl.mjs} +235 -26
- package/dist/client/{ThemedButton-CnSa7o-I.mjs → ThemedButton-PFOhXktM.mjs} +1 -33
- package/dist/client/{accessibleSurfaces-Wl8-_OVJ.mjs → accessibleSurfaces-BogaGutk.mjs} +983 -634
- package/dist/client/{accordion-wofJY8xY.mjs → accordion-6cuswD_s.mjs} +1 -1
- package/dist/client/{booking-form.client-CYl9NrqS.mjs → booking-form.client-BOMe_SKi.mjs} +52 -29
- package/dist/client/bookingCalendar--aWnqFDn.mjs +180 -0
- package/dist/client/{bookingForm-kgVWtuMe.mjs → bookingForm-DSCH-VHo.mjs} +4 -4
- package/dist/client/bookings.mjs +17 -11
- package/dist/client/{boxStyleClassNames-CQHWz5gJ.mjs → boxStyleClassNames-BFuqZCfz.mjs} +2 -2
- package/dist/client/{carousel-BE1dEFsD.mjs → carousel-CGyQVV1M.mjs} +2 -2
- package/dist/client/{carousel.client-DMtGYTTM.mjs → carousel.client-BtLwHefX.mjs} +1 -1
- package/dist/client/{cart-BsjsdGZE.mjs → cart-BYOe7MCh.mjs} +3 -3
- package/dist/client/{cart.client-DylGUWXY.mjs → cart.client-BKFkaXdV.mjs} +1 -1
- package/dist/client/{checkout-B5KxEUDr.mjs → checkout-Dwd7Di77.mjs} +3 -3
- package/dist/client/{checkout.client-C98fhch3.mjs → checkout.client-C25hpi-z.mjs} +1 -1
- package/dist/client/{checkoutUrls-BMLYTf38.mjs → checkoutUrls-tG788sw0.mjs} +1 -1
- package/dist/client/client.mjs +106 -43
- package/dist/client/{constants-PfYJsEZF.mjs → constants-DdxFG3Ic.mjs} +1 -2
- package/dist/client/{context-DtKdUdkO.mjs → context-Hi1RuYEM.mjs} +753 -373
- package/dist/client/{dateFormatting-BaGPvQS3.mjs → dateFormatting-C8vBCHuo.mjs} +15 -25
- package/dist/client/{demoPortalMagicLink-B8eDjhuG.mjs → demoPortalMagicLink-BAL5UIDG.mjs} +2 -3
- package/dist/client/{enhanceHeaderSection-DvhD-8eE.mjs → enhanceHeaderSection-Dv1Lr9kJ.mjs} +4 -5
- package/dist/client/{event-registration.client-Du9a_xAN.mjs → event-registration.client-dB_Z7bb-.mjs} +191 -210
- package/dist/client/{eventCalendar-Di9wDfzl.mjs → eventCalendar-CQnRA4Ww.mjs} +4 -4
- package/dist/client/{eventCombined-CNW6nBsB.mjs → eventCombined-BDOG1hVp.mjs} +4 -4
- package/dist/client/{eventListing-CQMxQ8By.mjs → eventListing-DSVmhy9n.mjs} +4 -4
- package/dist/client/{eventRegistration-CprS9k1D.mjs → eventRegistration-CD5mRtEH.mjs} +4 -4
- package/dist/client/{form-Zl1_8RJ6.mjs → form-DWnlEVSK.mjs} +3 -3
- package/dist/client/{form.client-TaMUys6I.mjs → form.client-D7zmeqNI.mjs} +5 -5
- package/dist/client/{form.parts-CpNPbPPM.mjs → form.parts-C-G6N_MK.mjs} +3 -3
- package/dist/client/gifting/client.mjs +32 -29
- package/dist/client/{gifting-DNVa7-Wj.mjs → gifting-Cn0jidP5.mjs} +4 -4
- package/dist/client/{gifting.client-CFUq3GVx.mjs → gifting.client-DVo1YFLs.mjs} +5 -5
- package/dist/client/{gifting.parts-CDQvxA4A.mjs → gifting.parts-Bak93gD2.mjs} +2 -2
- package/dist/client/{headerSection-Cg6083rn.mjs → headerSection-DjQuj_6v.mjs} +2 -2
- package/dist/client/{mediaAssets-B99AP7ai.mjs → mediaAssets-COfQolI3.mjs} +1 -1
- package/dist/client/{mediaContext-Fusweriw.mjs → mediaContext-DzvnjYXm.mjs} +1 -1
- package/dist/client/{newsletter-form.client-VuL9I96G.mjs → newsletter-form.client-rIYPziZC.mjs} +7 -7
- package/dist/client/{newsletter-form.interactive-7Of3eYn0.mjs → newsletter-form.interactive-DVt3enLr.mjs} +181 -155
- package/dist/client/{newsletter-form.parts-OBqsfT24.mjs → newsletter-form.parts-CH6dGfdn.mjs} +2 -2
- package/dist/client/{newsletterForm-BkJe_RTv.mjs → newsletterForm-Cg8cBDHd.mjs} +3 -3
- package/dist/client/{lookSurfaces-gJ3OqPf9.mjs → noop-jesvJXEE.mjs} +403 -275
- package/dist/client/portal/client.mjs +12202 -7166
- package/dist/client/portalOrders-oEoTvzkW.mjs +596 -0
- package/dist/client/portalRoutes-ByyVZfVq.mjs +873 -0
- package/dist/client/{product-detail.client-B2hdxqJN.mjs → product-detail.client-5aHq-vuu.mjs} +1 -1
- package/dist/client/{product-list.client-CCEgu9rx.mjs → product-list.client-CyAk5rnC.mjs} +1 -1
- package/dist/client/{productDetail-CRX_ZRfS.mjs → productDetail-B8aZ2mqY.mjs} +3 -3
- package/dist/client/{productList-BAdJ6z5S.mjs → productList-BuLemmod.mjs} +3 -3
- package/dist/client/{propsDecoder-BLKAmX0S.mjs → propsDecoder-0Unsqn3R.mjs} +2 -2
- package/dist/client/{registry.server-Bj9cmHHF.mjs → registry.server-DzvtVVD0.mjs} +664 -434
- package/dist/client/{renderableMediaAssetAdmission-BlfqYLJW.mjs → renderableMediaAssetAdmission-BsOWd9lf.mjs} +1 -1
- package/dist/client/rendering/client.mjs +26 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +16 -8
- package/dist/client/{richText-coerce-Z45OLLEX.mjs → richText-coerce-Bnng7JFA.mjs} +2 -1
- package/dist/client/{routeIslandApiConfig-DHpTTK77.mjs → routeIslandApiConfig-BGfcc9sk.mjs} +1 -1
- package/dist/client/{runtimeResponse-DtWSfWSZ.mjs → runtimeResponse-DAPVRToN.mjs} +1 -1
- package/dist/client/{runtimeResponse-D2j2-mOk.mjs → runtimeResponse-nXT8VAMl.mjs} +1 -1
- package/dist/client/{shop-BKsgxm_-.mjs → shop-GuMqnDL-.mjs} +3 -3
- package/dist/client/{shop-commerce-Cbtk_kUW.mjs → shop-commerce-D5bDY1o1.mjs} +53 -16
- package/dist/client/{shop-commerce-store-B-rv2p5h.mjs → shop-commerce-store-B7sHnLwI.mjs} +22 -5
- package/dist/client/{shop-discount-apply.state-CiCDLNh7.mjs → shop-discount-apply.state-Dos2zdC2.mjs} +2 -2
- package/dist/client/{shop.client-Rnqa74Tk.mjs → shop.client-uvj5GDZb.mjs} +17 -39
- package/dist/client/{shopShared-BaBfhjCq.mjs → shopShared-3giNWE3H.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/src-Al4ooTl_.mjs +164 -0
- package/dist/client/{src-o7WEvbK1.mjs → src-CmXh3JWs.mjs} +233 -91
- package/dist/client/{timetableModel-BOff1Kk5.mjs → timetableModel-GA-hn1qM.mjs} +11 -87
- package/dist/client/{shop-add-feedback-DvC2kP1K.mjs → urlParams-C2QHo1Pa.mjs} +1 -42
- package/dist/client/{useAvailableSlots-DQJNh10g.mjs → useAvailableSlots-CBneCxbG.mjs} +2 -3
- package/dist/client/{useDiscountCodeUi-BcFQRI_7.mjs → useDiscountCodeUi-D0kGF0C7.mjs} +1 -1
- package/dist/client/{useEventPagination-BvdcexDC.mjs → useEventPagination-xX8n_Tuu.mjs} +8 -8
- package/dist/client/{view-CTBwSpKv.mjs → view-DOyZc-DF.mjs} +4 -4
- package/dist/client/{wizardSteps-CWIQyRIw.mjs → wizardSteps-B952ify5.mjs} +1241 -295
- package/dist/preview-next/client/{PageSectionToolbar-CG6KwITA.mjs → PageSectionToolbar-BI3UCdpu.mjs} +3 -3
- package/dist/preview-next/client/{PreviewEditorSidebar-BGBqrC9m.mjs → PreviewEditorSidebar-jkfLVOgY.mjs} +12 -9
- package/dist/preview-next/client/{PreviewEditorUI-Bwkyx28x.mjs → PreviewEditorUI-DwJQs4hM.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-DB1l6JNU.mjs → PreviewShell-BAxAkuz8.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-Bs6Cwzr3.mjs → SdkPreviewModeRuntime-0UVB-39f.mjs} +68 -17
- package/dist/preview-next/client/{previewAssistantSlot-T-oDD_Dd.mjs → previewAssistantSlot-BgiYk3PB.mjs} +7347 -3516
- package/dist/preview-next/client/{previewChromeRoot-BeukcDRy.mjs → previewChromeRoot-tieNdF3E.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-ceDW_9q2.mjs → sdk-runtime-DXb_Evl0.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-CCB9bScO.mjs → siteStyleAccess-BlN0jt2c.mjs} +3 -3
- package/dist/preview-next/client/{useAutosaveStatus-D4o0CKq7.mjs → useAutosaveStatus-BUEPA4oL.mjs} +1 -1
- package/dist/preview-next/client/{useOpenBlockForSetup-Seccrvwu.mjs → useOpenBlockForSetup-BVfr5P--.mjs} +1 -1
- package/dist/preview-next/container-responsive.css +203 -174
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-FwFj8zGL.mjs → route-contract-BHTBA48n.mjs} +90 -37
- package/dist/server/{Block.shared-D6WrRCxX.mjs → Block.shared-hGoyEdjJ.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-BQzjDQ2q.mjs → ThemeScopeCore-BfUCTOwj.mjs} +160 -142
- package/dist/server/{accessibleSurfaces-CM3QANtw.mjs → accessibleSurfaces-Dskni4Xj.mjs} +94 -330
- package/dist/server/accordions-By_0Ykks.mjs +111 -0
- package/dist/server/{bindings-CS6ih1Yc.mjs → bindings-DMJH4bvo.mjs} +7 -7
- package/dist/server/{client-m0ylCj_f.mjs → client-DrwlRNAH.mjs} +105 -42
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/constants-CeMywaiD.mjs +1485 -0
- package/dist/server/{customCss-BZ8YSrQg.mjs → customCss-C9kgPHvr.mjs} +41 -5
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/{resolveButtonColourStates--6yJp9Tq.mjs → expandPalette-ehuW8r2g.mjs} +745 -1229
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-vgWMz1uD.mjs → loadContent-D0prFflT.mjs} +5 -4
- package/dist/server/{loadPage-CIOL3-9t.mjs → loadPage-CBLke9pJ.mjs} +3 -3
- package/dist/server/{lookMediaFrame-m-91jGGn.mjs → lookMediaFrame-H0fi4bJk.mjs} +38 -18
- package/dist/server/manifest.mjs +36 -25
- package/dist/server/{mapLocation-BM5WX7FY.mjs → mapLocation-MDDSubTp.mjs} +1 -1
- package/dist/server/media-BRmYrnzb.mjs +31 -0
- package/dist/server/{media-luf7RF22.mjs → media-gvfIw3z8.mjs} +2 -31
- package/dist/server/{navigation-BcNfYYuu.mjs → navigation-wrcuWmgp.mjs} +2 -2
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +134 -81
- package/dist/server/{overrideResolution-BiHmsvTZ.mjs → overrideResolution-DUgCEH8z.mjs} +1 -1
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/{pageRenderPlan-DJo_obpi.mjs → pageRenderPlan-BHrmogsW.mjs} +165 -247
- package/dist/server/{pageRuntimeSupport-BnSuoHON.mjs → pageRuntimeSupport-D2-YMRei.mjs} +5 -5
- package/dist/server/{pageShared-BJuOzxzn.mjs → pageShared-CG8O31Eo.mjs} +3402 -3249
- package/dist/server/{parseThemeForPersistence-DOsfofCy.mjs → parseThemeForPersistence-CrPlbJEN.mjs} +3 -2
- package/dist/server/{portal-B4JVkdjc.mjs → portal-pG_uhsI2.mjs} +62 -46
- package/dist/server/portal.mjs +3 -3
- package/dist/server/portalQuestions-oUyohgL9.mjs +225 -0
- package/dist/server/{prebuild-Cr8p8T7V.mjs → prebuild-C8Amvzce.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-BZh57-ua.mjs → prefetchBlockData-BxUETRIZ.mjs} +4 -3
- package/dist/server/{registry-CvhFwbXJ.mjs → registry-Cc88-23f.mjs} +1514 -1190
- package/dist/server/rendering/components/pageShared.mjs +1 -1
- package/dist/server/rendering/helpers/loadPage.mjs +1 -1
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +10 -9
- package/dist/server/{resolveBlockData-Cv_W1LVB.mjs → resolveBlockData-OG3KOkig.mjs} +2 -2
- package/dist/server/{responseMedia-KRKguBC5.mjs → responseMedia-IfH65QAH.mjs} +1 -1
- package/dist/server/{schema-BpsqaSSU.mjs → schema-CwfxQjc4.mjs} +10 -113
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-CRKbTm_7.mjs → servicePageContent-BcFuhhD7.mjs} +22 -21
- package/dist/server/theme-bridge.mjs +34 -8
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-39SXCCnh.mjs → three-pass-converter-DPaUPTfl.mjs} +34 -16
- package/dist/server/titleSourceSchema-NhK6azFS.mjs +2018 -0
- package/dist/server/typeGuards-CTW_9AXq.mjs +413 -0
- package/dist/server/types-BKaBZFjD.mjs +1085 -0
- package/dist/server/{validation-DCl-FCk_.mjs → validation-BovmbS8N.mjs} +70 -17
- package/dist/server/{version-DT_R5JAR.mjs → version-hws4hgyX.mjs} +1 -1
- package/dist/server/video-Cdr3wh-q.mjs +272 -0
- package/dist/styles/index.css +1098 -1885
- package/package.json +2 -1
- package/dist/_dts/index-B0_2-65A.d.ts +0 -101
- package/dist/client/TabBarFragment-DlKQRhP4.mjs +0 -56
- package/dist/client/checkoutRoute-DKlZRNZD.mjs +0 -22
- package/dist/client/creditProducts-BQ1t1erI.mjs +0 -266
- package/dist/client/formatDate-hhI1-tzt.mjs +0 -26
- package/dist/server/constants-Cj7hfbrA.mjs +0 -41
- package/dist/server/richTextSchema-QLaQrbII.mjs +0 -212
- package/dist/server/titleSourceSchema-Cu-3PRvv.mjs +0 -122
|
@@ -0,0 +1,1485 @@
|
|
|
1
|
+
import { a as parseUuidBrand, t as parseMediaAssetId } from "./media-BRmYrnzb.mjs";
|
|
2
|
+
import { a as exactSchema, d as parseAttendeeId, i as evolvingSchema, l as parseClientArrangementId, m as parseEventSeriesRegistrationId, o as unknownKind, r as portalBeforeYouComeTaskSchema, s as parseAppointmentId, u as parseSiteTermsVersionId } from "./portalQuestions-oUyohgL9.mjs";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
//#region ../core/src/branded/orders.ts
|
|
5
|
+
const unsafeAsOrderId = (id) => id;
|
|
6
|
+
const unsafeAsOrderPaymentReceiptId = (id) => id;
|
|
7
|
+
const parseOrderId = (value) => parseUuidBrand(value, unsafeAsOrderId);
|
|
8
|
+
const parseOrderPaymentReceiptId = (value) => parseUuidBrand(value, unsafeAsOrderPaymentReceiptId);
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region ../core/src/branded/bookings.ts
|
|
11
|
+
const unsafeAsWaitlistEntryId = (id) => id;
|
|
12
|
+
const parseWaitlistEntryId = (value) => parseUuidBrand(value, unsafeAsWaitlistEntryId);
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region ../core/src/branded/entitlements.ts
|
|
15
|
+
const unsafeAsEntitlementId = (id) => id;
|
|
16
|
+
const parseEntitlementId = (value) => parseUuidBrand(value, unsafeAsEntitlementId);
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region ../core/src/appointment-lifecycle.ts
|
|
19
|
+
const APPOINTMENT_REQUEST_OUTCOME_VALUES = [
|
|
20
|
+
"approved",
|
|
21
|
+
"declined",
|
|
22
|
+
"lapsed",
|
|
23
|
+
"withdrawn"
|
|
24
|
+
];
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region ../core/src/booking-context-ref.ts
|
|
27
|
+
/** The raw id a booking's reference carries. Callers never choose among nullable columns. */
|
|
28
|
+
function bookingContextId(ref) {
|
|
29
|
+
switch (ref.tag) {
|
|
30
|
+
case "appointment": return ref.appointmentId;
|
|
31
|
+
case "event_attendee": return ref.attendeeId;
|
|
32
|
+
case "event_series_registration": return ref.registrationId;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exactSchema()(z.object({
|
|
36
|
+
id: z.string(),
|
|
37
|
+
email: z.string(),
|
|
38
|
+
name: z.string(),
|
|
39
|
+
phone: z.string().nullable()
|
|
40
|
+
}));
|
|
41
|
+
exactSchema()(z.object({
|
|
42
|
+
appointments: z.boolean(),
|
|
43
|
+
events: z.boolean()
|
|
44
|
+
}));
|
|
45
|
+
exactSchema()(z.object({
|
|
46
|
+
pricingOptionId: z.string().nullable(),
|
|
47
|
+
label: z.string(),
|
|
48
|
+
quantity: z.number()
|
|
49
|
+
}));
|
|
50
|
+
const portalJoiningDetailsSchema = exactSchema()(z.object({
|
|
51
|
+
joinUrl: z.string(),
|
|
52
|
+
accessCode: z.string().nullable(),
|
|
53
|
+
notes: z.string().nullable()
|
|
54
|
+
}));
|
|
55
|
+
exactSchema()(z.object({
|
|
56
|
+
id: z.string(),
|
|
57
|
+
name: z.string(),
|
|
58
|
+
phone: z.string().nullable(),
|
|
59
|
+
guestIndex: z.number()
|
|
60
|
+
}));
|
|
61
|
+
//#endregion
|
|
62
|
+
//#region ../site-contracts/src/siteData/portalCredits.ts
|
|
63
|
+
const passCreditHistoryEntrySchema = exactSchema()(z.object({
|
|
64
|
+
id: z.string(),
|
|
65
|
+
kind: z.enum(["redemption", "restoration"]),
|
|
66
|
+
credits: z.number(),
|
|
67
|
+
subjectKind: z.enum(["event_attendee", "appointment"]),
|
|
68
|
+
subjectId: z.string(),
|
|
69
|
+
occurredAt: z.string(),
|
|
70
|
+
bookingStartsAt: z.string().nullable(),
|
|
71
|
+
actorKind: z.enum([
|
|
72
|
+
"customer",
|
|
73
|
+
"admin",
|
|
74
|
+
"system"
|
|
75
|
+
]).nullable(),
|
|
76
|
+
reason: z.string().nullable()
|
|
77
|
+
}));
|
|
78
|
+
/** The pieces a booking's payment reuses when it names the pass or membership that paid. */
|
|
79
|
+
const customerPassUseCaseSchema = exactSchema()(z.enum(["event_pass", "appointment_package"]));
|
|
80
|
+
const customerMembershipStatusSchema = exactSchema()(z.enum([
|
|
81
|
+
"active",
|
|
82
|
+
"paused",
|
|
83
|
+
"canceled",
|
|
84
|
+
"past_due",
|
|
85
|
+
"trialing"
|
|
86
|
+
]));
|
|
87
|
+
exactSchema()(z.object({
|
|
88
|
+
id: z.string(),
|
|
89
|
+
heldWithStaffMemberId: z.string().nullable(),
|
|
90
|
+
passId: z.string(),
|
|
91
|
+
productUseCase: customerPassUseCaseSchema,
|
|
92
|
+
passName: z.string(),
|
|
93
|
+
passDescription: z.string().nullable(),
|
|
94
|
+
creditsHeld: z.number(),
|
|
95
|
+
creditsRemaining: z.number(),
|
|
96
|
+
creditsTotal: z.number(),
|
|
97
|
+
purchasedAt: z.string(),
|
|
98
|
+
expiresAt: z.string().nullable(),
|
|
99
|
+
status: z.enum([
|
|
100
|
+
"active",
|
|
101
|
+
"exhausted",
|
|
102
|
+
"expired",
|
|
103
|
+
"refunded"
|
|
104
|
+
]),
|
|
105
|
+
creditHistory: z.array(passCreditHistoryEntrySchema).readonly()
|
|
106
|
+
}));
|
|
107
|
+
exactSchema()(z.object({
|
|
108
|
+
id: z.string(),
|
|
109
|
+
membershipId: z.string(),
|
|
110
|
+
membershipName: z.string(),
|
|
111
|
+
membershipDescription: z.string().nullable(),
|
|
112
|
+
billingInterval: z.enum(["month", "year"]),
|
|
113
|
+
status: customerMembershipStatusSchema,
|
|
114
|
+
currentPeriodStart: z.string().nullable(),
|
|
115
|
+
currentPeriodEnd: z.string().nullable(),
|
|
116
|
+
cancelAtPeriodEnd: z.boolean(),
|
|
117
|
+
pausedAt: z.string().nullable(),
|
|
118
|
+
canceledAt: z.string().nullable(),
|
|
119
|
+
renews: z.boolean(),
|
|
120
|
+
canCancel: z.boolean(),
|
|
121
|
+
canResume: z.boolean(),
|
|
122
|
+
endedAt: z.string().nullable()
|
|
123
|
+
}));
|
|
124
|
+
const creditSummarySchema = exactSchema()(z.object({
|
|
125
|
+
currency: z.string(),
|
|
126
|
+
balanceCents: z.number(),
|
|
127
|
+
reservedCents: z.number(),
|
|
128
|
+
availableCents: z.number()
|
|
129
|
+
}));
|
|
130
|
+
const creditTransactionSchema = exactSchema()(z.object({
|
|
131
|
+
id: z.string(),
|
|
132
|
+
amountCents: z.number(),
|
|
133
|
+
currency: z.string(),
|
|
134
|
+
type: z.string(),
|
|
135
|
+
createdAt: z.string(),
|
|
136
|
+
reason: z.string().nullable()
|
|
137
|
+
}));
|
|
138
|
+
exactSchema()(z.object({
|
|
139
|
+
summary: creditSummarySchema,
|
|
140
|
+
transactions: z.array(creditTransactionSchema)
|
|
141
|
+
}));
|
|
142
|
+
//#endregion
|
|
143
|
+
//#region ../site-contracts/src/siteData/portalMoney.ts
|
|
144
|
+
const portalMoneySchema = exactSchema()(z.object({
|
|
145
|
+
amountCents: z.number(),
|
|
146
|
+
currency: z.string()
|
|
147
|
+
}));
|
|
148
|
+
const portalDeadlineSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
149
|
+
z.object({ kind: z.literal("none") }),
|
|
150
|
+
z.object({
|
|
151
|
+
kind: z.literal("due"),
|
|
152
|
+
at: z.string()
|
|
153
|
+
}),
|
|
154
|
+
z.object({
|
|
155
|
+
kind: z.literal("overdue"),
|
|
156
|
+
at: z.string()
|
|
157
|
+
})
|
|
158
|
+
]));
|
|
159
|
+
const portalPayOnlineSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
160
|
+
z.object({
|
|
161
|
+
kind: z.literal("available"),
|
|
162
|
+
amount: portalMoneySchema,
|
|
163
|
+
custom: z.object({
|
|
164
|
+
min: portalMoneySchema,
|
|
165
|
+
max: portalMoneySchema
|
|
166
|
+
}).nullable()
|
|
167
|
+
}),
|
|
168
|
+
z.object({ kind: z.literal("in_progress") }),
|
|
169
|
+
z.object({ kind: z.literal("not_offered") }),
|
|
170
|
+
z.object({ kind: z.literal("unchecked") })
|
|
171
|
+
]));
|
|
172
|
+
const payDue = z.object({
|
|
173
|
+
kind: z.literal("pay"),
|
|
174
|
+
amount: portalMoneySchema,
|
|
175
|
+
deadline: portalDeadlineSchema,
|
|
176
|
+
online: portalPayOnlineSchema
|
|
177
|
+
});
|
|
178
|
+
const instalmentFailed = z.object({
|
|
179
|
+
kind: z.literal("instalment_failed"),
|
|
180
|
+
amount: portalMoneySchema,
|
|
181
|
+
online: portalPayOnlineSchema
|
|
182
|
+
});
|
|
183
|
+
const finishPaying = z.object({
|
|
184
|
+
kind: z.literal("finish_paying"),
|
|
185
|
+
amount: portalMoneySchema,
|
|
186
|
+
deadline: portalDeadlineSchema,
|
|
187
|
+
firstPayment: z.boolean()
|
|
188
|
+
});
|
|
189
|
+
const paymentUnderway = z.object({
|
|
190
|
+
kind: z.literal("payment_underway"),
|
|
191
|
+
amount: portalMoneySchema
|
|
192
|
+
});
|
|
193
|
+
exactSchema()(z.discriminatedUnion("kind", [
|
|
194
|
+
payDue,
|
|
195
|
+
instalmentFailed,
|
|
196
|
+
finishPaying,
|
|
197
|
+
paymentUnderway
|
|
198
|
+
]));
|
|
199
|
+
const portalPaymentToDoSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
200
|
+
z.object({ kind: z.literal("nothing") }),
|
|
201
|
+
z.object({ kind: z.literal("checking") }),
|
|
202
|
+
z.object({
|
|
203
|
+
kind: z.literal("plan_running"),
|
|
204
|
+
rest: portalMoneySchema,
|
|
205
|
+
next: z.object({
|
|
206
|
+
amount: portalMoneySchema,
|
|
207
|
+
dueAt: z.string(),
|
|
208
|
+
passed: z.boolean()
|
|
209
|
+
}).nullable(),
|
|
210
|
+
online: portalPayOnlineSchema
|
|
211
|
+
}),
|
|
212
|
+
payDue,
|
|
213
|
+
instalmentFailed,
|
|
214
|
+
finishPaying,
|
|
215
|
+
paymentUnderway
|
|
216
|
+
]));
|
|
217
|
+
exactSchema()(z.object({
|
|
218
|
+
orderId: z.string(),
|
|
219
|
+
orderNumber: z.string(),
|
|
220
|
+
firstItem: z.string().nullable(),
|
|
221
|
+
otherItems: z.number()
|
|
222
|
+
}));
|
|
223
|
+
exactSchema()(z.object({
|
|
224
|
+
lines: z.array(z.object({
|
|
225
|
+
key: z.string(),
|
|
226
|
+
label: z.string(),
|
|
227
|
+
quantity: z.number(),
|
|
228
|
+
unitPrice: portalMoneySchema,
|
|
229
|
+
amount: portalMoneySchema,
|
|
230
|
+
refunded: portalMoneySchema.nullable()
|
|
231
|
+
})).readonly(),
|
|
232
|
+
adjustments: z.array(z.object({
|
|
233
|
+
kind: z.enum([
|
|
234
|
+
"discount",
|
|
235
|
+
"postage",
|
|
236
|
+
"tax",
|
|
237
|
+
"price_change"
|
|
238
|
+
]),
|
|
239
|
+
amount: portalMoneySchema,
|
|
240
|
+
effect: z.enum(["adds", "takes_off"])
|
|
241
|
+
})).readonly(),
|
|
242
|
+
total: portalMoneySchema,
|
|
243
|
+
taxIncluded: portalMoneySchema.nullable(),
|
|
244
|
+
credit: portalMoneySchema.nullable()
|
|
245
|
+
}));
|
|
246
|
+
//#endregion
|
|
247
|
+
//#region ../site-contracts/src/siteData/coreWireSchemas.ts
|
|
248
|
+
/**
|
|
249
|
+
* Decoders for the core-owned types the portal wire carries. Core keeps the
|
|
250
|
+
* types; these schemas are checked against them both ways, so a change to a
|
|
251
|
+
* core union shows up here as a compile error rather than as a refused
|
|
252
|
+
* response.
|
|
253
|
+
*/
|
|
254
|
+
/** A branded id on the wire, refused unless core's parser accepts it. */
|
|
255
|
+
function brandedId(parse, label) {
|
|
256
|
+
return z.string().transform((value, ctx) => {
|
|
257
|
+
const parsed = parse(value);
|
|
258
|
+
if (parsed.ok) return parsed.value;
|
|
259
|
+
ctx.addIssue({
|
|
260
|
+
code: "custom",
|
|
261
|
+
message: `Invalid ${label}`
|
|
262
|
+
});
|
|
263
|
+
return z.NEVER;
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
exactSchema()(z.discriminatedUnion("kind", [
|
|
267
|
+
z.object({
|
|
268
|
+
kind: z.literal("available"),
|
|
269
|
+
until: z.string().nullable()
|
|
270
|
+
}),
|
|
271
|
+
z.object({
|
|
272
|
+
kind: z.literal("closed"),
|
|
273
|
+
closedAt: z.string()
|
|
274
|
+
}),
|
|
275
|
+
z.object({
|
|
276
|
+
kind: z.literal("not_offered"),
|
|
277
|
+
reason: z.enum([
|
|
278
|
+
"not_wired",
|
|
279
|
+
"course_booking",
|
|
280
|
+
"storage_convergence",
|
|
281
|
+
"switched_off",
|
|
282
|
+
"checked_in",
|
|
283
|
+
"cancelled",
|
|
284
|
+
"waitlisted",
|
|
285
|
+
"past",
|
|
286
|
+
"date_missing",
|
|
287
|
+
"payment_pending",
|
|
288
|
+
"not_owner",
|
|
289
|
+
"not_authorized",
|
|
290
|
+
"pass_or_membership_backed",
|
|
291
|
+
"already_cancelled",
|
|
292
|
+
"already_started",
|
|
293
|
+
"payment_in_progress",
|
|
294
|
+
"invalid_start_time",
|
|
295
|
+
"not_cancelled",
|
|
296
|
+
"completed",
|
|
297
|
+
"hand_added",
|
|
298
|
+
"self_serve_refund",
|
|
299
|
+
"no_refund_link",
|
|
300
|
+
"check_in_unavailable",
|
|
301
|
+
"refunded",
|
|
302
|
+
"refund_pending",
|
|
303
|
+
"order_cancelled",
|
|
304
|
+
"order_cancelling",
|
|
305
|
+
"already_booked",
|
|
306
|
+
"has_room",
|
|
307
|
+
"no_ticket_choice",
|
|
308
|
+
"single_place"
|
|
309
|
+
])
|
|
310
|
+
})
|
|
311
|
+
]));
|
|
312
|
+
const cancellationMoneySchema = z.object({
|
|
313
|
+
amountCents: z.number(),
|
|
314
|
+
currency: z.string()
|
|
315
|
+
});
|
|
316
|
+
const cancellationKeepReasonSchema = z.discriminatedUnion("kind", [
|
|
317
|
+
z.object({
|
|
318
|
+
kind: z.literal("cutoff_passed"),
|
|
319
|
+
cutoffHours: z.number()
|
|
320
|
+
}),
|
|
321
|
+
z.object({ kind: z.literal("never_refunded") }),
|
|
322
|
+
z.object({ kind: z.literal("non_refundable_deposit") }),
|
|
323
|
+
z.object({ kind: z.literal("already_started") })
|
|
324
|
+
]);
|
|
325
|
+
const refundDestinationKindSchema = exactSchema()(z.enum([
|
|
326
|
+
"card",
|
|
327
|
+
"site_credit",
|
|
328
|
+
"card_and_site_credit"
|
|
329
|
+
]));
|
|
330
|
+
const refundRecipientSchema = exactSchema()(z.enum(["you", "original_buyer"]));
|
|
331
|
+
const cancellationMoneyOutcomeSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
332
|
+
z.object({ kind: z.literal("nothing_to_return") }),
|
|
333
|
+
z.object({
|
|
334
|
+
kind: z.literal("refund"),
|
|
335
|
+
money: cancellationMoneySchema,
|
|
336
|
+
to: refundDestinationKindSchema,
|
|
337
|
+
keptDeposit: cancellationMoneySchema.optional(),
|
|
338
|
+
until: z.string().optional()
|
|
339
|
+
}),
|
|
340
|
+
z.object({
|
|
341
|
+
kind: z.literal("credit_back"),
|
|
342
|
+
credits: z.number(),
|
|
343
|
+
until: z.string().optional()
|
|
344
|
+
}),
|
|
345
|
+
z.object({
|
|
346
|
+
kind: z.literal("keep_money"),
|
|
347
|
+
money: cancellationMoneySchema,
|
|
348
|
+
reason: cancellationKeepReasonSchema
|
|
349
|
+
}),
|
|
350
|
+
z.object({
|
|
351
|
+
kind: z.literal("keep_credit"),
|
|
352
|
+
credits: z.number(),
|
|
353
|
+
reason: cancellationKeepReasonSchema
|
|
354
|
+
}),
|
|
355
|
+
z.object({
|
|
356
|
+
kind: z.literal("contact_business"),
|
|
357
|
+
money: cancellationMoneySchema
|
|
358
|
+
})
|
|
359
|
+
]));
|
|
360
|
+
exactSchema()(z.discriminatedUnion("kind", [
|
|
361
|
+
z.object({
|
|
362
|
+
kind: z.literal("refunded"),
|
|
363
|
+
amount: cancellationMoneySchema.nullable(),
|
|
364
|
+
to: refundDestinationKindSchema,
|
|
365
|
+
recipient: refundRecipientSchema
|
|
366
|
+
}),
|
|
367
|
+
z.object({ kind: z.literal("credit_restored") }),
|
|
368
|
+
z.object({ kind: z.literal("refund_failed") }),
|
|
369
|
+
z.object({ kind: z.literal("none") })
|
|
370
|
+
]));
|
|
371
|
+
const appointmentRefSchema = exactSchema()(z.object({
|
|
372
|
+
tag: z.literal("appointment"),
|
|
373
|
+
appointmentId: brandedId(parseAppointmentId, "appointment id")
|
|
374
|
+
}));
|
|
375
|
+
const eventAttendeeRefSchema = exactSchema()(z.object({
|
|
376
|
+
tag: z.literal("event_attendee"),
|
|
377
|
+
attendeeId: brandedId(parseAttendeeId, "booking id")
|
|
378
|
+
}));
|
|
379
|
+
const courseRegistrationRefSchema = exactSchema()(z.object({
|
|
380
|
+
tag: z.literal("event_series_registration"),
|
|
381
|
+
registrationId: brandedId(parseEventSeriesRegistrationId, "course booking id")
|
|
382
|
+
}));
|
|
383
|
+
exactSchema()(z.discriminatedUnion("tag", [
|
|
384
|
+
appointmentRefSchema,
|
|
385
|
+
eventAttendeeRefSchema,
|
|
386
|
+
courseRegistrationRefSchema
|
|
387
|
+
]));
|
|
388
|
+
exactSchema()(z.enum(APPOINTMENT_REQUEST_OUTCOME_VALUES));
|
|
389
|
+
exactSchema()(z.object({
|
|
390
|
+
versionId: z.string().uuid().pipe(brandedId(parseSiteTermsVersionId, "site terms version")),
|
|
391
|
+
alreadyAgreed: z.boolean()
|
|
392
|
+
}));
|
|
393
|
+
const orderInstalmentSummarySchema = exactSchema()(z.object({
|
|
394
|
+
status: z.enum([
|
|
395
|
+
"pending_initial_payment",
|
|
396
|
+
"active",
|
|
397
|
+
"completed",
|
|
398
|
+
"payment_failed",
|
|
399
|
+
"cancelled",
|
|
400
|
+
"cancelled_as_paid_early",
|
|
401
|
+
"refunded",
|
|
402
|
+
"reconciliation_required"
|
|
403
|
+
]),
|
|
404
|
+
remainingBalanceCents: z.number(),
|
|
405
|
+
nextDueAt: z.string().nullable(),
|
|
406
|
+
nextDueAmountCents: z.number().nullable(),
|
|
407
|
+
rows: z.array(z.object({
|
|
408
|
+
id: z.string(),
|
|
409
|
+
sequence: z.number(),
|
|
410
|
+
phaseKind: z.enum(["initial", "scheduled"]),
|
|
411
|
+
dueAt: z.string(),
|
|
412
|
+
amountCents: z.number(),
|
|
413
|
+
status: z.enum([
|
|
414
|
+
"pending_initial_payment",
|
|
415
|
+
"scheduled",
|
|
416
|
+
"paid",
|
|
417
|
+
"failed",
|
|
418
|
+
"waived",
|
|
419
|
+
"cancelled",
|
|
420
|
+
"cancelled_as_paid_early",
|
|
421
|
+
"refunded"
|
|
422
|
+
])
|
|
423
|
+
})).readonly()
|
|
424
|
+
}));
|
|
425
|
+
const flexibleBalanceContractStatusSchema = exactSchema()(z.enum([
|
|
426
|
+
"active",
|
|
427
|
+
"payment_pending",
|
|
428
|
+
"overdue",
|
|
429
|
+
"completed",
|
|
430
|
+
"waived",
|
|
431
|
+
"cancelled_due_to_non_payment",
|
|
432
|
+
"refunded",
|
|
433
|
+
"closed_order_failed"
|
|
434
|
+
]));
|
|
435
|
+
const flexibleBalancePaymentEligibilitySchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
436
|
+
z.object({
|
|
437
|
+
kind: z.literal("eligible"),
|
|
438
|
+
minimumAmountCents: z.number(),
|
|
439
|
+
maximumCustomAmountCents: z.number(),
|
|
440
|
+
suggestedPayFullAmountCents: z.number()
|
|
441
|
+
}),
|
|
442
|
+
z.object({
|
|
443
|
+
kind: z.literal("full_balance_only"),
|
|
444
|
+
remainingBalanceCents: z.number(),
|
|
445
|
+
reason: z.enum(["overdue", "dust_balance"])
|
|
446
|
+
}),
|
|
447
|
+
z.object({
|
|
448
|
+
kind: z.literal("unavailable"),
|
|
449
|
+
reason: z.enum([
|
|
450
|
+
"already_settled",
|
|
451
|
+
"payment_pending",
|
|
452
|
+
"cancelled_due_to_non_payment",
|
|
453
|
+
"refunded",
|
|
454
|
+
"waived",
|
|
455
|
+
"order_failed",
|
|
456
|
+
"booking_cancelled",
|
|
457
|
+
"unresolved",
|
|
458
|
+
"below_card_minimum"
|
|
459
|
+
])
|
|
460
|
+
})
|
|
461
|
+
]));
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region ../site-contracts/src/siteData/portalOrders.ts
|
|
464
|
+
const ORDER_FILTERS = [
|
|
465
|
+
"all",
|
|
466
|
+
"products",
|
|
467
|
+
"bookings",
|
|
468
|
+
"passes",
|
|
469
|
+
"memberships"
|
|
470
|
+
];
|
|
471
|
+
const orderItemSchema = exactSchema()(z.object({
|
|
472
|
+
id: z.string(),
|
|
473
|
+
kind: z.enum([
|
|
474
|
+
"product",
|
|
475
|
+
"event_ticket",
|
|
476
|
+
"event_series_registration",
|
|
477
|
+
"pass",
|
|
478
|
+
"membership",
|
|
479
|
+
"appointment"
|
|
480
|
+
]),
|
|
481
|
+
displayName: z.string(),
|
|
482
|
+
quantity: z.number(),
|
|
483
|
+
unitPriceCents: z.number(),
|
|
484
|
+
totalCents: z.number(),
|
|
485
|
+
refundedCents: z.number(),
|
|
486
|
+
refundableRemainingCents: z.number()
|
|
487
|
+
}));
|
|
488
|
+
const orderRefundSchema = exactSchema()(z.object({
|
|
489
|
+
id: z.string(),
|
|
490
|
+
status: z.enum([
|
|
491
|
+
"pending",
|
|
492
|
+
"succeeded",
|
|
493
|
+
"failed",
|
|
494
|
+
"reconciliation_needed"
|
|
495
|
+
]),
|
|
496
|
+
amountCents: z.number(),
|
|
497
|
+
createdAt: z.string()
|
|
498
|
+
}));
|
|
499
|
+
const moneyTotals = {
|
|
500
|
+
collectedCents: z.number(),
|
|
501
|
+
refundedCents: z.number()
|
|
502
|
+
};
|
|
503
|
+
const customerOrderPaymentStateSchema = exactSchema()(z.union([
|
|
504
|
+
z.object({
|
|
505
|
+
kind: z.literal("not_required"),
|
|
506
|
+
reason: z.enum([
|
|
507
|
+
"free",
|
|
508
|
+
"waived",
|
|
509
|
+
"pass",
|
|
510
|
+
"membership"
|
|
511
|
+
]),
|
|
512
|
+
...moneyTotals,
|
|
513
|
+
outstandingCents: z.number()
|
|
514
|
+
}),
|
|
515
|
+
z.object({
|
|
516
|
+
kind: z.enum([
|
|
517
|
+
"unpaid",
|
|
518
|
+
"partially_paid",
|
|
519
|
+
"collection_failed"
|
|
520
|
+
]),
|
|
521
|
+
...moneyTotals,
|
|
522
|
+
outstandingCents: z.number()
|
|
523
|
+
}),
|
|
524
|
+
z.object({
|
|
525
|
+
kind: z.literal("waived"),
|
|
526
|
+
collectedCents: z.number(),
|
|
527
|
+
waivedCents: z.number(),
|
|
528
|
+
refundedCents: z.number(),
|
|
529
|
+
outstandingCents: z.literal(0)
|
|
530
|
+
}),
|
|
531
|
+
z.object({
|
|
532
|
+
kind: z.literal("paid"),
|
|
533
|
+
...moneyTotals,
|
|
534
|
+
outstandingCents: z.literal(0),
|
|
535
|
+
settledVia: z.enum([
|
|
536
|
+
"stripe",
|
|
537
|
+
"store_credit",
|
|
538
|
+
"mixed",
|
|
539
|
+
"pass_redemption",
|
|
540
|
+
"membership_access",
|
|
541
|
+
"free",
|
|
542
|
+
"manual"
|
|
543
|
+
])
|
|
544
|
+
}),
|
|
545
|
+
z.object({
|
|
546
|
+
kind: z.literal("refunded"),
|
|
547
|
+
...moneyTotals,
|
|
548
|
+
outstandingCents: z.number()
|
|
549
|
+
}),
|
|
550
|
+
z.object({
|
|
551
|
+
kind: z.literal("cancelled"),
|
|
552
|
+
...moneyTotals,
|
|
553
|
+
outstandingCents: z.number()
|
|
554
|
+
})
|
|
555
|
+
]));
|
|
556
|
+
const customerOrderFlexibleBalanceSchema = exactSchema()(z.object({
|
|
557
|
+
paymentEligibility: flexibleBalancePaymentEligibilitySchema.optional(),
|
|
558
|
+
status: flexibleBalanceContractStatusSchema,
|
|
559
|
+
dueAt: z.string(),
|
|
560
|
+
remainingBalanceCents: z.number(),
|
|
561
|
+
upfrontAmountCents: z.number()
|
|
562
|
+
}));
|
|
563
|
+
const customerOrderPaymentLabelsSchema = exactSchema()(z.object({
|
|
564
|
+
booking: z.string().nullable(),
|
|
565
|
+
money: z.string(),
|
|
566
|
+
tone: z.enum([
|
|
567
|
+
"success",
|
|
568
|
+
"attention",
|
|
569
|
+
"problem",
|
|
570
|
+
"neutral"
|
|
571
|
+
])
|
|
572
|
+
}));
|
|
573
|
+
exactSchema()(z.object({
|
|
574
|
+
id: z.string(),
|
|
575
|
+
siteId: z.string(),
|
|
576
|
+
customerId: z.string(),
|
|
577
|
+
orderNumber: z.string(),
|
|
578
|
+
createdAt: z.string(),
|
|
579
|
+
status: z.enum([
|
|
580
|
+
"pending",
|
|
581
|
+
"paid",
|
|
582
|
+
"partially_refunded",
|
|
583
|
+
"refunded",
|
|
584
|
+
"failed",
|
|
585
|
+
"cancelled"
|
|
586
|
+
]),
|
|
587
|
+
paymentMethod: z.enum([
|
|
588
|
+
"stripe",
|
|
589
|
+
"store_credit",
|
|
590
|
+
"mixed",
|
|
591
|
+
"pass_redemption",
|
|
592
|
+
"membership_access",
|
|
593
|
+
"free",
|
|
594
|
+
"manual",
|
|
595
|
+
"waived"
|
|
596
|
+
]),
|
|
597
|
+
currency: z.string(),
|
|
598
|
+
subtotalCents: z.number(),
|
|
599
|
+
discountCents: z.number(),
|
|
600
|
+
creditCents: z.number(),
|
|
601
|
+
taxCents: z.number(),
|
|
602
|
+
shippingCents: z.number(),
|
|
603
|
+
paidCents: z.number(),
|
|
604
|
+
refundedCents: z.number(),
|
|
605
|
+
grandTotalCents: z.number(),
|
|
606
|
+
balanceDueCents: z.number(),
|
|
607
|
+
paymentState: customerOrderPaymentStateSchema,
|
|
608
|
+
paymentLabels: customerOrderPaymentLabelsSchema,
|
|
609
|
+
toDo: portalPaymentToDoSchema,
|
|
610
|
+
instalmentPlan: orderInstalmentSummarySchema.nullable(),
|
|
611
|
+
flexibleBalance: customerOrderFlexibleBalanceSchema.nullable(),
|
|
612
|
+
filters: z.array(z.enum(ORDER_FILTERS)),
|
|
613
|
+
items: z.array(orderItemSchema),
|
|
614
|
+
refunds: z.array(orderRefundSchema)
|
|
615
|
+
}));
|
|
616
|
+
//#endregion
|
|
617
|
+
//#region ../site-contracts/src/siteData/portalWaitlists.ts
|
|
618
|
+
const customerPortalWaitlistSubjectSchema = exactSchema()(z.discriminatedUnion("kind", [z.object({
|
|
619
|
+
kind: z.literal("occurrence"),
|
|
620
|
+
occurrenceId: z.string(),
|
|
621
|
+
eventSeriesId: z.string(),
|
|
622
|
+
startsAt: z.string(),
|
|
623
|
+
endsAt: z.string(),
|
|
624
|
+
timeZone: z.string(),
|
|
625
|
+
deliveryMode: z.enum([
|
|
626
|
+
"in_person",
|
|
627
|
+
"online",
|
|
628
|
+
"hybrid"
|
|
629
|
+
]),
|
|
630
|
+
isOnline: z.boolean()
|
|
631
|
+
}), z.object({
|
|
632
|
+
kind: z.literal("wholeSeries"),
|
|
633
|
+
timeZone: z.string(),
|
|
634
|
+
deliveryMode: z.enum([
|
|
635
|
+
"in_person",
|
|
636
|
+
"online",
|
|
637
|
+
"hybrid"
|
|
638
|
+
]),
|
|
639
|
+
isOnline: z.boolean(),
|
|
640
|
+
eventSeriesId: z.string(),
|
|
641
|
+
scheduleSummary: z.string().nullable()
|
|
642
|
+
})]));
|
|
643
|
+
const OFFER_PRICE_KINDS = [
|
|
644
|
+
"total",
|
|
645
|
+
"free",
|
|
646
|
+
"chosen_at_booking",
|
|
647
|
+
"not_known"
|
|
648
|
+
];
|
|
649
|
+
const knownOfferPriceSchema = z.discriminatedUnion("kind", [
|
|
650
|
+
z.object({
|
|
651
|
+
kind: z.literal("total"),
|
|
652
|
+
amount: z.object({
|
|
653
|
+
amountCents: z.number(),
|
|
654
|
+
currency: z.string()
|
|
655
|
+
})
|
|
656
|
+
}),
|
|
657
|
+
z.object({ kind: z.literal("free") }),
|
|
658
|
+
z.object({ kind: z.literal("chosen_at_booking") }),
|
|
659
|
+
z.object({ kind: z.literal("not_known") })
|
|
660
|
+
]);
|
|
661
|
+
/** A kind this build doesn't know reads as not known, never as a failed list. */
|
|
662
|
+
const unknownOfferPriceSchema = z.object({ kind: z.string().refine((kind) => !OFFER_PRICE_KINDS.includes(kind), "a known price failed to decode") }).transform(() => ({ kind: "not_known" }));
|
|
663
|
+
const portalWaitlistOfferPriceSchema = evolvingSchema()(z.union([knownOfferPriceSchema, unknownOfferPriceSchema]));
|
|
664
|
+
const waitlistEntryBase = {
|
|
665
|
+
id: z.string(),
|
|
666
|
+
subject: customerPortalWaitlistSubjectSchema,
|
|
667
|
+
eventTitle: z.string(),
|
|
668
|
+
eventPath: z.string().nullable(),
|
|
669
|
+
venueName: z.string().nullable(),
|
|
670
|
+
requestedPlaces: z.number(),
|
|
671
|
+
joinedAt: z.string()
|
|
672
|
+
};
|
|
673
|
+
const customerPortalWaitlistEntrySchema = exactSchema()(z.discriminatedUnion("status", [
|
|
674
|
+
z.object({
|
|
675
|
+
...waitlistEntryBase,
|
|
676
|
+
status: z.literal("waiting"),
|
|
677
|
+
queuePosition: z.number().nullable(),
|
|
678
|
+
canLeave: z.literal(true)
|
|
679
|
+
}),
|
|
680
|
+
z.object({
|
|
681
|
+
...waitlistEntryBase,
|
|
682
|
+
status: z.literal("placeAvailable"),
|
|
683
|
+
claimExpiresAt: z.string(),
|
|
684
|
+
claimPath: z.string().nullable(),
|
|
685
|
+
offerPrice: portalWaitlistOfferPriceSchema,
|
|
686
|
+
canLeave: z.literal(true)
|
|
687
|
+
}),
|
|
688
|
+
z.object({
|
|
689
|
+
...waitlistEntryBase,
|
|
690
|
+
status: z.literal("offerExpired"),
|
|
691
|
+
claimExpiredAt: z.string(),
|
|
692
|
+
canLeave: z.literal(false)
|
|
693
|
+
})
|
|
694
|
+
]));
|
|
695
|
+
//#endregion
|
|
696
|
+
//#region ../site-contracts/src/siteData/portalRegularSessions.ts
|
|
697
|
+
const weekdaySchema = z.literal([
|
|
698
|
+
0,
|
|
699
|
+
1,
|
|
700
|
+
2,
|
|
701
|
+
3,
|
|
702
|
+
4,
|
|
703
|
+
5,
|
|
704
|
+
6
|
|
705
|
+
]);
|
|
706
|
+
const portalRegularSessionCadenceSchema = exactSchema()(z.discriminatedUnion("kind", [z.object({
|
|
707
|
+
kind: z.literal("weekly"),
|
|
708
|
+
everyWeeks: z.literal([1, 2]),
|
|
709
|
+
weekday: weekdaySchema
|
|
710
|
+
}), z.object({
|
|
711
|
+
kind: z.literal("monthly"),
|
|
712
|
+
weekday: weekdaySchema,
|
|
713
|
+
nth: z.literal([
|
|
714
|
+
1,
|
|
715
|
+
2,
|
|
716
|
+
3,
|
|
717
|
+
4,
|
|
718
|
+
"last"
|
|
719
|
+
])
|
|
720
|
+
})]));
|
|
721
|
+
const dateSchema = exactSchema()(z.union([
|
|
722
|
+
z.object({
|
|
723
|
+
state: z.literal("booked"),
|
|
724
|
+
occurrence: z.string(),
|
|
725
|
+
appointmentId: brandedId(parseAppointmentId, "appointment id"),
|
|
726
|
+
startAt: z.string(),
|
|
727
|
+
endAt: z.string()
|
|
728
|
+
}),
|
|
729
|
+
z.object({
|
|
730
|
+
state: z.enum([
|
|
731
|
+
"held",
|
|
732
|
+
"open",
|
|
733
|
+
"trainer_away"
|
|
734
|
+
]),
|
|
735
|
+
occurrence: z.string(),
|
|
736
|
+
startAt: z.string(),
|
|
737
|
+
endAt: z.string()
|
|
738
|
+
}),
|
|
739
|
+
z.object({
|
|
740
|
+
state: z.literal("away"),
|
|
741
|
+
occurrence: z.string()
|
|
742
|
+
})
|
|
743
|
+
]));
|
|
744
|
+
const portalRegularSessionSchema = exactSchema()(z.object({
|
|
745
|
+
arrangementId: brandedId(parseClientArrangementId, "regular sessions id"),
|
|
746
|
+
timezone: z.string(),
|
|
747
|
+
schedule: z.object({
|
|
748
|
+
effectiveFrom: z.string(),
|
|
749
|
+
cadence: portalRegularSessionCadenceSchema,
|
|
750
|
+
localStart: z.string()
|
|
751
|
+
}),
|
|
752
|
+
trainerName: z.string().nullable(),
|
|
753
|
+
serviceName: z.string().nullable(),
|
|
754
|
+
holdsTime: z.boolean(),
|
|
755
|
+
payment: z.union([z.object({
|
|
756
|
+
kind: z.literal("package"),
|
|
757
|
+
name: z.string().nullable(),
|
|
758
|
+
sessionsLeft: z.number()
|
|
759
|
+
}), z.object({ kind: z.enum(["owed", "payment_link"]) })]),
|
|
760
|
+
dates: z.array(dateSchema).readonly()
|
|
761
|
+
}));
|
|
762
|
+
exactSchema()(z.object({ arrangements: z.array(portalRegularSessionSchema).readonly() }));
|
|
763
|
+
//#endregion
|
|
764
|
+
//#region ../site-contracts/src/siteData/portalBookings.ts
|
|
765
|
+
/**
|
|
766
|
+
* One booking model for the customer portal, from GET /api/portal/bookings and
|
|
767
|
+
* GET /api/portal/bookings/{kind}/{id}. Every kind shares the fields a card and
|
|
768
|
+
* a booking page need, and its own extras ride in `detail`. The server decides
|
|
769
|
+
* every fact and action here, including whether the booking is over; the
|
|
770
|
+
* portal only words them.
|
|
771
|
+
*
|
|
772
|
+
* Wire evolution (pinned SDK clients): decoding is strict for the variants
|
|
773
|
+
* this build knows. Three points are extensible, and a value a newer server
|
|
774
|
+
* adds there decodes to a closed `unsupported` state instead of failing the
|
|
775
|
+
* page: the booking kind (the booking still shows, with nothing to act on), an
|
|
776
|
+
* action's state (the action is disabled), and the money a cancellation would
|
|
777
|
+
* return (cancel is disabled, so the portal never guesses a refund).
|
|
778
|
+
* Explanations of why an action isn't offered come from the server as text,
|
|
779
|
+
* so new reasons need no client change.
|
|
780
|
+
*/
|
|
781
|
+
const PORTAL_BOOKING_KINDS = [
|
|
782
|
+
"event",
|
|
783
|
+
"course",
|
|
784
|
+
"appointment"
|
|
785
|
+
];
|
|
786
|
+
/** The one map from a booking's reference to its URL words. */
|
|
787
|
+
function portalBookingPath(ref) {
|
|
788
|
+
return {
|
|
789
|
+
kind: portalBookingKind(ref),
|
|
790
|
+
bookingId: bookingContextId(ref)
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
function portalBookingKind(ref) {
|
|
794
|
+
switch (ref.tag) {
|
|
795
|
+
case "event_attendee": return "event";
|
|
796
|
+
case "event_series_registration": return "course";
|
|
797
|
+
case "appointment": return "appointment";
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
function brandedBookingId(parse) {
|
|
801
|
+
return z.string().transform((value, ctx) => {
|
|
802
|
+
const parsed = parse(value);
|
|
803
|
+
if (parsed.ok) return parsed.value;
|
|
804
|
+
ctx.addIssue({
|
|
805
|
+
code: "custom",
|
|
806
|
+
message: "Invalid booking ID"
|
|
807
|
+
});
|
|
808
|
+
return z.NEVER;
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
/**
|
|
812
|
+
* The URL words back to the booking's reference, refusing anything that isn't
|
|
813
|
+
* a real id of that kind. The route's params, the client router and
|
|
814
|
+
* `parsePortalBookingRef` all read bookings through this.
|
|
815
|
+
*/
|
|
816
|
+
const portalBookingPathSchema = z.union([
|
|
817
|
+
z.object({
|
|
818
|
+
kind: z.literal("event"),
|
|
819
|
+
bookingId: brandedBookingId(parseAttendeeId)
|
|
820
|
+
}).transform(({ bookingId }) => ({
|
|
821
|
+
tag: "event_attendee",
|
|
822
|
+
attendeeId: bookingId
|
|
823
|
+
})),
|
|
824
|
+
z.object({
|
|
825
|
+
kind: z.literal("course"),
|
|
826
|
+
bookingId: brandedBookingId(parseEventSeriesRegistrationId)
|
|
827
|
+
}).transform(({ bookingId }) => ({
|
|
828
|
+
tag: "event_series_registration",
|
|
829
|
+
registrationId: bookingId
|
|
830
|
+
})),
|
|
831
|
+
z.object({
|
|
832
|
+
kind: z.literal("appointment"),
|
|
833
|
+
bookingId: brandedBookingId(parseAppointmentId)
|
|
834
|
+
}).transform(({ bookingId }) => ({
|
|
835
|
+
tag: "appointment",
|
|
836
|
+
appointmentId: bookingId
|
|
837
|
+
}))
|
|
838
|
+
]);
|
|
839
|
+
/** The listed values must cover the union, so a new member here is a compile error, not a silent fallback. */
|
|
840
|
+
function allOf() {
|
|
841
|
+
return (values) => values;
|
|
842
|
+
}
|
|
843
|
+
const unsupported = (known) => unknownKind(known).transform(() => ({ kind: "unsupported" }));
|
|
844
|
+
const whenSchema = exactSchema()(z.object({
|
|
845
|
+
startsAt: z.string(),
|
|
846
|
+
endsAt: z.string().nullable(),
|
|
847
|
+
timeZone: z.string()
|
|
848
|
+
}));
|
|
849
|
+
const venueSchema = exactSchema()(z.object({
|
|
850
|
+
name: z.string().nullable(),
|
|
851
|
+
address: z.discriminatedUnion("kind", [
|
|
852
|
+
z.object({
|
|
853
|
+
kind: z.literal("shown"),
|
|
854
|
+
address: z.string().nullable(),
|
|
855
|
+
doorNote: z.string().nullable(),
|
|
856
|
+
directions: z.string().nullable()
|
|
857
|
+
}),
|
|
858
|
+
z.object({
|
|
859
|
+
kind: z.literal("after_booking"),
|
|
860
|
+
area: z.string().nullable()
|
|
861
|
+
}),
|
|
862
|
+
z.object({ kind: z.literal("not_given") })
|
|
863
|
+
])
|
|
864
|
+
}));
|
|
865
|
+
const whereSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
866
|
+
z.object({
|
|
867
|
+
kind: z.literal("venue"),
|
|
868
|
+
venue: venueSchema
|
|
869
|
+
}),
|
|
870
|
+
z.object({
|
|
871
|
+
kind: z.literal("online"),
|
|
872
|
+
joining: portalJoiningDetailsSchema.nullable()
|
|
873
|
+
}),
|
|
874
|
+
z.object({
|
|
875
|
+
kind: z.literal("hybrid"),
|
|
876
|
+
venue: venueSchema,
|
|
877
|
+
joining: portalJoiningDetailsSchema.nullable()
|
|
878
|
+
}),
|
|
879
|
+
z.object({ kind: z.literal("not_given") })
|
|
880
|
+
]));
|
|
881
|
+
const standingSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
882
|
+
z.object({ kind: z.literal("booked") }),
|
|
883
|
+
z.object({ kind: z.literal("awaiting_payment") }),
|
|
884
|
+
z.object({ kind: z.literal("requested") }),
|
|
885
|
+
z.object({
|
|
886
|
+
kind: z.literal("waitlisted"),
|
|
887
|
+
position: z.number().nullable()
|
|
888
|
+
}),
|
|
889
|
+
z.object({ kind: z.literal("cancelled") }),
|
|
890
|
+
z.object({
|
|
891
|
+
kind: z.literal("request_not_accepted"),
|
|
892
|
+
outcome: z.enum([
|
|
893
|
+
"declined",
|
|
894
|
+
"lapsed",
|
|
895
|
+
"withdrawn"
|
|
896
|
+
])
|
|
897
|
+
}),
|
|
898
|
+
z.object({ kind: z.literal("missed") }),
|
|
899
|
+
z.object({ kind: z.literal("given_away") })
|
|
900
|
+
]));
|
|
901
|
+
const peopleSchema = exactSchema()(z.object({
|
|
902
|
+
places: z.number(),
|
|
903
|
+
guests: z.array(z.object({
|
|
904
|
+
place: z.number(),
|
|
905
|
+
name: z.string().nullable(),
|
|
906
|
+
email: z.string().nullable(),
|
|
907
|
+
phone: z.string().nullable()
|
|
908
|
+
})).readonly(),
|
|
909
|
+
namesMissing: z.number()
|
|
910
|
+
}));
|
|
911
|
+
const ticketLineSchema = exactSchema()(z.object({
|
|
912
|
+
label: z.string(),
|
|
913
|
+
quantity: z.number(),
|
|
914
|
+
unitPrice: portalMoneySchema.nullable()
|
|
915
|
+
}));
|
|
916
|
+
const orderSchema = exactSchema()(z.object({
|
|
917
|
+
orderId: z.string(),
|
|
918
|
+
orderNumber: z.string(),
|
|
919
|
+
total: portalMoneySchema,
|
|
920
|
+
paidWithCredit: portalMoneySchema.nullable(),
|
|
921
|
+
paidSoFar: portalMoneySchema,
|
|
922
|
+
paymentLabels: customerOrderPaymentLabelsSchema,
|
|
923
|
+
toDo: portalPaymentToDoSchema,
|
|
924
|
+
bookingCount: z.number().int().positive()
|
|
925
|
+
}));
|
|
926
|
+
const paymentSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
927
|
+
z.object({ kind: z.literal("free") }),
|
|
928
|
+
z.object({ kind: z.literal("not_decided") }),
|
|
929
|
+
z.object({
|
|
930
|
+
kind: z.literal("pass"),
|
|
931
|
+
pass: z.object({
|
|
932
|
+
customerPassId: z.string(),
|
|
933
|
+
name: z.string(),
|
|
934
|
+
useCase: customerPassUseCaseSchema,
|
|
935
|
+
creditsRemaining: z.number(),
|
|
936
|
+
expiresAt: z.string().nullable()
|
|
937
|
+
}).nullable()
|
|
938
|
+
}),
|
|
939
|
+
z.object({
|
|
940
|
+
kind: z.literal("membership"),
|
|
941
|
+
membership: z.object({
|
|
942
|
+
customerMembershipId: z.string(),
|
|
943
|
+
name: z.string(),
|
|
944
|
+
status: customerMembershipStatusSchema
|
|
945
|
+
}).nullable()
|
|
946
|
+
}),
|
|
947
|
+
z.object({
|
|
948
|
+
kind: z.literal("order"),
|
|
949
|
+
order: orderSchema
|
|
950
|
+
}),
|
|
951
|
+
z.object({
|
|
952
|
+
kind: z.literal("owed"),
|
|
953
|
+
amount: portalMoneySchema.nullable()
|
|
954
|
+
}),
|
|
955
|
+
z.object({ kind: z.literal("unavailable") })
|
|
956
|
+
]));
|
|
957
|
+
const ACTION_KINDS = allOf()([
|
|
958
|
+
"available",
|
|
959
|
+
"closed",
|
|
960
|
+
"not_offered"
|
|
961
|
+
]);
|
|
962
|
+
const closedActionSchema = z.object({
|
|
963
|
+
kind: z.literal("closed"),
|
|
964
|
+
closedAt: z.string()
|
|
965
|
+
});
|
|
966
|
+
const notOfferedActionSchema = z.object({
|
|
967
|
+
kind: z.literal("not_offered"),
|
|
968
|
+
explanation: z.string().nullable()
|
|
969
|
+
});
|
|
970
|
+
const knownActionSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
971
|
+
z.object({
|
|
972
|
+
kind: z.literal("available"),
|
|
973
|
+
until: z.string().nullable()
|
|
974
|
+
}),
|
|
975
|
+
closedActionSchema,
|
|
976
|
+
notOfferedActionSchema
|
|
977
|
+
]));
|
|
978
|
+
const portalBookingActionSchema = evolvingSchema()(z.union([knownActionSchema, unsupported(ACTION_KINDS)]));
|
|
979
|
+
const RESCHEDULE_KINDS = allOf()([
|
|
980
|
+
"available",
|
|
981
|
+
"closed",
|
|
982
|
+
"not_offered",
|
|
983
|
+
"single_run"
|
|
984
|
+
]);
|
|
985
|
+
const knownRescheduleSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
986
|
+
z.object({
|
|
987
|
+
kind: z.literal("available"),
|
|
988
|
+
until: z.string().nullable()
|
|
989
|
+
}),
|
|
990
|
+
closedActionSchema,
|
|
991
|
+
notOfferedActionSchema,
|
|
992
|
+
z.object({ kind: z.literal("single_run") })
|
|
993
|
+
]));
|
|
994
|
+
/** An event's reschedule: a reason this build doesn't know decodes to `unsupported`, as every action's does. */
|
|
995
|
+
const portalRescheduleActionSchema = evolvingSchema()(z.union([knownRescheduleSchema, unsupported(RESCHEDULE_KINDS)]));
|
|
996
|
+
const MONEY_KINDS = allOf()([
|
|
997
|
+
"nothing_to_return",
|
|
998
|
+
"refund",
|
|
999
|
+
"credit_back",
|
|
1000
|
+
"keep_money",
|
|
1001
|
+
"keep_credit",
|
|
1002
|
+
"contact_business",
|
|
1003
|
+
"not_known"
|
|
1004
|
+
]);
|
|
1005
|
+
const cancelMoneySchema = exactSchema()(z.union([cancellationMoneyOutcomeSchema, z.object({ kind: z.literal("not_known") })]));
|
|
1006
|
+
const knownCancelSchema = exactSchema()(z.discriminatedUnion("kind", [
|
|
1007
|
+
z.object({
|
|
1008
|
+
kind: z.literal("available"),
|
|
1009
|
+
until: z.string().nullable(),
|
|
1010
|
+
money: cancelMoneySchema,
|
|
1011
|
+
recipient: refundRecipientSchema,
|
|
1012
|
+
termsApply: z.boolean()
|
|
1013
|
+
}),
|
|
1014
|
+
closedActionSchema,
|
|
1015
|
+
notOfferedActionSchema
|
|
1016
|
+
]));
|
|
1017
|
+
/** Open, but with money this build can't read: cancel is withheld rather than offered without its outcome. */
|
|
1018
|
+
const cancelWithUnknownMoney = z.object({
|
|
1019
|
+
kind: z.literal("available"),
|
|
1020
|
+
money: unknownKind(MONEY_KINDS)
|
|
1021
|
+
}).transform(() => ({ kind: "unsupported" }));
|
|
1022
|
+
const sharedActionsShape = {
|
|
1023
|
+
cancel: evolvingSchema()(z.union([
|
|
1024
|
+
knownCancelSchema,
|
|
1025
|
+
cancelWithUnknownMoney,
|
|
1026
|
+
unsupported(ACTION_KINDS)
|
|
1027
|
+
])),
|
|
1028
|
+
rebook: portalBookingActionSchema,
|
|
1029
|
+
editGuests: portalBookingActionSchema,
|
|
1030
|
+
showTicket: portalBookingActionSchema
|
|
1031
|
+
};
|
|
1032
|
+
const eventActionsSchema = evolvingSchema()(z.object({
|
|
1033
|
+
...sharedActionsShape,
|
|
1034
|
+
transfer: portalBookingActionSchema,
|
|
1035
|
+
reschedule: portalRescheduleActionSchema
|
|
1036
|
+
}));
|
|
1037
|
+
const courseActionsSchema = evolvingSchema()(z.object(sharedActionsShape));
|
|
1038
|
+
const appointmentActionsSchema = evolvingSchema()(z.object({
|
|
1039
|
+
...sharedActionsShape,
|
|
1040
|
+
reschedule: portalBookingActionSchema
|
|
1041
|
+
}));
|
|
1042
|
+
const baseShape = {
|
|
1043
|
+
title: z.string(),
|
|
1044
|
+
timing: z.enum(["upcoming", "over"]),
|
|
1045
|
+
where: whereSchema,
|
|
1046
|
+
standing: standingSchema,
|
|
1047
|
+
bookedAt: z.string().nullable(),
|
|
1048
|
+
people: peopleSchema,
|
|
1049
|
+
questions: portalBeforeYouComeTaskSchema.nullable(),
|
|
1050
|
+
payment: paymentSchema
|
|
1051
|
+
};
|
|
1052
|
+
const eventDetailSchema = exactSchema()(z.object({
|
|
1053
|
+
occurrenceId: z.string(),
|
|
1054
|
+
seriesName: z.string().nullable(),
|
|
1055
|
+
eventPath: z.string().nullable(),
|
|
1056
|
+
occurrencePath: z.string().nullable(),
|
|
1057
|
+
ticketLines: z.array(ticketLineSchema).readonly(),
|
|
1058
|
+
transfer: z.discriminatedUnion("kind", [
|
|
1059
|
+
z.object({ kind: z.literal("none") }),
|
|
1060
|
+
z.object({
|
|
1061
|
+
kind: z.literal("received"),
|
|
1062
|
+
from: z.string().nullable(),
|
|
1063
|
+
at: z.string().nullable()
|
|
1064
|
+
}),
|
|
1065
|
+
z.object({
|
|
1066
|
+
kind: z.literal("given"),
|
|
1067
|
+
to: z.string().nullable(),
|
|
1068
|
+
at: z.string().nullable()
|
|
1069
|
+
})
|
|
1070
|
+
]),
|
|
1071
|
+
rooms: z.array(z.object({
|
|
1072
|
+
name: z.string(),
|
|
1073
|
+
sleeps: z.number(),
|
|
1074
|
+
bookedAs: z.enum(["private", "shared"]),
|
|
1075
|
+
people: z.array(z.string()).readonly()
|
|
1076
|
+
})).readonly(),
|
|
1077
|
+
guestNamesRequired: z.boolean()
|
|
1078
|
+
}));
|
|
1079
|
+
const courseDetailSchema = exactSchema()(z.object({
|
|
1080
|
+
eventPath: z.string().nullable(),
|
|
1081
|
+
sessions: z.array(whenSchema).readonly(),
|
|
1082
|
+
nextSessionAt: z.string().nullable(),
|
|
1083
|
+
ticketLines: z.array(ticketLineSchema).readonly()
|
|
1084
|
+
}));
|
|
1085
|
+
const appointmentDetailSchema = exactSchema()(z.object({
|
|
1086
|
+
serviceName: z.string(),
|
|
1087
|
+
serviceId: z.string(),
|
|
1088
|
+
resourceId: z.string().nullable(),
|
|
1089
|
+
withName: z.string().nullable(),
|
|
1090
|
+
request: z.object({
|
|
1091
|
+
requestedAt: z.string().nullable(),
|
|
1092
|
+
decidedAt: z.string().nullable()
|
|
1093
|
+
}).nullable(),
|
|
1094
|
+
regularSession: z.object({
|
|
1095
|
+
cadence: portalRegularSessionCadenceSchema,
|
|
1096
|
+
localStart: z.string()
|
|
1097
|
+
}).nullable()
|
|
1098
|
+
}));
|
|
1099
|
+
const knownBookingSchema = evolvingSchema()(z.discriminatedUnion("kind", [
|
|
1100
|
+
z.object({
|
|
1101
|
+
kind: z.literal("event"),
|
|
1102
|
+
ref: eventAttendeeRefSchema,
|
|
1103
|
+
...baseShape,
|
|
1104
|
+
when: whenSchema,
|
|
1105
|
+
actions: eventActionsSchema,
|
|
1106
|
+
detail: eventDetailSchema
|
|
1107
|
+
}),
|
|
1108
|
+
z.object({
|
|
1109
|
+
kind: z.literal("course"),
|
|
1110
|
+
ref: courseRegistrationRefSchema,
|
|
1111
|
+
...baseShape,
|
|
1112
|
+
when: whenSchema.nullable(),
|
|
1113
|
+
actions: courseActionsSchema,
|
|
1114
|
+
detail: courseDetailSchema
|
|
1115
|
+
}),
|
|
1116
|
+
z.object({
|
|
1117
|
+
kind: z.literal("appointment"),
|
|
1118
|
+
ref: appointmentRefSchema,
|
|
1119
|
+
...baseShape,
|
|
1120
|
+
when: whenSchema,
|
|
1121
|
+
actions: appointmentActionsSchema,
|
|
1122
|
+
detail: appointmentDetailSchema
|
|
1123
|
+
})
|
|
1124
|
+
]));
|
|
1125
|
+
/** A newer kind's reference, read only far enough to key the card on it. */
|
|
1126
|
+
const unknownRefKey = z.record(z.string(), z.unknown()).catch({}).transform((ref) => Object.values(ref).filter((value) => typeof value === "string").join(":"));
|
|
1127
|
+
const unsupportedBookingSchema = unknownKind(PORTAL_BOOKING_KINDS).extend({
|
|
1128
|
+
title: z.string(),
|
|
1129
|
+
when: whenSchema.nullable().catch(null),
|
|
1130
|
+
ref: unknownRefKey
|
|
1131
|
+
}).transform((booking) => ({
|
|
1132
|
+
kind: "unsupported",
|
|
1133
|
+
key: `${booking.kind}:${booking.ref}`,
|
|
1134
|
+
title: booking.title,
|
|
1135
|
+
when: booking.when
|
|
1136
|
+
}));
|
|
1137
|
+
const portalBookingViewSchema = evolvingSchema()(z.union([knownBookingSchema, unsupportedBookingSchema]));
|
|
1138
|
+
evolvingSchema()(z.object({
|
|
1139
|
+
waitlist: z.array(customerPortalWaitlistEntrySchema).readonly(),
|
|
1140
|
+
comingUp: z.array(portalBookingViewSchema).readonly(),
|
|
1141
|
+
cancelled: z.array(portalBookingViewSchema).readonly(),
|
|
1142
|
+
past: z.array(portalBookingViewSchema).readonly(),
|
|
1143
|
+
nextPastCursor: z.string().nullable()
|
|
1144
|
+
}));
|
|
1145
|
+
evolvingSchema()(z.object({ booking: knownBookingSchema }));
|
|
1146
|
+
//#endregion
|
|
1147
|
+
//#region ../site-contracts/src/siteData/portalRoutes.ts
|
|
1148
|
+
/**
|
|
1149
|
+
* Pages the server renders on its own: Continue (before any session), tickets
|
|
1150
|
+
* and downloads. Every other page is the client portal's. The hosts' renderer
|
|
1151
|
+
* and the client's navigation both read this split, so neither can disagree
|
|
1152
|
+
* about who draws a page.
|
|
1153
|
+
*/
|
|
1154
|
+
const SERVER_PORTAL_PAGES = [
|
|
1155
|
+
"continue",
|
|
1156
|
+
"ticket",
|
|
1157
|
+
"download",
|
|
1158
|
+
"download_file"
|
|
1159
|
+
];
|
|
1160
|
+
function isServerPortalTarget(target) {
|
|
1161
|
+
return SERVER_PORTAL_PAGES.includes(target.page);
|
|
1162
|
+
}
|
|
1163
|
+
const CUSTOMER_PORTAL_PATH = "/portal";
|
|
1164
|
+
const NOT_FOUND = { page: "not_found" };
|
|
1165
|
+
const ARRIVAL_PARAMS = {
|
|
1166
|
+
signed_in: ["portal_login", "success"],
|
|
1167
|
+
order_paid: ["order", "success"],
|
|
1168
|
+
order_checkout_left: ["order", "cancelled"]
|
|
1169
|
+
};
|
|
1170
|
+
const ENTRY_REASON_PARAMS = {
|
|
1171
|
+
none: [],
|
|
1172
|
+
opened: [["entry", "1"]],
|
|
1173
|
+
stale: [["entry", "1"], ["stale", "1"]],
|
|
1174
|
+
link_sent: [["link", "sent"]],
|
|
1175
|
+
link_limited: [["link", "limited"]],
|
|
1176
|
+
demo_refused: [["link", "demo"]]
|
|
1177
|
+
};
|
|
1178
|
+
/** The query a page's own data puts in its address. */
|
|
1179
|
+
function targetParams(target) {
|
|
1180
|
+
return target.page === "continue" ? ENTRY_REASON_PARAMS[target.reason] : [];
|
|
1181
|
+
}
|
|
1182
|
+
function withQuery(path, params) {
|
|
1183
|
+
const query = new URLSearchParams(params.map(([name, value]) => [name, value])).toString();
|
|
1184
|
+
return query ? `${path}?${query}` : path;
|
|
1185
|
+
}
|
|
1186
|
+
function bookingPath(ref) {
|
|
1187
|
+
const { kind, bookingId } = portalBookingPath(ref);
|
|
1188
|
+
return `${CUSTOMER_PORTAL_PATH}/bookings/${kind}/${bookingId}`;
|
|
1189
|
+
}
|
|
1190
|
+
function targetPath(target) {
|
|
1191
|
+
const base = CUSTOMER_PORTAL_PATH;
|
|
1192
|
+
switch (target.page) {
|
|
1193
|
+
case "home": return base;
|
|
1194
|
+
case "bookings": return `${base}/bookings`;
|
|
1195
|
+
case "booking": return bookingPath(target.ref);
|
|
1196
|
+
case "booking_questions": return `${bookingPath(target.ref)}/questions`;
|
|
1197
|
+
case "booking_cancel": return `${bookingPath(target.ref)}/cancel`;
|
|
1198
|
+
case "booking_transfer": return `${bookingPath(target.ref)}/transfer`;
|
|
1199
|
+
case "booking_reschedule": return `${bookingPath(target.ref)}/reschedule`;
|
|
1200
|
+
case "ticket": return `${bookingPath(target.ref)}/ticket`;
|
|
1201
|
+
case "waitlist_offer": return `${base}/bookings/waitlist/${target.entryId}`;
|
|
1202
|
+
case "passes": return `${base}/passes`;
|
|
1203
|
+
case "payments": return `${base}/payments`;
|
|
1204
|
+
case "order": return `${base}/payments/orders/${target.orderId}`;
|
|
1205
|
+
case "receipt": return `${base}/payments/receipts/${target.receiptId}`;
|
|
1206
|
+
case "downloads": return `${base}/downloads`;
|
|
1207
|
+
case "download": return `${base}/downloads/${target.entitlementId}`;
|
|
1208
|
+
case "download_file": return `${base}/downloads/${target.entitlementId}/files/${target.assetId}`;
|
|
1209
|
+
case "details": return `${base}/details`;
|
|
1210
|
+
case "sign_in": return `${base}/sign-in`;
|
|
1211
|
+
case "continue": return `${base}/continue`;
|
|
1212
|
+
}
|
|
1213
|
+
}
|
|
1214
|
+
/** The site-relative path of a portal page, optionally carrying an arrival outcome. */
|
|
1215
|
+
function portalPath(target, options = {}) {
|
|
1216
|
+
const arrival = options.arrival ? [ARRIVAL_PARAMS[options.arrival]] : [];
|
|
1217
|
+
return withQuery(targetPath(target), [...targetParams(target), ...arrival]);
|
|
1218
|
+
}
|
|
1219
|
+
/**
|
|
1220
|
+
* A destination marked with an arrival outcome (the callback marks where sign-in
|
|
1221
|
+
* lands), keeping its own query: a checkout outcome already on it stays.
|
|
1222
|
+
*/
|
|
1223
|
+
function withPortalArrival(destination, arrival) {
|
|
1224
|
+
const marked = new URL(destination);
|
|
1225
|
+
const [name, value] = ARRIVAL_PARAMS[arrival];
|
|
1226
|
+
marked.searchParams.set(name, value);
|
|
1227
|
+
return marked;
|
|
1228
|
+
}
|
|
1229
|
+
/** Query parameters the portal reads and removes: the old link shapes and the arrival outcomes. */
|
|
1230
|
+
const CONSUMED_PARAMS = [
|
|
1231
|
+
"portal_tab",
|
|
1232
|
+
"portal_task",
|
|
1233
|
+
"portal_order",
|
|
1234
|
+
"portal_login",
|
|
1235
|
+
"order"
|
|
1236
|
+
];
|
|
1237
|
+
/** Continue's own query, which only Continue reads. */
|
|
1238
|
+
const ENTRY_PARAMS = [
|
|
1239
|
+
"entry",
|
|
1240
|
+
"stale",
|
|
1241
|
+
"link"
|
|
1242
|
+
];
|
|
1243
|
+
function parsePortalLocation(url) {
|
|
1244
|
+
const signedIn = cleanParam(url.searchParams, "portal_login") === "success";
|
|
1245
|
+
const checkout = parseCheckoutArrival(url.searchParams);
|
|
1246
|
+
const arrivals = [...signedIn ? ["signed_in"] : [], ...checkout ? [checkout] : []];
|
|
1247
|
+
const segments = portalSegments(url.pathname);
|
|
1248
|
+
if (segments === null) return {
|
|
1249
|
+
route: NOT_FOUND,
|
|
1250
|
+
arrivals,
|
|
1251
|
+
rewrite: null
|
|
1252
|
+
};
|
|
1253
|
+
const route = (segments.length === 0 ? legacyQueryRoute(url.searchParams, checkout) : null) ?? routeFromSegments(segments, url.searchParams);
|
|
1254
|
+
return {
|
|
1255
|
+
route,
|
|
1256
|
+
arrivals,
|
|
1257
|
+
rewrite: rewriteFor(url, route)
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
function parseCheckoutArrival(params) {
|
|
1261
|
+
const order = cleanParam(params, "order");
|
|
1262
|
+
return order === "success" ? "order_paid" : order === "cancelled" ? "order_checkout_left" : null;
|
|
1263
|
+
}
|
|
1264
|
+
function parseEntryReason(params) {
|
|
1265
|
+
const link = params.get("link");
|
|
1266
|
+
if (link === "sent") return "link_sent";
|
|
1267
|
+
if (link === "limited") return "link_limited";
|
|
1268
|
+
if (link === "demo") return "demo_refused";
|
|
1269
|
+
if (params.get("entry") !== "1") return "none";
|
|
1270
|
+
return params.get("stale") === "1" ? "stale" : "opened";
|
|
1271
|
+
}
|
|
1272
|
+
/** Whether a path is under the portal at all, whatever page it names. */
|
|
1273
|
+
function isPortalPathname(pathname) {
|
|
1274
|
+
return pathname === "/portal" || pathname.startsWith(`/portal/`);
|
|
1275
|
+
}
|
|
1276
|
+
/** The path below `/portal`, decoded; null when the path isn't the portal's. */
|
|
1277
|
+
function portalSegments(pathname) {
|
|
1278
|
+
if (!isPortalPathname(pathname)) return null;
|
|
1279
|
+
try {
|
|
1280
|
+
return pathname.slice(7).split("/").filter((part) => part !== "").map(decodeURIComponent);
|
|
1281
|
+
} catch {
|
|
1282
|
+
return null;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
function rewriteFor(url, route) {
|
|
1286
|
+
if (route.page === "not_found") return null;
|
|
1287
|
+
const kept = new URLSearchParams(url.searchParams);
|
|
1288
|
+
[...CONSUMED_PARAMS, ...route.page === "continue" ? ENTRY_PARAMS : []].forEach((name) => kept.delete(name));
|
|
1289
|
+
const canonical = withQuery(targetPath(route), [...targetParams(route), ...kept.entries()]);
|
|
1290
|
+
const visited = url.searchParams.toString();
|
|
1291
|
+
return canonical === `${url.pathname}${visited ? `?${visited}` : ""}` ? null : canonical;
|
|
1292
|
+
}
|
|
1293
|
+
function cleanParam(params, name) {
|
|
1294
|
+
const value = params.get(name)?.trim();
|
|
1295
|
+
return value ? value : null;
|
|
1296
|
+
}
|
|
1297
|
+
const only = (rest, route) => rest.length === 0 ? route : NOT_FOUND;
|
|
1298
|
+
function routeFromSegments(segments, params) {
|
|
1299
|
+
const [first, ...rest] = segments;
|
|
1300
|
+
switch (first) {
|
|
1301
|
+
case void 0: return { page: "home" };
|
|
1302
|
+
case "bookings": return bookingsRoute(rest);
|
|
1303
|
+
case "passes": return only(rest, { page: "passes" });
|
|
1304
|
+
case "payments": return paymentsRoute(rest);
|
|
1305
|
+
case "downloads":
|
|
1306
|
+
case "digital-products": return downloadsRoute(rest);
|
|
1307
|
+
case "tickets": return rest.length === 1 ? ticketRoute(parseBookingRef("event", rest[0])) : NOT_FOUND;
|
|
1308
|
+
case "details": return only(rest, { page: "details" });
|
|
1309
|
+
case "sign-in": return only(rest, { page: "sign_in" });
|
|
1310
|
+
case "continue": return only(rest, {
|
|
1311
|
+
page: "continue",
|
|
1312
|
+
reason: parseEntryReason(params)
|
|
1313
|
+
});
|
|
1314
|
+
default: return NOT_FOUND;
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
function parseBookingRef(kind, bookingId) {
|
|
1318
|
+
const parsed = portalBookingPathSchema.safeParse({
|
|
1319
|
+
kind,
|
|
1320
|
+
bookingId
|
|
1321
|
+
});
|
|
1322
|
+
return parsed.success ? parsed.data : null;
|
|
1323
|
+
}
|
|
1324
|
+
function ticketRoute(ref) {
|
|
1325
|
+
return ref?.tag === "event_attendee" ? {
|
|
1326
|
+
page: "ticket",
|
|
1327
|
+
ref
|
|
1328
|
+
} : NOT_FOUND;
|
|
1329
|
+
}
|
|
1330
|
+
function bookingsRoute(rest) {
|
|
1331
|
+
const [kind, id, action, ...extra] = rest;
|
|
1332
|
+
if (kind === void 0) return { page: "bookings" };
|
|
1333
|
+
if (kind === "waitlist") {
|
|
1334
|
+
const entryId = parseWaitlistEntryId(id);
|
|
1335
|
+
return entryId.ok && action === void 0 ? {
|
|
1336
|
+
page: "waitlist_offer",
|
|
1337
|
+
entryId: entryId.value
|
|
1338
|
+
} : NOT_FOUND;
|
|
1339
|
+
}
|
|
1340
|
+
const ref = parseBookingRef(kind, id);
|
|
1341
|
+
if (!ref || extra.length > 0) return NOT_FOUND;
|
|
1342
|
+
return bookingActionRoute(ref, action);
|
|
1343
|
+
}
|
|
1344
|
+
function bookingActionRoute(ref, action) {
|
|
1345
|
+
switch (action) {
|
|
1346
|
+
case void 0: return {
|
|
1347
|
+
page: "booking",
|
|
1348
|
+
ref
|
|
1349
|
+
};
|
|
1350
|
+
case "questions": return {
|
|
1351
|
+
page: "booking_questions",
|
|
1352
|
+
ref
|
|
1353
|
+
};
|
|
1354
|
+
case "cancel": return {
|
|
1355
|
+
page: "booking_cancel",
|
|
1356
|
+
ref
|
|
1357
|
+
};
|
|
1358
|
+
case "transfer": return ref.tag === "event_attendee" ? {
|
|
1359
|
+
page: "booking_transfer",
|
|
1360
|
+
ref
|
|
1361
|
+
} : NOT_FOUND;
|
|
1362
|
+
case "reschedule": return ref.tag === "event_series_registration" ? NOT_FOUND : {
|
|
1363
|
+
page: "booking_reschedule",
|
|
1364
|
+
ref
|
|
1365
|
+
};
|
|
1366
|
+
case "ticket": return ticketRoute(ref);
|
|
1367
|
+
default: return NOT_FOUND;
|
|
1368
|
+
}
|
|
1369
|
+
}
|
|
1370
|
+
function paymentsRoute(rest) {
|
|
1371
|
+
const [what, id, ...extra] = rest;
|
|
1372
|
+
if (what === void 0) return { page: "payments" };
|
|
1373
|
+
if (extra.length > 0) return NOT_FOUND;
|
|
1374
|
+
if (what === "orders") {
|
|
1375
|
+
const orderId = parseOrderId(id);
|
|
1376
|
+
return orderId.ok ? {
|
|
1377
|
+
page: "order",
|
|
1378
|
+
orderId: orderId.value
|
|
1379
|
+
} : NOT_FOUND;
|
|
1380
|
+
}
|
|
1381
|
+
if (what === "receipts") {
|
|
1382
|
+
const receiptId = parseOrderPaymentReceiptId(id);
|
|
1383
|
+
return receiptId.ok ? {
|
|
1384
|
+
page: "receipt",
|
|
1385
|
+
receiptId: receiptId.value
|
|
1386
|
+
} : NOT_FOUND;
|
|
1387
|
+
}
|
|
1388
|
+
return NOT_FOUND;
|
|
1389
|
+
}
|
|
1390
|
+
function downloadsRoute(rest) {
|
|
1391
|
+
const [id, files, asset, ...extra] = rest;
|
|
1392
|
+
if (id === void 0) return { page: "downloads" };
|
|
1393
|
+
const entitlementId = parseEntitlementId(id);
|
|
1394
|
+
if (!entitlementId.ok || extra.length > 0) return NOT_FOUND;
|
|
1395
|
+
if (files === void 0) return {
|
|
1396
|
+
page: "download",
|
|
1397
|
+
entitlementId: entitlementId.value
|
|
1398
|
+
};
|
|
1399
|
+
const assetId = parseMediaAssetId(asset);
|
|
1400
|
+
return files === "files" && assetId.ok ? {
|
|
1401
|
+
page: "download_file",
|
|
1402
|
+
entitlementId: entitlementId.value,
|
|
1403
|
+
assetId: assetId.value
|
|
1404
|
+
} : NOT_FOUND;
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* `/portal?…` as emails and pages wrote it before the portal had paths. A task
|
|
1408
|
+
* link wins, then an order, then a tab; a part that doesn't parse is ignored,
|
|
1409
|
+
* as the old portal ignored it. Coming back from paying lands on payments.
|
|
1410
|
+
*/
|
|
1411
|
+
function legacyQueryRoute(params, checkout) {
|
|
1412
|
+
return legacyTaskRoute(cleanParam(params, "portal_task")) ?? legacyOrderRoute(cleanParam(params, "portal_order")) ?? legacyTabRoute(cleanParam(params, "portal_tab")) ?? (checkout ? { page: "payments" } : null);
|
|
1413
|
+
}
|
|
1414
|
+
/** `portal_task` named the questions task of a booking, or a waitlist offer. */
|
|
1415
|
+
const LEGACY_TASK_KINDS = /* @__PURE__ */ new Map([
|
|
1416
|
+
["appointment", "appointment"],
|
|
1417
|
+
["event", "event"],
|
|
1418
|
+
["event_series_registration", "course"]
|
|
1419
|
+
]);
|
|
1420
|
+
function legacyTaskRoute(value) {
|
|
1421
|
+
const [kind, id, ...rest] = value?.split(":") ?? [];
|
|
1422
|
+
if (!kind || !id || rest.length > 0) return null;
|
|
1423
|
+
if (kind === "waitlist") {
|
|
1424
|
+
const entryId = parseWaitlistEntryId(id);
|
|
1425
|
+
return entryId.ok ? {
|
|
1426
|
+
page: "waitlist_offer",
|
|
1427
|
+
entryId: entryId.value
|
|
1428
|
+
} : null;
|
|
1429
|
+
}
|
|
1430
|
+
const bookingKind = LEGACY_TASK_KINDS.get(kind);
|
|
1431
|
+
const ref = bookingKind ? parseBookingRef(bookingKind, id) : null;
|
|
1432
|
+
return ref ? {
|
|
1433
|
+
page: "booking_questions",
|
|
1434
|
+
ref
|
|
1435
|
+
} : null;
|
|
1436
|
+
}
|
|
1437
|
+
function legacyOrderRoute(value) {
|
|
1438
|
+
if (value === null) return null;
|
|
1439
|
+
const orderId = parseOrderId(value);
|
|
1440
|
+
return orderId.ok ? {
|
|
1441
|
+
page: "order",
|
|
1442
|
+
orderId: orderId.value
|
|
1443
|
+
} : { page: "payments" };
|
|
1444
|
+
}
|
|
1445
|
+
const LEGACY_TABS = /* @__PURE__ */ new Map([
|
|
1446
|
+
["events", { page: "bookings" }],
|
|
1447
|
+
["appointments", { page: "bookings" }],
|
|
1448
|
+
["orders", { page: "payments" }],
|
|
1449
|
+
["digital-products", { page: "downloads" }],
|
|
1450
|
+
["passes-memberships", { page: "passes" }],
|
|
1451
|
+
["credit", { page: "passes" }],
|
|
1452
|
+
["profile", { page: "details" }]
|
|
1453
|
+
]);
|
|
1454
|
+
function legacyTabRoute(value) {
|
|
1455
|
+
return value === null ? null : LEGACY_TABS.get(value) ?? null;
|
|
1456
|
+
}
|
|
1457
|
+
//#endregion
|
|
1458
|
+
//#region src/portal/constants.ts
|
|
1459
|
+
/**
|
|
1460
|
+
* Portal Authentication Constants
|
|
1461
|
+
*/
|
|
1462
|
+
/** Cookie name for storing the portal session token */
|
|
1463
|
+
const PORTAL_TOKEN_COOKIE = "portal_token";
|
|
1464
|
+
/** Cookie max age in seconds (30 days) */
|
|
1465
|
+
const PORTAL_COOKIE_MAX_AGE = 720 * 60 * 60;
|
|
1466
|
+
/** Query parameter carrying an emailed sign-in token to the callback. GET stores it and consumes nothing. */
|
|
1467
|
+
const PORTAL_ENTRY_PARAM = "portal_entry";
|
|
1468
|
+
/** Short-lived private cookie holding the token and its destination, so neither is in the page's URL */
|
|
1469
|
+
const PORTAL_ENTRY_COOKIE = "rb_portal_entry";
|
|
1470
|
+
/**
|
|
1471
|
+
* Entry cookie max age in seconds (one day). People often open the email, get distracted and press
|
|
1472
|
+
* Continue later. The token already sits in their inbox for 30 days, so a day in a private cookie
|
|
1473
|
+
* on the same device adds little.
|
|
1474
|
+
*/
|
|
1475
|
+
const PORTAL_ENTRY_COOKIE_MAX_AGE = 1440 * 60;
|
|
1476
|
+
/** The fixed callback address on every site */
|
|
1477
|
+
const PORTAL_CALLBACK_PATH = "/api/portal/callback";
|
|
1478
|
+
/** Query/form parameter name for redirect destination */
|
|
1479
|
+
const REDIRECT_TO_PARAM = "redirect_to";
|
|
1480
|
+
/** Default redirect path for callback */
|
|
1481
|
+
const DEFAULT_PORTAL_REDIRECT = CUSTOMER_PORTAL_PATH;
|
|
1482
|
+
/** Default redirect path for logout */
|
|
1483
|
+
const DEFAULT_LOGOUT_REDIRECT = "/";
|
|
1484
|
+
//#endregion
|
|
1485
|
+
export { PORTAL_ENTRY_COOKIE as a, PORTAL_TOKEN_COOKIE as c, isServerPortalTarget as d, parsePortalLocation as f, PORTAL_COOKIE_MAX_AGE as i, REDIRECT_TO_PARAM as l, withPortalArrival as m, DEFAULT_PORTAL_REDIRECT as n, PORTAL_ENTRY_COOKIE_MAX_AGE as o, portalPath as p, PORTAL_CALLBACK_PATH as r, PORTAL_ENTRY_PARAM as s, DEFAULT_LOGOUT_REDIRECT as t, CUSTOMER_PORTAL_PATH as u };
|