@riverbankcms/sdk 0.179.0 → 0.181.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.
Files changed (240) hide show
  1. package/README.md +2 -2
  2. package/dist/_dts/{BlocksIslandsHydrator-DKwgs95u.d.ts → BlocksIslandsHydrator-CVCasDPz.d.ts} +1 -1
  3. package/dist/_dts/{Page-lWenra5i.d.ts → Page-Dtj2Ui3S.d.ts} +7 -7
  4. package/dist/_dts/{SdkPreviewMode-BRxhRw4I.d.ts → SdkPreviewMode-D1f_60WW.d.ts} +3 -2
  5. package/dist/_dts/{client-qWn7xAwJ.d.ts → client-Chr9pNVW.d.ts} +288 -121
  6. package/dist/_dts/{content-types-DL6GIvTm.d.ts → content-types-kjccgopX.d.ts} +2 -2
  7. package/dist/_dts/{contracts-CzWyAiJj.d.ts → contracts-BodaiS00.d.ts} +3 -3
  8. package/dist/_dts/{generatePageMetadata-CBKd0cJ4.d.ts → generatePageMetadata-BS6kaJFp.d.ts} +2 -2
  9. package/dist/_dts/{index-DCiSHd-C.d.ts → index-Brl6_I2j.d.ts} +5 -4
  10. package/dist/_dts/{index-CaCum9mM.d.ts → index-CJkefwYh.d.ts} +2 -2
  11. package/dist/_dts/{index-7CDBZGb-.d.ts → index-D1WpKwQe.d.ts} +1 -1
  12. package/dist/_dts/{index-BU9uAkHB.d.ts → index-DG0OvBs0.d.ts} +8 -8
  13. package/dist/_dts/{index-BYnG_vF5.d.ts → index-Diqt0PvG.d.ts} +1 -1
  14. package/dist/_dts/{index-CZgJrhzT.d.ts → index-Dy50xUMK.d.ts} +2 -2
  15. package/dist/_dts/{loadContent-CPKbFQyq.d.ts → loadContent-BgxshKrA.d.ts} +7 -7
  16. package/dist/_dts/{request-BjKBCS7t.d.ts → request-CA0izds5.d.ts} +4561 -1390
  17. package/dist/_dts/{resolveBlockData-DupbMCup.d.ts → resolveBlockData-ChQmwEd3.d.ts} +5 -5
  18. package/dist/_dts/{resolvePageContent-BqNyCHi8.d.ts → resolvePageContent-BvGyvblj.d.ts} +1 -1
  19. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  20. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client.d.ts +7 -7
  22. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  23. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  24. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
  26. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  27. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  28. package/dist/_dts/sdk/src/gifting/client.d.ts +1 -2
  29. package/dist/_dts/sdk/src/index.d.ts +104 -8
  30. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  31. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  32. package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
  33. package/dist/_dts/sdk/src/next/index.d.ts +84 -53
  34. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  35. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  36. package/dist/_dts/sdk/src/portal/client.d.ts +43 -56
  37. package/dist/_dts/sdk/src/portal/index.d.ts +3 -18
  38. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  39. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  41. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  42. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  43. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -1
  44. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +1 -1
  45. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +4 -4
  46. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  47. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  48. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  49. package/dist/_dts/sdk/src/rendering/themeAdmission.d.ts +1 -1
  50. package/dist/_dts/sdk/src/routing/index.d.ts +6 -6
  51. package/dist/_dts/sdk/src/server.d.ts +5 -5
  52. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  53. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  54. package/dist/_dts/{serviceBookingOutline-YcsIjvn1.d.ts → serviceBookingOutline-BgFbJQhU.d.ts} +8 -7
  55. package/dist/_dts/{types-B7e6Lmo5.d.ts → types-CQrsP1x_.d.ts} +3 -3
  56. package/dist/_dts/{types-CT-KOxl_.d.ts → types-CgS3xLk8.d.ts} +7 -2
  57. package/dist/_dts/{types-BOxSq-Bq.d.ts → types-R65DKjPn.d.ts} +9 -8
  58. package/dist/_dts/{validation-Dz6qccue.d.ts → validation-6LTIbuBA.d.ts} +4 -4
  59. package/dist/client/{BlocksIslandsHydrator-1XifJg6V.mjs → BlocksIslandsHydrator-DqZPz6oW.mjs} +19 -19
  60. package/dist/client/{BookingMailingListNote-BsbEgagJ.mjs → BookingMailingListNote-uWfR2kaG.mjs} +177 -70
  61. package/dist/client/{BookingQuestionFields-C8IbeLHj.mjs → BookingQuestionFields-CyNIKw6k.mjs} +23 -82
  62. package/dist/client/CalendarAction-D_Glwvz2.mjs +105 -0
  63. package/dist/client/{CalendarNavigationChevron-Bbqij1XQ.mjs → CalendarNavigationChevron-BGCX3zwG.mjs} +6 -6
  64. package/dist/client/{CheckboxChoice-BZPLCgTU.mjs → CheckboxChoice-C8i4NraK.mjs} +1 -1
  65. package/dist/client/{DemoBookingPortalAccess-uA9H8LIL.mjs → DemoBookingPortalAccess-DFLPyuqe.mjs} +18 -10
  66. package/dist/client/{EventCalendar.client-yoSI77ov.mjs → EventCalendar.client-zDL4-t-B.mjs} +10 -10
  67. package/dist/client/{EventCombined.client-HeCNlliq.mjs → EventCombined.client-uciDKLID.mjs} +60 -10
  68. package/dist/client/{EventEmbeddedCheckoutStep-BDnicDM6.mjs → EventEmbeddedCheckoutStep-BGkbUhuw.mjs} +1 -1
  69. package/dist/client/{EventItem-Duhk1vnF.mjs → EventItem-CwzrjcRw.mjs} +8 -7
  70. package/dist/client/{EventListWeekNavigation-BiutEqPK.mjs → EventListWeekNavigation-ChvcnPma.mjs} +1 -1
  71. package/dist/client/{EventListing.client-B5ln77jG.mjs → EventListing.client-DA57Qoyx.mjs} +3 -3
  72. package/dist/client/{EventListing.view-hUDhNtMv.mjs → EventListing.view-DZ0qMFF4.mjs} +8 -211
  73. package/dist/client/{EventRegistrationPayment-DqtX1vB2.mjs → EventRegistrationPayment-DSqCJL8E.mjs} +1657 -403
  74. package/dist/client/{Page-ChJ2TGVk.mjs → Page-C7mygH_f.mjs} +536 -287
  75. package/dist/client/{ProtectedSubmitButton-De6AzhE6.mjs → ProtectedSubmitButton-BNnKuir8.mjs} +1 -1
  76. package/dist/client/{SiteTermsAgreementField-CDBU31xW.mjs → SiteTermsAgreementField-B4z-e4Wq.mjs} +27 -24
  77. package/dist/client/{StepIndicator-JQA-VuEH.mjs → StepIndicator-Dn_DY4oY.mjs} +1 -1
  78. package/dist/client/{StepIndicator-2Dl9zon2.mjs → StepIndicator-atfDU82W.mjs} +21 -13
  79. package/dist/client/{ThemedButton-CnSa7o-I.mjs → ThemedButton-PFOhXktM.mjs} +1 -33
  80. package/dist/client/{accessibleSurfaces-Wl8-_OVJ.mjs → accessibleSurfaces-n6kS6Hct.mjs} +77 -1
  81. package/dist/client/{accordion-B6SqU49k.mjs → accordion-CsW8U3ff.mjs} +1 -1
  82. package/dist/client/{booking-form.client-DrEOjQ3N.mjs → booking-form.client-cBWM392H.mjs} +442 -86
  83. package/dist/client/bookingCalendar--aWnqFDn.mjs +180 -0
  84. package/dist/client/{bookingForm-drZBwEZW.mjs → bookingForm-DgySpp6C.mjs} +4 -4
  85. package/dist/client/bookings.mjs +51 -15
  86. package/dist/client/{boxStyleClassNames-DEh45w16.mjs → boxStyleClassNames-BpGVdLFD.mjs} +2 -2
  87. package/dist/client/{carousel-C-YJliD-.mjs → carousel-DJoleFV3.mjs} +2 -2
  88. package/dist/client/{carousel.client-DMtGYTTM.mjs → carousel.client-BtLwHefX.mjs} +1 -1
  89. package/dist/client/{cart-acGFWK9R.mjs → cart-EO5o6uPH.mjs} +3 -3
  90. package/dist/client/{cart.client-BzlOGP2j.mjs → cart.client-D_gPw45z.mjs} +1 -1
  91. package/dist/client/{checkout-SEontwhy.mjs → checkout-NVfZW0kR.mjs} +3 -3
  92. package/dist/client/{checkout.client-C0Qvh-d4.mjs → checkout.client-DD3JuqOy.mjs} +1 -1
  93. package/dist/client/{checkoutUrls-yUKeq1N9.mjs → checkoutUrls-z2gXvlGw.mjs} +1 -1
  94. package/dist/client/client.mjs +306 -196
  95. package/dist/client/constants-CoOkvw__.mjs +100 -0
  96. package/dist/client/{context-DTrwaQtg.mjs → context-CRhn9qzS.mjs} +922 -388
  97. package/dist/client/{dateFormatting-Cg8E1r9l.mjs → dateFormatting-BnWB4L1s.mjs} +15 -25
  98. package/dist/client/{demoPortalMagicLink-D0kOJYOX.mjs → demoPortalMagicLink-CWDGSTBu.mjs} +2 -3
  99. package/dist/client/{enhanceHeaderSection-DyrpZ7ks.mjs → enhanceHeaderSection-tdP_-Z9o.mjs} +4 -5
  100. package/dist/client/{event-registration.client-RLZQWi2V.mjs → event-registration.client-D7YYKySQ.mjs} +2084 -1640
  101. package/dist/client/{eventCalendar-CphYnImh.mjs → eventCalendar-CsAfu5d0.mjs} +4 -4
  102. package/dist/client/{eventCombined-BvqjASB_.mjs → eventCombined-VXJB5CoS.mjs} +4 -4
  103. package/dist/client/{eventListing-BaNAoC_M.mjs → eventListing-B3KIZNfY.mjs} +4 -4
  104. package/dist/client/{eventRegistration-COMHoRl6.mjs → eventRegistration-BP-dEk1c.mjs} +4 -4
  105. package/dist/client/{form-DyH2juYT.mjs → form-DM8Zbxbv.mjs} +3 -3
  106. package/dist/client/{form.client-DBwzkB0M.mjs → form.client-e2z_Tlgk.mjs} +5 -5
  107. package/dist/client/{form.parts-CY4kX3mh.mjs → form.parts-Ctljy1a3.mjs} +3 -3
  108. package/dist/client/gifting/client.mjs +32 -29
  109. package/dist/client/{gifting-CIx4V378.mjs → gifting-DWIsqQru.mjs} +4 -4
  110. package/dist/client/{gifting.client-BEVPpzJM.mjs → gifting.client-QsSWF0uA.mjs} +5 -5
  111. package/dist/client/{gifting.parts-VnORjnZK.mjs → gifting.parts-CedLgwa_.mjs} +2 -2
  112. package/dist/client/{headerSection-DGcJfRS8.mjs → headerSection-DAkRkwb-.mjs} +2 -2
  113. package/dist/client/{mediaAssets-B99AP7ai.mjs → mediaAssets-COfQolI3.mjs} +1 -1
  114. package/dist/client/{mediaContext-Fusweriw.mjs → mediaContext-DzvnjYXm.mjs} +1 -1
  115. package/dist/client/{newsletter-form.client-BvEDkjiD.mjs → newsletter-form.client-WYja9-WN.mjs} +7 -7
  116. package/dist/client/{newsletter-form.interactive-DCO1lErD.mjs → newsletter-form.interactive-RuM86VAv.mjs} +37 -44
  117. package/dist/client/{newsletter-form.parts-BIy4IUT3.mjs → newsletter-form.parts-2petDnWv.mjs} +2 -2
  118. package/dist/client/{newsletterForm-CoTXDNFS.mjs → newsletterForm-BUbXdA_e.mjs} +3 -3
  119. package/dist/client/{lookSurfaces-IqT_SVnX.mjs → noop-Dl4mZ-rr.mjs} +257 -49
  120. package/dist/client/portal/client.mjs +11779 -6745
  121. package/dist/client/portalOrders-COGn4BKG.mjs +596 -0
  122. package/dist/client/portalRoutes-D72yvtDh.mjs +862 -0
  123. package/dist/client/{product-detail.client-YHQ2aKX1.mjs → product-detail.client-pOAryevt.mjs} +1 -1
  124. package/dist/client/{product-list.client-DxoZw1vF.mjs → product-list.client-CcUpUiud.mjs} +1 -1
  125. package/dist/client/{productDetail-DjuFvkey.mjs → productDetail-BZJCfqat.mjs} +3 -3
  126. package/dist/client/{productList-DE9GEFoZ.mjs → productList-CiRs3mNb.mjs} +3 -3
  127. package/dist/client/{propsDecoder-Cyag_HOs.mjs → propsDecoder--uHW4tFM.mjs} +2 -2
  128. package/dist/client/{registry.server-BPwV-0Pp.mjs → registry.server-CDNNd8wC.mjs} +318 -235
  129. package/dist/client/{renderableMediaAssetAdmission-BlfqYLJW.mjs → renderableMediaAssetAdmission-BsOWd9lf.mjs} +1 -1
  130. package/dist/client/rendering/client.mjs +26 -26
  131. package/dist/client/rendering/islands.mjs +1 -1
  132. package/dist/client/rendering.mjs +16 -8
  133. package/dist/client/{richText-coerce-NrRqDeOg.mjs → richText-coerce-CQGE_wHV.mjs} +2 -1
  134. package/dist/client/{routeIslandApiConfig-BWq5gKFK.mjs → routeIslandApiConfig-BtCg87-N.mjs} +1 -1
  135. package/dist/client/{runtimeResponse-D2j2-mOk.mjs → runtimeResponse-DL_ARBpa.mjs} +1 -1
  136. package/dist/client/{runtimeResponse-DtWSfWSZ.mjs → runtimeResponse-Ds9cmBUf.mjs} +1 -1
  137. package/dist/client/{shop-C3wM0Hr4.mjs → shop-Rx_gEMK8.mjs} +3 -3
  138. package/dist/client/{shop-commerce-34YvcpbX.mjs → shop-commerce-D8evQnMT.mjs} +53 -16
  139. package/dist/client/{shop-commerce-store-B7xHksOs.mjs → shop-commerce-store-C9PcsSTj.mjs} +22 -5
  140. package/dist/client/{shop-discount-apply.state-BiBnozfO.mjs → shop-discount-apply.state-D5CtGfJI.mjs} +2 -2
  141. package/dist/client/{shop.client-C0v88nLd.mjs → shop.client-D4lzQ9oY.mjs} +17 -39
  142. package/dist/client/{shopShared-Ct-BRNez.mjs → shopShared-BVbq7Nm-.mjs} +2 -2
  143. package/dist/client/spam-protection.mjs +1 -1
  144. package/dist/client/src-Al4ooTl_.mjs +164 -0
  145. package/dist/client/{src-CCtanNlD.mjs → src-ZSqRK3dD.mjs} +345 -92
  146. package/dist/client/{timetableModel-lhE29TNT.mjs → timetableModel-BQJrSK0K.mjs} +205 -80
  147. package/dist/client/{shop-add-feedback-DvC2kP1K.mjs → urlParams-C2QHo1Pa.mjs} +1 -42
  148. package/dist/client/{useAvailableSlots-BelJviOT.mjs → useAvailableSlots-Dm3lKJKR.mjs} +3 -24
  149. package/dist/client/{useDiscountCodeUi-rQRE1-Ho.mjs → useDiscountCodeUi-klgfGn7f.mjs} +1 -1
  150. package/dist/client/{useEventPagination-C4rS2Xxl.mjs → useEventPagination-Jnjt7_ly.mjs} +8 -8
  151. package/dist/client/{view-LJVHVqsy.mjs → view-CC_yQLSA.mjs} +4 -4
  152. package/dist/client/{wizardSteps-CNDsxeJH.mjs → wizardSteps-BliJOzEX.mjs} +2512 -675
  153. package/dist/preview-next/before-render.mjs +1 -0
  154. package/dist/preview-next/client/{LocationPickerEnvironment-BHAT81Wx.mjs → LocationPickerEnvironment-BW3dRFIv.mjs} +1 -1
  155. package/dist/preview-next/client/{MapLibreEditMap-B52hkdIZ.mjs → MapLibreEditMap-Db9BHyXh.mjs} +2 -2
  156. package/dist/preview-next/client/{PageSectionToolbar-C4TtBPN-.mjs → PageSectionToolbar-BhL0uADo.mjs} +4 -4
  157. package/dist/preview-next/client/{PreviewEditorSidebar-D6fkE59-.mjs → PreviewEditorSidebar-Ct8eIm0i.mjs} +8 -7
  158. package/dist/preview-next/client/{PreviewEditorUI-amcDlj0O.mjs → PreviewEditorUI-BS32G4V9.mjs} +5 -5
  159. package/dist/preview-next/client/{PreviewShell-DeQjx4zk.mjs → PreviewShell-RL0WfZXD.mjs} +7 -7
  160. package/dist/preview-next/client/{SdkPreviewModeRuntime-Cx0SXnoX.mjs → SdkPreviewModeRuntime-MK_gHeGy.mjs} +39 -7
  161. package/dist/preview-next/client/{lucide-react-McYZeSMb.mjs → lucide-react-00FF_oar.mjs} +13 -1
  162. package/dist/preview-next/client/{previewAssistantSlot-aqpU34WI.mjs → previewAssistantSlot-CQyS8pcq.mjs} +10318 -3719
  163. package/dist/preview-next/client/{previewChromeRoot-D3Gy_Rs0.mjs → previewChromeRoot-BSxp3Mfu.mjs} +1 -1
  164. package/dist/preview-next/client/runtime.mjs +3 -3
  165. package/dist/preview-next/client/{sdk-runtime-Dzx_RrN7.mjs → sdk-runtime-DKnTzy74.mjs} +2 -2
  166. package/dist/preview-next/client/{siteStyleAccess-LHedw83e.mjs → siteStyleAccess-BlmbvbLN.mjs} +37 -25
  167. package/dist/preview-next/client/{useAutosaveStatus-DpSd9aVk.mjs → useAutosaveStatus-D-7GwZOQ.mjs} +1 -1
  168. package/dist/preview-next/client/{useOpenBlockForSetup-BGZn5AT1.mjs → useOpenBlockForSetup-BNZtGM5g.mjs} +2 -2
  169. package/dist/preview-next/container-responsive.css +292 -170
  170. package/dist/preview-next/keepAlive.mjs +1 -1
  171. package/dist/preview-next/middleware.mjs +1 -1
  172. package/dist/preview-next/{route-contract-DnL-FgSV.mjs → route-contract-R3PcMmax.mjs} +114 -37
  173. package/dist/server/{Block.shared-BEbq6EwO.mjs → Block.shared-CniF9tSu.mjs} +5 -5
  174. package/dist/server/{ThemeScopeCore-DFEM1a85.mjs → ThemeScopeCore-BQWsnGT6.mjs} +133 -120
  175. package/dist/server/{accessibleSurfaces-CM3QANtw.mjs → accessibleSurfaces-WPzUAHp4.mjs} +33 -2
  176. package/dist/server/accordions-By_0Ykks.mjs +111 -0
  177. package/dist/server/{bindings-Bly0dRs7.mjs → bindings-DxojjtK3.mjs} +7 -7
  178. package/dist/server/{client-CGJ2ztYp.mjs → client-CDndhbYO.mjs} +1412 -1307
  179. package/dist/server/config-validation.mjs +1 -1
  180. package/dist/server/config.mjs +2 -2
  181. package/dist/server/constants-VyF5nEhL.mjs +1474 -0
  182. package/dist/server/{customCss-BZ8YSrQg.mjs → customCss-C9kgPHvr.mjs} +41 -5
  183. package/dist/server/data/resolveBlockData.mjs +1 -1
  184. package/dist/server/index.mjs +3 -3
  185. package/dist/server/{loadContent-BkK1w3QQ.mjs → loadContent-BKstMBmX.mjs} +7 -4
  186. package/dist/server/{loadPage-DTLe0FEs.mjs → loadPage-IgNnZaqr.mjs} +3 -3
  187. package/dist/server/{lookMediaFrame-CaH018pK.mjs → lookMediaFrame-TFjgNG61.mjs} +74 -18
  188. package/dist/server/manifest.mjs +36 -25
  189. package/dist/server/{mapLocation-BM5WX7FY.mjs → mapLocation-MDDSubTp.mjs} +1 -1
  190. package/dist/server/media-BRmYrnzb.mjs +31 -0
  191. package/dist/server/{media-luf7RF22.mjs → media-gvfIw3z8.mjs} +2 -31
  192. package/dist/server/{navigation-BcNfYYuu.mjs → navigation-quBYlSKD.mjs} +2 -2
  193. package/dist/server/navigation.mjs +1 -1
  194. package/dist/server/next.mjs +170 -104
  195. package/dist/server/{overrideResolution-Uy9Zp2Ks.mjs → overrideResolution-CCaAPpIa.mjs} +1 -1
  196. package/dist/server/page-converter.mjs +3 -3
  197. package/dist/server/{pageRenderPlan-JzxBnqfV.mjs → pageRenderPlan-B7iULvKe.mjs} +15 -12
  198. package/dist/server/{pageRuntimeSupport-DyNSd2Yj.mjs → pageRuntimeSupport-BytMroxn.mjs} +9 -5
  199. package/dist/server/{pageShared-DU4ETFPS.mjs → pageShared-Dcs_XTIO.mjs} +836 -624
  200. package/dist/server/{parseThemeForPersistence-DOsfofCy.mjs → parseThemeForPersistence-Bihl4W5K.mjs} +3 -2
  201. package/dist/server/{portal-B4JVkdjc.mjs → portal-CMW_b9mG.mjs} +62 -46
  202. package/dist/server/portal.mjs +3 -3
  203. package/dist/server/portalQuestions-oUyohgL9.mjs +225 -0
  204. package/dist/server/{prebuild-8jNtDXmS.mjs → prebuild-agaH-vZV.mjs} +1 -1
  205. package/dist/server/prebuild.mjs +1 -1
  206. package/dist/server/{prefetchBlockData-xeMG42aw.mjs → prefetchBlockData-DwpRjqw4.mjs} +5 -3
  207. package/dist/server/{registry-DH1VrsCl.mjs → registry-DM9dHfDC.mjs} +582 -526
  208. package/dist/server/rendering/components/pageShared.mjs +1 -1
  209. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  210. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  211. package/dist/server/rendering/server.mjs +4 -4
  212. package/dist/server/rendering.mjs +10 -9
  213. package/dist/server/{resolveBlockData-BN8tweTx.mjs → resolveBlockData-CinHGf8l.mjs} +39 -31
  214. package/dist/server/{resolveButtonColourStates--6yJp9Tq.mjs → resolveButtonColourStates-B0O1IM16.mjs} +2 -1028
  215. package/dist/server/{resolvePageContent-DnM16_f9.mjs → resolvePageContent-BWKUZUIn.mjs} +1 -1
  216. package/dist/server/{responseMedia-F-ElH2Rd.mjs → responseMedia-IfH65QAH.mjs} +57 -2
  217. package/dist/server/routing.mjs +1 -1
  218. package/dist/server/{schema-BpsqaSSU.mjs → schema-CwfxQjc4.mjs} +10 -113
  219. package/dist/server/server.mjs +3 -3
  220. package/dist/server/{servicePageContent-B-FezJmH.mjs → servicePageContent-BBBhOtdE.mjs} +31 -26
  221. package/dist/server/theme-bridge.mjs +3 -2
  222. package/dist/server/theme.mjs +2 -2
  223. package/dist/server/{three-pass-converter-39SXCCnh.mjs → three-pass-converter-DPaUPTfl.mjs} +34 -16
  224. package/dist/server/titleSourceSchema-NhK6azFS.mjs +2018 -0
  225. package/dist/server/typeGuards-CTW_9AXq.mjs +413 -0
  226. package/dist/server/types-BKaBZFjD.mjs +1085 -0
  227. package/dist/server/{validation-3jOzYdPL.mjs → validation-DG5jX3jH.mjs} +70 -17
  228. package/dist/server/{version-8t0o6_jd.mjs → version-CipbxPHL.mjs} +1 -1
  229. package/dist/server/video-Cdr3wh-q.mjs +272 -0
  230. package/dist/styles/index.css +3446 -3796
  231. package/package.json +2 -1
  232. package/dist/_dts/index-DVSipdrT.d.ts +0 -101
  233. package/dist/client/TabBarFragment-DlKQRhP4.mjs +0 -56
  234. package/dist/client/checkoutRoute-DKlZRNZD.mjs +0 -22
  235. package/dist/client/constants-4o4_hl34.mjs +0 -6
  236. package/dist/client/creditProducts-BQ1t1erI.mjs +0 -266
  237. package/dist/client/formatDate-CTEN7gxW.mjs +0 -26
  238. package/dist/server/constants-Cj7hfbrA.mjs +0 -41
  239. package/dist/server/richTextSchema-QLaQrbII.mjs +0 -212
  240. package/dist/server/titleSourceSchema-Cu-3PRvv.mjs +0 -122
@@ -1,24 +1,17 @@
1
1
  "use client";
2
- import { c as unsafeAsMediaAssetId, d as parseUuidBrand, f as err, i as resolveManagedMediaReference, l as unsafeAsStorageBucketName, o as parseCanonicalMediaIdentifier, p as ok$1, u as unsafeAsStoragePath } from "./renderableMediaAssetAdmission-BlfqYLJW.mjs";
3
- import { $t as formatTimeRange, A as toBookingRequirementConsentField, D as blockBookingConsentSchema, E as blockBookingPaymentTermsSchema, Gt as validateBookingPaymentOptionKinds, Jt as formatDateTime, Kt as formatDate$2, M as bookingQuestionsAnswerValueSchema, P as eventCalendarListLayoutOptions, Qt as formatTime$2, Xt as formatSiteInstantDate, Yt as formatDateTimeRange, Z as runtimeMediaSchema, Zt as formatSiteInstantTime, _t as eventCalendarDefaultViewValues, an as addLocalScheduleDays, bn as formatCurrencyAmount, bt as eventCalendarListLayoutValues, c as blockSiteTermsSchema, cn as getBookingLocalDateKey, ct as eyebrowTreatmentValues, dn as parseLocalScheduleTime, fn as parseUtcIsoDateTimeString, gn as toBookingTimeZone, gt as normalizeCurrencyCode, hn as resolveBookingTimeZoneId, ht as allocateReductionCents, in as toScheduledBookingDateTime, j as beforeBookingQuestionsPresentationSchema, ln as getLocalScheduleDate, lt as headingDecorationColorTokenValues, mn as resolveBookingBusinessTimeZone, mt as unsafeAsPositiveCheckoutQuantity, nn as resolveBookingDisplayContext, on as compareLocalScheduleDates, pn as toUtcIsoDateTimeString, pt as visibleHeadingDecorationFamilyValues, qt as formatDateRange, sn as formatLocalScheduleDate, t as assertNever$1, tn as inferSiteDateLocale, un as parseBookingLocalDate, vt as eventCalendarDisplayModeValues, yn as toNonNegativeCents, yt as eventCalendarListLayoutCompatibleDisplayModeValues } from "./src-CCtanNlD.mjs";
4
- import { C as omitZeroAmountFutureRows, E as parseAppointmentServiceId, T as assertNever$2, _ as addIntervalPreservingMonthAnchor, a as buildBookingQuestionsSubmission, b as getBookingInstalmentDepositRefundability, d as resolveBookingQuestionsAnswerMode, g as formatCreditProductUnits, h as formatCreditProductPayment, l as initialBookingQuestionsAnswerMode, o as checkBookingQuestionsAnswered, p as creditProductUnitNoun, t as deriveCreditProductLabels, u as initialBookingQuestionsValues, v as clampConfiguredAmount, w as splitAmountWithRemainderInFirst, x as getBookingInstalmentPlanIntervalCount } from "./creditProducts-BQ1t1erI.mjs";
2
+ import { d as unsafeAsStoragePath, f as parseUuidBrand, i as resolveManagedMediaReference, l as unsafeAsMediaAssetId, m as ok$1, o as parseCanonicalMediaIdentifier, p as err, u as unsafeAsStorageBucketName } from "./renderableMediaAssetAdmission-BsOWd9lf.mjs";
3
+ import { An as formatCurrencyAmount, Bn as parseEventSeriesId, Cn as toUtcIsoDateTimeString, Ct as unsafeAsPositiveCheckoutQuantity, Dn as parsePositiveCents, Dt as eventCalendarDisplayModeValues, En as toBookingTimeZone, Et as eventCalendarDefaultViewValues, J as runtimeMediaSchema, Nn as parseAppointmentServiceId, O as toBookingRequirementConsentField, Ot as eventCalendarListLayoutCompatibleDisplayModeValues, Sn as parseUtcIsoDateTimeString, St as roomChoicesSchema, T as blockBookingConsentSchema, Tn as resolveBookingTimeZoneId, Tt as normalizeCurrencyCode, _n as formatLocalScheduleDate, an as formatDateTimeRange, at as eyebrowTreatmentValues, bn as parseBookingLocalDate, bt as placesFor, c as blockSiteTermsSchema, cn as formatTime$2, dn as inferSiteDateLocale, dt as bookingQuestionsAnswerValueSchema, fn as resolveBookingDisplayContext, gn as compareLocalScheduleDates, hn as addLocalScheduleDays, in as formatDateTime, j as eventCalendarListLayoutOptions, k as beforeBookingQuestionsPresentationSchema, kn as toNonNegativeCents, kt as eventCalendarListLayoutValues, ln as formatTimeRange, mn as toScheduledBookingDateTime, nn as formatDate$2, on as formatSiteInstantDate, ot as headingDecorationColorTokenValues, rn as formatDateRange, sn as formatSiteInstantTime, t as assertNever$2, tn as validateBookingPaymentOptionKinds, ut as visibleHeadingDecorationFamilyValues, vn as getBookingLocalDateKey, w as blockBookingPaymentTermsSchema, wn as resolveBookingBusinessTimeZone, wt as allocateReductionCents, xn as parseLocalScheduleTime, xt as reviewedRoomsSchema, yn as getLocalScheduleDate, yt as ROOM_PLACES, zn as parseEventOfferingId } from "./src-ZSqRK3dD.mjs";
4
+ import { c as checkBookingQuestionsAnswered, d as initialBookingQuestionsAnswerMode, f as initialBookingQuestionsValues, h as assertNever$3, p as resolveBookingQuestionsAnswerMode, r as bookingCalendar, s as buildBookingQuestionsSubmission } from "./bookingCalendar--aWnqFDn.mjs";
5
5
  import { t as stableJsonStringify } from "./stable-json-D0XAEIXc.mjs";
6
- import { $t as cardListFamilyBlocks, Mt as resolveEffectiveKnobs, en as cardListKnobBlocks, jt as blockAppearancePresets, n as listLookControl, r as listLookSlot } from "./lookSurfaces-IqT_SVnX.mjs";
6
+ import { Mt as blockAppearancePresets, Nt as resolveEffectiveKnobs, en as cardListFamilyBlocks, i as listLookSlot, r as listLookControl, tn as cardListKnobBlocks } from "./noop-Dl4mZ-rr.mjs";
7
7
  import { g as blockColorTokenNames, w as parseColorTokenParts } from "./types-BEaKfam_.mjs";
8
- import { G as mergeStyles, H as backgroundColorStyle, K as rgbColorValue, P as PUBLIC_BUTTON_ROLES, q as textColorStyle } from "./accessibleSurfaces-Wl8-_OVJ.mjs";
9
- import { S as clsx } from "./ThemedButton-CnSa7o-I.mjs";
10
- import { a as getSupabaseUrl, i as getSiteId, n as getCurrentResolveImageUrlContext, r as getMediaAssetIndex } from "./mediaContext-Fusweriw.mjs";
11
- import { l as buildCalendarViewport$1, n as calendarLinks, r as groupItemsByDate } from "./src-uwCpbHXG.mjs";
8
+ import { G as mergeStyles, H as backgroundColorStyle, K as rgbColorValue, P as PUBLIC_BUTTON_ROLES, q as textColorStyle } from "./accessibleSurfaces-n6kS6Hct.mjs";
9
+ import { x as clsx } from "./ThemedButton-PFOhXktM.mjs";
10
+ import { a as getSupabaseUrl, i as getSiteId, n as getCurrentResolveImageUrlContext, r as getMediaAssetIndex } from "./mediaContext-DzvnjYXm.mjs";
11
+ import { l as buildCalendarViewport$1, r as groupItemsByDate } from "./src-uwCpbHXG.mjs";
12
12
  import React from "react";
13
13
  import { Fragment, jsx } from "react/jsx-runtime";
14
14
  import { z } from "zod";
15
- //#region ../core/src/branded/events.ts
16
- const unsafeAsEventOfferingId = (id) => id;
17
- const unsafeAsEventSeriesId = (id) => id;
18
- const unsafeAsEventCategoryId = (id) => id;
19
- const parseEventOfferingId = (value) => parseUuidBrand(value, unsafeAsEventOfferingId);
20
- const parseEventSeriesId = (value) => parseUuidBrand(value, unsafeAsEventSeriesId);
21
- //#endregion
22
15
  //#region ../core/src/branded/identity.ts
23
16
  const unsafeAsSiteId = (id) => id;
24
17
  const parseSiteId = (value) => parseUuidBrand(value, unsafeAsSiteId);
@@ -45,7 +38,7 @@ function isPublicEventPricingOptionDisplayable(option) {
45
38
  case "not_on_sale_yet":
46
39
  case "sale_ended":
47
40
  case "attendance_mode_unavailable": return false;
48
- default: return assertNever$2(reason);
41
+ default: return assertNever$3(reason);
49
42
  }
50
43
  }
51
44
  function publicEventPricingDisplay(pricing) {
@@ -186,7 +179,7 @@ function canonicalEventPricingDisplay(pricing) {
186
179
  currency: pricing.currency,
187
180
  purpose: "configured"
188
181
  });
189
- default: return assertNever$2(pricing);
182
+ default: return assertNever$3(pricing);
190
183
  }
191
184
  }
192
185
  /**
@@ -205,7 +198,7 @@ function formatBookingPriceDisplay(display, options = {}) {
205
198
  case "mixed": return display.paidToAmount > display.paidFromAmount ? `Free or ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}–${formatCurrencyAmount(display.paidToAmount, display.currency, options)}` : `Free or ${formatCurrencyAmount(display.paidFromAmount, display.currency, options)}`;
206
199
  case "unavailable": return "Pricing unavailable";
207
200
  case "external": return display.label;
208
- default: return assertNever$2(display);
201
+ default: return assertNever$3(display);
209
202
  }
210
203
  }
211
204
  /** Render an event's price directly from its pricing value. */
@@ -456,6 +449,69 @@ function resolveFlexibleBalanceInitialPaymentCents(input) {
456
449
  return clampFlexibleBalanceConfiguredAmount(input.config.upfrontAmountCents, input.totalAmountCents);
457
450
  }
458
451
  //#endregion
