@riverbankcms/sdk 0.183.0 → 0.185.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 +34 -1
- package/dist/_dts/{BlocksIslandsHydrator-X1_G96iN.d.ts → BlocksIslandsHydrator-Bu0O7l4p.d.ts} +1 -1
- package/dist/_dts/{Page-CEqZJZEE.d.ts → Page-DYoL0IWL.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-DQejfbXL.d.ts → SdkPreviewMode-DgFAiR8r.d.ts} +2 -2
- package/dist/_dts/{client-B_B_amKD.d.ts → client-BKdjJ7A0.d.ts} +35 -4
- package/dist/_dts/{content-types-Dhx5Ocvx.d.ts → content-types-6K7zlJuF.d.ts} +2 -2
- package/dist/_dts/{contracts-FeOnfoa1.d.ts → contracts-CUR8ccnX.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-m70J6tit.d.ts → generatePageMetadata-CveWSMew.d.ts} +2 -2
- package/dist/_dts/{index-CjAkEWAp.d.ts → index-6WypKfbu.d.ts} +4 -4
- package/dist/_dts/{index-iuFrbIjt.d.ts → index-BMwrFX_K.d.ts} +1 -1
- package/dist/_dts/{index-BxCmCit0.d.ts → index-Bp5lk6I8.d.ts} +1 -1
- package/dist/_dts/{index-BOpUh8kO.d.ts → index-DTKn1H8g.d.ts} +3 -3
- package/dist/_dts/{index-Bizdaxji.d.ts → index-DX-Xe54X.d.ts} +2 -2
- package/dist/_dts/{index-liuhlOX7.d.ts → index-SD1fTP_7.d.ts} +2 -2
- package/dist/_dts/{loadContent-D4wrTIIw.d.ts → loadContent-BN8GtRsL.d.ts} +7 -7
- package/dist/_dts/{request-Gn0O1blj.d.ts → request-BwYvMqLf.d.ts} +78461 -77905
- package/dist/_dts/{resolveBlockData-D5duwuqS.d.ts → resolveBlockData-CYy0VlSK.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-xzJ3c9Na.d.ts → resolvePageContent-BwUDLi_W.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 -1
- package/dist/_dts/sdk/src/index.d.ts +7 -7
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- package/dist/_dts/sdk/src/portal/index.d.ts +10 -2
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +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 +36 -1
- package/dist/_dts/{serviceBookingOutline-B1gyJon_.d.ts → serviceBookingOutline-CMNev0gz.d.ts} +19 -8
- package/dist/_dts/{types-DBNuMtSk.d.ts → types-BBazdRQf.d.ts} +9 -10
- package/dist/_dts/{types-DHMcuoeQ.d.ts → types-BwngWRQ8.d.ts} +13 -15
- package/dist/_dts/{types-BoITy0rA.d.ts → types-C9_amrul.d.ts} +6 -2
- package/dist/_dts/{validation-BIPO-XlE.d.ts → validation-B58kUTuV.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-Ct8slgRk.mjs → BlocksIslandsHydrator-CooOPhs3.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-qqTxGGS4.mjs → BookingMailingListNote-D_khdttF.mjs} +61 -62
- package/dist/client/{BookingQuestionFields-DCh9MUIF.mjs → BookingQuestionFields-Bia1E7Cj.mjs} +49 -36
- package/dist/client/{CalendarAction-RcdaStG7.mjs → CalendarAction-C-AbMmct.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-D7Wt-Oaa.mjs → CalendarNavigationChevron-oaHxRbUO.mjs} +7 -7
- package/dist/client/{CheckboxChoice-BdGxZWeg.mjs → CheckboxChoice-CTMIII37.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-HFVkoOac.mjs → DemoBookingPortalAccess-M2xKYQjX.mjs} +7 -5
- package/dist/client/{EventCalendar.client-BtkJW8bA.mjs → EventCalendar.client-By7e9nyF.mjs} +11 -11
- package/dist/client/{EventCombined.client-DxaGjFFS.mjs → EventCombined.client-BdRZXB14.mjs} +10 -10
- package/dist/client/EventEmbeddedCheckoutStep-CJoxbx2Y.mjs +147 -0
- package/dist/client/{EventItem-Fr2qi2C2.mjs → EventItem-CDMa9zOX.mjs} +5 -5
- package/dist/client/{EventListWeekNavigation-BRMaq0ky.mjs → EventListWeekNavigation-B8WKaCrN.mjs} +1 -1
- package/dist/client/{EventListing.client-BhGxfbjt.mjs → EventListing.client-BEGiiFnO.mjs} +3 -3
- package/dist/client/{EventListing.view-COuEJzbO.mjs → EventListing.view-B6LOK-z4.mjs} +84 -7
- package/dist/client/{EventRegistrationPayment-BTLYhVxD.mjs → EventRegistrationPayment-CARdr15t.mjs} +140 -68
- package/dist/client/{Page-CgbQZP5g.mjs → Page-uP7AKSyp.mjs} +1762 -521
- package/dist/client/{ProtectedSubmitButton-BG7my0Qf.mjs → ProtectedSubmitButton-CY6u5sQa.mjs} +1 -1
- package/dist/client/SiteChoiceGroup-BZ5I0Vhy.mjs +96 -0
- package/dist/client/{SiteTermsAgreementField-DQNkfNLA.mjs → SiteTermsAgreementField-BDqRo2C5.mjs} +3 -3
- package/dist/client/{StepIndicator-DvPekKeM.mjs → StepIndicator-BWrXAKvs.mjs} +1 -1
- package/dist/client/{StepIndicator-DyXoI3ob.mjs → StepIndicator-Cb3NMw-Y.mjs} +30 -18
- package/dist/client/{ThemedButton-Bc9DBbVp.mjs → ThemedButton-C4rCsPCt.mjs} +11 -2
- package/dist/client/{accessibleSurfaces-wj4Rloo5.mjs → accessibleSurfaces-q-dDOwsW.mjs} +750 -560
- package/dist/client/{accordion-BVXfjnh-.mjs → accordion-BYW2YSUN.mjs} +1 -1
- package/dist/client/{booking-form.client-DycPGtke.mjs → booking-form.client-DAlWWWjV.mjs} +110 -72
- package/dist/client/{bookingCalendar--aWnqFDn.mjs → bookingCalendar-9nFa_do4.mjs} +6 -2
- package/dist/client/{bookingForm-DrWSUqL3.mjs → bookingForm-DtVk9p5l.mjs} +7 -6
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-CduDRcIk.mjs → boxStyleClassNames-CaSq3-r-.mjs} +2 -2
- package/dist/client/{EventEmbeddedCheckoutStep-B2c5dR49.mjs → browserStripe-Dh-LcDoW.mjs} +36 -142
- package/dist/client/{buttonParts-CJEtVOUy.mjs → buttonParts-C39GC0kz.mjs} +9 -2
- package/dist/client/{carousel-DyCLMP8s.mjs → carousel-msur7fxW.mjs} +2 -2
- package/dist/client/{carousel.client-DffP_Nv0.mjs → carousel.client-DKWqVHHh.mjs} +1 -1
- package/dist/client/{cart-BuEp_cj4.mjs → cart-Bx-JuY2n.mjs} +3 -3
- package/dist/client/{cart.client-CAO39uDG.mjs → cart.client-hB_9MimN.mjs} +1 -1
- package/dist/client/{checkout-BoxzT64s.mjs → checkout-BVWZn5Qu.mjs} +3 -3
- package/dist/client/{checkout.client-IGUy7XOx.mjs → checkout.client-Bt_GtHW9.mjs} +1 -1
- package/dist/client/{checkoutUrls-D0UsiFmm.mjs → checkoutUrls-CP-rQOZV.mjs} +1 -1
- package/dist/client/client.mjs +61 -48
- package/dist/client/{constants-C_8AxMdm.mjs → constants-yA1RJGXD.mjs} +1 -1
- package/dist/client/{context-D1L0pe__.mjs → context-CG77Keax.mjs} +43 -6
- package/dist/client/{dateFormatting-HvfmS_cH.mjs → dateFormatting-DIRIgfYr.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-BunFTnIq.mjs → demoPortalMagicLink-CgzNiOQ0.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-CtLAG651.mjs → enhanceHeaderSection-DgzZNM2M.mjs} +4 -4
- package/dist/client/{event-registration.client-DiSxkBUP.mjs → event-registration.client-Ckb4aDE9.mjs} +118 -74
- package/dist/client/{eventCalendar-DUnhwZ1o.mjs → eventCalendar-lqqQSzBQ.mjs} +4 -4
- package/dist/client/{eventCombined-BvBQo0nF.mjs → eventCombined-BIMyHrd-.mjs} +4 -4
- package/dist/client/{eventListing-aTLifOX7.mjs → eventListing-CBYxfvNf.mjs} +4 -4
- package/dist/client/{eventRegistration-DFd7pr09.mjs → eventRegistration-BhAqvkCb.mjs} +7 -6
- package/dist/client/{form-Dikmc2AO.mjs → form-CkOfk-Eb.mjs} +3 -3
- package/dist/client/{form.client-zHaQK5I9.mjs → form.client-Whi43oio.mjs} +5 -5
- package/dist/client/{form.parts-BLl9n8TH.mjs → form.parts-BgsWo2Me.mjs} +3 -3
- package/dist/client/gifting/client.mjs +8 -8
- package/dist/client/{gifting-CufPM38H.mjs → gifting-XtNpLcFI.mjs} +4 -4
- package/dist/client/{gifting.client--N1GaSY8.mjs → gifting.client-CraWj4I4.mjs} +174 -73
- package/dist/client/{gifting.interactive-D9MK4HkV.mjs → gifting.interactive-DiPDObN0.mjs} +61 -10
- package/dist/client/{gifting.parts-CRtiRzo-.mjs → gifting.parts-_mgGOcbA.mjs} +17 -43
- package/dist/client/{headerSection-BIaBpmk3.mjs → headerSection-CPIN3VSU.mjs} +2 -2
- package/dist/client/{islands-DJDLGQEm.mjs → islands-C95FyxUF.mjs} +1996 -1178
- package/dist/client/{newsletter-form.client-wg_JHTxm.mjs → newsletter-form.client-BgVJdKVe.mjs} +7 -7
- package/dist/client/{newsletter-form.interactive-hzpkW9NQ.mjs → newsletter-form.interactive-DpcfRbI_.mjs} +39 -18
- package/dist/client/{newsletter-form.parts-CgzpSv9p.mjs → newsletter-form.parts-poPgHrUh.mjs} +2 -2
- package/dist/client/{newsletterForm-CvxLiEBT.mjs → newsletterForm-Dt6wFjTe.mjs} +3 -3
- package/dist/client/portal/client.mjs +999 -81
- package/dist/client/{portalOrders-tCxS04g0.mjs → portalOrders-CAfjTyV9.mjs} +1 -1
- package/dist/client/{portalRoutes-DTHlWg_F.mjs → portalRoutes-D3Ttfv5x.mjs} +54 -12
- package/dist/client/portalSession-0XhXyTxT.mjs +41 -0
- package/dist/client/presentation-CudSUZ6Q.mjs +169 -0
- package/dist/client/{product-detail.client-22Q7zgjN.mjs → product-detail.client-BrBNT7Mq.mjs} +1 -1
- package/dist/client/{product-list.client-DFWYvK8z.mjs → product-list.client-CftTl7n6.mjs} +1 -1
- package/dist/client/{productDetail-DhZAwo60.mjs → productDetail-b1tpt585.mjs} +3 -3
- package/dist/client/{productList-BiVpbZK2.mjs → productList-DRT5sabi.mjs} +3 -3
- package/dist/client/{propsDecoder-DFYqKnLy.mjs → propsDecoder-Co1VXFaW.mjs} +4 -4
- package/dist/client/{registry.server-C3OBRg7x.mjs → registry.server-0UDNY7dO.mjs} +796 -715
- package/dist/client/rendering/client.mjs +28 -27
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-ms477Z08.mjs → richText-coerce-BFDEPZZA.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-B6nQeqvH.mjs → routeIslandApiConfig-DtqRutuX.mjs} +1 -1
- package/dist/client/{runtimeResponse-BYqsV1Kb.mjs → runtimeResponse-DBVXbcuz.mjs} +1 -1
- package/dist/client/runtimeResponse-LQnQdtNI.mjs +3 -0
- package/dist/client/{shop-xt4dQ3HH.mjs → shop-DL3CYR7i.mjs} +3 -3
- package/dist/client/{shop-commerce-DVsIcPaI.mjs → shop-commerce-CDth2_qq.mjs} +45 -27
- package/dist/client/{shop-commerce-store-7mO6KY7_.mjs → shop-commerce-store-CE0aaSHJ.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-L1Vge8tG.mjs → shop-discount-apply.state-p4aXtVsF.mjs} +2 -2
- package/dist/client/{shop.client-DNJfD3VQ.mjs → shop.client-BI2iw6Z3.mjs} +83 -29
- package/dist/client/{shopShared-DS8t6749.mjs → shopShared-BNWzgWAC.mjs} +2 -2
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/{src-Do_s2lqH.mjs → src-CJf3u16T.mjs} +1 -1
- package/dist/{preview-next/client/src-lX6heoDA.mjs → client/src-CMuv8vSO.mjs} +5 -1
- package/dist/client/src-CXOxpNtj.mjs +3 -0
- package/dist/client/{timetableModel-Dy3nNfTG.mjs → timetableModel-DZzGD6rS.mjs} +9 -9
- package/dist/client/{urlParams-C2QHo1Pa.mjs → useAutomaticDiscountPreview-CJDylOUe.mjs} +44 -1
- package/dist/client/{useAvailableSlots-DcjtDpUu.mjs → useAvailableSlots-nD6nuvSW.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-DvdFFWOT.mjs → useDiscountCodeUi-DMtTHqex.mjs} +6 -2
- package/dist/client/{useEventPagination-Cq-7sU5_.mjs → useEventPagination-CM-DCokc.mjs} +14 -16
- package/dist/client/{view-4gnPcpWJ.mjs → view-CHOhliHv.mjs} +4 -4
- package/dist/client/{wizardSteps-DDvL3iza.mjs → wizardSteps-BbroaNkT.mjs} +277 -87
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CLqSRUpt.mjs → EventEmbeddedCheckoutStep-CVy9oapv.mjs} +1 -1
- package/dist/preview-next/client/{LocationPickerEnvironment-CIdAg-Tm.mjs → LocationPickerEnvironment-DuRUwUrK.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Bm85jX35.mjs → MapLibreEditMap-CdSDYBq9.mjs} +2 -2
- package/dist/preview-next/client/{PageSectionToolbar-D8srnz9R.mjs → PageSectionToolbar-CR99z8BL.mjs} +582 -195
- package/dist/preview-next/client/{PreviewEditorSidebar-DVpk5cqp.mjs → PreviewEditorSidebar-BaKS6H8F.mjs} +1096 -283
- package/dist/preview-next/client/{PreviewEditorUI-XoTtHSFH.mjs → PreviewEditorUI-D6IG119o.mjs} +65 -16
- package/dist/preview-next/client/{PreviewShell-VQHsRg2u.mjs → PreviewShell-CKjkFOZS.mjs} +39 -12
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CLdF9f6o.mjs → SdkPreviewModeRuntime-BexDQWGj.mjs} +128 -27
- package/dist/preview-next/client/{ThemedButton-ORNN4x-3.mjs → ThemedButton-CRgbU75r.mjs} +18 -2
- package/dist/preview-next/client/{lucide-react-eAi3tDAr.mjs → lucide-react-B4c6U3ZU.mjs} +1 -1
- package/dist/preview-next/client/{previewAssistantSlot-CqH91EwA.mjs → previewAssistantSlot-DcEwU9l_.mjs} +7192 -3039
- package/dist/preview-next/client/{previewChromeRoot-B3ySEu6p.mjs → previewChromeRoot-VqseF0yf.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CdpSupcr.mjs → sdk-runtime-DcoVpKUf.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-C6eOP6QW.mjs → siteStyleAccess-BL1fZnUD.mjs} +16 -10
- package/dist/{client/src-uwCpbHXG.mjs → preview-next/client/src-B5x3r4cg.mjs} +5 -1
- package/dist/preview-next/client/src-CrT7h--V.mjs +3 -0
- package/dist/preview-next/client/{useAutosaveStatus-BhPg4e-r.mjs → useAutosaveStatus-CdFnzKac.mjs} +3 -3
- package/dist/preview-next/client/{useOpenBlockForSetup-BaWUF9D7.mjs → useOpenBlockForSetup-B62h7dhR.mjs} +4 -3
- package/dist/preview-next/container-responsive.css +158 -3
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-Ch0X99vE.mjs → route-contract-CQfEvfbg.mjs} +54 -41
- package/dist/server/{Block.shared-B2FmczLO.mjs → Block.shared-CbGnxkWX.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-DtAyv9qA.mjs → ThemeScopeCore-BjxlpVaV.mjs} +34 -8
- package/dist/server/{accessibleSurfaces-BtPqb76u.mjs → accessibleSurfaces-CZ7pLuJ7.mjs} +317 -148
- package/dist/server/{accordions-vzdZ2Wt1.mjs → accordions-C_C52VkS.mjs} +1 -1
- package/dist/server/{bindings-B_9JuU66.mjs → bindings-D-n66Oqc.mjs} +68 -247
- package/dist/server/{client-DC7cjiSw.mjs → client-BGGlrkft.mjs} +64 -47
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-d6nPNJpe.mjs → constants-TkO9Uxma.mjs} +51 -9
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-hb27HYic.mjs → loadContent-8H1hHdXo.mjs} +4 -4
- package/dist/server/{loadPage-JToD8wDD.mjs → loadPage-BZyqF_g3.mjs} +3 -3
- package/dist/server/lookMediaFrame-Dw6R9B0L.mjs +31837 -0
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-B2WhGofA.mjs → navigation-9TOyY5Zf.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-vD5KTClL.mjs → overrideResolution-CuduOS6V.mjs} +1 -1
- package/dist/server/page-converter.mjs +17 -4
- package/dist/server/{pageRenderPlan-CdqJ1NQZ.mjs → pageRenderPlan-DmP0HVMu.mjs} +618 -209
- package/dist/server/{pageRuntimeSupport-CAhr4oOf.mjs → pageRuntimeSupport-BQ1dWs1V.mjs} +12 -5
- package/dist/server/{pageShared-m80Xu2pd.mjs → pageShared-ALu7y5Dq.mjs} +836 -516
- package/dist/server/{parseThemeForPersistence-CRwOZfpa.mjs → parseThemeForPersistence-D_8I28BB.mjs} +3 -3
- package/dist/server/{portal-B2wCQno_.mjs → portal-P4oHSRho.mjs} +23 -2
- package/dist/server/portal.mjs +3 -3
- package/dist/server/{prebuild-BWIkFaXq.mjs → prebuild-BLL6RhjS.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-D1PHU-K9.mjs → prefetchBlockData-aR5W1dVF.mjs} +3 -3
- package/dist/server/{registry-KtsOsAzY.mjs → registry-DD_s7l3Y.mjs} +1575 -28658
- 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 +9 -9
- package/dist/server/{resolveBlockData-sjIDJYl7.mjs → resolveBlockData-DnQ2N0lI.mjs} +2 -2
- package/dist/server/{expandPalette-DxPrNOAB.mjs → resolveButtonColourStates-ChlP4NJ9.mjs} +1662 -1430
- package/dist/server/{responseMedia-IfH65QAH.mjs → responseMedia-D6F1tvIm.mjs} +1 -1
- package/dist/server/{schema-BBEqquBM.mjs → schema-ClDfFtz2.mjs} +261 -6
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-ChEZDRwU.mjs → servicePageContent-CsUerbJ1.mjs} +15 -12
- package/dist/server/theme-bridge.mjs +5 -4
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-DKCIBeb1.mjs → three-pass-converter-CLJrZb7s.mjs} +1 -1
- package/dist/server/{titleSourceSchema-DybHErxH.mjs → titleSourceSchema-DA_iErtG.mjs} +2 -3
- package/dist/server/{types-vyz09w64.mjs → types-CcKy8_tj.mjs} +14 -5
- package/dist/server/{validation-Cvi-1TZZ.mjs → validation-BbImAsVs.mjs} +5 -5
- package/dist/server/{version-B-icAIV1.mjs → version-BY48jPoe.mjs} +1 -1
- package/dist/styles/index.css +684 -181
- package/package.json +1 -1
- package/dist/client/appointment-service-categories-Cl2pqw-z.mjs +0 -70
- package/dist/client/runtimeResponse-CUX_lldL.mjs +0 -3
- package/dist/client/src-DqMbCjI1.mjs +0 -3
- package/dist/preview-next/client/src-EO5QoRlU.mjs +0 -3
- package/dist/server/customCss-rtIfEYwQ.mjs +0 -230
- package/dist/server/lookMediaFrame-CTsycLLK.mjs +0 -2756
- package/dist/server/media-gvfIw3z8.mjs +0 -216
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
+
import { i as rememberInvoiceReturn, n as invoiceStripeReturnUrl, r as loadBrowserStripe, t as clearInvoiceReturn } from "../browserStripe-Dh-LcDoW.mjs";
|
|
3
4
|
import { m as ok, p as err } from "../renderableMediaAssetAdmission-BsOWd9lf.mjs";
|
|
4
|
-
import { An as formatCurrencyAmount, Fn as unsafeAsAppointmentResourceId, On as parsePositiveMoneyInputToCents, Sn as parseUtcIsoDateTimeString, _t as unknownKind, an as formatDateTimeRange, bn as parseBookingLocalDate, cn as formatTime, gt as exactSchema, ht as evolvingSchema, in as formatDateTime, ln as formatTimeRange, nn as formatDate, rn as formatDateRange, t as assertNever, vt as unknownTag } from "../src-
|
|
5
|
-
import { a as withPortalArrival, c as portalBookingViewSchema, d as portalWaitlistOfferPriceSchema,
|
|
6
|
-
import { a as calendarEntryEnd, h as assertNever$1, i as bookingCalendarFromEntries, l as getInitialFieldValue, m as unansweredRequiredBookingQuestions, n as ONLINE_CALENDAR_LOCATION, o as UNANSWERED_QUESTION_MESSAGE, t as ONLINE_CALENDAR_DESCRIPTION, u as initialBookingQuestionValues } from "../bookingCalendar
|
|
5
|
+
import { An as formatCurrencyAmount, Fn as unsafeAsAppointmentResourceId, On as parsePositiveMoneyInputToCents, Sn as parseUtcIsoDateTimeString, _t as unknownKind, an as formatDateTimeRange, bn as parseBookingLocalDate, cn as formatTime, gt as exactSchema, ht as evolvingSchema, in as formatDateTime, ln as formatTimeRange, nn as formatDate, rn as formatDateRange, t as assertNever, vt as unknownTag } from "../src-CJf3u16T.mjs";
|
|
6
|
+
import { a as withPortalArrival, c as portalBookingViewSchema, d as portalWaitlistOfferPriceSchema, f as parseCustomerMembershipId, g as parseOrderPaymentReceiptId, h as parseOrderId, i as portalPath, l as portalBookingsResponseSchema, n as isServerPortalTarget, o as portalBookingPath, r as parsePortalLocation, s as portalBookingResponseSchema, u as portalRegularSessionsResponseSchema } from "../portalRoutes-D3Ttfv5x.mjs";
|
|
7
|
+
import { a as calendarEntryEnd, h as assertNever$1, i as bookingCalendarFromEntries, l as getInitialFieldValue, m as unansweredRequiredBookingQuestions, n as ONLINE_CALENDAR_LOCATION, o as UNANSWERED_QUESTION_MESSAGE, t as ONLINE_CALENDAR_DESCRIPTION, u as initialBookingQuestionValues } from "../bookingCalendar-9nFa_do4.mjs";
|
|
7
8
|
import { t as generateUuidV4 } from "../uuid-BETKW8rS.mjs";
|
|
8
|
-
import { a as
|
|
9
|
-
import { C as customerProfileSchema, _ as portalPaymentToDoSchema, f as portalDeadlineSchema, g as portalPaymentDueSchema, h as portalOrderNameSchema, i as bookingContextRefSchema, l as eventAttendeeRefSchema, m as portalOrderBreakdownSchema, n as customerOrderSchema, p as portalMoneySchema, x as customerPassUseCaseSchema } from "../portalOrders-
|
|
10
|
-
import { C as portalMeUpdateResponseSchema,
|
|
11
|
-
import { a as ThemedFileChooser, n as ThemedButton, r as ThemedButtonLink
|
|
9
|
+
import { a as QuestionFieldset, c as clientPersonPhrases, o as isFieldsetQuestion, s as questionControlProps, t as BookingQuestionFieldInput } from "../BookingQuestionFields-Bia1E7Cj.mjs";
|
|
10
|
+
import { C as customerProfileSchema, _ as portalPaymentToDoSchema, f as portalDeadlineSchema, g as portalPaymentDueSchema, h as portalOrderNameSchema, i as bookingContextRefSchema, l as eventAttendeeRefSchema, m as portalOrderBreakdownSchema, n as customerOrderSchema, p as portalMoneySchema, x as customerPassUseCaseSchema } from "../portalOrders-CAfjTyV9.mjs";
|
|
11
|
+
import { C as portalMeUpdateResponseSchema, D as portalTransferEventRegistrationResultSchema, E as portalRescheduleAppointmentResponseSchema, S as portalMeResponseSchema, T as portalOrderCheckoutResponseSchema, _ as portalDigitalProductsResponseSchema, a as createPortalTransport, b as portalEventRescheduleResultSchema, c as PORTAL, d as portalBookingQuestionsTaskResponseSchema, f as portalBookingQuestionsUploadUrlResponseSchema, g as portalDigitalProductDownloadUrlResponseSchema, h as portalDigitalProductAccessResponseSchema, l as magicLinkResponseSchema, m as portalCancelOutcomeSchema, n as useBlockApi, o as field, p as portalCancelMembershipAtPeriodEndResultSchema, s as isUncertainPortalFailure, t as BlockApiProvider, u as portalBookingQuestionsFinalizeUploadResponseSchema, v as portalEventGuestsResponseSchema, w as portalMembershipPaymentSchema, x as portalEventTicketResponseSchema, y as portalEventRescheduleDatesSchema } from "../context-CG77Keax.mjs";
|
|
12
|
+
import { O as clsx, a as ThemedFileChooser, n as ThemedButton, r as ThemedButtonLink } from "../ThemedButton-C4rCsPCt.mjs";
|
|
13
|
+
import { r as customerBookingCalendarUid } from "../src-CMuv8vSO.mjs";
|
|
12
14
|
import { n as assertSafeAppPath } from "../src-Al4ooTl_.mjs";
|
|
13
15
|
import { t as resolveDedicatedBookingHref } from "../bookingRoute-D6DlxYx6.mjs";
|
|
14
16
|
import { t as FieldValidationMessage } from "../FieldValidationMessage-CsqxShw4.mjs";
|
|
15
|
-
import { n as useAvailableDates, t as useAvailableSlots } from "../useAvailableSlots-
|
|
16
|
-
import { i as getDemoBookingPass, n as buildPortalCallbackUrl, t as PORTAL_CALLBACK_PATH } from "../demoPortalMagicLink-
|
|
17
|
-
import { n as downloadCalendar } from "../CalendarAction-
|
|
18
|
-
import { a as formatPortalSessionTime, c as portalSessionDisplay, i as formatPortalSessionDay, o as formatPortalSessionWithWeekday, r as formatPortalSession, s as lastCoveredInstant, t as formatDateTime$1 } from "../dateFormatting-
|
|
17
|
+
import { n as useAvailableDates, t as useAvailableSlots } from "../useAvailableSlots-nD6nuvSW.mjs";
|
|
18
|
+
import { i as getDemoBookingPass, n as buildPortalCallbackUrl, t as PORTAL_CALLBACK_PATH } from "../demoPortalMagicLink-CgzNiOQ0.mjs";
|
|
19
|
+
import { n as downloadCalendar } from "../CalendarAction-C-AbMmct.mjs";
|
|
20
|
+
import { a as formatPortalSessionTime, c as portalSessionDisplay, i as formatPortalSessionDay, o as formatPortalSessionWithWeekday, r as formatPortalSession, s as lastCoveredInstant, t as formatDateTime$1 } from "../dateFormatting-DIRIgfYr.mjs";
|
|
19
21
|
import * as React$1 from "react";
|
|
20
22
|
import { forwardRef, useCallback, useEffect, useId, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
21
23
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -208,6 +210,54 @@ const OFFLINE_PAYMENT_METHODS = [
|
|
|
208
210
|
"other"
|
|
209
211
|
];
|
|
210
212
|
//#endregion
|
|
213
|
+
//#region ../commerce/src/purchase/invoicePaymentState.ts
|
|
214
|
+
const PAYMENT_NOT_TAKEN = "That payment didn't go through. Please try again.";
|
|
215
|
+
const WAITING_FOR_BANK = "Waiting for your bank…";
|
|
216
|
+
function needsReadback(status) {
|
|
217
|
+
return status === "succeeded" || status === "processing";
|
|
218
|
+
}
|
|
219
|
+
/** Reads Stripe.js's `confirmPayment` result: readback, or a message to show. */
|
|
220
|
+
function interpretConfirmPayment(result) {
|
|
221
|
+
if (result.error) return {
|
|
222
|
+
kind: "error",
|
|
223
|
+
message: result.error.message ?? "That payment didn't go through. Please try again."
|
|
224
|
+
};
|
|
225
|
+
return needsReadback(result.paymentIntent?.status) ? { kind: "readback" } : {
|
|
226
|
+
kind: "error",
|
|
227
|
+
message: PAYMENT_NOT_TAKEN
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Reads Stripe.js's `handleNextAction` result. A failed bank check leaves the
|
|
232
|
+
* PaymentIntent needing a payment method, so the dialog falls back to the
|
|
233
|
+
* card form; anything else unexpected can be tried again.
|
|
234
|
+
*/
|
|
235
|
+
function stageAfterNextAction(result, attempt) {
|
|
236
|
+
const { error, paymentIntent } = result;
|
|
237
|
+
if (!error) {
|
|
238
|
+
if (needsReadback(paymentIntent?.status)) return "readback";
|
|
239
|
+
return paymentIntent?.status === "requires_payment_method" ? {
|
|
240
|
+
stage: "new_card",
|
|
241
|
+
notice: null
|
|
242
|
+
} : {
|
|
243
|
+
stage: "authentication_error",
|
|
244
|
+
attempt,
|
|
245
|
+
message: PAYMENT_NOT_TAKEN
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
return stageAfterNextActionError(error, attempt);
|
|
249
|
+
}
|
|
250
|
+
function stageAfterNextActionError(error, attempt) {
|
|
251
|
+
return error.payment_intent?.status === "requires_payment_method" || error.code === "payment_intent_authentication_failure" ? {
|
|
252
|
+
stage: "new_card",
|
|
253
|
+
notice: error.message ?? null
|
|
254
|
+
} : {
|
|
255
|
+
stage: "authentication_error",
|
|
256
|
+
attempt,
|
|
257
|
+
message: error.message ?? "That payment didn't go through. Please try again."
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
211
261
|
//#region ../site-contracts/src/siteData/portalHome.ts
|
|
212
262
|
const TASK_KINDS = [
|
|
213
263
|
"answer_questions",
|
|
@@ -398,7 +448,8 @@ const membershipSchema = evolvingSchema()(z.object({
|
|
|
398
448
|
})).nullable(),
|
|
399
449
|
actions: z.object({
|
|
400
450
|
cancel: z.boolean(),
|
|
401
|
-
keep: z.boolean()
|
|
451
|
+
keep: z.boolean(),
|
|
452
|
+
fixPayment: z.boolean()
|
|
402
453
|
})
|
|
403
454
|
}));
|
|
404
455
|
const useBookingSchema = exactSchema()(z.object({
|
|
@@ -848,6 +899,10 @@ function accountApi(call, siteId) {
|
|
|
848
899
|
assetId
|
|
849
900
|
} }),
|
|
850
901
|
holdings: () => call(PORTAL.getHoldings, portalHoldingsResponseSchema),
|
|
902
|
+
membershipPayment: (customerMembershipId, invoiceId) => call(PORTAL.membershipPayment, portalMembershipPaymentSchema, {
|
|
903
|
+
params: { customerMembershipId },
|
|
904
|
+
body: invoiceId ? { invoiceId } : {}
|
|
905
|
+
}),
|
|
851
906
|
cancelMembership: (customerMembershipId) => call(PORTAL.cancelMembershipAtPeriodEnd, membershipChangeSchema, {
|
|
852
907
|
params: { customerMembershipId },
|
|
853
908
|
body: {}
|
|
@@ -1497,6 +1552,8 @@ const withNotices = (nextNoticeId, kept, added) => ({
|
|
|
1497
1552
|
}))],
|
|
1498
1553
|
nextNoticeId: nextNoticeId + added.length
|
|
1499
1554
|
});
|
|
1555
|
+
/** Notices are plain data built the same way each time, so two that say the same thing serialise the same. */
|
|
1556
|
+
const sameNotice = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
1500
1557
|
/** The first page, with whatever outcomes its URL carried. */
|
|
1501
1558
|
function initialPortalNavigation(location) {
|
|
1502
1559
|
return {
|
|
@@ -1512,7 +1569,7 @@ function reducePortalNavigation(state, event) {
|
|
|
1512
1569
|
};
|
|
1513
1570
|
case "noticed": return {
|
|
1514
1571
|
...state,
|
|
1515
|
-
...withNotices(state.nextNoticeId, state.notices, [event.notice])
|
|
1572
|
+
...withNotices(state.nextNoticeId, state.notices.filter((shown) => !sameNotice(shown.notice, event.notice)), [event.notice])
|
|
1516
1573
|
};
|
|
1517
1574
|
case "dismissed": return {
|
|
1518
1575
|
...state,
|
|
@@ -2020,7 +2077,7 @@ function moneyCopyContext(booking, context, recipient) {
|
|
|
2020
2077
|
function cancelMoneyNote(offer, booking, context) {
|
|
2021
2078
|
return cancellationMoneySentence(offer.money, moneyCopyContext(booking, context, offer.cancel.recipient));
|
|
2022
2079
|
}
|
|
2023
|
-
function money$
|
|
2080
|
+
function money$3(value) {
|
|
2024
2081
|
return formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
2025
2082
|
}
|
|
2026
2083
|
/**
|
|
@@ -2035,7 +2092,7 @@ function bookingPaymentLine(payment) {
|
|
|
2035
2092
|
case "pass": return payment.pass ? `Paid with your ${payment.pass.name}` : "Paid with a pass";
|
|
2036
2093
|
case "membership": return payment.membership ? `Included in your ${payment.membership.name}` : "Included in your membership";
|
|
2037
2094
|
case "order": return payment.order.paymentLabels.money;
|
|
2038
|
-
case "owed": return payment.amount ? `${money$
|
|
2095
|
+
case "owed": return payment.amount ? `${money$3(payment.amount)} still to pay` : "Still to pay";
|
|
2039
2096
|
case "unavailable": return null;
|
|
2040
2097
|
}
|
|
2041
2098
|
}
|
|
@@ -2131,6 +2188,11 @@ const toBooking = (route, reach) => reach === "opens" ? {
|
|
|
2131
2188
|
},
|
|
2132
2189
|
always: true
|
|
2133
2190
|
} : toBookings();
|
|
2191
|
+
const toPasses = () => ({
|
|
2192
|
+
label: "Your passes and memberships",
|
|
2193
|
+
target: { page: "passes" },
|
|
2194
|
+
always: true
|
|
2195
|
+
});
|
|
2134
2196
|
const toPayments = () => ({
|
|
2135
2197
|
label: "Your payments",
|
|
2136
2198
|
target: { page: "payments" },
|
|
@@ -2192,6 +2254,12 @@ const PORTAL_PAGES = {
|
|
|
2192
2254
|
chrome: "section",
|
|
2193
2255
|
back: toAccount
|
|
2194
2256
|
},
|
|
2257
|
+
membership_payment: {
|
|
2258
|
+
section: "passes",
|
|
2259
|
+
title: "Pay for your membership",
|
|
2260
|
+
chrome: "inner",
|
|
2261
|
+
back: toPasses
|
|
2262
|
+
},
|
|
2195
2263
|
payments: {
|
|
2196
2264
|
section: "payments",
|
|
2197
2265
|
title: "Payments",
|
|
@@ -3003,7 +3071,7 @@ function plans(booking, standing, context) {
|
|
|
3003
3071
|
items
|
|
3004
3072
|
};
|
|
3005
3073
|
}
|
|
3006
|
-
function money$
|
|
3074
|
+
function money$2(value) {
|
|
3007
3075
|
return formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
3008
3076
|
}
|
|
3009
3077
|
/** Money is still asked for (a balance, a plan, or a plan's failed payment), so what's been paid so far is worth saying. */
|
|
@@ -3023,7 +3091,7 @@ function payButton(order, target) {
|
|
|
3023
3091
|
const { toDo } = order;
|
|
3024
3092
|
switch (toDo.kind) {
|
|
3025
3093
|
case "pay":
|
|
3026
|
-
case "instalment_failed": return toDo.online.kind === "available" ? portalLink(toDo.kind === "pay" ? `Pay ${money$
|
|
3094
|
+
case "instalment_failed": return toDo.online.kind === "available" ? portalLink(toDo.kind === "pay" ? `Pay ${money$2(toDo.amount)} now` : "Pay now", target, "primary") : null;
|
|
3027
3095
|
case "finish_paying": return portalLink(SEE_WHATS_LEFT_TO_PAY, target, "primary");
|
|
3028
3096
|
case "payment_underway":
|
|
3029
3097
|
case "plan_running":
|
|
@@ -3039,9 +3107,9 @@ function orderPayment(order) {
|
|
|
3039
3107
|
} : null;
|
|
3040
3108
|
const action = target ? payButton(order, target) : null;
|
|
3041
3109
|
const bookingLabel = order.paymentLabels.booking ? [["Order", order.paymentLabels.booking]] : [];
|
|
3042
|
-
const total = order.total.amountCents > 0 ? [["Order total", money$
|
|
3043
|
-
const credit = order.paidWithCredit ? [["Paid with your credit", money$
|
|
3044
|
-
const paid = stillPaying(order.toDo) && order.paidSoFar.amountCents > 0 ? [["Paid so far", money$
|
|
3110
|
+
const total = order.total.amountCents > 0 ? [["Order total", money$2(order.total)]] : [];
|
|
3111
|
+
const credit = order.paidWithCredit ? [["Paid with your credit", money$2(order.paidWithCredit)]] : [];
|
|
3112
|
+
const paid = stillPaying(order.toDo) && order.paidSoFar.amountCents > 0 ? [["Paid so far", money$2(order.paidSoFar)]] : [];
|
|
3045
3113
|
return {
|
|
3046
3114
|
facts: [
|
|
3047
3115
|
...total,
|
|
@@ -3070,7 +3138,7 @@ function payment(booking, context) {
|
|
|
3070
3138
|
switch (paid.kind) {
|
|
3071
3139
|
case "order": return orderPayment(paid.order);
|
|
3072
3140
|
case "owed": return {
|
|
3073
|
-
facts: [["Still to pay", paid.amount ? money$
|
|
3141
|
+
facts: [["Still to pay", paid.amount ? money$2(paid.amount) : "The full price"]],
|
|
3074
3142
|
action: null,
|
|
3075
3143
|
link: null,
|
|
3076
3144
|
note: null
|
|
@@ -3139,10 +3207,20 @@ function calendar(booking, standing, context, pageUrl) {
|
|
|
3139
3207
|
if (!standing.live || !standing.holdsPlace) return null;
|
|
3140
3208
|
const bookingId = portalBookingPath(booking.ref).bookingId;
|
|
3141
3209
|
const place = calendarPlace(booking);
|
|
3142
|
-
const entries =
|
|
3210
|
+
const entries = (booking.kind === "course" ? booking.detail.sessions : [{
|
|
3211
|
+
...booking.when,
|
|
3212
|
+
calendarUid: booking.kind === "appointment" ? customerBookingCalendarUid({
|
|
3213
|
+
kind: "appointment",
|
|
3214
|
+
appointmentId: bookingId
|
|
3215
|
+
}) : customerBookingCalendarUid({
|
|
3216
|
+
kind: "event",
|
|
3217
|
+
bookingId,
|
|
3218
|
+
occurrenceId: booking.detail.occurrenceId
|
|
3219
|
+
})
|
|
3220
|
+
}]).map((session) => {
|
|
3143
3221
|
const startsAt = new Date(session.startsAt);
|
|
3144
3222
|
return {
|
|
3145
|
-
uid:
|
|
3223
|
+
uid: session.calendarUid,
|
|
3146
3224
|
sequence: 0,
|
|
3147
3225
|
title: context.siteTitle ? `${booking.title} (${context.siteTitle})` : booking.title,
|
|
3148
3226
|
startsAt,
|
|
@@ -3266,7 +3344,7 @@ function TextParts({ parts }) {
|
|
|
3266
3344
|
case "email": return /* @__PURE__ */ jsx("a", {
|
|
3267
3345
|
className: "rb-portal-link rb-portal-link--inline",
|
|
3268
3346
|
href: `mailto:${part.address}`,
|
|
3269
|
-
children: part.address
|
|
3347
|
+
children: part.label ?? part.address
|
|
3270
3348
|
}, index);
|
|
3271
3349
|
case "phone": return /* @__PURE__ */ jsx("a", {
|
|
3272
3350
|
className: "rb-portal-link rb-portal-link--inline rb-portal-nowrap",
|
|
@@ -4800,15 +4878,27 @@ function dateChip(date, trainer) {
|
|
|
4800
4878
|
};
|
|
4801
4879
|
}
|
|
4802
4880
|
}
|
|
4881
|
+
function packageList(packages) {
|
|
4882
|
+
const named = packages.map((pack) => `your ${pack.name ?? "package"} (${pack.sessionsLeft === 0 ? "none" : pack.sessionsLeft} left)`);
|
|
4883
|
+
return named.length <= 1 ? named[0] ?? "" : `${named.slice(0, -1).join(", ")} and ${named.at(-1) ?? ""}`;
|
|
4884
|
+
}
|
|
4803
4885
|
function paymentLine(session) {
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
case "payment_link": return "We'll send you a link to pay for each session.";
|
|
4886
|
+
const { coverage, owedFollowUp } = session.payment;
|
|
4887
|
+
const forNew = coverage.packages.filter((pack) => pack.forNewSessions);
|
|
4888
|
+
const bookedOnly = coverage.packages.filter((pack) => !pack.forNewSessions);
|
|
4889
|
+
if (forNew.length > 0) {
|
|
4890
|
+
const otherwise = owedFollowUp === "payment_link" ? "When no package covers a session, we’ll send you a link to pay for it." : "When no package covers a session, you pay for it as it comes up.";
|
|
4891
|
+
return `Your next sessions come out of ${packageList(coverage.packages)}. ${otherwise}`;
|
|
4811
4892
|
}
|
|
4893
|
+
if (bookedOnly.length > 0) {
|
|
4894
|
+
const after = owedFollowUp === "payment_link" ? "we’ll send you a link to pay for each session." : "you pay for each session as it comes up.";
|
|
4895
|
+
return `Your booked sessions come out of ${bookedList(bookedOnly)}. After those, ${after}`;
|
|
4896
|
+
}
|
|
4897
|
+
return owedFollowUp === "payment_link" ? "We’ll send you a link to pay for each session." : "You pay for each session as it comes up.";
|
|
4898
|
+
}
|
|
4899
|
+
function bookedList(packages) {
|
|
4900
|
+
const named = packages.map((pack) => `your ${pack.name ?? "package"}`);
|
|
4901
|
+
return named.length <= 1 ? named[0] ?? "" : `${named.slice(0, -1).join(", ")} and ${named.at(-1) ?? ""}`;
|
|
4812
4902
|
}
|
|
4813
4903
|
function bookedRef(date) {
|
|
4814
4904
|
return date.state === "booked" ? {
|
|
@@ -4843,7 +4933,7 @@ function regularSessionModel(session, context) {
|
|
|
4843
4933
|
payment: paymentLine(session),
|
|
4844
4934
|
note: holdsTimeNote(session, trainer),
|
|
4845
4935
|
dates,
|
|
4846
|
-
heldNote: !session.dates.some((date) => date.state === "held") ? null : session.payment.
|
|
4936
|
+
heldNote: !session.dates.some((date) => date.state === "held") ? null : session.payment.coverage.packages.length > 0 ? "Held dates aren't booked yet, so nothing's taken from your package until they are." : "Held dates aren't booked yet."
|
|
4847
4937
|
};
|
|
4848
4938
|
}
|
|
4849
4939
|
//#endregion
|
|
@@ -5371,14 +5461,28 @@ function payTask$1(task, contact, context) {
|
|
|
5371
5461
|
}, "quiet") : null
|
|
5372
5462
|
};
|
|
5373
5463
|
}
|
|
5464
|
+
/** The membership a failed-payment task is about, for its payment page; null when its id isn't one. */
|
|
5465
|
+
function membershipTaskId(task) {
|
|
5466
|
+
const id = parseCustomerMembershipId(task.customerMembershipId);
|
|
5467
|
+
return id.ok ? id.value : null;
|
|
5468
|
+
}
|
|
5469
|
+
/**
|
|
5470
|
+
* A failed membership payment goes to its payment page, which pays it or says
|
|
5471
|
+
* who to get in touch with, so the task doesn't name the business as well.
|
|
5472
|
+
*/
|
|
5374
5473
|
function membershipTask$1(task, contact, context) {
|
|
5474
|
+
const line = membershipPaymentFailedLine(task, context, task.membershipName);
|
|
5475
|
+
const id = membershipTaskId(task);
|
|
5375
5476
|
return {
|
|
5376
5477
|
key: task.key,
|
|
5377
5478
|
urgent: task.urgent,
|
|
5378
5479
|
title: `Your last payment for ${task.membershipName} didn't go through`,
|
|
5379
|
-
text:
|
|
5480
|
+
text: id ? line ? [textPart(line)] : [] : membershipText(line, contact, context),
|
|
5380
5481
|
sub: null,
|
|
5381
|
-
action: portalLink("
|
|
5482
|
+
action: id ? portalLink("Fix payment", {
|
|
5483
|
+
page: "membership_payment",
|
|
5484
|
+
customerMembershipId: id
|
|
5485
|
+
}, "quiet") : portalLink("See membership", { page: "passes" }, "quiet")
|
|
5382
5486
|
};
|
|
5383
5487
|
}
|
|
5384
5488
|
/** A kind of task this page doesn't know yet: still shown, so the list never claims there's nothing waiting. */
|
|
@@ -5480,6 +5584,20 @@ function downloadsRow(part) {
|
|
|
5480
5584
|
target: { page: "downloads" }
|
|
5481
5585
|
}];
|
|
5482
5586
|
}
|
|
5587
|
+
/**
|
|
5588
|
+
* Where the passes row goes: straight to the payment page when exactly one
|
|
5589
|
+
* membership needs paying (its task names which), otherwise the passes page.
|
|
5590
|
+
*/
|
|
5591
|
+
function passesTarget(view) {
|
|
5592
|
+
const part = view.summaries.passes;
|
|
5593
|
+
const needing = part.kind === "shown" ? part.memberships.filter((membership) => membership.paymentFailed).length : 0;
|
|
5594
|
+
const ids = view.tasks.tasks.flatMap((task) => task.kind === "membership_payment_failed" ? [membershipTaskId(task)] : []);
|
|
5595
|
+
const [id] = ids;
|
|
5596
|
+
return needing === 1 && ids.length === 1 && id ? {
|
|
5597
|
+
page: "membership_payment",
|
|
5598
|
+
customerMembershipId: id
|
|
5599
|
+
} : { page: "passes" };
|
|
5600
|
+
}
|
|
5483
5601
|
function summaryRows(view, context) {
|
|
5484
5602
|
return [
|
|
5485
5603
|
{
|
|
@@ -5492,7 +5610,7 @@ function summaryRows(view, context) {
|
|
|
5492
5610
|
key: "passes",
|
|
5493
5611
|
title: "Passes & memberships",
|
|
5494
5612
|
line: passesLine(view.summaries.passes),
|
|
5495
|
-
target:
|
|
5613
|
+
target: passesTarget(view)
|
|
5496
5614
|
},
|
|
5497
5615
|
{
|
|
5498
5616
|
key: "payments",
|
|
@@ -6032,7 +6150,7 @@ function cantAnswer(detail, context) {
|
|
|
6032
6150
|
text: `${these}. ${one ? "It’s" : "They’re"} optional, so you can send the rest without ${one ? "it" : "them"}.`
|
|
6033
6151
|
};
|
|
6034
6152
|
}
|
|
6035
|
-
function dueLine(detail, late, context) {
|
|
6153
|
+
function dueLine$1(detail, late, context) {
|
|
6036
6154
|
const by = portalSentenceDate(detail.dueAt, context.site, context.now);
|
|
6037
6155
|
if (late) return by ? `These were wanted by ${by}, but you can still send them.` : "You can still send these.";
|
|
6038
6156
|
return by ? `Please send your answers by ${by}.` : null;
|
|
@@ -6077,7 +6195,7 @@ function questionsPageModel(detail, context) {
|
|
|
6077
6195
|
intro,
|
|
6078
6196
|
mode: {
|
|
6079
6197
|
kind: "ask",
|
|
6080
|
-
due: dueLine(detail, answering.late, context),
|
|
6198
|
+
due: dueLine$1(detail, answering.late, context),
|
|
6081
6199
|
required: requiredLine(detail),
|
|
6082
6200
|
keepNote: "Nothing's saved until you press Send, so if you leave this page first, you'll need to fill your answers in again.",
|
|
6083
6201
|
cantAnswer: cantAnswer(detail, context)
|
|
@@ -6131,7 +6249,7 @@ function begin(sections, state) {
|
|
|
6131
6249
|
request: state.values
|
|
6132
6250
|
};
|
|
6133
6251
|
}
|
|
6134
|
-
function answered$
|
|
6252
|
+
function answered$2(state, answer) {
|
|
6135
6253
|
switch (answer.kind) {
|
|
6136
6254
|
case "done": return {
|
|
6137
6255
|
...state,
|
|
@@ -6187,7 +6305,7 @@ function questionsTask(sections) {
|
|
|
6187
6305
|
return {
|
|
6188
6306
|
reduce,
|
|
6189
6307
|
begin: (state) => begin(sections, state),
|
|
6190
|
-
answered: answered$
|
|
6308
|
+
answered: answered$2
|
|
6191
6309
|
};
|
|
6192
6310
|
}
|
|
6193
6311
|
function questionsSendBar(task) {
|
|
@@ -10849,7 +10967,7 @@ function PortalQuestion({ field, number, value, error, disabled, idPrefix, onCha
|
|
|
10849
10967
|
}) : null
|
|
10850
10968
|
] });
|
|
10851
10969
|
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10852
|
-
|
|
10970
|
+
isFieldsetQuestion(field) ? /* @__PURE__ */ jsx("legend", { children: label }) : /* @__PURE__ */ jsx("label", {
|
|
10853
10971
|
htmlFor: inputId,
|
|
10854
10972
|
children: label
|
|
10855
10973
|
}),
|
|
@@ -10877,24 +10995,14 @@ function PortalQuestion({ field, number, value, error, disabled, idPrefix, onCha
|
|
|
10877
10995
|
return /* @__PURE__ */ jsx("div", {
|
|
10878
10996
|
className: `rb-portal-field${error ? " rb-portal-field--error" : ""}`,
|
|
10879
10997
|
"data-portal": "field",
|
|
10880
|
-
children:
|
|
10998
|
+
children: isFieldsetQuestion(field) ? /* @__PURE__ */ jsx(QuestionFieldset, {
|
|
10881
10999
|
field,
|
|
10882
|
-
control,
|
|
11000
|
+
describedBy: control["aria-describedby"],
|
|
11001
|
+
required: Boolean(field.required),
|
|
10883
11002
|
children: body
|
|
10884
11003
|
}) : body
|
|
10885
11004
|
});
|
|
10886
11005
|
}
|
|
10887
|
-
/** A choice group is a fieldset: the question is its legend, and the group carries required state and descriptions. */
|
|
10888
|
-
function ChoiceGroup({ field, control, children }) {
|
|
10889
|
-
return /* @__PURE__ */ jsx("fieldset", {
|
|
10890
|
-
"aria-describedby": control["aria-describedby"],
|
|
10891
|
-
...field.type === "radio" ? {
|
|
10892
|
-
role: "radiogroup",
|
|
10893
|
-
"aria-required": control["aria-required"]
|
|
10894
|
-
} : {},
|
|
10895
|
-
children
|
|
10896
|
-
});
|
|
10897
|
-
}
|
|
10898
11006
|
//#endregion
|
|
10899
11007
|
//#region ../blocks/src/portal/app/pages/QuestionsPage.tsx
|
|
10900
11008
|
const UPLOAD_FAILED = "We couldn't upload that file. Please try again.";
|
|
@@ -11931,7 +12039,7 @@ function listLoaded(state, page, append) {
|
|
|
11931
12039
|
}
|
|
11932
12040
|
};
|
|
11933
12041
|
}
|
|
11934
|
-
function answered(state, result) {
|
|
12042
|
+
function answered$1(state, result) {
|
|
11935
12043
|
if (state.submission.kind === "idle") return state;
|
|
11936
12044
|
if (result.moved) return {
|
|
11937
12045
|
status: "done",
|
|
@@ -12043,7 +12151,7 @@ function onAnswer(state, answer) {
|
|
|
12043
12151
|
},
|
|
12044
12152
|
message: RESCHEDULE_UNCERTAIN_MESSAGE
|
|
12045
12153
|
};
|
|
12046
|
-
case "done": return answered(state, answer.value);
|
|
12154
|
+
case "done": return answered$1(state, answer.value);
|
|
12047
12155
|
}
|
|
12048
12156
|
}
|
|
12049
12157
|
function reduceReschedule(state, event) {
|
|
@@ -12906,9 +13014,9 @@ function partOf(part, read) {
|
|
|
12906
13014
|
const nonEmpty = (items) => items.length > 0 ? items : null;
|
|
12907
13015
|
//#endregion
|
|
12908
13016
|
//#region ../blocks/src/portal/app/model/passesPage.ts
|
|
12909
|
-
const money = (value) => formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
13017
|
+
const money$1 = (value) => formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
12910
13018
|
function priceLine(membership) {
|
|
12911
|
-
return membership.price ? `${money(membership.price)} a ${membership.interval}` : null;
|
|
13019
|
+
return membership.price ? `${money$1(membership.price)} a ${membership.interval}` : null;
|
|
12912
13020
|
}
|
|
12913
13021
|
const text = textPart;
|
|
12914
13022
|
/** What a running membership's card adds for where it stands. */
|
|
@@ -12916,7 +13024,7 @@ function runningCard({ membership, base, date, lastDay, coveredUntil, context },
|
|
|
12916
13024
|
switch (standing.kind) {
|
|
12917
13025
|
case "renewing": {
|
|
12918
13026
|
const next = membership.paymentTrouble ? null : date(standing.nextPaymentAt);
|
|
12919
|
-
const nextFact = next ? [["Next payment", membership.price ? `${money(membership.price)} on ${next}` : next]] : [];
|
|
13027
|
+
const nextFact = next ? [["Next payment", membership.price ? `${money$1(membership.price)} on ${next}` : next]] : [];
|
|
12920
13028
|
return {
|
|
12921
13029
|
...base,
|
|
12922
13030
|
facts: [...base.facts, ...nextFact],
|
|
@@ -12972,6 +13080,7 @@ function standingCard(input) {
|
|
|
12972
13080
|
label: "Ended"
|
|
12973
13081
|
},
|
|
12974
13082
|
problem: null,
|
|
13083
|
+
fixPayment: null,
|
|
12975
13084
|
facts: [],
|
|
12976
13085
|
compact: true,
|
|
12977
13086
|
canCancel: false,
|
|
@@ -12986,12 +13095,23 @@ function standingCard(input) {
|
|
|
12986
13095
|
};
|
|
12987
13096
|
}
|
|
12988
13097
|
}
|
|
13098
|
+
function fixPaymentAction(membership) {
|
|
13099
|
+
const id = parseCustomerMembershipId(membership.id);
|
|
13100
|
+
return membership.actions.fixPayment && id.ok ? portalLink("Fix payment", {
|
|
13101
|
+
page: "membership_payment",
|
|
13102
|
+
customerMembershipId: id.value
|
|
13103
|
+
}, "primary") : null;
|
|
13104
|
+
}
|
|
13105
|
+
function problemText(line, payable, contact, context) {
|
|
13106
|
+
return payable ? line ? [text(line)] : [] : membershipText(line, contact, context);
|
|
13107
|
+
}
|
|
12989
13108
|
function membershipCard(membership, contact, context) {
|
|
12990
13109
|
const date = (value) => value ? portalSentenceDate(value, context.site, context.now) : null;
|
|
12991
13110
|
const lastDay = (value) => value ? portalSentenceLastDay(value, context.site, context.now) : null;
|
|
12992
13111
|
const coveredUntil = (value) => value ? portalSentenceCoveredUntil(value, context.site, context.now) : null;
|
|
12993
13112
|
const since = date(membership.since);
|
|
12994
13113
|
const trouble = membership.paymentTrouble;
|
|
13114
|
+
const fixPayment = trouble ? fixPaymentAction(membership) : null;
|
|
12995
13115
|
return standingCard({
|
|
12996
13116
|
membership,
|
|
12997
13117
|
base: {
|
|
@@ -13002,7 +13122,8 @@ function membershipCard(membership, contact, context) {
|
|
|
13002
13122
|
tone: "problem",
|
|
13003
13123
|
label: "Last payment didn't go through"
|
|
13004
13124
|
} : null,
|
|
13005
|
-
problem: trouble ?
|
|
13125
|
+
problem: trouble ? problemText(membershipPaymentFailedLine(trouble, context), fixPayment !== null, contact, context) : null,
|
|
13126
|
+
fixPayment,
|
|
13006
13127
|
note: null,
|
|
13007
13128
|
facts: since ? [["Member since", since]] : [],
|
|
13008
13129
|
compact: false,
|
|
@@ -13182,7 +13303,7 @@ function creditEntry(entry, context) {
|
|
|
13182
13303
|
const line = creditLine(entry, context);
|
|
13183
13304
|
const on = portalSentenceDate(entry.at, context.site, context.now);
|
|
13184
13305
|
const incoming = entry.amount.amountCents >= 0;
|
|
13185
|
-
const size = money({
|
|
13306
|
+
const size = money$1({
|
|
13186
13307
|
...entry.amount,
|
|
13187
13308
|
amountCents: Math.abs(entry.amount.amountCents)
|
|
13188
13309
|
});
|
|
@@ -13198,10 +13319,10 @@ function creditEntry(entry, context) {
|
|
|
13198
13319
|
}
|
|
13199
13320
|
function creditModel(account, context) {
|
|
13200
13321
|
return {
|
|
13201
|
-
available: money(account.available),
|
|
13202
|
-
setAside: account.setAside.amountCents > 0 ? `${money(account.setAside)} more is held for a payment that's still going through.` : null,
|
|
13322
|
+
available: money$1(account.available),
|
|
13323
|
+
setAside: account.setAside.amountCents > 0 ? `${money$1(account.setAside)} more is held for a payment that's still going through.` : null,
|
|
13203
13324
|
history: account.history.map((entry) => creditEntry(entry, context)),
|
|
13204
|
-
balance: `Balance: ${money({
|
|
13325
|
+
balance: `Balance: ${money$1({
|
|
13205
13326
|
...account.available,
|
|
13206
13327
|
amountCents: account.available.amountCents + account.setAside.amountCents
|
|
13207
13328
|
})}`
|
|
@@ -13300,12 +13421,12 @@ function membershipTaskView(task, card) {
|
|
|
13300
13421
|
}
|
|
13301
13422
|
//#endregion
|
|
13302
13423
|
//#region ../blocks/src/portal/app/pages/PassesPage.tsx
|
|
13303
|
-
const PASSES = { name: "passes" };
|
|
13424
|
+
const PASSES$1 = { name: "passes" };
|
|
13304
13425
|
function PassesPage({ session }) {
|
|
13305
13426
|
const { view: context } = usePortalApp();
|
|
13306
13427
|
return /* @__PURE__ */ jsx(PortalResourcePage, {
|
|
13307
13428
|
session,
|
|
13308
|
-
resource: PASSES,
|
|
13429
|
+
resource: PASSES$1,
|
|
13309
13430
|
failedTitle: "We couldn't load your passes and memberships",
|
|
13310
13431
|
loading: /* @__PURE__ */ jsx(PortalSection, {
|
|
13311
13432
|
id: "memberships",
|
|
@@ -13469,22 +13590,26 @@ function CancelConfirm({ view, onYes, onNo }) {
|
|
|
13469
13590
|
});
|
|
13470
13591
|
}
|
|
13471
13592
|
function MembershipActions({ card, busy, onCancel, onKeep }) {
|
|
13472
|
-
if (!card.canCancel && !card.canKeep) return null;
|
|
13593
|
+
if (!card.canCancel && !card.canKeep && !card.fixPayment) return null;
|
|
13473
13594
|
return /* @__PURE__ */ jsxs("div", {
|
|
13474
13595
|
className: "rb-portal-actions rb-portal-mt-m",
|
|
13475
|
-
children: [
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13479
|
-
|
|
13480
|
-
|
|
13481
|
-
|
|
13482
|
-
|
|
13483
|
-
|
|
13484
|
-
|
|
13485
|
-
|
|
13486
|
-
|
|
13487
|
-
|
|
13596
|
+
children: [
|
|
13597
|
+
card.fixPayment ? /* @__PURE__ */ jsx(ActionView, { action: card.fixPayment }) : null,
|
|
13598
|
+
card.canKeep ? /* @__PURE__ */ jsx(PortalButton, {
|
|
13599
|
+
type: "button",
|
|
13600
|
+
variant: "secondary",
|
|
13601
|
+
disabled: busy,
|
|
13602
|
+
label: busy ? "Saving…" : "Keep my membership",
|
|
13603
|
+
onClick: onKeep
|
|
13604
|
+
}) : null,
|
|
13605
|
+
card.canCancel ? /* @__PURE__ */ jsx("button", {
|
|
13606
|
+
type: "button",
|
|
13607
|
+
className: "rb-portal-link",
|
|
13608
|
+
disabled: busy,
|
|
13609
|
+
onClick: onCancel,
|
|
13610
|
+
children: "Cancel membership"
|
|
13611
|
+
}) : null
|
|
13612
|
+
]
|
|
13488
13613
|
});
|
|
13489
13614
|
}
|
|
13490
13615
|
function Uses({ uses }) {
|
|
@@ -13583,6 +13708,767 @@ function CreditCard({ credit }) {
|
|
|
13583
13708
|
] });
|
|
13584
13709
|
}
|
|
13585
13710
|
//#endregion
|
|
13711
|
+
//#region ../blocks/src/system/runtime/shared/stripe/useBankCheck.ts
|
|
13712
|
+
const BANK_CHECK_UNAVAILABLE = "We couldn’t open your bank’s payment check. Please try again.";
|
|
13713
|
+
const defaultBankCheckDeps = {
|
|
13714
|
+
loadBrowserStripe: (context) => loadBrowserStripe(context),
|
|
13715
|
+
reportError: () => {}
|
|
13716
|
+
};
|
|
13717
|
+
/** Stripe rejects script loading and action calls as well as returning payment errors. */
|
|
13718
|
+
async function runBankCheck(request, isCurrent, deps) {
|
|
13719
|
+
try {
|
|
13720
|
+
const stripe = await deps.loadBrowserStripe(request.context);
|
|
13721
|
+
if (!isCurrent()) return "cancelled";
|
|
13722
|
+
if (!stripe) throw new Error("Stripe.js returned no client for the bank check");
|
|
13723
|
+
return stageAfterNextAction(await stripe.handleNextAction({ clientSecret: request.clientSecret }), request.attempt);
|
|
13724
|
+
} catch (error) {
|
|
13725
|
+
deps.reportError(error);
|
|
13726
|
+
return {
|
|
13727
|
+
stage: "authentication_error",
|
|
13728
|
+
attempt: request.attempt,
|
|
13729
|
+
message: BANK_CHECK_UNAVAILABLE
|
|
13730
|
+
};
|
|
13731
|
+
}
|
|
13732
|
+
}
|
|
13733
|
+
const samePress = (a, b) => a.press === b.press && a.clientSecret === b.clientSecret && a.context === b.context;
|
|
13734
|
+
/** Runs the bank check `request` names, delivering its outcome only to the current mounted subscriber. */
|
|
13735
|
+
function useBankCheck(request, onDone, deps = defaultBankCheckDeps) {
|
|
13736
|
+
const pending = useRef(null);
|
|
13737
|
+
const subscriber = useRef(null);
|
|
13738
|
+
useEffect(() => {
|
|
13739
|
+
if (!request) return;
|
|
13740
|
+
const subscription = new AbortController();
|
|
13741
|
+
subscriber.current = subscription.signal;
|
|
13742
|
+
if (!pending.current || !samePress(pending.current.request, request)) pending.current = {
|
|
13743
|
+
request,
|
|
13744
|
+
outcome: runBankCheck(request, () => pending.current !== null && samePress(pending.current.request, request) && subscriber.current?.aborted === false, deps)
|
|
13745
|
+
};
|
|
13746
|
+
pending.current.outcome.then((next) => {
|
|
13747
|
+
if (next !== "cancelled" && !subscription.signal.aborted) onDone(next);
|
|
13748
|
+
});
|
|
13749
|
+
return () => subscription.abort();
|
|
13750
|
+
}, [
|
|
13751
|
+
request,
|
|
13752
|
+
onDone,
|
|
13753
|
+
deps
|
|
13754
|
+
]);
|
|
13755
|
+
}
|
|
13756
|
+
//#endregion
|
|
13757
|
+
//#region ../blocks/src/portal/app/model/membershipPaymentPage.ts
|
|
13758
|
+
/** The page as it opens: `invoiceId` is the one the URL names, after a reload, a bank's redirect or a sign-in. */
|
|
13759
|
+
function initialMembershipPayment(invoiceId) {
|
|
13760
|
+
return invoiceId === null ? { kind: "opening" } : {
|
|
13761
|
+
kind: "asking",
|
|
13762
|
+
invoiceId,
|
|
13763
|
+
newCard: false,
|
|
13764
|
+
polls: 0
|
|
13765
|
+
};
|
|
13766
|
+
}
|
|
13767
|
+
/** The pauses between checks while the bank settles; the last repeats until the deadline. */
|
|
13768
|
+
const CHECK_DELAYS_MS = [
|
|
13769
|
+
2e3,
|
|
13770
|
+
3e3,
|
|
13771
|
+
5e3
|
|
13772
|
+
];
|
|
13773
|
+
/** How long checking runs, request time included, before the page says it's taking longer. */
|
|
13774
|
+
const CHECK_DEADLINE_MS = 3e4;
|
|
13775
|
+
/** The wait before the next check, while checking. */
|
|
13776
|
+
function nextCheckDelay(state) {
|
|
13777
|
+
if (state.kind !== "checking") return null;
|
|
13778
|
+
return CHECK_DELAYS_MS[Math.min(state.polls, CHECK_DELAYS_MS.length) - 1] ?? null;
|
|
13779
|
+
}
|
|
13780
|
+
/** Whether the page is checking a payment, which the deadline covers from start to finish. */
|
|
13781
|
+
function inCheckingPhase(state) {
|
|
13782
|
+
return state.kind === "asking" || state.kind === "checking";
|
|
13783
|
+
}
|
|
13784
|
+
/** What the server's `pay` answer allows: the card form only for an answer prepared for a new card. */
|
|
13785
|
+
function payState(payment, notice) {
|
|
13786
|
+
switch (payment.reason) {
|
|
13787
|
+
case "new_card": return {
|
|
13788
|
+
kind: "card",
|
|
13789
|
+
payment,
|
|
13790
|
+
form: "loading",
|
|
13791
|
+
formAttempt: 1,
|
|
13792
|
+
notice,
|
|
13793
|
+
paying: false
|
|
13794
|
+
};
|
|
13795
|
+
case "authenticate": return {
|
|
13796
|
+
kind: "bank_check",
|
|
13797
|
+
payment,
|
|
13798
|
+
open: false,
|
|
13799
|
+
error: notice
|
|
13800
|
+
};
|
|
13801
|
+
}
|
|
13802
|
+
}
|
|
13803
|
+
function stillChecking(checking) {
|
|
13804
|
+
return {
|
|
13805
|
+
kind: "checking",
|
|
13806
|
+
invoiceId: checking.invoiceId,
|
|
13807
|
+
newCard: checking.newCard,
|
|
13808
|
+
polls: checking.polls + 1
|
|
13809
|
+
};
|
|
13810
|
+
}
|
|
13811
|
+
function askContext(state) {
|
|
13812
|
+
switch (state.kind) {
|
|
13813
|
+
case "opening": return {
|
|
13814
|
+
invoiceId: null,
|
|
13815
|
+
newCard: false,
|
|
13816
|
+
polls: 0,
|
|
13817
|
+
notice: null
|
|
13818
|
+
};
|
|
13819
|
+
case "reopening": return {
|
|
13820
|
+
invoiceId: state.invoiceId,
|
|
13821
|
+
newCard: false,
|
|
13822
|
+
polls: 0,
|
|
13823
|
+
notice: state.notice
|
|
13824
|
+
};
|
|
13825
|
+
case "asking": return {
|
|
13826
|
+
invoiceId: state.invoiceId,
|
|
13827
|
+
newCard: state.newCard,
|
|
13828
|
+
polls: state.polls,
|
|
13829
|
+
notice: null
|
|
13830
|
+
};
|
|
13831
|
+
}
|
|
13832
|
+
}
|
|
13833
|
+
function answered(asked, answer) {
|
|
13834
|
+
switch (answer.kind) {
|
|
13835
|
+
case "pay": return payState(answer, asked.notice);
|
|
13836
|
+
case "checking": return stillChecking(asked);
|
|
13837
|
+
case "paid": return {
|
|
13838
|
+
kind: "paid",
|
|
13839
|
+
nextRenewal: answer.nextRenewal,
|
|
13840
|
+
newCard: asked.newCard
|
|
13841
|
+
};
|
|
13842
|
+
case "nothing_to_pay": return { kind: "nothing_to_pay" };
|
|
13843
|
+
case "unavailable": return { kind: "unavailable" };
|
|
13844
|
+
}
|
|
13845
|
+
}
|
|
13846
|
+
function reduceAsk(state, event) {
|
|
13847
|
+
if (event.type === "answered") return answered(askContext(state), event.answer);
|
|
13848
|
+
if (event.type === "deadline") return state.kind === "asking" ? { kind: "slow" } : null;
|
|
13849
|
+
if (event.type !== "ask_failed") return null;
|
|
13850
|
+
return state.kind === "asking" ? stillChecking(state) : {
|
|
13851
|
+
kind: "ask_failed",
|
|
13852
|
+
retry: state
|
|
13853
|
+
};
|
|
13854
|
+
}
|
|
13855
|
+
/** Reads the payment back from the server, for the invoice just paid. */
|
|
13856
|
+
function readBack(payment, newCard) {
|
|
13857
|
+
return {
|
|
13858
|
+
kind: "asking",
|
|
13859
|
+
invoiceId: payment.invoiceId,
|
|
13860
|
+
newCard,
|
|
13861
|
+
polls: 0
|
|
13862
|
+
};
|
|
13863
|
+
}
|
|
13864
|
+
function afterBankCheck(payment, next) {
|
|
13865
|
+
if (next === "readback") return readBack(payment, false);
|
|
13866
|
+
switch (next.stage) {
|
|
13867
|
+
case "new_card": return {
|
|
13868
|
+
kind: "reopening",
|
|
13869
|
+
invoiceId: payment.invoiceId,
|
|
13870
|
+
notice: next.notice
|
|
13871
|
+
};
|
|
13872
|
+
case "authentication_error": return {
|
|
13873
|
+
kind: "bank_check",
|
|
13874
|
+
payment,
|
|
13875
|
+
open: false,
|
|
13876
|
+
error: next.message
|
|
13877
|
+
};
|
|
13878
|
+
case "authenticating": return {
|
|
13879
|
+
kind: "bank_check",
|
|
13880
|
+
payment,
|
|
13881
|
+
open: false,
|
|
13882
|
+
error: null
|
|
13883
|
+
};
|
|
13884
|
+
}
|
|
13885
|
+
}
|
|
13886
|
+
function reduceBankCheck(state, event) {
|
|
13887
|
+
if (!state.open) return event.type === "confirm_bank" ? {
|
|
13888
|
+
...state,
|
|
13889
|
+
open: true,
|
|
13890
|
+
error: null
|
|
13891
|
+
} : null;
|
|
13892
|
+
return event.type === "bank_done" ? afterBankCheck(state.payment, event.next) : null;
|
|
13893
|
+
}
|
|
13894
|
+
function reduceCard(state, event) {
|
|
13895
|
+
switch (event.type) {
|
|
13896
|
+
case "form_ready": return {
|
|
13897
|
+
...state,
|
|
13898
|
+
form: "ready"
|
|
13899
|
+
};
|
|
13900
|
+
case "form_failed": return state.paying ? null : {
|
|
13901
|
+
...state,
|
|
13902
|
+
form: "failed"
|
|
13903
|
+
};
|
|
13904
|
+
case "form_retry": return state.form === "failed" ? {
|
|
13905
|
+
...state,
|
|
13906
|
+
form: "loading",
|
|
13907
|
+
formAttempt: state.formAttempt + 1
|
|
13908
|
+
} : null;
|
|
13909
|
+
case "pay_card": return state.form === "ready" && !state.paying ? {
|
|
13910
|
+
...state,
|
|
13911
|
+
paying: true
|
|
13912
|
+
} : null;
|
|
13913
|
+
case "card_incomplete": return state.paying ? {
|
|
13914
|
+
...state,
|
|
13915
|
+
paying: false
|
|
13916
|
+
} : null;
|
|
13917
|
+
case "card_done":
|
|
13918
|
+
if (!state.paying) return null;
|
|
13919
|
+
return event.outcome.kind === "readback" ? readBack(state.payment, true) : {
|
|
13920
|
+
...state,
|
|
13921
|
+
paying: false,
|
|
13922
|
+
notice: event.outcome.message
|
|
13923
|
+
};
|
|
13924
|
+
case "answered":
|
|
13925
|
+
case "ask_failed":
|
|
13926
|
+
case "retry":
|
|
13927
|
+
case "poll":
|
|
13928
|
+
case "deadline":
|
|
13929
|
+
case "confirm_bank":
|
|
13930
|
+
case "bank_done": return null;
|
|
13931
|
+
}
|
|
13932
|
+
}
|
|
13933
|
+
/** Everything the member and the server do to the page. Events that don't fit the state are ignored. */
|
|
13934
|
+
function reduceMembershipPayment(state, event) {
|
|
13935
|
+
return transition(state, event) ?? state;
|
|
13936
|
+
}
|
|
13937
|
+
function transition(state, event) {
|
|
13938
|
+
switch (state.kind) {
|
|
13939
|
+
case "opening":
|
|
13940
|
+
case "reopening":
|
|
13941
|
+
case "asking": return reduceAsk(state, event);
|
|
13942
|
+
case "ask_failed": return event.type === "retry" ? state.retry : null;
|
|
13943
|
+
case "checking":
|
|
13944
|
+
if (event.type === "deadline") return { kind: "slow" };
|
|
13945
|
+
return event.type === "poll" ? {
|
|
13946
|
+
kind: "asking",
|
|
13947
|
+
invoiceId: state.invoiceId,
|
|
13948
|
+
newCard: state.newCard,
|
|
13949
|
+
polls: state.polls
|
|
13950
|
+
} : null;
|
|
13951
|
+
case "bank_check": return reduceBankCheck(state, event);
|
|
13952
|
+
case "card": return reduceCard(state, event);
|
|
13953
|
+
case "slow":
|
|
13954
|
+
case "paid":
|
|
13955
|
+
case "nothing_to_pay":
|
|
13956
|
+
case "unavailable": return null;
|
|
13957
|
+
}
|
|
13958
|
+
}
|
|
13959
|
+
/** The invoice to ask about now, when the page is asking. */
|
|
13960
|
+
function invoiceToAsk(state) {
|
|
13961
|
+
if (state.kind === "opening") return { invoiceId: null };
|
|
13962
|
+
return state.kind === "reopening" || state.kind === "asking" ? { invoiceId: state.invoiceId } : null;
|
|
13963
|
+
}
|
|
13964
|
+
/** Whether the URL can let go of the invoice: only once the server says it's paid or there's nothing to pay. */
|
|
13965
|
+
function releasesInvoice(state) {
|
|
13966
|
+
return state.kind === "paid" || state.kind === "nothing_to_pay";
|
|
13967
|
+
}
|
|
13968
|
+
const NO_CONTACT = {
|
|
13969
|
+
email: null,
|
|
13970
|
+
phone: null
|
|
13971
|
+
};
|
|
13972
|
+
/** The membership from the holdings read; still usable (with plainer words) when it isn't there. */
|
|
13973
|
+
function shownMembership(holdings, customerMembershipId) {
|
|
13974
|
+
if (holdings?.memberships.kind !== "shown") return null;
|
|
13975
|
+
return holdings.memberships.memberships.find((entry) => entry.id === customerMembershipId) ?? null;
|
|
13976
|
+
}
|
|
13977
|
+
function membershipPaymentSubject(holdings, customerMembershipId) {
|
|
13978
|
+
const membership = shownMembership(holdings, customerMembershipId);
|
|
13979
|
+
const contact = holdings?.contact ?? NO_CONTACT;
|
|
13980
|
+
if (!membership) return {
|
|
13981
|
+
name: null,
|
|
13982
|
+
failed: null,
|
|
13983
|
+
overdueSince: null,
|
|
13984
|
+
contact
|
|
13985
|
+
};
|
|
13986
|
+
const trouble = membership.paymentTrouble;
|
|
13987
|
+
return {
|
|
13988
|
+
name: membership.name,
|
|
13989
|
+
failed: trouble?.failed ?? null,
|
|
13990
|
+
overdueSince: trouble?.overdueSince ?? null,
|
|
13991
|
+
contact
|
|
13992
|
+
};
|
|
13993
|
+
}
|
|
13994
|
+
const PAYMENT_FORM_FAILED = "We couldn't load the payment form just now. Please try again in a moment.";
|
|
13995
|
+
const money = (value) => formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
13996
|
+
function dueLine(subject, amount, context) {
|
|
13997
|
+
const owed = amount ?? subject.failed;
|
|
13998
|
+
const since = subject.overdueSince ? portalSentenceDate(subject.overdueSince, context.site, context.now) : null;
|
|
13999
|
+
if (owed && since) return `${money(owed)} due since ${since}`;
|
|
14000
|
+
if (owed) return `${money(owed)} due`;
|
|
14001
|
+
return since ? `Due since ${since}` : null;
|
|
14002
|
+
}
|
|
14003
|
+
/** Stripe's reason, then what they can do; a decline with no reason of Stripe's says it plainly. */
|
|
14004
|
+
function declinedNotice(message) {
|
|
14005
|
+
return `${message === "That payment didn't go through. Please try again." ? "That payment didn't go through." : message} Try another card, or try again later.`;
|
|
14006
|
+
}
|
|
14007
|
+
function paidLines(state, name, context) {
|
|
14008
|
+
const renewal = state.nextRenewal;
|
|
14009
|
+
const date = renewal ? portalSentenceDate(renewal.date, context.site, context.now) : null;
|
|
14010
|
+
const next = !renewal || !date ? null : renewal.usesThisCard && state.newCard ? `We'll use this card for your next payment on ${date}.` : `Your next payment is on ${date}.`;
|
|
14011
|
+
return [`Thanks. ${name} is up to date.`, ...next ? [next] : []];
|
|
14012
|
+
}
|
|
14013
|
+
function isPaying(state) {
|
|
14014
|
+
return state.kind === "bank_check" || state.kind === "card" || state.kind === "reopening";
|
|
14015
|
+
}
|
|
14016
|
+
function bankCheckBody(state) {
|
|
14017
|
+
return state.open ? {
|
|
14018
|
+
kind: "bank_open",
|
|
14019
|
+
text: WAITING_FOR_BANK
|
|
14020
|
+
} : {
|
|
14021
|
+
kind: "confirm",
|
|
14022
|
+
label: `Confirm ${money(state.payment.amount)} payment`,
|
|
14023
|
+
hint: "Your bank will ask you to confirm it, usually in your banking app or a pop-up.",
|
|
14024
|
+
error: state.error
|
|
14025
|
+
};
|
|
14026
|
+
}
|
|
14027
|
+
function cardBody(state, context) {
|
|
14028
|
+
return {
|
|
14029
|
+
kind: "card",
|
|
14030
|
+
label: state.paying ? "Paying…" : `Pay ${money(state.payment.amount)}`,
|
|
14031
|
+
busy: state.paying,
|
|
14032
|
+
form: state.form,
|
|
14033
|
+
formAttempt: state.formAttempt,
|
|
14034
|
+
formFailed: PAYMENT_FORM_FAILED,
|
|
14035
|
+
notice: state.notice === null ? null : declinedNotice(state.notice),
|
|
14036
|
+
smallPrint: `Your card details go straight to Stripe, who handle payments for ${businessName(context)}.`
|
|
14037
|
+
};
|
|
14038
|
+
}
|
|
14039
|
+
const CARD_INTRO = "We couldn't take this month's payment. You can pay it now by card, and we'll use that card for your membership from now on.";
|
|
14040
|
+
function payIntro(state) {
|
|
14041
|
+
switch (state.kind) {
|
|
14042
|
+
case "card": return CARD_INTRO;
|
|
14043
|
+
case "bank_check": return `Your bank needs to check it's you before the ${money(state.payment.amount)} goes through.`;
|
|
14044
|
+
case "reopening": return null;
|
|
14045
|
+
}
|
|
14046
|
+
}
|
|
14047
|
+
function nextTryLine(state, context) {
|
|
14048
|
+
if (state.kind === "reopening" || state.kind === "bank_check" && state.open || !state.payment.nextAttempt) return null;
|
|
14049
|
+
const date = portalSentenceDate(state.payment.nextAttempt, context.site, context.now);
|
|
14050
|
+
return date ? `If you'd rather wait, we'll try the card we already have again on ${date}.` : null;
|
|
14051
|
+
}
|
|
14052
|
+
const CHECKING = "Thanks. We're just checking the payment with your bank. This usually takes a few seconds.";
|
|
14053
|
+
function bodyOf(state, names, subject, context) {
|
|
14054
|
+
switch (state.kind) {
|
|
14055
|
+
case "opening":
|
|
14056
|
+
case "reopening": return { kind: "asking" };
|
|
14057
|
+
case "ask_failed": return {
|
|
14058
|
+
kind: "ask_failed",
|
|
14059
|
+
title: "We couldn't check this payment just now"
|
|
14060
|
+
};
|
|
14061
|
+
case "bank_check": return bankCheckBody(state);
|
|
14062
|
+
case "card": return cardBody(state, context);
|
|
14063
|
+
case "asking":
|
|
14064
|
+
case "checking": return {
|
|
14065
|
+
kind: "checking",
|
|
14066
|
+
text: CHECKING
|
|
14067
|
+
};
|
|
14068
|
+
case "slow": return {
|
|
14069
|
+
kind: "slow",
|
|
14070
|
+
text: "This is taking longer than usual. You don't need to pay again. Check back here in a few minutes."
|
|
14071
|
+
};
|
|
14072
|
+
case "paid": return {
|
|
14073
|
+
kind: "paid",
|
|
14074
|
+
heading: "That's paid",
|
|
14075
|
+
lines: paidLines(state, names.atStart, context)
|
|
14076
|
+
};
|
|
14077
|
+
case "nothing_to_pay": return {
|
|
14078
|
+
kind: "nothing_to_pay",
|
|
14079
|
+
text: `There's nothing to pay for ${names.inSentence} at the moment.`
|
|
14080
|
+
};
|
|
14081
|
+
case "unavailable": return {
|
|
14082
|
+
kind: "unavailable",
|
|
14083
|
+
text: contactSentence("You can't pay for this membership here at the moment. Please get in touch with", subject.contact, context)
|
|
14084
|
+
};
|
|
14085
|
+
}
|
|
14086
|
+
}
|
|
14087
|
+
function payingLines(paying, context) {
|
|
14088
|
+
return paying ? {
|
|
14089
|
+
intro: payIntro(paying),
|
|
14090
|
+
nextTry: nextTryLine(paying, context)
|
|
14091
|
+
} : {
|
|
14092
|
+
intro: null,
|
|
14093
|
+
nextTry: null
|
|
14094
|
+
};
|
|
14095
|
+
}
|
|
14096
|
+
function amountDue(paying) {
|
|
14097
|
+
return paying && paying.kind !== "reopening" ? paying.payment.amount : null;
|
|
14098
|
+
}
|
|
14099
|
+
function membershipPaymentPageModel(state, subject, context) {
|
|
14100
|
+
const paying = isPaying(state) ? state : null;
|
|
14101
|
+
const settled = state.kind === "paid" || state.kind === "nothing_to_pay";
|
|
14102
|
+
const named = subject.name ?? "your membership";
|
|
14103
|
+
const atStart = subject.name ?? "Your membership";
|
|
14104
|
+
const { intro, nextTry } = payingLines(paying, context);
|
|
14105
|
+
return {
|
|
14106
|
+
title: paying ? `Pay for ${named}` : atStart,
|
|
14107
|
+
sub: settled ? null : dueLine(subject, amountDue(paying), context),
|
|
14108
|
+
intro,
|
|
14109
|
+
body: bodyOf(state, {
|
|
14110
|
+
atStart,
|
|
14111
|
+
inSentence: named
|
|
14112
|
+
}, subject, context),
|
|
14113
|
+
nextTry,
|
|
14114
|
+
back: state.kind === "slow" || settled
|
|
14115
|
+
};
|
|
14116
|
+
}
|
|
14117
|
+
//#endregion
|
|
14118
|
+
//#region ../blocks/src/portal/app/model/paymentAppearance.ts
|
|
14119
|
+
/** `rgb(1, 2, 3)` or `rgb(1 2 3)`, with or without alpha, as Stripe reads it: commas and no transparency. */
|
|
14120
|
+
function stripeColour(value) {
|
|
14121
|
+
const match = /^rgba?\(\s*(\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})\s*(?:[,/]\s*([\d.]+%?)\s*)?\)$/.exec(value.trim());
|
|
14122
|
+
if (!match) return /^#[0-9a-f]{3}(?:[0-9a-f]{3})?$/i.test(value.trim()) ? value.trim() : null;
|
|
14123
|
+
const [, red = "", green = "", blue = "", alpha] = match;
|
|
14124
|
+
if (alpha !== void 0 && alpha !== "1" && alpha !== "100%") return null;
|
|
14125
|
+
return `rgb(${red}, ${green}, ${blue})`;
|
|
14126
|
+
}
|
|
14127
|
+
/** A computed corner radius, in pixels (the first of a pair); null when there isn't one. */
|
|
14128
|
+
function stripeRadius(value) {
|
|
14129
|
+
const pixels = /^(\d+(?:\.\d+)?)px/.exec(value.trim())?.[1];
|
|
14130
|
+
return pixels === void 0 ? null : `${pixels}px`;
|
|
14131
|
+
}
|
|
14132
|
+
function stripeFont(value) {
|
|
14133
|
+
const font = value.trim();
|
|
14134
|
+
return font === "" ? null : font;
|
|
14135
|
+
}
|
|
14136
|
+
/** Stripe's appearance options; each value that can't be read is left to Stripe's default. */
|
|
14137
|
+
function portalPaymentAppearance(style) {
|
|
14138
|
+
const read = (name, value) => value === null ? {} : { [name]: value };
|
|
14139
|
+
return {
|
|
14140
|
+
theme: "stripe",
|
|
14141
|
+
variables: {
|
|
14142
|
+
...read("fontFamily", stripeFont(style.fontFamily)),
|
|
14143
|
+
...read("colorText", stripeColour(style.text)),
|
|
14144
|
+
...read("colorBackground", stripeColour(style.background)),
|
|
14145
|
+
...read("colorPrimary", stripeColour(style.primary)),
|
|
14146
|
+
...read("borderRadius", stripeRadius(style.radius))
|
|
14147
|
+
}
|
|
14148
|
+
};
|
|
14149
|
+
}
|
|
14150
|
+
//#endregion
|
|
14151
|
+
//#region ../blocks/src/portal/app/pages/MembershipPaymentPage.tsx
|
|
14152
|
+
/** The query parameter that keeps the invoice being paid through reloads and the bank's redirects. */
|
|
14153
|
+
const INVOICE_PARAM = "invoice";
|
|
14154
|
+
const PASSES = { name: "passes" };
|
|
14155
|
+
const PAID_CHANGES = [
|
|
14156
|
+
{ name: "passes" },
|
|
14157
|
+
{ name: "home" },
|
|
14158
|
+
{ name: "payments" }
|
|
14159
|
+
];
|
|
14160
|
+
/**
|
|
14161
|
+
* `invoiceId` comes from the route (the URL's `invoice`), so the page starts
|
|
14162
|
+
* the same on the server and in the browser; the portal's entry strips
|
|
14163
|
+
* Stripe's return parameters from the address.
|
|
14164
|
+
*/
|
|
14165
|
+
function MembershipPaymentPage({ session, customerMembershipId, invoiceId }) {
|
|
14166
|
+
const { view: context } = usePortalApp();
|
|
14167
|
+
const [state, dispatch] = React$1.useReducer(reduceMembershipPayment, invoiceId, initialMembershipPayment);
|
|
14168
|
+
usePaymentEffects(session, customerMembershipId, state, dispatch);
|
|
14169
|
+
const holdings = portalResourceShown(usePortalResource(session.resources, PASSES));
|
|
14170
|
+
if (holdings.kind === "loading" || state.kind === "opening") return /* @__PURE__ */ jsx(LoadingCards, {
|
|
14171
|
+
count: 1,
|
|
14172
|
+
label: "Loading your payment"
|
|
14173
|
+
});
|
|
14174
|
+
const page = membershipPaymentPageModel(state, membershipPaymentSubject(holdings.kind === "shown" ? holdings.value : null, customerMembershipId), context);
|
|
14175
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
14176
|
+
className: "rb-portal-head",
|
|
14177
|
+
"data-portal": "head",
|
|
14178
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
14179
|
+
className: "rb-portal-title",
|
|
14180
|
+
children: page.title
|
|
14181
|
+
}), page.sub ? /* @__PURE__ */ jsx("p", {
|
|
14182
|
+
className: "rb-portal-sub",
|
|
14183
|
+
children: page.sub
|
|
14184
|
+
}) : null] })
|
|
14185
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
14186
|
+
className: "rb-portal-stack",
|
|
14187
|
+
children: [
|
|
14188
|
+
page.intro ? /* @__PURE__ */ jsx("p", { children: page.intro }) : null,
|
|
14189
|
+
/* @__PURE__ */ jsx(Body, {
|
|
14190
|
+
body: page.body,
|
|
14191
|
+
state,
|
|
14192
|
+
dispatch,
|
|
14193
|
+
back: page.back
|
|
14194
|
+
}),
|
|
14195
|
+
page.nextTry ? /* @__PURE__ */ jsx("p", {
|
|
14196
|
+
className: "rb-portal-muted rb-portal-small",
|
|
14197
|
+
children: page.nextTry
|
|
14198
|
+
}) : null
|
|
14199
|
+
]
|
|
14200
|
+
})] });
|
|
14201
|
+
}
|
|
14202
|
+
/** Asking the server, checking again while the bank settles, and letting go of the invoice once it's settled. */
|
|
14203
|
+
function usePaymentEffects(session, customerMembershipId, state, dispatch) {
|
|
14204
|
+
const ask = React$1.useMemo(() => invoiceToAsk(state), [state]);
|
|
14205
|
+
React$1.useEffect(() => {
|
|
14206
|
+
if (!ask) return;
|
|
14207
|
+
const stale = new AbortController();
|
|
14208
|
+
session.api.membershipPayment(customerMembershipId, ask.invoiceId ?? void 0).then((result) => {
|
|
14209
|
+
if (!stale.signal.aborted) dispatch(result.ok ? {
|
|
14210
|
+
type: "answered",
|
|
14211
|
+
answer: result.value
|
|
14212
|
+
} : { type: "ask_failed" });
|
|
14213
|
+
});
|
|
14214
|
+
return () => stale.abort();
|
|
14215
|
+
}, [
|
|
14216
|
+
ask,
|
|
14217
|
+
session.api,
|
|
14218
|
+
customerMembershipId,
|
|
14219
|
+
dispatch
|
|
14220
|
+
]);
|
|
14221
|
+
const checking = inCheckingPhase(state);
|
|
14222
|
+
React$1.useEffect(() => {
|
|
14223
|
+
if (!checking) return;
|
|
14224
|
+
const timer = window.setTimeout(() => dispatch({ type: "deadline" }), CHECK_DEADLINE_MS);
|
|
14225
|
+
return () => window.clearTimeout(timer);
|
|
14226
|
+
}, [checking, dispatch]);
|
|
14227
|
+
const delay = nextCheckDelay(state);
|
|
14228
|
+
React$1.useEffect(() => {
|
|
14229
|
+
if (delay === null) return;
|
|
14230
|
+
const timer = window.setTimeout(() => dispatch({ type: "poll" }), delay);
|
|
14231
|
+
return () => window.clearTimeout(timer);
|
|
14232
|
+
}, [
|
|
14233
|
+
state,
|
|
14234
|
+
delay,
|
|
14235
|
+
dispatch
|
|
14236
|
+
]);
|
|
14237
|
+
const released = releasesInvoice(state);
|
|
14238
|
+
const paid = state.kind === "paid";
|
|
14239
|
+
React$1.useEffect(() => {
|
|
14240
|
+
if (!released) return;
|
|
14241
|
+
clearInvoiceReturn(INVOICE_PARAM);
|
|
14242
|
+
if (paid) session.resources.invalidate(PAID_CHANGES);
|
|
14243
|
+
}, [
|
|
14244
|
+
released,
|
|
14245
|
+
paid,
|
|
14246
|
+
session.resources
|
|
14247
|
+
]);
|
|
14248
|
+
const bankOpen = state.kind === "bank_check" && state.open ? state : null;
|
|
14249
|
+
useBankCheck(React$1.useMemo(() => bankOpen ? {
|
|
14250
|
+
press: bankOpen,
|
|
14251
|
+
context: bankOpen.payment.browser,
|
|
14252
|
+
clientSecret: bankOpen.payment.clientSecret,
|
|
14253
|
+
attempt: 1
|
|
14254
|
+
} : null, [bankOpen]), React$1.useCallback((next) => dispatch({
|
|
14255
|
+
type: "bank_done",
|
|
14256
|
+
next
|
|
14257
|
+
}), [dispatch]));
|
|
14258
|
+
}
|
|
14259
|
+
function BackToPasses() {
|
|
14260
|
+
return /* @__PURE__ */ jsx("div", {
|
|
14261
|
+
className: "rb-portal-actions rb-portal-mt-m",
|
|
14262
|
+
children: /* @__PURE__ */ jsx(PortalPageLink, {
|
|
14263
|
+
className: "rb-portal-link",
|
|
14264
|
+
to: { page: "passes" },
|
|
14265
|
+
children: "Back to your passes"
|
|
14266
|
+
})
|
|
14267
|
+
});
|
|
14268
|
+
}
|
|
14269
|
+
function Body({ body, state, dispatch, back }) {
|
|
14270
|
+
switch (body.kind) {
|
|
14271
|
+
case "asking": return /* @__PURE__ */ jsx(LoadingCards, {
|
|
14272
|
+
count: 1,
|
|
14273
|
+
label: "Checking your payment"
|
|
14274
|
+
});
|
|
14275
|
+
case "ask_failed": return /* @__PURE__ */ jsx(SectionFailed, {
|
|
14276
|
+
title: body.title,
|
|
14277
|
+
onRetry: () => dispatch({ type: "retry" })
|
|
14278
|
+
});
|
|
14279
|
+
case "confirm": return /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
14280
|
+
/* @__PURE__ */ jsx(PortalButton, {
|
|
14281
|
+
type: "button",
|
|
14282
|
+
variant: "primary",
|
|
14283
|
+
block: true,
|
|
14284
|
+
label: body.label,
|
|
14285
|
+
onClick: () => {
|
|
14286
|
+
if (state.kind !== "bank_check") return;
|
|
14287
|
+
rememberInvoiceReturn(INVOICE_PARAM, state.payment.invoiceId);
|
|
14288
|
+
dispatch({ type: "confirm_bank" });
|
|
14289
|
+
}
|
|
14290
|
+
}),
|
|
14291
|
+
body.error ? /* @__PURE__ */ jsx("p", {
|
|
14292
|
+
className: "rb-portal-field-error rb-portal-mt-m",
|
|
14293
|
+
role: "alert",
|
|
14294
|
+
children: body.error
|
|
14295
|
+
}) : null,
|
|
14296
|
+
/* @__PURE__ */ jsx("p", {
|
|
14297
|
+
className: "rb-portal-muted rb-portal-small rb-portal-mt-m",
|
|
14298
|
+
children: body.hint
|
|
14299
|
+
})
|
|
14300
|
+
] });
|
|
14301
|
+
case "bank_open": return /* @__PURE__ */ jsx(PortalCard, { children: /* @__PURE__ */ jsx("p", {
|
|
14302
|
+
role: "status",
|
|
14303
|
+
children: body.text
|
|
14304
|
+
}) });
|
|
14305
|
+
case "card": return state.kind === "card" ? /* @__PURE__ */ jsx(CardForm, {
|
|
14306
|
+
body,
|
|
14307
|
+
payment: state.payment,
|
|
14308
|
+
dispatch
|
|
14309
|
+
}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
14310
|
+
case "checking":
|
|
14311
|
+
case "slow": return /* @__PURE__ */ jsxs(PortalCard, { children: [/* @__PURE__ */ jsx("p", {
|
|
14312
|
+
role: "status",
|
|
14313
|
+
children: body.text
|
|
14314
|
+
}), back ? /* @__PURE__ */ jsx(BackToPasses, {}) : null] });
|
|
14315
|
+
case "paid": return /* @__PURE__ */ jsxs(PortalCard, { children: [
|
|
14316
|
+
/* @__PURE__ */ jsx("h3", { children: body.heading }),
|
|
14317
|
+
body.lines.map((line) => /* @__PURE__ */ jsx("p", {
|
|
14318
|
+
className: "rb-portal-mt-s",
|
|
14319
|
+
children: line
|
|
14320
|
+
}, line)),
|
|
14321
|
+
/* @__PURE__ */ jsx(BackToPasses, {})
|
|
14322
|
+
] });
|
|
14323
|
+
case "nothing_to_pay": return /* @__PURE__ */ jsxs(PortalCard, { children: [/* @__PURE__ */ jsx("p", { children: body.text }), /* @__PURE__ */ jsx(BackToPasses, {})] });
|
|
14324
|
+
case "unavailable": return /* @__PURE__ */ jsx(PortalCard, { children: /* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx(TextParts, { parts: body.text }) }) });
|
|
14325
|
+
}
|
|
14326
|
+
}
|
|
14327
|
+
/**
|
|
14328
|
+
* The five site-style values the card form takes, as the browser resolves
|
|
14329
|
+
* them where the form sits, so every site style's own tokens and skins apply.
|
|
14330
|
+
*/
|
|
14331
|
+
function readPortalPaymentStyle(where) {
|
|
14332
|
+
const probe = document.createElement("span");
|
|
14333
|
+
probe.setAttribute("aria-hidden", "true");
|
|
14334
|
+
probe.style.cssText = "position:absolute;visibility:hidden;pointer-events:none;color:var(--rb-portal-card-text);background-color:var(--rb-portal-card-bg);border-top-left-radius:var(--rb-portal-radius-sm);outline-color:var(--rb-portal-current)";
|
|
14335
|
+
where.appendChild(probe);
|
|
14336
|
+
const computed = window.getComputedStyle(probe);
|
|
14337
|
+
const style = {
|
|
14338
|
+
fontFamily: window.getComputedStyle(where).fontFamily,
|
|
14339
|
+
text: computed.color,
|
|
14340
|
+
background: computed.backgroundColor,
|
|
14341
|
+
radius: computed.borderTopLeftRadius,
|
|
14342
|
+
primary: computed.outlineColor
|
|
14343
|
+
};
|
|
14344
|
+
probe.remove();
|
|
14345
|
+
return style;
|
|
14346
|
+
}
|
|
14347
|
+
const FORM_TIMEOUT_MS = 3e4;
|
|
14348
|
+
function usePaymentElement(payment, attempt, container, dispatch) {
|
|
14349
|
+
const mounted = React$1.useRef(null);
|
|
14350
|
+
React$1.useEffect(() => {
|
|
14351
|
+
const life = {
|
|
14352
|
+
active: true,
|
|
14353
|
+
element: null
|
|
14354
|
+
};
|
|
14355
|
+
const fail = () => {
|
|
14356
|
+
if (!life.active) return;
|
|
14357
|
+
life.active = false;
|
|
14358
|
+
life.element?.destroy();
|
|
14359
|
+
life.element = null;
|
|
14360
|
+
mounted.current = null;
|
|
14361
|
+
dispatch({ type: "form_failed" });
|
|
14362
|
+
};
|
|
14363
|
+
const timeout = window.setTimeout(fail, FORM_TIMEOUT_MS);
|
|
14364
|
+
const mount = async () => {
|
|
14365
|
+
const stripe = await loadBrowserStripe(payment.browser);
|
|
14366
|
+
if (!life.active) return;
|
|
14367
|
+
const where = container.current;
|
|
14368
|
+
if (!stripe || !where) throw new Error("Payment form unavailable");
|
|
14369
|
+
const elements = stripe.elements({
|
|
14370
|
+
clientSecret: payment.clientSecret,
|
|
14371
|
+
appearance: portalPaymentAppearance(readPortalPaymentStyle(where))
|
|
14372
|
+
});
|
|
14373
|
+
const element = elements.create("payment");
|
|
14374
|
+
life.element = element;
|
|
14375
|
+
element.on("ready", () => {
|
|
14376
|
+
window.clearTimeout(timeout);
|
|
14377
|
+
if (life.active) dispatch({ type: "form_ready" });
|
|
14378
|
+
});
|
|
14379
|
+
element.on("loaderror", fail);
|
|
14380
|
+
element.mount(where);
|
|
14381
|
+
mounted.current = {
|
|
14382
|
+
stripe,
|
|
14383
|
+
elements
|
|
14384
|
+
};
|
|
14385
|
+
};
|
|
14386
|
+
mount().catch(fail);
|
|
14387
|
+
return () => {
|
|
14388
|
+
life.active = false;
|
|
14389
|
+
window.clearTimeout(timeout);
|
|
14390
|
+
life.element?.destroy();
|
|
14391
|
+
mounted.current = null;
|
|
14392
|
+
};
|
|
14393
|
+
}, [
|
|
14394
|
+
payment.browser,
|
|
14395
|
+
payment.clientSecret,
|
|
14396
|
+
attempt,
|
|
14397
|
+
container,
|
|
14398
|
+
dispatch
|
|
14399
|
+
]);
|
|
14400
|
+
return mounted;
|
|
14401
|
+
}
|
|
14402
|
+
function CardForm({ body, payment, dispatch }) {
|
|
14403
|
+
const container = React$1.useRef(null);
|
|
14404
|
+
const mounted = usePaymentElement(payment, body.formAttempt, container, dispatch);
|
|
14405
|
+
const pay = async (event) => {
|
|
14406
|
+
event.preventDefault();
|
|
14407
|
+
const form = mounted.current;
|
|
14408
|
+
if (!form || body.form !== "ready" || body.busy) return;
|
|
14409
|
+
dispatch({ type: "pay_card" });
|
|
14410
|
+
rememberInvoiceReturn(INVOICE_PARAM, payment.invoiceId);
|
|
14411
|
+
const result = await form.stripe.confirmPayment({
|
|
14412
|
+
elements: form.elements,
|
|
14413
|
+
redirect: "if_required",
|
|
14414
|
+
confirmParams: { return_url: invoiceStripeReturnUrl(INVOICE_PARAM) }
|
|
14415
|
+
}).catch(() => null);
|
|
14416
|
+
if (!result) return dispatch({
|
|
14417
|
+
type: "card_done",
|
|
14418
|
+
outcome: { kind: "readback" }
|
|
14419
|
+
});
|
|
14420
|
+
if (result.error?.type === "validation_error") return dispatch({ type: "card_incomplete" });
|
|
14421
|
+
dispatch({
|
|
14422
|
+
type: "card_done",
|
|
14423
|
+
outcome: interpretConfirmPayment(result)
|
|
14424
|
+
});
|
|
14425
|
+
};
|
|
14426
|
+
return /* @__PURE__ */ jsx(PortalCard, { children: /* @__PURE__ */ jsxs("form", {
|
|
14427
|
+
onSubmit: (event) => void pay(event),
|
|
14428
|
+
noValidate: true,
|
|
14429
|
+
children: [body.form === "failed" ? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
|
|
14430
|
+
role: "alert",
|
|
14431
|
+
children: body.formFailed
|
|
14432
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
14433
|
+
className: "rb-portal-actions rb-portal-mt-m",
|
|
14434
|
+
children: /* @__PURE__ */ jsx(PortalButton, {
|
|
14435
|
+
type: "button",
|
|
14436
|
+
variant: "secondary",
|
|
14437
|
+
label: "Try again",
|
|
14438
|
+
onClick: () => dispatch({ type: "form_retry" })
|
|
14439
|
+
})
|
|
14440
|
+
})] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
14441
|
+
body.form === "loading" ? /* @__PURE__ */ jsx("p", {
|
|
14442
|
+
className: "rb-portal-muted",
|
|
14443
|
+
role: "status",
|
|
14444
|
+
children: "Loading the card form…"
|
|
14445
|
+
}) : null,
|
|
14446
|
+
/* @__PURE__ */ jsx("div", {
|
|
14447
|
+
ref: container,
|
|
14448
|
+
"data-portal": "payment-form"
|
|
14449
|
+
}),
|
|
14450
|
+
body.notice ? /* @__PURE__ */ jsx("p", {
|
|
14451
|
+
className: "rb-portal-field-error rb-portal-mt-m",
|
|
14452
|
+
role: "alert",
|
|
14453
|
+
children: body.notice
|
|
14454
|
+
}) : null,
|
|
14455
|
+
/* @__PURE__ */ jsx("div", {
|
|
14456
|
+
className: "rb-portal-actions rb-portal-mt-l",
|
|
14457
|
+
children: /* @__PURE__ */ jsx(PortalButton, {
|
|
14458
|
+
type: "submit",
|
|
14459
|
+
variant: "primary",
|
|
14460
|
+
block: true,
|
|
14461
|
+
disabled: body.form !== "ready" || body.busy,
|
|
14462
|
+
label: body.label
|
|
14463
|
+
})
|
|
14464
|
+
})
|
|
14465
|
+
] }), /* @__PURE__ */ jsx("p", {
|
|
14466
|
+
className: "rb-portal-muted rb-portal-small rb-portal-mt-m",
|
|
14467
|
+
children: body.smallPrint
|
|
14468
|
+
})]
|
|
14469
|
+
}) });
|
|
14470
|
+
}
|
|
14471
|
+
//#endregion
|
|
13586
14472
|
//#region ../blocks/src/portal/app/model/downloadsPage.ts
|
|
13587
14473
|
/** "4.2 MB", "820 KB". */
|
|
13588
14474
|
function fileSize(bytes) {
|
|
@@ -15245,9 +16131,18 @@ function detailsPageModel(view, context) {
|
|
|
15245
16131
|
newsletterTitle: `Emails from ${businessNameAtStart(context)}`,
|
|
15246
16132
|
newsletter: partOf(view.newsletter, ({ newsletter }) => newsletterModel(newsletter, contact, context)),
|
|
15247
16133
|
newsletterFootnote: "Newsletter choices don't change the emails about your bookings and payments, like confirmations, reminders and receipts.",
|
|
15248
|
-
terms: partOf(view.terms, ({ agreement }) => agreement ? termsModel(agreement, context) : null)
|
|
16134
|
+
terms: partOf(view.terms, ({ agreement }) => agreement ? termsModel(agreement, context) : null),
|
|
16135
|
+
dataRequest: dataRequestLine(contact, context)
|
|
15249
16136
|
};
|
|
15250
16137
|
}
|
|
16138
|
+
/** "Want a copy of your data, or your details removed? Email Hollow Oak", the name opening an email. */
|
|
16139
|
+
function dataRequestLine(contact, context) {
|
|
16140
|
+
return contact.email ? [textPart("Want a copy of your data, or your details removed? "), {
|
|
16141
|
+
kind: "email",
|
|
16142
|
+
address: contact.email,
|
|
16143
|
+
label: `Email ${businessName(context)}`
|
|
16144
|
+
}] : null;
|
|
16145
|
+
}
|
|
15251
16146
|
function termsModel(agreement, context) {
|
|
15252
16147
|
const date = portalFullDate(agreement.agreedAt, context.site);
|
|
15253
16148
|
return {
|
|
@@ -15595,7 +16490,12 @@ function DetailsPage({ session, onSignOut }) {
|
|
|
15595
16490
|
onClick: onSignOut
|
|
15596
16491
|
})
|
|
15597
16492
|
})]
|
|
15598
|
-
})
|
|
16493
|
+
}),
|
|
16494
|
+
page.dataRequest ? /* @__PURE__ */ jsx("p", {
|
|
16495
|
+
className: "rb-portal-muted rb-portal-small",
|
|
16496
|
+
"data-portal": "data-request",
|
|
16497
|
+
children: /* @__PURE__ */ jsx(TextParts, { parts: page.dataRequest })
|
|
16498
|
+
}) : null
|
|
15599
16499
|
]
|
|
15600
16500
|
});
|
|
15601
16501
|
}
|
|
@@ -16475,6 +17375,11 @@ function PortalPage({ session, route, you, options }) {
|
|
|
16475
17375
|
onSignOut: () => options.onSignOut(route)
|
|
16476
17376
|
});
|
|
16477
17377
|
case "passes": return /* @__PURE__ */ jsx(PassesPage, { session });
|
|
17378
|
+
case "membership_payment": return /* @__PURE__ */ jsx(MembershipPaymentPage, {
|
|
17379
|
+
session,
|
|
17380
|
+
customerMembershipId: route.customerMembershipId,
|
|
17381
|
+
invoiceId: route.invoiceId ?? null
|
|
17382
|
+
}, route.customerMembershipId);
|
|
16478
17383
|
case "downloads": return /* @__PURE__ */ jsx(DownloadsPage, { session });
|
|
16479
17384
|
case "payments": return /* @__PURE__ */ jsx(PaymentsPage, { session });
|
|
16480
17385
|
case "order": return /* @__PURE__ */ jsx(OrderPage, {
|
|
@@ -16545,6 +17450,7 @@ function PortalApp(props) {
|
|
|
16545
17450
|
props.bookingRoute,
|
|
16546
17451
|
props.logoutPath
|
|
16547
17452
|
]);
|
|
17453
|
+
useSignedOutRewrite(portalToken === null ? initialLocation.rewrite : null);
|
|
16548
17454
|
return /* @__PURE__ */ jsx("div", {
|
|
16549
17455
|
className: ["rb-portal", props.className].filter(Boolean).join(" "),
|
|
16550
17456
|
"data-portal": "root",
|
|
@@ -16562,6 +17468,18 @@ function PortalApp(props) {
|
|
|
16562
17468
|
})
|
|
16563
17469
|
});
|
|
16564
17470
|
}
|
|
17471
|
+
/**
|
|
17472
|
+
* Signed in, the router tidies the address (see usePortalNavigation); signed
|
|
17473
|
+
* out it never runs, so the entry does the same here. That drops what the
|
|
17474
|
+
* address shouldn't keep, such as Stripe's client secret on a return from a
|
|
17475
|
+
* bank, while the page's own query (the invoice being paid) stays in the route
|
|
17476
|
+
* the sign-in link brings them back to.
|
|
17477
|
+
*/
|
|
17478
|
+
function useSignedOutRewrite(rewrite) {
|
|
17479
|
+
React$1.useEffect(() => {
|
|
17480
|
+
if (rewrite) window.history.replaceState(window.history.state, "", `${rewrite}${window.location.hash}`);
|
|
17481
|
+
}, [rewrite]);
|
|
17482
|
+
}
|
|
16565
17483
|
function SignedInPortal({ api, initialLocation, options }) {
|
|
16566
17484
|
return /* @__PURE__ */ jsx(PortalShell, {
|
|
16567
17485
|
session: usePortalSession(api, initialLocation),
|