@riverbankcms/sdk 0.179.0 → 0.180.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 (193) hide show
  1. package/README.md +2 -2
  2. package/dist/_dts/{BlocksIslandsHydrator-DKwgs95u.d.ts → BlocksIslandsHydrator-DC_AvZwy.d.ts} +1 -1
  3. package/dist/_dts/{Page-lWenra5i.d.ts → Page-DQOxVtp3.d.ts} +7 -7
  4. package/dist/_dts/{SdkPreviewMode-BRxhRw4I.d.ts → SdkPreviewMode-DrLgY9_f.d.ts} +3 -2
  5. package/dist/_dts/{client-qWn7xAwJ.d.ts → client-BP7VBRvs.d.ts} +235 -56
  6. package/dist/_dts/{content-types-DL6GIvTm.d.ts → content-types-1-K2qi__.d.ts} +2 -2
  7. package/dist/_dts/{contracts-CzWyAiJj.d.ts → contracts-Dfqz0Tcu.d.ts} +3 -3
  8. package/dist/_dts/{generatePageMetadata-CBKd0cJ4.d.ts → generatePageMetadata-CSfAqmry.d.ts} +2 -2
  9. package/dist/_dts/{index-DVSipdrT.d.ts → index-B0_2-65A.d.ts} +3 -3
  10. package/dist/_dts/{index-DCiSHd-C.d.ts → index-BeM5Ylwf.d.ts} +5 -3
  11. package/dist/_dts/{index-BYnG_vF5.d.ts → index-Blrw2oVk.d.ts} +1 -1
  12. package/dist/_dts/{index-CaCum9mM.d.ts → index-CB5Csefo.d.ts} +2 -2
  13. package/dist/_dts/{index-CZgJrhzT.d.ts → index-DCcxLa8p.d.ts} +2 -2
  14. package/dist/_dts/{index-7CDBZGb-.d.ts → index-DQBGwBPx.d.ts} +1 -1
  15. package/dist/_dts/{index-BU9uAkHB.d.ts → index-DQr358-m.d.ts} +4 -4
  16. package/dist/_dts/{loadContent-CPKbFQyq.d.ts → loadContent-BG2tLGXj.d.ts} +7 -7
  17. package/dist/_dts/{request-BjKBCS7t.d.ts → request-P08l6mkr.d.ts} +2602 -821
  18. package/dist/_dts/{resolveBlockData-DupbMCup.d.ts → resolveBlockData-BDHc8lFs.d.ts} +5 -5
  19. package/dist/_dts/{resolvePageContent-BqNyCHi8.d.ts → resolvePageContent-Y3IZBbtL.d.ts} +1 -1
  20. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client.d.ts +7 -7
  23. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +2 -2
  27. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +1 -1
  28. package/dist/_dts/sdk/src/data/types.d.ts +2 -2
  29. package/dist/_dts/sdk/src/gifting/client.d.ts +1 -1
  30. package/dist/_dts/sdk/src/index.d.ts +8 -8
  31. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  32. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  33. package/dist/_dts/sdk/src/navigation/index.d.ts +3 -3
  34. package/dist/_dts/sdk/src/next/index.d.ts +8 -8
  35. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  36. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  37. package/dist/_dts/sdk/src/portal/client.d.ts +3 -3
  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-BvtNagjw.d.ts} +8 -7
  55. package/dist/_dts/{types-BOxSq-Bq.d.ts → types-BrK6SS5c.d.ts} +9 -8
  56. package/dist/_dts/{types-CT-KOxl_.d.ts → types-DpEAnP4F.d.ts} +7 -2
  57. package/dist/_dts/{types-B7e6Lmo5.d.ts → types-HAy1-Jjo.d.ts} +3 -3
  58. package/dist/_dts/{validation-Dz6qccue.d.ts → validation-D6q3tOBA.d.ts} +4 -4
  59. package/dist/client/{BlocksIslandsHydrator-1XifJg6V.mjs → BlocksIslandsHydrator-DJSmdNUJ.mjs} +16 -16
  60. package/dist/client/{BookingMailingListNote-BsbEgagJ.mjs → BookingMailingListNote-CGxg37zx.mjs} +91 -59
  61. package/dist/client/{BookingQuestionFields-C8IbeLHj.mjs → BookingQuestionFields-DXegGSnS.mjs} +24 -3
  62. package/dist/client/{CalendarNavigationChevron-Bbqij1XQ.mjs → CalendarNavigationChevron-VfP50sYm.mjs} +5 -5
  63. package/dist/client/{DemoBookingPortalAccess-uA9H8LIL.mjs → DemoBookingPortalAccess-0Ua44F1j.mjs} +12 -7
  64. package/dist/client/{EventCalendar.client-yoSI77ov.mjs → EventCalendar.client-CrpiyDSP.mjs} +9 -9
  65. package/dist/client/{EventCombined.client-HeCNlliq.mjs → EventCombined.client-D0me9wnz.mjs} +8 -8
  66. package/dist/client/{EventItem-Duhk1vnF.mjs → EventItem-CJITrGkF.mjs} +5 -4
  67. package/dist/client/{EventListWeekNavigation-BiutEqPK.mjs → EventListWeekNavigation-BlEm_xjq.mjs} +1 -1
  68. package/dist/client/{EventListing.client-B5ln77jG.mjs → EventListing.client-BNM_HuS0.mjs} +3 -3
  69. package/dist/client/{EventListing.view-hUDhNtMv.mjs → EventListing.view-CXfb7RRy.mjs} +7 -210
  70. package/dist/client/{EventRegistrationPayment-DqtX1vB2.mjs → EventRegistrationPayment-DiD9uYs6.mjs} +1292 -224
  71. package/dist/client/{Page-ChJ2TGVk.mjs → Page-bX7iy_MK.mjs} +158 -50
  72. package/dist/client/{SiteTermsAgreementField-CDBU31xW.mjs → SiteTermsAgreementField-BAdW5DvE.mjs} +22 -15
  73. package/dist/client/{StepIndicator-JQA-VuEH.mjs → StepIndicator-DCfdcb7s.mjs} +1 -1
  74. package/dist/client/{StepIndicator-2Dl9zon2.mjs → StepIndicator-DCqorVne.mjs} +6 -6
  75. package/dist/client/{accordion-B6SqU49k.mjs → accordion-wofJY8xY.mjs} +1 -1
  76. package/dist/client/{booking-form.client-DrEOjQ3N.mjs → booking-form.client-CYl9NrqS.mjs} +410 -77
  77. package/dist/client/{bookingForm-drZBwEZW.mjs → bookingForm-kgVWtuMe.mjs} +4 -4
  78. package/dist/client/bookings.mjs +40 -10
  79. package/dist/client/{boxStyleClassNames-DEh45w16.mjs → boxStyleClassNames-CQHWz5gJ.mjs} +2 -2
  80. package/dist/client/{carousel-C-YJliD-.mjs → carousel-BE1dEFsD.mjs} +1 -1
  81. package/dist/client/{cart-acGFWK9R.mjs → cart-BsjsdGZE.mjs} +3 -3
  82. package/dist/client/{cart.client-BzlOGP2j.mjs → cart.client-DylGUWXY.mjs} +1 -1
  83. package/dist/client/{checkout-SEontwhy.mjs → checkout-B5KxEUDr.mjs} +3 -3
  84. package/dist/client/{checkout.client-C0Qvh-d4.mjs → checkout.client-C98fhch3.mjs} +1 -1
  85. package/dist/client/{checkoutUrls-yUKeq1N9.mjs → checkoutUrls-BMLYTf38.mjs} +1 -1
  86. package/dist/client/client.mjs +224 -158
  87. package/dist/client/constants-PfYJsEZF.mjs +101 -0
  88. package/dist/client/{context-DTrwaQtg.mjs → context-DtKdUdkO.mjs} +199 -27
  89. package/dist/client/{dateFormatting-Cg8E1r9l.mjs → dateFormatting-BaGPvQS3.mjs} +1 -1
  90. package/dist/client/{demoPortalMagicLink-D0kOJYOX.mjs → demoPortalMagicLink-B8eDjhuG.mjs} +1 -1
  91. package/dist/client/{enhanceHeaderSection-DyrpZ7ks.mjs → enhanceHeaderSection-DvhD-8eE.mjs} +3 -3
  92. package/dist/client/{event-registration.client-RLZQWi2V.mjs → event-registration.client-Du9a_xAN.mjs} +1980 -1517
  93. package/dist/client/{eventCalendar-CphYnImh.mjs → eventCalendar-Di9wDfzl.mjs} +4 -4
  94. package/dist/client/{eventCombined-BvqjASB_.mjs → eventCombined-CNW6nBsB.mjs} +4 -4
  95. package/dist/client/{eventListing-BaNAoC_M.mjs → eventListing-CQMxQ8By.mjs} +4 -4
  96. package/dist/client/{eventRegistration-COMHoRl6.mjs → eventRegistration-CprS9k1D.mjs} +4 -4
  97. package/dist/client/{form-DyH2juYT.mjs → form-Zl1_8RJ6.mjs} +3 -3
  98. package/dist/client/{form.client-DBwzkB0M.mjs → form.client-TaMUys6I.mjs} +4 -4
  99. package/dist/client/{form.parts-CY4kX3mh.mjs → form.parts-CpNPbPPM.mjs} +1 -1
  100. package/dist/client/{formatDate-CTEN7gxW.mjs → formatDate-hhI1-tzt.mjs} +1 -1
  101. package/dist/client/gifting/client.mjs +5 -5
  102. package/dist/client/{gifting-CIx4V378.mjs → gifting-DNVa7-Wj.mjs} +4 -4
  103. package/dist/client/{gifting.client-BEVPpzJM.mjs → gifting.client-CFUq3GVx.mjs} +4 -4
  104. package/dist/client/{gifting.parts-VnORjnZK.mjs → gifting.parts-CDQvxA4A.mjs} +2 -2
  105. package/dist/client/{headerSection-DGcJfRS8.mjs → headerSection-Cg6083rn.mjs} +2 -2
  106. package/dist/client/{lookSurfaces-IqT_SVnX.mjs → lookSurfaces-gJ3OqPf9.mjs} +92 -2
  107. package/dist/client/{newsletter-form.client-BvEDkjiD.mjs → newsletter-form.client-VuL9I96G.mjs} +5 -5
  108. package/dist/client/{newsletter-form.interactive-DCO1lErD.mjs → newsletter-form.interactive-7Of3eYn0.mjs} +18 -24
  109. package/dist/client/{newsletter-form.parts-BIy4IUT3.mjs → newsletter-form.parts-OBqsfT24.mjs} +1 -1
  110. package/dist/client/{newsletterForm-CoTXDNFS.mjs → newsletterForm-BkJe_RTv.mjs} +3 -3
  111. package/dist/client/portal/client.mjs +299 -115
  112. package/dist/client/{product-detail.client-YHQ2aKX1.mjs → product-detail.client-B2hdxqJN.mjs} +1 -1
  113. package/dist/client/{product-list.client-DxoZw1vF.mjs → product-list.client-CCEgu9rx.mjs} +1 -1
  114. package/dist/client/{productDetail-DjuFvkey.mjs → productDetail-CRX_ZRfS.mjs} +3 -3
  115. package/dist/client/{productList-DE9GEFoZ.mjs → productList-BAdJ6z5S.mjs} +3 -3
  116. package/dist/client/{propsDecoder-Cyag_HOs.mjs → propsDecoder-BLKAmX0S.mjs} +2 -2
  117. package/dist/client/{registry.server-BPwV-0Pp.mjs → registry.server-Bj9cmHHF.mjs} +89 -50
  118. package/dist/client/rendering/client.mjs +22 -22
  119. package/dist/client/rendering/islands.mjs +1 -1
  120. package/dist/client/rendering.mjs +4 -4
  121. package/dist/client/{richText-coerce-NrRqDeOg.mjs → richText-coerce-Z45OLLEX.mjs} +1 -1
  122. package/dist/client/{routeIslandApiConfig-BWq5gKFK.mjs → routeIslandApiConfig-DHpTTK77.mjs} +1 -1
  123. package/dist/client/{shop-C3wM0Hr4.mjs → shop-BKsgxm_-.mjs} +3 -3
  124. package/dist/client/{shop-commerce-34YvcpbX.mjs → shop-commerce-Cbtk_kUW.mjs} +12 -12
  125. package/dist/client/{shop-commerce-store-B7xHksOs.mjs → shop-commerce-store-B-rv2p5h.mjs} +1 -1
  126. package/dist/client/{shop-discount-apply.state-BiBnozfO.mjs → shop-discount-apply.state-CiCDLNh7.mjs} +2 -2
  127. package/dist/client/{shop.client-C0v88nLd.mjs → shop.client-Rnqa74Tk.mjs} +12 -12
  128. package/dist/client/{shopShared-Ct-BRNez.mjs → shopShared-BaBfhjCq.mjs} +2 -2
  129. package/dist/client/{src-CCtanNlD.mjs → src-o7WEvbK1.mjs} +118 -3
  130. package/dist/client/{timetableModel-lhE29TNT.mjs → timetableModel-BOff1Kk5.mjs} +201 -7
  131. package/dist/client/{useAvailableSlots-BelJviOT.mjs → useAvailableSlots-DQJNh10g.mjs} +3 -23
  132. package/dist/client/{useDiscountCodeUi-rQRE1-Ho.mjs → useDiscountCodeUi-BcFQRI_7.mjs} +1 -1
  133. package/dist/client/{useEventPagination-C4rS2Xxl.mjs → useEventPagination-BvdcexDC.mjs} +7 -7
  134. package/dist/client/{view-LJVHVqsy.mjs → view-CTBwSpKv.mjs} +3 -3
  135. package/dist/client/{wizardSteps-CNDsxeJH.mjs → wizardSteps-CWIQyRIw.mjs} +1605 -442
  136. package/dist/preview-next/before-render.mjs +1 -0
  137. package/dist/preview-next/client/{LocationPickerEnvironment-BHAT81Wx.mjs → LocationPickerEnvironment-BW3dRFIv.mjs} +1 -1
  138. package/dist/preview-next/client/{MapLibreEditMap-B52hkdIZ.mjs → MapLibreEditMap-Db9BHyXh.mjs} +2 -2
  139. package/dist/preview-next/client/{PageSectionToolbar-C4TtBPN-.mjs → PageSectionToolbar-CG6KwITA.mjs} +4 -4
  140. package/dist/preview-next/client/{PreviewEditorSidebar-D6fkE59-.mjs → PreviewEditorSidebar-BGBqrC9m.mjs} +8 -7
  141. package/dist/preview-next/client/{PreviewEditorUI-amcDlj0O.mjs → PreviewEditorUI-Bwkyx28x.mjs} +5 -5
  142. package/dist/preview-next/client/{PreviewShell-DeQjx4zk.mjs → PreviewShell-DB1l6JNU.mjs} +7 -7
  143. package/dist/preview-next/client/{SdkPreviewModeRuntime-Cx0SXnoX.mjs → SdkPreviewModeRuntime-Bs6Cwzr3.mjs} +15 -7
  144. package/dist/preview-next/client/{lucide-react-McYZeSMb.mjs → lucide-react-00FF_oar.mjs} +13 -1
  145. package/dist/preview-next/client/{previewAssistantSlot-aqpU34WI.mjs → previewAssistantSlot-T-oDD_Dd.mjs} +5735 -2073
  146. package/dist/preview-next/client/{previewChromeRoot-D3Gy_Rs0.mjs → previewChromeRoot-BeukcDRy.mjs} +1 -1
  147. package/dist/preview-next/client/runtime.mjs +3 -3
  148. package/dist/preview-next/client/{sdk-runtime-Dzx_RrN7.mjs → sdk-runtime-ceDW_9q2.mjs} +2 -2
  149. package/dist/preview-next/client/{siteStyleAccess-LHedw83e.mjs → siteStyleAccess-CCB9bScO.mjs} +35 -23
  150. package/dist/preview-next/client/{useAutosaveStatus-DpSd9aVk.mjs → useAutosaveStatus-D4o0CKq7.mjs} +1 -1
  151. package/dist/preview-next/client/{useOpenBlockForSetup-BGZn5AT1.mjs → useOpenBlockForSetup-Seccrvwu.mjs} +2 -2
  152. package/dist/preview-next/container-responsive.css +103 -10
  153. package/dist/preview-next/keepAlive.mjs +1 -1
  154. package/dist/preview-next/middleware.mjs +1 -1
  155. package/dist/preview-next/{route-contract-DnL-FgSV.mjs → route-contract-FwFj8zGL.mjs} +43 -0
  156. package/dist/server/{Block.shared-BEbq6EwO.mjs → Block.shared-D6WrRCxX.mjs} +4 -4
  157. package/dist/server/{ThemeScopeCore-DFEM1a85.mjs → ThemeScopeCore-BQzjDQ2q.mjs} +8 -1
  158. package/dist/server/{bindings-Bly0dRs7.mjs → bindings-CS6ih1Yc.mjs} +4 -4
  159. package/dist/server/{client-CGJ2ztYp.mjs → client-m0ylCj_f.mjs} +847 -786
  160. package/dist/server/config-validation.mjs +1 -1
  161. package/dist/server/config.mjs +2 -2
  162. package/dist/server/data/resolveBlockData.mjs +1 -1
  163. package/dist/server/index.mjs +2 -2
  164. package/dist/server/{loadContent-BkK1w3QQ.mjs → loadContent-vgWMz1uD.mjs} +6 -4
  165. package/dist/server/{loadPage-DTLe0FEs.mjs → loadPage-CIOL3-9t.mjs} +3 -3
  166. package/dist/server/{lookMediaFrame-CaH018pK.mjs → lookMediaFrame-m-91jGGn.mjs} +36 -0
  167. package/dist/server/next.mjs +43 -30
  168. package/dist/server/{overrideResolution-Uy9Zp2Ks.mjs → overrideResolution-BiHmsvTZ.mjs} +1 -1
  169. package/dist/server/page-converter.mjs +1 -1
  170. package/dist/server/{pageRenderPlan-JzxBnqfV.mjs → pageRenderPlan-DJo_obpi.mjs} +9 -7
  171. package/dist/server/{pageRuntimeSupport-DyNSd2Yj.mjs → pageRuntimeSupport-BnSuoHON.mjs} +5 -1
  172. package/dist/server/{pageShared-DU4ETFPS.mjs → pageShared-BJuOzxzn.mjs} +550 -258
  173. package/dist/server/{prebuild-8jNtDXmS.mjs → prebuild-Cr8p8T7V.mjs} +1 -1
  174. package/dist/server/prebuild.mjs +1 -1
  175. package/dist/server/{prefetchBlockData-xeMG42aw.mjs → prefetchBlockData-BZh57-ua.mjs} +4 -3
  176. package/dist/server/{registry-DH1VrsCl.mjs → registry-CvhFwbXJ.mjs} +240 -80
  177. package/dist/server/rendering/components/pageShared.mjs +1 -1
  178. package/dist/server/rendering/helpers/loadPage.mjs +1 -1
  179. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +1 -1
  180. package/dist/server/rendering/server.mjs +4 -4
  181. package/dist/server/rendering.mjs +8 -8
  182. package/dist/server/{resolveBlockData-BN8tweTx.mjs → resolveBlockData-Cv_W1LVB.mjs} +39 -31
  183. package/dist/server/{resolvePageContent-DnM16_f9.mjs → resolvePageContent-BWKUZUIn.mjs} +1 -1
  184. package/dist/server/{responseMedia-F-ElH2Rd.mjs → responseMedia-KRKguBC5.mjs} +56 -1
  185. package/dist/server/routing.mjs +1 -1
  186. package/dist/server/server.mjs +3 -3
  187. package/dist/server/{servicePageContent-B-FezJmH.mjs → servicePageContent-CRKbTm_7.mjs} +14 -10
  188. package/dist/server/theme-bridge.mjs +1 -1
  189. package/dist/server/{validation-3jOzYdPL.mjs → validation-DCl-FCk_.mjs} +4 -4
  190. package/dist/server/{version-8t0o6_jd.mjs → version-DT_R5JAR.mjs} +1 -1
  191. package/dist/styles/index.css +504 -27
  192. package/package.json +1 -1
  193. package/dist/client/constants-4o4_hl34.mjs +0 -6
@@ -1,9 +1,9 @@
1
1
  "use client";