452
+ //#region ../core/src/booking-instalments.ts
453
+ function isDepositBearingBookingInstalmentPlan(plan) {
454
+ switch (plan.kind) {
455
+ case "deposit_plus_one_remainder":
456
+ case "deposit_plus_scheduled_instalments": return true;
457
+ case "equal_scheduled_instalments": return false;
458
+ default: return assertNever$1(plan);
459
+ }
460
+ }
461
+ function getBookingInstalmentDepositRefundability(plan) {
462
+ return isDepositBearingBookingInstalmentPlan(plan) ? plan.depositRefundability : null;
463
+ }
464
+ function getBookingInstalmentProtectedDepositAmountCents(plan) {
465
+ return isDepositBearingBookingInstalmentPlan(plan) ? plan.depositAmountCents : null;
466
+ }
467
+ function clampConfiguredAmount(amountCents, totalAmountCents) {
468
+ return Math.max(0, Math.min(amountCents, totalAmountCents));
469
+ }
470
+ function splitAmountWithRemainderInFirst(totalAmountCents, partCount) {
471
+ if (partCount <= 0) return [];
472
+ const baseAmountCents = Math.floor(totalAmountCents / partCount);
473
+ const remainderCents = totalAmountCents - baseAmountCents * partCount;
474
+ return Array.from({ length: partCount }, (_, index) => index === 0 ? baseAmountCents + remainderCents : baseAmountCents);
475
+ }
476
+ function addIntervalPreservingMonthAnchor(isoString, intervalCount, intervalUnit) {
477
+ const date = new Date(isoString);
478
+ if (!Number.isFinite(date.getTime())) return isoString;
479
+ switch (intervalUnit) {
480
+ case "day":
481
+ date.setUTCDate(date.getUTCDate() + intervalCount);
482
+ return date.toISOString();
483
+ case "week":
484
+ date.setUTCDate(date.getUTCDate() + intervalCount * 7);
485
+ return date.toISOString();
486
+ case "month": return addMonthsPreservingAnchorDay(date, intervalCount).toISOString();
487
+ default: return assertNever$1(intervalUnit);
488
+ }
489
+ }
490
+ function getBookingInstalmentPlanIntervalCount(plan) {
491
+ switch (plan.kind) {
492
+ case "deposit_plus_one_remainder": return plan.remainderDueCount;
493
+ case "deposit_plus_scheduled_instalments":
494
+ case "equal_scheduled_instalments": return plan.intervalCount;
495
+ default: return assertNever$1(plan);
496
+ }
497
+ }
498
+ function omitZeroAmountFutureRows(rows) {
499
+ if (rows.length <= 1) return rows;
500
+ const firstRow = rows[0];
501
+ if (firstRow === void 0) return [];
502
+ return [firstRow, ...rows.slice(1).filter((row) => row.amountCents > 0)];
503
+ }
504
+ function addMonthsPreservingAnchorDay(date, intervalCount) {
505
+ const anchorDay = date.getUTCDate();
506
+ const nextMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + intervalCount, 1, date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()));
507
+ const lastDayOfTargetMonth = new Date(Date.UTC(nextMonth.getUTCFullYear(), nextMonth.getUTCMonth() + 1, 0)).getUTCDate();
508
+ nextMonth.setUTCDate(Math.min(anchorDay, lastDayOfTargetMonth));
509
+ return nextMonth;
510
+ }
511
+ function assertNever$1(value) {
512
+ throw new Error(`Unexpected value: ${String(value)}`);
513
+ }
514
+ //#endregion
459
515
  //#region ../core/src/venue-location.ts
460
516
  /** The owner's option and what visitors read are the same words, so the option says what you'll see. */
461
517
  const EVENT_ADDRESS_AFTER_BOOKING_LABEL = "Address shared after booking";
@@ -704,38 +760,6 @@ function invalidRuntimeContext() {
704
760
  return err({ tag: "invalid_mailing_list_runtime_context" });
705
761
  }
706
762
  //#endregion
707
- //#region ../core/src/slug.ts
708
- const REMOVED_CHARACTERS = /['\u2019]/g;
709
- const COMBINING_DIACRITICS = /[\u0300-\u036f]/g;
710
- const SEPARATOR_RUN = /[^a-z0-9]+/g;
711
- const TRAILING_SLUG_SEPARATORS = /[-/]+$/g;
712
- function slugifySegment(text) {
713
- return text.normalize("NFD").replace(COMBINING_DIACRITICS, "").toLowerCase().replace(REMOVED_CHARACTERS, "").replace(SEPARATOR_RUN, "-").replace(/^-+|-+$/g, "");
714
- }
715
- /**
716
- * Convert a string to a URL-safe slug.
717
- *
718
- * Every non-alphanumeric character (underscores included) is a separator and
719
- * collapses to a single hyphen, which keeps output inside the `site_routes`
720
- * slug constraint `^[a-z0-9]+([a-z0-9\-/]*[a-z0-9])?$`.
721
- *
722
- * This is the single slug implementation for the monorepo: block-form and the
723
- * shop admin catalog delegate here rather than keeping their own variants.
724
- *
725
- * @example
726
- * slugify("Initial Consultation") // "initial-consultation"
727
- * slugify("Reiki & Energy Healing") // "reiki-energy-healing"
728
- * slugify("Don't Stop") // "dont-stop"
729
- * slugify("draft_post") // "draft-post"
730
- * slugify("Blog / My Post", { preserveSegments: true }) // "blog/my-post"
731
- */
732
- function slugify(text, options = {}) {
733
- const source = text.toString().trim();
734
- const slug = options.preserveSegments === true ? source.split("/").map(slugifySegment).filter((segment) => segment.length > 0).join("/") : slugifySegment(source);
735
- if (options.maxLength === void 0) return slug;
736
- return slug.slice(0, options.maxLength).replace(TRAILING_SLUG_SEPARATORS, "");
737
- }
738
- //#endregion
739
763
  //#region ../core/src/whole-series-run-schedule.ts
740
764
  /**
741
765
  * A session that is not happening.
@@ -840,6 +864,67 @@ function resolveWholeSeriesBookingPhase(run, now) {
840
864
  };
841
865
  }
842
866
  }
867
+ /** Resolve the course's two distinct dates from its surviving schedule once. */
868
+ function resolveWholeSeriesPaymentDates(input) {
869
+ const live = orderedLiveRunSessions(input.sessions);
870
+ const option = input.paymentTerms.allowedOptions.find((option) => option.kind === "instalment_plan");
871
+ return {
872
+ bookingStartAt: live[0]?.startsAt ?? null,
873
+ instalmentCollectionDeadlineAt: (option?.courseDeadline === "last_session" ? live[live.length - 1] : live[0])?.startsAt ?? null
874
+ };
875
+ }
876
+ //#endregion
877
+ //#region ../core/src/credit-product-nouns.ts
878
+ const CREDIT_PRODUCT_NOUNS = {
879
+ event_pass: {
880
+ product: {
881
+ singular: "pass",
882
+ plural: "passes"
883
+ },
884
+ productTitle: {
885
+ singular: "Pass",
886
+ plural: "Passes"
887
+ },
888
+ unit: {
889
+ singular: "class",
890
+ plural: "classes"
891
+ }
892
+ },
893
+ appointment_package: {
894
+ product: {
895
+ singular: "package",
896
+ plural: "packages"
897
+ },
898
+ productTitle: {
899
+ singular: "Package",
900
+ plural: "Packages"
901
+ },
902
+ unit: {
903
+ singular: "session",
904
+ plural: "sessions"
905
+ }
906
+ }
907
+ };
908
+ function countedNoun(noun, count) {
909
+ return count === 1 ? noun.singular : noun.plural;
910
+ }
911
+ /** "class" or "classes", to follow a number the caller formats. */
912
+ function creditProductUnitNoun(useCase, count) {
913
+ return countedNoun(CREDIT_PRODUCT_NOUNS[useCase].unit, count);
914
+ }
915
+ /** "1 class", "4 sessions". */
916
+ function formatCreditProductUnits(useCase, count) {
917
+ return `${count} ${creditProductUnitNoun(useCase, count)}`;
918
+ }
919
+ /** "4 of 10 sessions left". */
920
+ function formatCreditProductBalance(useCase, balance) {
921
+ return `${balance.remaining} of ${balance.total} ${creditProductUnitNoun(useCase, balance.total)} left`;
922
+ }
923
+ /** Confirmation copy shared by booking screens and editable email wording. */
924
+ function formatCreditProductPayment(input) {
925
+ const used = input.creditsUsed;
926
+ return (used !== void 0 && used !== 0 && !Number.isNaN(used) ? `${used} credit${used === 1 ? "" : "s"} from your ${input.name}` : `Paid with your ${input.name}`) + (input.creditsRemaining === void 0 ? "" : ` (${input.creditsRemaining} left)`);
927
+ }
843
928
  //#endregion
844
929
  //#region ../commerce/src/utils/assertNever.ts
845
930
  function assertNever(value, message) {
@@ -993,7 +1078,13 @@ function resolveAvailableBookingCollectionOptions(input) {
993
1078
  });
994
1079
  const collapsed = available.map((option) => isBookingCollectionEquivalentToUpfront(option) ? upfront : option);
995
1080
  const unique = collapsed.filter((option, index) => collapsed.findIndex((other) => other.kind === option.kind) === index);
996
- return unique.length > 0 ? unique : [upfront];
1081
+ return unique.length > 0 ? unique.map((option) => permitted(option, "configured")) : [permitted(upfront, "lateFallback")];
1082
+ }
1083
+ function permitted(option, permission) {
1084
+ return {
1085
+ ...option,
1086
+ permission
1087
+ };
997
1088
  }
998
1089
  function isBookingCollectionEquivalentToUpfront(option) {
999
1090
  switch (option.kind) {
@@ -1056,49 +1147,57 @@ function resolveBookingCollectionOptionFacts(input) {
1056
1147
  }
1057
1148
  /** Discounts change preview money, never an already admitted collection identity. */
1058
1149
  function repriceBookingCollectionOptions(input) {
1059
- const repriced = input.options.map((option) => option.totalCents === input.totalCents ? option : resolveBookingCollectionOptionFacts({
1150
+ const repriced = input.options.map((option) => option.totalCents === input.totalCents ? option : permitted(resolveBookingCollectionOptionFacts({
1060
1151
  option,
1061
1152
  totalCents: input.totalCents,
1062
1153
  anchorAt: option.anchorAt,
1063
1154
  bookingStartAt: option.bookingStartAt,
1064
1155
  timeZone: option.timeZone
1065
- }));
1156
+ }), option.permission));
1066
1157
  const available = repriced.filter((option) => canOfferBookingCollectionOption(option, input.currency, input.instalmentCollectionDeadlineAt));
1067
1158
  const first = repriced[0];
1068
- return available.length > 0 || !first ? available : [resolveBookingCollectionOptionFacts({
1159
+ return available.length > 0 || !first ? available : [permitted(resolveBookingCollectionOptionFacts({
1069
1160
  option: { kind: "upfront" },
1070
1161
  totalCents: input.totalCents,
1071
1162
  anchorAt: first.anchorAt,
1072
1163
  bookingStartAt: first.bookingStartAt,
1073
1164
  timeZone: first.timeZone
1074
- })];
1165
+ }), "lateFallback")];
1075
1166
  }
1076
1167
  /** The same admission is used for the offer and the submitted selection. */
1077
1168
  function canOfferBookingCollectionOption(option, currency, deadline = option.bookingStartAt) {
1169
+ return collectionDatesOpen(option, deadline) && laterCollectionsChargeable(option, currency);
1170
+ }
1171
+ /** The one date rule: whether an option's due dates still fall between now and the booking (or the owner's deadline). */
1172
+ function collectionDatesOpen(option, deadline) {
1078
1173
  if (option.kind === "upfront" || option.kind === "deferred_manual") return true;
1079
1174
  const window = bookingCollectionWindow(option);
1080
1175
  if (!window) return false;
1081
- const { now, start } = window;
1082
- if (option.kind === "flexible_balance") return flexibleBalanceCanBeCollected(option, currency, now, start);
1176
+ if (option.kind === "flexible_balance") {
1177
+ const localDay = (at) => formatLocalScheduleDate(getLocalScheduleDate(new Date(at), option.timeZone));
1178
+ return option.balanceDueDay >= localDay(window.now) && option.balanceDueDay < localDay(window.start);
1179
+ }
1083
1180
  return deadline !== null && canInstalmentPlanCompleteBefore({
1084
1181
  now: option.anchorAt,
1085
1182
  deadline,
1086
1183
  schedule: option.schedule
1087
- }) && laterInstalmentsCanBeCollected(option, currency, now);
1088
- }
1089
- function laterInstalmentsCanBeCollected(option, currency, now) {
1090
- return option.schedule.filter((row) => row.stateAtBooking === "scheduled").every((row) => Date.parse(row.dueAt) > now && !isStripeChargeBelowMinimum({
1091
- amountCents: row.amountCents,
1092
- currency
1093
- }));
1184
+ }) && option.schedule.every((row) => row.stateAtBooking !== "scheduled" || Date.parse(row.dueAt) > window.now);
1094
1185
  }
