@riverbankcms/sdk 0.184.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/dist/_dts/{BlocksIslandsHydrator-DjBTJYiF.d.ts → BlocksIslandsHydrator-Bu0O7l4p.d.ts} +1 -1
- package/dist/_dts/{Page-BpXEM2ET.d.ts → Page-DYoL0IWL.d.ts} +7 -7
- package/dist/_dts/{SdkPreviewMode-Bb3h7KRE.d.ts → SdkPreviewMode-DgFAiR8r.d.ts} +2 -2
- package/dist/_dts/{client-DgTRRtl_.d.ts → client-BKdjJ7A0.d.ts} +23 -4
- package/dist/_dts/{content-types-DZQJp_ak.d.ts → content-types-6K7zlJuF.d.ts} +2 -2
- package/dist/_dts/{contracts-Ww1fmd-c.d.ts → contracts-CUR8ccnX.d.ts} +3 -3
- package/dist/_dts/{generatePageMetadata-BGc7dju6.d.ts → generatePageMetadata-CveWSMew.d.ts} +2 -2
- package/dist/_dts/{index-Cni4jykw.d.ts → index-6WypKfbu.d.ts} +4 -4
- package/dist/_dts/{index-ukS-Ffem.d.ts → index-BMwrFX_K.d.ts} +1 -1
- package/dist/_dts/{index-W9-7djG3.d.ts → index-Bp5lk6I8.d.ts} +1 -1
- package/dist/_dts/{index-Cc85KVLW.d.ts → index-DTKn1H8g.d.ts} +1 -1
- package/dist/_dts/{index-DxxTQ_0V.d.ts → index-DX-Xe54X.d.ts} +2 -2
- package/dist/_dts/{index-BECaUNYs.d.ts → index-SD1fTP_7.d.ts} +2 -2
- package/dist/_dts/{loadContent-BlSWTlbD.d.ts → loadContent-BN8GtRsL.d.ts} +7 -7
- package/dist/_dts/{request-CZz2BoXJ.d.ts → request-BwYvMqLf.d.ts} +459 -109
- package/dist/_dts/{resolveBlockData-D12HXnS3.d.ts → resolveBlockData-CYy0VlSK.d.ts} +5 -5
- package/dist/_dts/{resolvePageContent-BteMsSGP.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 +1 -1
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
- package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{serviceBookingOutline-aTlOvO3U.d.ts → serviceBookingOutline-CMNev0gz.d.ts} +10 -7
- package/dist/_dts/{types-CCcQlRBi.d.ts → types-BBazdRQf.d.ts} +3 -3
- package/dist/_dts/{types-Du4aMnWC.d.ts → types-BwngWRQ8.d.ts} +7 -7
- package/dist/_dts/{types-Bi7R07RX.d.ts → types-C9_amrul.d.ts} +2 -2
- package/dist/_dts/{validation-CjCWVmwe.d.ts → validation-B58kUTuV.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CFLWxjxR.mjs → BlocksIslandsHydrator-CooOPhs3.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-C4LcfwyA.mjs → BookingMailingListNote-D_khdttF.mjs} +59 -60
- package/dist/client/{BookingQuestionFields-DdcmoHqQ.mjs → BookingQuestionFields-Bia1E7Cj.mjs} +48 -35
- package/dist/client/{CalendarAction-DYGewmvh.mjs → CalendarAction-C-AbMmct.mjs} +1 -1
- package/dist/client/{CalendarNavigationChevron-ZfrUiiiI.mjs → CalendarNavigationChevron-oaHxRbUO.mjs} +6 -6
- package/dist/client/{DemoBookingPortalAccess-pzkGVkgG.mjs → DemoBookingPortalAccess-M2xKYQjX.mjs} +4 -4
- package/dist/client/{EventCalendar.client-Ct1B3xI4.mjs → EventCalendar.client-By7e9nyF.mjs} +10 -10
- package/dist/client/{EventCombined.client-DgfNtcgW.mjs → EventCombined.client-BdRZXB14.mjs} +9 -9
- package/dist/client/EventEmbeddedCheckoutStep-CJoxbx2Y.mjs +147 -0
- package/dist/client/{EventItem-KGKkK19N.mjs → EventItem-CDMa9zOX.mjs} +4 -4
- package/dist/client/{EventListWeekNavigation-Ba9ezxuC.mjs → EventListWeekNavigation-B8WKaCrN.mjs} +1 -1
- package/dist/client/{EventListing.client-xFKRDLwC.mjs → EventListing.client-BEGiiFnO.mjs} +3 -3
- package/dist/client/{EventListing.view-Dy36vWHi.mjs → EventListing.view-B6LOK-z4.mjs} +5 -5
- package/dist/client/{EventRegistrationPayment-Dth9L00x.mjs → EventRegistrationPayment-CARdr15t.mjs} +44 -35
- package/dist/client/{Page-DB5KODiu.mjs → Page-uP7AKSyp.mjs} +37 -30
- package/dist/client/SiteChoiceGroup-BZ5I0Vhy.mjs +96 -0
- package/dist/client/{SiteTermsAgreementField-BDVP_HeK.mjs → SiteTermsAgreementField-BDqRo2C5.mjs} +2 -2
- package/dist/client/{StepIndicator-CLgDVzCs.mjs → StepIndicator-BWrXAKvs.mjs} +1 -1
- package/dist/client/{StepIndicator-DRyZ8igu.mjs → StepIndicator-Cb3NMw-Y.mjs} +29 -17
- package/dist/client/{accessibleSurfaces-CqroimVQ.mjs → accessibleSurfaces-q-dDOwsW.mjs} +5 -3
- package/dist/client/{accordion-BQYRP5xV.mjs → accordion-BYW2YSUN.mjs} +1 -1
- package/dist/client/{booking-form.client-B7ckDuOC.mjs → booking-form.client-DAlWWWjV.mjs} +108 -70
- package/dist/client/{bookingCalendar--aWnqFDn.mjs → bookingCalendar-9nFa_do4.mjs} +6 -2
- package/dist/client/{bookingForm-BeD4650p.mjs → bookingForm-DtVk9p5l.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{boxStyleClassNames-CA7FirMH.mjs → boxStyleClassNames-CaSq3-r-.mjs} +2 -2
- package/dist/client/{EventEmbeddedCheckoutStep-CjoaG1zy.mjs → browserStripe-Dh-LcDoW.mjs} +36 -142
- package/dist/client/{carousel-DJ9Aa1m3.mjs → carousel-msur7fxW.mjs} +1 -1
- package/dist/client/{cart-DdCenbTy.mjs → cart-Bx-JuY2n.mjs} +3 -3
- package/dist/client/{cart.client-BQm06qNw.mjs → cart.client-hB_9MimN.mjs} +1 -1
- package/dist/client/{checkout-45wPQULN.mjs → checkout-BVWZn5Qu.mjs} +3 -3
- package/dist/client/{checkout.client-bSv4cc5z.mjs → checkout.client-Bt_GtHW9.mjs} +1 -1
- package/dist/client/{checkoutUrls-CwlaMl3W.mjs → checkoutUrls-CP-rQOZV.mjs} +1 -1
- package/dist/client/client.mjs +43 -18
- package/dist/client/{constants-DXV4KR7l.mjs → constants-yA1RJGXD.mjs} +1 -1
- package/dist/client/{context-lCPfX-xe.mjs → context-CG77Keax.mjs} +30 -3
- package/dist/client/{dateFormatting-HvfmS_cH.mjs → dateFormatting-DIRIgfYr.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-Ce3Gyin_.mjs → demoPortalMagicLink-CgzNiOQ0.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-CGcDE9aE.mjs → enhanceHeaderSection-DgzZNM2M.mjs} +3 -3
- package/dist/client/{event-registration.client-DlPfn4YG.mjs → event-registration.client-Ckb4aDE9.mjs} +79 -58
- package/dist/client/{eventCalendar-CioAdryV.mjs → eventCalendar-lqqQSzBQ.mjs} +4 -4
- package/dist/client/{eventCombined-Dwt0G6ez.mjs → eventCombined-BIMyHrd-.mjs} +4 -4
- package/dist/client/{eventListing-B3H9ifOC.mjs → eventListing-CBYxfvNf.mjs} +4 -4
- package/dist/client/{eventRegistration-Do7cAhXb.mjs → eventRegistration-BhAqvkCb.mjs} +4 -4
- package/dist/client/{form-CsqzgC6v.mjs → form-CkOfk-Eb.mjs} +3 -3
- package/dist/client/{form.client-DVDB7hY6.mjs → form.client-Whi43oio.mjs} +4 -4
- package/dist/client/{form.parts-1q2rzSYt.mjs → form.parts-BgsWo2Me.mjs} +1 -1
- package/dist/client/gifting/client.mjs +7 -7
- package/dist/client/{gifting-BrXQGX-k.mjs → gifting-XtNpLcFI.mjs} +4 -4
- package/dist/client/{gifting.client--zAjnY5N.mjs → gifting.client-CraWj4I4.mjs} +173 -71
- package/dist/client/{gifting.interactive-CrwHpUJG.mjs → gifting.interactive-DiPDObN0.mjs} +3 -2
- package/dist/client/{gifting.parts-CcKdDaQq.mjs → gifting.parts-_mgGOcbA.mjs} +12 -43
- package/dist/client/{headerSection-DlcDH4bi.mjs → headerSection-CPIN3VSU.mjs} +2 -2
- package/dist/client/{islands-dMh0Oxli.mjs → islands-C95FyxUF.mjs} +11 -9
- package/dist/client/{newsletter-form.client-BxA1PsdS.mjs → newsletter-form.client-BgVJdKVe.mjs} +6 -6
- package/dist/client/{newsletter-form.interactive-D0iRg7p2.mjs → newsletter-form.interactive-DpcfRbI_.mjs} +35 -15
- package/dist/client/{newsletter-form.parts-Dmuklz0r.mjs → newsletter-form.parts-poPgHrUh.mjs} +1 -1
- package/dist/client/{newsletterForm-CBzvgIfg.mjs → newsletterForm-Dt6wFjTe.mjs} +3 -3
- package/dist/client/portal/client.mjs +978 -72
- package/dist/client/{portalOrders-tCxS04g0.mjs → portalOrders-CAfjTyV9.mjs} +1 -1
- package/dist/client/{portalRoutes-DiGibcZI.mjs → portalRoutes-D3Ttfv5x.mjs} +48 -13
- package/dist/client/presentation-CudSUZ6Q.mjs +169 -0
- package/dist/client/{product-detail.client-D9MP8hvH.mjs → product-detail.client-BrBNT7Mq.mjs} +1 -1
- package/dist/client/{product-list.client-wCz1qcUY.mjs → product-list.client-CftTl7n6.mjs} +1 -1
- package/dist/client/{productDetail-D9-fCY6c.mjs → productDetail-b1tpt585.mjs} +3 -3
- package/dist/client/{productList-PJyxXSac.mjs → productList-DRT5sabi.mjs} +3 -3
- package/dist/client/{propsDecoder-B8lrKGPw.mjs → propsDecoder-Co1VXFaW.mjs} +4 -4
- package/dist/client/{registry.server-CI63JVHW.mjs → registry.server-0UDNY7dO.mjs} +185 -224
- package/dist/client/rendering/client.mjs +23 -23
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +5 -5
- package/dist/client/{richText-coerce-Jt9hDHdh.mjs → richText-coerce-BFDEPZZA.mjs} +2 -2
- package/dist/client/{routeIslandApiConfig-ZSPcJWx1.mjs → routeIslandApiConfig-DtqRutuX.mjs} +1 -1
- package/dist/client/{runtimeResponse-_iW9oEYc.mjs → runtimeResponse-DBVXbcuz.mjs} +1 -1
- package/dist/client/runtimeResponse-LQnQdtNI.mjs +3 -0
- package/dist/client/{shop-CbdJlWOw.mjs → shop-DL3CYR7i.mjs} +3 -3
- package/dist/client/{shop-commerce-BqLbzUUn.mjs → shop-commerce-CDth2_qq.mjs} +13 -13
- package/dist/client/{shop-commerce-store-BT0-zRqN.mjs → shop-commerce-store-CE0aaSHJ.mjs} +1 -1
- package/dist/client/{shop-discount-apply.state-Cws0lnSb.mjs → shop-discount-apply.state-p4aXtVsF.mjs} +2 -2
- package/dist/client/{shop.client-0cNErhJT.mjs → shop.client-BI2iw6Z3.mjs} +56 -21
- package/dist/client/{shopShared-COuQ2MhQ.mjs → shopShared-BNWzgWAC.mjs} +2 -2
- 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-DqI6U1BS.mjs → timetableModel-DZzGD6rS.mjs} +8 -8
- package/dist/client/{useAutomaticDiscountPreview-CeVUVzGf.mjs → useAutomaticDiscountPreview-CJDylOUe.mjs} +1 -1
- package/dist/client/{useAvailableSlots-B0mjVhZr.mjs → useAvailableSlots-nD6nuvSW.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-B_hfgdAP.mjs → useDiscountCodeUi-DMtTHqex.mjs} +1 -1
- package/dist/client/{useEventPagination-Ct4A6iR1.mjs → useEventPagination-CM-DCokc.mjs} +7 -7
- package/dist/client/{view-Cj151w4m.mjs → view-CHOhliHv.mjs} +3 -3
- package/dist/client/{wizardSteps-B3gsXNnb.mjs → wizardSteps-BbroaNkT.mjs} +68 -22
- package/dist/preview-next/client/{PageSectionToolbar-Dv4CW0AQ.mjs → PageSectionToolbar-CR99z8BL.mjs} +3 -3
- package/dist/preview-next/client/{PreviewEditorSidebar-B7WW58uE.mjs → PreviewEditorSidebar-BaKS6H8F.mjs} +6 -6
- package/dist/preview-next/client/{PreviewEditorUI-BnJ1ughv.mjs → PreviewEditorUI-D6IG119o.mjs} +4 -4
- package/dist/preview-next/client/{PreviewShell-C7qWzAe4.mjs → PreviewShell-CKjkFOZS.mjs} +5 -5
- package/dist/preview-next/client/{SdkPreviewModeRuntime-CYi4UHtG.mjs → SdkPreviewModeRuntime-BexDQWGj.mjs} +4 -4
- package/dist/preview-next/client/{previewAssistantSlot-DrUoRNu9.mjs → previewAssistantSlot-DcEwU9l_.mjs} +977 -505
- package/dist/preview-next/client/{previewChromeRoot-CEYp90mM.mjs → previewChromeRoot-VqseF0yf.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-DnO2_c0A.mjs → sdk-runtime-DcoVpKUf.mjs} +2 -2
- package/dist/preview-next/client/{siteStyleAccess-B3PwHw2z.mjs → siteStyleAccess-BL1fZnUD.mjs} +1 -1
- 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-DrdQ4ier.mjs → useAutosaveStatus-CdFnzKac.mjs} +2 -2
- package/dist/preview-next/client/{useOpenBlockForSetup-kuGRKaRL.mjs → useOpenBlockForSetup-B62h7dhR.mjs} +1 -1
- package/dist/preview-next/container-responsive.css +8 -0
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-CwrXkLT3.mjs → route-contract-CQfEvfbg.mjs} +38 -13
- package/dist/server/{Block.shared-C5ucphCJ.mjs → Block.shared-CbGnxkWX.mjs} +5 -5
- package/dist/server/{ThemeScopeCore-DvbqYXdK.mjs → ThemeScopeCore-BjxlpVaV.mjs} +5 -5
- package/dist/server/{accessibleSurfaces-CAcf1lHT.mjs → accessibleSurfaces-CZ7pLuJ7.mjs} +2 -2
- package/dist/server/{accordions-DjcsqjCK.mjs → accordions-C_C52VkS.mjs} +1 -1
- package/dist/server/{bindings-CFw4M-gZ.mjs → bindings-D-n66Oqc.mjs} +5 -5
- package/dist/server/{client-D0XCgITW.mjs → client-BGGlrkft.mjs} +41 -16
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{constants-BZduY8jG.mjs → constants-TkO9Uxma.mjs} +45 -10
- package/dist/server/data/resolveBlockData.mjs +1 -1
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-C-qyB8Tq.mjs → loadContent-8H1hHdXo.mjs} +4 -4
- package/dist/server/{loadPage-BpKKmi8E.mjs → loadPage-BZyqF_g3.mjs} +3 -3
- package/dist/server/{lookMediaFrame-EFws7tAj.mjs → lookMediaFrame-Dw6R9B0L.mjs} +13 -11
- package/dist/server/manifest.mjs +2 -2
- package/dist/server/{navigation-DYkuiNXa.mjs → navigation-9TOyY5Zf.mjs} +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +9 -9
- package/dist/server/{overrideResolution-DmZn4xUE.mjs → overrideResolution-CuduOS6V.mjs} +1 -1
- package/dist/server/page-converter.mjs +3 -3
- package/dist/server/{pageRenderPlan-DRB7cUZ0.mjs → pageRenderPlan-DmP0HVMu.mjs} +30 -8
- package/dist/server/{pageRuntimeSupport-Uv1xDieJ.mjs → pageRuntimeSupport-BQ1dWs1V.mjs} +3 -3
- package/dist/server/{pageShared-BdQF875z.mjs → pageShared-ALu7y5Dq.mjs} +272 -165
- package/dist/server/{parseThemeForPersistence-CwcWZL7u.mjs → parseThemeForPersistence-D_8I28BB.mjs} +3 -3
- package/dist/server/{portal-BQ8qiQnk.mjs → portal-P4oHSRho.mjs} +2 -1
- package/dist/server/portal.mjs +2 -2
- package/dist/server/{prebuild-B51QZVNe.mjs → prebuild-BLL6RhjS.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CppDAfJW.mjs → prefetchBlockData-aR5W1dVF.mjs} +3 -3
- package/dist/server/{registry-Bf4W8Qa7.mjs → registry-DD_s7l3Y.mjs} +82 -33
- 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-DMHAZooQ.mjs → resolveBlockData-DnQ2N0lI.mjs} +2 -2
- package/dist/server/{resolveButtonColourStates-BMtAAPzp.mjs → resolveButtonColourStates-ChlP4NJ9.mjs} +1 -1
- package/dist/server/{responseMedia-DKYfR518.mjs → responseMedia-D6F1tvIm.mjs} +1 -1
- package/dist/server/{schema-DGaihVwp.mjs → schema-ClDfFtz2.mjs} +3 -3
- package/dist/server/server.mjs +3 -3
- package/dist/server/{servicePageContent-CRvmreX7.mjs → servicePageContent-CsUerbJ1.mjs} +14 -12
- package/dist/server/theme-bridge.mjs +3 -3
- package/dist/server/theme.mjs +2 -2
- package/dist/server/{three-pass-converter-mcy2E1Yd.mjs → three-pass-converter-CLJrZb7s.mjs} +1 -1
- package/dist/server/{titleSourceSchema-B2qFOUwZ.mjs → titleSourceSchema-DA_iErtG.mjs} +2 -2
- package/dist/server/{types-C_S0pWbR.mjs → types-CcKy8_tj.mjs} +5 -3
- package/dist/server/{validation-CUtNT_EZ.mjs → validation-BbImAsVs.mjs} +5 -5
- package/dist/server/{version-DebJQ4zn.mjs → version-BY48jPoe.mjs} +1 -1
- package/dist/styles/index.css +192 -134
- package/package.json +1 -1
- package/dist/client/appointment-service-categories-Cl2pqw-z.mjs +0 -70
- package/dist/client/runtimeResponse-DlPBWBd9.mjs +0 -3
- package/dist/client/src-DqMbCjI1.mjs +0 -3
- package/dist/preview-next/client/src-EO5QoRlU.mjs +0 -3
|
@@ -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,
|
|
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";
|
|
11
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",
|
|
@@ -5383,14 +5461,28 @@ function payTask$1(task, contact, context) {
|
|
|
5383
5461
|
}, "quiet") : null
|
|
5384
5462
|
};
|
|
5385
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
|
+
*/
|
|
5386
5473
|
function membershipTask$1(task, contact, context) {
|
|
5474
|
+
const line = membershipPaymentFailedLine(task, context, task.membershipName);
|
|
5475
|
+
const id = membershipTaskId(task);
|
|
5387
5476
|
return {
|
|
5388
5477
|
key: task.key,
|
|
5389
5478
|
urgent: task.urgent,
|
|
5390
5479
|
title: `Your last payment for ${task.membershipName} didn't go through`,
|
|
5391
|
-
text:
|
|
5480
|
+
text: id ? line ? [textPart(line)] : [] : membershipText(line, contact, context),
|
|
5392
5481
|
sub: null,
|
|
5393
|
-
action: portalLink("
|
|
5482
|
+
action: id ? portalLink("Fix payment", {
|
|
5483
|
+
page: "membership_payment",
|
|
5484
|
+
customerMembershipId: id
|
|
5485
|
+
}, "quiet") : portalLink("See membership", { page: "passes" }, "quiet")
|
|
5394
5486
|
};
|
|
5395
5487
|
}
|
|
5396
5488
|
/** A kind of task this page doesn't know yet: still shown, so the list never claims there's nothing waiting. */
|
|
@@ -5492,6 +5584,20 @@ function downloadsRow(part) {
|
|
|
5492
5584
|
target: { page: "downloads" }
|
|
5493
5585
|
}];
|
|
5494
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
|
+
}
|
|
5495
5601
|
function summaryRows(view, context) {
|
|
5496
5602
|
return [
|
|
5497
5603
|
{
|
|
@@ -5504,7 +5610,7 @@ function summaryRows(view, context) {
|
|
|
5504
5610
|
key: "passes",
|
|
5505
5611
|
title: "Passes & memberships",
|
|
5506
5612
|
line: passesLine(view.summaries.passes),
|
|
5507
|
-
target:
|
|
5613
|
+
target: passesTarget(view)
|
|
5508
5614
|
},
|
|
5509
5615
|
{
|
|
5510
5616
|
key: "payments",
|
|
@@ -6044,7 +6150,7 @@ function cantAnswer(detail, context) {
|
|
|
6044
6150
|
text: `${these}. ${one ? "It’s" : "They’re"} optional, so you can send the rest without ${one ? "it" : "them"}.`
|
|
6045
6151
|
};
|
|
6046
6152
|
}
|
|
6047
|
-
function dueLine(detail, late, context) {
|
|
6153
|
+
function dueLine$1(detail, late, context) {
|
|
6048
6154
|
const by = portalSentenceDate(detail.dueAt, context.site, context.now);
|
|
6049
6155
|
if (late) return by ? `These were wanted by ${by}, but you can still send them.` : "You can still send these.";
|
|
6050
6156
|
return by ? `Please send your answers by ${by}.` : null;
|
|
@@ -6089,7 +6195,7 @@ function questionsPageModel(detail, context) {
|
|
|
6089
6195
|
intro,
|
|
6090
6196
|
mode: {
|
|
6091
6197
|
kind: "ask",
|
|
6092
|
-
due: dueLine(detail, answering.late, context),
|
|
6198
|
+
due: dueLine$1(detail, answering.late, context),
|
|
6093
6199
|
required: requiredLine(detail),
|
|
6094
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.",
|
|
6095
6201
|
cantAnswer: cantAnswer(detail, context)
|
|
@@ -6143,7 +6249,7 @@ function begin(sections, state) {
|
|
|
6143
6249
|
request: state.values
|
|
6144
6250
|
};
|
|
6145
6251
|
}
|
|
6146
|
-
function answered$
|
|
6252
|
+
function answered$2(state, answer) {
|
|
6147
6253
|
switch (answer.kind) {
|
|
6148
6254
|
case "done": return {
|
|
6149
6255
|
...state,
|
|
@@ -6199,7 +6305,7 @@ function questionsTask(sections) {
|
|
|
6199
6305
|
return {
|
|
6200
6306
|
reduce,
|
|
6201
6307
|
begin: (state) => begin(sections, state),
|
|
6202
|
-
answered: answered$
|
|
6308
|
+
answered: answered$2
|
|
6203
6309
|
};
|
|
6204
6310
|
}
|
|
6205
6311
|
function questionsSendBar(task) {
|
|
@@ -10861,7 +10967,7 @@ function PortalQuestion({ field, number, value, error, disabled, idPrefix, onCha
|
|
|
10861
10967
|
}) : null
|
|
10862
10968
|
] });
|
|
10863
10969
|
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10864
|
-
|
|
10970
|
+
isFieldsetQuestion(field) ? /* @__PURE__ */ jsx("legend", { children: label }) : /* @__PURE__ */ jsx("label", {
|
|
10865
10971
|
htmlFor: inputId,
|
|
10866
10972
|
children: label
|
|
10867
10973
|
}),
|
|
@@ -10889,24 +10995,14 @@ function PortalQuestion({ field, number, value, error, disabled, idPrefix, onCha
|
|
|
10889
10995
|
return /* @__PURE__ */ jsx("div", {
|
|
10890
10996
|
className: `rb-portal-field${error ? " rb-portal-field--error" : ""}`,
|
|
10891
10997
|
"data-portal": "field",
|
|
10892
|
-
children:
|
|
10998
|
+
children: isFieldsetQuestion(field) ? /* @__PURE__ */ jsx(QuestionFieldset, {
|
|
10893
10999
|
field,
|
|
10894
|
-
control,
|
|
11000
|
+
describedBy: control["aria-describedby"],
|
|
11001
|
+
required: Boolean(field.required),
|
|
10895
11002
|
children: body
|
|
10896
11003
|
}) : body
|
|
10897
11004
|
});
|
|
10898
11005
|
}
|
|
10899
|
-
/** A choice group is a fieldset: the question is its legend, and the group carries required state and descriptions. */
|
|
10900
|
-
function ChoiceGroup({ field, control, children }) {
|
|
10901
|
-
return /* @__PURE__ */ jsx("fieldset", {
|
|
10902
|
-
"aria-describedby": control["aria-describedby"],
|
|
10903
|
-
...field.type === "radio" ? {
|
|
10904
|
-
role: "radiogroup",
|
|
10905
|
-
"aria-required": control["aria-required"]
|
|
10906
|
-
} : {},
|
|
10907
|
-
children
|
|
10908
|
-
});
|
|
10909
|
-
}
|
|
10910
11006
|
//#endregion
|
|
10911
11007
|
//#region ../blocks/src/portal/app/pages/QuestionsPage.tsx
|
|
10912
11008
|
const UPLOAD_FAILED = "We couldn't upload that file. Please try again.";
|
|
@@ -11943,7 +12039,7 @@ function listLoaded(state, page, append) {
|
|
|
11943
12039
|
}
|
|
11944
12040
|
};
|
|
11945
12041
|
}
|
|
11946
|
-
function answered(state, result) {
|
|
12042
|
+
function answered$1(state, result) {
|
|
11947
12043
|
if (state.submission.kind === "idle") return state;
|
|
11948
12044
|
if (result.moved) return {
|
|
11949
12045
|
status: "done",
|
|
@@ -12055,7 +12151,7 @@ function onAnswer(state, answer) {
|
|
|
12055
12151
|
},
|
|
12056
12152
|
message: RESCHEDULE_UNCERTAIN_MESSAGE
|
|
12057
12153
|
};
|
|
12058
|
-
case "done": return answered(state, answer.value);
|
|
12154
|
+
case "done": return answered$1(state, answer.value);
|
|
12059
12155
|
}
|
|
12060
12156
|
}
|
|
12061
12157
|
function reduceReschedule(state, event) {
|
|
@@ -12918,9 +13014,9 @@ function partOf(part, read) {
|
|
|
12918
13014
|
const nonEmpty = (items) => items.length > 0 ? items : null;
|
|
12919
13015
|
//#endregion
|
|
12920
13016
|
//#region ../blocks/src/portal/app/model/passesPage.ts
|
|
12921
|
-
const money = (value) => formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
13017
|
+
const money$1 = (value) => formatCurrencyAmount(value.amountCents, value.currency, { decimals: "auto" });
|
|
12922
13018
|
function priceLine(membership) {
|
|
12923
|
-
return membership.price ? `${money(membership.price)} a ${membership.interval}` : null;
|
|
13019
|
+
return membership.price ? `${money$1(membership.price)} a ${membership.interval}` : null;
|
|
12924
13020
|
}
|
|
12925
13021
|
const text = textPart;
|
|
12926
13022
|
/** What a running membership's card adds for where it stands. */
|
|
@@ -12928,7 +13024,7 @@ function runningCard({ membership, base, date, lastDay, coveredUntil, context },
|
|
|
12928
13024
|
switch (standing.kind) {
|
|
12929
13025
|
case "renewing": {
|
|
12930
13026
|
const next = membership.paymentTrouble ? null : date(standing.nextPaymentAt);
|
|
12931
|
-
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]] : [];
|
|
12932
13028
|
return {
|
|
12933
13029
|
...base,
|
|
12934
13030
|
facts: [...base.facts, ...nextFact],
|
|
@@ -12984,6 +13080,7 @@ function standingCard(input) {
|
|
|
12984
13080
|
label: "Ended"
|
|
12985
13081
|
},
|
|
12986
13082
|
problem: null,
|
|
13083
|
+
fixPayment: null,
|
|
12987
13084
|
facts: [],
|
|
12988
13085
|
compact: true,
|
|
12989
13086
|
canCancel: false,
|
|
@@ -12998,12 +13095,23 @@ function standingCard(input) {
|
|
|
12998
13095
|
};
|
|
12999
13096
|
}
|
|
13000
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
|
+
}
|
|
13001
13108
|
function membershipCard(membership, contact, context) {
|
|
13002
13109
|
const date = (value) => value ? portalSentenceDate(value, context.site, context.now) : null;
|
|
13003
13110
|
const lastDay = (value) => value ? portalSentenceLastDay(value, context.site, context.now) : null;
|
|
13004
13111
|
const coveredUntil = (value) => value ? portalSentenceCoveredUntil(value, context.site, context.now) : null;
|
|
13005
13112
|
const since = date(membership.since);
|
|
13006
13113
|
const trouble = membership.paymentTrouble;
|
|
13114
|
+
const fixPayment = trouble ? fixPaymentAction(membership) : null;
|
|
13007
13115
|
return standingCard({
|
|
13008
13116
|
membership,
|
|
13009
13117
|
base: {
|
|
@@ -13014,7 +13122,8 @@ function membershipCard(membership, contact, context) {
|
|
|
13014
13122
|
tone: "problem",
|
|
13015
13123
|
label: "Last payment didn't go through"
|
|
13016
13124
|
} : null,
|
|
13017
|
-
problem: trouble ?
|
|
13125
|
+
problem: trouble ? problemText(membershipPaymentFailedLine(trouble, context), fixPayment !== null, contact, context) : null,
|
|
13126
|
+
fixPayment,
|
|
13018
13127
|
note: null,
|
|
13019
13128
|
facts: since ? [["Member since", since]] : [],
|
|
13020
13129
|
compact: false,
|
|
@@ -13194,7 +13303,7 @@ function creditEntry(entry, context) {
|
|
|
13194
13303
|
const line = creditLine(entry, context);
|
|
13195
13304
|
const on = portalSentenceDate(entry.at, context.site, context.now);
|
|
13196
13305
|
const incoming = entry.amount.amountCents >= 0;
|
|
13197
|
-
const size = money({
|
|
13306
|
+
const size = money$1({
|
|
13198
13307
|
...entry.amount,
|
|
13199
13308
|
amountCents: Math.abs(entry.amount.amountCents)
|
|
13200
13309
|
});
|
|
@@ -13210,10 +13319,10 @@ function creditEntry(entry, context) {
|
|
|
13210
13319
|
}
|
|
13211
13320
|
function creditModel(account, context) {
|
|
13212
13321
|
return {
|
|
13213
|
-
available: money(account.available),
|
|
13214
|
-
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,
|
|
13215
13324
|
history: account.history.map((entry) => creditEntry(entry, context)),
|
|
13216
|
-
balance: `Balance: ${money({
|
|
13325
|
+
balance: `Balance: ${money$1({
|
|
13217
13326
|
...account.available,
|
|
13218
13327
|
amountCents: account.available.amountCents + account.setAside.amountCents
|
|
13219
13328
|
})}`
|
|
@@ -13312,12 +13421,12 @@ function membershipTaskView(task, card) {
|
|
|
13312
13421
|
}
|
|
13313
13422
|
//#endregion
|
|
13314
13423
|
//#region ../blocks/src/portal/app/pages/PassesPage.tsx
|
|
13315
|
-
const PASSES = { name: "passes" };
|
|
13424
|
+
const PASSES$1 = { name: "passes" };
|
|
13316
13425
|
function PassesPage({ session }) {
|
|
13317
13426
|
const { view: context } = usePortalApp();
|
|
13318
13427
|
return /* @__PURE__ */ jsx(PortalResourcePage, {
|
|
13319
13428
|
session,
|
|
13320
|
-
resource: PASSES,
|
|
13429
|
+
resource: PASSES$1,
|
|
13321
13430
|
failedTitle: "We couldn't load your passes and memberships",
|
|
13322
13431
|
loading: /* @__PURE__ */ jsx(PortalSection, {
|
|
13323
13432
|
id: "memberships",
|
|
@@ -13481,22 +13590,26 @@ function CancelConfirm({ view, onYes, onNo }) {
|
|
|
13481
13590
|
});
|
|
13482
13591
|
}
|
|
13483
13592
|
function MembershipActions({ card, busy, onCancel, onKeep }) {
|
|
13484
|
-
if (!card.canCancel && !card.canKeep) return null;
|
|
13593
|
+
if (!card.canCancel && !card.canKeep && !card.fixPayment) return null;
|
|
13485
13594
|
return /* @__PURE__ */ jsxs("div", {
|
|
13486
13595
|
className: "rb-portal-actions rb-portal-mt-m",
|
|
13487
|
-
children: [
|
|
13488
|
-
|
|
13489
|
-
|
|
13490
|
-
|
|
13491
|
-
|
|
13492
|
-
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13497
|
-
|
|
13498
|
-
|
|
13499
|
-
|
|
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
|
+
]
|
|
13500
13613
|
});
|
|
13501
13614
|
}
|
|
13502
13615
|
function Uses({ uses }) {
|
|
@@ -13595,6 +13708,767 @@ function CreditCard({ credit }) {
|
|
|
13595
13708
|
] });
|
|
13596
13709
|
}
|
|
13597
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
|
|
13598
14472
|
//#region ../blocks/src/portal/app/model/downloadsPage.ts
|
|
13599
14473
|
/** "4.2 MB", "820 KB". */
|
|
13600
14474
|
function fileSize(bytes) {
|
|
@@ -15257,9 +16131,18 @@ function detailsPageModel(view, context) {
|
|
|
15257
16131
|
newsletterTitle: `Emails from ${businessNameAtStart(context)}`,
|
|
15258
16132
|
newsletter: partOf(view.newsletter, ({ newsletter }) => newsletterModel(newsletter, contact, context)),
|
|
15259
16133
|
newsletterFootnote: "Newsletter choices don't change the emails about your bookings and payments, like confirmations, reminders and receipts.",
|
|
15260
|
-
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)
|
|
15261
16136
|
};
|
|
15262
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
|
+
}
|
|
15263
16146
|
function termsModel(agreement, context) {
|
|
15264
16147
|
const date = portalFullDate(agreement.agreedAt, context.site);
|
|
15265
16148
|
return {
|
|
@@ -15607,7 +16490,12 @@ function DetailsPage({ session, onSignOut }) {
|
|
|
15607
16490
|
onClick: onSignOut
|
|
15608
16491
|
})
|
|
15609
16492
|
})]
|
|
15610
|
-
})
|
|
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
|
|
15611
16499
|
]
|
|
15612
16500
|
});
|
|
15613
16501
|
}
|
|
@@ -16487,6 +17375,11 @@ function PortalPage({ session, route, you, options }) {
|
|
|
16487
17375
|
onSignOut: () => options.onSignOut(route)
|
|
16488
17376
|
});
|
|
16489
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);
|
|
16490
17383
|
case "downloads": return /* @__PURE__ */ jsx(DownloadsPage, { session });
|
|
16491
17384
|
case "payments": return /* @__PURE__ */ jsx(PaymentsPage, { session });
|
|
16492
17385
|
case "order": return /* @__PURE__ */ jsx(OrderPage, {
|
|
@@ -16557,6 +17450,7 @@ function PortalApp(props) {
|
|
|
16557
17450
|
props.bookingRoute,
|
|
16558
17451
|
props.logoutPath
|
|
16559
17452
|
]);
|
|
17453
|
+
useSignedOutRewrite(portalToken === null ? initialLocation.rewrite : null);
|
|
16560
17454
|
return /* @__PURE__ */ jsx("div", {
|
|
16561
17455
|
className: ["rb-portal", props.className].filter(Boolean).join(" "),
|
|
16562
17456
|
"data-portal": "root",
|
|
@@ -16574,6 +17468,18 @@ function PortalApp(props) {
|
|
|
16574
17468
|
})
|
|
16575
17469
|
});
|
|
16576
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
|
+
}
|
|
16577
17483
|
function SignedInPortal({ api, initialLocation, options }) {
|
|
16578
17484
|
return /* @__PURE__ */ jsx(PortalShell, {
|
|
16579
17485
|
session: usePortalSession(api, initialLocation),
|