2
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";
3
+ import { $t as formatDateTime, A as toBookingRequirementConsentField, Ct as eventCalendarListLayoutCompatibleDisplayModeValues, D as blockBookingConsentSchema, E as blockBookingPaymentTermsSchema, M as bookingQuestionsAnswerValueSchema, P as eventCalendarListLayoutOptions, Qt as formatDateRange, St as eventCalendarDisplayModeValues, Tn as formatCurrencyAmount, Xt as validateBookingPaymentOptionKinds, Z as runtimeMediaSchema, Zt as formatDate$2, _n as parseUtcIsoDateTimeString, _t as roomChoicesSchema, bn as resolveBookingTimeZoneId, bt as normalizeCurrencyCode, c as blockSiteTermsSchema, ct as eyebrowTreatmentValues, dn as compareLocalScheduleDates, en as formatDateTimeRange, fn as formatLocalScheduleDate, gn as parseLocalScheduleTime, gt as reviewedRoomsSchema, hn as parseBookingLocalDate, ht as placesFor, in as formatTimeRange, j as beforeBookingQuestionsPresentationSchema, ln as toScheduledBookingDateTime, lt as headingDecorationColorTokenValues, mn as getLocalScheduleDate, mt as ROOM_PLACES, nn as formatSiteInstantTime, on as inferSiteDateLocale, pn as getBookingLocalDateKey, pt as visibleHeadingDecorationFamilyValues, rn as formatTime$2, sn as resolveBookingDisplayContext, t as assertNever$1, tn as formatSiteInstantDate, un as addLocalScheduleDays, vn as toUtcIsoDateTimeString, vt as unsafeAsPositiveCheckoutQuantity, wn as toNonNegativeCents, wt as eventCalendarListLayoutValues, xn as toBookingTimeZone, xt as eventCalendarDefaultViewValues, yn as resolveBookingBusinessTimeZone, yt as allocateReductionCents } from "./src-o7WEvbK1.mjs";
4
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";
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 { $t as cardListFamilyBlocks, Mt as resolveEffectiveKnobs, en as cardListKnobBlocks, jt as blockAppearancePresets, n as listLookControl, r as listLookSlot } from "./lookSurfaces-gJ3OqPf9.mjs";
7
7
  import { g as blockColorTokenNames, w as parseColorTokenParts } from "./types-BEaKfam_.mjs";
8
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
9
  import { S as clsx } from "./ThemedButton-CnSa7o-I.mjs";
@@ -840,6 +840,15 @@ function resolveWholeSeriesBookingPhase(run, now) {
840
840
  };
841
841
  }
842
842
  }
843
+ /** Resolve the course's two distinct dates from its surviving schedule once. */
844
+ function resolveWholeSeriesPaymentDates(input) {
845
+ const live = orderedLiveRunSessions(input.sessions);
846
+ const option = input.paymentTerms.allowedOptions.find((option) => option.kind === "instalment_plan");
847
+ return {
848
+ bookingStartAt: live[0]?.startsAt ?? null,
849
+ instalmentCollectionDeadlineAt: (option?.courseDeadline === "last_session" ? live[live.length - 1] : live[0])?.startsAt ?? null
850
+ };
851
+ }
843
852
  //#endregion
844
853
  //#region ../commerce/src/utils/assertNever.ts
845
854
  function assertNever(value, message) {
@@ -993,7 +1002,13 @@ function resolveAvailableBookingCollectionOptions(input) {
993
1002
  });
994
1003
  const collapsed = available.map((option) => isBookingCollectionEquivalentToUpfront(option) ? upfront : option);
995
1004
  const unique = collapsed.filter((option, index) => collapsed.findIndex((other) => other.kind === option.kind) === index);
996
- return unique.length > 0 ? unique : [upfront];
1005
+ return unique.length > 0 ? unique.map((option) => permitted(option, "configured")) : [permitted(upfront, "lateFallback")];
1006
+ }
1007
+ function permitted(option, permission) {
1008
+ return {
1009
+ ...option,
1010
+ permission
1011
+ };
997
1012
  }