1095
- function flexibleBalanceCanBeCollected(option, currency, now, start) {
1096
- const today = formatLocalScheduleDate(getLocalScheduleDate(new Date(now), option.timeZone));
1097
- const startDay = formatLocalScheduleDate(getLocalScheduleDate(new Date(start), option.timeZone));
1098
- return option.balanceDueDay >= today && option.balanceDueDay < startDay && !isStripeChargeBelowMinimum({
1099
- amountCents: option.remainingBalanceCents,
1100
- currency
1101
- });
1186
+ /** The amount rule: every later collection is big enough to charge to a card. */
1187
+ function laterCollectionsChargeable(option, currency) {
1188
+ switch (option.kind) {
1189
+ case "upfront":
1190
+ case "deferred_manual": return true;
1191
+ case "flexible_balance": return !isStripeChargeBelowMinimum({
1192
+ amountCents: option.remainingBalanceCents,
1193
+ currency
1194
+ });
1195
+ case "instalment_plan": return option.schedule.every((row) => row.stateAtBooking !== "scheduled" || !isStripeChargeBelowMinimum({
1196
+ amountCents: row.amountCents,
1197
+ currency
1198
+ }));
1199
+ default: return assertNever(option);
1200
+ }
1102
1201
  }
1103
1202
  function bookingCollectionWindow(option) {
1104
1203
  const now = Date.parse(option.anchorAt);
@@ -1108,6 +1207,29 @@ function bookingCollectionWindow(option) {
1108
1207
  start
1109
1208
  } : null;
1110
1209
  }
1210
+ /** Instalment due dates don't depend on the amount; this total keeps every row (zero rows are dropped). */
1211
+ const SCHEDULE_DATES_TOTAL_CENTS = 1e9;
1212
+ /**
1213
+ * The date half of `canOfferBookingCollectionOption`, for a configured option
1214
+ * before any total is known: whether its dates still allow it to be offered.
1215
+ * Amount rules (Stripe minimums, a deposit below the total) are left out, so a
1216
+ * `true` here is an offer the total may still refuse. Upfront and pay-directly
1217
+ * options have no dates to miss.
1218
+ */
1219
+ function bookingCollectionDatesOpen(option, dates) {
1220
+ if (option.kind === "upfront" || option.kind === "deferred_manual") return true;
1221
+ if (!bookingCollectionWindow({
1222
+ anchorAt: dates.nowIso,
1223
+ bookingStartAt: dates.bookingStartAt
1224
+ })) return false;
1225
+ return collectionDatesOpen(resolveBookingCollectionOptionFacts({
1226
+ option,
1227
+ totalCents: SCHEDULE_DATES_TOTAL_CENTS,
1228
+ anchorAt: dates.nowIso,
1229
+ bookingStartAt: dates.bookingStartAt,
1230
+ timeZone: dates.timeZone
1231
+ }), dates.instalmentCollectionDeadlineAt === void 0 ? dates.bookingStartAt : dates.instalmentCollectionDeadlineAt);
1232
+ }
1111
1233
  /** Mirrors private.flexible_balance_due_day: fixed civil date, or local start minus calendar days. */
1112
1234
  function flexibleBalanceDueDay(config, bookingStartAt, timeZone) {
1113
1235
  const rule = config.dueDateRule;
@@ -1205,7 +1327,72 @@ const checkoutCopy = {
1205
1327
  checkoutAssistanceRequired: "We can’t confirm your last payment attempt yet. Please don’t pay again – contact the business so they can check it."
1206
1328
  };
1207
1329
  //#endregion
1330
+ //#region ../commerce/src/purchase/eventCheckoutRecoveryWindow.ts
1331
+ const EVENT_CHECKOUT_HOLD_DURATION_MS = 2100 * 1e3;
1332
+ //#endregion
1333
+ //#region ../commerce/src/purchase/roomWords.ts
1334
+ const PEOPLE_WORD = {
1335
+ guest: "you",
1336
+ staff: "them"
1337
+ };
1338
+ const PLACE_WORD = {
1339
+ women: "women's",
1340
+ men: "men's",
1341
+ mixed: "mixed"
1342
+ };
1343
+ const withArticle = (name) => `${/^(?:[aeiou]|8|11|18)/i.test(name) ? "an" : "a"} ${name}`;
1344
+ function bedPhrase(name, place) {
1345
+ return place === null ? `a shared ${name}` : `${withArticle(name)} (shared ${PLACE_WORD[place]} room)`;
1346
+ }
1347
+ function toThemselvesText(name, people, audience) {
1348
+ if (people > 1) return `${people} of ${PEOPLE_WORD[audience]} each have ${withArticle(name)} to ${audience === "guest" ? "yourself" : "themselves"}`;
1349
+ return audience === "guest" ? `You have ${withArticle(name)} to yourself` : `They have ${withArticle(name)} to themselves`;
1350
+ }
1351
+ /** One line of "How you'll stay", or "How they'll stay" in the staff dialog. */
1352
+ function stayLineText(line, audience) {
1353
+ const of = `${line.people} of ${PEOPLE_WORD[audience]}`;
1354
+ switch (line.kind) {
1355
+ case "to_themselves": return toThemselvesText(line.kindName, line.people, audience);
1356
+ case "share": return `${of} share ${withArticle(line.kindName)}`;
1357
+ case "beds": return `${of} ${line.people === 1 ? "has" : "each have"} a bed in ${bedPhrase(line.kindName, line.place)}`;
1358
+ }
1359
+ }
1360
+ function stayNoteText(note, audience) {
1361
+ const they = audience === "guest" ? "you'd" : "they'd";
1362
+ return `There isn't ${withArticle(note.kindName)} free for the ${note.people} of ${PEOPLE_WORD[audience]} together, so ${they} be in separate shared rooms.`;
1363
+ }
1364
+ const morePeopleText = (people) => people === 1 ? "1 more person" : `${people} more people`;
1365
+ const STAY_CHANGED_FOR_GUEST = "Someone else has just booked, so you'd now be in separate rooms. Carry on if that's OK. Here's how you'd stay.";
1366
+ function placementProblemText(problem, audience) {
1367
+ switch (problem.kind) {
1368
+ case "not_enough_places": return `Someone booked the last ${problem.kindName} place while you were ${audience === "guest" ? "choosing" : "adding them"}.`;
1369
+ case "whole_room_needs_more_people": return `${problem.kindName} is for ${problem.forPeople} of ${PEOPLE_WORD[audience]} booking together. Add ${morePeopleText(problem.morePeople)}, or choose another option.`;
1370
+ case "no_longer_together": return audience === "guest" ? STAY_CHANGED_FOR_GUEST : "Someone else has just booked, so they'd now be in separate rooms. Here's how they'd stay. Carry on if that's OK.";
1371
+ case "option_unavailable": return "That room option isn't available any more. Please choose another.";
1372
+ }
1373
+ }
1374
+ /**
1375
+ * The guest's page shows the words for a refusal's reason, with no room to name,
1376
+ * and then asks again: with fresh facts, `placementProblemText` says it better.
1377
+ */
1378
+ const ROOM_REFUSAL_REASON_MESSAGES = {
1379
+ roomNotEnoughPlaces: "Someone booked the last place in that room while you were choosing.",
1380
+ roomNeedsMorePeople: "That room needs more people booking together. Add more people, or choose another option.",
1381
+ roomStayChanged: STAY_CHANGED_FOR_GUEST,
1382
+ roomOptionsChanged: "The room options for this event have changed. Please check them and choose again.",
1383
+ roomsNeedChoices: "Rooms can't be booked here yet. Please book on the organiser's website."
1384
+ };
1385
+ //#endregion
1208
1386
  //#region ../commerce/src/purchase/event-registration-errors.ts
1387
+ /**
1388
+ * Said to a booker whose earlier unfinished booking this one can't replace, because nothing shows the
1389
+ * earlier one is theirs (#1832). They aren't where that booking is, so it can't ask them to pay for it
1390
+ * or cancel it here: it sends them back to where they started, or tells them when the places free up.
1391
+ */
1392
+ function earlierBookingUnpaid(subject, otherwise = "") {
1393
+ return `You’ve already started ${subject === null ? "a booking" : `a booking for ${subject}`} that isn’t paid yet. Go back to where you started it to pay, ${otherwise}or try again in about 40 minutes.`;
1394
+ }
1395
+ earlierBookingUnpaid("this date"), earlierBookingUnpaid("this run");
1209
1396
  const eventRegistrationErrors = {
1210
1397
  invalidAnswers: {
1211
1398
  endsCommand: false,
@@ -1267,6 +1454,12 @@ const eventRegistrationErrors = {
1267
1454
  message: "We couldn't set up payment for this booking, so your place hasn't been reserved and you haven't been charged. Please try again in a few minutes, or contact the organiser if it keeps happening.",
1268
1455
  action: "retry"
1269
1456
  },
1457
+ /** Payment couldn't start because the site can't take card payments, so retrying won't help. */
1458
+ onlinePaymentUnavailable: {
1459
+ endsCommand: true,
1460
+ message: "Online payment isn't available for this booking, so your place hasn't been reserved and you haven't been charged. Please contact the organiser to book.",
1461
+ action: "none"
1462
+ },
1270
1463
  registrationAttemptEnded: {
1271
1464
  endsCommand: true,
1272
1465
  message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
@@ -1277,6 +1470,31 @@ const eventRegistrationErrors = {
1277
1470
  message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
1278
1471
  action: "places"
1279
1472
  },
1473
+ roomNotEnoughPlaces: {
1474
+ endsCommand: false,
1475
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomNotEnoughPlaces,
1476
+ action: "places"
1477
+ },
1478
+ roomNeedsMorePeople: {
1479
+ endsCommand: false,
1480
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomNeedsMorePeople,
1481
+ action: "places"
1482
+ },
1483
+ roomStayChanged: {
1484
+ endsCommand: false,
1485
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomStayChanged,
1486
+ action: "places"
1487
+ },
1488
+ roomOptionsChanged: {
1489
+ endsCommand: false,
1490
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomOptionsChanged,
1491
+ action: "places"
1492
+ },
1493
+ roomsNeedChoices: {
1494
+ endsCommand: false,
1495
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomsNeedChoices,
1496
+ action: "none"
1497
+ },
1280
1498
  registrationAlreadyExists: {
1281
1499
  endsCommand: false,
1282
1500
  message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
@@ -1302,12 +1520,50 @@ const eventRegistrationErrors = {
1302
1520
  message: "You’ve already started booking this event. Please finish in the other tab if it’s still open, or check your booking status before starting again.",
1303
1521
  action: "portal"
1304
1522
  },
1523
+ /**
1524
+ * The server's own message says which date or run. This one is only shown if that's missing. The
1525
+ * earlier booking still stands, so the command isn't ended: the same attempt works once the hold lapses.
1526
+ */
1527
+ earlierBookingUnpaid: {
1528
+ endsCommand: false,
1529
+ message: earlierBookingUnpaid(null),
1530
+ action: "retry"
1531
+ },
1532
+ /**
1533
+ * Several dates or runs were chosen where only one can be booked at a time: the event's setting
1534
+ * changed after the form loaded, or the booking uses a waitlist invitation. The server's own message
1535
+ * says which, so this one is only shown if that's missing.
1536
+ */
1537
+ bookOneAtATime: {
1538
+ endsCommand: false,
1539
+ message: "These can’t be booked together. Untick all but one, then book the others separately.",
1540
+ action: "places"
1541
+ },
1305
1542
  invalidCommitInput: {
1306
1543
  endsCommand: false,
1307
1544
  message: "We couldn’t accept your booking details. Please check the information you entered and try again. If this keeps happening, contact the organiser for help.",
1308
1545
  action: "details"
1309
1546
  }
1310
1547
  };
1548
+ /**
1549
+ * The refusals said in the server's own words, because only the server knows what to name. The public
1550
+ * route sends a refusal's reason and never its service tag, so the reason is all a form has to go on.
1551
+ *
1552
+ * - An earlier unpaid booking: the words name the date or run, and say whether there's a date to untick.
1553
+ * - Several chosen where one is allowed: the words say whether it's dates or runs.
1554
+ * - A date or run that filled up while several were being booked: the words name it, so the booker
1555
+ * knows which to untick. One booking has nothing to name, so it keeps the reason's own message.
1556
+ */
1557
+ const serverWordedRefusals = {
1558
+ earlierBookingUnpaid: "always",
1559
+ bookOneAtATime: "always",
1560
+ capacityChanged: "several_bookings"
1561
+ };
1562
+ /** What a refusal says: the server's words where they say more, and the reason's own otherwise or when none came. */
1563
+ function eventRegistrationRefusalMessage(reason, serverMessage, bookings) {
1564
+ const worded = serverWordedRefusals[reason];
1565
+ return (worded === "always" || worded === "several_bookings" && bookings === "several") && serverMessage.trim().length > 0 ? serverMessage : eventRegistrationErrors[reason].message;
1566
+ }
1311
1567
  function parseEventRegistrationErrorReason(value) {
1312
1568
  return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
1313
1569
  }
@@ -1531,6 +1787,504 @@ function nextCombinationHint(input) {
1531
1787
  }).sort((a, b) => a.added.length - b.added.length || a.plan.totalCents - b.plan.totalCents || compareOffer(a.offer, b.offer))[0] ?? null;
1532
1788
  }
1533
1789
  //#endregion
1790
+ //#region ../commerce/src/purchase/roomPlacement.ts
1791
+ /** The ticket type for someone in a room with this many people in it. */
1792
+ function priceFor(kind, peopleInRoom) {
1793
+ const exact = kind.prices.find((price) => price.peopleInRoom === peopleInRoom);
1794
+ const flat = kind.prices.find((price) => price.peopleInRoom === null);
1795
+ return (exact ?? flat)?.pricingOptionId ?? null;
1796
+ }
1797
+ /** A party bigger than a room takes as many as it needs, filling each. */
1798
+ function roomSizes(people, sleeps) {
1799
+ return Array.from({ length: Math.ceil(people / sleeps) }, (_, index) => Math.min(sleeps, people - index * sleeps));
1800
+ }
1801
+ /** The fewest people above this that a room of this kind has a price for. */
1802
+ function nextPricedSize(kind, size) {
1803
+ const bigger = kind.prices.flatMap((price) => price.peopleInRoom !== null && price.peopleInRoom > size ? [price.peopleInRoom] : []);
1804
+ return bigger.length === 0 ? null : Math.min(...bigger);
1805
+ }
1806
+ /** A private room with no price for this few needs more people, or isn't on offer at all. */
1807
+ function unpricedPrivateRoom(kind, size) {
1808
+ const forPeople = nextPricedSize(kind, size);
1809
+ if (forPeople === null) return {
1810
+ kind: "option_unavailable",
1811
+ kindId: kind.id
1812
+ };
1813
+ return {
1814
+ kind: "whole_room_needs_more_people",
1815
+ kindId: kind.id,
1816
+ kindName: kind.name,
1817
+ forPeople,
1818
+ morePeople: forPeople - size
1819
+ };
1820
+ }
1821
+ function privateUnits(kind, choice) {
1822
+ const priced = (choice.way === "own" ? Array.from({ length: choice.people }, () => 1) : roomSizes(choice.people, kind.sleeps)).map((size) => ({
1823
+ size,
1824
+ pricingOptionId: priceFor(kind, size)
1825
+ }));
1826
+ const missing = priced.find((unit) => unit.pricingOptionId === null);
1827
+ if (missing) return err(unpricedPrivateRoom(kind, missing.size));
1828
+ return ok$1(priced.flatMap(({ size, pricingOptionId }) => pricingOptionId === null ? [] : [{
1829
+ kind,
1830
+ size,
1831
+ pricingOptionId
1832
+ }]));
1833
+ }
1834
+ /** Everyone who chose the same sharing option in one booking is one group. */
1835
+ function addSharing(groups, group) {
1836
+ const same = (other) => other.kind.id === group.kind.id && other.place === group.place;
1837
+ return groups.some(same) ? groups.map((other) => same(other) ? {
1838
+ ...other,
1839
+ people: other.people + group.people
1840
+ } : other) : [...groups, group];
1841
+ }
1842
+ function addChoice(request, kind, choice) {
1843
+ if (choice.way !== "sharing") {
1844
+ const units = privateUnits(kind, choice);
1845
+ return units.ok ? ok$1({
1846
+ ...request,
1847
+ privateUnits: [...request.privateUnits, ...units.value]
1848
+ }) : units;
1849
+ }
1850
+ const pricingOptionId = kind.sleeps > 1 ? priceFor(kind, kind.sleeps) : null;
1851
+ if (pricingOptionId === null) return err({
1852
+ kind: "option_unavailable",
1853
+ kindId: kind.id
1854
+ });
1855
+ return ok$1({
1856
+ ...request,
1857
+ sharingGroups: addSharing(request.sharingGroups, {
1858
+ kind,
1859
+ place: choice.place,
1860
+ people: choice.people,
1861
+ pricingOptionId
1862
+ })
1863
+ });
1864
+ }
1865
+ function readChoices(facts, choices) {
1866
+ return choices.reduce((request, choice) => {
1867
+ if (!request.ok) return request;
1868
+ const kind = facts.kinds.find((candidate) => candidate.id === choice.kindId);
1869
+ if (!kind || !Number.isInteger(choice.people) || choice.people < 1) return err({
1870
+ kind: "option_unavailable",
1871
+ kindId: choice.kindId
1872
+ });
1873
+ return addChoice(request.value, kind, choice);
1874
+ }, ok$1({
1875
+ privateUnits: [],
1876
+ sharingGroups: []
1877
+ }));
1878
+ }
1879
+ /** Whether a sharing group still to be placed in this booking could use the room. */
1880
+ function isWantedBy(room, groups) {
1881
+ return groups.some((group) => group.kind.id === room.kindId && roomTakesPlace(room, group.place));
1882
+ }
1883
+ /**
1884
+ * One-way rooms before "either" ones, so flexible rooms stay free longest. Then
1885
+ * rooms this booking's sharing groups can't use, so the order of the choices
1886
+ * can't turn away a booking that fits.
1887
+ */
1888
+ function privateRoomFor(rooms, kindId, groups) {
1889
+ const open = rooms.filter((room) => room.kindId === kindId && room.occupancy.bookedAs === "empty" && room.setup.way !== "shared");
1890
+ return open.find((room) => room.setup.way === "private") ?? open.find((room) => !isWantedBy(room, groups)) ?? open[0];
1891
+ }
1892
+ function placePrivate(working, unit, groups) {
1893
+ const room = privateRoomFor(working.facts.rooms, unit.kind.id, groups);
1894
+ if (!room) return err({
1895
+ kind: "not_enough_places",
1896
+ kindId: unit.kind.id,
1897
+ kindName: unit.kind.name
1898
+ });
1899
+ const seat = {
1900
+ roomId: room.id,
1901
+ kindId: unit.kind.id,
1902
+ kindName: unit.kind.name,
1903
+ pricingOptionId: unit.pricingOptionId,
1904
+ bookedAs: "private",
1905
+ place: null
1906
+ };
1907
+ return ok$1({
1908
+ ...working,
1909
+ facts: {
1910
+ ...working.facts,
1911
+ rooms: working.facts.rooms.map((other) => other.id === room.id ? {
1912
+ ...other,
1913
+ occupancy: { bookedAs: "private" },
1914
+ freePlaces: 0
1915
+ } : other)
1916
+ },
1917
+ seats: [...working.seats, ...Array.from({ length: unit.size }, () => seat)]
1918
+ });
1919
+ }
1920
+ /** A room becomes a women's or a men's room with its first guest, and never mixes them. */
1921
+ function roomTakesPlace(room, place) {
1922
+ const { setup, occupancy } = room;
1923
+ if (setup.way === "private" || occupancy.bookedAs === "private" || room.freePlaces < 1) return false;
1924
+ return placesFor(setup.forWho).includes(place) && (occupancy.bookedAs === "empty" || occupancy.place === place);
1925
+ }
1926
+ /** One-way rooms first. Within each, part-full rooms before empty ones, which keeps rooms open for private booking. */
1927
+ function sharingRank(room) {
1928
+ return (room.setup.way === "shared" ? 0 : 2) + (room.occupancy.bookedAs === "shared" ? 0 : 1);
1929
+ }
1930
+ function fill(rooms, people) {
1931
+ return rooms.reduce(({ left, taken }, room) => {
1932
+ const count = Math.min(left, room.freePlaces);
1933
+ return {
1934
+ left: left - count,
1935
+ taken: count > 0 ? [...taken, {
1936
+ room,
1937
+ count
1938
+ }] : taken
1939
+ };
1940
+ }, {
1941
+ left: people,
1942
+ taken: []
1943
+ }).taken;
1944
+ }
1945
+ /** A person in each room while there's another room to use, then the rest wherever there's space. */
1946
+ function spread(rooms, people) {
1947
+ const first = rooms.slice(0, people);
1948
+ const leftOver = fill(first.map((room) => ({
1949
+ ...room,
1950
+ freePlaces: room.freePlaces - 1
1951
+ })).concat(rooms.slice(people)), people - first.length);
1952
+ return rooms.flatMap((room) => {
1953
+ const count = (first.includes(room) ? 1 : 0) + (leftOver.find((taken) => taken.room.id === room.id)?.count ?? 0);
1954
+ return count > 0 ? [{
1955
+ room,
1956
+ count
1957
+ }] : [];
1958
+ });
1959
+ }
1960
+ /** All in one room if there's one with space, or else filling each in turn. */
1961
+ function keepTogether(rooms, people) {
1962
+ const whole = rooms.find((room) => room.freePlaces >= people);
1963
+ return whole ? [{
1964
+ room: whole,
1965
+ count: people
1966
+ }] : fill(rooms, people);
1967
+ }
1968
+ /** Rooms later groups can't use come first, and are all this group gets if they're enough. */
1969
+ function roomsLeavingSpaceFor(open, people, later) {
1970
+ const spare = open.filter((room) => !isWantedBy(room, later));
1971
+ if (spare.reduce((sum, room) => sum + room.freePlaces, 0) >= people) return spare;
1972
+ return [...spare, ...open.filter((room) => isWantedBy(room, later))];
1973
+ }
1974
+ function placeSharing(working, group, later) {
1975
+ const { facts } = working;
1976
+ const { kind, place, people } = group;
1977
+ const open = facts.rooms.filter((room) => room.kindId === kind.id && roomTakesPlace(room, place)).map((room, index) => ({
1978
+ room,
1979
+ index
1980
+ })).sort((left, right) => sharingRank(left.room) - sharingRank(right.room) || left.index - right.index).map(({ room }) => room);
1981
+ if (open.reduce((sum, room) => sum + room.freePlaces, 0) < people) return err({
1982
+ kind: "not_enough_places",
1983
+ kindId: kind.id,
1984
+ kindName: kind.name
1985
+ });
1986
+ const candidates = roomsLeavingSpaceFor(open, people, later);
1987
+ const allocations = facts.arrangement === "separate" ? spread(candidates, people) : keepTogether(candidates, people);
1988
+ const countIn = (roomId) => allocations.find((taken) => taken.room.id === roomId)?.count ?? 0;
1989
+ return ok$1({
1990
+ facts: {
1991
+ ...facts,
1992
+ rooms: facts.rooms.map((room) => countIn(room.id) > 0 ? {
1993
+ ...room,
1994
+ occupancy: {
1995
+ bookedAs: "shared",
1996
+ place
1997
+ },
1998
+ freePlaces: room.freePlaces - countIn(room.id)
1999
+ } : room)
2000
+ },
2001
+ seats: [...working.seats, ...allocations.flatMap(({ room, count }) => Array.from({ length: count }, () => ({
2002
+ roomId: room.id,
2003
+ kindId: kind.id,
2004
+ kindName: kind.name,
2005
+ pricingOptionId: group.pricingOptionId,
2006
+ bookedAs: "shared",
2007
+ place
2008
+ })))],
2009
+ sharing: [...working.sharing, {
2010
+ kindId: kind.id,
2011
+ kindName: kind.name,
2012
+ place,
2013
+ people,
2014
+ together: allocations.length === 1
2015
+ }]
2016
+ });
2017
+ }
2018
+ /** Every room of this kind that can be shared is mixed, so there's no choice of place to mention. */
2019
+ function kindIsAllMixed(facts, kindId) {
2020
+ return facts.rooms.every((room) => room.kindId !== kindId || room.setup.way === "private" || room.setup.forWho === "mixed");
2021
+ }
2022
+ function privateStayLine(unit) {
2023
+ return unit.size === 1 ? {
2024
+ kind: "to_themselves",
2025
+ kindName: unit.kind.name,
2026
+ people: 1
2027
+ } : {
2028
+ kind: "share",
2029
+ kindName: unit.kind.name,
2030
+ people: unit.size
2031
+ };
2032
+ }
2033
+ /** People on their own in one kind of room read as one line. */
2034
+ function mergeToThemselves(lines, line) {
2035
+ const same = (other) => other.kind === "to_themselves" && line.kind === "to_themselves" && other.kindName === line.kindName;
2036
+ return lines.some(same) ? lines.map((other) => same(other) ? {
2037
+ ...other,
2038
+ people: other.people + line.people
2039
+ } : other) : [...lines, line];
2040
+ }
2041
+ function sharingStayLine(facts, outcome) {
2042
+ if (facts.arrangement === "together" && outcome.together && outcome.people > 1) return {
2043
+ kind: "share",
2044
+ kindName: outcome.kindName,
2045
+ people: outcome.people
2046
+ };
2047
+ return {
2048
+ kind: "beds",
2049
+ kindName: outcome.kindName,
2050
+ people: outcome.people,
2051
+ place: kindIsAllMixed(facts, outcome.kindId) ? null : outcome.place
2052
+ };
2053
+ }
2054
+ function chargedLines(seats) {
2055
+ return [...new Set(seats.map((seat) => seat.pricingOptionId))].map((pricingOptionId) => ({
2056
+ pricingOptionId,
2057
+ quantity: seats.filter((seat) => seat.pricingOptionId === pricingOptionId).length
2058
+ }));
2059
+ }
2060
+ function toPlacement(request, working) {
2061
+ const { facts } = working;
2062
+ return {
2063
+ kind: "placed",
2064
+ guests: working.seats.map((seat, guestPosition) => ({
2065
+ ...seat,
2066
+ guestPosition
2067
+ })),
2068
+ ticketLines: chargedLines(working.seats),
2069
+ sharing: working.sharing,
2070
+ stay: [...request.privateUnits.map(privateStayLine).reduce(mergeToThemselves, []), ...working.sharing.map((outcome) => sharingStayLine(facts, outcome))],
2071
+ notes: facts.arrangement === "together" ? working.sharing.flatMap((outcome) => outcome.together ? [] : [{
2072
+ kind: "separate_rooms",
2073
+ kindName: outcome.kindName,
2074
+ people: outcome.people
2075
+ }]) : []
2076
+ };
2077
+ }
2078
+ /**
2079
+ * Places a booking. Private choices go first, because sharing could otherwise
2080
+ * take the only empty room. A preference about sharing never refuses a booking.
2081
+ */
2082
+ function placeBooking(facts, choices) {
2083
+ const request = readChoices(facts, choices);
2084
+ if (!request.ok) return request.error;
2085
+ const { privateUnits: units, sharingGroups: groups } = request.value;
2086
+ const start = ok$1({
2087
+ facts,
2088
+ seats: [],
2089
+ sharing: []
2090
+ });
2091
+ const afterPrivate = units.reduce((working, unit) => working.ok ? placePrivate(working.value, unit, groups) : working, start);
2092
+ const placed = groups.reduce((working, group, index) => working.ok ? placeSharing(working.value, group, groups.slice(index + 1)) : working, afterPrivate);
2093
+ return placed.ok ? toPlacement(request.value, placed.value) : placed.error;
2094
+ }
2095
+ /** Each person's price in a whole room still waiting for more people, the same "each" its row shows. */
2096
+ function waitingRoomLines(kind, people) {
2097
+ return roomSizes(people, kind.sleeps).flatMap((size) => {
2098
+ const pricingOptionId = priceFor(kind, size) ?? priceFor(kind, nextPricedSize(kind, size) ?? size);
2099
+ return pricingOptionId ? [{
2100
+ pricingOptionId,
2101
+ quantity: size
2102
+ }] : [];
2103
+ });
2104
+ }
2105
+ /**
2106
+ * What can be counted while the booking as a whole can't go ahead: every choice
2107
+ * that still fits, and a whole room waiting for its other people if there's still
2108
+ * a room for them. A choice whose place has gone isn't counted, so it can't read
2109
+ * as a place they still hold.
2110
+ */
2111
+ function countSoFar(facts, choices) {
2112
+ const { fitting, waiting } = choices.reduce((sofar, choice) => {
2113
+ const placed = placeBooking(facts, [...sofar.fitting, choice]);
2114
+ if (placed.kind === "placed") return {
2115
+ ...sofar,
2116
+ fitting: [...sofar.fitting, choice]
2117
+ };
2118
+ if (placed.kind !== "whole_room_needs_more_people") return sofar;
2119
+ const withThem = {
2120
+ ...choice,
2121
+ people: choice.people + placed.morePeople
2122
+ };
2123
+ return placeBooking(facts, [...sofar.fitting, withThem]).kind === "placed" ? {
2124
+ ...sofar,
2125
+ waiting: [...sofar.waiting, choice]
2126
+ } : sofar;
2127
+ }, {
2128
+ fitting: [],
2129
+ waiting: []
2130
+ });
2131
+ const placed = placeBooking(facts, fitting);
2132
+ const waitingLines = waiting.flatMap((choice) => {
2133
+ const kind = facts.kinds.find((candidate) => candidate.id === choice.kindId);
2134
+ return kind ? waitingRoomLines(kind, choice.people) : [];
2135
+ });
2136
+ const ticketLines = [...placed.kind === "placed" ? placed.ticketLines : [], ...waitingLines];
2137
+ return {
2138
+ people: ticketLines.reduce((sum, line) => sum + line.quantity, 0),
2139
+ ticketLines
2140
+ };
2141
+ }
2142
+ /** The outcome to send with the booking, so the server can tell if it has changed. */
2143
+ function reviewedStay(placement) {
2144
+ return placement.sharing.map(({ kindId, place, together }) => ({
2145
+ kindId,
2146
+ place,
2147
+ together
2148
+ }));
2149
+ }
2150
+ //#endregion
2151
+ //#region ../commerce/src/purchase/roomOptions.ts
2152
+ function optionKey(choice) {
2153
+ return choice.way === "sharing" ? `${choice.kindId}:sharing:${choice.place}` : `${choice.kindId}:${choice.way}`;
2154
+ }
2155
+ function sameRoomOption(left, right) {
2156
+ return optionKey(left) === optionKey(right);
2157
+ }
2158
+ const withPeople = (choice, people) => ({
2159
+ ...choice,
2160
+ people
2161
+ });
2162
+ /** The choices with this option set to a number of people. Nobody means it's gone. */
2163
+ function setRoomChoicePeople(choices, option, people) {
2164
+ const others = choices.filter((choice) => !sameRoomOption(choice, option));
2165
+ if (people <= 0) return others;
2166
+ return choices.some((choice) => sameRoomOption(choice, option)) ? choices.map((choice) => sameRoomOption(choice, option) ? withPeople(option, people) : choice) : [...choices, withPeople(option, people)];
2167
+ }
2168
+ /** Every place a room of this kind can be shared as, whoever's in it now. */
2169
+ function sharedPlaces(facts, kindId) {
2170
+ const forWho = facts.rooms.flatMap(({ kindId: roomKind, setup }) => roomKind === kindId && setup.way !== "private" ? [setup.forWho] : []);
2171
+ return ROOM_PLACES.filter((place) => forWho.some((who) => placesFor(who).includes(place)));
2172
+ }
2173
+ function sharingTitle(facts, kindId, place) {
2174
+ return kindIsAllMixed(facts, kindId) ? "Sharing" : `A bed in a shared ${PLACE_WORD[place]} room`;
2175
+ }
2176
+ function wholeRoomDetail(kind, audience) {
2177
+ const sizes = kind.prices.map((price) => price.peopleInRoom ?? 2).filter((size) => size > 1);
2178
+ return `For ${Math.min(...sizes, kind.sleeps) < kind.sleeps ? "up to " : ""}${kind.sleeps} of ${audience === "guest" ? "you" : "them"}. Add a place for each.`;
2179
+ }
2180
+ /** The price for the people added so far, or for a full room before there are two of them. */
2181
+ function wholeRoomPrice(kind, people) {
2182
+ return priceFor(kind, people >= 2 ? Math.min(people, kind.sleeps) : kind.sleeps);
2183
+ }
2184
+ /** Sharing first, as most guests want, then the room to yourself. */
2185
+ function optionDrafts(facts, kind, audience) {
2186
+ const rooms = facts.rooms.filter((room) => room.kindId === kind.id);
2187
+ const sharing = kind.sleeps > 1 ? sharedPlaces(facts, kind.id).map((place) => ({
2188
+ choice: {
2189
+ kindId: kind.id,
2190
+ way: "sharing",
2191
+ place
2192
+ },
2193
+ title: sharingTitle(facts, kind.id, place),
2194
+ detail: null,
2195
+ each: false,
2196
+ priceFor: () => priceFor(kind, kind.sleeps)
2197
+ })) : [];
2198
+ const whole = kind.sleeps > 1 && rooms.some((room) => room.setup.way === "private") ? [{
2199
+ choice: {
2200
+ kindId: kind.id,
2201
+ way: "whole_room"
2202
+ },
2203
+ title: "The whole room",
2204
+ detail: wholeRoomDetail(kind, audience),
2205
+ each: true,
2206
+ priceFor: (people) => wholeRoomPrice(kind, people)
2207
+ }] : [];
2208
+ const own = rooms.some((room) => room.setup.way !== "shared") ? [{
2209
+ choice: {
2210
+ kindId: kind.id,
2211
+ way: "own"
2212
+ },
2213
+ title: audience === "guest" ? "On your own" : "On their own",
2214
+ detail: null,
2215
+ each: false,
2216
+ priceFor: () => priceFor(kind, 1)
2217
+ }] : [];
2218
+ return [
2219
+ ...sharing,
2220
+ ...whole,
2221
+ ...own
2222
+ ];
2223
+ }
2224
+ function peopleWithOption(choices, option) {
2225
+ return choices.find((choice) => sameRoomOption(choice, option))?.people ?? 0;
2226
+ }
2227
+ /**
2228
+ * The most people this option could take, asked of placement itself. A choice
2229
+ * that can't stand yet (one person in a room for two) doesn't count against the
2230
+ * others, or adding it would make every other option vanish.
2231
+ */
2232
+ function mostPeopleFor(facts, choices, option) {
2233
+ const others = choices.filter((choice) => !sameRoomOption(choice, option) && placeBooking(facts, [choice]).kind === "placed");
2234
+ const free = facts.rooms.reduce((sum, room) => room.kindId === option.kindId ? sum + room.freePlaces : sum, 0);
2235
+ const fits = (people) => placeBooking(facts, [...others, withPeople(option, people)]).kind === "placed";
2236
+ return Array.from({ length: free }, (_, index) => free - index).find(fits) ?? 0;
2237
+ }
2238
+ function kindOptions(facts, kind, choices, audience) {
2239
+ const options = optionDrafts(facts, kind, audience).flatMap((draft) => {
2240
+ const people = peopleWithOption(choices, draft.choice);
2241
+ const pricingOptionId = draft.priceFor(people);
2242
+ const mostPeople = mostPeopleFor(facts, choices, draft.choice);
2243
+ if (pricingOptionId === null || mostPeople === 0 && people === 0) return [];
2244
+ const { choice, title, detail, each } = draft;
2245
+ return [{
2246
+ key: optionKey(choice),
2247
+ choice,
2248
+ title,
2249
+ detail,
2250
+ each,
2251
+ pricingOptionId,
2252
+ people,
2253
+ mostPeople
2254
+ }];
2255
+ });
2256
+ return {
2257
+ kindId: kind.id,
2258
+ kindName: kind.name,
2259
+ options,
2260
+ fullyBooked: options.length === 0
2261
+ };
2262
+ }
2263
+ /** What to offer for each kind of room. A kind with no price on sale can't be booked, so it isn't listed. */
2264
+ function roomKindOptions(facts, choices, audience) {
2265
+ return facts.kinds.filter((kind) => kind.prices.length > 0).map((kind) => kindOptions(facts, kind, choices, audience));
2266
+ }
2267
+ /** Whether anyone in this kind of room could end up sharing. */
2268
+ function roomsOfferSharing(facts) {
2269
+ return facts.kinds.some((kind) => kind.sleeps > 1 && sharedPlaces(facts, kind.id).length > 0);
2270
+ }
2271
+ function leftText(count, noun) {
2272
+ if (count < 1 || count > 3) return null;
2273
+ return `${count} ${noun}${count === 1 ? "" : "s"} left`;
2274
+ }
2275
+ /**
2276
+ * What's left of this option, only once there are few enough to matter. A bed is
2277
+ * a place. The whole room and "on your own" both use up a room, so they count
2278
+ * rooms, and the same room can't read as different stock from one row to the next.
2279
+ */
2280
+ function placesLeftText(option, sleeps) {
2281
+ switch (option.choice.way) {
2282
+ case "sharing": return leftText(option.mostPeople, "place");
2283
+ case "whole_room": return leftText(Math.ceil(option.mostPeople / sleeps), "room");
2284
+ case "own": return leftText(option.mostPeople, "room");
2285
+ }
2286
+ }
2287
+ //#endregion
1534
2288
  //#region ../site-contracts/src/siteData/eventSelection.ts
1535
2289
  function isHybrid(item) {
1536
2290
  return item.deliveryMode === "hybrid";
@@ -2262,7 +3016,7 @@ const headingClassFromAlignment = {
2262
3016
  summary: "Append text alignment class to a base heading class",
2263
3017
  run: (value, options) => {
2264
3018
  const alignClass = (typeof value === "string" && value === "center" ? "center" : "left") === "center" ? "rb-text-center" : "rb-text-left";
2265
- return `${options.base} ${alignClass}`.trim();
3019
+ return `${options.base ?? ""} ${alignClass}`.trim();
2266
3020
  }
2267
3021
  };
2268
3022
  const bodyClassFromAlignment = {
@@ -2271,7 +3025,7 @@ const bodyClassFromAlignment = {
2271
3025
  summary: "Append body alignment helper classes to a base class",
2272
3026
  run: (value, options) => {
2273
3027
  const extra = (typeof value === "string" && value === "center" ? "center" : "left") === "center" ? "rb-mx-auto rb-text-center" : "";
2274
- return `${options.base} ${extra}`.trim();
3028
+ return `${options.base ?? ""} ${extra}`.trim();
2275
3029
  }
2276
3030
  };
2277
3031
  const stackAlignFromAlignment = {
@@ -5242,7 +5996,21 @@ function createInteractiveIslandCodec(options) {
5242
5996
  }
5243
5997
  //#endregion
5244
5998
  //#region ../blocks/src/system/runtime/nodes/booking-form.service-pricing.ts
5999
+ /**
6000
+ * The amounts the client can choose for a sliding-scale service. A site that
6001
+ * can't take cards yet (the server says `pending_stripe_setup`) can only take
6002
+ * the free end of the scale online, so a scale that starts at nothing narrows
6003
+ * to nothing; one that starts higher stays as it is and needs a card.
6004
+ */
5245
6005
  function getBookingServiceSlidingScale(service) {
6006
+ const scale = configuredSlidingScale(service);
6007
+ return scale && scale.minAmount === 0 && service?.paymentTermsAvailability?.kind === "pending_stripe_setup" ? {
6008
+ ...scale,
6009
+ maxAmount: 0,
6010
+ suggestedAmount: 0
6011
+ } : scale;
6012
+ }
6013
+ function configuredSlidingScale(service) {
5246
6014
  const pricing = service?.pricing;
5247
6015
  if (!pricing || pricing.pricingStrategy !== "sliding_scale" || pricing.slidingMinAmount === null || pricing.slidingMinAmount === void 0 || pricing.slidingMaxAmount === null || pricing.slidingMaxAmount === void 0) return null;
5248
6016
  return {
@@ -5284,11 +6052,15 @@ function resolveBookingPurchasablePackages(enabled, state) {
5284
6052
  }
5285
6053
  }
5286
6054
  function resolveBookingPaymentAvailability(perSession, held, purchase) {
5287
- if (perSession || held.items.length > 0 || purchase.kind === "ready" && purchase.items.length > 0) return { kind: "available" };
6055
+ if (perSession || heldPackagesOffered(held) || purchase.kind === "ready" && purchase.items.length > 0) return { kind: "available" };
5288
6056
  if (held.kind === "loading" || held.kind === "idle" || purchase.kind === "loading") return { kind: "loading" };
5289
6057
  if (held.kind === "error" || purchase.kind === "error") return { kind: "load_error" };
5290
6058
  return { kind: "no_choices" };
5291
6059
  }
6060
+ /** Packages held with one team member count: the payment step offers to book with them. */
6061
+ function heldPackagesOffered(held) {
6062
+ return held.items.length > 0 || held.kind === "ready" && held.heldWithTeamMembers.length > 0;
6063
+ }
5292
6064
  /** Disclose the package's purchase price; server settlement may require a review for discounts or credit. */
5293
6065
  function bookingPackagePurchaseTerms(product, promisedDiscountId) {
5294
6066
  return {
@@ -5330,10 +6102,20 @@ function resolveBookingPackageSources(service, enabled, bearerAuth) {
5330
6102
  const packageOnly = service?.onlinePaymentChoices?.perSession === false;
5331
6103
  return {
5332
6104
  packageOnly,
5333
- held: resolveHeldPackageSource(service, service?.onlinePaymentChoices?.heldPackage !== false && (enabled || packageOnly), bearerAuth),
6105
+ held: resolveHeldPackageSource(service, serviceOffersHeldPackages(service, enabled || packageOnly, bearerAuth), bearerAuth),
5334
6106
  canBuy: service?.onlinePaymentChoices?.buyPackage === true
5335
6107
  };
5336
6108
  }
6109
+ /**
6110
+ * Whether the client's own packages are offered for this service at all.
6111
+ * Forms turn packages on once the client is signed in, so signed out, a
6112
+ * service that says it takes them still counts: signing in may let them pay
6113
+ * with one.
6114
+ */
6115
+ function serviceOffersHeldPackages(service, enabled, bearerAuth) {
6116
+ const heldPackage = service?.onlinePaymentChoices?.heldPackage;
6117
+ return heldPackage !== false && (enabled || !bearerAuth && heldPackage === true);
6118
+ }
5337
6119
  function resolveHeldPackageSource(service, enabled, bearerAuth) {
5338
6120
  if (!enabled) return "disabled";
5339
6121
  if (!heldPackageServiceEligible(service)) return "missing-priced-service";
@@ -5354,7 +6136,7 @@ function bookingPackageRequestKey(enabled, serviceId, resourceId) {
5354
6136
  function applyBookingPaymentAdmission(services, unrestrictedHeldServiceId) {
5355
6137
  return services.map((service) => {
5356
6138
  const choices = service.onlinePaymentChoices;
5357
- if (service.requiresApproval) return {
6139
+ if (service.requiresApproval || service.onlinePaymentChoices?.perSession !== false && !getBookingServiceSlidingScale(service) && (service.priceAmount ?? 0) === 0) return {
5358
6140
  ...service,
5359
6141
  onlinePaymentChoices: {
5360
6142
  perSession: true,
@@ -5391,6 +6173,37 @@ const BOOKING_FORM_DATA_RESERVED_KEY_VALUES = [
5391
6173
  ];
5392
6174
  const BOOKING_FORM_DATA_RESERVED_KEYS = new Set(BOOKING_FORM_DATA_RESERVED_KEY_VALUES);
5393
6175
  //#endregion
6176
+ //#region ../blocks/src/system/runtime/shared/utils/formatting.ts
6177
+ /**
6178
+ * Shared Formatting Utilities
6179
+ *
6180
+ * Currency and date formatting helpers for registration blocks.
6181
+ */
6182
+ /**
6183
+ * Format a price in cents to a localized currency string.
6184
+ *
6185
+ * @param cents - Price in cents
6186
+ * @param currency - ISO 4217 currency code (e.g., 'USD', 'GBP')
6187
+ * @param locale - Optional locale override (defaults to the currency's locale)
6188
+ * Whole amounts drop the pence ("£245"); fractional ones keep two places ("£8.50").
6189
+ *
6190
+ * @returns Formatted price string (e.g., "£100" or "£8.50")
6191
+ */
6192
+ function formatPrice(cents, currency = "GBP", locale) {
6193
+ return formatCurrencyAmount(cents, currency, {
6194
+ decimals: "auto",
6195
+ locale
6196
+ });
6197
+ }
6198
+ /**
6199
+ * Format minor units as a plain amount for a number input, following the same
6200
+ * rule as `formatPrice`: whole amounts drop the pence ("8"), fractional ones
6201
+ * keep two places ("8.50").
6202
+ */
6203
+ function formatCentsAsCurrencyInput(amount) {
6204
+ return amount % 100 === 0 ? String(amount / 100) : (amount / 100).toFixed(2);
6205
+ }
6206
+ //#endregion
5394
6207
  //#region ../blocks/src/system/runtime/shared/bookingQuestionsAnswers.ts
5395
6208
  const EMPTY_BOOKING_QUESTIONS_ANSWERS = {
5396
6209
  scope: null,
@@ -5578,6 +6391,19 @@ function decideBookingQuestionsRestoration(source) {
5578
6391
  answerMode: draft.answerMode
5579
6392
  });
5580
6393
  }
6394
+ if (source.kind === "tab_draft") {
6395
+ const { draft, identity } = source;
6396
+ const answers = tabDraftAnswersStillAsked(draft, source.current);
6397
+ if (Object.keys(answers).length === 0) return null;
6398
+ return decided({
6399
+ scope: {
6400
+ identity,
6401
+ requirementId: draft.requirementId
6402
+ },
6403
+ edits: answers,
6404
+ answerMode: "answers"
6405
+ });
6406
+ }
5581
6407
  const { snapshot, currentIdentity } = source;
5582
6408
  if (!isBookingQuestionsOwner(snapshot.owner, currentIdentity)) return null;
5583
6409
  const scope = {
@@ -5607,6 +6433,64 @@ function restoreBookingQuestionsAnswers(state, restoration) {
5607
6433
  answerMode: restoration.answerMode
5608
6434
  };
5609
6435
  }
6436
+ const scalarQuestionTypes = [
6437
+ "text",
6438
+ "email",
6439
+ "textarea",
6440
+ "select",
6441
+ "radio",
6442
+ "checkbox",
6443
+ "tel",
6444
+ "url",
6445
+ "number",
6446
+ "date",
6447
+ "time"
6448
+ ];
6449
+ const plainAnswerSchema = z.union([
6450
+ z.string(),
6451
+ z.number(),
6452
+ z.boolean(),
6453
+ z.null(),
6454
+ z.array(z.string())
6455
+ ]);
6456
+ const bookingQuestionsTabDraftSchema = z.object({
6457
+ requirementId: z.string().min(1),
6458
+ answers: z.record(z.string(), z.object({
6459
+ type: z.enum(scalarQuestionTypes),
6460
+ value: plainAnswerSchema
6461
+ }))
6462
+ });
6463
+ function questionSet(presentation) {
6464
+ return presentation.kind === "none" || presentation.kind === "unavailable" ? null : presentation.set;
6465
+ }
6466
+ function scalarQuestions(presentation) {
6467
+ const set = questionSet(presentation);
6468
+ return new Map((set?.sections ?? []).flatMap((section) => section.items).flatMap((item) => item.type === "document_upload" ? [] : [[item.id, item.type]]));
6469
+ }
6470
+ /** The booker's own answers to the set they were shown, to keep in this tab; null when there's nothing to keep. */
6471
+ function toBookingQuestionsTabDraft(state, shown) {
6472
+ const requirementId = bookingQuestionsRequirementId(shown);
6473
+ if (!state.scope || requirementId === null || state.scope.requirementId !== requirementId || state.answerMode === "keep_existing") return null;
6474
+ const types = scalarQuestions(shown);
6475
+ const answers = Object.fromEntries(Object.entries(state.edits).flatMap(([id, value]) => {
6476
+ const type = types.get(id);
6477
+ const plain = plainAnswerSchema.safeParse(value);
6478
+ return type && plain.success ? [[id, {
6479
+ type,
6480
+ value: plain.data
6481
+ }]] : [];
6482
+ }));
6483
+ return Object.keys(answers).length > 0 ? {
6484
+ requirementId,
6485
+ answers
6486
+ } : null;
6487
+ }
6488
+ /** Kept answers whose question is still asked, as the same kind of question, in the same set. */
6489
+ function tabDraftAnswersStillAsked(draft, current) {
6490
+ if (bookingQuestionsRequirementId(current) !== draft.requirementId) return {};
6491
+ const types = scalarQuestions(current);
6492
+ return Object.fromEntries(Object.entries(draft.answers).filter(([id, answer]) => types.get(id) === answer.type).map(([id, answer]) => [id, answer.value]));
6493
+ }
5610
6494
  //#endregion
5611
6495
  //#region ../blocks/src/system/runtime/nodes/booking-form.questions.ts
5612
6496
  const EMPTY_APPOINTMENT_BOOKING_QUESTIONS = EMPTY_BOOKING_QUESTIONS_ANSWERS;
@@ -5655,37 +6539,6 @@ function projectSelectedAppointmentConsentIntoForm(form, selectedConsent) {
5655
6539
  };
5656
6540
  }
5657
6541
  //#endregion
5658
- //#region ../blocks/src/system/runtime/shared/utils/formatting.ts
5659
- /**
5660
- * Shared Formatting Utilities
5661
- *
5662
- * Currency and date formatting helpers for registration blocks.
5663
- */
5664
- /**
5665
- * Format a price in cents to a localized currency string.
5666
- *
5667
- * @param cents - Price in cents
5668
- * @param currency - ISO 4217 currency code (e.g., 'USD', 'GBP')
5669
- * @param locale - Optional locale override (defaults to the currency's locale)
5670
- * Whole amounts drop the pence ("£245"); fractional ones keep two places ("£8.50").
5671
- *
5672
- * @returns Formatted price string (e.g., "£100" or "£8.50")
5673
- */
5674
- function formatPrice(cents, currency = "GBP", locale) {
5675
- return formatCurrencyAmount(cents, currency, {
5676
- decimals: "auto",
5677
- locale
5678
- });
5679
- }
5680
- /**
5681
- * Format minor units as a plain amount for a number input, following the same
5682
- * rule as `formatPrice`: whole amounts drop the pence ("8"), fractional ones
5683
- * keep two places ("8.50").
5684
- */
5685
- function formatCentsAsCurrencyInput(amount) {
5686
- return amount % 100 === 0 ? String(amount / 100) : (amount / 100).toFixed(2);
5687
- }
5688
- //#endregion
5689
6542
  //#region ../blocks/src/system/runtime/nodes/booking-form.state.ts
5690
6543
  function toTrimmedString(value) {
5691
6544
  const trimmed = value?.trim();
@@ -5817,7 +6670,7 @@ function deriveBookingFormViewState(input) {
5817
6670
  kind: "success",
5818
6671
  resourceName: input.verificationState.resourceName
5819
6672
  };
5820
- default: return assertNever$1(input.verificationState);
6673
+ default: return assertNever$2(input.verificationState);
5821
6674
  }
5822
6675
  }
5823
6676
  function resolveBookingSiteId(siteId, form) {
@@ -5993,7 +6846,8 @@ function resolveBookingPaymentStep(input) {
5993
6846
  kind: "unavailable",
5994
6847
  mode: "unsupported",
5995
6848
  service,
5996
- errorMessage: "Online payments are not set up for this service yet."
6849
+ reason: "cardPaymentsUnavailable",
6850
+ errorMessage: "Card payments aren’t set up for this service yet."
5997
6851
  };
5998
6852
  const [first, ...rest] = resolveAvailableBookingCollectionOptions({
5999
6853
  paymentTerms: service.paymentTerms ?? { allowedOptions: [{ kind: "upfront" }] },
@@ -6007,10 +6861,26 @@ function resolveBookingPaymentStep(input) {
6007
6861
  kind: "unavailable",
6008
6862
  mode: "unsupported",
6009
6863
  service,
6864
+ reason: "paymentOptionsUnavailable",
6010
6865
  errorMessage: "This service has a payment configuration that cannot be booked right now."
6011
6866
  };
6012
6867
  return resolveReadyBookingPayment(service, [first, ...rest], input.data.selectedCollectionOptionKind);
6013
6868
  }
6869
+ /**
6870
+ * The same decision at the least the client can choose to pay, whatever
6871
+ * they've typed so far: whether some per-session choice can go ahead at all.
6872
+ * A sliding scale that starts at nothing is free at its low end.
6873
+ */
6874
+ function resolveLowestBookingPaymentStep(input) {
6875
+ const slidingScale = getBookingServiceSlidingScale(resolveBookingSelectedService(input));
6876
+ return resolveBookingPaymentStep(slidingScale ? {
6877
+ ...input,
6878
+ data: {
6879
+ ...input.data,
6880
+ selectedSlidingAmountInput: formatCentsAsCurrencyInput(slidingScale.minAmount)
6881
+ }
6882
+ } : input);
6883
+ }
6014
6884
  function resolveReadyBookingPayment(service, availableOptions, requestedKind) {
6015
6885
  const [first, ...rest] = availableOptions;
6016
6886
  const current = toSelectedCollectionOptionKind(requestedKind);
@@ -6051,7 +6921,7 @@ function prepareBookingSubmission(input) {
6051
6921
  value: {
6052
6922
  ...common,
6053
6923
  kind: "package_purchase",
6054
- purchasePassId: input.data.packagePurchase.package.id,
6924
+ passProductId: input.data.packagePurchase.package.id,
6055
6925
  discountCode: toTrimmedString(input.data.discountCode),
6056
6926
  shownTerms: input.shownTerms ?? bookingPackagePurchaseTerms(input.data.packagePurchase.package, input.promisedDiscountId)
6057
6927
  }
@@ -6186,7 +7056,7 @@ function formatBookingSubmissionPreparationError(error) {
6186
7056
  case "sliding-amount-out-of-range": return `Please choose an amount within the sliding scale for "${error.serviceTitle}".`;
6187
7057
  case "payment-option-unsupported": return `Service "${error.serviceTitle}" has a payment option that is not supported yet.`;
6188
7058
  case "service-missing-duration": return `Service "${error.serviceTitle}" is missing duration. Please update the service in the dashboard to include a duration (e.g., 30 minutes).`;
6189
- default: return assertNever$1(error);
7059
+ default: return assertNever$2(error);
6190
7060
  }
6191
7061
  }
6192
7062
  const DEFAULT_BOOKING_SUCCESS_COPY = {
@@ -6273,6 +7143,7 @@ function resolveMissingBookingPaymentStep(input) {
6273
7143
  kind: "unavailable",
6274
7144
  mode: "unsupported",
6275
7145
  service: null,
7146
+ reason: "paymentOptionsUnavailable",
6276
7147
  errorMessage: "Payment options are unavailable for the selected service right now."
6277
7148
  } : {
6278
7149
  kind: "unselected",
@@ -6398,6 +7269,13 @@ const bookingServiceSchema = z.object({
6398
7269
  buyPackage: z.boolean(),
6399
7270
  anyAvailable: z.boolean()
6400
7271
  }).optional(),
7272
+ onlinePayments: z.discriminatedUnion("kind", [z.object({ kind: z.literal("available") }), z.object({
7273
+ kind: z.literal("unavailable"),
7274
+ organiserContact: z.object({
7275
+ email: z.string().nullable(),
7276
+ phone: z.string().nullable()
7277
+ }).optional()
7278
+ })]).optional(),
6401
7279
  pricing: z.custom().optional(),
6402
7280
  priceAmount: z.number().nullable().optional(),
6403
7281
  priceCurrency: z.string().nullable().optional(),
@@ -6998,7 +7876,11 @@ function resolveEventRegistrationChoices(events, context, now) {
6998
7876
  const runs = groupPublicEventsByRun(scoped);
6999
7877
  if (context.occurrenceContext || context.subject?.kind === "eventSeries" && context.subject.bookingScope === "whole_series" || runs.length === 1 && scoped.every((event) => event.bookingScope === "whole_series")) return scoped;
7000
7878
  const eligibleRunIds = new Set(runs.filter((group) => resolveWholeSeriesChooserEligibility(group, now).kind === "eligible").map((group) => group.eventSeriesId));
7001
- return scoped.filter((event) => event.bookingScope === "whole_series" ? eligibleRunIds.has(event.seriesId) : Date.parse(event.startsAt) > now.getTime() && !hasEventBookingClosedEarly(event, now));
7879
+ return scoped.filter((event) => event.bookingScope === "whole_series" ? eligibleRunIds.has(event.seriesId) : isUpcomingDateChoice(event, now));
7880
+ }
7881
+ /** A date a new booking can still choose: it hasn't started and its bookings haven't closed. */
7882
+ function isUpcomingDateChoice(event, now) {
7883
+ return Date.parse(event.startsAt) > now.getTime() && !hasEventBookingClosedEarly(event, now);
7002
7884
  }
7003
7885
  //#endregion
7004
7886
  //#region ../blocks/src/system/runtime/nodes/event-registration/closedEarlyCopy.ts
@@ -7096,6 +7978,34 @@ function closedDatesCopy(dates, now) {
7096
7978
  };
7097
7979
  }
7098
7980
  //#endregion
7981
+ //#region ../blocks/src/system/runtime/api/creditProducts.ts
7982
+ function useCasesFromModules(modules) {
7983
+ if (!modules) return [];
7984
+ return [...modules.events ? ["event_pass"] : [], ...modules.appointments ? ["appointment_package"] : []];
7985
+ }
7986
+ function deriveUseCases(products, modules) {
7987
+ if (products.length > 0) return products.map((product) => product.productUseCase);
7988
+ return useCasesFromModules(modules);
7989
+ }
7990
+ function deriveCreditProductLabels(products, options = {}) {
7991
+ const style = options.style ?? "generic";
7992
+ const useCases = deriveUseCases(products, options.modules);
7993
+ const hasEventPass = useCases.includes("event_pass");
7994
+ const hasAppointmentPackage = useCases.includes("appointment_package");
7995
+ if (hasEventPass && hasAppointmentPackage) return {
7996
+ heading: "Passes & Packages",
7997
+ emptyMessage: "You don't have any passes or packages yet."
7998
+ };
7999
+ if (hasAppointmentPackage) return {
8000
+ heading: style === "class" ? "Appointment Packages" : "Packages",
8001
+ emptyMessage: "You don't have any packages yet."
8002
+ };
8003
+ return {
8004
+ heading: style === "class" ? "Class Passes" : "Passes",
8005
+ emptyMessage: "You don't have any passes yet."
8006
+ };
8007
+ }
8008
+ //#endregion
7099
8009
  //#region ../blocks/src/system/runtime/nodes/shop-commerce.shared.ts
7100
8010
  const EMPTY_COMMERCE_CART_STATE = { items: [] };
7101
8011
  const storedProductCartItemSchema = z.object({
@@ -7555,7 +8465,7 @@ function capacityPlacesLabel(source, display, wording) {
7555
8465
  case "low": return formatRemainingPlaces(source, wording);
7556
8466
  case "unlimited": return wording.unlimited ?? null;
7557
8467
  case "open": return wording.open ?? null;
7558
- default: return assertNever$2(remaining);
8468
+ default: return assertNever$3(remaining);
7559
8469
  }
7560
8470
  }
7561
8471
  function hybridPlacesLabel(event, display, wording) {
@@ -7829,15 +8739,6 @@ function getRegistrationOccurrenceId(target) {
7829
8739
  function shouldLoadRegistrationOptions(authState, step) {
7830
8740
  return authState === "authenticated" || step === "select-tickets" || step === "enter-details" || step === "select-payment";
7831
8741
  }
7832
- function getEligibilityFlowFlags(input) {
7833
- const hasPass = (input.eligibility?.eligiblePasses.length ?? 0) > 0;
7834
- const hasMembership = (input.eligibility?.eligibleMemberships.length ?? 0) > 0;
7835
- return {
7836
- hasEligibility: hasPass || hasMembership,
7837
- hasMembershipEligibility: hasMembership,
7838
- isMembershipFastTrack: input.portalAuthState === "authenticated" && hasMembership && input.ticketsCount === 1 && input.paymentMethod === "membership"
7839
- };
7840
- }
7841
8742
  /** Prefer refreshed capacity, including a known zero; fall back while options load. */
7842
8743
  function getTicketSelectionRemainingPlaces(input) {
7843
8744
  const availability = input.eligibility?.availability;
@@ -7870,7 +8771,7 @@ function resolveHeldTicketPlaces(current, invitation, paymentHold) {
7870
8771
  return getHeldPlacesBySelection(current, invitation.kind === "ready" ? {
7871
8772
  selectionId: invitation.restoration.event?.selectionId ?? current.selectionId,
7872
8773
  attendanceMode: invitation.restoration.attendanceMode,
7873
- lines: invitation.restoration.ticketSelections
8774
+ lines: invitation.restoration.claimed.kind === "reservedTickets" ? invitation.restoration.claimed.ticketSelections : []
7874
8775
  } : paymentHold);
7875
8776
  }
7876
8777
  function getCurrentTicketSelection(event, attendanceMode, lines) {
@@ -7881,6 +8782,17 @@ function getCurrentTicketSelection(event, attendanceMode, lines) {
7881
8782
  };
7882
8783
  }
7883
8784
  //#endregion
8785
+ //#region ../blocks/src/system/runtime/shared/utils/email.ts
8786
+ /**
8787
+ * The public booking, checkout and discount endpoints check addresses with
8788
+ * zod's email rule, so the forms use the same one: an address a form accepts
8789
+ * is never refused later, after the visitor has moved on.
8790
+ */
8791
+ const emailAddressSchema = z.string().trim().email().max(320);
8792
+ function isEmailAddress(value) {
8793
+ return emailAddressSchema.safeParse(value).success;
8794
+ }
8795
+ //#endregion
7884
8796
  //#region ../blocks/src/system/runtime/nodes/event-registration/utils.ts
7885
8797
  function getPortalSubjectEmail(profile) {
7886
8798
  return profile?.email ?? null;
@@ -7921,6 +8833,13 @@ const BOOKING_DATE_PRESENTATIONS = {
7921
8833
  year: "omit"
7922
8834
  }
7923
8835
  },
8836
+ dayMonth: {
8837
+ kind: "date",
8838
+ options: {
8839
+ date: "short",
8840
+ year: "omit"
8841
+ }
8842
+ },
7924
8843
  dayLong: {
7925
8844
  kind: "date",
7926
8845
  options: {
@@ -8029,6 +8948,26 @@ function courseSchedule(sessions, siteTimeZone, deliveryMode) {
8029
8948
  return `${sessions.length} sessions · ${firstLabel} – ${lastLabel}`;
8030
8949
  }
8031
8950
  /**
8951
+ * A course run's schedule as a row in the list of runs shows it, one line
8952
+ * each: how many sessions, then the span with its times ("Wed 6 Jan – Wed 27
8953
+ * Jan, 6:30pm–8pm"). The times are the first session's; a run's sessions
8954
+ * usually share them.
8955
+ */
8956
+ function formatRunScheduleLines(event) {
8957
+ if (event.registrationSubject.kind !== "wholeSeries") return [];
8958
+ const { sessions } = event.registrationSubject;
8959
+ const first = sessions[0];
8960
+ if (!first) return [];
8961
+ const last = sessions[sessions.length - 1] ?? first;
8962
+ const at = (session) => ({
8963
+ ...session,
8964
+ siteTimeZone: event.siteTimeZone,
8965
+ deliveryMode: event.deliveryMode
8966
+ });
8967
+ const days = sessions.length === 1 ? formatBookingWhen(at(first), "day") : `${formatBookingWhen(at(first), "day")} – ${formatBookingWhen(at(last), "day")}`;
8968
+ return [sessions.length === 1 ? "1 session" : `${sessions.length} sessions`, `${days}, ${formatBookingWhen(at(first), "timeRange")}`];
8969
+ }
8970
+ /**
8032
8971
  * When a booking happens, in one line: the occurrence's date and time, or a
8033
8972
  * course's session count and first and last dates. The default retains the
8034
8973
  * stored end time; an explicitly requested `short` variant shows the start.
@@ -8055,45 +8994,13 @@ function scheduleInput(event, occurrence) {
8055
8994
  deliveryMode: event.deliveryMode
8056
8995
  };
8057
8996
  }
8058
- /** Tooltip text shown when pass/membership redemptions are unavailable for multi-ticket bookings. */
8059
- const ENTITLEMENT_SINGLE_TICKET_TOOLTIP = "Only available for single-ticket bookings";
8060
- /** Passes and memberships can only be redeemed for single-ticket registrations. */
8061
- function areEntitlementsDisabledForTicketCount(ticketsCount) {
8062
- return ticketsCount > 1;
8063
- }
8064
- /**
8065
- * Describe what redeeming a pass costs the customer.
8066
- *
8067
- * The balance is what they hold *before* this booking, so "1 of 5" means four
8068
- * are left afterwards. Spelling out the balance is what stops people missing
8069
- * that a credit is being spent at all.
8070
- *
8071
- * Always one credit: passes are only redeemable for single-ticket bookings,
8072
- * per {@link areEntitlementsDisabledForTicketCount}.
8073
- *
8074
- * @param creditsRemaining - Credits on the pass before this booking, if known
8075
- */
8076
- function formatPassCreditUsageLabel(creditsRemaining) {
8077
- if (typeof creditsRemaining !== "number" || creditsRemaining <= 0) return `Uses ${formatCreditProductUnits("event_pass", 1)} from your pass`;
8078
- if (creditsRemaining === 1) return `Uses your last ${creditProductUnitNoun("event_pass", 1)}`;
8079
- return `Uses 1 of your ${formatCreditProductUnits("event_pass", creditsRemaining)}`;
8080
- }
8081
8997
  function transformRegistrationOptionsResponse(response) {
8082
- const eligiblePasses = response.entitlements.passes.map((pass) => ({
8083
- id: pass.customerPassId,
8084
- passName: pass.passName,
8085
- creditsRemaining: pass.creditsRemaining
8086
- }));
8087
- const eligibleMemberships = response.entitlements.memberships.map((membership) => ({
8088
- id: membership.customerMembershipId,
8089
- membershipName: membership.membershipName
8090
- }));
8091
- const eventAcceptsPasses = response.entitlements.requiresLoginForPasses || eligiblePasses.length > 0 || response.entitlements.availableForPurchase.passes.length > 0;
8092
- const eventAcceptsMemberships = response.entitlements.requiresLoginForMemberships || eligibleMemberships.length > 0 || response.entitlements.availableForPurchase.memberships.length > 0;
8998
+ const entitlements = registrationEntitlements(response.entitlements);
8093
8999
  const monetaryPaymentAvailable = hasMonetaryPaymentOption(response);
8094
9000
  return {
8095
9001
  discountPreview: response.discountPreview,
8096
9002
  availability: response.availability,
9003
+ ...siteOnlinePayments(response),
8097
9004
  registration: response.registration,
8098
9005
  paymentOptions: response.paymentOptions,
8099
9006
  isFree: response.paymentOptions.some((option) => option.kind === "free"),
@@ -8113,19 +9020,16 @@ function transformRegistrationOptionsResponse(response) {
8113
9020
  currency: response.pricing.currency
8114
9021
  })),
8115
9022
  ticketTypes: response.pricing.options,
9023
+ ...response.rooms ? { rooms: response.rooms } : {},
8116
9024
  price: response.pricing.subtotalCents,
8117
9025
  currency: response.pricing.currency,
8118
- requiresAuthForCredit: response.entitlements.requiresLoginForCredit ?? false,
8119
- requiresAuthForPasses: response.entitlements.requiresLoginForPasses,
8120
- requiresAuthForMemberships: response.entitlements.requiresLoginForMemberships,
8121
- eligiblePasses,
8122
- eligibleMemberships,
8123
- eventAcceptsPasses,
8124
- eventAcceptsMemberships,
8125
- availablePasses: [...response.entitlements.availableForPurchase.passes],
8126
- availableMemberships: [...response.entitlements.availableForPurchase.memberships]
9026
+ ...entitlements
8127
9027
  };
8128
9028
  }
9029
+ /** Older servers don't say whether the site takes cards; the block then assumes it does. */
9030
+ function siteOnlinePayments(response) {
9031
+ return response.onlinePayments ? { onlinePayments: response.onlinePayments } : {};
9032
+ }
8129
9033
  function customerCredit(credit) {
8130
9034
  if (!credit) return null;
8131
9035
  return {
@@ -8197,6 +9101,32 @@ function findSelectedTicketType(input) {
8197
9101
  selectedAttendanceMode: input.selectedAttendanceMode
8198
9102
  }).find((ticketType) => ticketType.pricingOptionId === input.selectedPricingOptionId) ?? null;
8199
9103
  }
9104
+ /** The server's entitlement decision, adapted once for the payment step. */
9105
+ function registrationEntitlements(entitlements) {
9106
+ const eligiblePasses = entitlements.passes.map((pass) => ({
9107
+ id: pass.customerPassId,
9108
+ passName: pass.passName,
9109
+ creditsRemaining: pass.creditsRemaining
9110
+ }));
9111
+ const eligibleMemberships = entitlements.memberships.map((membership) => ({
9112
+ id: membership.customerMembershipId,
9113
+ membershipName: membership.membershipName
9114
+ }));
9115
+ const eventAcceptsPasses = entitlements.requiresLoginForPasses || eligiblePasses.length > 0 || entitlements.availableForPurchase.passes.length > 0;
9116
+ const eventAcceptsMemberships = entitlements.requiresLoginForMemberships || eligibleMemberships.length > 0 || entitlements.availableForPurchase.memberships.length > 0;
9117
+ return {
9118
+ requiresAuthForCredit: entitlements.requiresLoginForCredit ?? false,
9119
+ requiresAuthForPasses: entitlements.requiresLoginForPasses,
9120
+ requiresAuthForMemberships: entitlements.requiresLoginForMemberships,
9121
+ unavailableEntitlements: entitlements.unavailableEntitlements ?? [],
9122
+ eligiblePasses,
9123
+ eligibleMemberships,
9124
+ eventAcceptsPasses,
9125
+ eventAcceptsMemberships,
9126
+ availablePasses: [...entitlements.availableForPurchase.passes],
9127
+ availableMemberships: [...entitlements.availableForPurchase.memberships]
9128
+ };
9129
+ }
8200
9130
  //#endregion
8201
9131
  //#region ../blocks/src/system/runtime/nodes/event-registration/combinationPrices.state.ts
8202
9132
  /**
@@ -8418,12 +9348,6 @@ function selectionPreviewLines(input) {
8418
9348
  });
8419
9349
  return lines.length > 0 && lines.every((line) => line !== null) ? lines : null;
8420
9350
  }
8421
- /** A preview belongs to one code (or none, for the automatic one), one set of items and one number of places. */
8422
- function selectionPreviewKey(code, lines) {
8423
- const trimmed = code === null ? "" : code.trim().toUpperCase();
8424
- if (code !== null && !trimmed || !lines) return null;
8425
- return JSON.stringify([trimmed, lines]);
8426
- }
8427
9351
  /**
8428
9352
  * The lines' sum, shown as "Subtotal" only when something comes off it;
8429
9353
  * otherwise the lines lead straight to the total.
@@ -8433,6 +9357,7 @@ function paymentSubtotal(subtotalCents, reductions) {
8433
9357
  }
8434
9358
  /** "4 dates, 1 place on each", above the list. */
8435
9359
  function paymentCaption(several, items, places) {
9360
+ if (items === 1) return plural(places, "place");
8436
9361
  return `${plural(items, several === "runs" ? "run" : "date")}, ${plural(places, "place")} on each`;
8437
9362
  }
8438
9363
  /** The multiplier for a line, when its amount splits evenly into a price per place. */
@@ -8627,7 +9552,8 @@ function sameOffering(events) {
8627
9552
  }
8628
9553
  function registrationSelectionMode(input) {
8629
9554
  const { events } = input;
8630
- if (input.hasPreSelectedContext || events.length < 2) return SINGLE;
9555
+ if (events.length < 2) return SINGLE;
9556
+ if (events.some((event) => event.rooms)) return SINGLE;
8631
9557
  if (!events.every((event) => event.allowsMultipleBooking)) return SINGLE;
8632
9558
  const firstSeriesId = events[0]?.seriesId;
8633
9559
  if (events.every((event) => event.registrationSubject.kind === "occurrence" && event.seriesId === firstSeriesId)) return {
@@ -8767,11 +9693,16 @@ function severalConfirmationSentence(kind, email) {
8767
9693
  }
8768
9694
  const SEVERAL_BOOKINGS_ACCOUNT_NOTE = "You can see and manage your bookings in your account.";
8769
9695
  /**
8770
- * Why passes and memberships, and the first item's deposit or instalments
8771
- * when it had them, aren't offered while several items are ticked.
9696
+ * What several items can't use. Runs can't use passes or memberships. Dates
9697
+ * can (issue 1767, set 6), and the payment step's own options explain them, so
9698
+ * there's no note. A deposit or instalments never get this far: an event that
9699
+ * offers one doesn't book several (decision 6).
8772
9700
  */
8773
- function selectionEntitlementNote(kind, hadDepositOrInstalments) {
8774
- return `${hadDepositOrInstalments ? "Deposits, instalments, class passes and memberships" : "Class passes and memberships"} can be used when you book one ${kind === "dates" ? "date" : "run"} at a time.`;
9701
+ function selectionEntitlementNote(kind) {
9702
+ switch (kind) {
9703
+ case "dates": return null;
9704
+ case "runs": return "Class passes and memberships can be used when you book one run at a time.";
9705
+ }
8775
9706
  }
8776
9707
  const NO_RUN_PRICING_CHOICES = {};
8777
9708
  /** Runs whose price needs a choice get their own section on the tickets step. */
@@ -8855,18 +9786,26 @@ function incompleteRunChoiceMessage(input) {
8855
9786
  * item offers, and an item that only runs one way decides it. Items with no
8856
9787
  * way in common can't be booked together.
8857
9788
  */
9789
+ const ATTENDANCE_CHOICE_MESSAGE = "Choose whether you want to attend in person or online.";
9790
+ /**
9791
+ * The visitor still has to say how they'll attend. Places and prices depend
9792
+ * on it, so nothing is quoted until they have.
9793
+ */
9794
+ function attendanceChoicePending(attendance, selected) {
9795
+ return attendance.kind === "choose" && resolveSelectionAttendanceMode(attendance, selected) === null;
9796
+ }
8858
9797
  /**
8859
9798
  * What several runs still need before the tickets step can go on: one way
8860
9799
  * of attending for them all, then a usable ticket or amount for each run.
8861
9800
  */
8862
9801
  function severalRunsChoiceMessage(input) {
8863
9802
  if (input.attendance.kind === "incompatible") return INCOMPATIBLE_ATTENDANCE_MESSAGE;
8864
- if (input.attendance.kind === "choose" && input.facts.attendanceMode === null) return "Choose whether you want to attend in person or online.";
9803
+ if (attendanceChoicePending(input.attendance, input.facts.attendanceMode)) return ATTENDANCE_CHOICE_MESSAGE;
8865
9804
  return incompleteRunChoiceMessage(input);
8866
9805
  }
8867
9806
  function selectionTicketInputs(input) {
8868
9807
  const priced = pricedTicketInputs(input);
8869
- const ticketsCount = input.invitation.kind === "ready" ? input.invitation.restoration.ticketsCount : priced.usesTicketLines ? getTicketSelectionTotal(priced.lines) : input.placeCount;
9808
+ const ticketsCount = input.invitation.kind === "ready" && input.invitation.restoration.claimed.kind === "reservedTickets" ? input.invitation.restoration.claimed.places : priced.usesTicketLines ? getTicketSelectionTotal(priced.lines) : input.placeCount;
8870
9809
  return {
8871
9810
  ...priced,
8872
9811
  ticketsCount
@@ -9005,26 +9944,21 @@ function itemPriceCents(input, event) {
9005
9944
  function selectionItemPrice(input) {
9006
9945
  return (event) => itemPriceCents(input, event);
9007
9946
  }
9008
- function decideSelectionPayment(input) {
9009
- const several = severalItemsOf(input.selection);
9010
- if (several === null) return { kind: "one-item" };
9011
- return {
9012
- kind: "several",
9013
- due: selectionCostsNothing(several, input) ? "nothing" : "card"
9014
- };
9015
- }
9016
- function selectionCostsNothing(several, input) {
9017
- switch (several) {
9018
- case "runs": return input.selection.every((run) => runUnitPriceCents(run, runPricingChoice(input.runChoices, run)) === 0);
9019
- case "dates": {
9020
- const first = input.selection[0];
9021
- if (input.eligibility) return input.eligibility.isFree;
9022
- return first !== void 0 && publicEventPricingType(first.pricing) === "free";
9023
- }
9024
- }
9025
- }
9026
9947
  //#endregion
9027
9948
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationPaymentReturn.ts
9949
+ /** On an event with rooms, what was asked for: the room lines come from placement, not from here. */
9950
+ function roomsRestoration(pending) {
9951
+ const { rooms } = pending;
9952
+ return rooms ? {
9953
+ ticketLines: rooms.dayLines,
9954
+ roomChoices: rooms.choices,
9955
+ reviewedRooms: rooms.reviewed ?? []
9956
+ } : {
9957
+ ticketLines: pending.ticketSelections,
9958
+ roomChoices: [],
9959
+ reviewedRooms: []
9960
+ };
9961
+ }
9028
9962
  /**
9029
9963
  * The server owns submitted answers and consent; payment recovery only restores choices.
9030
9964
  */
@@ -9032,7 +9966,7 @@ function paymentReturnRestoration(pending, events) {
9032
9966
  return {
9033
9967
  selection: findSelection(pending.selectedEventIds, events),
9034
9968
  runChoices: pending.runChoices ?? NO_RUN_PRICING_CHOICES,
9035
- ticketLines: pending.ticketSelections,
9969
+ ...roomsRestoration(pending),
9036
9970
  placeCount: getTicketSelectionTotal(pending.ticketSelections),
9037
9971
  formData: {
9038
9972
  ...pending.formData,
@@ -9335,6 +10269,8 @@ const draftFields = z.object({
9335
10269
  pricingOptionId: z.string().nullable(),
9336
10270
  quantity: z.number().int().positive()
9337
10271
  })),
10272
+ roomChoices: roomChoicesSchema.default([]),
10273
+ reviewedRooms: reviewedRoomsSchema.default([]),
9338
10274
  ticketsCount: z.number().int().positive(),
9339
10275
  selectedSlidingAmountInput: z.string(),
9340
10276
  formData: z.object({
@@ -9372,6 +10308,8 @@ function toEventSignInDraft(source, attempt) {
9372
10308
  runChoices: draft.runChoices,
9373
10309
  selectedAttendanceMode: draft.selectedAttendanceMode,
9374
10310
  ticketSelections: draft.selectedTicketLines,
10311
+ roomChoices: draft.roomChoices,
10312
+ reviewedRooms: draft.reviewedRooms,
9375
10313
  ticketsCount: flow.placeCount,
9376
10314
  selectedSlidingAmountInput: draft.selectedSlidingAmountInput,
9377
10315
  formData,
@@ -9450,6 +10388,8 @@ function restoreEventSignInDraft(state, restoration) {
9450
10388
  runChoices: draft.runChoices,
9451
10389
  selectedAttendanceMode: draft.selectedAttendanceMode,
9452
10390
  selectedTicketLines: draft.ticketSelections.map((line) => ({ ...line })),
10391
+ roomChoices: draft.roomChoices,
10392
+ reviewedRooms: draft.reviewedRooms,
9453
10393
  selectedSlidingAmountInput: draft.selectedSlidingAmountInput
9454
10394
  }
9455
10395
  };
@@ -9509,48 +10449,6 @@ function buildBookingInstalmentCadenceLabel(plan) {
9509
10449
  return interval === 1 ? unit : `every ${interval} ${unit}`;
9510
10450
  }
9511
10451
  //#endregion
9512
- //#region ../blocks/src/system/runtime/nodes/event-registration/bookingCalendar.ts
9513
- /** Public schedule plus the authorised outcome's arrival text; online access stays in email. */
9514
- function bookingCalendar(event, outcome) {
9515
- if (!event) return null;
9516
- const { identity } = outcome;
9517
- const sessions = event.registrationSubject.kind === "wholeSeries" ? event.registrationSubject.sessions : [{
9518
- occurrenceId: event.registrationSubject.occurrenceId,
9519
- startsAt: event.startsAt,
9520
- endsAt: event.endsAt
9521
- }];
9522
- const bookingId = identity.scope === "occurrence" ? identity.attendeeId : identity.registrationId;
9523
- const entries = sessions.map((session) => ({
9524
- uid: `booking-${bookingId}-${session.occurrenceId}@riverbankcms.com`,
9525
- sequence: 0,
9526
- title: event.title,
9527
- startsAt: new Date(session.startsAt),
9528
- endsAt: new Date(session.endsAt),
9529
- timezone: "UTC",
9530
- status: "confirmed",
9531
- location: identity.attendanceMode === "online" ? "Online" : outcome.arrivalVenues?.[session.occurrenceId] ?? event.venue?.name,
9532
- description: identity.attendanceMode === "online" ? "See your confirmation email for joining instructions." : void 0
9533
- }));
9534
- const first = entries[0];
9535
- if (!first) return null;
9536
- const common = {
9537
- fileName: `${slugify(event.title) || "event"}.ics`,
9538
- feed: {
9539
- timezone: "UTC",
9540
- entries
9541
- }
9542
- };
9543
- return entries.length === 1 ? {
9544
- ...common,
9545
- kind: "single",
9546
- ...calendarLinks(first)
9547
- } : {
9548
- ...common,
9549
- kind: "sessions",
9550
- sessionCount: entries.length
9551
- };
9552
- }
9553
- //#endregion
9554
10452
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationEventAdapter.ts
9555
10453
  function toRegistrationEvent(event) {
9556
10454
  return {
@@ -9624,7 +10522,7 @@ function confirmationPaymentRows(payment) {
9624
10522
  case "none": return [];
9625
10523
  case "settled": return payment.rows;
9626
10524
  case "due": return [...payment.paidRows, payment.amountDueRow];
9627
- default: return assertNever$2(payment);
10525
+ default: return assertNever$3(payment);
9628
10526
  }
9629
10527
  }
9630
10528
  function row(label, value) {
@@ -9636,20 +10534,21 @@ function row(label, value) {
9636
10534
  function placesLabel(count) {
9637
10535
  return count === 1 ? "1 place" : `${count} places`;
9638
10536
  }
9639
- function duePayment(balance, currency, paidRows, instructions) {
10537
+ function duePayment(balance, currency, paidRows, instructions, dueDay) {
10538
+ const amount = formatPrice(balance.amountCents, currency);
9640
10539
  return {
9641
10540
  kind: "due",
9642
10541
  paidRows,
9643
10542
  amountDueRow: {
9644
10543
  label: "Still to pay",
9645
- value: formatPrice(balance.amountCents, currency)
10544
+ value: balance.dueAt !== null && dueDay ? `${amount} by ${dueDay(balance.dueAt)}` : amount
9646
10545
  },
9647
10546
  instructions
9648
10547
  };
9649
10548
  }
9650
10549
  /** Every evidenced debt carries its required amount row, independently of success prose. */
9651
- function presentConfirmationPayment(payment) {
9652
- const presentation = presentPayment(payment);
10550
+ function presentConfirmationPayment(payment, dueDay = null) {
10551
+ const presentation = presentPayment(payment, dueDay);
9653
10552
  if (!payment.discount) return presentation;
9654
10553
  const discountRow = {
9655
10554
  label: `Discount code ${payment.discount.code}`,
@@ -9670,32 +10569,62 @@ function presentConfirmationPayment(payment) {
9670
10569
  };
9671
10570
  }
9672
10571
  }
9673
- function presentPayment(payment) {
10572
+ function presentPayment(payment, dueDay) {
9674
10573
  switch (payment.kind) {
9675
- case "free":
10574
+ case "free": return {
10575
+ kind: "settled",
10576
+ rows: row("Payment", "Free")
10577
+ };
9676
10578
  case "waived": return {
9677
10579
  kind: "settled",
9678
- rows: []
10580
+ rows: row("Payment", "Nothing to pay")
9679
10581
  };
9680
10582
  case "pass": return presentPassPayment(payment);
9681
10583
  case "membership": return {
9682
10584
  kind: "settled",
9683
10585
  rows: row("Paid with", payment.membershipName?.trim() || "Membership")
9684
10586
  };
9685
- case "manual_due": return duePayment(payment.balance, payment.currency, [], OFFLINE_BOOKING_PAYMENT_INSTRUCTIONS);
10587
+ case "manual_due": return duePayment(payment.balance, payment.currency, [], paymentInstructions(payment), dueDay);
9686
10588
  case "monetary":
9687
10589
  case "managed_balance_due": {
9688
10590
  const paidRows = row("Paid", payment.amountPaidCents > 0 ? formatPrice(payment.amountPaidCents, payment.currency) : null);
9689
10591
  return payment.balance.kind === "settled" ? {
9690
10592
  kind: "settled",
9691
10593
  rows: paidRows
9692
- } : duePayment(payment.balance, payment.currency, paidRows, payment.kind === "monetary" && payment.paymentMethod === "manual" ? OFFLINE_BOOKING_PAYMENT_INSTRUCTIONS : null);
10594
+ } : duePayment(payment.balance, payment.currency, paidRows, paymentInstructions(payment), dueDay);
9693
10595
  }
9694
- default: return assertNever$2(payment);
10596
+ default: return assertNever$3(payment);
9695
10597
  }
9696
10598
  }
10599
+ /** How to pay what's still owed: only money paid to the organiser directly has instructions. */
10600
+ function paymentInstructions(payment) {
10601
+ return payment.kind === "manual_due" || payment.kind === "monetary" && payment.paymentMethod === "manual" ? OFFLINE_BOOKING_PAYMENT_INSTRUCTIONS : null;
10602
+ }
10603
+ function isOwed(payment) {
10604
+ return payment.balance.kind === "due" && "currency" in payment;
10605
+ }
10606
+ /**
10607
+ * What several bookings still owe in all, worded as one booking's debt is:
10608
+ * the dates paid by card, pass or membership owe nothing, so only the rest
10609
+ * count. Nothing's said when a date's details didn't load, so the total is
10610
+ * never short, and a due date is given only when every debt shares it.
10611
+ */
10612
+ function severalOwed(outcomes, dueDay) {
10613
+ const owed = (detailedPayments(outcomes) ?? []).filter(isOwed);
10614
+ const [first] = owed;
10615
+ if (!first || owed.some((payment) => payment.currency !== first.currency)) return { kind: "none" };
10616
+ const amountCents = parsePositiveCents(owed.reduce((sum, payment) => sum + payment.balance.amountCents, 0));
10617
+ if (!amountCents.ok) return { kind: "none" };
10618
+ const dueAt = owed.every((payment) => payment.balance.dueAt === first.balance.dueAt) ? first.balance.dueAt : null;
10619
+ const instructions = owed.map(paymentInstructions).find((text) => text !== null) ?? null;
10620
+ return duePayment({
10621
+ kind: "due",
10622
+ amountCents: amountCents.value,
10623
+ dueAt
10624
+ }, first.currency, [], instructions, dueDay);
10625
+ }
9697
10626
  /** Places and payment, only when the outcome carries the booking's details. */
9698
- function outcomeFacts(outcome) {
10627
+ function outcomeFacts(outcome, dueDay) {
9699
10628
  switch (outcome.kind) {
9700
10629
  case "detailsUnavailable": return {
9701
10630
  places: null,
@@ -9707,10 +10636,10 @@ function outcomeFacts(outcome) {
9707
10636
  return {
9708
10637
  places,
9709
10638
  rows: row("Places", places === null ? null : String(places)),
9710
- payment: presentConfirmationPayment(outcome.payment)
10639
+ payment: presentConfirmationPayment(outcome.payment, dueDay)
9711
10640
  };
9712
10641
  }
9713
- default: return assertNever$2(outcome);
10642
+ default: return assertNever$3(outcome);
9714
10643
  }
9715
10644
  }
9716
10645
  function scheduleRows(event, when, where, display) {
@@ -9757,7 +10686,7 @@ function oneBooking(result, context) {
9757
10686
  const { identity } = result.outcome;
9758
10687
  const event = findBookedEvent(context.events, identity);
9759
10688
  const dates = entryFacts(event);
9760
- const facts = outcomeFacts(result.outcome);
10689
+ const facts = outcomeFacts(result.outcome, eventDueDay(event));
9761
10690
  const totalPlaces = completedBookingPlaces(context.completedOutcomes, identity);
9762
10691
  const where = identity.attendanceMode === "online" ? "none" : "venue";
9763
10692
  const arrival = identity.attendanceMode === "in_person" && context.display.venue === "shown" ? [...new Set(Object.values(result.outcome.arrivalVenues ?? {}))].join("\n\n") : "";
@@ -9772,15 +10701,16 @@ function oneBooking(result, context) {
9772
10701
  ...row("Where", arrival),
9773
10702
  ...facts.rows
9774
10703
  ],
9775
- payment: facts.payment,
10704
+ payment: withSubmissionPayment(facts.payment, result.submissionPayment),
9776
10705
  calendar: bookingCalendar(event, result.outcome),
9777
- several: null
10706
+ several: null,
10707
+ creditsLeftSentence: null
9778
10708
  };
9779
10709
  }
9780
10710
  /**
9781
10711
  * Several bookings made together: a line for each, in order, then the places
9782
- * each one has and what was paid in all. The finished card and bar keep the
9783
- * first booking's facts; there's no single calendar entry for them all.
10712
+ * each one has and what was paid in all. The finished card and bar say how
10713
+ * many were booked, from the first; there's no single calendar entry for them all.
9784
10714
  */
9785
10715
  function severalBookings(result, outcomes, context) {
9786
10716
  const several = outcomes[0]?.identity.scope === "occurrence" ? "dates" : "runs";
@@ -9789,11 +10719,38 @@ function severalBookings(result, outcomes, context) {
9789
10719
  return event ? [bookedItemRow(several, event)] : [];
9790
10720
  });
9791
10721
  return {
9792
- entry: oneBooking(result, context).entry,
9793
- summary: [...items, ...placesOnEachRow(several, outcomes)],
9794
- payment: severalPayment(outcomes),
10722
+ entry: severalEntry(several, outcomes, oneBooking(result, context).entry, context),
10723
+ summary: [
10724
+ ...items,
10725
+ ...placesOnEachRow(several, outcomes),
10726
+ ...severalFundingRow(outcomes)
10727
+ ],
10728
+ payment: withSubmissionPayment(severalOwed(outcomes, eventDueDay(firstEvent(outcomes, context))), result.submissionPayment),
9795
10729
  calendar: null,
9796
- several
10730
+ several,
10731
+ creditsLeftSentence: creditsLeftSentence(outcomes, result.passCreditsRemaining)
10732
+ };
10733
+ }
10734
+ /** A balance's due day in the booked event's own dates. */
10735
+ function eventDueDay(event) {
10736
+ return event ? (dueAt) => formatBookingWhen({
10737
+ ...event,
10738
+ startsAt: dueAt,
10739
+ endsAt: null
10740
+ }, "day") : null;
10741
+ }
10742
+ function firstEvent(outcomes, context) {
10743
+ return outcomes[0] ? findBookedEvent(context.events, outcomes[0].identity) : null;
10744
+ }
10745
+ /** "3 dates from Mon 9 Nov" on the card and bar, with the first booking's places. */
10746
+ function severalEntry(several, outcomes, first, context) {
10747
+ const event = firstEvent(outcomes, context);
10748
+ const count = `${outcomes.length} ${several === "runs" ? "runs" : "dates"}`;
10749
+ const when = event ? `${count} from ${formatBookingWhen(event, "day")}` : count;
10750
+ return {
10751
+ ...first,
10752
+ when,
10753
+ shortWhen: when
9797
10754
  };
9798
10755
  }
9799
10756
  /** Runs by name and dates; dates by day, both with their times. */
@@ -9815,27 +10772,83 @@ function placesOnEachRow(several, outcomes) {
9815
10772
  value: `${places} on each ${several === "runs" ? "run" : "date"}`
9816
10773
  }] : [];
9817
10774
  }
9818
- /**
9819
- * What several bookings cost together. They're always paid up front by card
9820
- * or free, so anything else (or a booking whose details didn't load) shows
9821
- * no payment rather than a partial sum.
9822
- */
9823
- function severalPayment(outcomes) {
9824
- const payments = outcomes.flatMap((outcome) => outcome.kind === "detailsAvailable" ? [outcome.payment] : []);
9825
- if (payments.length !== outcomes.length) return { kind: "none" };
9826
- const paid = payments.flatMap((payment) => payment.kind === "monetary" && payment.balance.kind === "settled" ? [payment] : []);
9827
- const free = payments.filter((payment) => payment.kind === "free" || payment.kind === "waived");
9828
- const currency = paid[0]?.currency;
9829
- if (paid.length + free.length !== payments.length || paid.some((payment) => payment.currency !== currency)) return { kind: "none" };
9830
- const total = paid.reduce((sum, payment) => sum + payment.amountPaidCents, 0);
9831
- return {
10775
+ /** A checkout's cash comes from its order; booking funding and debt keep their own rows. */
10776
+ function withSubmissionPayment(payment, submission) {
10777
+ if (submission === void 0) return payment;
10778
+ const rows = submission ? [
10779
+ ...row("Paid", submission.amountPaidCents > 0 ? formatPrice(submission.amountPaidCents, submission.currency) : null),
10780
+ ...row("From account credit", submission.creditCents > 0 ? formatPrice(submission.creditCents, submission.currency) : null),
10781
+ ...submission.purchasedItems.map((item) => ({
10782
+ label: item.name,
10783
+ value: formatPrice(item.priceCents, submission.currency)
10784
+ }))
10785
+ ] : [];
10786
+ const retained = confirmationPaymentRows(payment).filter((item) => item.label !== "Paid" && item.label !== "Still to pay");
10787
+ return payment.kind === "due" ? {
10788
+ ...payment,
10789
+ paidRows: [...retained, ...rows]
10790
+ } : {
9832
10791
  kind: "settled",
9833
- rows: currency && total > 0 ? [{
9834
- label: "Paid",
9835
- value: formatPrice(total, currency)
9836
- }] : []
10792
+ rows: [...retained, ...rows]
9837
10793
  };
9838
10794
  }
10795
+ /** How one date was paid, as the finished screen groups them. */
10796
+ function fundingGroup(payment) {
10797
+ switch (payment.kind) {
10798
+ case "pass": return `with your ${payment.passName?.trim() || "class pass"}`;
10799
+ case "membership": return `with your ${payment.membershipName?.trim() || "membership"}`;
10800
+ case "monetary": switch (payment.paymentMethod) {
10801
+ case "stripe": return "paid by card";
10802
+ case "store_credit": return "paid with account credit";
10803
+ case "mixed": return "paid by card and account credit";
10804
+ case "manual": return null;
10805
+ default: return assertNever$3(payment.paymentMethod);
10806
+ }
10807
+ case "free":
10808
+ case "waived": return "free of charge";
10809
+ case "manual_due":
10810
+ case "managed_balance_due": return null;
10811
+ default: return assertNever$3(payment);
10812
+ }
10813
+ }
10814
+ function detailedPayments(outcomes) {
10815
+ const payments = outcomes.flatMap((outcome) => outcome.kind === "detailsAvailable" ? [outcome.payment] : []);
10816
+ return payments.length === outcomes.length ? payments : null;
10817
+ }
10818
+ /**
10819
+ * Several dates where a pass or membership covered some: a Payment row with
10820
+ * each way they were paid and how many dates it paid for, as one date's
10821
+ * Payment row says how it was paid. Dates paid only with money keep the total alone.
10822
+ */
10823
+ function severalFundingRow(outcomes) {
10824
+ const payments = detailedPayments(outcomes);
10825
+ return row("Payment", payments ? fundingGroupLines(payments).join(", ") : null);
10826
+ }
10827
+ /**
10828
+ * The pass's balance once several dates are booked. A covered booking's
10829
+ * receipt says it once every date had settled, so it's shown even when a
10830
+ * date's details didn't load; a booking finished through checkout has it on
10831
+ * each date's payment instead.
10832
+ */
10833
+ function creditsLeftSentence(outcomes, receiptBalance) {
10834
+ const payments = detailedPayments(outcomes);
10835
+ const left = receiptBalance ?? (payments ? passBalanceOnDates(payments) : null);
10836
+ return left === null ? null : `You have ${left} ${left === 1 ? "credit" : "credits"} left on your pass.`;
10837
+ }
10838
+ /** How many dates each way paid for, when a pass or membership paid for any. */
10839
+ function fundingGroupLines(payments) {
10840
+ if (!payments.some((payment) => payment.kind === "pass" || payment.kind === "membership")) return [];
10841
+ const groups = payments.flatMap((payment) => {
10842
+ const group = fundingGroup(payment);
10843
+ return group === null ? [] : [group];
10844
+ });
10845
+ if (groups.length !== payments.length) return [];
10846
+ return [...groups.reduce((dates, group) => dates.set(group, (dates.get(group) ?? 0) + 1), /* @__PURE__ */ new Map())].map(([group, count]) => `${count} ${count === 1 ? "date" : "dates"} ${group}`);
10847
+ }
10848
+ function passBalanceOnDates(payments) {
10849
+ const balances = payments.flatMap((payment) => payment.kind === "pass" && payment.passCreditsRemaining !== void 0 ? [payment.passCreditsRemaining] : []);
10850
+ return balances.length > 0 ? Math.min(...balances) : null;
10851
+ }
9839
10852
  function waitlistedBooking(context) {
9840
10853
  const event = context.draftEvent;
9841
10854
  const dates = entryFacts(withOccurrenceTitle(event, context.occurrenceContext), context.occurrenceContext);
@@ -9847,7 +10860,8 @@ function waitlistedBooking(context) {
9847
10860
  summary: scheduleRows(event, dates.shortWhen, "venue", context.display),
9848
10861
  payment: { kind: "none" },
9849
10862
  calendar: null,
9850
- several: null
10863
+ several: null,
10864
+ creditsLeftSentence: null
9851
10865
  };
9852
10866
  }
9853
10867
  /**
@@ -9871,7 +10885,7 @@ function resolveFinishedPresentation(presentation, context) {
9871
10885
  case "paymentStatus":
9872
10886
  case "paymentFailed":
9873
10887
  case "error": return presentation;
9874
- default: return assertNever$2(presentation);
10888
+ default: return assertNever$3(presentation);
9875
10889
  }
9876
10890
  }
9877
10891
  /** Entitlement confirmations name what was spent and the balance, when supplied. */
@@ -9911,6 +10925,254 @@ function hasStatus(value) {
9911
10925
  return typeof value === "object" && value !== null && "status" in value;
9912
10926
  }
9913
10927
  //#endregion
10928
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationRooms.state.ts
10929
+ /**
10930
+ * The room offer for what's selected: the freshest facts we have, or the page's
10931
+ * own. The last booking options that had rooms in them are kept while no options
10932
+ * are being asked for, because a choice that no longer fits has no lines to ask
10933
+ * with, and falling back to the page's older facts would make it fit again. Facts
10934
+ * about another event are ignored.
10935
+ */
10936
+ function selectRoomOffer(selection, roomFacts) {
10937
+ const page = selection[0]?.rooms ?? null;
10938
+ return page && roomFacts?.seriesId === page.seriesId ? roomFacts : page;
10939
+ }
10940
+ function decideRoomStay(offer, choices) {
10941
+ if (offer === null) return { kind: "none" };
10942
+ return choices.length === 0 ? { kind: "empty" } : placeBooking(offer, choices);
10943
+ }
10944
+ function stayIsPlaced(stay) {
10945
+ return stay.kind === "placed";
10946
+ }
10947
+ function stayFailure(stay) {
10948
+ return stay.kind === "none" || stay.kind === "empty" || stayIsPlaced(stay) ? null : stay;
10949
+ }
10950
+ /** What the booking charges for: the places without a room, then what placement decided. */
10951
+ function bookingLines(dayLines, stay) {
10952
+ return stayIsPlaced(stay) ? [...dayLines, ...stay.ticketLines] : dayLines;
10953
+ }
10954
+ const draftRoomStay = (draft, roomFacts) => decideRoomStay(selectRoomOffer(draft.selection, roomFacts), draft.roomChoices);
10955
+ /** Whether the rooms the guest chose still fit the latest facts. Nothing chosen, or no rooms, always does. */
10956
+ function draftRoomsStillPlace(draft, roomFacts) {
10957
+ return stayFailure(draftRoomStay(draft, roomFacts)) === null;
10958
+ }
10959
+ /** The same derivation, from the draft and the options it was last checked against. */
10960
+ function draftBookingLines(draft, roomFacts) {
10961
+ return bookingLines(draft.selectedTicketLines, draftRoomStay(draft, roomFacts));
10962
+ }
10963
+ /**
10964
+ * The stay the guest is agreeing to by carrying on. The server compares the booking
10965
+ * with this, so it must be what they saw here, not what placement says by the time
10966
+ * they've signed in or paid.
10967
+ */
10968
+ function withReviewedRooms(draft, roomFacts) {
10969
+ const stay = draftRoomStay(draft, roomFacts);
10970
+ return stayIsPlaced(stay) ? {
10971
+ ...draft,
10972
+ reviewedRooms: reviewedStay(stay)
10973
+ } : draft;
10974
+ }
10975
+ /** Room prices are chosen through rooms, so they're never listed as flat tickets. */
10976
+ function dayOptionsOf(options, offer) {
10977
+ if (offer === null) return options;
10978
+ return options.filter((option) => !offer.linkedOptionIds.includes(option.pricingOptionId));
10979
+ }
10980
+ /**
10981
+ * What goes with the booking on an event with rooms: always the rooms the guest asked
10982
+ * for, whatever placement here last said. Placement on this page is only a preview;
10983
+ * the server places for real, and when the rooms have gone it refuses with a room
10984
+ * reason that takes the guest back to choose again. Someone staying only for the day
10985
+ * sends the rooms part empty. A line for a room's price outside the rooms (a custom
10986
+ * renderer listing the ticket types) sends nothing, so the server's clear refusal
10987
+ * explains it.
10988
+ */
10989
+ function roomSubmission(offer, choices, dayLines, reviewed) {
10990
+ if (offer === null) return void 0;
10991
+ if (dayLines.some((line) => line.pricingOptionId !== null && offer.linkedOptionIds.includes(line.pricingOptionId))) return void 0;
10992
+ return {
10993
+ request: choices.length === 0 ? {
10994
+ choices: [],
10995
+ reviewed: []
10996
+ } : {
10997
+ choices,
10998
+ reviewed
10999
+ },
11000
+ dayLines
11001
+ };
11002
+ }
11003
+ const NO_DEFAULT_TICKETS = [];
11004
+ /** What a sole ticket type can be picked from by default. An event with rooms has no default: its guests choose. */
11005
+ function defaultTicketOptions(offer, options) {
11006
+ return offer ? NO_DEFAULT_TICKETS : options;
11007
+ }
11008
+ /** What's still needed before the guest can carry on, or null. */
11009
+ function roomChoiceMessage(stay, dayLines) {
11010
+ if (stay.kind === "empty") return dayLines.length > 0 ? null : ADD_A_PLACE;
11011
+ const failure = stayFailure(stay);
11012
+ return failure ? placementProblemText(failure, "guest") : null;
11013
+ }
11014
+ /** The refusals the guest can put right from the rooms step, with fresh facts. */
11015
+ function isRoomChoiceRefusal(reason) {
11016
+ return reason === "roomNotEnoughPlaces" || reason === "roomNeedsMorePeople" || reason === "roomStayChanged" || reason === "roomOptionsChanged";
11017
+ }
11018
+ const ADD_A_PLACE = "Add a place to see your total.";
11019
+ /** The sticky bar's short form of the split-rooms note, for a guest who can't see the note yet. */
11020
+ const SPLIT_ROOMS_SHORT = "You'd be in separate rooms";
11021
+ const NO_TOTAL_YET = "We can't work out your total yet.";
11022
+ const TOTAL_SO_FAR = "Your total so far.";
11023
+ const TAKE_IT_OFF = "Take it off, then choose another room.";
11024
+ const PRICES_ARE = "Prices are per person, for the whole retreat.";
11025
+ const SHARING_INTRO = {
11026
+ together: `Add a place for each person. If you choose the same shared option in the same kind of room, we'll put you together when there's one free. ${PRICES_ARE}`,
11027
+ separate: `Add a place for each person. People booking together are usually given separate rooms on this retreat. ${PRICES_ARE}`,
11028
+ organiser: `Add a place for each person. The organiser decides who shares with whom. ${PRICES_ARE}`
11029
+ };
11030
+ function roomChooserIntro(offer) {
11031
+ return roomsOfferSharing(offer) ? SHARING_INTRO[offer.arrangement] : `Add a place for each person. ${PRICES_ARE}`;
11032
+ }
11033
+ const peopleIn = (lines) => lines.reduce((sum, line) => sum + line.quantity, 0);
11034
+ const peopleChoosing = (choices) => choices.reduce((sum, choice) => sum + choice.people, 0);
11035
+ function kindViews(input) {
11036
+ const details = new Map(input.offer.kinds.map((kind) => [kind.id, kind]));
11037
+ const amountOf = (id) => input.options.find((option) => option.pricingOptionId === id)?.priceAmount;
11038
+ return roomKindOptions(input.offer, input.choices, "guest").flatMap((kind) => {
11039
+ const detail = details.get(kind.kindId);
11040
+ if (!detail) return [];
11041
+ const options = kind.options.flatMap((option) => {
11042
+ const priceCents = amountOf(option.pricingOptionId);
11043
+ if (priceCents === void 0) return [];
11044
+ return [{
11045
+ key: option.key,
11046
+ choice: option.choice,
11047
+ title: option.title,
11048
+ detail: option.detail,
11049
+ priceCents,
11050
+ each: option.each,
11051
+ people: option.people,
11052
+ maxPeople: Math.min(option.mostPeople, input.maxTickets - (input.everyone - option.people)),
11053
+ placesLeft: placesLeftText(option, detail.sleeps),
11054
+ gone: option.people > 0 && option.mostPeople === 0
11055
+ }];
11056
+ });
11057
+ return [{
11058
+ kindId: kind.kindId,
11059
+ name: kind.kindName,
11060
+ description: detail.description,
11061
+ photos: detail.photos,
11062
+ options,
11063
+ fullyBooked: options.every((option) => option.gone)
11064
+ }];
11065
+ });
11066
+ }
11067
+ function totalOf(lines, options) {
11068
+ if (lines.length === 0) return null;
11069
+ return lines.reduce((total, line) => {
11070
+ const amount = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.priceAmount;
11071
+ return total === null || amount === void 0 ? null : total + amount * line.quantity;
11072
+ }, 0);
11073
+ }
11074
+ function lastDayText(saleEndsAt, timeZone) {
11075
+ const instant = Date.parse(saleEndsAt);
11076
+ if (Number.isNaN(instant)) return null;
11077
+ return new Intl.DateTimeFormat(inferSiteDateLocale(timeZone), {
11078
+ day: "numeric",
11079
+ month: "long",
11080
+ year: "numeric",
11081
+ timeZone
11082
+ }).format(/* @__PURE__ */ new Date(instant - 1));
11083
+ }
11084
+ /** The soonest a chosen room's named price ends. A room with only one price has nothing to say. */
11085
+ function priceNoteOf(stay, offer, options, timeZone) {
11086
+ if (!stayIsPlaced(stay)) return null;
11087
+ const prices = offer.kinds.flatMap((kind) => kind.prices);
11088
+ const ending = stay.ticketLines.flatMap((line) => {
11089
+ const priceName = prices.find((price) => price.pricingOptionId === line.pricingOptionId)?.priceName;
11090
+ const saleEndsAt = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.saleEndsAt;
11091
+ return priceName && saleEndsAt ? [{
11092
+ priceName,
11093
+ saleEndsAt
11094
+ }] : [];
11095
+ }).sort((left, right) => Date.parse(left.saleEndsAt) - Date.parse(right.saleEndsAt))[0];
11096
+ const lastDay = ending ? lastDayText(ending.saleEndsAt, timeZone) : null;
11097
+ return ending && lastDay ? `${ending.priceName} price until ${lastDay}` : null;
11098
+ }
11099
+ function stayLinesOf(stay, dayLines, options) {
11100
+ const rooms = stayIsPlaced(stay) ? stay.stay.map((line) => stayLineText(line, "guest")) : [];
11101
+ const day = dayLines.flatMap((line) => {
11102
+ const name = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.name;
11103
+ return name ? [`${line.quantity} × ${name}`] : [];
11104
+ });
11105
+ return [...rooms, ...day];
11106
+ }
11107
+ /** What's stopping the booking, with the next step when a chosen place has gone. */
11108
+ function failureNotice(failure) {
11109
+ switch (failure.kind) {
11110
+ case "not_enough_places": return `${placementProblemText(failure, "guest")} ${TAKE_IT_OFF}`;
11111
+ case "option_unavailable": return `That room option isn't available any more. ${TAKE_IT_OFF}`;
11112
+ case "whole_room_needs_more_people": return placementProblemText(failure, "guest");
11113
+ }
11114
+ }
11115
+ function takeOffFor(failure, offer, choices) {
11116
+ if (!failure || failure.kind === "whole_room_needs_more_people") return null;
11117
+ const name = offer.kinds.find((kind) => kind.id === failure.kindId)?.name;
11118
+ return {
11119
+ label: name ? `Take off the ${name}` : "Take off that room",
11120
+ choices: choicesLeftAfterTakingOff(failure.kindId, offer, choices)
11121
+ };
11122
+ }
11123
+ /** Only what no longer fits comes off. A kind can have other choices that still do, like a men's bed beside a women's. */
11124
+ function choicesLeftAfterTakingOff(kindId, offer, choices) {
11125
+ const options = roomKindOptions(offer, choices, "guest").find((kind) => kind.kindId === kindId)?.options ?? [];
11126
+ const stillFits = (choice) => options.some((option) => sameRoomOption(option.choice, choice) && option.people <= option.mostPeople);
11127
+ const left = choices.filter((choice) => choice.kindId !== kindId || stillFits(choice));
11128
+ return left.length < choices.length ? left : choices.filter((choice) => choice.kindId !== kindId);
11129
+ }
11130
+ /** The people and money the summary can stand behind, however far the booking has got. */
11131
+ function bookingSoFar(offer, choices, stay, dayLines, options) {
11132
+ const counted = stayFailure(stay) ? countSoFar(offer, choices) : null;
11133
+ const people = peopleIn(dayLines) + (counted ? counted.people : peopleChoosing(choices));
11134
+ const totalCents = totalOf(counted ? [...dayLines, ...counted.ticketLines] : bookingLines(dayLines, stay), options);
11135
+ const stillAdding = stayFailure(stay)?.kind === "whole_room_needs_more_people";
11136
+ return {
11137
+ people,
11138
+ totalCents,
11139
+ totalNote: people === 0 ? null : totalCents === null ? NO_TOTAL_YET : stillAdding ? TOTAL_SO_FAR : null
11140
+ };
11141
+ }
11142
+ /** Why it can't go ahead, the note when nothing's stopping it, and the stay a refusal asks them to agree to. */
11143
+ function stayMessages(stay, refusal, stayLines) {
11144
+ const failure = stayFailure(stay);
11145
+ const notice = failure ? failureNotice(failure) : refusal || null;
11146
+ const notes = stayIsPlaced(stay) ? stay.notes : [];
11147
+ const note = notice === null ? notes[0] : void 0;
11148
+ return {
11149
+ notice,
11150
+ noticeStay: notice !== null && notes.length > 0 ? stayLines : [],
11151
+ note: note ? stayNoteText(note, "guest") : null,
11152
+ splitWarning: note ? SPLIT_ROOMS_SHORT : null
11153
+ };
11154
+ }
11155
+ /** The chooser, as a pure reading of the draft and the freshest room facts. */
11156
+ function presentRoomChooser(input) {
11157
+ const { offer, choices, stay, dayLines, options } = input;
11158
+ const stayLines = stayLinesOf(stay, dayLines, options);
11159
+ return {
11160
+ intro: roomChooserIntro(offer),
11161
+ kinds: kindViews({
11162
+ offer,
11163
+ choices,
11164
+ options,
11165
+ maxTickets: input.maxTickets,
11166
+ everyone: peopleChoosing(choices) + peopleIn(dayLines)
11167
+ }),
11168
+ stayLines,
11169
+ ...stayMessages(stay, input.refusal, stayLines),
11170
+ takeOff: takeOffFor(stayFailure(stay), offer, choices),
11171
+ ...bookingSoFar(offer, choices, stay, dayLines, options),
11172
+ priceNote: priceNoteOf(stay, offer, options, input.timeZone)
11173
+ };
11174
+ }
11175
+ //#endregion
9914
11176
  //#region ../blocks/src/system/runtime/nodes/event-registration/validation.ts
9915
11177
  function createInitialRegistrationFormData() {
9916
11178
  return {
@@ -9925,7 +11187,7 @@ function createInitialRegistrationFormData() {
9925
11187
  function validateFormData(formData, requiresConsent = false) {
9926
11188
  return {
9927
11189
  ...!formData.name.trim() ? { name: "Name is required" } : {},
9928
- ...!formData.email.trim() ? { email: "Email is required" } : !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email) ? { email: "Invalid email address" } : {},
11190
+ ...!formData.email.trim() ? { email: "Email is required" } : !isEmailAddress(formData.email) ? { email: "Invalid email address" } : {},
9929
11191
  ...requiresConsent && formData.consentAccepted !== true ? { consentAccepted: "Please read and accept the agreement before continuing." } : {}
9930
11192
  };
9931
11193
  }
@@ -9934,136 +11196,21 @@ function registrationQuestionsMessage(questionFieldErrors, errorMessage) {
9934
11196
  return Object.keys(questionFieldErrors).length > 0 ? errorMessage : "";
9935
11197
  }
9936
11198
  //#endregion
9937
- //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDraft.state.ts
9938
- function createRegistrationDraftData(event) {
9939
- const defaults = event ? getEventSelectionDefaults(event) : null;
9940
- return {
9941
- selection: event ? [event] : [],
9942
- runChoices: NO_RUN_PRICING_CHOICES,
9943
- formData: createInitialRegistrationFormData(),
9944
- guests: [],
9945
- selectedAttendanceMode: defaults?.attendanceMode ?? null,
9946
- selectedTicketLines: [],
9947
- selectedSlidingAmountInput: defaults?.slidingAmountInput ?? "",
9948
- bookingQuestions: EMPTY_BOOKING_QUESTIONS_ANSWERS,
9949
- runRequirements: NO_RUN_REQUIREMENTS
11199
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDerivations.ts
11200
+ /** Public requests share subject identity without copying the run's display sessions. */
11201
+ function toRegistrationRequestSubject(subject, attendanceMode) {
11202
+ return subject.kind === "occurrence" ? {
11203
+ kind: "occurrence",
11204
+ occurrenceId: subject.occurrenceId,
11205
+ attendanceMode: attendanceMode ?? void 0
11206
+ } : {
11207
+ kind: "wholeSeries",
11208
+ eventSeriesId: subject.eventSeriesId,
11209
+ attendanceMode: attendanceMode ?? void 0
9950
11210
  };
9951
11211
  }
9952
- function updated(current, value) {
9953
- return typeof value === "function" ? value(current) : value;
9954
- }
9955
- function editRegistrationDraft(draft, edit) {
9956
- switch (edit.field) {
9957
- case "selection": {
9958
- const selection = updated(draft.selection, edit.value);
9959
- return {
9960
- ...draft,
9961
- selection,
9962
- selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(selection), draft.selectedAttendanceMode)
9963
- };
9964
- }
9965
- case "runChoices": return {
9966
- ...draft,
9967
- runChoices: updated(draft.runChoices, edit.value)
9968
- };
9969
- case "formData": return {
9970
- ...draft,
9971
- formData: updated(draft.formData, edit.value)
9972
- };
9973
- case "guests": return {
9974
- ...draft,
9975
- guests: updated(draft.guests, edit.value)
9976
- };
9977
- case "selectedAttendanceMode": return {
9978
- ...draft,
9979
- selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(draft.selection), updated(draft.selectedAttendanceMode, edit.value))
9980
- };
9981
- case "selectedTicketLines": return {
9982
- ...draft,
9983
- selectedTicketLines: updated(draft.selectedTicketLines, edit.value)
9984
- };
9985
- case "selectedSlidingAmountInput": return {
9986
- ...draft,
9987
- selectedSlidingAmountInput: updated(draft.selectedSlidingAmountInput, edit.value)
9988
- };
9989
- default: return assertNever$1(edit);
9990
- }
9991
- }
9992
- /** Ready invitations own their reserved selection; identity fields remain editable. */
9993
- function canEditInvitedDraft(invitation, edit) {
9994
- return invitation.kind !== "ready" || edit.field === "formData" || edit.field === "guests";
9995
- }
9996
- function beginWaitlistInvitation(credential) {
9997
- return credential ? {
9998
- kind: "resolving",
9999
- request: { credential }
10000
- } : { kind: "none" };
10001
- }
10002
- /** A source notification is not a new attempt when its credential is unchanged. */
10003
- function receiveWaitlistInvitation(invitation, credential) {
10004
- return (invitation.kind === "none" ? null : invitation.request.credential) === credential ? invitation : beginWaitlistInvitation(credential);
10005
- }
10006
- function restoreRegistrationDraft(draft, claim, restoration) {
10007
- return {
10008
- bookingQuestions: draft.bookingQuestions,
10009
- runRequirements: NO_RUN_REQUIREMENTS,
10010
- selection: restoration.event ? [restoration.event] : draft.selection,
10011
- runChoices: NO_RUN_PRICING_CHOICES,
10012
- selectedAttendanceMode: restoration.attendanceMode,
10013
- selectedTicketLines: [...restoration.ticketSelections],
10014
- selectedSlidingAmountInput: restoration.slidingAmountInput ?? draft.selectedSlidingAmountInput,
10015
- formData: {
10016
- ...draft.formData,
10017
- email: claim.prefill.email,
10018
- name: claim.prefill.name,
10019
- phone: claim.prefill.phone ?? "",
10020
- notes: claim.prefill.notes ?? ""
10021
- },
10022
- guests: claim.prefill.guests.map((guest) => ({
10023
- name: guest.name,
10024
- email: guest.email ?? "",
10025
- phone: guest.phone ?? ""
10026
- }))
10027
- };
10028
- }
10029
- function invitationSubmission(invitation) {
10030
- switch (invitation.kind) {
10031
- case "none": return {
10032
- kind: "available",
10033
- credential: null
10034
- };
10035
- case "ready": return {
10036
- kind: "available",
10037
- credential: invitation.request.credential
10038
- };
10039
- case "resolving": return {
10040
- kind: "blocked",
10041
- message: "Please wait while we check your waiting list invitation."
10042
- };
10043
- case "portal-login-required":
10044
- case "error": return {
10045
- kind: "blocked",
10046
- message: invitation.message
10047
- };
10048
- default: return assertNever$1(invitation);
10049
- }
10050
- }
10051
- //#endregion
10052
- //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDerivations.ts
10053
- /** Public requests share subject identity without copying the run's display sessions. */
10054
- function toRegistrationRequestSubject(subject, attendanceMode) {
10055
- return subject.kind === "occurrence" ? {
10056
- kind: "occurrence",
10057
- occurrenceId: subject.occurrenceId,
10058
- attendanceMode: attendanceMode ?? void 0
10059
- } : {
10060
- kind: "wholeSeries",
10061
- eventSeriesId: subject.eventSeriesId,
10062
- attendanceMode: attendanceMode ?? void 0
10063
- };
10064
- }
10065
- function eventMatchesOccurrenceId(event, occurrenceId) {
10066
- return event.registrationSubject.kind === "occurrence" && (event.registrationSubject.occurrenceId === occurrenceId || event.selectionId === occurrenceId);
11212
+ function eventMatchesOccurrenceId(event, occurrenceId) {
11213
+ return event.registrationSubject.kind === "occurrence" && (event.registrationSubject.occurrenceId === occurrenceId || event.selectionId === occurrenceId);
10067
11214
  }
10068
11215
  function findEventByOccurrenceId(events, occurrenceId) {
10069
11216
  return events.find((event) => eventMatchesOccurrenceId(event, occurrenceId)) ?? null;
@@ -10075,7 +11222,7 @@ function findPreSelectedEvent(input) {
10075
11222
  startsAt: occurrenceContext.startsAt,
10076
11223
  timeZone: occurrenceContext.timeZone
10077
11224
  }));
10078
- return input.scopedEvents.find((event) => eventMatchesOccurrenceId(event, occurrenceContext.id) || getBookingLocalDateKey(toScheduledBookingDateTime({
11225
+ return input.scopedEvents.find((event) => eventMatchesOccurrenceId(event, occurrenceContext.id)) ?? input.scopedEvents.find((event) => getBookingLocalDateKey(toScheduledBookingDateTime({
10079
11226
  startsAt: event.startsAt,
10080
11227
  timeZone: event.timeZone
10081
11228
  })) === contextDate) ?? null;
@@ -10116,14 +11263,6 @@ function resolveRouteRequiresPayment(input) {
10116
11263
  function resolveDiscountContext(input) {
10117
11264
  const selection = input.paymentSelection.method ? input.paymentSelection : null;
10118
11265
  if (!input.event) return null;
10119
- if (selection?.method === "pass_bundle" && selection.bundlePassId) return {
10120
- type: "pass",
10121
- passId: selection.bundlePassId
10122
- };
10123
- if (selection?.method === "membership_bundle" && selection.bundleMembershipId) return {
10124
- type: "membership",
10125
- membershipId: selection.bundleMembershipId
10126
- };
10127
11266
  if (!input.eventRequiresPayment) return null;
10128
11267
  if (input.ticketsCount <= 0) return null;
10129
11268
  if (selection?.method && selection.method !== "stripe") return null;
@@ -10158,32 +11297,47 @@ function buildRegistrationSelectionRequest(input) {
10158
11297
  }
10159
11298
  //#endregion
10160
11299
  //#region ../blocks/src/system/runtime/nodes/event-registration/waitlistClaimRestoration.ts
11300
+ /** A date's waiting list is joined one place at a time, and its offer holds that one place. */
11301
+ const DATE_OFFER_PLACES = 1;
10161
11302
  function findClaimEvent(subject, events) {
10162
11303
  switch (subject.kind) {
10163
11304
  case "event_occurrence": return findEventByOccurrenceId(events, subject.occurrenceId);
10164
11305
  case "whole_series": return events.find((event) => event.registrationSubject.kind === "wholeSeries" && event.registrationSubject.eventSeriesId === subject.eventSeriesId) ?? null;
10165
- default: return assertNever$1(subject);
11306
+ default: return assertNever$2(subject);
10166
11307
  }
10167
11308
  }
10168
11309
  /** Reserved quantities and amounts have one interpretation across restoration and submission. */
10169
- function claimedSelection(subject) {
11310
+ function claimedPlaces(subject) {
10170
11311
  switch (subject.kind) {
10171
11312
  case "event_occurrence": return {
10172
- ticketSelections: [{
10173
- pricingOptionId: null,
10174
- quantity: 1
10175
- }],
10176
- ticketsCount: 1,
10177
- slidingAmountInput: null
11313
+ kind: "anyTicket",
11314
+ places: DATE_OFFER_PLACES
10178
11315
  };
10179
11316
  case "whole_series": return {
11317
+ kind: "reservedTickets",
11318
+ places: subject.seatCount,
10180
11319
  ticketSelections: subject.ticketSelections,
10181
- ticketsCount: subject.seatCount,
10182
11320
  slidingAmountInput: subject.selectedSlidingAmount === null ? null : formatCentsAsCurrencyInput(subject.selectedSlidingAmount)
10183
11321
  };
10184
- default: return assertNever$1(subject);
11322
+ default: return assertNever$2(subject);
10185
11323
  }
10186
11324
  }
11325
+ /** The tickets they're booking: the reserved ones, or what they've chosen for the places held. */
11326
+ function claimTicketSelections(claimed, chosen) {
11327
+ return claimed.kind === "reservedTickets" ? claimed.ticketSelections : chosen;
11328
+ }
11329
+ /**
11330
+ * What to quote while they haven't chosen a ticket yet: the places held, with no ticket. The
11331
+ * answer says which tickets have room for them, which the page's own figures can't, since
11332
+ * they count the held place as taken.
11333
+ */
11334
+ function claimQuoteSelections(claimed, chosen) {
11335
+ const lines = claimTicketSelections(claimed, chosen);
11336
+ return lines.length > 0 ? lines : [{
11337
+ pricingOptionId: null,
11338
+ quantity: claimed.places
11339
+ }];
11340
+ }
10187
11341
  function resolveWaitlistClaimRestoration(input) {
10188
11342
  if (input.events.kind !== "ready") return { kind: "awaitingEvents" };
10189
11343
  const { subject } = input.claim;
@@ -10193,18 +11347,246 @@ function resolveWaitlistClaimRestoration(input) {
10193
11347
  kind: "ready",
10194
11348
  event,
10195
11349
  attendanceMode: subject.attendanceMode,
10196
- ...claimedSelection(subject)
11350
+ claimed: claimedPlaces(subject)
10197
11351
  } : {
10198
11352
  kind: "different-event",
10199
11353
  message: "This waiting list invitation is for a different event. Please open the link in your invitation email."
10200
11354
  };
10201
11355
  }
11356
+ /**
11357
+ * What this visitor books and quotes, and how many places they can ask for. An invitation books
11358
+ * only the places it holds; anyone else chooses freely, up to the block's own limit.
11359
+ */
11360
+ function invitationBooking(invitation, chosen, blockLimit) {
11361
+ if (invitation.kind !== "ready") return {
11362
+ ticketSelections: [...chosen],
11363
+ quoteSelections: chosen,
11364
+ maxTicketsNum: blockLimit
11365
+ };
11366
+ const { claimed } = invitation.restoration;
11367
+ return {
11368
+ ticketSelections: [...claimTicketSelections(claimed, chosen)],
11369
+ quoteSelections: claimQuoteSelections(claimed, chosen),
11370
+ maxTicketsNum: claimed.places
11371
+ };
11372
+ }
10202
11373
  /** A place held on a run or date that's closed is still theirs, so it stays on the list they see. */
10203
11374
  function withOfferedEvent(choices, invitation) {
10204
11375
  const offered = invitation.kind === "ready" ? invitation.restoration.event : null;
10205
11376
  return offered && !choices.some((event) => event.selectionId === offered.selectionId) ? [offered, ...choices] : choices;
10206
11377
  }
10207
11378
  //#endregion
11379
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDraft.state.ts
11380
+ function createRegistrationDraftData(event) {
11381
+ const defaults = event ? getEventSelectionDefaults(event) : null;
11382
+ return {
11383
+ selection: event ? [event] : [],
11384
+ runChoices: NO_RUN_PRICING_CHOICES,
11385
+ formData: createInitialRegistrationFormData(),
11386
+ guests: [],
11387
+ selectedAttendanceMode: defaults?.attendanceMode ?? null,
11388
+ selectedTicketLines: [],
11389
+ roomChoices: [],
11390
+ reviewedRooms: [],
11391
+ selectedSlidingAmountInput: defaults?.slidingAmountInput ?? "",
11392
+ bookingQuestions: EMPTY_BOOKING_QUESTIONS_ANSWERS,
11393
+ runRequirements: NO_RUN_REQUIREMENTS
11394
+ };
11395
+ }
11396
+ function updated(current, value) {
11397
+ return typeof value === "function" ? value(current) : value;
11398
+ }
11399
+ function editRegistrationDraft(draft, edit) {
11400
+ switch (edit.field) {
11401
+ case "selection": {
11402
+ const selection = updated(draft.selection, edit.value);
11403
+ return {
11404
+ ...draft,
11405
+ selection,
11406
+ selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(selection), draft.selectedAttendanceMode)
11407
+ };
11408
+ }
11409
+ case "runChoices": return {
11410
+ ...draft,
11411
+ runChoices: updated(draft.runChoices, edit.value)
11412
+ };
11413
+ case "formData": return {
11414
+ ...draft,
11415
+ formData: updated(draft.formData, edit.value)
11416
+ };
11417
+ case "guests": return {
11418
+ ...draft,
11419
+ guests: updated(draft.guests, edit.value)
11420
+ };
11421
+ case "selectedAttendanceMode": return {
11422
+ ...draft,
11423
+ selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(draft.selection), updated(draft.selectedAttendanceMode, edit.value))
11424
+ };
11425
+ case "selectedTicketLines": return {
11426
+ ...draft,
11427
+ selectedTicketLines: updated(draft.selectedTicketLines, edit.value)
11428
+ };
11429
+ case "roomChoices": return {
11430
+ ...draft,
11431
+ roomChoices: updated(draft.roomChoices, edit.value),
11432
+ reviewedRooms: []
11433
+ };
11434
+ case "selectedSlidingAmountInput": return {
11435
+ ...draft,
11436
+ selectedSlidingAmountInput: updated(draft.selectedSlidingAmountInput, edit.value)
11437
+ };
11438
+ default: return assertNever$2(edit);
11439
+ }
11440
+ }
11441
+ /** Ready invitations own their reserved selection; identity fields remain editable. */
11442
+ function canEditInvitedDraft(invitation, edit) {
11443
+ if (invitation.kind !== "ready" || edit.field === "formData" || edit.field === "guests") return true;
11444
+ return invitation.restoration.claimed.kind === "anyTicket" && (edit.field === "selectedTicketLines" || edit.field === "selectedSlidingAmountInput");
11445
+ }
11446
+ function beginWaitlistInvitation(credential) {
11447
+ return credential ? {
11448
+ kind: "resolving",
11449
+ request: { credential }
11450
+ } : { kind: "none" };
11451
+ }
11452
+ /** A source notification is not a new attempt when its credential is unchanged. */
11453
+ function receiveWaitlistInvitation(invitation, credential) {
11454
+ return (invitation.kind === "none" ? null : invitation.request.credential) === credential ? invitation : beginWaitlistInvitation(credential);
11455
+ }
11456
+ function restoreRegistrationDraft(draft, claim, restoration) {
11457
+ return {
11458
+ bookingQuestions: draft.bookingQuestions,
11459
+ runRequirements: NO_RUN_REQUIREMENTS,
11460
+ selection: restoration.event ? [restoration.event] : draft.selection,
11461
+ runChoices: NO_RUN_PRICING_CHOICES,
11462
+ selectedAttendanceMode: restoration.attendanceMode,
11463
+ selectedTicketLines: [...claimTicketSelections(restoration.claimed, [])],
11464
+ roomChoices: [],
11465
+ reviewedRooms: [],
11466
+ selectedSlidingAmountInput: (restoration.claimed.kind === "reservedTickets" ? restoration.claimed.slidingAmountInput : null) ?? draft.selectedSlidingAmountInput,
11467
+ formData: {
11468
+ ...draft.formData,
11469
+ email: claim.prefill.email,
11470
+ name: claim.prefill.name,
11471
+ phone: claim.prefill.phone ?? "",
11472
+ notes: claim.prefill.notes ?? ""
11473
+ },
11474
+ guests: claim.prefill.guests.map((guest) => ({
11475
+ name: guest.name,
11476
+ email: guest.email ?? "",
11477
+ phone: guest.phone ?? ""
11478
+ }))
11479
+ };
11480
+ }
11481
+ function invitationSubmission(invitation) {
11482
+ switch (invitation.kind) {
11483
+ case "none": return {
11484
+ kind: "available",
11485
+ credential: null
11486
+ };
11487
+ case "ready": return {
11488
+ kind: "available",
11489
+ credential: invitation.request.credential
11490
+ };
11491
+ case "resolving": return {
11492
+ kind: "blocked",
11493
+ message: "Please wait while we check your waiting list invitation."
11494
+ };
11495
+ case "portal-login-required":
11496
+ case "error": return {
11497
+ kind: "blocked",
11498
+ message: invitation.message
11499
+ };
11500
+ default: return assertNever$2(invitation);
11501
+ }
11502
+ }
11503
+ //#endregion
11504
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationEntry.ts
11505
+ function decideRegistrationEntry(input) {
11506
+ const event = findPreSelectedEvent({
11507
+ scopedEvents: input.events,
11508
+ occurrenceContext: input.occurrenceContext
11509
+ });
11510
+ if (!input.occurrenceContext && !event) return {
11511
+ kind: "chooseEvent",
11512
+ choices: input.events
11513
+ };
11514
+ if (input.offer === "eventsAsGiven") return {
11515
+ kind: "pageDate",
11516
+ event,
11517
+ choices: input.events
11518
+ };
11519
+ if (!event) return {
11520
+ kind: "pageDate",
11521
+ event,
11522
+ choices: input.events
11523
+ };
11524
+ const moreDates = input.occurrenceContext ? addableDates(event, input) : [];
11525
+ const [first, ...rest] = moreDates;
11526
+ return first ? {
11527
+ kind: "pageDateAndMore",
11528
+ event,
11529
+ moreDates: [first, ...rest],
11530
+ choices: [event, ...moreDates]
11531
+ } : {
11532
+ kind: "pageDate",
11533
+ event,
11534
+ choices: [event]
11535
+ };
11536
+ }
11537
+ /**
11538
+ * The class's other dates a visitor could add to the page's date, as the
11539
+ * class's own page lists them, or none when the page's date books on its own:
11540
+ * a return to finish a booking, a date that can't be ticked, a class that
11541
+ * doesn't book several dates or has rooms, or no other date open to book.
11542
+ */
11543
+ function addableDates(pageDate, input) {
11544
+ if (input.arrival !== "none") return [];
11545
+ if (pageDate.registrationSubject.kind !== "occurrence") return [];
11546
+ if (selectionRowAvailability(pageDate) !== "open" || !isUpcomingDateChoice(pageDate, input.now)) return [];
11547
+ const others = input.events.filter((event) => event.selectionId !== pageDate.selectionId && event.seriesId === pageDate.seriesId && isUpcomingDateChoice(event, input.now));
11548
+ const mode = registrationSelectionMode({ events: [pageDate, ...others] });
11549
+ if (mode.kind !== "several" || mode.items !== "dates") return [];
11550
+ return others.some((event) => selectionRowAvailability(event) === "open") ? others : [];
11551
+ }
11552
+ /** Whether the route starts by choosing (and so Back and "Change dates" lead there). */
11553
+ function entryChoosesEvent(entry) {
11554
+ return entry.kind !== "pageDate";
11555
+ }
11556
+ /** The date this page is about, if it names one the events include. */
11557
+ function entryPageEvent(entry) {
11558
+ return entry.kind === "chooseEvent" ? null : entry.event;
11559
+ }
11560
+ /** A booking that starts by choosing, with nothing ticked. */
11561
+ const CHOOSING_START = {
11562
+ step: "select-event",
11563
+ event: null
11564
+ };
11565
+ /** A booking that starts on Tickets, before the page's date is known. */
11566
+ const TICKETS_START = {
11567
+ step: "select-tickets",
11568
+ event: null
11569
+ };
11570
+ function entryStart(entry) {
11571
+ return {
11572
+ ...entryChoosesEvent(entry) ? CHOOSING_START : TICKETS_START,
11573
+ event: entryPageEvent(entry)
11574
+ };
11575
+ }
11576
+ function entrySelectionMode(entry) {
11577
+ return entry.kind === "pageDate" ? { kind: "single" } : registrationSelectionMode({ events: entry.choices });
11578
+ }
11579
+ /**
11580
+ * The page's occurrence names the booking only while the booking is for the
11581
+ * page's date: a date page that lets the visitor tick others books those as
11582
+ * themselves.
11583
+ */
11584
+ function bookingOccurrenceContext(occurrenceContext, pageEvent, selection) {
11585
+ const primary = selection[0];
11586
+ if (!occurrenceContext) return null;
11587
+ return !primary || primary.selectionId === pageEvent?.selectionId ? occurrenceContext : null;
11588
+ }
11589
+ //#endregion
10208
11590
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationBrowserDraft.ts
10209
11591
  const browserDraftSteps = [
10210
11592
  "select-event",
@@ -10212,11 +11594,23 @@ const browserDraftSteps = [
10212
11594
  "enter-details",
10213
11595
  "select-payment"
10214
11596
  ];
11597
+ /** How long this tab's draft is kept after it was last saved; older drafts are ignored and cleared. */
11598
+ const BROWSER_DRAFT_LIFETIME_MS = 10800 * 1e3;
10215
11599
  /**
10216
- * An allowlist: free text, questions, agreement and payment authority never go to storage.
10217
- * The discount code is its text only, never a price or amount, and the server checks it again on restore.
11600
+ * An allowlist of what the booker typed or chose, kept in this tab only, for
11601
+ * `BROWSER_DRAFT_LIFETIME_MS`: the selection and tickets, their contact
11602
+ * details, the rooms they asked for and, for a signed-in customer only, their
11603
+ * note ("Anything we should know?"), the guests' names and contact details, and their answers to the
11604
+ * questions, by question ID (`BookingQuestionsTabDraft`: plain answers only,
11605
+ * never file uploads, and dropped on restore if the question has gone or
11606
+ * changed kind), once for the selection or per run when runs ask their own.
11607
+ * `owner` is whoever was signed in (or nobody) when it was saved: contact,
11608
+ * the note, guests and answers come back only to that same visitor. The terms agreement, payment choices and anything
11609
+ * else payment-related never go to storage. The discount code is its text
11610
+ * only, never a price or amount, and the server checks it again on restore.
10218
11611
  */
10219
11612
  const registrationBrowserDraftSchema = z.object({
11613
+ owner: bookingQuestionsOwnerSchema,
10220
11614
  step: z.enum(browserDraftSteps),
10221
11615
  selectedEventIds: z.array(z.string()),
10222
11616
  placeCount: z.number().int().positive(),
@@ -10230,20 +11624,45 @@ const registrationBrowserDraftSchema = z.object({
10230
11624
  pricingOptionId: z.string().nullable(),
10231
11625
  slidingAmountInput: z.string()
10232
11626
  })),
11627
+ roomChoices: roomChoicesSchema.default([]),
11628
+ reviewedRooms: reviewedRoomsSchema.default([]),
10233
11629
  contact: z.object({
10234
11630
  name: z.string(),
10235
11631
  email: z.string(),
10236
11632
  phone: z.string()
10237
11633
  }),
10238
- discountCode: z.string().default("")
11634
+ notes: z.string().default(""),
11635
+ discountCode: z.string().default(""),
11636
+ guests: z.array(z.object({
11637
+ name: z.string(),
11638
+ email: z.string().nullable(),
11639
+ phone: z.string().nullable()
11640
+ })).default([]),
11641
+ questions: bookingQuestionsTabDraftSchema.nullable().default(null),
11642
+ /** Each run's answers, by series ID, when the runs ask their questions separately. */
11643
+ runQuestions: z.record(z.string(), bookingQuestionsTabDraftSchema).default({})
10239
11644
  });
10240
11645
  function isBrowserDraftStep(step) {
10241
11646
  return browserDraftSteps.some((candidate) => candidate === step);
10242
11647
  }
10243
- function registrationBrowserDraft(flow, discountCode) {
11648
+ /**
11649
+ * The note ("Anything we should know?") often holds health details, so it's
11650
+ * kept only for a signed-in customer. A signed-out draft could be opened by the
11651
+ * next person on a shared device, such as a studio's front-desk tablet.
11652
+ */
11653
+ function keepsNote(owner) {
11654
+ return owner.kind === "session";
11655
+ }
11656
+ /** The saved note to put back, or nothing for a signed-out draft (including one saved before this rule). */
11657
+ function restoredNote(saved) {
11658
+ return keepsNote(saved.owner) ? { notes: saved.notes } : {};
11659
+ }
11660
+ function registrationBrowserDraft(flow, discountCode, identity) {
10244
11661
  if (!isBrowserDraftStep(flow.step)) return null;
10245
11662
  const { draft } = flow;
11663
+ const owner = bookingQuestionsOwnerOf(identity);
10246
11664
  return {
11665
+ owner,
10247
11666
  step: flow.step,
10248
11667
  selectedEventIds: draft.selection.map((event) => event.selectionId),
10249
11668
  placeCount: flow.placeCount,
@@ -10251,12 +11670,51 @@ function registrationBrowserDraft(flow, discountCode) {
10251
11670
  selectedSlidingAmountInput: draft.selectedSlidingAmountInput,
10252
11671
  selectedAttendanceMode: draft.selectedAttendanceMode,
10253
11672
  runChoices: draft.runChoices,
11673
+ roomChoices: [...draft.roomChoices],
11674
+ reviewedRooms: [...draft.reviewedRooms],
10254
11675
  contact: {
10255
11676
  name: draft.formData.name,
10256
11677
  email: draft.formData.email,
10257
11678
  phone: draft.formData.phone
10258
11679
  },
10259
- discountCode
11680
+ notes: keepsNote(owner) ? draft.formData.notes : "",
11681
+ discountCode,
11682
+ guests: draft.guests.map(({ name, email, phone }) => ({
11683
+ name,
11684
+ email,
11685
+ phone
11686
+ })),
11687
+ ...questionsDrafts(draft.selection, draft.bookingQuestions, draft.runRequirements, identity)
11688
+ };
11689
+ }
11690
+ /** Who asks the questions: one event for the whole selection, or each run for itself. */
11691
+ function questionAskers(selection) {
11692
+ const layout = decideSelectionRequirementsLayout(selection);
11693
+ return layout.kind === "per_run" ? {
11694
+ kind: "per_run",
11695
+ runs: layout.runs
11696
+ } : {
11697
+ kind: "once",
11698
+ event: primarySelectionItem(selection)
11699
+ };
11700
+ }
11701
+ /** Only answers typed as the visitor signed in now are kept, so the draft's one stamp covers them. */
11702
+ function answersDraft(answers, event, identity) {
11703
+ if ((answers.scope?.identity ?? null) !== identity) return null;
11704
+ return toBookingQuestionsTabDraft(answers, answers.refreshed?.targetKey === event.seriesId ? answers.refreshed.presentation : event.bookingQuestions);
11705
+ }
11706
+ function questionsDrafts(selection, answers, runs, identity) {
11707
+ const askers = questionAskers(selection);
11708
+ if (askers.kind === "once") return {
11709
+ questions: askers.event ? answersDraft(answers, askers.event, identity) : null,
11710
+ runQuestions: {}
11711
+ };
11712
+ return {
11713
+ questions: null,
11714
+ runQuestions: Object.fromEntries(askers.runs.flatMap((run) => {
11715
+ const kept = answersDraft(runAnswers(runs, run.seriesId).questions, run, identity);
11716
+ return kept ? [[run.seriesId, kept]] : [];
11717
+ }))
10260
11718
  };
10261
11719
  }
10262
11720
  /** A code belongs to its selection: it only comes back when that whole selection does. */
@@ -10264,13 +11722,15 @@ function restorableBrowserDraftCode(saved, events) {
10264
11722
  return findSelection(saved.selectedEventIds, events).length === saved.selectedEventIds.length ? saved.discountCode : "";
10265
11723
  }
10266
11724
  /** Restore against current events, never a saved price/capacity or a partial selection. */
10267
- function restoreRegistrationBrowserDraft(state, saved, events) {
11725
+ function restoreRegistrationBrowserDraft(state, saved, events, identity) {
10268
11726
  if (state.invitation.kind !== "none" || !isBrowserDraftStep(state.step)) return state;
10269
11727
  const selection = findSelection(saved.selectedEventIds, events);
10270
- const contact = {
11728
+ const theirs = isBookingQuestionsOwner(saved.owner, identity);
11729
+ const contact = theirs ? {
10271
11730
  ...state.draft.formData,
10272
- ...saved.contact
10273
- };
11731
+ ...saved.contact,
11732
+ ...restoredNote(saved)
11733
+ } : state.draft.formData;
10274
11734
  if (selection.length !== saved.selectedEventIds.length) return {
10275
11735
  ...state,
10276
11736
  draft: {
@@ -10278,6 +11738,8 @@ function restoreRegistrationBrowserDraft(state, saved, events) {
10278
11738
  formData: contact
10279
11739
  }
10280
11740
  };
11741
+ const restoredSelection = selection.length ? selection : state.draft.selection;
11742
+ const questions = theirs ? restoredQuestions(state.draft, saved, restoredSelection, identity) : {};
10281
11743
  return {
10282
11744
  ...state,
10283
11745
  step: saved.step === "select-payment" ? "enter-details" : saved.step,
@@ -10285,14 +11747,39 @@ function restoreRegistrationBrowserDraft(state, saved, events) {
10285
11747
  draft: {
10286
11748
  ...state.draft,
10287
11749
  formData: contact,
10288
- selection: selection.length ? selection : state.draft.selection,
11750
+ guests: theirs ? saved.guests.map((guest) => ({ ...guest })) : state.draft.guests,
11751
+ ...questions,
11752
+ selection: restoredSelection,
10289
11753
  selectedTicketLines: saved.selectedTicketLines,
10290
11754
  selectedSlidingAmountInput: saved.selectedSlidingAmountInput,
10291
11755
  selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(selection.length ? selection : state.draft.selection), saved.selectedAttendanceMode),
10292
- runChoices: saved.runChoices
11756
+ runChoices: saved.runChoices,
11757
+ roomChoices: saved.roomChoices,
11758
+ reviewedRooms: saved.reviewedRooms
10293
11759
  }
10294
11760
  };
10295
11761
  }
11762
+ /** Answers come back against the questions as they're asked now, never as they were saved. */
11763
+ function restoredQuestions(current, saved, selection, identity) {
11764
+ const restore = (answers, draft, event) => draft ? restoreBookingQuestionsAnswers(answers, decideBookingQuestionsRestoration({
11765
+ kind: "tab_draft",
11766
+ draft,
11767
+ identity,
11768
+ current: event.bookingQuestions
11769
+ })) : answers;
11770
+ const askers = questionAskers(selection);
11771
+ if (askers.kind === "once") return askers.event ? { bookingQuestions: restore(current.bookingQuestions, saved.questions, askers.event) } : {};
11772
+ return { runRequirements: askers.runs.reduce((runs, run) => {
11773
+ const answers = runAnswers(runs, run.seriesId);
11774
+ return {
11775
+ ...runs,
11776
+ [run.seriesId]: {
11777
+ ...answers,
11778
+ questions: restore(answers.questions, saved.runQuestions[run.seriesId], run)
11779
+ }
11780
+ };
11781
+ }, current.runRequirements) };
11782
+ }
10296
11783
  //#endregion
10297
11784
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptions.ts
10298
11785
  function buildBookingPaymentSelectionViewModel(input) {
@@ -10338,7 +11825,7 @@ function buildBookingPaymentOptionViewModel(input) {
10338
11825
  ...input,
10339
11826
  option: input.option
10340
11827
  });
10341
- default: return assertNever$1(input.option);
11828
+ default: return assertNever$2(input.option);
10342
11829
  }
10343
11830
  }
10344
11831
  function depositPolicy(refundability) {
@@ -10532,7 +12019,7 @@ function projectReviewedBookingCollectionMoney(facts, terms) {
10532
12019
  };
10533
12020
  case "upfront":
10534
12021
  case "deferred_manual": return money;
10535
- default: return assertNever$1(facts);
12022
+ default: return assertNever$2(facts);
10536
12023
  }
10537
12024
  }
10538
12025
  function requireReviewedLaterPaymentAmount(terms, index) {
@@ -10611,6 +12098,16 @@ function buildSelectedSiteCreditPreview(input) {
10611
12098
  });
10612
12099
  }
10613
12100
  //#endregion
12101
+ //#region ../blocks/src/system/runtime/shared/onlineBookingUnavailable.ts
12102
+ /**
12103
+ * Said, for events and appointments alike, when a booking needs a card
12104
+ * payment the site can't take yet, so the client books with the business
12105
+ * instead. Shown with the business's published contact details.
12106
+ */
12107
+ function onlineBookingUnavailableMessage(businessName) {
12108
+ return `You can’t book this online yet. Please contact ${businessName?.trim() || "the organiser"} to book your place.`;
12109
+ }
12110
+ //#endregion
10614
12111
  //#region ../blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.ts
10615
12112
  function isEventRegistrationAvailable(event) {
10616
12113
  return event.bookingAvailability.kind === "open";
@@ -10631,13 +12128,6 @@ function toHeadlessPaymentSelection(selection) {
10631
12128
  method: "stripe",
10632
12129
  collectionOptionKind: selection.collectionOptionKind
10633
12130
  };
10634
- case "pass":
10635
- if (!selection.passId) return { method: "none" };
10636
- return {
10637
- method: "pass",
10638
- passId: selection.passId,
10639
- ...selection.productName ? { productName: selection.productName } : {}
10640
- };
10641
12131
  case "membership":
10642
12132
  if (!selection.membershipId) return { method: "none" };
10643
12133
  return {
@@ -10645,20 +12135,6 @@ function toHeadlessPaymentSelection(selection) {
10645
12135
  membershipId: selection.membershipId,
10646
12136
  ...selection.productName ? { productName: selection.productName } : {}
10647
12137
  };
10648
- case "pass_bundle":
10649
- if (!selection.bundlePassId) return { method: "none" };
10650
- return {
10651
- method: "pass_bundle",
10652
- passId: selection.bundlePassId,
10653
- ...selection.productName ? { productName: selection.productName } : {}
10654
- };
10655
- case "membership_bundle":
10656
- if (!selection.bundleMembershipId) return { method: "none" };
10657
- return {
10658
- method: "membership_bundle",
10659
- membershipId: selection.bundleMembershipId,
10660
- ...selection.productName ? { productName: selection.productName } : {}
10661
- };
10662
12138
  }
10663
12139
  }
10664
12140
  function toInternalPaymentSelection(selection) {
@@ -10669,26 +12145,11 @@ function toInternalPaymentSelection(selection) {
10669
12145
  method: "stripe",
10670
12146
  collectionOptionKind: selection.collectionOptionKind
10671
12147
  };
10672
- case "pass": return {
10673
- method: "pass",
10674
- passId: selection.passId,
10675
- ...selection.productName ? { productName: selection.productName } : {}
10676
- };
10677
12148
  case "membership": return {
10678
12149
  method: "membership",
10679
12150
  membershipId: selection.membershipId,
10680
12151
  ...selection.productName ? { productName: selection.productName } : {}
10681
12152
  };
10682
- case "pass_bundle": return {
10683
- method: "pass_bundle",
10684
- bundlePassId: selection.passId,
10685
- ...selection.productName ? { productName: selection.productName } : {}
10686
- };
10687
- case "membership_bundle": return {
10688
- method: "membership_bundle",
10689
- bundleMembershipId: selection.membershipId,
10690
- ...selection.productName ? { productName: selection.productName } : {}
10691
- };
10692
12153
  }
10693
12154
  }
10694
12155
  function resolveEventRegistrationSubmitPlan(input) {
@@ -10711,13 +12172,7 @@ function toSubmitArgs(selection) {
10711
12172
  switch (selection.method) {
10712
12173
  case "stripe":
10713
12174
  case "free": return { method: selection.method };
10714
- case "pass":
10715
- case "pass_bundle": return {
10716
- method: selection.method,
10717
- passId: selection.passId
10718
- };
10719
- case "membership":
10720
- case "membership_bundle": return {
12175
+ case "membership": return {
10721
12176
  method: selection.method,
10722
12177
  membershipId: selection.membershipId
10723
12178
  };
@@ -10750,7 +12205,7 @@ function resolveHeadlessEventRegistrationStatus(wizard) {
10750
12205
  case "select-tickets":
10751
12206
  case "enter-details":
10752
12207
  case "select-payment": return { tag: "ready" };
10753
- default: return assertNever$1(wizard.flow);
12208
+ default: return assertNever$2(wizard.flow);
10754
12209
  }
10755
12210
  }
10756
12211
  const BOOKING_CLOSED_MESSAGE = "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.";
@@ -10805,11 +12260,11 @@ function resolveHeadlessEventRegistrationView(wizard) {
10805
12260
  case "select-payment":
10806
12261
  case "submitting":
10807
12262
  case "payment": return { kind: "form" };
10808
- default: return assertNever$1(wizard.flow);
12263
+ default: return assertNever$2(wizard.flow);
10809
12264
  }
10810
12265
  }
10811
12266
  function deriveEventRegistrationSteps(input) {
10812
- const needsPaymentStep = input.eventRequiresPayment && input.paymentSelection.method !== "pass" && input.paymentSelection.method !== "membership";
12267
+ const needsPaymentStep = input.eventRequiresPayment && input.paymentSelection.method !== "membership";
10813
12268
  const ids = [
10814
12269
  ...!input.hasPreSelectedContext ? ["select-event"] : [],
10815
12270
  "select-tickets",
@@ -10869,7 +12324,7 @@ function resolveRegistrationAdmission(input) {
10869
12324
  if (input.eligibilityLoading) return { kind: "checking" };
10870
12325
  if (input.eligibilityError) return {
10871
12326
  kind: "closed",
10872
- reason: "optionsUnavailable",
12327
+ reason: input.bookingsClosed ? "bookingsClosed" : "optionsUnavailable",
10873
12328
  message: input.eligibilityError
10874
12329
  };
10875
12330
  if (!input.eligibility) return { kind: "checking" };
@@ -10880,9 +12335,34 @@ function resolveRegistrationAdmission(input) {
10880
12335
  reason: "alreadyWaitlisted",
10881
12336
  message: "You're already on the waitlist for this event."
10882
12337
  };
10883
- return admissionFromAvailability(availability, input.isAuthenticated);
12338
+ const admission = admissionFromAvailability(availability, input.isAuthenticated, input.businessName);
12339
+ return admission.kind === "open" && input.selectionPayment ? admissionForSelectionPayment(input.selectionPayment, input.businessName) : admission;
12340
+ }
12341
+ /** The checkout refusal's words, for a selection the page shouldn't have offered together. */
12342
+ const BOOK_SEPARATELY_MESSAGE = "These can’t be booked together. Book them one at a time.";
12343
+ /** An open selection the server says can't be paid: the site can't take the money, or the items' ways to pay don't combine. */
12344
+ function admissionForSelectionPayment(payment, businessName) {
12345
+ switch (payment.kind) {
12346
+ case "bookable": return { kind: "open" };
12347
+ case "cannotBookOnline": return cannotBookOnline(businessName, payment.organiserContact ?? void 0);
12348
+ case "bookSeparately": return {
12349
+ kind: "closed",
12350
+ reason: "unavailable",
12351
+ message: BOOK_SEPARATELY_MESSAGE
12352
+ };
12353
+ case "noPaymentOption": return cannotBookOnline(businessName, void 0);
12354
+ }
10884
12355
  }
10885
- function admissionFromAvailability(availability, isAuthenticated) {
12356
+ /** The site can't take this payment now, so the client books with the business instead. */
12357
+ function cannotBookOnline(businessName, contact) {
12358
+ return {
12359
+ kind: "closed",
12360
+ reason: "unavailable",
12361
+ message: onlineBookingUnavailableMessage(businessName),
12362
+ ...contact ? { contact } : {}
12363
+ };
12364
+ }
12365
+ function admissionFromAvailability(availability, isAuthenticated, businessName) {
10886
12366
  switch (availability.kind) {
10887
12367
  case "available": return { kind: "open" };
10888
12368
  case "waitlist": return {
@@ -10894,11 +12374,7 @@ function admissionFromAvailability(availability, isAuthenticated) {
10894
12374
  kind: "fullyBooked",
10895
12375
  placesLeft: Math.max(0, availability.remainingPlaces ?? 0)
10896
12376
  };
10897
- case "paymentUnavailable": return {
10898
- kind: "closed",
10899
- reason: "unavailable",
10900
- message: "Payment options are not available for this event."
10901
- };
12377
+ case "paymentUnavailable": return cannotBookOnline(businessName, availability.organiserContact);
10902
12378
  case "selectionRequired": return { kind: "open" };
10903
12379
  case "bookingClosed": return {
10904
12380
  kind: "closed",
@@ -10938,6 +12414,23 @@ function settledRemainingPlaces(eligibility) {
10938
12414
  const availability = eligibility?.availability;
10939
12415
  return availability?.kind === "available" ? availability.remainingPlaces ?? null : null;
10940
12416
  }
12417
+ /** The primary button's words while admission is closed, where it shows at all (`registrationStopsHere`). */
12418
+ function closedAdmissionLabel(reason) {
12419
+ switch (reason) {
12420
+ case "alreadyWaitlisted": return "Already on waitlist";
12421
+ case "bookingsClosed": return "Bookings closed";
12422
+ case "optionsUnavailable": return "Couldn’t load times";
12423
+ case "unavailable": return "Can’t book online";
12424
+ }
12425
+ }
12426
+ /**
12427
+ * This can't be booked online at all (the site can't take the payment, or
12428
+ * registration is closed): the notice says why and who to contact, so the
12429
+ * form shows no places to choose and no button to press.
12430
+ */
12431
+ function registrationStopsHere(admission) {
12432
+ return admission.kind === "closed" && (admission.reason === "unavailable" || admission.reason === "bookingsClosed");
12433
+ }
10941
12434
  function resolveRegistrationAvailabilityBlocker(admission) {
10942
12435
  switch (admission.kind) {
10943
12436
  case "open":
@@ -11042,7 +12535,7 @@ function resolveRegistrationTicketContinuation(input) {
11042
12535
  };
11043
12536
  case "closed": return {
11044
12537
  kind: "blocked",
11045
- label: input.admission.reason === "alreadyWaitlisted" ? "Already on waitlist" : input.admission.reason === "optionsUnavailable" ? "Availability unavailable" : "Registration unavailable",
12538
+ label: closedAdmissionLabel(input.admission.reason),
11046
12539
  pending: false,
11047
12540
  message: input.admission.message
11048
12541
  };
@@ -11204,6 +12697,63 @@ function toEventDirectPaymentOption(option, mode, totalCents) {
11204
12697
  };
11205
12698
  }
11206
12699
  }
12700
+ /**
12701
+ * Several items' ways to pay, as the server's answer collects their money:
12702
+ * in full by card, or directly with the business, each booking owing its own
12703
+ * amount. Nothing here resolves terms; the answer already did.
12704
+ */
12705
+ function buildSelectionCollectionOptions(input) {
12706
+ const choice = input.collections.length > 1;
12707
+ return input.collections.flatMap((collection) => {
12708
+ const totalCents = input.orderTotalCents ?? collection.amountCents;
12709
+ switch (collection.kind) {
12710
+ case "upfront": return [payInFullOption(collection.currency, totalCents, choice)];
12711
+ case "deferred_manual": return [payDirectlyOption(collection, totalCents, input.itemLabel)];
12712
+ case "instalment_plan":
12713
+ case "flexible_balance": return [];
12714
+ }
12715
+ });
12716
+ }
12717
+ function payInFullOption(currency, totalCents, choice) {
12718
+ const { title: _title, ...copy } = buildUpfrontBookingPaymentOptionCopy(formatPrice(totalCents, currency));
12719
+ return {
12720
+ ...copy,
12721
+ ...summaryFor({
12722
+ totalCents,
12723
+ dueTodayCents: totalCents,
12724
+ currency
12725
+ }),
12726
+ kind: "upfront",
12727
+ presentationKind: "upfront",
12728
+ flexibleBalance: null,
12729
+ label: choice ? "Pay in full now" : "Pay by card",
12730
+ totalCents,
12731
+ configuredPaymentDueNowCents: totalCents
12732
+ };
12733
+ }
12734
+ /** One pay-directly choice, listing what each booking owes when their prices add up to the total. */
12735
+ function payDirectlyOption(collection, totalCents, itemLabel) {
12736
+ const { title, ...copy } = buildDeferredManualBookingPaymentOptionCopy();
12737
+ const termRows = (totalCents === collection.amountCents ? collection.bookings ?? [] : []).map((booking) => ({
12738
+ label: itemLabel(booking.itemId),
12739
+ value: formatPrice(booking.amountCents, collection.currency)
12740
+ }));
12741
+ return {
12742
+ ...copy,
12743
+ ...summaryFor({
12744
+ totalCents,
12745
+ dueTodayCents: 0,
12746
+ currency: collection.currency,
12747
+ termRows
12748
+ }),
12749
+ kind: "deferred_manual",
12750
+ presentationKind: "deferred_manual",
12751
+ flexibleBalance: null,
12752
+ label: title,
12753
+ totalCents,
12754
+ configuredPaymentDueNowCents: 0
12755
+ };
12756
+ }
11207
12757
  function resolveEventRegistrationDirectPaymentSelection(input) {
11208
12758
  if (input.selection.method !== null && input.selection.method !== "stripe") return { kind: "not-stripe" };
11209
12759
  const [onlyOption, ...otherOptions] = input.options;
@@ -11247,29 +12797,15 @@ function decideEventRegistrationPayment(input) {
11247
12797
  },
11248
12798
  directPaymentOptions: input.directPaymentOptions,
11249
12799
  canShowDirectPaymentOptions: input.directPaymentOptions.length > 0,
11250
- ...selectionPaymentPresentation(input.selectionPayment, input.eligibility)
12800
+ paysNothing: input.paysNothing,
12801
+ offersEntitlements: input.offersEntitlements
11251
12802
  };
11252
12803
  }
11253
- /** Whether nothing is due, and whether passes and memberships are offered, for the whole selection. */
11254
- function selectionPaymentPresentation(payment, eligibility) {
11255
- switch (payment.kind) {
11256
- case "one-item": return {
11257
- paysNothing: eligibility?.isFree ?? false,
11258
- offersEntitlements: true,
11259
- paysInFullBecauseSeveral: false
11260
- };
11261
- case "several": return {
11262
- paysNothing: payment.due === "nothing",
11263
- offersEntitlements: false,
11264
- paysInFullBecauseSeveral: payment.due === "card" && (eligibility?.paymentOptions ?? []).some((option) => option.kind === "flexibleBalance" || option.kind === "instalmentPlan")
11265
- };
11266
- }
11267
- }
11268
12804
  /**
11269
12805
  * Label for the button that acts on the chosen payment method.
11270
12806
  *
11271
- * A pass redemption spends a credit the moment it is pressed, so the label
11272
- * names the pass instead of describing the step.
12807
+ * Dates paid with a pass or membership take their button from the funding
12808
+ * option instead.
11273
12809
  */
11274
12810
  function resolvePaymentButtonText(method, siteCreditPreview, eligibility, selectedDirectOption) {
11275
12811
  switch (method) {
@@ -11279,9 +12815,6 @@ function resolvePaymentButtonText(method, siteCreditPreview, eligibility, select
11279
12815
  if (!eligibility) return "Continue to Payment";
11280
12816
  if (siteCreditPreview.cardDueNowCents > 0) return `Pay ${formatPrice(siteCreditPreview.cardDueNowCents, eligibility.currency)} by card`;
11281
12817
  return `Book with ${formatPrice(siteCreditPreview.appliedCreditCents, eligibility.currency)} site credit`;
11282
- case "pass": return "Book using class pass";
11283
- case "pass_bundle":
11284
- case "membership_bundle": return "Buy and book";
11285
12818
  case "free":
11286
12819
  case "membership":
11287
12820
  case null: return "Book your place";
@@ -11290,10 +12823,7 @@ function resolvePaymentButtonText(method, siteCreditPreview, eligibility, select
11290
12823
  function canContinueWithPaymentSelection(selection, directPaymentSelection) {
11291
12824
  switch (selection.method) {
11292
12825
  case "stripe": return directPaymentSelection.kind === "valid";
11293
- case "pass": return Boolean(selection.passId);
11294
12826
  case "membership": return Boolean(selection.membershipId);
11295
- case "pass_bundle": return Boolean(selection.bundlePassId);
11296
- case "membership_bundle": return Boolean(selection.bundleMembershipId);
11297
12827
  case "free": return true;
11298
12828
  case null: return false;
11299
12829
  }
@@ -11308,6 +12838,356 @@ function shouldPromptForLogin(status, isAuthenticated, eligibility) {
11308
12838
  return Boolean(status === "not-eligible" && !isAuthenticated && eligibility && (eligibility.requiresAuthForPasses || eligibility.requiresAuthForMemberships));
11309
12839
  }
11310
12840
  //#endregion
12841
+ //#region ../blocks/src/system/runtime/nodes/event-registration/useSelectionFunding.state.ts
12842
+ /**
12843
+ * How the dates are paid, one date or several (issue 1767, sets 6 and 7). The server
12844
+ * plans every option, its order and the one to select; the block keeps which one
12845
+ * the visitor picked and sends that option back with the split it showed.
12846
+ */
12847
+ /** The pass or membership an entitlement option uses, as the server names it on submit. */
12848
+ function entitlementSource(entitlement) {
12849
+ switch (entitlement.kind) {
12850
+ case "ownedPass": return {
12851
+ kind: "ownedPass",
12852
+ passId: entitlement.passId
12853
+ };
12854
+ case "ownedMembership": return {
12855
+ kind: "ownedMembership",
12856
+ membershipId: entitlement.membershipId
12857
+ };
12858
+ case "buyPass": return {
12859
+ kind: "buyPass",
12860
+ productId: entitlement.productId
12861
+ };
12862
+ case "buyMembership": return {
12863
+ kind: "buyMembership",
12864
+ productId: entitlement.productId
12865
+ };
12866
+ default: return assertNever$2(entitlement);
12867
+ }
12868
+ }
12869
+ function sourceKey(source) {
12870
+ switch (source.kind) {
12871
+ case "ownedPass": return `ownedPass:${source.passId}`;
12872
+ case "ownedMembership": return `ownedMembership:${source.membershipId}`;
12873
+ case "buyPass": return `buyPass:${source.productId}`;
12874
+ case "buyMembership": return `buyMembership:${source.productId}`;
12875
+ default: return assertNever$2(source);
12876
+ }
12877
+ }
12878
+ /** One key per option, so a pick survives a refetch that still offers it. */
12879
+ function fundingPickKey(pick) {
12880
+ switch (pick.kind) {
12881
+ case "money": return "money";
12882
+ case "entitlement": return sourceKey(pick.source);
12883
+ default: return assertNever$2(pick);
12884
+ }
12885
+ }
12886
+ function fundingOptionPick(option) {
12887
+ switch (option.kind) {
12888
+ case "money": return { kind: "money" };
12889
+ case "entitlement": return {
12890
+ kind: "entitlement",
12891
+ source: entitlementSource(option.entitlement)
12892
+ };
12893
+ default: return assertNever$2(option);
12894
+ }
12895
+ }
12896
+ function fundingOptionKey(option) {
12897
+ return fundingPickKey(fundingOptionPick(option));
12898
+ }
12899
+ function findOption(funding, pick) {
12900
+ const key = fundingPickKey(pick);
12901
+ return funding.options.find((option) => fundingOptionKey(option) === key);
12902
+ }
12903
+ /** The picked option, or the server's own selection when the pick isn't offered. */
12904
+ function chosenFundingOption(funding, pick) {
12905
+ return findOption(funding, pick) ?? findOption(funding, funding.selected) ?? funding.options[0];
12906
+ }
12907
+ /** The dates the option charges money for, earliest first. */
12908
+ function fundingMoneyDates(option) {
12909
+ switch (option.kind) {
12910
+ case "money": return option.moneyDates;
12911
+ case "entitlement": return option.uncovered.map((date) => date.occurrenceId);
12912
+ default: return assertNever$2(option);
12913
+ }
12914
+ }
12915
+ /** What submit sends: the option's source and the split the visitor saw. */
12916
+ function fundingChoice(option) {
12917
+ switch (option.kind) {
12918
+ case "money": return { kind: "money" };
12919
+ case "entitlement": return {
12920
+ kind: "entitlement",
12921
+ source: entitlementSource(option.entitlement),
12922
+ expected: {
12923
+ covered: [...option.covered],
12924
+ moneyDates: [...fundingMoneyDates(option)]
12925
+ }
12926
+ };
12927
+ default: return assertNever$2(option);
12928
+ }
12929
+ }
12930
+ /**
12931
+ * The options request for the dates of one event, one date or several; null
12932
+ * for anything else, which keeps its own payment step. A waitlist claim asks the
12933
+ * same way: the claim admits the held place, and the funding pays for it.
12934
+ */
12935
+ function selectionFundingRequest(input) {
12936
+ const selection = input.target?.selection;
12937
+ if (selection?.kind !== "dates") return null;
12938
+ const eventSeriesId = datesSeries(selection, input.eventSeriesId);
12939
+ const lines = normalizeTicketSelectionLines(input.ticketSelections);
12940
+ if (!eventSeriesId || lines.length === 0) return null;
12941
+ return {
12942
+ subject: {
12943
+ kind: "dates",
12944
+ eventSeriesId,
12945
+ occurrenceIds: selection.occurrenceIds,
12946
+ ...input.attendanceMode ? { attendanceMode: input.attendanceMode } : {}
12947
+ },
12948
+ selections: lines.map(({ pricingOptionId, quantity }) => ({
12949
+ pricingOptionId,
12950
+ quantity
12951
+ })),
12952
+ ...input.selectedSlidingAmount !== null ? { selectedSlidingAmount: input.selectedSlidingAmount } : {}
12953
+ };
12954
+ }
12955
+ /** Several dates name their series; one date's comes from the event being booked. */
12956
+ function datesSeries(selection, eventSeriesId) {
12957
+ return selection.eventSeriesId ?? (selection.occurrenceIds.length === 1 ? eventSeriesId : null);
12958
+ }
12959
+ /**
12960
+ * What the quote prices for the dates: nothing while the ways to pay are on their way or when the
12961
+ * visitor's own pass or membership covers every date, and otherwise the chosen option's whole order,
12962
+ * which the server funds and prices itself. Null for anything that isn't dates. One date paid with
12963
+ * money keeps its own booking's quote, so its card options, deposits and automatic discount stay
12964
+ * as they are, and it waits for nothing.
12965
+ */
12966
+ function selectionDatesQuote(lookup, request) {
12967
+ if (request === null) return null;
12968
+ const oneDate = request.subject.occurrenceIds.length === 1;
12969
+ switch (lookup.tag) {
12970
+ case "idle": return null;
12971
+ case "loading":
12972
+ case "failed": return oneDate ? null : { kind: "waiting" };
12973
+ case "loaded": {
12974
+ const option = chosenFundingOption(lookup.funding, lookup.pick);
12975
+ if (oneDate && option.kind === "money") return null;
12976
+ return ownCoverPaysEveryDate(option) ? { kind: "nothingToPay" } : {
12977
+ kind: "order",
12978
+ selection: {
12979
+ ...request,
12980
+ funding: fundingChoice(option)
12981
+ }
12982
+ };
12983
+ }
12984
+ default: return assertNever$2(lookup);
12985
+ }
12986
+ }
12987
+ /** A pass or membership the visitor already has, covering every date: submit books them with no order. */
12988
+ function ownCoverPaysEveryDate(option) {
12989
+ if (option.kind === "money" || option.uncovered.length > 0) return false;
12990
+ switch (option.entitlement.kind) {
12991
+ case "ownedPass":
12992
+ case "ownedMembership": return true;
12993
+ case "buyPass":
12994
+ case "buyMembership": return false;
12995
+ default: return assertNever$2(option.entitlement);
12996
+ }
12997
+ }
12998
+ /**
12999
+ * One date with nothing but money to offer, no note and no change to explain keeps
13000
+ * the card step it always had; anything else shows the ways to pay.
13001
+ */
13002
+ function cardStepServesDates(lookup, dateCount) {
13003
+ if (dateCount !== 1 || lookup.tag !== "loaded" || lookup.notice !== null || lookup.reload !== null) return false;
13004
+ const { options, entitlementNote } = lookup.funding;
13005
+ return options.length === 1 && options[0].kind === "money" && entitlementNote === "none";
13006
+ }
13007
+ /** The option the visitor has chosen, once the options are in. */
13008
+ function lookupChosenOption(lookup) {
13009
+ return lookup.tag === "loaded" ? chosenFundingOption(lookup.funding, lookup.pick) : null;
13010
+ }
13011
+ /** What the visitor is looking at now, for a quote or submit to say which options it was about. */
13012
+ function selectionFundingBasis(lookup) {
13013
+ return lookup.tag === "loaded" ? {
13014
+ requestKey: lookup.requestKey,
13015
+ pickKey: fundingPickKey(lookup.pick)
13016
+ } : null;
13017
+ }
13018
+ const initialSelectionFundingLookup = { tag: "idle" };
13019
+ function settles(state, requestKey) {
13020
+ if (state.tag === "idle" || state.requestKey !== requestKey) return false;
13021
+ return state.tag === "loading" || state.tag === "loaded" && state.reload !== null && state.reload.sent;
13022
+ }
13023
+ function stillCurrent(state, basis) {
13024
+ const now = selectionFundingBasis(state);
13025
+ return now !== null && basis !== null && now.requestKey === basis.requestKey && now.pickKey === basis.pickKey;
13026
+ }
13027
+ /**
13028
+ * The options as the visitor may choose them: with a payment answer, only those it can take payment
13029
+ * for. An option it doesn't answer for isn't offered, rather than free. Null when the answer leaves
13030
+ * nothing, or not the server's own selection, which the server never sends.
13031
+ */
13032
+ function offeredSelectionFunding(funding, payment) {
13033
+ if (payment === null || payment.kind !== "bookable") return funding;
13034
+ const offered = new Set(payment.options.map((option) => fundingPickKey(option.funding)));
13035
+ const [first, ...rest] = funding.options.filter((option) => offered.has(fundingOptionKey(option)));
13036
+ if (first === void 0 || !offered.has(fundingPickKey(funding.selected))) return null;
13037
+ return {
13038
+ ...funding,
13039
+ options: [first, ...rest]
13040
+ };
13041
+ }
13042
+ function settle(state, action) {
13043
+ const funding = offeredSelectionFunding(action.funding, action.payment);
13044
+ if (funding === null) return {
13045
+ tag: "failed",
13046
+ requestKey: action.requestKey
13047
+ };
13048
+ const revised = state.tag === "loaded" ? state.reload : null;
13049
+ const pick = revised && findOption(funding, revised.pick) ? revised.pick : funding.selected;
13050
+ return {
13051
+ tag: "loaded",
13052
+ requestKey: action.requestKey,
13053
+ funding,
13054
+ payment: action.payment,
13055
+ pick,
13056
+ notice: state.tag === "loaded" && revised ? state.notice : null,
13057
+ reload: null
13058
+ };
13059
+ }
13060
+ /** A reload after a refusal keeps the options on screen; anything else starts afresh. */
13061
+ function startLoading(state, requestKey) {
13062
+ return state.tag === "loaded" && state.requestKey === requestKey && state.reload !== null ? {
13063
+ ...state,
13064
+ reload: {
13065
+ ...state.reload,
13066
+ sent: true
13067
+ }
13068
+ } : {
13069
+ tag: "loading",
13070
+ requestKey
13071
+ };
13072
+ }
13073
+ function selectionFundingReducer(state, action) {
13074
+ switch (action.type) {
13075
+ case "loading": return startLoading(state, action.requestKey);
13076
+ case "loaded": return settles(state, action.requestKey) ? settle(state, action) : state;
13077
+ case "failed": return settles(state, action.requestKey) ? {
13078
+ tag: "failed",
13079
+ requestKey: action.requestKey
13080
+ } : state;
13081
+ case "picked": return state.tag === "loaded" && state.reload === null && findOption(state.funding, action.pick) ? {
13082
+ ...state,
13083
+ pick: action.pick,
13084
+ notice: null
13085
+ } : state;
13086
+ case "changed": return stillCurrent(state, action.basis) ? {
13087
+ ...state,
13088
+ notice: action.message,
13089
+ reload: {
13090
+ pick: action.funding.selected,
13091
+ sent: false
13092
+ }
13093
+ } : state;
13094
+ case "reset": return initialSelectionFundingLookup;
13095
+ default: return assertNever$2(action);
13096
+ }
13097
+ }
13098
+ /** The lookup for this request: another request's answer, or none yet, is still loading. */
13099
+ function currentSelectionFundingLookup(state, requestKey) {
13100
+ if (requestKey === null) return initialSelectionFundingLookup;
13101
+ if (state.tag !== "idle" && state.requestKey === requestKey) return state;
13102
+ return {
13103
+ tag: "loading",
13104
+ requestKey
13105
+ };
13106
+ }
13107
+ /** Whether the hook should ask the server now. */
13108
+ function selectionFundingFetchWanted(state, requestKey, enabled) {
13109
+ if (!enabled || requestKey === null) return false;
13110
+ if (state.tag === "idle" || state.requestKey !== requestKey) return true;
13111
+ return state.tag === "loaded" && state.reload !== null && !state.reload.sent;
13112
+ }
13113
+ //#endregion
13114
+ //#region ../blocks/src/system/runtime/nodes/event-registration/selectionPaymentAnswer.state.ts
13115
+ /**
13116
+ * How several dates or runs can be paid, as the server's selection payment
13117
+ * owner answered (P3). The block formats this answer and decides nothing about
13118
+ * it: which ways to pay exist, what each collects and whether the site can take
13119
+ * the money are all the server's.
13120
+ */
13121
+ /** The answer's option for a funding pick (money, or a pass or membership). */
13122
+ function paymentOptionFor(payment, pick) {
13123
+ if (payment.kind !== "bookable") return null;
13124
+ const key = fundingPickKey(pick);
13125
+ return payment.options.find((option) => fundingPickKey(option.funding) === key) ?? null;
13126
+ }
13127
+ const MONEY = { kind: "money" };
13128
+ /** How the selection's money is collected, one way per collection. Empty when nothing is due. */
13129
+ function collectionsOf(option) {
13130
+ if (!option) return [];
13131
+ switch (option.collect.kind) {
13132
+ case "nothing": return [];
13133
+ case "money": return option.collect.collections;
13134
+ default: return assertNever$2(option.collect);
13135
+ }
13136
+ }
13137
+ /** How a funding pick's money is collected. Empty with no answer yet, or when nothing is due. */
13138
+ function pickCollections(payment, pick) {
13139
+ return payment ? collectionsOf(paymentOptionFor(payment, pick)) : [];
13140
+ }
13141
+ /** The money option's ways to pay: what the visitor pays with no pass or membership. */
13142
+ function moneyCollections(payment) {
13143
+ return pickCollections(payment, MONEY);
13144
+ }
13145
+ /** Nothing to pay with money: the selection books free. False with no answer yet. */
13146
+ function selectionPaysNothing(payment) {
13147
+ return payment !== null && paymentOptionFor(payment, MONEY)?.collect.kind === "nothing";
13148
+ }
13149
+ /** Every way any option collects money, which a choice on the payment step must be one of. */
13150
+ function selectionCollectionKinds(payment) {
13151
+ if (payment.kind !== "bookable") return [];
13152
+ return [...new Set(payment.options.flatMap((option) => collectionsOf(option).map((collection) => collection.kind)))];
13153
+ }
13154
+ /** Each chosen item's name, keyed by the ID the server's per-booking amounts use. */
13155
+ function selectionItemLabels(selection) {
13156
+ const names = new Map(selection.map((event) => {
13157
+ const subject = event.registrationSubject;
13158
+ return [subject.kind === "occurrence" ? subject.occurrenceId : subject.eventSeriesId, selectionItemName(event, selection)];
13159
+ }));
13160
+ return (itemId) => names.get(itemId) ?? "";
13161
+ }
13162
+ /**
13163
+ * What the runs read is asked: each run with its own ticket or amount, at the
13164
+ * places chosen for them all. Null for anything but several runs, and while a
13165
+ * run's choice is unfinished.
13166
+ */
13167
+ function runsSelectionPaymentRequest(input) {
13168
+ if (input.selection.length < 2) return null;
13169
+ const runs = input.selection.flatMap((run) => {
13170
+ if (run.registrationSubject.kind !== "wholeSeries") return [];
13171
+ const choice = runPricingChoice(input.runChoices, run);
13172
+ const sliding = run.pricing.kind === "sliding_scale" ? parseCurrencyInputToCents(choice.slidingAmountInput) : null;
13173
+ return [{
13174
+ eventSeriesId: run.registrationSubject.eventSeriesId,
13175
+ selections: [{
13176
+ pricingOptionId: choice.pricingOptionId,
13177
+ quantity: input.places
13178
+ }],
13179
+ ...sliding !== null ? { selectedSlidingAmount: sliding } : {}
13180
+ }];
13181
+ });
13182
+ const [first, ...rest] = runs;
13183
+ if (!first || runs.length !== input.selection.length) return null;
13184
+ return { subject: {
13185
+ kind: "runs",
13186
+ runs: [first, ...rest],
13187
+ ...input.attendanceMode ? { attendanceMode: input.attendanceMode } : {}
13188
+ } };
13189
+ }
13190
+ //#endregion
11311
13191
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.ts
11312
13192
  /** Identity, not clicking a row, decides whether this is a new booking. */
11313
13193
  function decideEventChoice(state, event) {
@@ -11320,10 +13200,14 @@ function decideEventChoice(state, event) {
11320
13200
  }
11321
13201
  /** A replacement owns all new-event defaults and detaches invitation authority atomically. */
11322
13202
  function replaceRegistrationEvent(state, action) {
13203
+ const fresh = resetRegistrationDraft(state, {
13204
+ step: action.navigation === "advance" ? "select-tickets" : "select-event",
13205
+ event: action.event
13206
+ });
11323
13207
  return {
11324
- ...resetRegistrationDraft(state, action.navigation === "advance"),
13208
+ ...fresh,
11325
13209
  draft: {
11326
- ...createRegistrationDraftData(action.event),
13210
+ ...fresh.draft,
11327
13211
  formData: {
11328
13212
  ...state.draft.formData,
11329
13213
  consentAccepted: false
@@ -11331,21 +13215,24 @@ function replaceRegistrationEvent(state, action) {
11331
13215
  }
11332
13216
  };
11333
13217
  }
11334
- function createInitialRegistrationFlowState(hasPreSelectedContext) {
13218
+ function createInitialRegistrationFlowState(start) {
11335
13219
  return resetRegistrationDraft({
11336
13220
  isAuthenticated: false,
11337
13221
  completedOutcomes: [],
11338
13222
  spentClaim: null,
11339
13223
  draft: createRegistrationDraftData(null)
11340
- }, hasPreSelectedContext);
13224
+ }, start);
11341
13225
  }
11342
- /** Reset booking choices; live session facts are required and carried through. */
11343
- function resetRegistrationDraft(session, hasPreSelectedContext) {
13226
+ /**
13227
+ * Reset booking choices to the start's, with that item's own defaults; the
13228
+ * details typed so far and live session facts are carried through.
13229
+ */
13230
+ function resetRegistrationDraft(session, start) {
11344
13231
  return {
11345
13232
  questionFieldErrors: {},
11346
- step: hasPreSelectedContext ? "select-tickets" : "select-event",
13233
+ step: start.step,
11347
13234
  draft: {
11348
- ...createRegistrationDraftData(null),
13235
+ ...createRegistrationDraftData(start.event),
11349
13236
  formData: session.draft.formData
11350
13237
  },
11351
13238
  invitation: { kind: "none" },
@@ -11354,7 +13241,8 @@ function resetRegistrationDraft(session, hasPreSelectedContext) {
11354
13241
  completedOutcomes: session.completedOutcomes,
11355
13242
  spentClaim: session.spentClaim,
11356
13243
  eligibility: null,
11357
- passOptOut: false,
13244
+ selectionPayment: null,
13245
+ roomFacts: null,
11358
13246
  paymentSelection: { method: null },
11359
13247
  selectionSource: "auto"
11360
13248
  };
@@ -11369,10 +13257,7 @@ function paymentSelectionIdentity(selection) {
11369
13257
  case null:
11370
13258
  case "free": return [selection.method, void 0];
11371
13259
  case "stripe": return [selection.method, selection.collectionOptionKind];
11372
- case "pass": return [selection.method, selection.passId];
11373
13260
  case "membership": return [selection.method, selection.membershipId];
11374
- case "pass_bundle": return [selection.method, selection.bundlePassId];
11375
- case "membership_bundle": return [selection.method, selection.bundleMembershipId];
11376
13261
  }
11377
13262
  }
11378
13263
  function normalizePaymentSelection(selection) {
@@ -11387,7 +13272,7 @@ function flowTicketsCount(state) {
11387
13272
  const { ticketsCount } = selectionTicketInputs({
11388
13273
  several: severalItemsOf(state.draft.selection),
11389
13274
  primary: state.draft.selection[0] ?? null,
11390
- lines: state.draft.selectedTicketLines,
13275
+ lines: draftBookingLines(state.draft, state.roomFacts),
11391
13276
  slidingAmountInput: state.draft.selectedSlidingAmountInput,
11392
13277
  placeCount: state.placeCount,
11393
13278
  runChoices: state.draft.runChoices,
@@ -11395,88 +13280,57 @@ function flowTicketsCount(state) {
11395
13280
  });
11396
13281
  return Math.max(1, ticketsCount);
11397
13282
  }
11398
- /** How the whole selection is paid; the wizard reads the same decision. */
11399
- function flowSelectionPayment(state) {
11400
- return decideSelectionPayment({
11401
- selection: state.draft.selection,
11402
- runChoices: state.draft.runChoices,
11403
- eligibility: state.eligibility
11404
- });
11405
- }
11406
- /** Passes, memberships and bundles cover one item for one person. */
11407
- function entitlementsAllowed(state) {
11408
- return flowTicketsCount(state) === 1 && severalItemsOf(state.draft.selection) === null;
13283
+ /** A membership covers one place on one run, so it's chosen for the visitor then. Dates are paid with the server's funding options instead (issue 1767). */
13284
+ function membershipAllowed(state) {
13285
+ return flowTicketsCount(state) === 1 && state.draft.selection[0]?.registrationSubject.kind === "wholeSeries";
11409
13286
  }
11410
13287
  function computeAutoSelection(state) {
11411
- const { isAuthenticated, eligibility, passOptOut } = state;
13288
+ const { isAuthenticated, eligibility } = state;
11412
13289
  if (!eligibility) return { method: null };
11413
- const payment = flowSelectionPayment(state);
11414
- if (payment.kind === "several") return payment.due === "nothing" ? { method: "free" } : { method: null };
13290
+ if (severalItemsOf(state.draft.selection) !== null) return selectionPaysNothing(state.selectionPayment) ? { method: "free" } : { method: null };
11415
13291
  if (eligibility.isFree) return { method: "free" };
11416
- if (isAuthenticated && entitlementsAllowed(state)) {
11417
- const membership = eligibility.eligibleMemberships[0];
11418
- if (membership) return {
11419
- method: "membership",
11420
- membershipId: membership.id,
11421
- productName: membership.membershipName
11422
- };
11423
- const pass = eligibility.eligiblePasses[0];
11424
- if (pass && !passOptOut) return {
11425
- method: "pass",
11426
- passId: pass.id,
11427
- productName: pass.passName
11428
- };
11429
- }
11430
- return { method: null };
11431
- }
11432
- function isSelectionValid(input) {
11433
- const { selection, isAuthenticated, eligibility } = input;
13292
+ const membership = isAuthenticated && membershipAllowed(state) ? eligibility.eligibleMemberships[0] : void 0;
13293
+ return membership ? {
13294
+ method: "membership",
13295
+ membershipId: membership.id,
13296
+ productName: membership.membershipName
13297
+ } : { method: null };
13298
+ }
13299
+ function isSelectionValid(state, selection) {
13300
+ const { isAuthenticated, eligibility } = state;
11434
13301
  if (!selection.method) return false;
11435
- if (input.payment.kind === "several") return isSeveralItemsSelectionValid(selection, input.payment.due);
11436
- if (!eligibility) return selection.method === "stripe" || selection.method === "pass_bundle" || selection.method === "membership_bundle";
13302
+ if (severalItemsOf(state.draft.selection) !== null) return isSeveralItemsSelectionValid(selection, state.selectionPayment);
13303
+ if (!eligibility) return selection.method === "stripe";
11437
13304
  switch (selection.method) {
11438
13305
  case "free": return eligibility.isFree;
11439
13306
  case "stripe": return isCardSelectionValid(selection, eligibility);
11440
- case "pass":
11441
- case "membership":
11442
- case "pass_bundle":
11443
- case "membership_bundle": return input.entitlementsAllowed && isEntitlementSelectionValid(selection, eligibility, isAuthenticated);
13307
+ case "membership": return membershipAllowed(state) && isAuthenticated && eligibility.eligibleMemberships.some((membership) => membership.id === selection.membershipId);
11444
13308
  default: return false;
11445
13309
  }
11446
13310
  }
11447
13311
  /**
11448
- * Several items are free when nothing is due, otherwise paid up front by card
11449
- * (issue 1725). The first item's own options don't apply: a free first run
11450
- * doesn't make a paid second one free.
13312
+ * Several items are free when the server says nothing is due, otherwise paid
13313
+ * one of the ways its answer collects money. The first item's own options
13314
+ * don't apply. While the answer is being asked again, a chosen way to pay
13315
+ * stands until it arrives.
11451
13316
  */
11452
- function isSeveralItemsSelectionValid(selection, due) {
11453
- switch (due) {
11454
- case "nothing": return selection.method === "free";
11455
- case "card": return selection.method === "stripe" && selection.collectionOptionKind === "upfront";
13317
+ function isSeveralItemsSelectionValid(selection, payment) {
13318
+ if (payment === null) return selection.method === "stripe";
13319
+ switch (selection.method) {
13320
+ case "free": return selectionPaysNothing(payment);
13321
+ case "stripe": return selectionCollectionKinds(payment).includes(selection.collectionOptionKind);
13322
+ case "membership":
13323
+ case null: return false;
13324
+ default: return assertNever$2(selection);
11456
13325
  }
11457
13326
  }
11458
13327
  function isCardSelectionValid(selection, eligibility) {
11459
13328
  if (!eligibility.requiresPayment || !eligibility.price) return false;
11460
13329
  return getApprovedDirectPaymentCollectionOptionKinds(eligibility.paymentOptions).includes(selection.collectionOptionKind);
11461
13330
  }
11462
- function isEntitlementSelectionValid(selection, eligibility, isAuthenticated) {
11463
- if ((selection.method === "pass" || selection.method === "membership") && !isAuthenticated) return false;
11464
- switch (selection.method) {
11465
- case "pass": return eligibility.eligiblePasses.some((pass) => pass.id === selection.passId);
11466
- case "membership": return eligibility.eligibleMemberships.some((membership) => membership.id === selection.membershipId);
11467
- case "pass_bundle": return eligibility.availablePasses.some((pass) => pass.id === selection.bundlePassId);
11468
- case "membership_bundle": return eligibility.availableMemberships.some((membership) => membership.id === selection.bundleMembershipId);
11469
- }
11470
- }
11471
13331
  function normalizeRegistrationFlowState(state) {
11472
13332
  const autoSelection = computeAutoSelection(state);
11473
- const canKeepManualSelection = state.step !== "select-tickets" && state.selectionSource === "manual" && isSelectionValid({
11474
- selection: state.paymentSelection,
11475
- isAuthenticated: state.isAuthenticated,
11476
- eligibility: state.eligibility,
11477
- entitlementsAllowed: entitlementsAllowed(state),
11478
- payment: flowSelectionPayment(state)
11479
- });
13333
+ const canKeepManualSelection = state.step !== "select-tickets" && state.selectionSource === "manual" && isSelectionValid(state, state.paymentSelection);
11480
13334
  const nextSelection = canKeepManualSelection ? state.paymentSelection : autoSelection;
11481
13335
  const nextSource = canKeepManualSelection ? "manual" : "auto";
11482
13336
  const normalizedSelection = normalizePaymentSelection(nextSelection);
@@ -11508,7 +13362,7 @@ function reduceUnlockedAction(state, action) {
11508
13362
  questionFieldErrors: action.failure.questionFieldErrors
11509
13363
  };
11510
13364
  case "payment-return-restored": return restorePaymentReturn(state, action.restoration);
11511
- default: return assertNever$1(action);
13365
+ default: return assertNever$2(action);
11512
13366
  }
11513
13367
  }
11514
13368
  /**
@@ -11537,12 +13391,13 @@ function restorePaymentReturn(state, restoration) {
11537
13391
  selection: restoration.selection.length > 0 ? restoration.selection : state.draft.selection,
11538
13392
  runChoices: restoration.runChoices,
11539
13393
  selectedTicketLines: restoration.ticketLines.map((line) => ({ ...line })),
13394
+ roomChoices: restoration.roomChoices,
13395
+ reviewedRooms: restoration.reviewedRooms,
11540
13396
  selectedAttendanceMode: restoration.attendanceMode,
11541
13397
  selectedSlidingAmountInput: restoration.slidingAmountInput
11542
13398
  },
11543
13399
  paymentSelection: normalizePaymentSelection(restoration.paymentSelection),
11544
- selectionSource: "manual",
11545
- passOptOut: passOptOutAfterManualSelection(state, restoration.paymentSelection)
13400
+ selectionSource: "manual"
11546
13401
  };
11547
13402
  return isRegistrationLocked(state.step) ? restored : normalizeRegistrationFlowState(restored);
11548
13403
  }
@@ -11555,12 +13410,12 @@ function synchronizeRegistrationAuthentication(state, isAuthenticated) {
11555
13410
  return isRegistrationLocked(state.step) ? updated : normalizeRegistrationFlowState(updated);
11556
13411
  }
11557
13412
  function isPaymentChoiceAction(action) {
11558
- return action.type === "set-manual-payment-selection" || action.type === "use-card-instead-of-pass" || action.type === "use-pass";
13413
+ return action.type === "set-manual-payment-selection";
11559
13414
  }
11560
13415
  /** Active navigation and draft updates share the same selection normalization. */
11561
13416
  function reduceActiveRegistration(state, action) {
11562
13417
  switch (action.type) {
11563
- case "browser-draft-restored": return normalizeRegistrationFlowState(restoreRegistrationBrowserDraft(state, action.draft, action.events));
13418
+ case "browser-draft-restored": return normalizeRegistrationFlowState(restoreRegistrationBrowserDraft(state, action.draft, action.events, action.identity));
11564
13419
  case "claim-arrived": {
11565
13420
  if (isSameWaitlistClaim(action.credential, state.spentClaim)) return state;
11566
13421
  const invitation = receiveWaitlistInvitation(state.invitation, action.credential);
@@ -11585,7 +13440,8 @@ function reduceActiveRegistration(state, action) {
11585
13440
  case "sign-in-draft-restored": return normalizeRegistrationFlowState(restoreEventSignInDraft(state, action.restoration));
11586
13441
  case "tickets-completed": return state.step === "select-tickets" ? normalizeRegistrationFlowState({
11587
13442
  ...state,
11588
- step: "enter-details"
13443
+ step: "enter-details",
13444
+ draft: withReviewedRooms(state.draft, state.roomFacts)
11589
13445
  }) : state;
11590
13446
  case "set-step": return isRegistrationLocked(action.step) ? {
11591
13447
  ...state,
@@ -11595,17 +13451,25 @@ function reduceActiveRegistration(state, action) {
11595
13451
  ...state,
11596
13452
  step: action.step
11597
13453
  });
11598
- case "reset": return resetRegistrationDraft(state, action.hasPreSelectedContext);
13454
+ case "reset": return resetRegistrationDraft(state, action.start);
11599
13455
  case "set-tickets-count":
11600
- case "eligibility-updated": return normalizeRegistrationFlowState(updateRegistrationDraft(state, action));
13456
+ case "eligibility-updated": return normalizeRegistrationFlowState(backToRoomsWhenTheyveGone(updateRegistrationDraft(state, action)));
13457
+ case "selection-payment-updated": return withSelectionPayment(state, action.payment);
11601
13458
  case "event-continued": return action.navigation === "advance" ? {
11602
13459
  ...state,
11603
13460
  step: "select-tickets"
11604
13461
  } : state;
11605
13462
  case "event-replaced": return replaceRegistrationEvent(state, action);
11606
- default: return assertNever$1(action);
13463
+ default: return assertNever$2(action);
11607
13464
  }
11608
13465
  }
13466
+ /** A new answer from the server can change which ways to pay are still valid. */
13467
+ function withSelectionPayment(state, payment) {
13468
+ return state.selectionPayment === payment ? state : normalizeRegistrationFlowState({
13469
+ ...state,
13470
+ selectionPayment: payment
13471
+ });
13472
+ }
11609
13473
  /** Answering a question clears the complaint about that question, and only that one. */
11610
13474
  function applyRegistrationQuestionsEvent(state, event) {
11611
13475
  const draft = {
@@ -11649,6 +13513,7 @@ function applyRunRequirementsAction(state, action) {
11649
13513
  const SELECTION_FIELDS = /* @__PURE__ */ new Set([
11650
13514
  "selection",
11651
13515
  "selectedTicketLines",
13516
+ "roomChoices",
11652
13517
  "runChoices"
11653
13518
  ]);
11654
13519
  function applyDraftEdit(state, edit) {
@@ -11697,6 +13562,20 @@ function isRegistrationLocked(step) {
11697
13562
  "payment-status"
11698
13563
  ].includes(step);
11699
13564
  }
13565
+ /** Steps after the rooms are chosen and before anything's submitted, where fresher room facts can still send the guest back. */
13566
+ const BEFORE_SUBMITTING = /* @__PURE__ */ new Set(["enter-details", "select-payment"]);
13567
+ /**
13568
+ * Someone else took the room while this guest was on their details or payment. Their
13569
+ * choices stay as they were, and they go back to the rooms, which say what changed,
13570
+ * rather than carrying on with a booking that no longer has its room.
13571
+ */
13572
+ function backToRoomsWhenTheyveGone(state) {
13573
+ if (!BEFORE_SUBMITTING.has(state.step) || draftRoomsStillPlace(state.draft, state.roomFacts)) return state;
13574
+ return {
13575
+ ...state,
13576
+ step: "select-tickets"
13577
+ };
13578
+ }
11700
13579
  /** Draft edits change inputs; the existing selection owner normalizes their consequences. */
11701
13580
  function updateRegistrationDraft(state, action) {
11702
13581
  switch (action.type) {
@@ -11706,79 +13585,34 @@ function updateRegistrationDraft(state, action) {
11706
13585
  };
11707
13586
  case "eligibility-updated": return {
11708
13587
  ...state,
11709
- eligibility: action.eligibility
13588
+ eligibility: action.eligibility,
13589
+ roomFacts: action.eligibility?.rooms ?? state.roomFacts
11710
13590
  };
11711
- default: return assertNever$1(action);
11712
- }
11713
- }
11714
- /**
11715
- * The pass the customer turned down, while it would otherwise cover this booking.
11716
- *
11717
- * The opt-out lasts for the whole booking; it only matters while a pass would
11718
- * be chosen automatically, so this is what offers the way back to it.
11719
- */
11720
- function getDeclinedPass(state) {
11721
- const paysDirectly = state.paymentSelection.method === "stripe" || state.paymentSelection.method === null;
11722
- return state.passOptOut && paysDirectly ? getOfferedPass(state) : null;
11723
- }
11724
- /** The pass auto-selection picks for this booking when the customer hasn't opted out. */
11725
- function getOfferedPass(state) {
11726
- const offered = computeAutoSelection({
11727
- ...state,
11728
- passOptOut: false
11729
- });
11730
- return offered.method === "pass" ? offered : null;
11731
- }
11732
- /**
11733
- * A manual card choice only opts out of a pass that was on offer; choosing the
11734
- * pass itself opts back in.
11735
- */
11736
- function passOptOutAfterManualSelection(state, selection) {
11737
- switch (selection.method) {
11738
- case "stripe": return state.passOptOut || getOfferedPass(state) !== null;
11739
- case "pass": return false;
11740
- case null:
11741
- case "free":
11742
- case "membership":
11743
- case "pass_bundle":
11744
- case "membership_bundle": return state.passOptOut;
13591
+ default: return assertNever$2(action);
11745
13592
  }
11746
13593
  }
13594
+ /** A run's membership books without a payment step. */
11747
13595
  function isEntitlementSelection(selection) {
11748
- return selection.method === "pass" || selection.method === "membership";
13596
+ return selection.method === "membership";
11749
13597
  }
11750
13598
  function requiresPaymentStep(params) {
11751
13599
  if (!params.eventRequiresPayment) return false;
11752
13600
  return !isEntitlementSelection(params.paymentSelection);
11753
13601
  }
11754
13602
  function reduceRegistrationPaymentChoice(state, action) {
11755
- switch (action.type) {
11756
- case "set-manual-payment-selection": return normalizeRegistrationFlowState({
11757
- ...state,
11758
- paymentSelection: normalizePaymentSelection(action.selection),
11759
- selectionSource: "manual",
11760
- passOptOut: passOptOutAfterManualSelection(state, action.selection)
11761
- });
11762
- case "use-card-instead-of-pass": return normalizeRegistrationFlowState({
11763
- ...state,
11764
- passOptOut: true,
11765
- paymentSelection: { method: null },
11766
- selectionSource: "manual"
11767
- });
11768
- case "use-pass": return normalizeRegistrationFlowState({
11769
- ...state,
11770
- passOptOut: false,
11771
- selectionSource: "auto"
11772
- });
11773
- }
13603
+ return normalizeRegistrationFlowState({
13604
+ ...state,
13605
+ paymentSelection: normalizePaymentSelection(action.selection),
13606
+ selectionSource: "manual"
13607
+ });
11774
13608
  }
11775
13609
  /** Only explicit navigation leaves a completed booking; draft refreshes retain it. */
11776
13610
  function reduceCompletedRegistration(state, action) {
11777
13611
  const { result: _result, ...draft } = state;
11778
13612
  switch (action.type) {
11779
- case "reset": return resetRegistrationDraft(state, action.hasPreSelectedContext);
13613
+ case "reset": return resetRegistrationDraft(state, action.start);
11780
13614
  case "set-step": return {
11781
- ...resetRegistrationDraft(state, action.step !== "select-event"),
13615
+ ...resetRegistrationDraft(state, CHOOSING_START),
11782
13616
  step: action.step
11783
13617
  };
11784
13618
  case "event-replaced": return registrationFlowReducer({
@@ -11801,10 +13635,9 @@ function reduceCompletedRegistration(state, action) {
11801
13635
  case "tickets-completed":
11802
13636
  case "set-tickets-count":
11803
13637
  case "eligibility-updated":
11804
- case "set-manual-payment-selection":
11805
- case "use-card-instead-of-pass":
11806
- case "use-pass": return state;
11807
- default: return assertNever$1(action);
13638
+ case "selection-payment-updated":
13639
+ case "set-manual-payment-selection": return state;
13640
+ default: return assertNever$2(action);
11808
13641
  }
11809
13642
  }
11810
13643
  /** A lookup can restore only the active request, never a completed or replaced draft. */
@@ -11841,7 +13674,7 @@ function applyWaitlistClaimLookup(state, action) {
11841
13674
  case "awaitingEvents": return state;
11842
13675
  case "ready": return normalizeRegistrationFlowState({
11843
13676
  ...state,
11844
- placeCount: restoration.ticketsCount,
13677
+ placeCount: restoration.claimed.places,
11845
13678
  draft: restoreRegistrationDraft(state.draft, lookup.claim, restoration),
11846
13679
  invitation: {
11847
13680
  kind: "ready",
@@ -11860,10 +13693,10 @@ function applyWaitlistClaimLookup(state, action) {
11860
13693
  action: "none"
11861
13694
  }
11862
13695
  };
11863
- default: return assertNever$1(restoration);
13696
+ default: return assertNever$2(restoration);
11864
13697
  }
11865
13698
  }
11866
- default: return assertNever$1(lookup);
13699
+ default: return assertNever$2(lookup);
11867
13700
  }
11868
13701
  }
11869
13702
  /** Completion remembers places; resetting the draft leaves this visit's outcomes intact. */
@@ -11959,7 +13792,7 @@ function registrationPresentation(state, route) {
11959
13792
  layout: "whole",
11960
13793
  screen: "paymentFailed"
11961
13794
  };
11962
- default: return assertNever$1(step);
13795
+ default: return assertNever$2(step);
11963
13796
  }
11964
13797
  }
11965
13798
  /**
@@ -11989,6 +13822,7 @@ const REGISTRATION_STEP_LABELS = [
11989
13822
  "Dates",
11990
13823
  "Tickets",
11991
13824
  "Places",
13825
+ "Rooms",
11992
13826
  "Your details",
11993
13827
  "How you’ll pay",
11994
13828
  "Payment"
@@ -12009,7 +13843,8 @@ function registrationStepLabelContext(scopedEvents, bookedEvent) {
12009
13843
  const several = scopedEvents.every((event) => event.allowsMultipleBooking === true);
12010
13844
  return {
12011
13845
  eventSelection: mode === "date" && several ? "dates" : severalRuns(scopedEvents) ? "runs" : mode,
12012
- booksWholeSeries: bookedEvent?.registrationSubject.kind === "wholeSeries"
13846
+ booksWholeSeries: bookedEvent?.registrationSubject.kind === "wholeSeries",
13847
+ booksRooms: Boolean((bookedEvent ?? (scopedEvents.length === 1 ? scopedEvents[0] : null))?.rooms)
12013
13848
  };
12014
13849
  }
12015
13850
  /** One label owner for the live progress and the server placeholder. */
@@ -12021,11 +13856,13 @@ function registrationStepLabel(step, context) {
12021
13856
  case "runs": return "Choose what to book";
12022
13857
  case "event": return "Event";
12023
13858
  }
12024
- case "select-tickets": return context.booksWholeSeries ? "Places" : "Tickets";
13859
+ case "select-tickets":
13860
+ if (context.booksRooms) return "Rooms";
13861
+ return context.booksWholeSeries ? "Places" : "Tickets";
12025
13862
  case "enter-details": return "Your details";
12026
13863
  case "select-payment": return "How you’ll pay";
12027
13864
  case "payment": return "Payment";
12028
13865
  }
12029
13866
  }
12030
13867
  //#endregion
12031
- export { beginWaitlistInvitation as $, formatEventTimeRange as $a, columnOptionSchema as $i, placesLeftLabel as $n, DEFAULT_MAILING_LIST_SUCCESS_MESSAGE as $o, isSameOpenCheckout as $r, severalRunsChoiceMessage as $t, isEventRegistrationAvailable as A, getEventAvailability as Aa, BOOKING_FORM_DATA_RESERVED_KEY_VALUES as Ai, getSlidingScaleForEvent as An, generateLookMediaFrameCss as Ao, resolveEventRegistrationScopedEvents as Ar, decideSelectionPayment as At, paymentChoiceDetails as B, buildCalendarViewport as Ba, resolveBookingPaymentMode as Bi, getTicketSelectionTotal as Bn, eventRegistrationErrorEndsCommand as Bo, resolveSelectionBookingClosedDetail as Br, selectionAtLimit as Bt, resolveGuestNextStepCheck as C, hasEventBookingClosedEarly as Ca, decideBookingQuestionsRestoration as Ci, getVisibleTicketTypes as Cn, asPartialObject as Co, resolveSelectedProduct as Cr, runsKeepingAnswers as Ct, settledRemainingPlaces as D, formatEventRemainingPlaces as Da, toBookingQuestionsAnswerDraft as Di, getCurrentTicketSelection as Dn, isInlineTextEmpty as Do, eventRegistrationPageSurfaceSubjectSchema as Dr, SELECTION_LIMIT_NOTE as Dt, resolveRegistrationTicketContinuation as E, canJoinEventWaitlistOnAnyMode as Ea, restoreBookingQuestionsAnswers as Ei, withOccurrenceTitle as En, inlineTextToPlainText as Eo, closedDateCopy as Er, paymentReturnRestoration as Et, toHeadlessPaymentSelection as F, selectMostOpenCapacitySource as Fa, reconcileBookingPackagePurchase as Fi, shouldLoadRegistrationOptions as Fn, sanitizeHref as Fo, planOrdinarySeriesSelection as Fr, registrationSelectionMode as Ft, withOfferedEvent as G, formatCalendarTitle as Ga, createInteractiveIslandCodec as Gi, BOOKING_SIGN_IN_RETURN_PARAM as Gn, CANCELLED_SESSION_STATUS as Go, readOverrideServiceCategories as Gr, selectionItemPrice as Gt, registrationBrowserDraft as H, eventDateLocale as Ha, toBookingPurchasablePackages as Hi, hasValidPricingOptionSelection as Hn, parseEventRegistrationErrorReason as Ho, groupPublicEventsByRun as Hr, selectionConsentLabel as Ht, toInternalPaymentSelection as I, BLOCK_BUTTON_ROLE_OPTIONS as Ia, resolveBookingPackagePaymentSelection as Ii, withRegistrationAvailability as In, parseAspectRatioValue as Io, planWholeSeriesParentBooking as Ir, runChoiceUsable as It, resolveDiscountContext as J, formatEventCompactDateRail as Ja, defineClientOwnedBlockRuntime as Ji, decideSignInReturn as Jn, resolveWholeSeriesBookingPhase as Jo, getBookingRedirectStateFromLocation as Jr, selectionPlacesNote as Jt, buildRegistrationSelectionRequest as K, formatDate$1 as Ka, defineInteractiveIslandMetaKeys as Ki, clearSignInReturnDrafts as Kn, nextLiveRunSessionStartMs as Ko, deriveBookingFormViewState as Kr, selectionItemsLabel as Kt, calculateEventRegistrationPreviewTotal as L, blockButtonRoleSchema as La, resolveBookingPackageSources as Li, canRequestTicketOption as Ln, isRecord$3 as Lo, planWholeSeriesParentSelection as Lr, runNeedsPricingChoice as Lt, resolveEventRegistrationSubmitPlan as M, getRemainingPlaces as Ma, bookingHasPackagePaymentChoices as Mi, getTicketSelectionRemainingPlaces as Mn, parseBlockColorToken as Mo, getPublicEventCanonicalPath as Mr, incompleteRunChoiceMessage as Mt, resolveHeadlessEventRegistrationStatus as N, isEventFull as Na, bookingPackageRequestKey as Ni, parseCurrencyInputToCents as Nn, readRuntimeNow as No, isOrdinaryPublicEvent as Nr, planSelectionPrice as Nt, visitorHoldsOwnPlace as O, formatRemainingPlaces as Oa, toBookingQuestionsPaymentSnapshot as Oi, getEligibilityFlowFlags as On, parseInlineTextFromUnknown as Oo, normalizeEventRegistrationPageSurfaceSubject as Or, SEVERAL_BOOKINGS_ACCOUNT_NOTE as Ot, resolveHeadlessEventRegistrationView as P, selectEventCapacitySource as Pa, bookingRequiresResourceSelection as Pi, resolveHeldTicketPlaces as Pn, resolveDateRuntimeContext as Po, planDropInPanel as Pr, primarySelectionItem as Pt, toRegistrationRequestSubject as Q, formatEventRunDates as Qa, calendarTabViewsSchema as Qi, sweepExpiredSignInReturnDrafts as Qn, DEFAULT_MAILING_LIST_PRIVACY_NOTE as Qo, isBookingServiceSlidingAmountInRange as Qr, severalItemsOf as Qt, buildBookingPaymentSelectionViewModel as R, isBlockButtonRole as Ra, resolveBookingPaymentAvailability as Ri, getSingleSelectedPricingOptionId as Rn, INCOMPATIBLE_ATTENDANCE_MESSAGE as Ro, planWholeSeriesRunSelection as Rr, runPricingChoice as Rt, planRegistrationDetailsContinuation as S, resolveRuntimeEventDestination as Sa, bookingQuestionsAnswerDraftSchema as Si, getTicketTypeAvailabilityLabel as Sn, sectionStateToneFromKind as So, reduceCommerceCart as Sr, runFieldErrors as St, resolveRegistrationAvailabilityBlocker as T, canJoinEventWaitlist as Ta, needsBookingQuestionsRefresh as Ti, transformRegistrationOptionsResponse as Tn, runTransforms as To, closedRunCopy as Tr, withoutKeptAnswers as Tt, registrationBrowserDraftSchema as U, eventDateOptions as Ua, getBookingServiceSlidingScale as Ui, normalizeTicketSelectionLines as Un, flexibleBalanceDueDay as Uo, bookingFormInteractiveIslandPropsCodec as Ur, selectionEntitlementNote as Ut, paymentChoicePrice as V, eventCalendarWeekStart as Va, resolveBookingPurchasablePackages as Vi, getTicketTypeLineMax as Vn, eventRegistrationErrors as Vo, selectionRepresentativeEvent as Vr, selectionConfirmationHint as Vt, restorableBrowserDraftCode as W, eventLocalDateKey as Wa, buildInteractiveIslandProps as Wi, setTicketLineQuantity as Wn, repriceBookingCollectionOptions as Wo, buildBookingFormInteractiveIslandProps as Wr, selectionIncludes as Wt, resolveRegistrationTarget as X, formatEventHourLabel as Xa, isDecodeSuccess as Xi, readSignInReturn as Xn, parseMailingListRuntimeContext as Xo, getRegistrationSuccessCopy as Xr, selectionTicketInputs as Xt, resolveEventRequiresPayment as Y, formatEventDateParts as Ya, defineProgressiveBlockRuntime as Yi, nextSignInReturnExpiry as Yn, resolveWholeSeriesRunLifecycle as Yo, getBookingSuccessCopy as Yr, selectionRowAvailability as Yt, resolveRouteRequiresPayment as Z, formatEventNextDateFact as Za, bookingNowSchema as Zi, signInReturnPath as Zn, resolveBookingSignupOffer as Zo, getShopSuccessCopy as Zr, severalConfirmationSentence as Zt, shouldPromptForLogin as _, bookingPresentation as _a, applyAppointmentBookingQuestionsEvent as _i, formatPassCreditUsageLabel as _n, createImageShapeField as _o, buildPassCartItem as _r, unsafeAsSiteId as _s, buildSelectionRequirementsSubmission as _t, registrationPresentation as a, previewStageSchema as aa, resolveBookingPaymentStep as ai, combinationWorking as an, MediaPlaceholder as ao, buildCheckoutDisplay as ar, offeringLabelForPageSurfaceSubject as as, toWaitlistClaimResolveFailure as at, placeCountCeiling as b, eventVenuePlace as ba, isAppointmentBookingQuestionsEvent as bi, getImplicitSingleTicketType as bn, uiTransforms as bo, parseStoredCommerceCartState as br, deriveRunRequirements as bt, registrationStepLabelContext as c, browserReadAuthoritySchema as ca, resolveDefaultBookingServiceId as ci, selectionPreviewKey as cn, renderAudio as co, buildProductDetailDisplay as cr, formatEventPricing as cs, getRegistrationStartAt as ct, decideEventChoice as d, PAGE_NAVIGATION as da, toSelectedCollectionOptionKind as di, ENTITLEMENT_SINGLE_TICKET_TOOLTIP as dn, resolveImageUrl as do, formatInterval as dr, publicEventPricingDisplay as ds, toWholeSeriesRegistrationEvents as dt, eventButtonVariantSchema as ea, normalizeBookingFormConfig as ei, summariseSelectionPayment as en, formatEventWeekdayTime as eo, registrationDisplaySchema as er, parseBrevoListId as es, createRegistrationDraftData as et, getDeclinedPass as f, canonicalUrl as fa, formatCentsAsCurrencyInput as fi, areEntitlementsDisabledForTicketCount as fn, resolveImageUrlWithContext as fo, formatValidity as fr, publicEventPricingStrategy as fs, EVENT_SIGN_IN_FORM_ID as ft, decideEventRegistrationPayment as g, bookingPageKindSchema as ga, EMPTY_APPOINTMENT_BOOKING_QUESTIONS as gi, formatEventDateTime as gn, systemCustomizeFacetDefinitionsForBlock as go, EMPTY_COMMERCE_CART_STATE as gr, parseSiteId as gs, toEventSignInDraft as gt, buildEventRegistrationPaymentOptionsViewModel as h, requestSignIn as ha, resolveSelectedAppointmentConsent as hi, formatDate as hn, resolveArrangementKnobs as ho, passCardListContent as hr, resolvePricingOptionsPriceDisplay as hs, eventSignInRestoration as ht, registrationPaymentRoute as i, filterAutoShowSchema as ia, resolveAppointmentCheckoutVerificationState as ii, combinationOffersOf as in, ImagePresets as io, buildCartDisplay as ir, EVENT_ADDRESS_AFTER_BOOKING_LABEL as is, isSameWaitlistClaim as it, normalizeEventRegistrationMaxTickets as j, getEventAvailabilityStatus as ja, applyBookingPaymentAdmission as ji, getSlidingScaleSelectionMessage as jn, resolveLookMediaFrame as jo, eventOccurrenceContext as jr, effectiveSelection as jt, deriveEventRegistrationSteps as k, formatTotalCapacity as ka, BOOKING_FORM_DATA_RESERVED_KEYS as ki, getRegistrationOccurrenceId as kn, plainTextToInlineText as ko, resolveEventRegistrationChoices as kr, canToggleSelectionItem as kt, areEventRegistrationPaymentSelectionsEqual as l, createHostedBlockApiConfig as la, selectedBookingCollectionOptionKind as li, selectionPreviewLines as ln, renderVideo as lo, buildProductListDisplay as lr, isPublicEventPricingOptionDisplayable as ls, toRegistrationEvents as lt, registrationFlowReducer as m, pageNavigationSchema as ma, projectSelectedAppointmentConsentIntoForm as mi, formatBookingWhen as mn, resolvePublicMediaUrl as mo, membershipClassesLabel as mr, resolveExactOrFreePriceDisplay as ms, eventSignInEnds as mt, getEventSelectionMode as n, eventCalendarDisplayModeSchema as na, parseBookingCurrencyInputToCents as ni, combinationHintCopy as nn, groupEventsByDate as no, shownVenue as nr, parseMailchimpInterestId as ns, registrationQuestionsMessage as nt, registrationRoute as o, registrationButtonVariantSchema as oa, resolveBookingSelectedService as oi, selectionCombinationHint as on, computeMediaTransformStyle as oo, buildPassesMembershipsDisplay as or, EVENT_PRESET_VOCABULARY as os, confirmationPaymentRows as ot, isRegistrationLocked as p, leavePage as pa, formatPrice as pi, findSelectedTicketType as pn, resolveMediaNodeResponsiveImage as po, membershipCardListContent as pr, publicEventPricingType as ps, eventSignInDraftStore as pt, findPreSelectedEvent as q, formatEventClockLabel as qa, createZodCodec as qi, createSignInReturnDraftStore as qn, orderedLiveRunSessions as qo, formatBookingSubmissionPreparationError as qr, selectionPlacesLabel as qt, panelShouldOpen as r, eventLayoutSchema as ra, prepareBookingSubmission as ri, combinationOfferLine as rn, resolveEventTimeZone as ro, appliedDiscountHint as rr, parseNewsletterListId as rs, validateFormData as rt, registrationStepLabel as s, weekStartSchema as sa, resolveBookingSiteId as si, selectionItemName as sn, mediaImageHostProps as so, buildProductCardDisplay as sr, formatBookingPriceDisplay as ss, resolveFinishedPresentation as st, REGISTRATION_STEP_LABELS as t, eventCalendarDefaultViewSchema as ta, normalizeBookingServices as ti, toggleSelectionItem as tn, formatTime$1 as to, resolveRegistrationDisplay as tr, parseMailchimpAudienceId as ts, invitationSubmission as tt, createInitialRegistrationFlowState as u, getBlockApiReadStage as ua, snapshotBookingShownTerms as ui, serverPricedTotalCents as un, resolveImageSourceSetWithContext as uo, formatCommercePrice as ur, publicEventPricingCurrency as us, toWholeSeriesRegistrationEvent as ut, fullyBookedLabel as v, eventOnlinePlace as va, appointmentQuestionsRefusal as vi, formatRegistrationSchedule as vn, heroTitleSizeOptions as vo, buildProductCartItem as vr, parseEventSeriesId as vs, checkRunRequirements as vt, resolveRegistrationAdmission as w, isBookableEvent as wa, deriveBookingQuestions as wi, occurrenceTitleOverride as wn, createTransformRegistry as wo, closedDatesCopy as wr, toRunRequirementsSnapshots as wt, planRegistrationDetailsCheck as x, formatEventLocation as xa, needsAppointmentQuestionsRefresh as xi, getPortalSubjectEmail as xn, SECTION_STATE_KINDS as xo, productItemKey as xr, nextRunToRead as xt, getTicketSelectionPurpose as y, eventPlaceName as ya, deriveAppointmentBookingQuestions as yi, formatTime as yn, createAspectRatioField as yo, deriveCommerceCheckoutState as yr, unsafeAsEventCategoryId as ys, decideSelectionRequirementsLayout as yt, buildReviewedBookingPaymentViewModel as z, RichText as za, resolveBookingPaymentChoice as zi, getTicketLineQuantity as zn, decideSelectionAttendance as zo, registrationDataForEventSelection as zr, runUnitPriceCents as zt };
13868
+ export { deriveEventRegistrationSteps as $, PAGE_NAVIGATION as $a, toSelectedCollectionOptionKind as $i, serverPricedTotalCents as $n, resolveImageUrl as $o, formatValidity as $r, parseMailchimpAudienceId as $s, toWholeSeriesRegistrationEvents as $t, ownCoverPaysEveryDate as A, toBookingPurchasablePackages as Aa, bookingFormInteractiveIslandPropsCodec as Ai, selectionConfirmationHint as An, eventDateLocale as Ao, normalizeTicketSelectionLines as Ar, eventRegistrationErrors as As, resolveEventRequiresPayment as At, closedAdmissionLabel as B, calendarTabViewsSchema as Ba, isSameOpenCheckout as Bi, severalConfirmationSentence as Bn, formatEventRunDates as Bo, placesLeftLabel as Br, formatCreditProductPayment as Bs, defaultTicketOptions as Bt, currentSelectionFundingLookup as C, reconcileBookingPackagePurchase as Ca, planWholeSeriesParentBooking as Ci, primarySelectionItem as Cn, selectMostOpenCapacitySource as Co, withRegistrationAvailability as Cr, sanitizeHref as Cs, beginWaitlistInvitation as Ct, fundingOptionPick as D, resolveBookingPaymentChoice as Da, resolveSelectionBookingClosedDetail as Di, runPricingChoice as Dn, RichText as Do, getTicketSelectionTotal as Dr, decideSelectionAttendance as Ds, buildRegistrationSelectionRequest as Dt, fundingOptionKey as E, resolveBookingPaymentAvailability as Ea, registrationDataForEventSelection as Ei, runNeedsPricingChoice as En, isBlockButtonRole as Eo, getTicketLineQuantity as Er, INCOMPATIBLE_ATTENDANCE_MESSAGE as Es, withOfferedEvent as Et, selectionFundingRequest as F, createZodCodec as Fa, getBookingRedirectStateFromLocation as Fi, selectionItemsLabel as Fn, formatEventClockLabel as Fo, decideSignInReturn as Fr, bookingCollectionDatesOpen as Fs, validateFormData as Ft, planRegistrationDetailsContinuation as G, eventLayoutSchema as Ga, resolveAppointmentCheckoutVerificationState as Gi, combinationHintCopy as Gn, resolveEventTimeZone as Go, buildCartDisplay as Gr, resolveWholeSeriesBookingPhase as Gs, selectRoomOffer as Gt, getTicketSelectionPurpose as H, eventButtonVariantSchema as Ha, normalizeBookingServices as Hi, severalRunsChoiceMessage as Hn, formatEventWeekdayTime as Ho, resolveRegistrationDisplay as Hr, CANCELLED_SESSION_STATUS as Hs, presentRoomChooser as Ht, buildEventRegistrationPaymentOptionsViewModel as I, defineClientOwnedBlockRuntime as Ia, getBookingSuccessCopy as Ii, selectionPlacesLabel as In, formatEventCompactDateRail as Io, nextSignInReturnExpiry as Ir, flexibleBalanceDueDay as Is, ADD_A_PLACE as It, resolveRegistrationAdmission as J, registrationButtonVariantSchema as Ja, resolveBookingSiteId as Ji, combinationWorking as Jn, computeMediaTransformStyle as Jo, buildProductCardDisplay as Jr, parseMailingListRuntimeContext as Js, confirmationPaymentRows as Jt, registrationStopsHere as K, filterAutoShowSchema as Ka, resolveBookingPaymentStep as Ki, combinationOfferLine as Kn, ImagePresets as Ko, buildCheckoutDisplay as Kr, resolveWholeSeriesPaymentDates as Ks, isSameWaitlistClaim as Kt, buildSelectionCollectionOptions as L, defineProgressiveBlockRuntime as La, getRegistrationSuccessCopy as Li, selectionPlacesNote as Ln, formatEventDateParts as Lo, readSignInReturn as Lr, repriceBookingCollectionOptions as Ls, bookingLines as Lt, selectionFundingBasis as M, buildInteractiveIslandProps as Ma, readOverrideServiceCategories as Mi, selectionEntitlementNote as Mn, eventLocalDateKey as Mo, BOOKING_SIGN_IN_RETURN_PARAM as Mr, parseEventRegistrationErrorReason as Ms, resolveRouteRequiresPayment as Mt, selectionFundingFetchWanted as N, createInteractiveIslandCodec as Na, deriveBookingFormViewState as Ni, selectionIncludes as Nn, formatCalendarTitle as No, clearSignInReturnDrafts as Nr, EVENT_CHECKOUT_HOLD_DURATION_MS as Ns, toRegistrationRequestSubject as Nt, initialSelectionFundingLookup as O, resolveBookingPaymentMode as Oa, selectionRepresentativeEvent as Oi, runUnitPriceCents as On, buildCalendarViewport as Oo, getTicketTypeLineMax as Or, setRoomChoicePeople as Os, findPreSelectedEvent as Ot, selectionFundingReducer as P, defineInteractiveIslandMetaKeys as Pa, formatBookingSubmissionPreparationError as Pi, selectionItemPrice as Pn, formatDate$1 as Po, createSignInReturnDraftStore as Pr, planCheckoutPaymentFlow as Ps, registrationQuestionsMessage as Pt, visitorHoldsOwnPlace as Q, getBlockApiReadStage as Qa, snapshotBookingShownTerms as Qi, selectionPreviewLines as Qn, resolveImageSourceSetWithContext as Qo, formatInterval as Qr, parseBrevoListId as Qs, toWholeSeriesRegistrationEvent as Qt, decideEventRegistrationPayment as R, isDecodeSuccess as Ra, getShopSuccessCopy as Ri, selectionRowAvailability as Rn, formatEventHourLabel as Ro, signInReturnPath as Rr, getStripeMinimumChargeRequirement as Rs, dayOptionsOf as Rt, chosenFundingOption as S, bookingRequiresResourceSelection as Sa, planOrdinarySeriesSelection as Si, planSelectionPrice as Sn, selectEventCapacitySource as So, shouldLoadRegistrationOptions as Sr, resolveDateRuntimeContext as Ss, entryStart as St, fundingMoneyDates as T, resolveBookingPackageSources as Ta, planWholeSeriesRunSelection as Ti, runChoiceUsable as Tn, blockButtonRoleSchema as To, getSingleSelectedPricingOptionId as Tr, isRecord$3 as Ts, invitationBooking as Tt, placeCountCeiling as U, eventCalendarDefaultViewSchema as Ua, parseBookingCurrencyInputToCents as Ui, summariseSelectionPayment as Un, formatTime$1 as Uo, shownVenue as Ur, nextLiveRunSessionStartMs as Us, roomChoiceMessage as Ut, fullyBookedLabel as V, columnOptionSchema as Va, normalizeBookingFormConfig as Vi, severalItemsOf as Vn, formatEventTimeRange as Vo, registrationDisplaySchema as Vr, formatCreditProductUnits as Vs, isRoomChoiceRefusal as Vt, planRegistrationDetailsCheck as W, eventCalendarDisplayModeSchema as Wa, prepareBookingSubmission as Wi, toggleSelectionItem as Wn, groupEventsByDate as Wo, appliedDiscountHint as Wr, orderedLiveRunSessions as Ws, roomSubmission as Wt, resolveRegistrationTicketContinuation as X, browserReadAuthoritySchema as Xa, resolveLowestBookingPaymentStep as Xi, selectionCombinationHint as Xn, renderAudio as Xo, buildProductListDisplay as Xr, DEFAULT_MAILING_LIST_PRIVACY_NOTE as Xs, getRegistrationStartAt as Xt, resolveRegistrationAvailabilityBlocker as Y, weekStartSchema as Ya, resolveDefaultBookingServiceId as Yi, paymentCaption as Yn, mediaImageHostProps as Yo, buildProductDetailDisplay as Yr, resolveBookingSignupOffer as Ys, resolveFinishedPresentation as Yt, settledRemainingPlaces as Z, createHostedBlockApiConfig as Za, selectedBookingCollectionOptionKind as Zi, selectionItemName as Zn, renderVideo as Zo, formatCommercePrice as Zr, DEFAULT_MAILING_LIST_SUCCESS_MESSAGE as Zs, toRegistrationEvents as Zt, pickCollections as _, BOOKING_FORM_DATA_RESERVED_KEYS as _a, resolveEventRegistrationScopedEvents as _i, SEVERAL_BOOKINGS_ACCOUNT_NOTE as _n, formatTotalCapacity as _o, getSlidingScaleForEvent as _r, plainTextToInlineText as _s, bookingOccurrenceContext as _t, registrationPresentation as a, deriveAppointmentBookingQuestions as aa, EVENT_PRESET_VOCABULARY as ac, buildProductCartItem as ai, buildSelectionRequirementsSubmission as an, bookingPresentation as ao, formatRunScheduleLines as ar, createImageShapeField as as, toHeadlessPaymentSelection as at, selectionPaysNothing as b, bookingHasPackagePaymentChoices as ba, isOrdinaryPublicEvent as bi, effectiveSelection as bn, getRemainingPlaces as bo, parseCurrencyInputToCents as br, parseBlockColorToken as bs, entryPageEvent as bt, registrationStepLabelContext as c, bookingQuestionsAnswerDraftSchema as ca, isPublicEventPricingOptionDisplayable as cc, productItemKey as ci, deriveRunRequirements as cn, eventVenuePlace as co, getPortalSubjectEmail as cr, uiTransforms as cs, calculateEventRegistrationPreviewTotal as ct, decideEventChoice as d, needsBookingQuestionsRefresh as da, publicEventPricingStrategy as dc, closedDatesCopy as di, runsKeepingAnswers as dn, hasEventBookingClosedEarly as do, occurrenceTitleOverride as dr, asPartialObject as ds, paymentChoiceDetails as dt, projectSelectedAppointmentConsentIntoForm as ea, parseMailchimpInterestId as ec, membershipCardListContent as ei, EVENT_SIGN_IN_FORM_ID as en, canonicalUrl as eo, findSelectedTicketType as er, resolveImageUrlWithContext as es, isEventRegistrationAvailable as et, isRegistrationLocked as f, restoreBookingQuestionsAnswers as fa, publicEventPricingType as fc, closedRunCopy as fi, toRunRequirementsSnapshots as fn, isBookableEvent as fo, transformRegistrationOptionsResponse as fr, createTransformRegistry as fs, paymentChoicePrice as ft, paymentOptionFor as g, formatPrice as ga, unsafeAsSiteId as gc, resolveEventRegistrationChoices as gi, SELECTION_LIMIT_NOTE as gn, formatRemainingPlaces as go, getRegistrationOccurrenceId as gr, parseInlineTextFromUnknown as gs, restorableBrowserDraftCode as gt, moneyCollections as h, formatCentsAsCurrencyInput as ha, parseSiteId as hc, normalizeEventRegistrationPageSurfaceSubject as hi, ATTENDANCE_CHOICE_MESSAGE as hn, formatEventRemainingPlaces as ho, getCurrentTicketSelection as hr, isInlineTextEmpty as hs, registrationBrowserDraftSchema as ht, registrationPaymentRoute as i, appointmentQuestionsRefusal as ia, offeringLabelForPageSurfaceSubject as ic, buildPassCartItem as ii, toEventSignInDraft as in, bookingPageKindSchema as io, formatRegistrationSchedule as ir, systemCustomizeFacetDefinitionsForBlock as is, resolveHeadlessEventRegistrationView as it, selectionDatesQuote as j, getBookingServiceSlidingScale as ja, buildBookingFormInteractiveIslandProps as ji, selectionConsentLabel as jn, eventDateOptions as jo, setTicketLineQuantity as jr, eventRegistrationRefusalMessage as js, resolveRegistrationTarget as jt, lookupChosenOption as k, resolveBookingPurchasablePackages as ka, groupPublicEventsByRun as ki, selectionAtLimit as kn, eventCalendarWeekStart as ko, hasValidPricingOptionSelection as kr, eventRegistrationErrorEndsCommand as ks, resolveDiscountContext as kt, areEventRegistrationPaymentSelectionsEqual as l, decideBookingQuestionsRestoration as la, publicEventPricingCurrency as lc, reduceCommerceCart as li, nextRunToRead as ln, formatEventLocation as lo, getTicketTypeAvailabilityLabel as lr, SECTION_STATE_KINDS as ls, buildBookingPaymentSelectionViewModel as lt, collectionsOf as m, toBookingQuestionsPaymentSnapshot as ma, resolvePricingOptionsPriceDisplay as mc, eventRegistrationPageSurfaceSubjectSchema as mi, paymentReturnRestoration as mn, canJoinEventWaitlistOnAnyMode as mo, isEmailAddress as mr, inlineTextToPlainText as ms, registrationBrowserDraft as mt, getEventSelectionMode as n, EMPTY_APPOINTMENT_BOOKING_QUESTIONS as na, EVENT_ADDRESS_AFTER_BOOKING_LABEL as nc, passCardListContent as ni, eventSignInEnds as nn, pageNavigationSchema as no, formatDate as nr, resolvePublicMediaUrl as ns, resolveEventRegistrationSubmitPlan as nt, registrationRoute as o, isAppointmentBookingQuestionsEvent as oa, formatBookingPriceDisplay as oc, deriveCommerceCheckoutState as oi, checkRunRequirements as on, eventOnlinePlace as oo, formatTime as or, heroTitleSizeOptions as os, toInternalPaymentSelection as ot, registrationFlowReducer as p, toBookingQuestionsAnswerDraft as pa, resolveExactOrFreePriceDisplay as pc, closedDateCopy as pi, withoutKeptAnswers as pn, canJoinEventWaitlist as po, withOccurrenceTitle as pr, runTransforms as ps, BROWSER_DRAFT_LIFETIME_MS as pt, resolveGuestNextStepCheck as q, previewStageSchema as qa, resolveBookingSelectedService as qi, combinationOffersOf as qn, MediaPlaceholder as qo, buildPassesMembershipsDisplay as qr, resolveWholeSeriesRunLifecycle as qs, toWaitlistClaimResolveFailure as qt, panelShouldOpen as r, applyAppointmentBookingQuestionsEvent as ra, getBookingInstalmentProtectedDepositAmountCents as rc, EMPTY_COMMERCE_CART_STATE as ri, eventSignInRestoration as rn, requestSignIn as ro, formatEventDateTime as rr, resolveArrangementKnobs as rs, resolveHeadlessEventRegistrationStatus as rt, registrationStepLabel as s, needsAppointmentQuestionsRefresh as sa, formatEventPricing as sc, parseStoredCommerceCartState as si, decideSelectionRequirementsLayout as sn, eventPlaceName as so, getImplicitSingleTicketType as sr, createAspectRatioField as ss, onlineBookingUnavailableMessage as st, REGISTRATION_STEP_LABELS as t, resolveSelectedAppointmentConsent as ta, parseNewsletterListId as tc, membershipClassesLabel as ti, eventSignInDraftStore as tn, leavePage as to, formatBookingWhen as tr, resolveMediaNodeResponsiveImage as ts, normalizeEventRegistrationMaxTickets as tt, createInitialRegistrationFlowState as u, deriveBookingQuestions as ua, publicEventPricingDisplay as uc, resolveSelectedProduct as ui, runFieldErrors as un, resolveRuntimeEventDestination as uo, getVisibleTicketTypes as ur, sectionStateToneFromKind as us, buildReviewedBookingPaymentViewModel as ut, runsSelectionPaymentRequest as v, BOOKING_FORM_DATA_RESERVED_KEY_VALUES as va, eventOccurrenceContext as vi, attendanceChoicePending as vn, getEventAvailability as vo, getSlidingScaleSelectionMessage as vr, generateLookMediaFrameCss as vs, decideRegistrationEntry as vt, fundingChoice as w, resolveBookingPackagePaymentSelection as wa, planWholeSeriesParentSelection as wi, quoteReductions as wn, BLOCK_BUTTON_ROLE_OPTIONS as wo, canRequestTicketOption as wr, parseAspectRatioValue as ws, invitationSubmission as wt, cardStepServesDates as x, bookingPackageRequestKey as xa, planDropInPanel as xi, incompleteRunChoiceMessage as xn, isEventFull as xo, resolveHeldTicketPlaces as xr, readRuntimeNow as xs, entrySelectionMode as xt, selectionItemLabels as y, applyBookingPaymentAdmission as ya, getPublicEventCanonicalPath as yi, canToggleSelectionItem as yn, getEventAvailabilityStatus as yo, getTicketSelectionRemainingPlaces as yr, resolveLookMediaFrame as ys, entryChoosesEvent as yt, shouldPromptForLogin as z, bookingNowSchema as za, isBookingServiceSlidingAmountInRange as zi, selectionTicketInputs as zn, formatEventNextDateFact as zo, sweepExpiredSignInReturnDrafts as zr, formatCreditProductBalance as zs, decideRoomStay as zt };