998
1013
  function isBookingCollectionEquivalentToUpfront(option) {
999
1014
  switch (option.kind) {
@@ -1056,22 +1071,22 @@ function resolveBookingCollectionOptionFacts(input) {
1056
1071
  }
1057
1072
  /** Discounts change preview money, never an already admitted collection identity. */
1058
1073
  function repriceBookingCollectionOptions(input) {
1059
- const repriced = input.options.map((option) => option.totalCents === input.totalCents ? option : resolveBookingCollectionOptionFacts({
1074
+ const repriced = input.options.map((option) => option.totalCents === input.totalCents ? option : permitted(resolveBookingCollectionOptionFacts({
1060
1075
  option,
1061
1076
  totalCents: input.totalCents,
1062
1077
  anchorAt: option.anchorAt,
1063
1078
  bookingStartAt: option.bookingStartAt,
1064
1079
  timeZone: option.timeZone
1065
- }));
1080
+ }), option.permission));
1066
1081
  const available = repriced.filter((option) => canOfferBookingCollectionOption(option, input.currency, input.instalmentCollectionDeadlineAt));
1067
1082
  const first = repriced[0];
1068
- return available.length > 0 || !first ? available : [resolveBookingCollectionOptionFacts({
1083
+ return available.length > 0 || !first ? available : [permitted(resolveBookingCollectionOptionFacts({
1069
1084
  option: { kind: "upfront" },
1070
1085
  totalCents: input.totalCents,
1071
1086
  anchorAt: first.anchorAt,
1072
1087
  bookingStartAt: first.bookingStartAt,
1073
1088
  timeZone: first.timeZone
1074
- })];
1089
+ }), "lateFallback")];
1075
1090
  }
1076
1091
  /** The same admission is used for the offer and the submitted selection. */
1077
1092
  function canOfferBookingCollectionOption(option, currency, deadline = option.bookingStartAt) {
@@ -1108,6 +1123,45 @@ function bookingCollectionWindow(option) {
1108
1123
  start
1109
1124
  } : null;
1110
1125
  }
1126
+ /** Instalment due dates don't depend on the amount; this total keeps every row (zero rows are dropped). */
1127
+ const SCHEDULE_DATES_TOTAL_CENTS = 1e9;
1128
+ /**
1129
+ * The date half of `canOfferBookingCollectionOption`, for a configured option
1130
+ * before any total is known: whether its dates still allow it to be offered.
1131
+ * Amount rules (Stripe minimums, a deposit below the total) are left out, so a
1132
+ * `true` here is an offer the total may still refuse. Upfront and pay-directly
1133
+ * options have no dates to miss.
1134
+ */
1135
+ function bookingCollectionDatesOpen(option, dates) {
1136
+ if (option.kind === "upfront" || option.kind === "deferred_manual") return true;
1137
+ const window = bookingCollectionWindow({
1138
+ anchorAt: dates.nowIso,
1139
+ bookingStartAt: dates.bookingStartAt
1140
+ });
1141
+ if (!window || dates.bookingStartAt === null) return false;
1142
+ switch (option.kind) {
1143
+ case "flexible_balance": {
1144
+ const due = flexibleBalanceDueDay(option.config, dates.bookingStartAt, dates.timeZone);
1145
+ const localDay = (at) => formatLocalScheduleDate(getLocalScheduleDate(new Date(at), dates.timeZone));
1146
+ return due >= localDay(window.now) && due < localDay(window.start);
1147
+ }
1148
+ case "instalment_plan": {
1149
+ const deadline = dates.instalmentCollectionDeadlineAt === void 0 ? dates.bookingStartAt : dates.instalmentCollectionDeadlineAt;
1150
+ if (deadline === null) return false;
1151
+ const schedule = buildBookingInstalmentSchedule({
1152
+ anchorAt: dates.nowIso,
1153
+ totalAmountCents: SCHEDULE_DATES_TOTAL_CENTS,
1154
+ plan: option.plan
1155
+ });
1156
+ return canInstalmentPlanCompleteBefore({
1157
+ now: dates.nowIso,
1158
+ deadline,
1159
+ schedule
1160
+ }) && schedule.every((row) => row.stateAtBooking !== "scheduled" || Date.parse(row.dueAt) > window.now);
1161
+ }
1162
+ default: return assertNever(option);
1163
+ }
1164
+ }
1111
1165
  /** Mirrors private.flexible_balance_due_day: fixed civil date, or local start minus calendar days. */
1112
1166
  function flexibleBalanceDueDay(config, bookingStartAt, timeZone) {
1113
1167
  const rule = config.dueDateRule;
@@ -1205,6 +1259,59 @@ const checkoutCopy = {
1205
1259
  checkoutAssistanceRequired: "We can’t confirm your last payment attempt yet. Please don’t pay again – contact the business so they can check it."
1206
1260
  };
1207
1261
  //#endregion
1262
+ //#region ../commerce/src/purchase/roomWords.ts
1263
+ const PEOPLE_WORD = {
1264
+ guest: "you",
1265
+ staff: "them"
1266
+ };
1267
+ const PLACE_WORD = {
1268
+ women: "women's",
1269
+ men: "men's",
1270
+ mixed: "mixed"
1271
+ };
1272
+ const withArticle = (name) => `${/^(?:[aeiou]|8|11|18)/i.test(name) ? "an" : "a"} ${name}`;
1273
+ function bedPhrase(name, place) {
1274
+ return place === null ? `a shared ${name}` : `${withArticle(name)} (shared ${PLACE_WORD[place]} room)`;
1275
+ }
1276
+ function toThemselvesText(name, people, audience) {
1277
+ if (people > 1) return `${people} of ${PEOPLE_WORD[audience]} each have ${withArticle(name)} to ${audience === "guest" ? "yourself" : "themselves"}`;
1278
+ return audience === "guest" ? `You have ${withArticle(name)} to yourself` : `They have ${withArticle(name)} to themselves`;
1279
+ }
1280
+ /** One line of "How you'll stay", or "How they'll stay" in the staff dialog. */
1281
+ function stayLineText(line, audience) {
1282
+ const of = `${line.people} of ${PEOPLE_WORD[audience]}`;
1283
+ switch (line.kind) {
1284
+ case "to_themselves": return toThemselvesText(line.kindName, line.people, audience);
1285
+ case "share": return `${of} share ${withArticle(line.kindName)}`;
1286
+ case "beds": return `${of} ${line.people === 1 ? "has" : "each have"} a bed in ${bedPhrase(line.kindName, line.place)}`;
1287
+ }
1288
+ }
1289
+ function stayNoteText(note, audience) {
1290
+ const they = audience === "guest" ? "you'd" : "they'd";
1291
+ return `There isn't ${withArticle(note.kindName)} free for the ${note.people} of ${PEOPLE_WORD[audience]} together, so ${they} be in separate shared rooms.`;
1292
+ }
1293
+ const morePeopleText = (people) => people === 1 ? "1 more person" : `${people} more people`;
1294
+ 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.";
1295
+ function placementProblemText(problem, audience) {
1296
+ switch (problem.kind) {
1297
+ case "not_enough_places": return `Someone booked the last ${problem.kindName} place while you were ${audience === "guest" ? "choosing" : "adding them"}.`;
1298
+ 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.`;
1299
+ 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.";
1300
+ case "option_unavailable": return "That room option isn't available any more. Please choose another.";
1301
+ }
1302
+ }
1303
+ /**
1304
+ * The guest's page shows the words for a refusal's reason, with no room to name,
1305
+ * and then asks again: with fresh facts, `placementProblemText` says it better.
1306
+ */
1307
+ const ROOM_REFUSAL_REASON_MESSAGES = {
1308
+ roomNotEnoughPlaces: "Someone booked the last place in that room while you were choosing.",
1309
+ roomNeedsMorePeople: "That room needs more people booking together. Add more people, or choose another option.",
1310
+ roomStayChanged: STAY_CHANGED_FOR_GUEST,
1311
+ roomOptionsChanged: "The room options for this event have changed. Please check them and choose again.",
1312
+ roomsNeedChoices: "Rooms can't be booked here yet. Please book on the organiser's website."
1313
+ };
1314
+ //#endregion
1208
1315
  //#region ../commerce/src/purchase/event-registration-errors.ts
1209
1316
  const eventRegistrationErrors = {
1210
1317
  invalidAnswers: {
@@ -1267,6 +1374,12 @@ const eventRegistrationErrors = {
1267
1374
  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
1375
  action: "retry"
1269
1376
  },
1377
+ /** Payment couldn't start because the site can't take card payments, so retrying won't help. */
1378
+ onlinePaymentUnavailable: {
1379
+ endsCommand: true,
1380
+ 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.",
1381
+ action: "none"
1382
+ },
1270
1383
  registrationAttemptEnded: {
1271
1384
  endsCommand: true,
1272
1385
  message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
@@ -1277,6 +1390,31 @@ const eventRegistrationErrors = {
1277
1390
  message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
1278
1391
  action: "places"
1279
1392
  },
1393
+ roomNotEnoughPlaces: {
1394
+ endsCommand: false,
1395
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomNotEnoughPlaces,
1396
+ action: "places"
1397
+ },
1398
+ roomNeedsMorePeople: {
1399
+ endsCommand: false,
1400
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomNeedsMorePeople,
1401
+ action: "places"
1402
+ },
1403
+ roomStayChanged: {
1404
+ endsCommand: false,
1405
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomStayChanged,
1406
+ action: "places"
1407
+ },
1408
+ roomOptionsChanged: {
1409
+ endsCommand: false,
1410
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomOptionsChanged,
1411
+ action: "places"
1412
+ },
1413
+ roomsNeedChoices: {
1414
+ endsCommand: false,
1415
+ message: ROOM_REFUSAL_REASON_MESSAGES.roomsNeedChoices,
1416
+ action: "none"
1417
+ },
1280
1418
  registrationAlreadyExists: {
1281
1419
  endsCommand: false,
1282
1420
  message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
@@ -1531,6 +1669,504 @@ function nextCombinationHint(input) {
1531
1669
  }).sort((a, b) => a.added.length - b.added.length || a.plan.totalCents - b.plan.totalCents || compareOffer(a.offer, b.offer))[0] ?? null;
1532
1670
  }
1533
1671
  //#endregion
1672
+ //#region ../commerce/src/purchase/roomPlacement.ts
1673
+ /** The ticket type for someone in a room with this many people in it. */
1674
+ function priceFor(kind, peopleInRoom) {
1675
+ const exact = kind.prices.find((price) => price.peopleInRoom === peopleInRoom);
1676
+ const flat = kind.prices.find((price) => price.peopleInRoom === null);
1677
+ return (exact ?? flat)?.pricingOptionId ?? null;
1678
+ }
1679
+ /** A party bigger than a room takes as many as it needs, filling each. */
1680
+ function roomSizes(people, sleeps) {
1681
+ return Array.from({ length: Math.ceil(people / sleeps) }, (_, index) => Math.min(sleeps, people - index * sleeps));
1682
+ }
1683
+ /** The fewest people above this that a room of this kind has a price for. */
1684
+ function nextPricedSize(kind, size) {
1685
+ const bigger = kind.prices.flatMap((price) => price.peopleInRoom !== null && price.peopleInRoom > size ? [price.peopleInRoom] : []);
1686
+ return bigger.length === 0 ? null : Math.min(...bigger);
1687
+ }
1688
+ /** A private room with no price for this few needs more people, or isn't on offer at all. */
1689
+ function unpricedPrivateRoom(kind, size) {
1690
+ const forPeople = nextPricedSize(kind, size);
1691
+ if (forPeople === null) return {
1692
+ kind: "option_unavailable",
1693
+ kindId: kind.id
1694
+ };
1695
+ return {
1696
+ kind: "whole_room_needs_more_people",
1697
+ kindId: kind.id,
1698
+ kindName: kind.name,
1699
+ forPeople,
1700
+ morePeople: forPeople - size
1701
+ };
1702
+ }
1703
+ function privateUnits(kind, choice) {
1704
+ const priced = (choice.way === "own" ? Array.from({ length: choice.people }, () => 1) : roomSizes(choice.people, kind.sleeps)).map((size) => ({
1705
+ size,
1706
+ pricingOptionId: priceFor(kind, size)
1707
+ }));
1708
+ const missing = priced.find((unit) => unit.pricingOptionId === null);
1709
+ if (missing) return err(unpricedPrivateRoom(kind, missing.size));
1710
+ return ok$1(priced.flatMap(({ size, pricingOptionId }) => pricingOptionId === null ? [] : [{
1711
+ kind,
1712
+ size,
1713
+ pricingOptionId
1714
+ }]));
1715
+ }
1716
+ /** Everyone who chose the same sharing option in one booking is one group. */
1717
+ function addSharing(groups, group) {
1718
+ const same = (other) => other.kind.id === group.kind.id && other.place === group.place;
1719
+ return groups.some(same) ? groups.map((other) => same(other) ? {
1720
+ ...other,
1721
+ people: other.people + group.people
1722
+ } : other) : [...groups, group];
1723
+ }
1724
+ function addChoice(request, kind, choice) {
1725
+ if (choice.way !== "sharing") {
1726
+ const units = privateUnits(kind, choice);
1727
+ return units.ok ? ok$1({
1728
+ ...request,
1729
+ privateUnits: [...request.privateUnits, ...units.value]
1730
+ }) : units;
1731
+ }
1732
+ const pricingOptionId = kind.sleeps > 1 ? priceFor(kind, kind.sleeps) : null;
1733
+ if (pricingOptionId === null) return err({
1734
+ kind: "option_unavailable",
1735
+ kindId: kind.id
1736
+ });
1737
+ return ok$1({
1738
+ ...request,
1739
+ sharingGroups: addSharing(request.sharingGroups, {
1740
+ kind,
1741
+ place: choice.place,
1742
+ people: choice.people,
1743
+ pricingOptionId
1744
+ })
1745
+ });
1746
+ }
1747
+ function readChoices(facts, choices) {
1748
+ return choices.reduce((request, choice) => {
1749
+ if (!request.ok) return request;
1750
+ const kind = facts.kinds.find((candidate) => candidate.id === choice.kindId);
1751
+ if (!kind || !Number.isInteger(choice.people) || choice.people < 1) return err({
1752
+ kind: "option_unavailable",
1753
+ kindId: choice.kindId
1754
+ });
1755
+ return addChoice(request.value, kind, choice);
1756
+ }, ok$1({
1757
+ privateUnits: [],
1758
+ sharingGroups: []
1759
+ }));
1760
+ }
1761
+ /** Whether a sharing group still to be placed in this booking could use the room. */
1762
+ function isWantedBy(room, groups) {
1763
+ return groups.some((group) => group.kind.id === room.kindId && roomTakesPlace(room, group.place));
1764
+ }
1765
+ /**
1766
+ * One-way rooms before "either" ones, so flexible rooms stay free longest. Then
1767
+ * rooms this booking's sharing groups can't use, so the order of the choices
1768
+ * can't turn away a booking that fits.
1769
+ */
1770
+ function privateRoomFor(rooms, kindId, groups) {
1771
+ const open = rooms.filter((room) => room.kindId === kindId && room.occupancy.bookedAs === "empty" && room.setup.way !== "shared");
1772
+ return open.find((room) => room.setup.way === "private") ?? open.find((room) => !isWantedBy(room, groups)) ?? open[0];
1773
+ }
1774
+ function placePrivate(working, unit, groups) {
1775
+ const room = privateRoomFor(working.facts.rooms, unit.kind.id, groups);
1776
+ if (!room) return err({
1777
+ kind: "not_enough_places",
1778
+ kindId: unit.kind.id,
1779
+ kindName: unit.kind.name
1780
+ });
1781
+ const seat = {
1782
+ roomId: room.id,
1783
+ kindId: unit.kind.id,
1784
+ kindName: unit.kind.name,
1785
+ pricingOptionId: unit.pricingOptionId,
1786
+ bookedAs: "private",
1787
+ place: null
1788
+ };
1789
+ return ok$1({
1790
+ ...working,
1791
+ facts: {
1792
+ ...working.facts,
1793
+ rooms: working.facts.rooms.map((other) => other.id === room.id ? {
1794
+ ...other,
1795
+ occupancy: { bookedAs: "private" },
1796
+ freePlaces: 0
1797
+ } : other)
1798
+ },
1799
+ seats: [...working.seats, ...Array.from({ length: unit.size }, () => seat)]
1800
+ });
1801
+ }
1802
+ /** A room becomes a women's or a men's room with its first guest, and never mixes them. */
1803
+ function roomTakesPlace(room, place) {
1804
+ const { setup, occupancy } = room;
1805
+ if (setup.way === "private" || occupancy.bookedAs === "private" || room.freePlaces < 1) return false;
1806
+ return placesFor(setup.forWho).includes(place) && (occupancy.bookedAs === "empty" || occupancy.place === place);
1807
+ }
1808
+ /** One-way rooms first. Within each, part-full rooms before empty ones, which keeps rooms open for private booking. */
1809
+ function sharingRank(room) {
1810
+ return (room.setup.way === "shared" ? 0 : 2) + (room.occupancy.bookedAs === "shared" ? 0 : 1);
1811
+ }
1812
+ function fill(rooms, people) {
1813
+ return rooms.reduce(({ left, taken }, room) => {
1814
+ const count = Math.min(left, room.freePlaces);
1815
+ return {
1816
+ left: left - count,
1817
+ taken: count > 0 ? [...taken, {
1818
+ room,
1819
+ count
1820
+ }] : taken
1821
+ };
1822
+ }, {
1823
+ left: people,
1824
+ taken: []
1825
+ }).taken;
1826
+ }
1827
+ /** A person in each room while there's another room to use, then the rest wherever there's space. */
1828
+ function spread(rooms, people) {
1829
+ const first = rooms.slice(0, people);
1830
+ const leftOver = fill(first.map((room) => ({
1831
+ ...room,
1832
+ freePlaces: room.freePlaces - 1
1833
+ })).concat(rooms.slice(people)), people - first.length);
1834
+ return rooms.flatMap((room) => {
1835
+ const count = (first.includes(room) ? 1 : 0) + (leftOver.find((taken) => taken.room.id === room.id)?.count ?? 0);
1836
+ return count > 0 ? [{
1837
+ room,
1838
+ count
1839
+ }] : [];
1840
+ });
1841
+ }
1842
+ /** All in one room if there's one with space, or else filling each in turn. */
1843
+ function keepTogether(rooms, people) {
1844
+ const whole = rooms.find((room) => room.freePlaces >= people);
1845
+ return whole ? [{
1846
+ room: whole,
1847
+ count: people
1848
+ }] : fill(rooms, people);
1849
+ }
1850
+ /** Rooms later groups can't use come first, and are all this group gets if they're enough. */
1851
+ function roomsLeavingSpaceFor(open, people, later) {
1852
+ const spare = open.filter((room) => !isWantedBy(room, later));
1853
+ if (spare.reduce((sum, room) => sum + room.freePlaces, 0) >= people) return spare;
1854
+ return [...spare, ...open.filter((room) => isWantedBy(room, later))];
1855
+ }
1856
+ function placeSharing(working, group, later) {
1857
+ const { facts } = working;
1858
+ const { kind, place, people } = group;
1859
+ const open = facts.rooms.filter((room) => room.kindId === kind.id && roomTakesPlace(room, place)).map((room, index) => ({
1860
+ room,
1861
+ index
1862
+ })).sort((left, right) => sharingRank(left.room) - sharingRank(right.room) || left.index - right.index).map(({ room }) => room);
1863
+ if (open.reduce((sum, room) => sum + room.freePlaces, 0) < people) return err({
1864
+ kind: "not_enough_places",
1865
+ kindId: kind.id,
1866
+ kindName: kind.name
1867
+ });
1868
+ const candidates = roomsLeavingSpaceFor(open, people, later);
1869
+ const allocations = facts.arrangement === "separate" ? spread(candidates, people) : keepTogether(candidates, people);
1870
+ const countIn = (roomId) => allocations.find((taken) => taken.room.id === roomId)?.count ?? 0;
1871
+ return ok$1({
1872
+ facts: {
1873
+ ...facts,
1874
+ rooms: facts.rooms.map((room) => countIn(room.id) > 0 ? {
1875
+ ...room,
1876
+ occupancy: {
1877
+ bookedAs: "shared",
1878
+ place
1879
+ },
1880
+ freePlaces: room.freePlaces - countIn(room.id)
1881
+ } : room)
1882
+ },
1883
+ seats: [...working.seats, ...allocations.flatMap(({ room, count }) => Array.from({ length: count }, () => ({
1884
+ roomId: room.id,
1885
+ kindId: kind.id,
1886
+ kindName: kind.name,
1887
+ pricingOptionId: group.pricingOptionId,
1888
+ bookedAs: "shared",
1889
+ place
1890
+ })))],
1891
+ sharing: [...working.sharing, {
1892
+ kindId: kind.id,
1893
+ kindName: kind.name,
1894
+ place,
1895
+ people,
1896
+ together: allocations.length === 1
1897
+ }]
1898
+ });
1899
+ }
1900
+ /** Every room of this kind that can be shared is mixed, so there's no choice of place to mention. */
1901
+ function kindIsAllMixed(facts, kindId) {
1902
+ return facts.rooms.every((room) => room.kindId !== kindId || room.setup.way === "private" || room.setup.forWho === "mixed");
1903
+ }
1904
+ function privateStayLine(unit) {
1905
+ return unit.size === 1 ? {
1906
+ kind: "to_themselves",
1907
+ kindName: unit.kind.name,
1908
+ people: 1
1909
+ } : {
1910
+ kind: "share",
1911
+ kindName: unit.kind.name,
1912
+ people: unit.size
1913
+ };
1914
+ }
1915
+ /** People on their own in one kind of room read as one line. */
1916
+ function mergeToThemselves(lines, line) {
1917
+ const same = (other) => other.kind === "to_themselves" && line.kind === "to_themselves" && other.kindName === line.kindName;
1918
+ return lines.some(same) ? lines.map((other) => same(other) ? {
1919
+ ...other,
1920
+ people: other.people + line.people
1921
+ } : other) : [...lines, line];
1922
+ }
1923
+ function sharingStayLine(facts, outcome) {
1924
+ if (facts.arrangement === "together" && outcome.together && outcome.people > 1) return {
1925
+ kind: "share",
1926
+ kindName: outcome.kindName,
1927
+ people: outcome.people
1928
+ };
1929
+ return {
1930
+ kind: "beds",
1931
+ kindName: outcome.kindName,
1932
+ people: outcome.people,
1933
+ place: kindIsAllMixed(facts, outcome.kindId) ? null : outcome.place
1934
+ };
1935
+ }
1936
+ function chargedLines(seats) {
1937
+ return [...new Set(seats.map((seat) => seat.pricingOptionId))].map((pricingOptionId) => ({
1938
+ pricingOptionId,
1939
+ quantity: seats.filter((seat) => seat.pricingOptionId === pricingOptionId).length
1940
+ }));
1941
+ }
1942
+ function toPlacement(request, working) {
1943
+ const { facts } = working;
1944
+ return {
1945
+ kind: "placed",
1946
+ guests: working.seats.map((seat, guestPosition) => ({
1947
+ ...seat,
1948
+ guestPosition
1949
+ })),
1950
+ ticketLines: chargedLines(working.seats),
1951
+ sharing: working.sharing,
1952
+ stay: [...request.privateUnits.map(privateStayLine).reduce(mergeToThemselves, []), ...working.sharing.map((outcome) => sharingStayLine(facts, outcome))],
1953
+ notes: facts.arrangement === "together" ? working.sharing.flatMap((outcome) => outcome.together ? [] : [{
1954
+ kind: "separate_rooms",
1955
+ kindName: outcome.kindName,
1956
+ people: outcome.people
1957
+ }]) : []
1958
+ };
1959
+ }
1960
+ /**
1961
+ * Places a booking. Private choices go first, because sharing could otherwise
1962
+ * take the only empty room. A preference about sharing never refuses a booking.
1963
+ */
1964
+ function placeBooking(facts, choices) {
1965
+ const request = readChoices(facts, choices);
1966
+ if (!request.ok) return request.error;
1967
+ const { privateUnits: units, sharingGroups: groups } = request.value;
1968
+ const start = ok$1({
1969
+ facts,
1970
+ seats: [],
1971
+ sharing: []
1972
+ });
1973
+ const afterPrivate = units.reduce((working, unit) => working.ok ? placePrivate(working.value, unit, groups) : working, start);
1974
+ const placed = groups.reduce((working, group, index) => working.ok ? placeSharing(working.value, group, groups.slice(index + 1)) : working, afterPrivate);
1975
+ return placed.ok ? toPlacement(request.value, placed.value) : placed.error;
1976
+ }
1977
+ /** Each person's price in a whole room still waiting for more people, the same "each" its row shows. */
1978
+ function waitingRoomLines(kind, people) {
1979
+ return roomSizes(people, kind.sleeps).flatMap((size) => {
1980
+ const pricingOptionId = priceFor(kind, size) ?? priceFor(kind, nextPricedSize(kind, size) ?? size);
1981
+ return pricingOptionId ? [{
1982
+ pricingOptionId,
1983
+ quantity: size
1984
+ }] : [];
1985
+ });
1986
+ }
1987
+ /**
1988
+ * What can be counted while the booking as a whole can't go ahead: every choice
1989
+ * that still fits, and a whole room waiting for its other people if there's still
1990
+ * a room for them. A choice whose place has gone isn't counted, so it can't read
1991
+ * as a place they still hold.
1992
+ */
1993
+ function countSoFar(facts, choices) {
1994
+ const { fitting, waiting } = choices.reduce((sofar, choice) => {
1995
+ const placed = placeBooking(facts, [...sofar.fitting, choice]);
1996
+ if (placed.kind === "placed") return {
1997
+ ...sofar,
1998
+ fitting: [...sofar.fitting, choice]
1999
+ };
2000
+ if (placed.kind !== "whole_room_needs_more_people") return sofar;
2001
+ const withThem = {
2002
+ ...choice,
2003
+ people: choice.people + placed.morePeople
2004
+ };
2005
+ return placeBooking(facts, [...sofar.fitting, withThem]).kind === "placed" ? {
2006
+ ...sofar,
2007
+ waiting: [...sofar.waiting, choice]
2008
+ } : sofar;
2009
+ }, {
2010
+ fitting: [],
2011
+ waiting: []
2012
+ });
2013
+ const placed = placeBooking(facts, fitting);
2014
+ const waitingLines = waiting.flatMap((choice) => {
2015
+ const kind = facts.kinds.find((candidate) => candidate.id === choice.kindId);
2016
+ return kind ? waitingRoomLines(kind, choice.people) : [];
2017
+ });
2018
+ const ticketLines = [...placed.kind === "placed" ? placed.ticketLines : [], ...waitingLines];
2019
+ return {
2020
+ people: ticketLines.reduce((sum, line) => sum + line.quantity, 0),
2021
+ ticketLines
2022
+ };
2023
+ }
2024
+ /** The outcome to send with the booking, so the server can tell if it has changed. */
2025
+ function reviewedStay(placement) {
2026
+ return placement.sharing.map(({ kindId, place, together }) => ({
2027
+ kindId,
2028
+ place,
2029
+ together
2030
+ }));
2031
+ }
2032
+ //#endregion
2033
+ //#region ../commerce/src/purchase/roomOptions.ts
2034
+ function optionKey(choice) {
2035
+ return choice.way === "sharing" ? `${choice.kindId}:sharing:${choice.place}` : `${choice.kindId}:${choice.way}`;
2036
+ }
2037
+ function sameRoomOption(left, right) {
2038
+ return optionKey(left) === optionKey(right);
2039
+ }
2040
+ const withPeople = (choice, people) => ({
2041
+ ...choice,
2042
+ people
2043
+ });
2044
+ /** The choices with this option set to a number of people. Nobody means it's gone. */
2045
+ function setRoomChoicePeople(choices, option, people) {
2046
+ const others = choices.filter((choice) => !sameRoomOption(choice, option));
2047
+ if (people <= 0) return others;
2048
+ return choices.some((choice) => sameRoomOption(choice, option)) ? choices.map((choice) => sameRoomOption(choice, option) ? withPeople(option, people) : choice) : [...choices, withPeople(option, people)];
2049
+ }
2050
+ /** Every place a room of this kind can be shared as, whoever's in it now. */
2051
+ function sharedPlaces(facts, kindId) {
2052
+ const forWho = facts.rooms.flatMap(({ kindId: roomKind, setup }) => roomKind === kindId && setup.way !== "private" ? [setup.forWho] : []);
2053
+ return ROOM_PLACES.filter((place) => forWho.some((who) => placesFor(who).includes(place)));
2054
+ }
2055
+ function sharingTitle(facts, kindId, place) {
2056
+ return kindIsAllMixed(facts, kindId) ? "Sharing" : `A bed in a shared ${PLACE_WORD[place]} room`;
2057
+ }
2058
+ function wholeRoomDetail(kind, audience) {
2059
+ const sizes = kind.prices.map((price) => price.peopleInRoom ?? 2).filter((size) => size > 1);
2060
+ return `For ${Math.min(...sizes, kind.sleeps) < kind.sleeps ? "up to " : ""}${kind.sleeps} of ${audience === "guest" ? "you" : "them"}. Add a place for each.`;
2061
+ }
2062
+ /** The price for the people added so far, or for a full room before there are two of them. */
2063
+ function wholeRoomPrice(kind, people) {
2064
+ return priceFor(kind, people >= 2 ? Math.min(people, kind.sleeps) : kind.sleeps);
2065
+ }
2066
+ /** Sharing first, as most guests want, then the room to yourself. */
2067
+ function optionDrafts(facts, kind, audience) {
2068
+ const rooms = facts.rooms.filter((room) => room.kindId === kind.id);
2069
+ const sharing = kind.sleeps > 1 ? sharedPlaces(facts, kind.id).map((place) => ({
2070
+ choice: {
2071
+ kindId: kind.id,
2072
+ way: "sharing",
2073
+ place
2074
+ },
2075
+ title: sharingTitle(facts, kind.id, place),
2076
+ detail: null,
2077
+ each: false,
2078
+ priceFor: () => priceFor(kind, kind.sleeps)
2079
+ })) : [];
2080
+ const whole = kind.sleeps > 1 && rooms.some((room) => room.setup.way === "private") ? [{
2081
+ choice: {
2082
+ kindId: kind.id,
2083
+ way: "whole_room"
2084
+ },
2085
+ title: "The whole room",
2086
+ detail: wholeRoomDetail(kind, audience),
2087
+ each: true,
2088
+ priceFor: (people) => wholeRoomPrice(kind, people)
2089
+ }] : [];
2090
+ const own = rooms.some((room) => room.setup.way !== "shared") ? [{
2091
+ choice: {
2092
+ kindId: kind.id,
2093
+ way: "own"
2094
+ },
2095
+ title: audience === "guest" ? "On your own" : "On their own",
2096
+ detail: null,
2097
+ each: false,
2098
+ priceFor: () => priceFor(kind, 1)
2099
+ }] : [];
2100
+ return [
2101
+ ...sharing,
2102
+ ...whole,
2103
+ ...own
2104
+ ];
2105
+ }
2106
+ function peopleWithOption(choices, option) {
2107
+ return choices.find((choice) => sameRoomOption(choice, option))?.people ?? 0;
2108
+ }
2109
+ /**
2110
+ * The most people this option could take, asked of placement itself. A choice
2111
+ * that can't stand yet (one person in a room for two) doesn't count against the
2112
+ * others, or adding it would make every other option vanish.
2113
+ */
2114
+ function mostPeopleFor(facts, choices, option) {
2115
+ const others = choices.filter((choice) => !sameRoomOption(choice, option) && placeBooking(facts, [choice]).kind === "placed");
2116
+ const free = facts.rooms.reduce((sum, room) => room.kindId === option.kindId ? sum + room.freePlaces : sum, 0);
2117
+ const fits = (people) => placeBooking(facts, [...others, withPeople(option, people)]).kind === "placed";
2118
+ return Array.from({ length: free }, (_, index) => free - index).find(fits) ?? 0;
2119
+ }
2120
+ function kindOptions(facts, kind, choices, audience) {
2121
+ const options = optionDrafts(facts, kind, audience).flatMap((draft) => {
2122
+ const people = peopleWithOption(choices, draft.choice);
2123
+ const pricingOptionId = draft.priceFor(people);
2124
+ const mostPeople = mostPeopleFor(facts, choices, draft.choice);
2125
+ if (pricingOptionId === null || mostPeople === 0 && people === 0) return [];
2126
+ const { choice, title, detail, each } = draft;
2127
+ return [{
2128
+ key: optionKey(choice),
2129
+ choice,
2130
+ title,
2131
+ detail,
2132
+ each,
2133
+ pricingOptionId,
2134
+ people,
2135
+ mostPeople
2136
+ }];
2137
+ });
2138
+ return {
2139
+ kindId: kind.id,
2140
+ kindName: kind.name,
2141
+ options,
2142
+ fullyBooked: options.length === 0
2143
+ };
2144
+ }
2145
+ /** What to offer for each kind of room. A kind with no price on sale can't be booked, so it isn't listed. */
2146
+ function roomKindOptions(facts, choices, audience) {
2147
+ return facts.kinds.filter((kind) => kind.prices.length > 0).map((kind) => kindOptions(facts, kind, choices, audience));
2148
+ }
2149
+ /** Whether anyone in this kind of room could end up sharing. */
2150
+ function roomsOfferSharing(facts) {
2151
+ return facts.kinds.some((kind) => kind.sleeps > 1 && sharedPlaces(facts, kind.id).length > 0);
2152
+ }
2153
+ function leftText(count, noun) {
2154
+ if (count < 1 || count > 3) return null;
2155
+ return `${count} ${noun}${count === 1 ? "" : "s"} left`;
2156
+ }
2157
+ /**
2158
+ * What's left of this option, only once there are few enough to matter. A bed is
2159
+ * a place. The whole room and "on your own" both use up a room, so they count
2160
+ * rooms, and the same room can't read as different stock from one row to the next.
2161
+ */
2162
+ function placesLeftText(option, sleeps) {
2163
+ switch (option.choice.way) {
2164
+ case "sharing": return leftText(option.mostPeople, "place");
2165
+ case "whole_room": return leftText(Math.ceil(option.mostPeople / sleeps), "room");
2166
+ case "own": return leftText(option.mostPeople, "room");
2167
+ }
2168
+ }
2169
+ //#endregion
1534
2170
  //#region ../site-contracts/src/siteData/eventSelection.ts
1535
2171
  function isHybrid(item) {
1536
2172
  return item.deliveryMode === "hybrid";
@@ -5242,7 +5878,21 @@ function createInteractiveIslandCodec(options) {
5242
5878
  }
5243
5879
  //#endregion
5244
5880
  //#region ../blocks/src/system/runtime/nodes/booking-form.service-pricing.ts
5881
+ /**
5882
+ * The amounts the client can choose for a sliding-scale service. A site that
5883
+ * can't take cards yet (the server says `pending_stripe_setup`) can only take
5884
+ * the free end of the scale online, so a scale that starts at nothing narrows
5885
+ * to nothing; one that starts higher stays as it is and needs a card.
5886
+ */
5245
5887
  function getBookingServiceSlidingScale(service) {
5888
+ const scale = configuredSlidingScale(service);
5889
+ return scale && scale.minAmount === 0 && service?.paymentTermsAvailability?.kind === "pending_stripe_setup" ? {
5890
+ ...scale,
5891
+ maxAmount: 0,
5892
+ suggestedAmount: 0
5893
+ } : scale;
5894
+ }
5895
+ function configuredSlidingScale(service) {
5246
5896
  const pricing = service?.pricing;
5247
5897
  if (!pricing || pricing.pricingStrategy !== "sliding_scale" || pricing.slidingMinAmount === null || pricing.slidingMinAmount === void 0 || pricing.slidingMaxAmount === null || pricing.slidingMaxAmount === void 0) return null;
5248
5898
  return {
@@ -5284,11 +5934,15 @@ function resolveBookingPurchasablePackages(enabled, state) {
5284
5934
  }
5285
5935
  }
5286
5936
  function resolveBookingPaymentAvailability(perSession, held, purchase) {
5287
- if (perSession || held.items.length > 0 || purchase.kind === "ready" && purchase.items.length > 0) return { kind: "available" };
5937
+ if (perSession || heldPackagesOffered(held) || purchase.kind === "ready" && purchase.items.length > 0) return { kind: "available" };
5288
5938
  if (held.kind === "loading" || held.kind === "idle" || purchase.kind === "loading") return { kind: "loading" };
5289
5939
  if (held.kind === "error" || purchase.kind === "error") return { kind: "load_error" };
5290
5940
  return { kind: "no_choices" };
5291
5941
  }
5942
+ /** Packages held with one team member count: the payment step offers to book with them. */
5943
+ function heldPackagesOffered(held) {
5944
+ return held.items.length > 0 || held.kind === "ready" && held.heldWithTeamMembers.length > 0;
5945
+ }
5292
5946
  /** Disclose the package's purchase price; server settlement may require a review for discounts or credit. */
5293
5947
  function bookingPackagePurchaseTerms(product, promisedDiscountId) {
5294
5948
  return {
@@ -5330,10 +5984,20 @@ function resolveBookingPackageSources(service, enabled, bearerAuth) {
5330
5984
  const packageOnly = service?.onlinePaymentChoices?.perSession === false;
5331
5985
  return {
5332
5986
  packageOnly,
5333
- held: resolveHeldPackageSource(service, service?.onlinePaymentChoices?.heldPackage !== false && (enabled || packageOnly), bearerAuth),
5987
+ held: resolveHeldPackageSource(service, serviceOffersHeldPackages(service, enabled || packageOnly, bearerAuth), bearerAuth),
5334
5988
  canBuy: service?.onlinePaymentChoices?.buyPackage === true
5335
5989
  };
5336
5990
  }
5991
+ /**
5992
+ * Whether the client's own packages are offered for this service at all.
5993
+ * Forms turn packages on once the client is signed in, so signed out, a
5994
+ * service that says it takes them still counts: signing in may let them pay
5995
+ * with one.
5996
+ */
5997
+ function serviceOffersHeldPackages(service, enabled, bearerAuth) {
5998
+ const heldPackage = service?.onlinePaymentChoices?.heldPackage;
5999
+ return heldPackage !== false && (enabled || !bearerAuth && heldPackage === true);
6000
+ }
5337
6001
  function resolveHeldPackageSource(service, enabled, bearerAuth) {
5338
6002
  if (!enabled) return "disabled";
5339
6003
  if (!heldPackageServiceEligible(service)) return "missing-priced-service";
@@ -5354,7 +6018,7 @@ function bookingPackageRequestKey(enabled, serviceId, resourceId) {
5354
6018
  function applyBookingPaymentAdmission(services, unrestrictedHeldServiceId) {
5355
6019
  return services.map((service) => {
5356
6020
  const choices = service.onlinePaymentChoices;
5357
- if (service.requiresApproval) return {
6021
+ if (service.requiresApproval || service.onlinePaymentChoices?.perSession !== false && !getBookingServiceSlidingScale(service) && (service.priceAmount ?? 0) === 0) return {
5358
6022
  ...service,
5359
6023
  onlinePaymentChoices: {
5360
6024
  perSession: true,
@@ -5391,6 +6055,37 @@ const BOOKING_FORM_DATA_RESERVED_KEY_VALUES = [
5391
6055
  ];
5392
6056
  const BOOKING_FORM_DATA_RESERVED_KEYS = new Set(BOOKING_FORM_DATA_RESERVED_KEY_VALUES);
5393
6057
  //#endregion
6058
+ //#region ../blocks/src/system/runtime/shared/utils/formatting.ts
6059
+ /**
6060
+ * Shared Formatting Utilities
6061
+ *
6062
+ * Currency and date formatting helpers for registration blocks.
6063
+ */
6064
+ /**
6065
+ * Format a price in cents to a localized currency string.
6066
+ *
6067
+ * @param cents - Price in cents
6068
+ * @param currency - ISO 4217 currency code (e.g., 'USD', 'GBP')
6069
+ * @param locale - Optional locale override (defaults to the currency's locale)
6070
+ * Whole amounts drop the pence ("£245"); fractional ones keep two places ("£8.50").
6071
+ *
6072
+ * @returns Formatted price string (e.g., "£100" or "£8.50")
6073
+ */
6074
+ function formatPrice(cents, currency = "GBP", locale) {
6075
+ return formatCurrencyAmount(cents, currency, {
6076
+ decimals: "auto",
6077
+ locale
6078
+ });
6079
+ }
6080
+ /**
6081
+ * Format minor units as a plain amount for a number input, following the same
6082
+ * rule as `formatPrice`: whole amounts drop the pence ("8"), fractional ones
6083
+ * keep two places ("8.50").
6084
+ */
6085
+ function formatCentsAsCurrencyInput(amount) {
6086
+ return amount % 100 === 0 ? String(amount / 100) : (amount / 100).toFixed(2);
6087
+ }
6088
+ //#endregion
5394
6089
  //#region ../blocks/src/system/runtime/shared/bookingQuestionsAnswers.ts
5395
6090
  const EMPTY_BOOKING_QUESTIONS_ANSWERS = {
5396
6091
  scope: null,
@@ -5578,6 +6273,19 @@ function decideBookingQuestionsRestoration(source) {
5578
6273
  answerMode: draft.answerMode
5579
6274
  });
5580
6275
  }
6276
+ if (source.kind === "tab_draft") {
6277
+ const { draft, identity } = source;
6278
+ const answers = tabDraftAnswersStillAsked(draft, source.current);
6279
+ if (Object.keys(answers).length === 0) return null;
6280
+ return decided({
6281
+ scope: {
6282
+ identity,
6283
+ requirementId: draft.requirementId
6284
+ },
6285
+ edits: answers,
6286
+ answerMode: "answers"
6287
+ });
6288
+ }
5581
6289
  const { snapshot, currentIdentity } = source;
5582
6290
  if (!isBookingQuestionsOwner(snapshot.owner, currentIdentity)) return null;
5583
6291
  const scope = {
@@ -5607,6 +6315,64 @@ function restoreBookingQuestionsAnswers(state, restoration) {
5607
6315
  answerMode: restoration.answerMode
5608
6316
  };
5609
6317
  }
6318
+ const scalarQuestionTypes = [
6319
+ "text",
6320
+ "email",
6321
+ "textarea",
6322
+ "select",
6323
+ "radio",
6324
+ "checkbox",
6325
+ "tel",
6326
+ "url",
6327
+ "number",
6328
+ "date",
6329
+ "time"
6330
+ ];
6331
+ const plainAnswerSchema = z.union([
6332
+ z.string(),
6333
+ z.number(),
6334
+ z.boolean(),
6335
+ z.null(),
6336
+ z.array(z.string())
6337
+ ]);
6338
+ const bookingQuestionsTabDraftSchema = z.object({
6339
+ requirementId: z.string().min(1),
6340
+ answers: z.record(z.string(), z.object({
6341
+ type: z.enum(scalarQuestionTypes),
6342
+ value: plainAnswerSchema
6343
+ }))
6344
+ });
6345
+ function questionSet(presentation) {
6346
+ return presentation.kind === "none" || presentation.kind === "unavailable" ? null : presentation.set;
6347
+ }
6348
+ function scalarQuestions(presentation) {
6349
+ const set = questionSet(presentation);
6350
+ return new Map((set?.sections ?? []).flatMap((section) => section.items).flatMap((item) => item.type === "document_upload" ? [] : [[item.id, item.type]]));
6351
+ }
6352
+ /** The booker's own answers to the set they were shown, to keep in this tab; null when there's nothing to keep. */
6353
+ function toBookingQuestionsTabDraft(state, shown) {
6354
+ const requirementId = bookingQuestionsRequirementId(shown);
6355
+ if (!state.scope || requirementId === null || state.scope.requirementId !== requirementId || state.answerMode === "keep_existing") return null;
6356
+ const types = scalarQuestions(shown);
6357
+ const answers = Object.fromEntries(Object.entries(state.edits).flatMap(([id, value]) => {
6358
+ const type = types.get(id);
6359
+ const plain = plainAnswerSchema.safeParse(value);
6360
+ return type && plain.success ? [[id, {
6361
+ type,
6362
+ value: plain.data
6363
+ }]] : [];
6364
+ }));
6365
+ return Object.keys(answers).length > 0 ? {
6366
+ requirementId,
6367
+ answers
6368
+ } : null;
6369
+ }
6370
+ /** Kept answers whose question is still asked, as the same kind of question, in the same set. */
6371
+ function tabDraftAnswersStillAsked(draft, current) {
6372
+ if (bookingQuestionsRequirementId(current) !== draft.requirementId) return {};
6373
+ const types = scalarQuestions(current);
6374
+ return Object.fromEntries(Object.entries(draft.answers).filter(([id, answer]) => types.get(id) === answer.type).map(([id, answer]) => [id, answer.value]));
6375
+ }
5610
6376
  //#endregion
5611
6377
  //#region ../blocks/src/system/runtime/nodes/booking-form.questions.ts
5612
6378
  const EMPTY_APPOINTMENT_BOOKING_QUESTIONS = EMPTY_BOOKING_QUESTIONS_ANSWERS;
@@ -5655,37 +6421,6 @@ function projectSelectedAppointmentConsentIntoForm(form, selectedConsent) {
5655
6421
  };
5656
6422
  }
5657
6423
  //#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
6424
  //#region ../blocks/src/system/runtime/nodes/booking-form.state.ts
5690
6425
  function toTrimmedString(value) {
5691
6426
  const trimmed = value?.trim();
@@ -5993,7 +6728,8 @@ function resolveBookingPaymentStep(input) {
5993
6728
  kind: "unavailable",
5994
6729
  mode: "unsupported",
5995
6730
  service,
5996
- errorMessage: "Online payments are not set up for this service yet."
6731
+ reason: "cardPaymentsUnavailable",
6732
+ errorMessage: "Card payments aren’t set up for this service yet."
5997
6733
  };
5998
6734
  const [first, ...rest] = resolveAvailableBookingCollectionOptions({
5999
6735
  paymentTerms: service.paymentTerms ?? { allowedOptions: [{ kind: "upfront" }] },
@@ -6007,10 +6743,26 @@ function resolveBookingPaymentStep(input) {
6007
6743
  kind: "unavailable",
6008
6744
  mode: "unsupported",
6009
6745
  service,
6746
+ reason: "paymentOptionsUnavailable",
6010
6747
  errorMessage: "This service has a payment configuration that cannot be booked right now."
6011
6748
  };
6012
6749
  return resolveReadyBookingPayment(service, [first, ...rest], input.data.selectedCollectionOptionKind);
6013
6750
  }
6751
+ /**
6752
+ * The same decision at the least the client can choose to pay, whatever
6753
+ * they've typed so far: whether some per-session choice can go ahead at all.
6754
+ * A sliding scale that starts at nothing is free at its low end.
6755
+ */
6756
+ function resolveLowestBookingPaymentStep(input) {
6757
+ const slidingScale = getBookingServiceSlidingScale(resolveBookingSelectedService(input));
6758
+ return resolveBookingPaymentStep(slidingScale ? {
6759
+ ...input,
6760
+ data: {
6761
+ ...input.data,
6762
+ selectedSlidingAmountInput: formatCentsAsCurrencyInput(slidingScale.minAmount)
6763
+ }
6764
+ } : input);
6765
+ }
6014
6766
  function resolveReadyBookingPayment(service, availableOptions, requestedKind) {
6015
6767
  const [first, ...rest] = availableOptions;
6016
6768
  const current = toSelectedCollectionOptionKind(requestedKind);
@@ -6051,7 +6803,7 @@ function prepareBookingSubmission(input) {
6051
6803
  value: {
6052
6804
  ...common,
6053
6805
  kind: "package_purchase",
6054
- purchasePassId: input.data.packagePurchase.package.id,
6806
+ passProductId: input.data.packagePurchase.package.id,
6055
6807
  discountCode: toTrimmedString(input.data.discountCode),
6056
6808
  shownTerms: input.shownTerms ?? bookingPackagePurchaseTerms(input.data.packagePurchase.package, input.promisedDiscountId)
6057
6809
  }
@@ -6273,6 +7025,7 @@ function resolveMissingBookingPaymentStep(input) {
6273
7025
  kind: "unavailable",
6274
7026
  mode: "unsupported",
6275
7027
  service: null,
7028
+ reason: "paymentOptionsUnavailable",
6276
7029
  errorMessage: "Payment options are unavailable for the selected service right now."
6277
7030
  } : {
6278
7031
  kind: "unselected",
@@ -6398,6 +7151,13 @@ const bookingServiceSchema = z.object({
6398
7151
  buyPackage: z.boolean(),
6399
7152
  anyAvailable: z.boolean()
6400
7153
  }).optional(),
7154
+ onlinePayments: z.discriminatedUnion("kind", [z.object({ kind: z.literal("available") }), z.object({
7155
+ kind: z.literal("unavailable"),
7156
+ organiserContact: z.object({
7157
+ email: z.string().nullable(),
7158
+ phone: z.string().nullable()
7159
+ }).optional()
7160
+ })]).optional(),
6401
7161
  pricing: z.custom().optional(),
6402
7162
  priceAmount: z.number().nullable().optional(),
6403
7163
  priceCurrency: z.string().nullable().optional(),
@@ -7829,15 +8589,6 @@ function getRegistrationOccurrenceId(target) {
7829
8589
  function shouldLoadRegistrationOptions(authState, step) {
7830
8590
  return authState === "authenticated" || step === "select-tickets" || step === "enter-details" || step === "select-payment";
7831
8591
  }
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
8592
  /** Prefer refreshed capacity, including a known zero; fall back while options load. */
7842
8593
  function getTicketSelectionRemainingPlaces(input) {
7843
8594
  const availability = input.eligibility?.availability;
@@ -7870,7 +8621,7 @@ function resolveHeldTicketPlaces(current, invitation, paymentHold) {
7870
8621
  return getHeldPlacesBySelection(current, invitation.kind === "ready" ? {
7871
8622
  selectionId: invitation.restoration.event?.selectionId ?? current.selectionId,
7872
8623
  attendanceMode: invitation.restoration.attendanceMode,
7873
- lines: invitation.restoration.ticketSelections
8624
+ lines: invitation.restoration.claimed.kind === "reservedTickets" ? invitation.restoration.claimed.ticketSelections : []
7874
8625
  } : paymentHold);
7875
8626
  }
7876
8627
  function getCurrentTicketSelection(event, attendanceMode, lines) {
@@ -7881,6 +8632,17 @@ function getCurrentTicketSelection(event, attendanceMode, lines) {
7881
8632
  };
7882
8633
  }
7883
8634
  //#endregion
8635
+ //#region ../blocks/src/system/runtime/shared/utils/email.ts
8636
+ /**
8637
+ * The public booking, checkout and discount endpoints check addresses with
8638
+ * zod's email rule, so the forms use the same one: an address a form accepts
8639
+ * is never refused later, after the visitor has moved on.
8640
+ */
8641
+ const emailAddressSchema = z.string().trim().email().max(320);
8642
+ function isEmailAddress(value) {
8643
+ return emailAddressSchema.safeParse(value).success;
8644
+ }
8645
+ //#endregion
7884
8646
  //#region ../blocks/src/system/runtime/nodes/event-registration/utils.ts
7885
8647
  function getPortalSubjectEmail(profile) {
7886
8648
  return profile?.email ?? null;
@@ -7921,6 +8683,13 @@ const BOOKING_DATE_PRESENTATIONS = {
7921
8683
  year: "omit"
7922
8684
  }
7923
8685
  },
8686
+ dayMonth: {
8687
+ kind: "date",
8688
+ options: {
8689
+ date: "short",
8690
+ year: "omit"
8691
+ }
8692
+ },
7924
8693
  dayLong: {
7925
8694
  kind: "date",
7926
8695
  options: {
@@ -8055,45 +8824,13 @@ function scheduleInput(event, occurrence) {
8055
8824
  deliveryMode: event.deliveryMode
8056
8825
  };
8057
8826
  }
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
8827
  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;
8828
+ const entitlements = registrationEntitlements(response.entitlements);
8093
8829
  const monetaryPaymentAvailable = hasMonetaryPaymentOption(response);
8094
8830
  return {
8095
8831
  discountPreview: response.discountPreview,
8096
8832
  availability: response.availability,
8833
+ ...siteOnlinePayments(response),
8097
8834
  registration: response.registration,
8098
8835
  paymentOptions: response.paymentOptions,
8099
8836
  isFree: response.paymentOptions.some((option) => option.kind === "free"),
@@ -8113,19 +8850,16 @@ function transformRegistrationOptionsResponse(response) {
8113
8850
  currency: response.pricing.currency
8114
8851
  })),
8115
8852
  ticketTypes: response.pricing.options,
8853
+ ...response.rooms ? { rooms: response.rooms } : {},
8116
8854
  price: response.pricing.subtotalCents,
8117
8855
  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]
8856
+ ...entitlements
8127
8857
  };
8128
8858
  }
8859
+ /** Older servers don't say whether the site takes cards; the block then assumes it does. */
8860
+ function siteOnlinePayments(response) {
8861
+ return response.onlinePayments ? { onlinePayments: response.onlinePayments } : {};
8862
+ }
8129
8863
  function customerCredit(credit) {
8130
8864
  if (!credit) return null;
8131
8865
  return {
@@ -8197,6 +8931,32 @@ function findSelectedTicketType(input) {
8197
8931
  selectedAttendanceMode: input.selectedAttendanceMode
8198
8932
  }).find((ticketType) => ticketType.pricingOptionId === input.selectedPricingOptionId) ?? null;
8199
8933
  }
8934
+ /** The server's entitlement decision, adapted once for the payment step. */
8935
+ function registrationEntitlements(entitlements) {
8936
+ const eligiblePasses = entitlements.passes.map((pass) => ({
8937
+ id: pass.customerPassId,
8938
+ passName: pass.passName,
8939
+ creditsRemaining: pass.creditsRemaining
8940
+ }));
8941
+ const eligibleMemberships = entitlements.memberships.map((membership) => ({
8942
+ id: membership.customerMembershipId,
8943
+ membershipName: membership.membershipName
8944
+ }));
8945
+ const eventAcceptsPasses = entitlements.requiresLoginForPasses || eligiblePasses.length > 0 || entitlements.availableForPurchase.passes.length > 0;
8946
+ const eventAcceptsMemberships = entitlements.requiresLoginForMemberships || eligibleMemberships.length > 0 || entitlements.availableForPurchase.memberships.length > 0;
8947
+ return {
8948
+ requiresAuthForCredit: entitlements.requiresLoginForCredit ?? false,
8949
+ requiresAuthForPasses: entitlements.requiresLoginForPasses,
8950
+ requiresAuthForMemberships: entitlements.requiresLoginForMemberships,
8951
+ unavailableEntitlements: entitlements.unavailableEntitlements ?? [],
8952
+ eligiblePasses,
8953
+ eligibleMemberships,
8954
+ eventAcceptsPasses,
8955
+ eventAcceptsMemberships,
8956
+ availablePasses: [...entitlements.availableForPurchase.passes],
8957
+ availableMemberships: [...entitlements.availableForPurchase.memberships]
8958
+ };
8959
+ }
8200
8960
  //#endregion
8201
8961
  //#region ../blocks/src/system/runtime/nodes/event-registration/combinationPrices.state.ts
8202
8962
  /**
@@ -8418,12 +9178,6 @@ function selectionPreviewLines(input) {
8418
9178
  });
8419
9179
  return lines.length > 0 && lines.every((line) => line !== null) ? lines : null;
8420
9180
  }
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
9181
  /**
8428
9182
  * The lines' sum, shown as "Subtotal" only when something comes off it;
8429
9183
  * otherwise the lines lead straight to the total.
@@ -8433,6 +9187,7 @@ function paymentSubtotal(subtotalCents, reductions) {
8433
9187
  }
8434
9188
  /** "4 dates, 1 place on each", above the list. */
8435
9189
  function paymentCaption(several, items, places) {
9190
+ if (items === 1) return plural(places, "place");
8436
9191
  return `${plural(items, several === "runs" ? "run" : "date")}, ${plural(places, "place")} on each`;
8437
9192
  }
8438
9193
  /** The multiplier for a line, when its amount splits evenly into a price per place. */
@@ -8628,6 +9383,7 @@ function sameOffering(events) {
8628
9383
  function registrationSelectionMode(input) {
8629
9384
  const { events } = input;
8630
9385
  if (input.hasPreSelectedContext || events.length < 2) return SINGLE;
9386
+ if (events.some((event) => event.rooms)) return SINGLE;
8631
9387
  if (!events.every((event) => event.allowsMultipleBooking)) return SINGLE;
8632
9388
  const firstSeriesId = events[0]?.seriesId;
8633
9389
  if (events.every((event) => event.registrationSubject.kind === "occurrence" && event.seriesId === firstSeriesId)) return {
@@ -8767,11 +9523,16 @@ function severalConfirmationSentence(kind, email) {
8767
9523
  }
8768
9524
  const SEVERAL_BOOKINGS_ACCOUNT_NOTE = "You can see and manage your bookings in your account.";
8769
9525
  /**
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.
9526
+ * What several items can't use. Runs can't use passes, memberships, or the
9527
+ * first run's deposit or instalments. Dates can use a pass or membership
9528
+ * (issue 1767, set 6), which the payment step's own options explain, so only a
9529
+ * deposit or instalments need saying; otherwise there's no note.
8772
9530
  */
8773
9531
  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.`;
9532
+ switch (kind) {
9533
+ case "dates": return hadDepositOrInstalments ? "Deposits and instalments can be used when you book one date at a time." : null;
9534
+ case "runs": return `${hadDepositOrInstalments ? "Deposits, instalments, class passes and memberships" : "Class passes and memberships"} can be used when you book one run at a time.`;
9535
+ }
8775
9536
  }
8776
9537
  const NO_RUN_PRICING_CHOICES = {};
8777
9538
  /** Runs whose price needs a choice get their own section on the tickets step. */
@@ -8866,7 +9627,7 @@ function severalRunsChoiceMessage(input) {
8866
9627
  }
8867
9628
  function selectionTicketInputs(input) {
8868
9629
  const priced = pricedTicketInputs(input);
8869
- const ticketsCount = input.invitation.kind === "ready" ? input.invitation.restoration.ticketsCount : priced.usesTicketLines ? getTicketSelectionTotal(priced.lines) : input.placeCount;
9630
+ 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
9631
  return {
8871
9632
  ...priced,
8872
9633
  ticketsCount
@@ -9025,6 +9786,19 @@ function selectionCostsNothing(several, input) {
9025
9786
  }
9026
9787
  //#endregion
9027
9788
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationPaymentReturn.ts
9789
+ /** On an event with rooms, what was asked for: the room lines come from placement, not from here. */
9790
+ function roomsRestoration(pending) {
9791
+ const { rooms } = pending;
9792
+ return rooms ? {
9793
+ ticketLines: rooms.dayLines,
9794
+ roomChoices: rooms.choices,
9795
+ reviewedRooms: rooms.reviewed ?? []
9796
+ } : {
9797
+ ticketLines: pending.ticketSelections,
9798
+ roomChoices: [],
9799
+ reviewedRooms: []
9800
+ };
9801
+ }
9028
9802
  /**
9029
9803
  * The server owns submitted answers and consent; payment recovery only restores choices.
9030
9804
  */
@@ -9032,7 +9806,7 @@ function paymentReturnRestoration(pending, events) {
9032
9806
  return {
9033
9807
  selection: findSelection(pending.selectedEventIds, events),
9034
9808
  runChoices: pending.runChoices ?? NO_RUN_PRICING_CHOICES,
9035
- ticketLines: pending.ticketSelections,
9809
+ ...roomsRestoration(pending),
9036
9810
  placeCount: getTicketSelectionTotal(pending.ticketSelections),
9037
9811
  formData: {
9038
9812
  ...pending.formData,
@@ -9335,6 +10109,8 @@ const draftFields = z.object({
9335
10109
  pricingOptionId: z.string().nullable(),
9336
10110
  quantity: z.number().int().positive()
9337
10111
  })),
10112
+ roomChoices: roomChoicesSchema.default([]),
10113
+ reviewedRooms: reviewedRoomsSchema.default([]),
9338
10114
  ticketsCount: z.number().int().positive(),
9339
10115
  selectedSlidingAmountInput: z.string(),
9340
10116
  formData: z.object({
@@ -9372,6 +10148,8 @@ function toEventSignInDraft(source, attempt) {
9372
10148
  runChoices: draft.runChoices,
9373
10149
  selectedAttendanceMode: draft.selectedAttendanceMode,
9374
10150
  ticketSelections: draft.selectedTicketLines,
10151
+ roomChoices: draft.roomChoices,
10152
+ reviewedRooms: draft.reviewedRooms,
9375
10153
  ticketsCount: flow.placeCount,
9376
10154
  selectedSlidingAmountInput: draft.selectedSlidingAmountInput,
9377
10155
  formData,
@@ -9450,6 +10228,8 @@ function restoreEventSignInDraft(state, restoration) {
9450
10228
  runChoices: draft.runChoices,
9451
10229
  selectedAttendanceMode: draft.selectedAttendanceMode,
9452
10230
  selectedTicketLines: draft.ticketSelections.map((line) => ({ ...line })),
10231
+ roomChoices: draft.roomChoices,
10232
+ reviewedRooms: draft.reviewedRooms,
9453
10233
  selectedSlidingAmountInput: draft.selectedSlidingAmountInput
9454
10234
  }
9455
10235
  };
@@ -9772,15 +10552,16 @@ function oneBooking(result, context) {
9772
10552
  ...row("Where", arrival),
9773
10553
  ...facts.rows
9774
10554
  ],
9775
- payment: facts.payment,
10555
+ payment: withSubmissionPayment(facts.payment, result.submissionPayment),
9776
10556
  calendar: bookingCalendar(event, result.outcome),
9777
- several: null
10557
+ several: null,
10558
+ creditsLeftSentence: null
9778
10559
  };
9779
10560
  }
9780
10561
  /**
9781
10562
  * 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.
10563
+ * each one has and what was paid in all. The finished card and bar say how
10564
+ * many were booked, from the first; there's no single calendar entry for them all.
9784
10565
  */
9785
10566
  function severalBookings(result, outcomes, context) {
9786
10567
  const several = outcomes[0]?.identity.scope === "occurrence" ? "dates" : "runs";
@@ -9789,11 +10570,27 @@ function severalBookings(result, outcomes, context) {
9789
10570
  return event ? [bookedItemRow(several, event)] : [];
9790
10571
  });
9791
10572
  return {
9792
- entry: oneBooking(result, context).entry,
9793
- summary: [...items, ...placesOnEachRow(several, outcomes)],
9794
- payment: severalPayment(outcomes),
10573
+ entry: severalEntry(several, outcomes, oneBooking(result, context).entry, context),
10574
+ summary: [
10575
+ ...items,
10576
+ ...placesOnEachRow(several, outcomes),
10577
+ ...severalFundingRow(outcomes)
10578
+ ],
10579
+ payment: withSubmissionPayment({ kind: "none" }, result.submissionPayment),
9795
10580
  calendar: null,
9796
- several
10581
+ several,
10582
+ creditsLeftSentence: creditsLeftSentence(outcomes, result.passCreditsRemaining)
10583
+ };
10584
+ }
10585
+ /** "3 dates from Mon 9 Nov" on the card and bar, with the first booking's places. */
10586
+ function severalEntry(several, outcomes, first, context) {
10587
+ const firstEvent = outcomes[0] ? findBookedEvent(context.events, outcomes[0].identity) : null;
10588
+ const count = `${outcomes.length} ${several === "runs" ? "runs" : "dates"}`;
10589
+ const when = firstEvent ? `${count} from ${formatBookingWhen(firstEvent, "day")}` : count;
10590
+ return {
10591
+ ...first,
10592
+ when,
10593
+ shortWhen: when
9797
10594
  };
9798
10595
  }
9799
10596
  /** Runs by name and dates; dates by day, both with their times. */
@@ -9815,27 +10612,83 @@ function placesOnEachRow(several, outcomes) {
9815
10612
  value: `${places} on each ${several === "runs" ? "run" : "date"}`
9816
10613
  }] : [];
9817
10614
  }
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 {
10615
+ /** A checkout's cash comes from its order; booking funding and debt keep their own rows. */
10616
+ function withSubmissionPayment(payment, submission) {
10617
+ if (submission === void 0) return payment;
10618
+ const rows = submission ? [
10619
+ ...row("Paid", submission.amountPaidCents > 0 ? formatPrice(submission.amountPaidCents, submission.currency) : null),
10620
+ ...row("From account credit", submission.creditCents > 0 ? formatPrice(submission.creditCents, submission.currency) : null),
10621
+ ...submission.purchasedItems.map((item) => ({
10622
+ label: item.name,
10623
+ value: formatPrice(item.priceCents, submission.currency)
10624
+ }))
10625
+ ] : [];
10626
+ const retained = confirmationPaymentRows(payment).filter((item) => item.label !== "Paid" && item.label !== "Still to pay");
10627
+ return payment.kind === "due" ? {
10628
+ ...payment,
10629
+ paidRows: [...retained, ...rows]
10630
+ } : {
9832
10631
  kind: "settled",
9833
- rows: currency && total > 0 ? [{
9834
- label: "Paid",
9835
- value: formatPrice(total, currency)
9836
- }] : []
10632
+ rows: [...retained, ...rows]
9837
10633
  };
9838
10634
  }
10635
+ /** How one date was paid, as the finished screen groups them. */
10636
+ function fundingGroup(payment) {
10637
+ switch (payment.kind) {
10638
+ case "pass": return `with your ${payment.passName?.trim() || "class pass"}`;
10639
+ case "membership": return `with your ${payment.membershipName?.trim() || "membership"}`;
10640
+ case "monetary": switch (payment.paymentMethod) {
10641
+ case "stripe": return "paid by card";
10642
+ case "store_credit": return "paid with account credit";
10643
+ case "mixed": return "paid by card and account credit";
10644
+ case "manual": return null;
10645
+ default: return assertNever$2(payment.paymentMethod);
10646
+ }
10647
+ case "free":
10648
+ case "waived": return "free of charge";
10649
+ case "manual_due":
10650
+ case "managed_balance_due": return null;
10651
+ default: return assertNever$2(payment);
10652
+ }
10653
+ }
10654
+ function detailedPayments(outcomes) {
10655
+ const payments = outcomes.flatMap((outcome) => outcome.kind === "detailsAvailable" ? [outcome.payment] : []);
10656
+ return payments.length === outcomes.length ? payments : null;
10657
+ }
10658
+ /**
10659
+ * Several dates where a pass or membership covered some: a Payment row with
10660
+ * each way they were paid and how many dates it paid for, as one date's
10661
+ * Payment row says how it was paid. Dates paid only with money keep the total alone.
10662
+ */
10663
+ function severalFundingRow(outcomes) {
10664
+ const payments = detailedPayments(outcomes);
10665
+ return row("Payment", payments ? fundingGroupLines(payments).join(", ") : null);
10666
+ }
10667
+ /**
10668
+ * The pass's balance once several dates are booked. A covered booking's
10669
+ * receipt says it once every date had settled, so it's shown even when a
10670
+ * date's details didn't load; a booking finished through checkout has it on
10671
+ * each date's payment instead.
10672
+ */
10673
+ function creditsLeftSentence(outcomes, receiptBalance) {
10674
+ const payments = detailedPayments(outcomes);
10675
+ const left = receiptBalance ?? (payments ? passBalanceOnDates(payments) : null);
10676
+ return left === null ? null : `You have ${left} ${left === 1 ? "credit" : "credits"} left on your pass.`;
10677
+ }
10678
+ /** How many dates each way paid for, when a pass or membership paid for any. */
10679
+ function fundingGroupLines(payments) {
10680
+ if (!payments.some((payment) => payment.kind === "pass" || payment.kind === "membership")) return [];
10681
+ const groups = payments.flatMap((payment) => {
10682
+ const group = fundingGroup(payment);
10683
+ return group === null ? [] : [group];
10684
+ });
10685
+ if (groups.length !== payments.length) return [];
10686
+ 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}`);
10687
+ }
10688
+ function passBalanceOnDates(payments) {
10689
+ const balances = payments.flatMap((payment) => payment.kind === "pass" && payment.passCreditsRemaining !== void 0 ? [payment.passCreditsRemaining] : []);
10690
+ return balances.length > 0 ? Math.min(...balances) : null;
10691
+ }
9839
10692
  function waitlistedBooking(context) {
9840
10693
  const event = context.draftEvent;
9841
10694
  const dates = entryFacts(withOccurrenceTitle(event, context.occurrenceContext), context.occurrenceContext);
@@ -9847,7 +10700,8 @@ function waitlistedBooking(context) {
9847
10700
  summary: scheduleRows(event, dates.shortWhen, "venue", context.display),
9848
10701
  payment: { kind: "none" },
9849
10702
  calendar: null,
9850
- several: null
10703
+ several: null,
10704
+ creditsLeftSentence: null
9851
10705
  };
9852
10706
  }
9853
10707
  /**
@@ -9911,6 +10765,254 @@ function hasStatus(value) {
9911
10765
  return typeof value === "object" && value !== null && "status" in value;
9912
10766
  }
9913
10767
  //#endregion
10768
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationRooms.state.ts
10769
+ /**
10770
+ * The room offer for what's selected: the freshest facts we have, or the page's
10771
+ * own. The last booking options that had rooms in them are kept while no options
10772
+ * are being asked for, because a choice that no longer fits has no lines to ask
10773
+ * with, and falling back to the page's older facts would make it fit again. Facts
10774
+ * about another event are ignored.
10775
+ */
10776
+ function selectRoomOffer(selection, roomFacts) {
10777
+ const page = selection[0]?.rooms ?? null;
10778
+ return page && roomFacts?.seriesId === page.seriesId ? roomFacts : page;
10779
+ }
10780
+ function decideRoomStay(offer, choices) {
10781
+ if (offer === null) return { kind: "none" };
10782
+ return choices.length === 0 ? { kind: "empty" } : placeBooking(offer, choices);
10783
+ }
10784
+ function stayIsPlaced(stay) {
10785
+ return stay.kind === "placed";
10786
+ }
10787
+ function stayFailure(stay) {
10788
+ return stay.kind === "none" || stay.kind === "empty" || stayIsPlaced(stay) ? null : stay;
10789
+ }
10790
+ /** What the booking charges for: the places without a room, then what placement decided. */
10791
+ function bookingLines(dayLines, stay) {
10792
+ return stayIsPlaced(stay) ? [...dayLines, ...stay.ticketLines] : dayLines;
10793
+ }
10794
+ const draftRoomStay = (draft, roomFacts) => decideRoomStay(selectRoomOffer(draft.selection, roomFacts), draft.roomChoices);
10795
+ /** Whether the rooms the guest chose still fit the latest facts. Nothing chosen, or no rooms, always does. */
10796
+ function draftRoomsStillPlace(draft, roomFacts) {
10797
+ return stayFailure(draftRoomStay(draft, roomFacts)) === null;
10798
+ }
10799
+ /** The same derivation, from the draft and the options it was last checked against. */
10800
+ function draftBookingLines(draft, roomFacts) {
10801
+ return bookingLines(draft.selectedTicketLines, draftRoomStay(draft, roomFacts));
10802
+ }
10803
+ /**
10804
+ * The stay the guest is agreeing to by carrying on. The server compares the booking
10805
+ * with this, so it must be what they saw here, not what placement says by the time
10806
+ * they've signed in or paid.
10807
+ */
10808
+ function withReviewedRooms(draft, roomFacts) {
10809
+ const stay = draftRoomStay(draft, roomFacts);
10810
+ return stayIsPlaced(stay) ? {
10811
+ ...draft,
10812
+ reviewedRooms: reviewedStay(stay)
10813
+ } : draft;
10814
+ }
10815
+ /** Room prices are chosen through rooms, so they're never listed as flat tickets. */
10816
+ function dayOptionsOf(options, offer) {
10817
+ if (offer === null) return options;
10818
+ return options.filter((option) => !offer.linkedOptionIds.includes(option.pricingOptionId));
10819
+ }
10820
+ /**
10821
+ * What goes with the booking on an event with rooms: always the rooms the guest asked
10822
+ * for, whatever placement here last said. Placement on this page is only a preview;
10823
+ * the server places for real, and when the rooms have gone it refuses with a room
10824
+ * reason that takes the guest back to choose again. Someone staying only for the day
10825
+ * sends the rooms part empty. A line for a room's price outside the rooms (a custom
10826
+ * renderer listing the ticket types) sends nothing, so the server's clear refusal
10827
+ * explains it.
10828
+ */
10829
+ function roomSubmission(offer, choices, dayLines, reviewed) {
10830
+ if (offer === null) return void 0;
10831
+ if (dayLines.some((line) => line.pricingOptionId !== null && offer.linkedOptionIds.includes(line.pricingOptionId))) return void 0;
10832
+ return {
10833
+ request: choices.length === 0 ? {
10834
+ choices: [],
10835
+ reviewed: []
10836
+ } : {
10837
+ choices,
10838
+ reviewed
10839
+ },
10840
+ dayLines
10841
+ };
10842
+ }
10843
+ const NO_DEFAULT_TICKETS = [];
10844
+ /** What a sole ticket type can be picked from by default. An event with rooms has no default: its guests choose. */
10845
+ function defaultTicketOptions(offer, options) {
10846
+ return offer ? NO_DEFAULT_TICKETS : options;
10847
+ }
10848
+ /** What's still needed before the guest can carry on, or null. */
10849
+ function roomChoiceMessage(stay, dayLines) {
10850
+ if (stay.kind === "empty") return dayLines.length > 0 ? null : ADD_A_PLACE;
10851
+ const failure = stayFailure(stay);
10852
+ return failure ? placementProblemText(failure, "guest") : null;
10853
+ }
10854
+ /** The refusals the guest can put right from the rooms step, with fresh facts. */
10855
+ function isRoomChoiceRefusal(reason) {
10856
+ return reason === "roomNotEnoughPlaces" || reason === "roomNeedsMorePeople" || reason === "roomStayChanged" || reason === "roomOptionsChanged";
10857
+ }
10858
+ const ADD_A_PLACE = "Add a place to see your total.";
10859
+ /** The sticky bar's short form of the split-rooms note, for a guest who can't see the note yet. */
10860
+ const SPLIT_ROOMS_SHORT = "You'd be in separate rooms";
10861
+ const NO_TOTAL_YET = "We can't work out your total yet.";
10862
+ const TOTAL_SO_FAR = "Your total so far.";
10863
+ const TAKE_IT_OFF = "Take it off, then choose another room.";
10864
+ const PRICES_ARE = "Prices are per person, for the whole retreat.";
10865
+ const SHARING_INTRO = {
10866
+ 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}`,
10867
+ separate: `Add a place for each person. People booking together are usually given separate rooms on this retreat. ${PRICES_ARE}`,
10868
+ organiser: `Add a place for each person. The organiser decides who shares with whom. ${PRICES_ARE}`
10869
+ };
10870
+ function roomChooserIntro(offer) {
10871
+ return roomsOfferSharing(offer) ? SHARING_INTRO[offer.arrangement] : `Add a place for each person. ${PRICES_ARE}`;
10872
+ }
10873
+ const peopleIn = (lines) => lines.reduce((sum, line) => sum + line.quantity, 0);
10874
+ const peopleChoosing = (choices) => choices.reduce((sum, choice) => sum + choice.people, 0);
10875
+ function kindViews(input) {
10876
+ const details = new Map(input.offer.kinds.map((kind) => [kind.id, kind]));
10877
+ const amountOf = (id) => input.options.find((option) => option.pricingOptionId === id)?.priceAmount;
10878
+ return roomKindOptions(input.offer, input.choices, "guest").flatMap((kind) => {
10879
+ const detail = details.get(kind.kindId);
10880
+ if (!detail) return [];
10881
+ const options = kind.options.flatMap((option) => {
10882
+ const priceCents = amountOf(option.pricingOptionId);
10883
+ if (priceCents === void 0) return [];
10884
+ return [{
10885
+ key: option.key,
10886
+ choice: option.choice,
10887
+ title: option.title,
10888
+ detail: option.detail,
10889
+ priceCents,
10890
+ each: option.each,
10891
+ people: option.people,
10892
+ maxPeople: Math.min(option.mostPeople, input.maxTickets - (input.everyone - option.people)),
10893
+ placesLeft: placesLeftText(option, detail.sleeps),
10894
+ gone: option.people > 0 && option.mostPeople === 0
10895
+ }];
10896
+ });
10897
+ return [{
10898
+ kindId: kind.kindId,
10899
+ name: kind.kindName,
10900
+ description: detail.description,
10901
+ photos: detail.photos,
10902
+ options,
10903
+ fullyBooked: options.every((option) => option.gone)
10904
+ }];
10905
+ });
10906
+ }
10907
+ function totalOf(lines, options) {
10908
+ if (lines.length === 0) return null;
10909
+ return lines.reduce((total, line) => {
10910
+ const amount = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.priceAmount;
10911
+ return total === null || amount === void 0 ? null : total + amount * line.quantity;
10912
+ }, 0);
10913
+ }
10914
+ function lastDayText(saleEndsAt, timeZone) {
10915
+ const instant = Date.parse(saleEndsAt);
10916
+ if (Number.isNaN(instant)) return null;
10917
+ return new Intl.DateTimeFormat(inferSiteDateLocale(timeZone), {
10918
+ day: "numeric",
10919
+ month: "long",
10920
+ year: "numeric",
10921
+ timeZone
10922
+ }).format(/* @__PURE__ */ new Date(instant - 1));
10923
+ }
10924
+ /** The soonest a chosen room's named price ends. A room with only one price has nothing to say. */
10925
+ function priceNoteOf(stay, offer, options, timeZone) {
10926
+ if (!stayIsPlaced(stay)) return null;
10927
+ const prices = offer.kinds.flatMap((kind) => kind.prices);
10928
+ const ending = stay.ticketLines.flatMap((line) => {
10929
+ const priceName = prices.find((price) => price.pricingOptionId === line.pricingOptionId)?.priceName;
10930
+ const saleEndsAt = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.saleEndsAt;
10931
+ return priceName && saleEndsAt ? [{
10932
+ priceName,
10933
+ saleEndsAt
10934
+ }] : [];
10935
+ }).sort((left, right) => Date.parse(left.saleEndsAt) - Date.parse(right.saleEndsAt))[0];
10936
+ const lastDay = ending ? lastDayText(ending.saleEndsAt, timeZone) : null;
10937
+ return ending && lastDay ? `${ending.priceName} price until ${lastDay}` : null;
10938
+ }
10939
+ function stayLinesOf(stay, dayLines, options) {
10940
+ const rooms = stayIsPlaced(stay) ? stay.stay.map((line) => stayLineText(line, "guest")) : [];
10941
+ const day = dayLines.flatMap((line) => {
10942
+ const name = options.find((option) => option.pricingOptionId === line.pricingOptionId)?.name;
10943
+ return name ? [`${line.quantity} × ${name}`] : [];
10944
+ });
10945
+ return [...rooms, ...day];
10946
+ }
10947
+ /** What's stopping the booking, with the next step when a chosen place has gone. */
10948
+ function failureNotice(failure) {
10949
+ switch (failure.kind) {
10950
+ case "not_enough_places": return `${placementProblemText(failure, "guest")} ${TAKE_IT_OFF}`;
10951
+ case "option_unavailable": return `That room option isn't available any more. ${TAKE_IT_OFF}`;
10952
+ case "whole_room_needs_more_people": return placementProblemText(failure, "guest");
10953
+ }
10954
+ }
10955
+ function takeOffFor(failure, offer, choices) {
10956
+ if (!failure || failure.kind === "whole_room_needs_more_people") return null;
10957
+ const name = offer.kinds.find((kind) => kind.id === failure.kindId)?.name;
10958
+ return {
10959
+ label: name ? `Take off the ${name}` : "Take off that room",
10960
+ choices: choicesLeftAfterTakingOff(failure.kindId, offer, choices)
10961
+ };
10962
+ }
10963
+ /** 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. */
10964
+ function choicesLeftAfterTakingOff(kindId, offer, choices) {
10965
+ const options = roomKindOptions(offer, choices, "guest").find((kind) => kind.kindId === kindId)?.options ?? [];
10966
+ const stillFits = (choice) => options.some((option) => sameRoomOption(option.choice, choice) && option.people <= option.mostPeople);
10967
+ const left = choices.filter((choice) => choice.kindId !== kindId || stillFits(choice));
10968
+ return left.length < choices.length ? left : choices.filter((choice) => choice.kindId !== kindId);
10969
+ }
10970
+ /** The people and money the summary can stand behind, however far the booking has got. */
10971
+ function bookingSoFar(offer, choices, stay, dayLines, options) {
10972
+ const counted = stayFailure(stay) ? countSoFar(offer, choices) : null;
10973
+ const people = peopleIn(dayLines) + (counted ? counted.people : peopleChoosing(choices));
10974
+ const totalCents = totalOf(counted ? [...dayLines, ...counted.ticketLines] : bookingLines(dayLines, stay), options);
10975
+ const stillAdding = stayFailure(stay)?.kind === "whole_room_needs_more_people";
10976
+ return {
10977
+ people,
10978
+ totalCents,
10979
+ totalNote: people === 0 ? null : totalCents === null ? NO_TOTAL_YET : stillAdding ? TOTAL_SO_FAR : null
10980
+ };
10981
+ }
10982
+ /** Why it can't go ahead, the note when nothing's stopping it, and the stay a refusal asks them to agree to. */
10983
+ function stayMessages(stay, refusal, stayLines) {
10984
+ const failure = stayFailure(stay);
10985
+ const notice = failure ? failureNotice(failure) : refusal || null;
10986
+ const notes = stayIsPlaced(stay) ? stay.notes : [];
10987
+ const note = notice === null ? notes[0] : void 0;
10988
+ return {
10989
+ notice,
10990
+ noticeStay: notice !== null && notes.length > 0 ? stayLines : [],
10991
+ note: note ? stayNoteText(note, "guest") : null,
10992
+ splitWarning: note ? SPLIT_ROOMS_SHORT : null
10993
+ };
10994
+ }
10995
+ /** The chooser, as a pure reading of the draft and the freshest room facts. */
10996
+ function presentRoomChooser(input) {
10997
+ const { offer, choices, stay, dayLines, options } = input;
10998
+ const stayLines = stayLinesOf(stay, dayLines, options);
10999
+ return {
11000
+ intro: roomChooserIntro(offer),
11001
+ kinds: kindViews({
11002
+ offer,
11003
+ choices,
11004
+ options,
11005
+ maxTickets: input.maxTickets,
11006
+ everyone: peopleChoosing(choices) + peopleIn(dayLines)
11007
+ }),
11008
+ stayLines,
11009
+ ...stayMessages(stay, input.refusal, stayLines),
11010
+ takeOff: takeOffFor(stayFailure(stay), offer, choices),
11011
+ ...bookingSoFar(offer, choices, stay, dayLines, options),
11012
+ priceNote: priceNoteOf(stay, offer, options, input.timeZone)
11013
+ };
11014
+ }
11015
+ //#endregion
9914
11016
  //#region ../blocks/src/system/runtime/nodes/event-registration/validation.ts
9915
11017
  function createInitialRegistrationFormData() {
9916
11018
  return {
@@ -9925,7 +11027,7 @@ function createInitialRegistrationFormData() {
9925
11027
  function validateFormData(formData, requiresConsent = false) {
9926
11028
  return {
9927
11029
  ...!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" } : {},
11030
+ ...!formData.email.trim() ? { email: "Email is required" } : !isEmailAddress(formData.email) ? { email: "Invalid email address" } : {},
9929
11031
  ...requiresConsent && formData.consentAccepted !== true ? { consentAccepted: "Please read and accept the agreement before continuing." } : {}
9930
11032
  };
9931
11033
  }
@@ -9934,121 +11036,6 @@ function registrationQuestionsMessage(questionFieldErrors, errorMessage) {
9934
11036
  return Object.keys(questionFieldErrors).length > 0 ? errorMessage : "";
9935
11037
  }
9936
11038
  //#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
9950
- };
9951
- }
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
11039
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDerivations.ts
10053
11040
  /** Public requests share subject identity without copying the run's display sessions. */
10054
11041
  function toRegistrationRequestSubject(subject, attendanceMode) {
@@ -10116,14 +11103,6 @@ function resolveRouteRequiresPayment(input) {
10116
11103
  function resolveDiscountContext(input) {
10117
11104
  const selection = input.paymentSelection.method ? input.paymentSelection : null;
10118
11105
  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
11106
  if (!input.eventRequiresPayment) return null;
10128
11107
  if (input.ticketsCount <= 0) return null;
10129
11108
  if (selection?.method && selection.method !== "stripe") return null;
@@ -10158,6 +11137,8 @@ function buildRegistrationSelectionRequest(input) {
10158
11137
  }
10159
11138
  //#endregion
10160
11139
  //#region ../blocks/src/system/runtime/nodes/event-registration/waitlistClaimRestoration.ts
11140
+ /** A date's waiting list is joined one place at a time, and its offer holds that one place. */
11141
+ const DATE_OFFER_PLACES = 1;
10161
11142
  function findClaimEvent(subject, events) {
10162
11143
  switch (subject.kind) {
10163
11144
  case "event_occurrence": return findEventByOccurrenceId(events, subject.occurrenceId);
@@ -10166,24 +11147,37 @@ function findClaimEvent(subject, events) {
10166
11147
  }
10167
11148
  }
10168
11149
  /** Reserved quantities and amounts have one interpretation across restoration and submission. */
10169
- function claimedSelection(subject) {
11150
+ function claimedPlaces(subject) {
10170
11151
  switch (subject.kind) {
10171
11152
  case "event_occurrence": return {
10172
- ticketSelections: [{
10173
- pricingOptionId: null,
10174
- quantity: 1
10175
- }],
10176
- ticketsCount: 1,
10177
- slidingAmountInput: null
11153
+ kind: "anyTicket",
11154
+ places: DATE_OFFER_PLACES
10178
11155
  };
10179
11156
  case "whole_series": return {
11157
+ kind: "reservedTickets",
11158
+ places: subject.seatCount,
10180
11159
  ticketSelections: subject.ticketSelections,
10181
- ticketsCount: subject.seatCount,
10182
11160
  slidingAmountInput: subject.selectedSlidingAmount === null ? null : formatCentsAsCurrencyInput(subject.selectedSlidingAmount)
10183
11161
  };
10184
11162
  default: return assertNever$1(subject);
10185
11163
  }
10186
11164
  }
11165
+ /** The tickets they're booking: the reserved ones, or what they've chosen for the places held. */
11166
+ function claimTicketSelections(claimed, chosen) {
11167
+ return claimed.kind === "reservedTickets" ? claimed.ticketSelections : chosen;
11168
+ }
11169
+ /**
11170
+ * What to quote while they haven't chosen a ticket yet: the places held, with no ticket. The
11171
+ * answer says which tickets have room for them, which the page's own figures can't, since
11172
+ * they count the held place as taken.
11173
+ */
11174
+ function claimQuoteSelections(claimed, chosen) {
11175
+ const lines = claimTicketSelections(claimed, chosen);
11176
+ return lines.length > 0 ? lines : [{
11177
+ pricingOptionId: null,
11178
+ quantity: claimed.places
11179
+ }];
11180
+ }
10187
11181
  function resolveWaitlistClaimRestoration(input) {
10188
11182
  if (input.events.kind !== "ready") return { kind: "awaitingEvents" };
10189
11183
  const { subject } = input.claim;
@@ -10193,18 +11187,160 @@ function resolveWaitlistClaimRestoration(input) {
10193
11187
  kind: "ready",
10194
11188
  event,
10195
11189
  attendanceMode: subject.attendanceMode,
10196
- ...claimedSelection(subject)
11190
+ claimed: claimedPlaces(subject)
10197
11191
  } : {
10198
11192
  kind: "different-event",
10199
11193
  message: "This waiting list invitation is for a different event. Please open the link in your invitation email."
10200
11194
  };
10201
11195
  }
11196
+ /**
11197
+ * What this visitor books and quotes, and how many places they can ask for. An invitation books
11198
+ * only the places it holds; anyone else chooses freely, up to the block's own limit.
11199
+ */
11200
+ function invitationBooking(invitation, chosen, blockLimit) {
11201
+ if (invitation.kind !== "ready") return {
11202
+ ticketSelections: [...chosen],
11203
+ quoteSelections: chosen,
11204
+ maxTicketsNum: blockLimit
11205
+ };
11206
+ const { claimed } = invitation.restoration;
11207
+ return {
11208
+ ticketSelections: [...claimTicketSelections(claimed, chosen)],
11209
+ quoteSelections: claimQuoteSelections(claimed, chosen),
11210
+ maxTicketsNum: claimed.places
11211
+ };
11212
+ }
10202
11213
  /** A place held on a run or date that's closed is still theirs, so it stays on the list they see. */
10203
11214
  function withOfferedEvent(choices, invitation) {
10204
11215
  const offered = invitation.kind === "ready" ? invitation.restoration.event : null;
10205
11216
  return offered && !choices.some((event) => event.selectionId === offered.selectionId) ? [offered, ...choices] : choices;
10206
11217
  }
10207
11218
  //#endregion
11219
+ //#region ../blocks/src/system/runtime/nodes/event-registration/registrationDraft.state.ts
11220
+ function createRegistrationDraftData(event) {
11221
+ const defaults = event ? getEventSelectionDefaults(event) : null;
11222
+ return {
11223
+ selection: event ? [event] : [],
11224
+ runChoices: NO_RUN_PRICING_CHOICES,
11225
+ formData: createInitialRegistrationFormData(),
11226
+ guests: [],
11227
+ selectedAttendanceMode: defaults?.attendanceMode ?? null,
11228
+ selectedTicketLines: [],
11229
+ roomChoices: [],
11230
+ reviewedRooms: [],
11231
+ selectedSlidingAmountInput: defaults?.slidingAmountInput ?? "",
11232
+ bookingQuestions: EMPTY_BOOKING_QUESTIONS_ANSWERS,
11233
+ runRequirements: NO_RUN_REQUIREMENTS
11234
+ };
11235
+ }
11236
+ function updated(current, value) {
11237
+ return typeof value === "function" ? value(current) : value;
11238
+ }
11239
+ function editRegistrationDraft(draft, edit) {
11240
+ switch (edit.field) {
11241
+ case "selection": {
11242
+ const selection = updated(draft.selection, edit.value);
11243
+ return {
11244
+ ...draft,
11245
+ selection,
11246
+ selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(selection), draft.selectedAttendanceMode)
11247
+ };
11248
+ }
11249
+ case "runChoices": return {
11250
+ ...draft,
11251
+ runChoices: updated(draft.runChoices, edit.value)
11252
+ };
11253
+ case "formData": return {
11254
+ ...draft,
11255
+ formData: updated(draft.formData, edit.value)
11256
+ };
11257
+ case "guests": return {
11258
+ ...draft,
11259
+ guests: updated(draft.guests, edit.value)
11260
+ };
11261
+ case "selectedAttendanceMode": return {
11262
+ ...draft,
11263
+ selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(draft.selection), updated(draft.selectedAttendanceMode, edit.value))
11264
+ };
11265
+ case "selectedTicketLines": return {
11266
+ ...draft,
11267
+ selectedTicketLines: updated(draft.selectedTicketLines, edit.value)
11268
+ };
11269
+ case "roomChoices": return {
11270
+ ...draft,
11271
+ roomChoices: updated(draft.roomChoices, edit.value),
11272
+ reviewedRooms: []
11273
+ };
11274
+ case "selectedSlidingAmountInput": return {
11275
+ ...draft,
11276
+ selectedSlidingAmountInput: updated(draft.selectedSlidingAmountInput, edit.value)
11277
+ };
11278
+ default: return assertNever$1(edit);
11279
+ }
11280
+ }
11281
+ /** Ready invitations own their reserved selection; identity fields remain editable. */
11282
+ function canEditInvitedDraft(invitation, edit) {
11283
+ if (invitation.kind !== "ready" || edit.field === "formData" || edit.field === "guests") return true;
11284
+ return invitation.restoration.claimed.kind === "anyTicket" && (edit.field === "selectedTicketLines" || edit.field === "selectedSlidingAmountInput");
11285
+ }
11286
+ function beginWaitlistInvitation(credential) {
11287
+ return credential ? {
11288
+ kind: "resolving",
11289
+ request: { credential }
11290
+ } : { kind: "none" };
11291
+ }
11292
+ /** A source notification is not a new attempt when its credential is unchanged. */
11293
+ function receiveWaitlistInvitation(invitation, credential) {
11294
+ return (invitation.kind === "none" ? null : invitation.request.credential) === credential ? invitation : beginWaitlistInvitation(credential);
11295
+ }
11296
+ function restoreRegistrationDraft(draft, claim, restoration) {
11297
+ return {
11298
+ bookingQuestions: draft.bookingQuestions,
11299
+ runRequirements: NO_RUN_REQUIREMENTS,
11300
+ selection: restoration.event ? [restoration.event] : draft.selection,
11301
+ runChoices: NO_RUN_PRICING_CHOICES,
11302
+ selectedAttendanceMode: restoration.attendanceMode,
11303
+ selectedTicketLines: [...claimTicketSelections(restoration.claimed, [])],
11304
+ roomChoices: [],
11305
+ reviewedRooms: [],
11306
+ selectedSlidingAmountInput: (restoration.claimed.kind === "reservedTickets" ? restoration.claimed.slidingAmountInput : null) ?? draft.selectedSlidingAmountInput,
11307
+ formData: {
11308
+ ...draft.formData,
11309
+ email: claim.prefill.email,
11310
+ name: claim.prefill.name,
11311
+ phone: claim.prefill.phone ?? "",
11312
+ notes: claim.prefill.notes ?? ""
11313
+ },
11314
+ guests: claim.prefill.guests.map((guest) => ({
11315
+ name: guest.name,
11316
+ email: guest.email ?? "",
11317
+ phone: guest.phone ?? ""
11318
+ }))
11319
+ };
11320
+ }
11321
+ function invitationSubmission(invitation) {
11322
+ switch (invitation.kind) {
11323
+ case "none": return {
11324
+ kind: "available",
11325
+ credential: null
11326
+ };
11327
+ case "ready": return {
11328
+ kind: "available",
11329
+ credential: invitation.request.credential
11330
+ };
11331
+ case "resolving": return {
11332
+ kind: "blocked",
11333
+ message: "Please wait while we check your waiting list invitation."
11334
+ };
11335
+ case "portal-login-required":
11336
+ case "error": return {
11337
+ kind: "blocked",
11338
+ message: invitation.message
11339
+ };
11340
+ default: return assertNever$1(invitation);
11341
+ }
11342
+ }
11343
+ //#endregion
10208
11344
  //#region ../blocks/src/system/runtime/nodes/event-registration/registrationBrowserDraft.ts
10209
11345
  const browserDraftSteps = [
10210
11346
  "select-event",
@@ -10212,11 +11348,22 @@ const browserDraftSteps = [
10212
11348
  "enter-details",
10213
11349
  "select-payment"
10214
11350
  ];
11351
+ /** How long this tab's draft is kept after it was last saved; older drafts are ignored and cleared. */
11352
+ const BROWSER_DRAFT_LIFETIME_MS = 10800 * 1e3;
10215
11353
  /**
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.
11354
+ * An allowlist of what the booker typed or chose, kept in this tab only, for
11355
+ * `BROWSER_DRAFT_LIFETIME_MS`: the selection and tickets, their contact
11356
+ * details, the guests' names and contact details, and their answers to the
11357
+ * questions, by question ID (`BookingQuestionsTabDraft`: plain answers only,
11358
+ * never file uploads, and dropped on restore if the question has gone or
11359
+ * changed kind), once for the selection or per run when runs ask their own.
11360
+ * `owner` is whoever was signed in (or nobody) when it was saved: contact,
11361
+ * guests and answers come back only to that same visitor. Notes, the terms agreement, payment choices and anything
11362
+ * else payment-related never go to storage. The discount code is its text
11363
+ * only, never a price or amount, and the server checks it again on restore.
10218
11364
  */
10219
11365
  const registrationBrowserDraftSchema = z.object({
11366
+ owner: bookingQuestionsOwnerSchema,
10220
11367
  step: z.enum(browserDraftSteps),
10221
11368
  selectedEventIds: z.array(z.string()),
10222
11369
  placeCount: z.number().int().positive(),
@@ -10235,15 +11382,24 @@ const registrationBrowserDraftSchema = z.object({
10235
11382
  email: z.string(),
10236
11383
  phone: z.string()
10237
11384
  }),
10238
- discountCode: z.string().default("")
11385
+ discountCode: z.string().default(""),
11386
+ guests: z.array(z.object({
11387
+ name: z.string(),
11388
+ email: z.string().nullable(),
11389
+ phone: z.string().nullable()
11390
+ })).default([]),
11391
+ questions: bookingQuestionsTabDraftSchema.nullable().default(null),
11392
+ /** Each run's answers, by series ID, when the runs ask their questions separately. */
11393
+ runQuestions: z.record(z.string(), bookingQuestionsTabDraftSchema).default({})
10239
11394
  });
10240
11395
  function isBrowserDraftStep(step) {
10241
11396
  return browserDraftSteps.some((candidate) => candidate === step);
10242
11397
  }
10243
- function registrationBrowserDraft(flow, discountCode) {
11398
+ function registrationBrowserDraft(flow, discountCode, identity) {
10244
11399
  if (!isBrowserDraftStep(flow.step)) return null;
10245
11400
  const { draft } = flow;
10246
11401
  return {
11402
+ owner: bookingQuestionsOwnerOf(identity),
10247
11403
  step: flow.step,
10248
11404
  selectedEventIds: draft.selection.map((event) => event.selectionId),
10249
11405
  placeCount: flow.placeCount,
@@ -10256,7 +11412,43 @@ function registrationBrowserDraft(flow, discountCode) {
10256
11412
  email: draft.formData.email,
10257
11413
  phone: draft.formData.phone
10258
11414
  },
10259
- discountCode
11415
+ discountCode,
11416
+ guests: draft.guests.map(({ name, email, phone }) => ({
11417
+ name,
11418
+ email,
11419
+ phone
11420
+ })),
11421
+ ...questionsDrafts(draft.selection, draft.bookingQuestions, draft.runRequirements, identity)
11422
+ };
11423
+ }
11424
+ /** Who asks the questions: one event for the whole selection, or each run for itself. */
11425
+ function questionAskers(selection) {
11426
+ const layout = decideSelectionRequirementsLayout(selection);
11427
+ return layout.kind === "per_run" ? {
11428
+ kind: "per_run",
11429
+ runs: layout.runs
11430
+ } : {
11431
+ kind: "once",
11432
+ event: primarySelectionItem(selection)
11433
+ };
11434
+ }
11435
+ /** Only answers typed as the visitor signed in now are kept, so the draft's one stamp covers them. */
11436
+ function answersDraft(answers, event, identity) {
11437
+ if ((answers.scope?.identity ?? null) !== identity) return null;
11438
+ return toBookingQuestionsTabDraft(answers, answers.refreshed?.targetKey === event.seriesId ? answers.refreshed.presentation : event.bookingQuestions);
11439
+ }
11440
+ function questionsDrafts(selection, answers, runs, identity) {
11441
+ const askers = questionAskers(selection);
11442
+ if (askers.kind === "once") return {
11443
+ questions: askers.event ? answersDraft(answers, askers.event, identity) : null,
11444
+ runQuestions: {}
11445
+ };
11446
+ return {
11447
+ questions: null,
11448
+ runQuestions: Object.fromEntries(askers.runs.flatMap((run) => {
11449
+ const kept = answersDraft(runAnswers(runs, run.seriesId).questions, run, identity);
11450
+ return kept ? [[run.seriesId, kept]] : [];
11451
+ }))
10260
11452
  };
10261
11453
  }
10262
11454
  /** A code belongs to its selection: it only comes back when that whole selection does. */
@@ -10264,13 +11456,14 @@ function restorableBrowserDraftCode(saved, events) {
10264
11456
  return findSelection(saved.selectedEventIds, events).length === saved.selectedEventIds.length ? saved.discountCode : "";
10265
11457
  }
10266
11458
  /** Restore against current events, never a saved price/capacity or a partial selection. */
10267
- function restoreRegistrationBrowserDraft(state, saved, events) {
11459
+ function restoreRegistrationBrowserDraft(state, saved, events, identity) {
10268
11460
  if (state.invitation.kind !== "none" || !isBrowserDraftStep(state.step)) return state;
10269
11461
  const selection = findSelection(saved.selectedEventIds, events);
10270
- const contact = {
11462
+ const theirs = isBookingQuestionsOwner(saved.owner, identity);
11463
+ const contact = theirs ? {
10271
11464
  ...state.draft.formData,
10272
11465
  ...saved.contact
10273
- };
11466
+ } : state.draft.formData;
10274
11467
  if (selection.length !== saved.selectedEventIds.length) return {
10275
11468
  ...state,
10276
11469
  draft: {
@@ -10278,6 +11471,8 @@ function restoreRegistrationBrowserDraft(state, saved, events) {
10278
11471
  formData: contact
10279
11472
  }
10280
11473
  };
11474
+ const restoredSelection = selection.length ? selection : state.draft.selection;
11475
+ const questions = theirs ? restoredQuestions(state.draft, saved, restoredSelection, identity) : {};
10281
11476
  return {
10282
11477
  ...state,
10283
11478
  step: saved.step === "select-payment" ? "enter-details" : saved.step,
@@ -10285,7 +11480,9 @@ function restoreRegistrationBrowserDraft(state, saved, events) {
10285
11480
  draft: {
10286
11481
  ...state.draft,
10287
11482
  formData: contact,
10288
- selection: selection.length ? selection : state.draft.selection,
11483
+ guests: theirs ? saved.guests.map((guest) => ({ ...guest })) : state.draft.guests,
11484
+ ...questions,
11485
+ selection: restoredSelection,
10289
11486
  selectedTicketLines: saved.selectedTicketLines,
10290
11487
  selectedSlidingAmountInput: saved.selectedSlidingAmountInput,
10291
11488
  selectedAttendanceMode: resolveSelectionAttendanceMode(decideSelectionAttendance(selection.length ? selection : state.draft.selection), saved.selectedAttendanceMode),
@@ -10293,6 +11490,27 @@ function restoreRegistrationBrowserDraft(state, saved, events) {
10293
11490
  }
10294
11491
  };
10295
11492
  }
11493
+ /** Answers come back against the questions as they're asked now, never as they were saved. */
11494
+ function restoredQuestions(current, saved, selection, identity) {
11495
+ const restore = (answers, draft, event) => draft ? restoreBookingQuestionsAnswers(answers, decideBookingQuestionsRestoration({
11496
+ kind: "tab_draft",
11497
+ draft,
11498
+ identity,
11499
+ current: event.bookingQuestions
11500
+ })) : answers;
11501
+ const askers = questionAskers(selection);
11502
+ if (askers.kind === "once") return askers.event ? { bookingQuestions: restore(current.bookingQuestions, saved.questions, askers.event) } : {};
11503
+ return { runRequirements: askers.runs.reduce((runs, run) => {
11504
+ const answers = runAnswers(runs, run.seriesId);
11505
+ return {
11506
+ ...runs,
11507
+ [run.seriesId]: {
11508
+ ...answers,
11509
+ questions: restore(answers.questions, saved.runQuestions[run.seriesId], run)
11510
+ }
11511
+ };
11512
+ }, current.runRequirements) };
11513
+ }
10296
11514
  //#endregion
10297
11515
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptions.ts
10298
11516
  function buildBookingPaymentSelectionViewModel(input) {
@@ -10611,6 +11829,16 @@ function buildSelectedSiteCreditPreview(input) {
10611
11829
  });
10612
11830
  }
10613
11831
  //#endregion
11832
+ //#region ../blocks/src/system/runtime/shared/onlineBookingUnavailable.ts
11833
+ /**
11834
+ * Said, for events and appointments alike, when a booking needs a card
11835
+ * payment the site can't take yet, so the client books with the business
11836
+ * instead. Shown with the business's published contact details.
11837
+ */
11838
+ function onlineBookingUnavailableMessage(businessName) {
11839
+ return `You can’t book this online yet. Please contact ${businessName?.trim() || "the organiser"} to book your place.`;
11840
+ }
11841
+ //#endregion
10614
11842
  //#region ../blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.ts
10615
11843
  function isEventRegistrationAvailable(event) {
10616
11844
  return event.bookingAvailability.kind === "open";
@@ -10631,13 +11859,6 @@ function toHeadlessPaymentSelection(selection) {
10631
11859
  method: "stripe",
10632
11860
  collectionOptionKind: selection.collectionOptionKind
10633
11861
  };
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
11862
  case "membership":
10642
11863
  if (!selection.membershipId) return { method: "none" };
10643
11864
  return {
@@ -10645,20 +11866,6 @@ function toHeadlessPaymentSelection(selection) {
10645
11866
  membershipId: selection.membershipId,
10646
11867
  ...selection.productName ? { productName: selection.productName } : {}
10647
11868
  };
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
11869
  }
10663
11870
  }
10664
11871
  function toInternalPaymentSelection(selection) {
@@ -10669,26 +11876,11 @@ function toInternalPaymentSelection(selection) {
10669
11876
  method: "stripe",
10670
11877
  collectionOptionKind: selection.collectionOptionKind
10671
11878
  };
10672
- case "pass": return {
10673
- method: "pass",
10674
- passId: selection.passId,
10675
- ...selection.productName ? { productName: selection.productName } : {}
10676
- };
10677
11879
  case "membership": return {
10678
11880
  method: "membership",
10679
11881
  membershipId: selection.membershipId,
10680
11882
  ...selection.productName ? { productName: selection.productName } : {}
10681
11883
  };
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
11884
  }
10693
11885
  }
10694
11886
  function resolveEventRegistrationSubmitPlan(input) {
@@ -10711,13 +11903,7 @@ function toSubmitArgs(selection) {
10711
11903
  switch (selection.method) {
10712
11904
  case "stripe":
10713
11905
  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 {
11906
+ case "membership": return {
10721
11907
  method: selection.method,
10722
11908
  membershipId: selection.membershipId
10723
11909
  };
@@ -10809,7 +11995,7 @@ function resolveHeadlessEventRegistrationView(wizard) {
10809
11995
  }
10810
11996
  }
10811
11997
  function deriveEventRegistrationSteps(input) {
10812
- const needsPaymentStep = input.eventRequiresPayment && input.paymentSelection.method !== "pass" && input.paymentSelection.method !== "membership";
11998
+ const needsPaymentStep = input.eventRequiresPayment && input.paymentSelection.method !== "membership";
10813
11999
  const ids = [
10814
12000
  ...!input.hasPreSelectedContext ? ["select-event"] : [],
10815
12001
  "select-tickets",
@@ -10880,9 +12066,27 @@ function resolveRegistrationAdmission(input) {
10880
12066
  reason: "alreadyWaitlisted",
10881
12067
  message: "You're already on the waitlist for this event."
10882
12068
  };
10883
- return admissionFromAvailability(availability, input.isAuthenticated);
12069
+ const admission = admissionFromAvailability(availability, input.isAuthenticated, input.businessName);
12070
+ return admission.kind === "open" && input.severalRunsNeedCard ? admissionWithCardDue(input.eligibility.onlinePayments, input.businessName) : admission;
12071
+ }
12072
+ /** Several runs whose total has to go to card payment (issue 1725), priced from every run. */
12073
+ function severalRunsNeedCard(several, payment) {
12074
+ return several === "runs" && payment.kind === "several" && payment.due === "card";
10884
12075
  }
10885
- function admissionFromAvailability(availability, isAuthenticated) {
12076
+ /** An open selection that has to go to card payment, which the site may not be able to take. */
12077
+ function admissionWithCardDue(onlinePayments, businessName) {
12078
+ return onlinePayments?.kind === "unavailable" ? cannotBookOnline(businessName, onlinePayments.organiserContact) : { kind: "open" };
12079
+ }
12080
+ /** The site can't take this payment now, so the client books with the business instead. */
12081
+ function cannotBookOnline(businessName, contact) {
12082
+ return {
12083
+ kind: "closed",
12084
+ reason: "unavailable",
12085
+ message: onlineBookingUnavailableMessage(businessName),
12086
+ ...contact ? { contact } : {}
12087
+ };
12088
+ }
12089
+ function admissionFromAvailability(availability, isAuthenticated, businessName) {
10886
12090
  switch (availability.kind) {
10887
12091
  case "available": return { kind: "open" };
10888
12092
  case "waitlist": return {
@@ -10894,11 +12098,7 @@ function admissionFromAvailability(availability, isAuthenticated) {
10894
12098
  kind: "fullyBooked",
10895
12099
  placesLeft: Math.max(0, availability.remainingPlaces ?? 0)
10896
12100
  };
10897
- case "paymentUnavailable": return {
10898
- kind: "closed",
10899
- reason: "unavailable",
10900
- message: "Payment options are not available for this event."
10901
- };
12101
+ case "paymentUnavailable": return cannotBookOnline(businessName, availability.organiserContact);
10902
12102
  case "selectionRequired": return { kind: "open" };
10903
12103
  case "bookingClosed": return {
10904
12104
  kind: "closed",
@@ -10938,6 +12138,22 @@ function settledRemainingPlaces(eligibility) {
10938
12138
  const availability = eligibility?.availability;
10939
12139
  return availability?.kind === "available" ? availability.remainingPlaces ?? null : null;
10940
12140
  }
12141
+ /** The primary button's words while admission is closed, where it shows at all (`registrationStopsHere`). */
12142
+ function closedAdmissionLabel(reason) {
12143
+ switch (reason) {
12144
+ case "alreadyWaitlisted": return "Already on waitlist";
12145
+ case "optionsUnavailable": return "Couldn’t load times";
12146
+ case "unavailable": return "Can’t book online";
12147
+ }
12148
+ }
12149
+ /**
12150
+ * This can't be booked online at all (the site can't take the payment, or
12151
+ * registration is closed): the notice says why and who to contact, so the
12152
+ * form shows no places to choose and no button to press.
12153
+ */
12154
+ function registrationStopsHere(admission) {
12155
+ return admission.kind === "closed" && admission.reason === "unavailable";
12156
+ }
10941
12157
  function resolveRegistrationAvailabilityBlocker(admission) {
10942
12158
  switch (admission.kind) {
10943
12159
  case "open":
@@ -11042,7 +12258,7 @@ function resolveRegistrationTicketContinuation(input) {
11042
12258
  };
11043
12259
  case "closed": return {
11044
12260
  kind: "blocked",
11045
- label: input.admission.reason === "alreadyWaitlisted" ? "Already on waitlist" : input.admission.reason === "optionsUnavailable" ? "Availability unavailable" : "Registration unavailable",
12261
+ label: closedAdmissionLabel(input.admission.reason),
11046
12262
  pending: false,
11047
12263
  message: input.admission.message
11048
12264
  };
@@ -11268,8 +12484,8 @@ function selectionPaymentPresentation(payment, eligibility) {
11268
12484
  /**
11269
12485
  * Label for the button that acts on the chosen payment method.
11270
12486
  *
11271
- * A pass redemption spends a credit the moment it is pressed, so the label
11272
- * names the pass instead of describing the step.
12487
+ * Dates paid with a pass or membership take their button from the funding
12488
+ * option instead.
11273
12489
  */
11274
12490
  function resolvePaymentButtonText(method, siteCreditPreview, eligibility, selectedDirectOption) {
11275
12491
  switch (method) {
@@ -11279,9 +12495,6 @@ function resolvePaymentButtonText(method, siteCreditPreview, eligibility, select
11279
12495
  if (!eligibility) return "Continue to Payment";
11280
12496
  if (siteCreditPreview.cardDueNowCents > 0) return `Pay ${formatPrice(siteCreditPreview.cardDueNowCents, eligibility.currency)} by card`;
11281
12497
  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
12498
  case "free":
11286
12499
  case "membership":
11287
12500
  case null: return "Book your place";
@@ -11290,10 +12503,7 @@ function resolvePaymentButtonText(method, siteCreditPreview, eligibility, select
11290
12503
  function canContinueWithPaymentSelection(selection, directPaymentSelection) {
11291
12504
  switch (selection.method) {
11292
12505
  case "stripe": return directPaymentSelection.kind === "valid";
11293
- case "pass": return Boolean(selection.passId);
11294
12506
  case "membership": return Boolean(selection.membershipId);
11295
- case "pass_bundle": return Boolean(selection.bundlePassId);
11296
- case "membership_bundle": return Boolean(selection.bundleMembershipId);
11297
12507
  case "free": return true;
11298
12508
  case null: return false;
11299
12509
  }
@@ -11354,7 +12564,7 @@ function resetRegistrationDraft(session, hasPreSelectedContext) {
11354
12564
  completedOutcomes: session.completedOutcomes,
11355
12565
  spentClaim: session.spentClaim,
11356
12566
  eligibility: null,
11357
- passOptOut: false,
12567
+ roomFacts: null,
11358
12568
  paymentSelection: { method: null },
11359
12569
  selectionSource: "auto"
11360
12570
  };
@@ -11369,10 +12579,7 @@ function paymentSelectionIdentity(selection) {
11369
12579
  case null:
11370
12580
  case "free": return [selection.method, void 0];
11371
12581
  case "stripe": return [selection.method, selection.collectionOptionKind];
11372
- case "pass": return [selection.method, selection.passId];
11373
12582
  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
12583
  }
11377
12584
  }
11378
12585
  function normalizePaymentSelection(selection) {
@@ -11387,7 +12594,7 @@ function flowTicketsCount(state) {
11387
12594
  const { ticketsCount } = selectionTicketInputs({
11388
12595
  several: severalItemsOf(state.draft.selection),
11389
12596
  primary: state.draft.selection[0] ?? null,
11390
- lines: state.draft.selectedTicketLines,
12597
+ lines: draftBookingLines(state.draft, state.roomFacts),
11391
12598
  slidingAmountInput: state.draft.selectedSlidingAmountInput,
11392
12599
  placeCount: state.placeCount,
11393
12600
  runChoices: state.draft.runChoices,
@@ -11403,44 +12610,35 @@ function flowSelectionPayment(state) {
11403
12610
  eligibility: state.eligibility
11404
12611
  });
11405
12612
  }
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;
12613
+ /**
12614
+ * A membership covers one run for one person, so it's chosen for the visitor
12615
+ * then. Dates are paid with the server's funding options instead (issue 1767).
12616
+ */
12617
+ function membershipAllowed(state) {
12618
+ return flowTicketsCount(state) === 1 && severalItemsOf(state.draft.selection) === null && state.draft.selection[0]?.registrationSubject.kind === "wholeSeries";
11409
12619
  }
11410
12620
  function computeAutoSelection(state) {
11411
- const { isAuthenticated, eligibility, passOptOut } = state;
12621
+ const { isAuthenticated, eligibility } = state;
11412
12622
  if (!eligibility) return { method: null };
11413
12623
  const payment = flowSelectionPayment(state);
11414
12624
  if (payment.kind === "several") return payment.due === "nothing" ? { method: "free" } : { method: null };
11415
12625
  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 };
12626
+ const membership = isAuthenticated && membershipAllowed(state) ? eligibility.eligibleMemberships[0] : void 0;
12627
+ return membership ? {
12628
+ method: "membership",
12629
+ membershipId: membership.id,
12630
+ productName: membership.membershipName
12631
+ } : { method: null };
11431
12632
  }
11432
12633
  function isSelectionValid(input) {
11433
12634
  const { selection, isAuthenticated, eligibility } = input;
11434
12635
  if (!selection.method) return false;
11435
12636
  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";
12637
+ if (!eligibility) return selection.method === "stripe";
11437
12638
  switch (selection.method) {
11438
12639
  case "free": return eligibility.isFree;
11439
12640
  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);
12641
+ case "membership": return input.membershipAllowed && isAuthenticated && eligibility.eligibleMemberships.some((membership) => membership.id === selection.membershipId);
11444
12642
  default: return false;
11445
12643
  }
11446
12644
  }
@@ -11459,22 +12657,13 @@ function isCardSelectionValid(selection, eligibility) {
11459
12657
  if (!eligibility.requiresPayment || !eligibility.price) return false;
11460
12658
  return getApprovedDirectPaymentCollectionOptionKinds(eligibility.paymentOptions).includes(selection.collectionOptionKind);
11461
12659
  }
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
12660
  function normalizeRegistrationFlowState(state) {
11472
12661
  const autoSelection = computeAutoSelection(state);
11473
12662
  const canKeepManualSelection = state.step !== "select-tickets" && state.selectionSource === "manual" && isSelectionValid({
11474
12663
  selection: state.paymentSelection,
11475
12664
  isAuthenticated: state.isAuthenticated,
11476
12665
  eligibility: state.eligibility,
11477
- entitlementsAllowed: entitlementsAllowed(state),
12666
+ membershipAllowed: membershipAllowed(state),
11478
12667
  payment: flowSelectionPayment(state)
11479
12668
  });
11480
12669
  const nextSelection = canKeepManualSelection ? state.paymentSelection : autoSelection;
@@ -11537,12 +12726,13 @@ function restorePaymentReturn(state, restoration) {
11537
12726
  selection: restoration.selection.length > 0 ? restoration.selection : state.draft.selection,
11538
12727
  runChoices: restoration.runChoices,
11539
12728
  selectedTicketLines: restoration.ticketLines.map((line) => ({ ...line })),
12729
+ roomChoices: restoration.roomChoices,
12730
+ reviewedRooms: restoration.reviewedRooms,
11540
12731
  selectedAttendanceMode: restoration.attendanceMode,
11541
12732
  selectedSlidingAmountInput: restoration.slidingAmountInput
11542
12733
  },
11543
12734
  paymentSelection: normalizePaymentSelection(restoration.paymentSelection),
11544
- selectionSource: "manual",
11545
- passOptOut: passOptOutAfterManualSelection(state, restoration.paymentSelection)
12735
+ selectionSource: "manual"
11546
12736
  };
11547
12737
  return isRegistrationLocked(state.step) ? restored : normalizeRegistrationFlowState(restored);
11548
12738
  }
@@ -11555,12 +12745,12 @@ function synchronizeRegistrationAuthentication(state, isAuthenticated) {
11555
12745
  return isRegistrationLocked(state.step) ? updated : normalizeRegistrationFlowState(updated);
11556
12746
  }
11557
12747
  function isPaymentChoiceAction(action) {
11558
- return action.type === "set-manual-payment-selection" || action.type === "use-card-instead-of-pass" || action.type === "use-pass";
12748
+ return action.type === "set-manual-payment-selection";
11559
12749
  }
11560
12750
  /** Active navigation and draft updates share the same selection normalization. */
11561
12751
  function reduceActiveRegistration(state, action) {
11562
12752
  switch (action.type) {
11563
- case "browser-draft-restored": return normalizeRegistrationFlowState(restoreRegistrationBrowserDraft(state, action.draft, action.events));
12753
+ case "browser-draft-restored": return normalizeRegistrationFlowState(restoreRegistrationBrowserDraft(state, action.draft, action.events, action.identity));
11564
12754
  case "claim-arrived": {
11565
12755
  if (isSameWaitlistClaim(action.credential, state.spentClaim)) return state;
11566
12756
  const invitation = receiveWaitlistInvitation(state.invitation, action.credential);
@@ -11585,7 +12775,8 @@ function reduceActiveRegistration(state, action) {
11585
12775
  case "sign-in-draft-restored": return normalizeRegistrationFlowState(restoreEventSignInDraft(state, action.restoration));
11586
12776
  case "tickets-completed": return state.step === "select-tickets" ? normalizeRegistrationFlowState({
11587
12777
  ...state,
11588
- step: "enter-details"
12778
+ step: "enter-details",
12779
+ draft: withReviewedRooms(state.draft, state.roomFacts)
11589
12780
  }) : state;
11590
12781
  case "set-step": return isRegistrationLocked(action.step) ? {
11591
12782
  ...state,
@@ -11597,7 +12788,7 @@ function reduceActiveRegistration(state, action) {
11597
12788
  });
11598
12789
  case "reset": return resetRegistrationDraft(state, action.hasPreSelectedContext);
11599
12790
  case "set-tickets-count":
11600
- case "eligibility-updated": return normalizeRegistrationFlowState(updateRegistrationDraft(state, action));
12791
+ case "eligibility-updated": return normalizeRegistrationFlowState(backToRoomsWhenTheyveGone(updateRegistrationDraft(state, action)));
11601
12792
  case "event-continued": return action.navigation === "advance" ? {
11602
12793
  ...state,
11603
12794
  step: "select-tickets"
@@ -11649,6 +12840,7 @@ function applyRunRequirementsAction(state, action) {
11649
12840
  const SELECTION_FIELDS = /* @__PURE__ */ new Set([
11650
12841
  "selection",
11651
12842
  "selectedTicketLines",
12843
+ "roomChoices",
11652
12844
  "runChoices"
11653
12845
  ]);
11654
12846
  function applyDraftEdit(state, edit) {
@@ -11697,6 +12889,20 @@ function isRegistrationLocked(step) {
11697
12889
  "payment-status"
11698
12890
  ].includes(step);
11699
12891
  }
12892
+ /** Steps after the rooms are chosen and before anything's submitted, where fresher room facts can still send the guest back. */
12893
+ const BEFORE_SUBMITTING = /* @__PURE__ */ new Set(["enter-details", "select-payment"]);
12894
+ /**
12895
+ * Someone else took the room while this guest was on their details or payment. Their
12896
+ * choices stay as they were, and they go back to the rooms, which say what changed,
12897
+ * rather than carrying on with a booking that no longer has its room.
12898
+ */
12899
+ function backToRoomsWhenTheyveGone(state) {
12900
+ if (!BEFORE_SUBMITTING.has(state.step) || draftRoomsStillPlace(state.draft, state.roomFacts)) return state;
12901
+ return {
12902
+ ...state,
12903
+ step: "select-tickets"
12904
+ };
12905
+ }
11700
12906
  /** Draft edits change inputs; the existing selection owner normalizes their consequences. */
11701
12907
  function updateRegistrationDraft(state, action) {
11702
12908
  switch (action.type) {
@@ -11706,71 +12912,26 @@ function updateRegistrationDraft(state, action) {
11706
12912
  };
11707
12913
  case "eligibility-updated": return {
11708
12914
  ...state,
11709
- eligibility: action.eligibility
12915
+ eligibility: action.eligibility,
12916
+ roomFacts: action.eligibility?.rooms ?? state.roomFacts
11710
12917
  };
11711
12918
  default: return assertNever$1(action);
11712
12919
  }
11713
12920
  }
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;
11745
- }
11746
- }
12921
+ /** A run's membership books without a payment step. */
11747
12922
  function isEntitlementSelection(selection) {
11748
- return selection.method === "pass" || selection.method === "membership";
12923
+ return selection.method === "membership";
11749
12924
  }
11750
12925
  function requiresPaymentStep(params) {
11751
12926
  if (!params.eventRequiresPayment) return false;
11752
12927
  return !isEntitlementSelection(params.paymentSelection);
11753
12928
  }
11754
12929
  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
- }
12930
+ return normalizeRegistrationFlowState({
12931
+ ...state,
12932
+ paymentSelection: normalizePaymentSelection(action.selection),
12933
+ selectionSource: "manual"
12934
+ });
11774
12935
  }
11775
12936
  /** Only explicit navigation leaves a completed booking; draft refreshes retain it. */
11776
12937
  function reduceCompletedRegistration(state, action) {
@@ -11801,9 +12962,7 @@ function reduceCompletedRegistration(state, action) {
11801
12962
  case "tickets-completed":
11802
12963
  case "set-tickets-count":
11803
12964
  case "eligibility-updated":
11804
- case "set-manual-payment-selection":
11805
- case "use-card-instead-of-pass":
11806
- case "use-pass": return state;
12965
+ case "set-manual-payment-selection": return state;
11807
12966
  default: return assertNever$1(action);
11808
12967
  }
11809
12968
  }
@@ -11841,7 +13000,7 @@ function applyWaitlistClaimLookup(state, action) {
11841
13000
  case "awaitingEvents": return state;
11842
13001
  case "ready": return normalizeRegistrationFlowState({
11843
13002
  ...state,
11844
- placeCount: restoration.ticketsCount,
13003
+ placeCount: restoration.claimed.places,
11845
13004
  draft: restoreRegistrationDraft(state.draft, lookup.claim, restoration),
11846
13005
  invitation: {
11847
13006
  kind: "ready",
@@ -11989,6 +13148,7 @@ const REGISTRATION_STEP_LABELS = [
11989
13148
  "Dates",
11990
13149
  "Tickets",
11991
13150
  "Places",
13151
+ "Rooms",
11992
13152
  "Your details",
11993
13153
  "How you’ll pay",
11994
13154
  "Payment"
@@ -12009,7 +13169,8 @@ function registrationStepLabelContext(scopedEvents, bookedEvent) {
12009
13169
  const several = scopedEvents.every((event) => event.allowsMultipleBooking === true);
12010
13170
  return {
12011
13171
  eventSelection: mode === "date" && several ? "dates" : severalRuns(scopedEvents) ? "runs" : mode,
12012
- booksWholeSeries: bookedEvent?.registrationSubject.kind === "wholeSeries"
13172
+ booksWholeSeries: bookedEvent?.registrationSubject.kind === "wholeSeries",
13173
+ booksRooms: Boolean((bookedEvent ?? (scopedEvents.length === 1 ? scopedEvents[0] : null))?.rooms)
12013
13174
  };
12014
13175
  }
12015
13176
  /** One label owner for the live progress and the server placeholder. */
@@ -12021,11 +13182,13 @@ function registrationStepLabel(step, context) {
12021
13182
  case "runs": return "Choose what to book";
12022
13183
  case "event": return "Event";
12023
13184
  }
12024
- case "select-tickets": return context.booksWholeSeries ? "Places" : "Tickets";
13185
+ case "select-tickets":
13186
+ if (context.booksRooms) return "Rooms";
13187
+ return context.booksWholeSeries ? "Places" : "Tickets";
12025
13188
  case "enter-details": return "Your details";
12026
13189
  case "select-payment": return "How you’ll pay";
12027
13190
  case "payment": return "Payment";
12028
13191
  }
12029
13192
  }
12030
13193
  //#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 };
13194
+ export { withOfferedEvent as $, RichText as $a, resolveBookingPaymentChoice as $i, getTicketSelectionTotal as $n, decideSelectionAttendance as $o, resolveSelectionBookingClosedDetail as $r, runNeedsPricingChoice as $t, visitorHoldsOwnPlace as A, bookingPageKindSchema as Aa, appointmentQuestionsRefusal as Ai, formatEventDateTime as An, systemCustomizeFacetDefinitionsForBlock as Ao, buildPassCartItem as Ar, publicEventPricingDisplay as As, eventSignInRestoration as At, calculateEventRegistrationPreviewTotal as B, canJoinEventWaitlistOnAnyMode as Ba, toBookingQuestionsPaymentSnapshot as Bi, isEmailAddress as Bn, inlineTextToPlainText as Bo, eventRegistrationPageSurfaceSubjectSchema as Br, withoutKeptAnswers as Bt, registrationStopsHere as C, createHostedBlockApiConfig as Ca, selectedBookingCollectionOptionKind as Ci, selectionCombinationHint as Cn, renderVideo as Co, formatCommercePrice as Cr, EVENT_ADDRESS_AFTER_BOOKING_LABEL as Cs, getRegistrationStartAt as Ct, resolveRegistrationTicketContinuation as D, leavePage as Da, resolveSelectedAppointmentConsent as Di, findSelectedTicketType as Dn, resolveMediaNodeResponsiveImage as Do, membershipClassesLabel as Dr, formatEventPricing as Ds, EVENT_SIGN_IN_FORM_ID as Dt, resolveRegistrationAvailabilityBlocker as E, canonicalUrl as Ea, projectSelectedAppointmentConsentIntoForm as Ei, serverPricedTotalCents as En, resolveImageUrlWithContext as Eo, membershipCardListContent as Er, formatBookingPriceDisplay as Es, toWholeSeriesRegistrationEvents as Et, resolveHeadlessEventRegistrationStatus as F, formatEventLocation as Fa, decideBookingQuestionsRestoration as Fi, getTicketTypeAvailabilityLabel as Fn, SECTION_STATE_KINDS as Fo, reduceCommerceCart as Fr, parseSiteId as Fs, deriveRunRequirements as Ft, BROWSER_DRAFT_LIFETIME_MS as G, getEventAvailabilityStatus as Ga, applyBookingPaymentAdmission as Gi, getTicketSelectionRemainingPlaces as Gn, resolveLookMediaFrame as Go, getPublicEventCanonicalPath as Gr, decideSelectionPayment as Gt, buildReviewedBookingPaymentViewModel as H, formatRemainingPlaces as Ha, formatPrice as Hi, getRegistrationOccurrenceId as Hn, parseInlineTextFromUnknown as Ho, resolveEventRegistrationChoices as Hr, SELECTION_LIMIT_NOTE as Ht, resolveHeadlessEventRegistrationView as I, resolveRuntimeEventDestination as Ia, deriveBookingQuestions as Ii, getVisibleTicketTypes as In, sectionStateToneFromKind as Io, resolveSelectedProduct as Ir, unsafeAsSiteId as Is, nextRunToRead as It, restorableBrowserDraftCode as J, selectEventCapacitySource as Ja, bookingRequiresResourceSelection as Ji, shouldLoadRegistrationOptions as Jn, resolveDateRuntimeContext as Jo, planOrdinarySeriesSelection as Jr, planSelectionPrice as Jt, registrationBrowserDraft as K, getRemainingPlaces as Ka, bookingHasPackagePaymentChoices as Ki, parseCurrencyInputToCents as Kn, parseBlockColorToken as Ko, isOrdinaryPublicEvent as Kr, effectiveSelection as Kt, toHeadlessPaymentSelection as L, hasEventBookingClosedEarly as La, needsBookingQuestionsRefresh as Li, occurrenceTitleOverride as Ln, asPartialObject as Lo, closedDatesCopy as Lr, parseEventSeriesId as Ls, runFieldErrors as Lt, isEventRegistrationAvailable as M, eventOnlinePlace as Ma, isAppointmentBookingQuestionsEvent as Mi, formatTime as Mn, heroTitleSizeOptions as Mo, deriveCommerceCheckoutState as Mr, publicEventPricingType as Ms, buildSelectionRequirementsSubmission as Mt, normalizeEventRegistrationMaxTickets as N, eventPlaceName as Na, needsAppointmentQuestionsRefresh as Ni, getImplicitSingleTicketType as Nn, createAspectRatioField as No, parseStoredCommerceCartState as Nr, resolveExactOrFreePriceDisplay as Ns, checkRunRequirements as Nt, settledRemainingPlaces as O, pageNavigationSchema as Oa, EMPTY_APPOINTMENT_BOOKING_QUESTIONS as Oi, formatBookingWhen as On, resolvePublicMediaUrl as Oo, passCardListContent as Or, isPublicEventPricingOptionDisplayable as Os, eventSignInDraftStore as Ot, resolveEventRegistrationSubmitPlan as P, eventVenuePlace as Pa, bookingQuestionsAnswerDraftSchema as Pi, getPortalSubjectEmail as Pn, uiTransforms as Po, productItemKey as Pr, resolvePricingOptionsPriceDisplay as Ps, decideSelectionRequirementsLayout as Pt, invitationBooking as Q, isBlockButtonRole as Qa, resolveBookingPaymentAvailability as Qi, getTicketLineQuantity as Qn, INCOMPATIBLE_ATTENDANCE_MESSAGE as Qo, registrationDataForEventSelection as Qr, runChoiceUsable as Qt, toInternalPaymentSelection as R, isBookableEvent as Ra, restoreBookingQuestionsAnswers as Ri, transformRegistrationOptionsResponse as Rn, createTransformRegistry as Ro, closedRunCopy as Rr, unsafeAsEventCategoryId as Rs, runsKeepingAnswers as Rt, planRegistrationDetailsContinuation as S, browserReadAuthoritySchema as Sa, resolveLowestBookingPaymentStep as Si, paymentCaption as Sn, renderAudio as So, buildProductListDisplay as Sr, parseNewsletterListId as Ss, resolveFinishedPresentation as St, resolveRegistrationAdmission as T, PAGE_NAVIGATION as Ta, toSelectedCollectionOptionKind as Ti, selectionPreviewLines as Tn, resolveImageUrl as To, formatValidity as Tr, EVENT_PRESET_VOCABULARY as Ts, toWholeSeriesRegistrationEvent as Tt, paymentChoiceDetails as U, formatTotalCapacity as Ua, BOOKING_FORM_DATA_RESERVED_KEYS as Ui, getSlidingScaleForEvent as Un, plainTextToInlineText as Uo, resolveEventRegistrationScopedEvents as Ur, SEVERAL_BOOKINGS_ACCOUNT_NOTE as Ut, buildBookingPaymentSelectionViewModel as V, formatEventRemainingPlaces as Va, formatCentsAsCurrencyInput as Vi, getCurrentTicketSelection as Vn, isInlineTextEmpty as Vo, normalizeEventRegistrationPageSurfaceSubject as Vr, paymentReturnRestoration as Vt, paymentChoicePrice as W, getEventAvailability as Wa, BOOKING_FORM_DATA_RESERVED_KEY_VALUES as Wi, getSlidingScaleSelectionMessage as Wn, generateLookMediaFrameCss as Wo, eventOccurrenceContext as Wr, canToggleSelectionItem as Wt, createRegistrationDraftData as X, BLOCK_BUTTON_ROLE_OPTIONS as Xa, resolveBookingPackagePaymentSelection as Xi, canRequestTicketOption as Xn, parseAspectRatioValue as Xo, planWholeSeriesParentSelection as Xr, quoteReductions as Xt, beginWaitlistInvitation as Y, selectMostOpenCapacitySource as Ya, reconcileBookingPackagePurchase as Yi, withRegistrationAvailability as Yn, sanitizeHref as Yo, planWholeSeriesParentBooking as Yr, primarySelectionItem as Yt, invitationSubmission as Z, blockButtonRoleSchema as Za, resolveBookingPackageSources as Zi, getSingleSelectedPricingOptionId as Zn, isRecord$3 as Zo, planWholeSeriesRunSelection as Zr, registrationSelectionMode as Zt, closedAdmissionLabel as _, eventLayoutSchema as _a, resolveAppointmentCheckoutVerificationState as _i, toggleSelectionItem as _n, resolveEventTimeZone as _o, buildCartDisplay as _r, DEFAULT_MAILING_LIST_PRIVACY_NOTE as _s, roomSubmission as _t, registrationPresentation as a, createInteractiveIslandCodec as aa, deriveBookingFormViewState as ai, selectionEntitlementNote as an, formatCalendarTitle as ao, clearSignInReturnDrafts as ar, bookingCollectionDatesOpen as as, resolveRouteRequiresPayment as at, placeCountCeiling as b, registrationButtonVariantSchema as ba, resolveBookingSiteId as bi, combinationOffersOf as bn, computeMediaTransformStyle as bo, buildProductCardDisplay as br, parseMailchimpAudienceId as bs, toWaitlistClaimResolveFailure as bt, registrationStepLabelContext as c, defineClientOwnedBlockRuntime as ca, getBookingSuccessCopy as ci, selectionItemsLabel as cn, formatEventCompactDateRail as co, nextSignInReturnExpiry as cr, getStripeMinimumChargeRequirement as cs, validateFormData as ct, decideEventChoice as d, bookingNowSchema as da, isBookingServiceSlidingAmountInRange as di, selectionRowAvailability as dn, formatEventNextDateFact as do, sweepExpiredSignInReturnDrafts as dr, orderedLiveRunSessions as ds, dayOptionsOf as dt, resolveBookingPaymentMode as ea, selectionRepresentativeEvent as ei, runPricingChoice as en, buildCalendarViewport as eo, getTicketTypeLineMax as er, setRoomChoicePeople as es, buildRegistrationSelectionRequest as et, isRegistrationLocked as f, calendarTabViewsSchema as fa, isSameOpenCheckout as fi, selectionTicketInputs as fn, formatEventRunDates as fo, placesLeftLabel as fr, resolveWholeSeriesBookingPhase as fs, decideRoomStay as ft, shouldPromptForLogin as g, eventCalendarDisplayModeSchema as ga, prepareBookingSubmission as gi, summariseSelectionPayment as gn, groupEventsByDate as go, appliedDiscountHint as gr, resolveBookingSignupOffer as gs, roomChoiceMessage as gt, decideEventRegistrationPayment as h, eventCalendarDefaultViewSchema as ha, parseBookingCurrencyInputToCents as hi, severalRunsChoiceMessage as hn, formatTime$1 as ho, shownVenue as hr, parseMailingListRuntimeContext as hs, presentRoomChooser as ht, registrationPaymentRoute as i, buildInteractiveIslandProps as ia, readOverrideServiceCategories as ii, selectionConsentLabel as in, eventLocalDateKey as io, BOOKING_SIGN_IN_RETURN_PARAM as ir, planCheckoutPaymentFlow as is, resolveRegistrationTarget as it, deriveEventRegistrationSteps as j, bookingPresentation as ja, deriveAppointmentBookingQuestions as ji, formatRegistrationSchedule as jn, createImageShapeField as jo, buildProductCartItem as jr, publicEventPricingStrategy as js, toEventSignInDraft as jt, severalRunsNeedCard as k, requestSignIn as ka, applyAppointmentBookingQuestionsEvent as ki, formatDate as kn, resolveArrangementKnobs as ko, EMPTY_COMMERCE_CART_STATE as kr, publicEventPricingCurrency as ks, eventSignInEnds as kt, areEventRegistrationPaymentSelectionsEqual as l, defineProgressiveBlockRuntime as la, getRegistrationSuccessCopy as li, selectionPlacesLabel as ln, formatEventDateParts as lo, readSignInReturn as lr, CANCELLED_SESSION_STATUS as ls, ADD_A_PLACE as lt, buildEventRegistrationPaymentOptionsViewModel as m, eventButtonVariantSchema as ma, normalizeBookingServices as mi, severalItemsOf as mn, formatEventWeekdayTime as mo, resolveRegistrationDisplay as mr, resolveWholeSeriesRunLifecycle as ms, isRoomChoiceRefusal as mt, getEventSelectionMode as n, toBookingPurchasablePackages as na, bookingFormInteractiveIslandPropsCodec as ni, selectionAtLimit as nn, eventDateLocale as no, normalizeTicketSelectionLines as nr, eventRegistrationErrors as ns, resolveDiscountContext as nt, registrationRoute as o, defineInteractiveIslandMetaKeys as oa, formatBookingSubmissionPreparationError as oi, selectionIncludes as on, formatDate$1 as oo, createSignInReturnDraftStore as or, flexibleBalanceDueDay as os, toRegistrationRequestSubject as ot, registrationFlowReducer as p, columnOptionSchema as pa, normalizeBookingFormConfig as pi, severalConfirmationSentence as pn, formatEventTimeRange as po, registrationDisplaySchema as pr, resolveWholeSeriesPaymentDates as ps, defaultTicketOptions as pt, registrationBrowserDraftSchema as q, isEventFull as qa, bookingPackageRequestKey as qi, resolveHeldTicketPlaces as qn, readRuntimeNow as qo, planDropInPanel as qr, incompleteRunChoiceMessage as qt, panelShouldOpen as r, getBookingServiceSlidingScale as ra, buildBookingFormInteractiveIslandProps as ri, selectionConfirmationHint as rn, eventDateOptions as ro, setTicketLineQuantity as rr, parseEventRegistrationErrorReason as rs, resolveEventRequiresPayment as rt, registrationStepLabel as s, createZodCodec as sa, getBookingRedirectStateFromLocation as si, selectionItemPrice as sn, formatEventClockLabel as so, decideSignInReturn as sr, repriceBookingCollectionOptions as ss, registrationQuestionsMessage as st, REGISTRATION_STEP_LABELS as t, resolveBookingPurchasablePackages as ta, groupPublicEventsByRun as ti, runUnitPriceCents as tn, eventCalendarWeekStart as to, hasValidPricingOptionSelection as tr, eventRegistrationErrorEndsCommand as ts, findPreSelectedEvent as tt, createInitialRegistrationFlowState as u, isDecodeSuccess as ua, getShopSuccessCopy as ui, selectionPlacesNote as un, formatEventHourLabel as uo, signInReturnPath as ur, nextLiveRunSessionStartMs as us, bookingLines as ut, fullyBookedLabel as v, filterAutoShowSchema as va, resolveBookingPaymentStep as vi, combinationHintCopy as vn, ImagePresets as vo, buildCheckoutDisplay as vr, DEFAULT_MAILING_LIST_SUCCESS_MESSAGE as vs, selectRoomOffer as vt, resolveGuestNextStepCheck as w, getBlockApiReadStage as wa, snapshotBookingShownTerms as wi, selectionItemName as wn, resolveImageSourceSetWithContext as wo, formatInterval as wr, offeringLabelForPageSurfaceSubject as ws, toRegistrationEvents as wt, planRegistrationDetailsCheck as x, weekStartSchema as xa, resolveDefaultBookingServiceId as xi, combinationWorking as xn, mediaImageHostProps as xo, buildProductDetailDisplay as xr, parseMailchimpInterestId as xs, confirmationPaymentRows as xt, getTicketSelectionPurpose as y, previewStageSchema as ya, resolveBookingSelectedService as yi, combinationOfferLine as yn, MediaPlaceholder as yo, buildPassesMembershipsDisplay as yr, parseBrevoListId as ys, isSameWaitlistClaim as yt, onlineBookingUnavailableMessage as z, canJoinEventWaitlist as za, toBookingQuestionsAnswerDraft as zi, withOccurrenceTitle as zn, runTransforms as zo, closedDateCopy as zr, toRunRequirementsSnapshots as zt };