@riverbankcms/sdk 0.161.0 → 0.162.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 (187) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-Bx4kLiTA.d.ts → BlocksIslandsHydrator-PZUoA872.d.ts} +1 -1
  2. package/dist/_dts/{Page-Dm7_P13o.d.ts → Page-CdQS6C7i.d.ts} +8 -8
  3. package/dist/_dts/{SdkPreviewMode-D7HdWWwF.d.ts → SdkPreviewMode-CNGO-5f1.d.ts} +58 -91
  4. package/dist/_dts/{client-Ep0jI9eE.d.ts → client-DGa53rjL.d.ts} +11 -3
  5. package/dist/_dts/{content-types-BgAzCrBc.d.ts → content-types-K9R7P-KF.d.ts} +2 -2
  6. package/dist/_dts/{contracts-DUiOnj9e.d.ts → contracts-CyBaPaIq.d.ts} +13 -4
  7. package/dist/_dts/{footerPageOutline-B-uXamTG.d.ts → footerPageOutline-B6jmKmon.d.ts} +6 -6
  8. package/dist/_dts/{generatePageMetadata-BDkZYEcS.d.ts → generatePageMetadata-iemoR3AN.d.ts} +2 -2
  9. package/dist/_dts/{index-ylivB7Jj.d.ts → index-8CN0Nd-Z.d.ts} +2 -2
  10. package/dist/_dts/{index-CSsfq6KG.d.ts → index-BtnsA14K.d.ts} +9 -5
  11. package/dist/_dts/{index-BVkP8f70.d.ts → index-C39F9KaB.d.ts} +13 -2
  12. package/dist/_dts/{index-KPrWM0KF.d.ts → index-DEu85xBt.d.ts} +1 -1
  13. package/dist/_dts/{schema-BHu0PYWl.d.ts → index-DI2yaSPY.d.ts} +4099 -3343
  14. package/dist/_dts/{types-BR1Yboa9.d.ts → index-Dbd0Sn0G.d.ts} +3300 -1691
  15. package/dist/_dts/{index-CF6Cjs7b.d.ts → index-Du1IRglc.d.ts} +2 -2
  16. package/dist/_dts/{index-D_8uz4OP.d.ts → index-Jlcq6w69.d.ts} +3 -3
  17. package/dist/_dts/{index-DvKQA6AZ.d.ts → index-Wm62sXf2.d.ts} +4 -4
  18. package/dist/_dts/{loadContent-DTjKOO-T.d.ts → loadContent-BPfAAZDW.d.ts} +10 -7
  19. package/dist/_dts/{resolvePageContent-C1vA5c5w.d.ts → resolvePageContent-DWbrtKf8.d.ts} +2 -2
  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 +6 -6
  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/index.d.ts +8 -8
  27. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  28. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  29. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  30. package/dist/_dts/sdk/src/next/index.d.ts +7 -7
  31. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  32. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  33. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  34. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  35. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  36. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  37. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  38. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  39. package/dist/_dts/sdk/src/rendering/index.d.ts +6 -6
  40. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  41. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  42. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  43. package/dist/_dts/sdk/src/server.d.ts +5 -5
  44. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  45. package/dist/_dts/{types-ZGUiHpDE.d.ts → types-CVv2H4AT.d.ts} +7 -7
  46. package/dist/_dts/{types-D02ngcUH.d.ts → types-CfNG5koF.d.ts} +2 -2
  47. package/dist/_dts/{types-CJXTCF_F.d.ts → types-ClZ-BQL_.d.ts} +3 -3
  48. package/dist/_dts/{validation-BaV565gb.d.ts → validation-BJ6Lf_Dr.d.ts} +4 -4
  49. package/dist/client/{BlocksIslandsHydrator-DTExCJsb.mjs → BlocksIslandsHydrator-COqlgWYU.mjs} +20 -19
  50. package/dist/client/{BookingMailingListNote-BDpxmn1p.mjs → BookingMailingListNote-CFYPDEHH.mjs} +1 -1
  51. package/dist/client/{CalendarNavigationChevron-PeCiL82X.mjs → CalendarNavigationChevron-COBVxgHb.mjs} +6 -6
  52. package/dist/client/{CheckboxChoice-DWexRLf6.mjs → CheckboxChoice-C7X9dJ8A.mjs} +1 -1
  53. package/dist/client/{DemoBookingPortalAccess-3zmIqakW.mjs → DemoBookingPortalAccess-CvT0E9AR.mjs} +26 -10
  54. package/dist/client/{DemoPortalSignInLink-GHi-8BW5.mjs → DemoPortalSignInLink-EBOBN5dT.mjs} +1 -1
  55. package/dist/client/{EventCalendar.client-BxQLY5cX.mjs → EventCalendar.client-U6pKcntV.mjs} +16 -17
  56. package/dist/client/{EventCombined.client-B5bmQ03b.mjs → EventCombined.client-CNzwEHws.mjs} +8 -8
  57. package/dist/client/{EventEmbeddedCheckoutStep-CgMZ9TeU.mjs → EventEmbeddedCheckoutStep-B9yAWV_k.mjs} +1 -1
  58. package/dist/client/{EventItem-BEx-qiDE.mjs → EventItem-M5rpaHxi.mjs} +4 -4
  59. package/dist/client/{EventListWeekNavigation-CyH5tA6Y.mjs → EventListWeekNavigation-D4ieBLDY.mjs} +1 -1
  60. package/dist/client/{EventListing.client-D3uySdGP.mjs → EventListing.client-B8F40Rmn.mjs} +3 -3
  61. package/dist/client/{EventListing.view-9RFrBejr.mjs → EventListing.view-k4lhuCn5.mjs} +14 -21
  62. package/dist/client/{EventRegistrationPayment-CG2tQx8K.mjs → EventRegistrationPayment-C3g8_Hqb.mjs} +10 -10
  63. package/dist/client/LocationMapActions-CAjt7qVo.mjs +62 -0
  64. package/dist/client/{LocationMapActions-Wsr83Q7q.mjs → MapDrawingSvg-_aIK2ojv.mjs} +2 -70
  65. package/dist/client/{Page-Bf2nPACI.mjs → Page-DJBIQBOw.mjs} +1762 -254
  66. package/dist/client/{StepIndicator-CZweb1vs.mjs → StepIndicator-CFacB1z6.mjs} +2 -2
  67. package/dist/client/{TabBarFragment-Bkgz67gt.mjs → TabBarFragment-BLsfQskO.mjs} +1 -1
  68. package/dist/client/{ThemedButton-CnyL3s1A.mjs → ThemedButton-BWsDgjMC.mjs} +1 -1
  69. package/dist/client/{accordion-TcimLLRQ.mjs → accordion-CtO2XF7M.mjs} +1 -1
  70. package/dist/client/{booking-form.client-q-RpJ4aF.mjs → booking-form.client-RICCQ0h2.mjs} +137 -60
  71. package/dist/client/{bookingForm-DjGfk3Wj.mjs → bookingForm-SvjLPx8i.mjs} +4 -4
  72. package/dist/client/bookings.mjs +5 -5
  73. package/dist/client/{carousel-CGAk6j0m.mjs → carousel-BR-zCD3O.mjs} +2 -2
  74. package/dist/client/{carousel.client-ArlGmYWV.mjs → carousel.client-CEWtoZd3.mjs} +1 -1
  75. package/dist/client/{cart-D_h3rAZ2.mjs → cart-C6YpKbZZ.mjs} +3 -3
  76. package/dist/client/{cart.client-DHOxZbJ7.mjs → cart.client-dC938WrX.mjs} +1 -1
  77. package/dist/client/{checkout-tC-3CzuM.mjs → checkout-Dy9RlREI.mjs} +3 -3
  78. package/dist/client/{checkout.client-DsBb2Pkm.mjs → checkout.client-CefG0d2F.mjs} +1 -1
  79. package/dist/client/client.mjs +34 -69
  80. package/dist/client/{context-9ZfMb6GA.mjs → context-BFwxgZpB.mjs} +28 -1
  81. package/dist/client/{cta-D-ZqL7-e.mjs → cta-DtA42Xio.mjs} +1 -1
  82. package/dist/client/{dateFormatting-BCwLqYpW.mjs → dateFormatting-yP1B7F0O.mjs} +39 -2
  83. package/dist/client/{demoPortalMagicLink-BxkSS9fx.mjs → demoPortalMagicLink-WOiT5Ryi.mjs} +1 -1
  84. package/dist/client/{enhanceHeaderSection-xg6to91E.mjs → enhanceHeaderSection-Dh8c_Lq-.mjs} +3 -3
  85. package/dist/client/{event-details.client-C670TgRd.mjs → event-details.client-BFgsLqTj.mjs} +2 -1
  86. package/dist/client/{event-registration.client-C6GApWTB.mjs → event-registration.client-BaXZ1-Ky.mjs} +13 -13
  87. package/dist/client/{eventCalendar-CWc0dg9i.mjs → eventCalendar-COLwF80U.mjs} +4 -4
  88. package/dist/client/{eventCombined-D4DbOrvQ.mjs → eventCombined-D3Ltwu03.mjs} +4 -4
  89. package/dist/client/{eventDetails-C2DfmbC0.mjs → eventDetails-CBrkimXu.mjs} +2 -2
  90. package/dist/client/{eventListing-C_yXmHyz.mjs → eventListing-CedKVA1S.mjs} +4 -4
  91. package/dist/client/{eventRegistration-DJuaCB-O.mjs → eventRegistration-DkQQfR1b.mjs} +4 -4
  92. package/dist/client/{form-QZhtdFHA.mjs → form-XFy9uXSJ.mjs} +3 -3
  93. package/dist/client/{form.client-CgvPACwG.mjs → form.client-B0iancFK.mjs} +4 -4
  94. package/dist/client/{form.parts-2uI0-5N-.mjs → form.parts-DMbolu9Y.mjs} +3 -3
  95. package/dist/client/{formatDate-Danr0Nk4.mjs → formatDate-Jm5MQOCA.mjs} +1 -1
  96. package/dist/client/gifting/client.mjs +3 -3
  97. package/dist/client/{headerSection-DJdlLdvZ.mjs → headerSection-WjlECjtV.mjs} +2 -2
  98. package/dist/client/{mediaAssets-BvjcAZpS.mjs → mediaAssets-BkoW_PEn.mjs} +1 -1
  99. package/dist/client/mediaContext-CNzWmoA4.mjs +136 -0
  100. package/dist/client/{newsletter-form.client-Cbepz2KU.mjs → newsletter-form.client-D-XwJTjN.mjs} +5 -5
  101. package/dist/client/{newsletter-form.parts-DN8oMCQ0.mjs → newsletter-form.parts-H92f30y0.mjs} +2 -2
  102. package/dist/client/{newsletterForm-wjLtW-wq.mjs → newsletterForm-DMuxzu6I.mjs} +3 -3
  103. package/dist/client/{noop-B7H6gCbj.mjs → noop-B3RNPVrt.mjs} +19 -3
  104. package/dist/client/portal/client.mjs +1116 -85
  105. package/dist/client/{product-detail.client-CYTR165c.mjs → product-detail.client-B3HuuykE.mjs} +1 -1
  106. package/dist/client/{product-list.client-B4vTvag8.mjs → product-list.client-CzsDrHQO.mjs} +1 -1
  107. package/dist/client/{productDetail-k8LEMSWn.mjs → productDetail-CbBUVWgd.mjs} +3 -3
  108. package/dist/client/{productList-DEo8Bqoe.mjs → productList-vqOKH2mh.mjs} +3 -3
  109. package/dist/client/{propsDecoder-G0j0HXBO.mjs → propsDecoder-CkSUep5a.mjs} +4 -3
  110. package/dist/client/{registry.server-BTmSXE3D.mjs → registry.server-cZ24QwtW.mjs} +272 -68
  111. package/dist/client/rendering/client.mjs +27 -26
  112. package/dist/client/rendering/islands.mjs +1 -1
  113. package/dist/client/rendering.mjs +10 -7
  114. package/dist/client/{richText-coerce-B19taoH6.mjs → richText-coerce-DDcCKvBJ.mjs} +1 -1
  115. package/dist/client/{routeIslandApiConfig-Chu5BHra.mjs → routeIslandApiConfig-DYBioANh.mjs} +1 -1
  116. package/dist/client/{schema-C-m8XHuW.mjs → schema-DNHLlze-.mjs} +4575 -4311
  117. package/dist/client/{shop-RGWa43H7.mjs → shop-CF0dhnfH.mjs} +3 -3
  118. package/dist/client/{shop-commerce-TJYCBO_H.mjs → shop-commerce-DQznNBEo.mjs} +11 -11
  119. package/dist/client/{shop-commerce-store-CjCcUB_o.mjs → shop-commerce-store-Ba8zPlIg.mjs} +1 -1
  120. package/dist/client/{shop.client-tsKfZw1W.mjs → shop.client-DqfYoqWH.mjs} +12 -12
  121. package/dist/client/{shop.interactive-CVqLAU53.mjs → shop.interactive-CreQ0I7i.mjs} +38 -31
  122. package/dist/client/{shopShared-C3lHMz_R.mjs → shopShared-D-yh-P7g.mjs} +2 -2
  123. package/dist/client/{mediaContext-jPeJ2PmJ.mjs → site-styles-B9HgmY07.mjs} +1329 -511
  124. package/dist/client/{timetableModel-V2ifvGGy.mjs → timetableModel-DCdVErTJ.mjs} +10 -9
  125. package/dist/client/{useAvailableSlots-D1X69-pN.mjs → useAvailableSlots-Cvgdp2DH.mjs} +8 -11
  126. package/dist/client/{useBookingNowIso-Ch30jino.mjs → useBookingNowIso-DrTnGNzD.mjs} +1 -1
  127. package/dist/client/{useDiscountApply-Bwzr1RjV.mjs → useDiscountApply-CULjnXGl.mjs} +2 -2
  128. package/dist/client/{useDiscountCodeUi-BimJbFC7.mjs → useDiscountCodeUi-Gn_m7e0o.mjs} +1 -1
  129. package/dist/client/{useEventPagination-CLAS0upd.mjs → useEventPagination-CsysCF22.mjs} +6 -6
  130. package/dist/client/{view-Dj_FZHmg.mjs → view-BpBjo9Te.mjs} +64 -55
  131. package/dist/client/{view-BUh4LnLS.mjs → view-DMyTchi7.mjs} +4 -4
  132. package/dist/client/{wizardSteps-BkZc-hKH.mjs → wizardSteps-BO2OmMO9.mjs} +59 -53
  133. package/dist/preview-next/before-render.mjs +3 -3
  134. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-CwerMfzn.mjs → EventEmbeddedCheckoutStep-DLsSmZbO.mjs} +1 -1
  135. package/dist/preview-next/client/{PreviewEditorSidebar-Dvq-RW9-.mjs → PreviewEditorSidebar-ChrW9VEo.mjs} +164 -1042
  136. package/dist/preview-next/client/{PreviewEditorUI-BdFjS39R.mjs → PreviewEditorUI-VaHvYtrA.mjs} +9 -190
  137. package/dist/preview-next/client/{SdkPreviewModeRuntime-CjkGh1IG.mjs → SdkPreviewModeRuntime-Bz7jR6nl.mjs} +1 -1
  138. package/dist/preview-next/client/{SdkPreviewModeRuntime-BEfHln1E.mjs → SdkPreviewModeRuntime-DWwktlWs.mjs} +220 -130
  139. package/dist/preview-next/client/{ThemedButton-b14Bv03E.mjs → ThemedButton-CHKOWXxl.mjs} +608 -333
  140. package/dist/preview-next/client/{SiteChromeCustomizeContext-CDbxk_qZ.mjs → previewAuthStore-C0VUwEHz.mjs} +158752 -162808
  141. package/dist/preview-next/client/{previewChromeSurface-Dd1_mNIg.mjs → previewChromeSurface-Dhyx2YrS.mjs} +1 -1
  142. package/dist/preview-next/client/runtime.mjs +3 -3
  143. package/dist/preview-next/client/{sdk-runtime-B-CXyGVb.mjs → sdk-runtime-C2GWOCyj.mjs} +1 -1
  144. package/dist/preview-next/client/siteStyleAccess-DHyzUpv4.mjs +12833 -0
  145. package/dist/preview-next/client/{spinner-CGxS8Ns-.mjs → spinner-BeR2S8oG.mjs} +1 -1
  146. package/dist/preview-next/keepAlive.mjs +2 -2
  147. package/dist/preview-next/middleware.mjs +1 -1
  148. package/dist/preview-next/{refresh-contract-CvmNqZ1Q.mjs → refresh-contract-uQ6BXgLJ.mjs} +5 -0
  149. package/dist/preview-next/{route-contract-hLg-yjQN.mjs → route-contract-CkrFDMrl.mjs} +394 -200
  150. package/dist/server/{Block.shared-CeTd2saO.mjs → Block.shared-DxvNGDig.mjs} +4 -4
  151. package/dist/server/{bindings-C5YpKuKt.mjs → bindings-BuhKvYkE.mjs} +2 -2
  152. package/dist/server/{client-Cv26lZQ4.mjs → client-BobW6DOz.mjs} +34 -69
  153. package/dist/server/config-validation.mjs +1 -1
  154. package/dist/server/config.mjs +2 -2
  155. package/dist/server/{effectiveNavLinkStyle-CGvGr3yD.mjs → effectiveNavLinkStyle-B-MKSt0p.mjs} +1127 -144
  156. package/dist/server/index.mjs +3 -3
  157. package/dist/server/{loadContent-C8a0b-cC.mjs → loadContent-CCG_3mbY.mjs} +7 -4
  158. package/dist/server/loadPage-Bk9HDh9K.mjs +2 -0
  159. package/dist/server/{loadPage-BW7dklu3.mjs → loadPage-jntGoMrf.mjs} +2 -2
  160. package/dist/server/next.mjs +9 -9
  161. package/dist/server/{overrideResolution-tIuqmJB3.mjs → overrideResolution-BBOlgn4Z.mjs} +1 -1
  162. package/dist/server/{overrides-D1fiPOKF.mjs → overrides-DByQwIyW.mjs} +264 -168
  163. package/dist/server/page-converter.mjs +1 -1
  164. package/dist/server/{prebuild--fO0E2tr.mjs → prebuild-DrwcTk2t.mjs} +1 -1
  165. package/dist/server/prebuild.mjs +1 -1
  166. package/dist/server/{prefetchBlockData-CqJnokWJ.mjs → prefetchBlockData-LfgxSJYE.mjs} +31 -10
  167. package/dist/server/{publicProducts-CvvZ4JIe.mjs → publicProducts-8A3T5v4M.mjs} +647 -166
  168. package/dist/server/{registry-BVfCqaCq.mjs → registry-Digv02oV.mjs} +308 -36
  169. package/dist/server/rendering/server.mjs +4 -4
  170. package/dist/server/rendering.mjs +8 -8
  171. package/dist/server/{resolveBlockData-DPNvhXEz.mjs → resolveBlockData-C23t8-77.mjs} +1 -1
  172. package/dist/server/routing.mjs +1 -1
  173. package/dist/server/{schema-CD4peO7m.mjs → schema-BiqpDRwB.mjs} +2813 -2549
  174. package/dist/server/server.mjs +3 -3
  175. package/dist/server/{site-styles-H-EvTJiW.mjs → site-styles-DrkprQPL.mjs} +81 -113
  176. package/dist/server/{siteChromeOverlayClearance-DNC2k1U0.mjs → siteChromeOverlayClearance-BmKKkkbh.mjs} +2 -2
  177. package/dist/server/{src-ILxc6pid.mjs → src-08GY1njw.mjs} +902 -44
  178. package/dist/server/theme-bridge.mjs +1 -1
  179. package/dist/server/theme.mjs +1 -1
  180. package/dist/server/{themeAdmission-BNHIXiUj.mjs → themeAdmission-CSd_Vusz.mjs} +36 -29
  181. package/dist/server/{validation-B1ieVemg.mjs → validation-DdUTkBOZ.mjs} +2 -2
  182. package/dist/server/{version-BQK44wFg.mjs → version-DdIOqIDe.mjs} +1 -1
  183. package/dist/styles/index.css +872 -41
  184. package/package.json +1 -1
  185. package/dist/_dts/index-BQDBQvdu.d.ts +0 -13
  186. package/dist/preview-next/client/siteStyleAccess-Kqk0j0dE.mjs +0 -5812
  187. package/dist/server/loadPage--DXBwI8V.mjs +0 -2
@@ -1,22 +1,22 @@
1
1
  "use client";
2
2
  "use client";
3
- import { dr as unsafeAsAppointmentResourceId } from "../schema-C-m8XHuW.mjs";
4
- import { C as clsx, H as parsePositiveMoneyInputToCents, U as formatCurrencyAmount, V as resolveFlexibleBalancePaymentEligibility, i as ThemedButtonLink, o as ThemedFileChooser, r as ThemedButton, t as ThemedActionsButton, u as SpinnerNode, z as formatOrderInstalmentStatusLabel$1 } from "../ThemedButton-CnyL3s1A.mjs";
3
+ import { mr as unsafeAsAppointmentResourceId } from "../schema-DNHLlze-.mjs";
4
+ import { C as clsx, H as parsePositiveMoneyInputToCents, U as formatCurrencyAmount, V as resolveFlexibleBalancePaymentEligibility, i as ThemedButtonLink, o as ThemedFileChooser, r as ThemedButton, t as ThemedActionsButton, u as SpinnerNode, z as formatOrderInstalmentStatusLabel$1 } from "../ThemedButton-BWsDgjMC.mjs";
5
5
  import { c as assertNever$1, t as assertNever } from "../src-VIsPY-kw.mjs";
6
- import { t as logger } from "../noop-B7H6gCbj.mjs";
6
+ import { t as logger } from "../noop-B3RNPVrt.mjs";
7
7
  import { t as generateUuidV4 } from "../uuid-BETKW8rS.mjs";
8
8
  import { t as resolveDedicatedBookingHref } from "../bookingRoute-Bqlyu5Vb.mjs";
9
- import { t as CheckboxChoice } from "../CheckboxChoice-DWexRLf6.mjs";
10
- import { t as DemoPortalSignInLink } from "../DemoPortalSignInLink-GHi-8BW5.mjs";
9
+ import { t as CheckboxChoice } from "../CheckboxChoice-C7X9dJ8A.mjs";
10
+ import { t as DemoPortalSignInLink } from "../DemoPortalSignInLink-EBOBN5dT.mjs";
11
11
  import { t as ModalShell } from "../ModalShell-B_fHWK71.mjs";
12
- import { t as TabBarFragment } from "../TabBarFragment-Bkgz67gt.mjs";
12
+ import { t as TabBarFragment } from "../TabBarFragment-BLsfQskO.mjs";
13
13
  import { i as getPortalCreditProductCreditNoun, r as getCreditProductTypeLabel, t as deriveCreditProductLabels } from "../creditProducts-BOWi1QLp.mjs";
14
- import { t as formatDate } from "../formatDate-Danr0Nk4.mjs";
15
- import { i as createBlockApi, n as useBlockApi, t as BlockApiProvider } from "../context-9ZfMb6GA.mjs";
16
- import { n as useAvailableDates, t as useAvailableSlots } from "../useAvailableSlots-D1X69-pN.mjs";
17
- import { t as useBookingNowIso } from "../useBookingNowIso-Ch30jino.mjs";
18
- import { n as buildPortalCallbackUrl, r as requestDemoPortalMagicLink } from "../demoPortalMagicLink-BxkSS9fx.mjs";
19
- import { a as isPast, i as formatPortalSession, n as formatDateTime, o as portalSessionDisplay, r as formatEntitlementEnd, t as formatDate$1 } from "../dateFormatting-BCwLqYpW.mjs";
14
+ import { t as formatDate } from "../formatDate-Jm5MQOCA.mjs";
15
+ import { i as createBlockApi, n as useBlockApi, r as BlockApiError, t as BlockApiProvider } from "../context-BFwxgZpB.mjs";
16
+ import { n as useAvailableDates, t as useAvailableSlots } from "../useAvailableSlots-Cvgdp2DH.mjs";
17
+ import { t as useBookingNowIso } from "../useBookingNowIso-DrTnGNzD.mjs";
18
+ import { n as buildPortalCallbackUrl, r as requestDemoPortalMagicLink } from "../demoPortalMagicLink-WOiT5Ryi.mjs";
19
+ import { a as formatPortalSessionDay, c as isPast, i as formatPortalSession, l as portalSessionDisplay, n as formatDateTime, o as formatPortalSessionTime, r as formatEntitlementEnd, s as formatPortalSessionWithWeekday, t as formatDate$1 } from "../dateFormatting-yP1B7F0O.mjs";
20
20
  import * as React$1 from "react";
21
21
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useId, useMemo, useReducer, useRef, useState } from "react";
22
22
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -5734,6 +5734,222 @@ function BeforeYouComeTaskDisplay({ task, ...props }) {
5734
5734
  });
5735
5735
  }
5736
5736
  //#endregion
5737
+ //#region ../blocks/src/customer-portal/components/bookings/portalEventReschedulePresentation.ts
5738
+ const studioName = (studio) => studio?.trim() || "the organiser";
5739
+ function firstName(name) {
5740
+ return name.trim().split(/\s+/)[0] ?? name;
5741
+ }
5742
+ function joinNames(names) {
5743
+ if (names.length <= 1) return names[0] ?? "";
5744
+ return `${names.slice(0, -1).join(", ")} and ${names.at(-1) ?? ""}`;
5745
+ }
5746
+ const guestCount = (subject) => Math.max(0, subject.ticketsCount - 1);
5747
+ /** Every guest has a name, so the copy can use them. */
5748
+ const allGuestsNamed = (subject) => guestCount(subject) > 0 && subject.guestNames.length === guestCount(subject);
5749
+ function guestsPhrase(count) {
5750
+ return count === 1 ? "your guest" : `your ${count} guests`;
5751
+ }
5752
+ /** "you, Tom Nair and Asha Patel", or "you and your 2 guests". */
5753
+ function everyonePhrase(subject) {
5754
+ if (allGuestsNamed(subject)) return joinNames(["you", ...subject.guestNames]);
5755
+ return `you and ${guestsPhrase(guestCount(subject))}`;
5756
+ }
5757
+ const sessionFacts = (facts) => ({
5758
+ timeZone: facts.timeZone,
5759
+ isOnline: facts.isOnline
5760
+ });
5761
+ const dateFacts = (date) => ({
5762
+ timeZone: date.timeZone,
5763
+ isOnline: date.attendanceMode === "online"
5764
+ });
5765
+ function whereLine(date) {
5766
+ return date.attendanceMode === "online" ? "Online" : date.venueName;
5767
+ }
5768
+ /** The booking's own date, as the flow's first card shows it. */
5769
+ function rescheduleCurrentCard(subject, site) {
5770
+ const when = formatPortalSessionWithWeekday(subject.startsAt, subject.endsAt, sessionFacts(subject), site);
5771
+ const where = subject.isOnline ? "Online" : subject.venueName;
5772
+ const tickets = subject.ticketsCount === 1 ? "1 ticket" : `${subject.ticketsCount} tickets: ${everyonePhrase(subject)}`;
5773
+ return {
5774
+ title: subject.title,
5775
+ current: `Current date: ${[when, where].filter(Boolean).join(", ")}`,
5776
+ tickets
5777
+ };
5778
+ }
5779
+ function reschedulePickLead(subject) {
5780
+ if (guestCount(subject) === 0) return "Choose a new date for your booking.";
5781
+ return `Choose a new date. Your whole booking moves together, so ${allGuestsNamed(subject) ? joinNames(subject.guestNames.map(firstName)) : guestsPhrase(guestCount(subject))} will come with you.`;
5782
+ }
5783
+ const BLOCKED_BADGES = {
5784
+ full: "Full",
5785
+ already_booked: "Already booked",
5786
+ not_bookable: "Not available",
5787
+ ticket_not_usable: "Ticket not accepted",
5788
+ pass_not_accepted: "Not covered",
5789
+ tickets_collide: "Not available"
5790
+ };
5791
+ function placesLeft(date) {
5792
+ return date.capacity.kind === "bounded" ? Math.max(0, date.capacity.availableSeats) : 0;
5793
+ }
5794
+ /** Why a date can't be chosen, as its badge, and anything added to its where line. */
5795
+ function unavailableView(date, places) {
5796
+ const { assessment } = date;
5797
+ if (assessment.kind === "blocked") {
5798
+ const { reason } = assessment;
5799
+ return reason === "not_enough_room" ? {
5800
+ badge: `${placesLeft(date)} left`,
5801
+ extra: `you need ${places} places`
5802
+ } : {
5803
+ badge: BLOCKED_BADGES[reason],
5804
+ extra: null
5805
+ };
5806
+ }
5807
+ return {
5808
+ badge: assessment.kind === "needs_capacity_override" ? "Full" : "Not available",
5809
+ extra: null
5810
+ };
5811
+ }
5812
+ function rescheduleDateOption(date, places, site) {
5813
+ const when = formatPortalSessionWithWeekday(date.startsAt, date.endsAt, dateFacts(date), site);
5814
+ if (date.assessment.kind === "selectable") return {
5815
+ occurrenceId: date.occurrenceId,
5816
+ when,
5817
+ where: whereLine(date),
5818
+ badge: null,
5819
+ choosable: true
5820
+ };
5821
+ const unavailable = unavailableView(date, places);
5822
+ const where = [whereLine(date), unavailable.extra].filter(Boolean).join(" · ") || null;
5823
+ return {
5824
+ occurrenceId: date.occurrenceId,
5825
+ when,
5826
+ where,
5827
+ badge: unavailable.badge,
5828
+ choosable: false
5829
+ };
5830
+ }
5831
+ /** "You can reschedule this booking until 6:30pm on Mon 19 Oct." Null when it's open right up to the start. */
5832
+ function rescheduleUntilLine(until, subject, site) {
5833
+ if (!until || until === subject.startsAt) return null;
5834
+ return `You can reschedule this booking until ${formatPortalSessionTime(until, sessionFacts(subject), site)} on ${formatPortalSessionDay(until, sessionFacts(subject), site)}.`;
5835
+ }
5836
+ function rescheduleNoDates(subject) {
5837
+ return {
5838
+ lead: "There aren't any other dates you can move this booking to at the moment.",
5839
+ detail: `Dates only show here if they have ${subject.ticketsCount === 1 ? "room for you" : `room for all ${subject.ticketsCount} of you`}. If you'd still like to change your booking, get in touch with ${studioName(subject.studio)} and they can help.`
5840
+ };
5841
+ }
5842
+ function noticePoints(date) {
5843
+ if (date.assessment.kind !== "selectable") return [];
5844
+ return date.assessment.notices.map((notice) => notice.kind === "venue_changed" ? `The new date is at ${date.venueName ?? "a different venue"}.` : notice.to === "online" ? "You'll join online on the new date, not in person." : "You'll come in person on the new date, not online.");
5845
+ }
5846
+ /** The confirm step: from and to, and what follows from the change. */
5847
+ function rescheduleConfirmSummary(subject, date, site) {
5848
+ const fromDay = formatPortalSessionDay(subject.startsAt, sessionFacts(subject), site);
5849
+ const toDay = formatPortalSessionDay(date.startsAt, dateFacts(date), site);
5850
+ const places = subject.ticketsCount === 1 ? "Your place" : "Your places";
5851
+ return {
5852
+ from: {
5853
+ when: formatPortalSessionWithWeekday(subject.startsAt, subject.endsAt, sessionFacts(subject), site),
5854
+ where: subject.isOnline ? "Online" : subject.venueName
5855
+ },
5856
+ to: {
5857
+ when: formatPortalSessionWithWeekday(date.startsAt, date.endsAt, dateFacts(date), site),
5858
+ where: whereLine(date)
5859
+ },
5860
+ points: [
5861
+ subject.ticketsCount === 1 ? `You'll be booked on ${toDay} instead.` : `This moves all ${subject.ticketsCount} tickets, so ${everyonePhrase(subject)} will be booked on ${toDay}.`,
5862
+ ...noticePoints(date),
5863
+ "There's nothing more to pay. Your payment moves across with the booking.",
5864
+ `${places} on ${fromDay} ${subject.ticketsCount === 1 ? "goes" : "go"} back on sale as soon as you confirm.`,
5865
+ subject.ticketingEnabled ? "We'll email you the new details, with your new ticket." : "We'll email you the new details."
5866
+ ]
5867
+ };
5868
+ }
5869
+ /** The result, inside the dialog. */
5870
+ function rescheduleDoneSummary(subject, date, site) {
5871
+ const day = formatPortalSessionDay(date.startsAt, dateFacts(date), site);
5872
+ const where = date.attendanceMode === "online" ? "online" : date.venueName ? `at ${date.venueName}` : null;
5873
+ const time = [date.startsAt, date.endsAt].map((instant) => formatPortalSessionTime(instant, dateFacts(date), site)).join("–");
5874
+ const who = subject.ticketsCount === 1 ? "" : `, for ${everyonePhrase(subject)}`;
5875
+ return {
5876
+ title: `You're booked for ${day}`,
5877
+ detail: `${[`${date.title}, ${time}`, where].filter(Boolean).join(" ")}${who}.`,
5878
+ followUp: subject.ticketingEnabled ? "We'll email you the new details. Your ticket has changed, so use the new one below or from your email, because the old one won't scan any more." : "We'll email you the new details."
5879
+ };
5880
+ }
5881
+ /** The note left on the booking's row once the dialog closes. */
5882
+ function rescheduledRowNote(date, site) {
5883
+ return `Booking moved to ${formatPortalSessionDay(date.startsAt, dateFacts(date), site)}, ${formatPortalSessionTime(date.startsAt, dateFacts(date), site)}. We'll email you the new details.`;
5884
+ }
5885
+ /** When the booking turns out not to be reschedulable once the dialog opens. */
5886
+ function rescheduleUnavailableMessage(source, studio) {
5887
+ return source.kind === "closed" ? `Rescheduling has closed for this booking. If you can't make it, get in touch with ${studioName(studio)}.` : `This booking can't be rescheduled here. If you need to change it, get in touch with ${studioName(studio)}.`;
5888
+ }
5889
+ const ACTION_NOUNS = {
5890
+ reschedule: "Rescheduling",
5891
+ transfer: "Transfers",
5892
+ cancel: "Cancelling"
5893
+ };
5894
+ const ACTION_HELP = {
5895
+ reschedule: "If you can't make it",
5896
+ transfer: "If someone else needs your place",
5897
+ cancel: "If you need help with your booking"
5898
+ };
5899
+ function hoursLabel(hours) {
5900
+ if (hours >= 48 && hours % 24 === 0) return `${hours / 24} days`;
5901
+ return hours === 1 ? "1 hour" : `${hours} hours`;
5902
+ }
5903
+ /** "24 hours before the class starts" or "when the course started". */
5904
+ function closedWhen(closedAt, facts) {
5905
+ const hours = Math.round((Date.parse(facts.startsAt) - Date.parse(closedAt)) / 36e5);
5906
+ return hours > 0 ? `${hoursLabel(hours)} before the ${facts.kind} starts` : `when the ${facts.kind} started`;
5907
+ }
5908
+ /**
5909
+ * Greyed with the time it closed when the action exists for this booking but
5910
+ * its time has passed; hidden when it was never on offer (switched off, a
5911
+ * course booking, checked in). Decided by Will for all three actions.
5912
+ */
5913
+ function portalActionTile(action, availability, facts, site) {
5914
+ switch (availability.kind) {
5915
+ case "available": return { kind: "offered" };
5916
+ case "not_offered": return { kind: "hidden" };
5917
+ case "closed": {
5918
+ const display = sessionFacts(facts);
5919
+ const at = `${formatPortalSessionTime(availability.closedAt, display, site)} on ${formatPortalSessionDay(availability.closedAt, display, site)}`;
5920
+ return {
5921
+ kind: "greyed",
5922
+ description: `${ACTION_NOUNS[action]} closed ${closedWhen(availability.closedAt, facts)}, at ${at}. ${ACTION_HELP[action]}, get in touch with ${studioName(facts.studio)}.`
5923
+ };
5924
+ }
5925
+ }
5926
+ }
5927
+ const HIDDEN = { kind: "hidden" };
5928
+ /**
5929
+ * The three change actions on a single-date booking's row. A server that sends
5930
+ * `availability` has decided from the action table, and its answer maps
5931
+ * straight to tiles (a started class greys Cancel and Transfer with when they
5932
+ * closed; the server hides what a handed-on or cancelled row can't do).
5933
+ * Older servers send only the booleans (no Reschedule), so the row's own check
5934
+ * (`olderServerRowOpen`: not past, cancelled or handed on) applies to them alone.
5935
+ */
5936
+ function portalEventActionTiles(actions, olderServerRowOpen, facts, site) {
5937
+ const { availability } = actions;
5938
+ if (!availability) {
5939
+ const offered = (on) => olderServerRowOpen && on ? { kind: "offered" } : HIDDEN;
5940
+ return {
5941
+ reschedule: HIDDEN,
5942
+ transfer: offered(actions.canTransfer),
5943
+ cancel: offered(actions.canCancel)
5944
+ };
5945
+ }
5946
+ return {
5947
+ reschedule: portalActionTile("reschedule", availability.reschedule, facts, site),
5948
+ transfer: portalActionTile("transfer", availability.transfer, facts, site),
5949
+ cancel: portalActionTile("cancel", availability.cancel, facts, site)
5950
+ };
5951
+ }
5952
+ //#endregion
5737
5953
  //#region ../blocks/src/customer-portal/components/bookings/eventSeriesRegistrationPresentation.ts
5738
5954
  function assertEventSeriesRegistrationHasSessions(enrollment) {
5739
5955
  if (enrollment.sessions.length === 0) throw new Error(`Event series registration ${enrollment.id} must include at least one session.`);
@@ -5769,6 +5985,24 @@ function getSessionDatesSummary(enrollment, context) {
5769
5985
  function getEventSessionCountLabel(enrollment) {
5770
5986
  return `${enrollment.sessionsCount} session${enrollment.sessionsCount === 1 ? "" : "s"}`;
5771
5987
  }
5988
+ /**
5989
+ * Cancel on a course row, from the booking action table when the server sends
5990
+ * it (the course cancel write asks the same cell), so a course past its first
5991
+ * session greys Cancel with when it closed. Older servers send nothing, and
5992
+ * the row keeps its own check (`isPast` and status) for them only.
5993
+ */
5994
+ function courseCancelTile(enrollment, isPast, siteTitle, context) {
5995
+ const availability = enrollment.actions?.availability.cancel;
5996
+ if (!availability) return !isPast && enrollment.status !== "cancelled" && enrollment.status !== "completed" ? { kind: "offered" } : { kind: "hidden" };
5997
+ const first = getSortedEventSessions(enrollment)[0];
5998
+ return portalActionTile("cancel", availability, {
5999
+ startsAt: first.startsAt,
6000
+ timeZone: first.timeZone,
6001
+ isOnline: enrollment.isOnline ?? false,
6002
+ kind: "course",
6003
+ studio: siteTitle
6004
+ }, context);
6005
+ }
5772
6006
  //#endregion
5773
6007
  //#region ../blocks/src/customer-portal/components/bookings/EventSeriesRegistrationTableRow.tsx
5774
6008
  function RegistrationDetails({ enrollment, primaryDateLabel, sessionDatesSummary, sessionCountLabel, statusBadge }) {
@@ -6039,7 +6273,7 @@ function getWholeSeriesNonEnrolledBadge(enrollment) {
6039
6273
  label: getEventSeriesRegistrationStatusLabel(enrollment)
6040
6274
  };
6041
6275
  }
6042
- function EventSeriesRegistrationDialogs({ enrollment, actionsOpen, setActionsOpen, canViewEventDetails, canCancel, cancelFlow }) {
6276
+ function EventSeriesRegistrationDialogs({ enrollment, actionsOpen, setActionsOpen, canViewEventDetails, cancelTile, cancelFlow }) {
6043
6277
  return /* @__PURE__ */ jsxs(Fragment, { children: [actionsOpen ? /* @__PURE__ */ jsx(PortalModal, {
6044
6278
  title: "Actions",
6045
6279
  titleId: `cp-actions-course-${enrollment.id}`,
@@ -6057,29 +6291,48 @@ function EventSeriesRegistrationDialogs({ enrollment, actionsOpen, setActionsOpe
6057
6291
  className: "cp-action-tile__desc",
6058
6292
  children: "View the event page."
6059
6293
  })]
6060
- }) : null, canCancel ? /* @__PURE__ */ jsxs("button", {
6061
- type: "button",
6062
- className: "rb-tile rb-tile--interactive cp-action-tile cp-action-tile--danger",
6063
- disabled: cancelFlow.submitting,
6064
- onClick: () => {
6065
- cancelFlow.clearFeedback();
6066
- setActionsOpen(false);
6067
- cancelFlow.startCancelFlow();
6068
- },
6069
- children: [/* @__PURE__ */ jsx("div", {
6070
- className: "cp-action-tile__title",
6071
- children: "Cancel booking"
6072
- }), /* @__PURE__ */ jsx("div", {
6073
- className: "cp-action-tile__desc",
6074
- children: "Cancels every session in this booking."
6075
- })]
6076
- }) : null]
6294
+ }) : null, /* @__PURE__ */ jsx(CourseCancelTile, {
6295
+ tile: cancelTile,
6296
+ cancelFlow,
6297
+ close: () => setActionsOpen(false)
6298
+ })]
6077
6299
  })
6078
6300
  }) : null, /* @__PURE__ */ jsx(EventSeriesCancellationDialog, {
6079
6301
  enrollmentId: enrollment.id,
6080
6302
  cancelFlow
6081
6303
  })] });
6082
6304
  }
6305
+ function CourseCancelTile({ tile, cancelFlow, close }) {
6306
+ if (tile.kind === "greyed") return /* @__PURE__ */ jsxs("div", {
6307
+ className: "rb-tile cp-action-tile cp-action-tile--unavailable",
6308
+ "aria-disabled": "true",
6309
+ children: [/* @__PURE__ */ jsx("div", {
6310
+ className: "cp-action-tile__title",
6311
+ children: "Cancel booking"
6312
+ }), /* @__PURE__ */ jsx("div", {
6313
+ className: "cp-action-tile__desc",
6314
+ children: tile.description
6315
+ })]
6316
+ });
6317
+ if (tile.kind === "hidden") return null;
6318
+ return /* @__PURE__ */ jsxs("button", {
6319
+ type: "button",
6320
+ className: "rb-tile rb-tile--interactive cp-action-tile cp-action-tile--danger",
6321
+ disabled: cancelFlow.submitting,
6322
+ onClick: () => {
6323
+ cancelFlow.clearFeedback();
6324
+ close();
6325
+ cancelFlow.startCancelFlow();
6326
+ },
6327
+ children: [/* @__PURE__ */ jsx("div", {
6328
+ className: "cp-action-tile__title",
6329
+ children: "Cancel booking"
6330
+ }), /* @__PURE__ */ jsx("div", {
6331
+ className: "cp-action-tile__desc",
6332
+ children: "Cancels every session in this booking."
6333
+ })]
6334
+ });
6335
+ }
6083
6336
  function EventSeriesCancellationDialog({ enrollmentId, cancelFlow }) {
6084
6337
  if (cancelFlow.dialog.tag === "closed") return null;
6085
6338
  const withoutRefund = cancelFlow.dialog.tag === "confirmWithoutRefund";
@@ -6107,7 +6360,7 @@ function EventSeriesCancellationDialog({ enrollmentId, cancelFlow }) {
6107
6360
  })]
6108
6361
  });
6109
6362
  }
6110
- function EventSeriesRegistrationRow({ enrollment, isPast = false, showActionsColumn = true, onRefresh }) {
6363
+ function EventSeriesRegistrationRow({ enrollment, siteTitle, isPast = false, showActionsColumn = true, onRefresh }) {
6111
6364
  const { context } = usePortalDateDisplay();
6112
6365
  const api = useBlockApi();
6113
6366
  const [actionsOpen, setActionsOpen] = React$1.useState(false);
@@ -6115,13 +6368,13 @@ function EventSeriesRegistrationRow({ enrollment, isPast = false, showActionsCol
6115
6368
  cancel: React$1.useCallback((opts) => api.cancelWholeSeriesRegistration(enrollment.id, { confirmCancelWithoutRefund: opts?.confirmCancelWithoutRefund }), [api, enrollment.id]),
6116
6369
  onRefresh
6117
6370
  });
6118
- const { primaryDateLabel, sessionDatesSummary, sessionCountLabel, canCancel, canViewEventDetails, hasAnyActions, statusBadge, isMuted, additionalParticipants } = presentEventSeriesRegistration(enrollment, isPast, context);
6371
+ const { primaryDateLabel, sessionDatesSummary, sessionCountLabel, cancelTile, canViewEventDetails, hasAnyActions, statusBadge, isMuted, additionalParticipants } = presentEventSeriesRegistration(enrollment, isPast, siteTitle, context);
6119
6372
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(EventSeriesRegistrationDialogs, {
6120
6373
  enrollment,
6121
6374
  actionsOpen,
6122
6375
  setActionsOpen,
6123
6376
  canViewEventDetails,
6124
- canCancel,
6377
+ cancelTile,
6125
6378
  cancelFlow
6126
6379
  }), /* @__PURE__ */ jsx(EventSeriesRegistrationTableRow, {
6127
6380
  enrollment,
@@ -6138,16 +6391,16 @@ function EventSeriesRegistrationRow({ enrollment, isPast = false, showActionsCol
6138
6391
  onRefresh
6139
6392
  })] });
6140
6393
  }
6141
- function presentEventSeriesRegistration(enrollment, isPast, context) {
6142
- const canCancel = !isPast && enrollment.status !== "cancelled" && enrollment.status !== "completed";
6394
+ function presentEventSeriesRegistration(enrollment, isPast, siteTitle, context) {
6395
+ const cancelTile = courseCancelTile(enrollment, isPast, siteTitle, context);
6143
6396
  const canViewEventDetails = Boolean(enrollment.eventPath);
6144
6397
  return {
6145
6398
  primaryDateLabel: getPrimaryEventSessionDateLabel(enrollment, context),
6146
6399
  sessionDatesSummary: getSessionDatesSummary(enrollment, context),
6147
6400
  sessionCountLabel: getEventSessionCountLabel(enrollment),
6148
- canCancel,
6401
+ cancelTile,
6149
6402
  canViewEventDetails,
6150
- hasAnyActions: canCancel || canViewEventDetails,
6403
+ hasAnyActions: cancelTile.kind !== "hidden" || canViewEventDetails,
6151
6404
  statusBadge: getWholeSeriesNonEnrolledBadge(enrollment),
6152
6405
  isMuted: isPast || enrollment.status === "cancelled",
6153
6406
  additionalParticipants: enrollment.participants.filter((participant) => !participant.isBooker)
@@ -6166,7 +6419,778 @@ function buildEventGuestDrafts(rows, expectedGuestCount) {
6166
6419
  });
6167
6420
  }
6168
6421
  //#endregion
6422
+ //#region ../blocks/src/customer-portal/components/bookings/portalEventReschedule.state.ts
6423
+ const RESCHEDULE_UNCERTAIN_MESSAGE = "We couldn't confirm whether your booking moved. Try again to finish the same change. It won't be moved twice.";
6424
+ const IDLE = { kind: "idle" };
6425
+ function openReschedule(commandId) {
6426
+ return {
6427
+ status: "open",
6428
+ commandId,
6429
+ step: "pick",
6430
+ booking: null,
6431
+ until: null,
6432
+ list: { status: "loading" },
6433
+ selectedId: null,
6434
+ submission: IDLE,
6435
+ message: null,
6436
+ stale: false
6437
+ };
6438
+ }
6439
+ /** Only dates the server marked selectable can be chosen. */
6440
+ function isSelectableDate(date) {
6441
+ return date.assessment.kind === "selectable";
6442
+ }
6443
+ function selectedRescheduleDate(state) {
6444
+ if (state.list.status !== "loaded" || !state.selectedId) return null;
6445
+ return state.list.dates.find((date) => date.occurrenceId === state.selectedId) ?? null;
6446
+ }
6447
+ /**
6448
+ * The date the confirm step shows: the frozen request's while one is
6449
+ * unanswered (whatever the list does meanwhile), otherwise the selected one.
6450
+ */
6451
+ function confirmingRescheduleDate(state) {
6452
+ return state.submission.kind === "idle" ? selectedRescheduleDate(state) : state.submission.frozen.date;
6453
+ }
6454
+ /** Nothing on any loaded page can be chosen, and there are no more pages to look at. */
6455
+ function noDatesToChoose(state) {
6456
+ return state.list.status === "loaded" && state.list.nextPage === null && !state.list.dates.some(isSelectableDate);
6457
+ }
6458
+ /** Whether the choice can still change: not while a request is unanswered. */
6459
+ function rescheduleEditable(state) {
6460
+ return state.submission.kind === "idle" && !state.stale;
6461
+ }
6462
+ function canContinueReschedule(state) {
6463
+ const date = selectedRescheduleDate(state);
6464
+ return date !== null && isSelectableDate(date) && rescheduleEditable(state);
6465
+ }
6466
+ /** What the customer reviewed, for the write to hold: their booking as first read, and the date as listed. */
6467
+ function rescheduleConfirmation(subject, booking, date) {
6468
+ return {
6469
+ source: {
6470
+ occurrenceId: subject.occurrenceId,
6471
+ startsAt: subject.startsAt,
6472
+ ...booking
6473
+ },
6474
+ target: {
6475
+ startsAt: date.startsAt,
6476
+ venueId: date.venueId,
6477
+ attendanceMode: date.attendanceMode
6478
+ }
6479
+ };
6480
+ }
6481
+ function freshSubmission(state, subject) {
6482
+ const date = selectedRescheduleDate(state);
6483
+ if (!date || state.step !== "confirm" || !state.booking || !isSelectableDate(date)) return null;
6484
+ return {
6485
+ date,
6486
+ request: {
6487
+ commandId: state.commandId,
6488
+ occurrenceId: date.occurrenceId,
6489
+ confirmation: rescheduleConfirmation(subject, state.booking, date)
6490
+ }
6491
+ };
6492
+ }
6493
+ /** The request to send now: the frozen one after a lost answer, otherwise one built from the choice. */
6494
+ function nextRescheduleSubmission(state, subject) {
6495
+ if (state.status !== "open" || state.stale) return null;
6496
+ switch (state.submission.kind) {
6497
+ case "submitting": return null;
6498
+ case "uncertain": return state.submission.frozen;
6499
+ case "idle": return freshSubmission(state, subject);
6500
+ }
6501
+ }
6502
+ /** A server's error answer means nothing was written; no answer, or a server fault, leaves it unknown. */
6503
+ function rescheduleFailureEvent(error) {
6504
+ return error.status !== null && error.status < 500 ? {
6505
+ type: "submitRejected",
6506
+ message: error.message
6507
+ } : { type: "submitLost" };
6508
+ }
6509
+ /** What one refusal means for the dialog: choose another date, or nothing more to do here. */
6510
+ function rescheduleRefusalOutcome(reason) {
6511
+ switch (reason) {
6512
+ case "target_full":
6513
+ case "target_not_bookable":
6514
+ case "target_changed":
6515
+ case "already_booked_on_target":
6516
+ case "ticket_not_usable": return "pick_again";
6517
+ case "source_changed":
6518
+ case "source_unavailable":
6519
+ case "not_found": return "stale";
6520
+ }
6521
+ }
6522
+ function listLoaded(state, page, append) {
6523
+ if (page.source.kind !== "available") return {
6524
+ status: "unavailable",
6525
+ source: page.source
6526
+ };
6527
+ const earlier = append && state.list.status === "loaded" ? state.list.dates : [];
6528
+ const shown = new Set(earlier.map((date) => date.occurrenceId));
6529
+ const dates = [...earlier, ...page.dates.filter((date) => !shown.has(date.occurrenceId))];
6530
+ return {
6531
+ ...state,
6532
+ booking: state.booking ?? page.booking,
6533
+ until: page.source.until,
6534
+ list: {
6535
+ status: "loaded",
6536
+ dates,
6537
+ nextPage: page.nextPage,
6538
+ loadingMore: false
6539
+ }
6540
+ };
6541
+ }
6542
+ function answered(state, result) {
6543
+ if (state.submission.kind === "idle") return state;
6544
+ if (result.moved) return {
6545
+ status: "done",
6546
+ date: state.submission.frozen.date
6547
+ };
6548
+ const settled = {
6549
+ ...state,
6550
+ submission: IDLE,
6551
+ message: result.message
6552
+ };
6553
+ return rescheduleRefusalOutcome(result.reason) === "stale" ? {
6554
+ ...settled,
6555
+ stale: true
6556
+ } : {
6557
+ ...settled,
6558
+ step: "pick",
6559
+ list: { status: "loading" },
6560
+ selectedId: null
6561
+ };
6562
+ }
6563
+ function listFailed(state, message, append) {
6564
+ return append && state.list.status === "loaded" ? {
6565
+ ...state,
6566
+ list: {
6567
+ ...state.list,
6568
+ loadingMore: false
6569
+ },
6570
+ message
6571
+ } : {
6572
+ ...state,
6573
+ list: {
6574
+ status: "failed",
6575
+ message
6576
+ }
6577
+ };
6578
+ }
6579
+ /** The list stops waiting for a page, and nothing else changes. */
6580
+ function listSettled(state) {
6581
+ return state.list.status === "loaded" ? {
6582
+ ...state,
6583
+ list: {
6584
+ ...state.list,
6585
+ loadingMore: false
6586
+ }
6587
+ } : state;
6588
+ }
6589
+ /**
6590
+ * A page's answer, for this dialog only. While a request is unanswered the
6591
+ * frozen request owns the dialog, so a late page is dropped (it can be loaded
6592
+ * again afterwards): it can't replace the list or close the dialog under it.
6593
+ * A further page nobody is waiting for any more (the list was reloaded) is dropped too.
6594
+ */
6595
+ function onListResponse(state, event) {
6596
+ if (event.commandId !== state.commandId) return state;
6597
+ if (state.submission.kind !== "idle") return listSettled(state);
6598
+ if (event.append && !(state.list.status === "loaded" && state.list.loadingMore)) return state;
6599
+ return event.type === "listLoaded" ? listLoaded(state, event.page, event.append) : listFailed(state, event.message, event.append);
6600
+ }
6601
+ function onListEvent(state, event) {
6602
+ switch (event.type) {
6603
+ case "listLoaded":
6604
+ case "listFailed": return onListResponse(state, event);
6605
+ case "moreRequested": return state.list.status === "loaded" ? {
6606
+ ...state,
6607
+ list: {
6608
+ ...state.list,
6609
+ loadingMore: true
6610
+ }
6611
+ } : state;
6612
+ case "listReloading": return {
6613
+ ...state,
6614
+ list: { status: "loading" }
6615
+ };
6616
+ }
6617
+ }
6618
+ function onEditEvent(state, event) {
6619
+ if (!rescheduleEditable(state)) return state;
6620
+ switch (event.type) {
6621
+ case "selected": return {
6622
+ ...state,
6623
+ selectedId: event.occurrenceId,
6624
+ message: null
6625
+ };
6626
+ case "continued": return canContinueReschedule(state) ? {
6627
+ ...state,
6628
+ step: "confirm",
6629
+ message: null
6630
+ } : state;
6631
+ case "back": return {
6632
+ ...state,
6633
+ step: "pick",
6634
+ message: null
6635
+ };
6636
+ }
6637
+ }
6638
+ function onSubmitEvent(state, subject, event) {
6639
+ if (event.type === "submitStarted") {
6640
+ const frozen = nextRescheduleSubmission(state, subject);
6641
+ return frozen ? {
6642
+ ...state,
6643
+ submission: {
6644
+ kind: "submitting",
6645
+ frozen
6646
+ },
6647
+ message: null
6648
+ } : state;
6649
+ }
6650
+ if (state.submission.kind !== "submitting") return state;
6651
+ switch (event.type) {
6652
+ case "submitRejected": return {
6653
+ ...state,
6654
+ submission: IDLE,
6655
+ message: event.message
6656
+ };
6657
+ case "submitLost": return {
6658
+ ...state,
6659
+ submission: {
6660
+ kind: "uncertain",
6661
+ frozen: state.submission.frozen
6662
+ },
6663
+ message: RESCHEDULE_UNCERTAIN_MESSAGE
6664
+ };
6665
+ case "answered": return answered(state, event.result);
6666
+ }
6667
+ }
6668
+ function rescheduleReducer(subject) {
6669
+ return (state, event) => {
6670
+ if (state.status !== "open") return state;
6671
+ switch (event.type) {
6672
+ case "listLoaded":
6673
+ case "listFailed":
6674
+ case "moreRequested":
6675
+ case "listReloading": return onListEvent(state, event);
6676
+ case "selected":
6677
+ case "continued":
6678
+ case "back": return onEditEvent(state, event);
6679
+ case "submitStarted":
6680
+ case "submitRejected":
6681
+ case "submitLost":
6682
+ case "answered": return onSubmitEvent(state, subject, event);
6683
+ }
6684
+ };
6685
+ }
6686
+ //#endregion
6687
+ //#region ../blocks/src/customer-portal/components/bookings/usePortalEventReschedule.ts
6688
+ const LIST_FAILED = "We couldn't load the other dates. Please try again.";
6689
+ const SUBMIT_FAILED = "We couldn't reschedule your booking. Please try again.";
6690
+ function errorFacts(error, fallback) {
6691
+ return error instanceof BlockApiError ? {
6692
+ status: error.status,
6693
+ message: error.message || fallback
6694
+ } : {
6695
+ status: null,
6696
+ message: fallback
6697
+ };
6698
+ }
6699
+ /** The effects around the reschedule state: load pages of dates, and send (or resend) the frozen request. */
6700
+ function usePortalEventReschedule(subject) {
6701
+ const api = useBlockApi();
6702
+ const reducer = React$1.useMemo(() => rescheduleReducer(subject), [subject]);
6703
+ const [state, dispatch] = React$1.useReducer(reducer, void 0, () => openReschedule(generateUuidV4()));
6704
+ const commandId = state.status === "open" ? state.commandId : null;
6705
+ const listStatus = state.status === "open" ? state.list.status : null;
6706
+ const loadPage = React$1.useCallback(async (append, cursor) => {
6707
+ if (!commandId) return;
6708
+ try {
6709
+ dispatch({
6710
+ type: "listLoaded",
6711
+ commandId,
6712
+ page: await api.listEventRescheduleDates(subject.registrationId, {
6713
+ limit: 10,
6714
+ ...cursor
6715
+ }),
6716
+ append
6717
+ });
6718
+ } catch (error) {
6719
+ dispatch({
6720
+ type: "listFailed",
6721
+ commandId,
6722
+ message: errorFacts(error, LIST_FAILED).message,
6723
+ append
6724
+ });
6725
+ }
6726
+ }, [
6727
+ api,
6728
+ commandId,
6729
+ subject.registrationId
6730
+ ]);
6731
+ React$1.useEffect(() => {
6732
+ if (listStatus === "loading") loadPage(false);
6733
+ }, [listStatus, loadPage]);
6734
+ return {
6735
+ state,
6736
+ dispatch,
6737
+ loadMore: React$1.useCallback(() => {
6738
+ if (state.status !== "open" || state.list.status !== "loaded" || !state.list.nextPage) return;
6739
+ dispatch({ type: "moreRequested" });
6740
+ loadPage(true, state.list.nextPage);
6741
+ }, [loadPage, state]),
6742
+ submit: React$1.useCallback(async () => {
6743
+ const submission = nextRescheduleSubmission(state, subject);
6744
+ if (!submission) return;
6745
+ dispatch({ type: "submitStarted" });
6746
+ try {
6747
+ dispatch({
6748
+ type: "answered",
6749
+ result: await api.rescheduleEventRegistration(subject.registrationId, submission.request)
6750
+ });
6751
+ } catch (error) {
6752
+ dispatch(rescheduleFailureEvent(errorFacts(error, SUBMIT_FAILED)));
6753
+ }
6754
+ }, [
6755
+ api,
6756
+ state,
6757
+ subject
6758
+ ]),
6759
+ retryList: () => dispatch({ type: "listReloading" })
6760
+ };
6761
+ }
6762
+ //#endregion
6763
+ //#region ../blocks/src/customer-portal/components/bookings/PortalEventRescheduleFlow.tsx
6764
+ function rescheduleCopySubject(event, studio) {
6765
+ return {
6766
+ title: event.eventTitle,
6767
+ startsAt: event.startsAt,
6768
+ endsAt: event.endsAt,
6769
+ timeZone: event.timeZone,
6770
+ isOnline: event.isOnline,
6771
+ venueName: event.venueName,
6772
+ ticketsCount: event.ticketsCount,
6773
+ guestNames: (event.guests ?? []).map((guest) => guest.name.trim()).filter(Boolean),
6774
+ ticketingEnabled: event.ticketingEnabled,
6775
+ studio
6776
+ };
6777
+ }
6778
+ /**
6779
+ * "Reschedule" for a single-date booking: choose another date of the same
6780
+ * class, confirm, then see the result. Built on the appointment flow's dialog
6781
+ * frame and the site's own theme.
6782
+ */
6783
+ function PortalEventRescheduleFlow({ event, studio, onClose, onRescheduled }) {
6784
+ const subject = React$1.useMemo(() => ({
6785
+ registrationId: event.id,
6786
+ occurrenceId: event.occurrenceId,
6787
+ startsAt: event.startsAt
6788
+ }), [
6789
+ event.id,
6790
+ event.occurrenceId,
6791
+ event.startsAt
6792
+ ]);
6793
+ const copy = React$1.useMemo(() => rescheduleCopySubject(event, studio), [event, studio]);
6794
+ const flow = usePortalEventReschedule(subject);
6795
+ const { state } = flow;
6796
+ const doneDate = state.status === "done" ? state.date : null;
6797
+ const reported = React$1.useRef(false);
6798
+ React$1.useEffect(() => {
6799
+ if (!doneDate || reported.current) return;
6800
+ reported.current = true;
6801
+ onRescheduled(doneDate);
6802
+ }, [doneDate, onRescheduled]);
6803
+ const busy = state.status === "open" && state.submission.kind === "submitting";
6804
+ return /* @__PURE__ */ jsx(PortalModal, {
6805
+ title: state.status === "done" ? "Booking rescheduled" : "Reschedule booking",
6806
+ titleId: `cp-reschedule-event-${event.id}`,
6807
+ onClose: busy ? () => void 0 : onClose,
6808
+ children: /* @__PURE__ */ jsx("div", {
6809
+ className: "cp-section cp-section--reschedule",
6810
+ children: /* @__PURE__ */ jsx("div", {
6811
+ className: "cp-card cp-reschedule",
6812
+ children: state.status === "unavailable" ? /* @__PURE__ */ jsx(UnavailableStep, {
6813
+ message: rescheduleUnavailableMessage(state.source, studio),
6814
+ onClose
6815
+ }) : state.status === "done" ? /* @__PURE__ */ jsx(DoneStep, {
6816
+ copy,
6817
+ date: state.date,
6818
+ ticketUrl: event.ticketUrl ?? null,
6819
+ onClose
6820
+ }) : state.step === "confirm" ? /* @__PURE__ */ jsx(ConfirmStep, {
6821
+ copy,
6822
+ state,
6823
+ flow
6824
+ }) : /* @__PURE__ */ jsx(PickStep, {
6825
+ copy,
6826
+ state,
6827
+ flow,
6828
+ onClose
6829
+ })
6830
+ })
6831
+ })
6832
+ });
6833
+ }
6834
+ function Message({ text }) {
6835
+ return text ? /* @__PURE__ */ jsx("div", {
6836
+ className: "cp-alert cp-alert--error cp-alert--sm cp-alert--mb",
6837
+ role: "alert",
6838
+ children: text
6839
+ }) : null;
6840
+ }
6841
+ function CurrentBooking({ copy }) {
6842
+ const { context } = usePortalDateDisplay();
6843
+ const card = rescheduleCurrentCard(copy, context);
6844
+ return /* @__PURE__ */ jsxs("div", {
6845
+ className: "cp-reschedule__current",
6846
+ children: [/* @__PURE__ */ jsx("h3", {
6847
+ className: "cp-card-title",
6848
+ children: card.title
6849
+ }), /* @__PURE__ */ jsxs("div", {
6850
+ className: "cp-reschedule__current-meta",
6851
+ children: [/* @__PURE__ */ jsx("span", { children: card.current }), /* @__PURE__ */ jsx("span", { children: card.tickets })]
6852
+ })]
6853
+ });
6854
+ }
6855
+ function PickStep({ copy, state, flow, onClose }) {
6856
+ const { context } = usePortalDateDisplay();
6857
+ if (noDatesToChoose(state)) {
6858
+ const none = rescheduleNoDates(copy);
6859
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6860
+ /* @__PURE__ */ jsx(CurrentBooking, { copy }),
6861
+ /* @__PURE__ */ jsx("p", {
6862
+ className: "cp-reschedule__lead",
6863
+ children: none.lead
6864
+ }),
6865
+ /* @__PURE__ */ jsx("p", {
6866
+ className: "cp-card-subtitle",
6867
+ children: none.detail
6868
+ }),
6869
+ /* @__PURE__ */ jsx("div", {
6870
+ className: "cp-card-actions cp-reschedule__actions",
6871
+ children: /* @__PURE__ */ jsx(ThemedButton, {
6872
+ type: "button",
6873
+ onClick: onClose,
6874
+ variant: "secondary",
6875
+ size: "sm",
6876
+ label: "Close"
6877
+ })
6878
+ })
6879
+ ] });
6880
+ }
6881
+ const until = rescheduleUntilLine(state.until, copy, context);
6882
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
6883
+ /* @__PURE__ */ jsx(CurrentBooking, { copy }),
6884
+ /* @__PURE__ */ jsx("p", {
6885
+ className: "cp-reschedule__lead",
6886
+ children: reschedulePickLead(copy)
6887
+ }),
6888
+ /* @__PURE__ */ jsx(Message, { text: state.message }),
6889
+ /* @__PURE__ */ jsx(DateList, {
6890
+ copy,
6891
+ state,
6892
+ flow
6893
+ }),
6894
+ until ? /* @__PURE__ */ jsx("p", {
6895
+ className: "cp-reschedule__fineprint",
6896
+ children: until
6897
+ }) : null,
6898
+ /* @__PURE__ */ jsxs("div", {
6899
+ className: "cp-card-actions cp-reschedule__actions cp-reschedule__actions--sticky",
6900
+ children: [/* @__PURE__ */ jsx(ThemedButton, {
6901
+ type: "button",
6902
+ onClick: onClose,
6903
+ variant: "secondary",
6904
+ size: "sm",
6905
+ label: "Cancel"
6906
+ }), /* @__PURE__ */ jsx(ThemedButton, {
6907
+ type: "button",
6908
+ onClick: () => flow.dispatch({ type: "continued" }),
6909
+ disabled: !canContinueReschedule(state),
6910
+ variant: "primary",
6911
+ size: "sm",
6912
+ label: "Continue"
6913
+ })]
6914
+ })
6915
+ ] });
6916
+ }
6917
+ function DateList({ copy, state, flow }) {
6918
+ const { context } = usePortalDateDisplay();
6919
+ if (state.list.status === "loading") return /* @__PURE__ */ jsx("p", {
6920
+ className: "cp-card-subtitle",
6921
+ children: "Loading dates…"
6922
+ });
6923
+ if (state.list.status === "failed") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Message, { text: state.list.message }), /* @__PURE__ */ jsx(ThemedButton, {
6924
+ type: "button",
6925
+ onClick: flow.retryList,
6926
+ variant: "secondary",
6927
+ size: "sm",
6928
+ label: "Try again"
6929
+ })] });
6930
+ const { list } = state;
6931
+ return /* @__PURE__ */ jsxs("fieldset", {
6932
+ className: "cp-reschedule__dates",
6933
+ children: [
6934
+ /* @__PURE__ */ jsxs("legend", {
6935
+ className: "cp-reschedule__legend",
6936
+ children: ["Other dates for ", copy.title]
6937
+ }),
6938
+ /* @__PURE__ */ jsx("div", {
6939
+ className: "cp-date-list",
6940
+ role: "radiogroup",
6941
+ "aria-label": `Other dates for ${copy.title}`,
6942
+ children: list.dates.map((date) => /* @__PURE__ */ jsx(DateOption, {
6943
+ option: rescheduleDateOption(date, copy.ticketsCount, context),
6944
+ selected: state.selectedId === date.occurrenceId,
6945
+ disabled: !rescheduleEditable(state),
6946
+ onSelect: () => flow.dispatch({
6947
+ type: "selected",
6948
+ occurrenceId: date.occurrenceId
6949
+ })
6950
+ }, date.occurrenceId))
6951
+ }),
6952
+ list.nextPage ? /* @__PURE__ */ jsx("div", {
6953
+ className: "cp-reschedule__more",
6954
+ children: /* @__PURE__ */ jsx(ThemedButton, {
6955
+ type: "button",
6956
+ onClick: flow.loadMore,
6957
+ disabled: list.loadingMore,
6958
+ variant: "secondary",
6959
+ size: "sm",
6960
+ label: list.loadingMore ? "Loading…" : "Load more dates"
6961
+ })
6962
+ }) : null
6963
+ ]
6964
+ });
6965
+ }
6966
+ function DateOption({ option, selected, disabled, onSelect }) {
6967
+ const className = [
6968
+ "cp-date-option",
6969
+ selected ? "cp-date-option--selected" : "",
6970
+ option.choosable ? "" : "cp-date-option--disabled"
6971
+ ].filter(Boolean).join(" ");
6972
+ return /* @__PURE__ */ jsxs("button", {
6973
+ type: "button",
6974
+ role: "radio",
6975
+ "aria-checked": selected,
6976
+ "aria-disabled": !option.choosable || disabled,
6977
+ className,
6978
+ onClick: option.choosable && !disabled ? onSelect : void 0,
6979
+ children: [
6980
+ /* @__PURE__ */ jsx("span", {
6981
+ className: "cp-date-option__radio",
6982
+ "aria-hidden": "true"
6983
+ }),
6984
+ /* @__PURE__ */ jsxs("span", {
6985
+ className: "cp-date-option__text",
6986
+ children: [/* @__PURE__ */ jsx("span", {
6987
+ className: "cp-date-option__when",
6988
+ children: option.when
6989
+ }), option.where ? /* @__PURE__ */ jsx("span", {
6990
+ className: "cp-date-option__where",
6991
+ children: option.where
6992
+ }) : null]
6993
+ }),
6994
+ option.badge ? /* @__PURE__ */ jsx(Badge, {
6995
+ variant: "default",
6996
+ children: option.badge
6997
+ }) : null
6998
+ ]
6999
+ });
7000
+ }
7001
+ function ConfirmStep({ copy, state, flow }) {
7002
+ const { context } = usePortalDateDisplay();
7003
+ const date = confirmingRescheduleDate(state);
7004
+ if (!date) return null;
7005
+ const summary = rescheduleConfirmSummary(copy, date, context);
7006
+ const submitting = state.submission.kind === "submitting";
7007
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7008
+ /* @__PURE__ */ jsx("h3", {
7009
+ className: "cp-card-title",
7010
+ children: copy.title
7011
+ }),
7012
+ /* @__PURE__ */ jsx("p", {
7013
+ className: "cp-card-subtitle cp-reschedule__check",
7014
+ children: "Check the change before you confirm."
7015
+ }),
7016
+ /* @__PURE__ */ jsxs("div", {
7017
+ className: "cp-change",
7018
+ children: [/* @__PURE__ */ jsx(ChangeRow, {
7019
+ label: "From",
7020
+ when: summary.from.when,
7021
+ where: summary.from.where,
7022
+ from: true
7023
+ }), /* @__PURE__ */ jsx(ChangeRow, {
7024
+ label: "To",
7025
+ when: summary.to.when,
7026
+ where: summary.to.where
7027
+ })]
7028
+ }),
7029
+ /* @__PURE__ */ jsx("ul", {
7030
+ className: "cp-reschedule__points",
7031
+ children: summary.points.map((point) => /* @__PURE__ */ jsx("li", { children: point }, point))
7032
+ }),
7033
+ /* @__PURE__ */ jsx(Message, { text: state.message }),
7034
+ /* @__PURE__ */ jsxs("div", {
7035
+ className: "cp-card-actions cp-reschedule__actions",
7036
+ children: [state.stale ? null : /* @__PURE__ */ jsx(ThemedButton, {
7037
+ type: "button",
7038
+ onClick: () => flow.dispatch({ type: "back" }),
7039
+ disabled: !rescheduleEditable(state),
7040
+ variant: "secondary",
7041
+ size: "sm",
7042
+ label: "Back"
7043
+ }), state.stale ? null : /* @__PURE__ */ jsx(ThemedButton, {
7044
+ type: "button",
7045
+ onClick: () => void flow.submit(),
7046
+ disabled: submitting,
7047
+ variant: "primary",
7048
+ size: "sm",
7049
+ label: submitting ? "Rescheduling…" : state.submission.kind === "uncertain" ? "Try again" : "Confirm reschedule"
7050
+ })]
7051
+ })
7052
+ ] });
7053
+ }
7054
+ function ChangeRow({ label, when, where, from = false }) {
7055
+ return /* @__PURE__ */ jsxs("div", {
7056
+ className: `cp-change__row${from ? " cp-change__row--from" : ""}`,
7057
+ children: [/* @__PURE__ */ jsx("div", {
7058
+ className: "cp-change__label",
7059
+ children: label
7060
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
7061
+ className: "cp-change__when",
7062
+ children: when
7063
+ }), where ? /* @__PURE__ */ jsx("div", {
7064
+ className: "cp-change__where",
7065
+ children: where
7066
+ }) : null] })]
7067
+ });
7068
+ }
7069
+ function DoneStep({ copy, date, ticketUrl, onClose }) {
7070
+ const { context } = usePortalDateDisplay();
7071
+ const done = rescheduleDoneSummary(copy, date, context);
7072
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
7073
+ /* @__PURE__ */ jsxs("div", {
7074
+ className: "cp-done",
7075
+ children: [/* @__PURE__ */ jsx("div", {
7076
+ className: "cp-done__tick",
7077
+ "aria-hidden": "true",
7078
+ children: /* @__PURE__ */ jsx("svg", {
7079
+ width: "18",
7080
+ height: "18",
7081
+ viewBox: "0 0 24 24",
7082
+ fill: "none",
7083
+ stroke: "currentColor",
7084
+ strokeWidth: "2.6",
7085
+ children: /* @__PURE__ */ jsx("path", {
7086
+ strokeLinecap: "round",
7087
+ strokeLinejoin: "round",
7088
+ d: "M5 12.5l4.5 4.5L19 7.5"
7089
+ })
7090
+ })
7091
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
7092
+ className: "cp-done__title",
7093
+ children: done.title
7094
+ }), /* @__PURE__ */ jsx("p", {
7095
+ className: "cp-done__detail",
7096
+ children: done.detail
7097
+ })] })]
7098
+ }),
7099
+ /* @__PURE__ */ jsx("p", {
7100
+ className: "cp-card-subtitle cp-card-subtitle--spaced",
7101
+ children: done.followUp
7102
+ }),
7103
+ /* @__PURE__ */ jsxs("div", {
7104
+ className: "cp-card-actions cp-reschedule__actions",
7105
+ children: [copy.ticketingEnabled && ticketUrl ? /* @__PURE__ */ jsx(ThemedButtonLink, {
7106
+ href: ticketUrl,
7107
+ variant: "secondary",
7108
+ size: "sm",
7109
+ label: "View ticket"
7110
+ }) : null, /* @__PURE__ */ jsx(ThemedButton, {
7111
+ type: "button",
7112
+ onClick: onClose,
7113
+ variant: "primary",
7114
+ size: "sm",
7115
+ label: "Done"
7116
+ })]
7117
+ })
7118
+ ] });
7119
+ }
7120
+ function UnavailableStep({ message, onClose }) {
7121
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
7122
+ className: "cp-reschedule__lead",
7123
+ children: message
7124
+ }), /* @__PURE__ */ jsx("div", {
7125
+ className: "cp-card-actions cp-reschedule__actions",
7126
+ children: /* @__PURE__ */ jsx(ThemedButton, {
7127
+ type: "button",
7128
+ onClick: onClose,
7129
+ variant: "secondary",
7130
+ size: "sm",
7131
+ label: "Close"
7132
+ })
7133
+ })] });
7134
+ }
7135
+ //#endregion
6169
7136
  //#region ../blocks/src/customer-portal/components/bookings/EventRow.tsx
7137
+ /** An action that exists for this booking but whose time has passed: shown, explained, not clickable. */
7138
+ function UnavailableActionTile({ title, tile }) {
7139
+ if (tile.kind !== "greyed") return null;
7140
+ return /* @__PURE__ */ jsxs("div", {
7141
+ className: "rb-tile cp-action-tile cp-action-tile--unavailable",
7142
+ "aria-disabled": "true",
7143
+ children: [/* @__PURE__ */ jsx("div", {
7144
+ className: "cp-action-tile__title",
7145
+ children: title
7146
+ }), /* @__PURE__ */ jsx("div", {
7147
+ className: "cp-action-tile__desc",
7148
+ children: tile.description
7149
+ })]
7150
+ });
7151
+ }
7152
+ const CHANGE_ACTIONS = [
7153
+ {
7154
+ action: "reschedule",
7155
+ title: "Reschedule",
7156
+ describe: (eventTitle) => `Move this booking to another date of ${eventTitle}.`
7157
+ },
7158
+ {
7159
+ action: "transfer",
7160
+ title: "Transfer to someone else",
7161
+ describe: () => "Hand this booking over to another person."
7162
+ },
7163
+ {
7164
+ action: "cancel",
7165
+ title: "Cancel booking",
7166
+ danger: true,
7167
+ describe: () => "Cancel this booking."
7168
+ }
7169
+ ];
7170
+ /** Reschedule, Transfer and Cancel as the action table answers: offered, greyed with the reason, or left out. */
7171
+ function ChangeActionTiles({ tiles, eventTitle, disabled, choose }) {
7172
+ return /* @__PURE__ */ jsx(Fragment, { children: CHANGE_ACTIONS.map(({ action, title, danger, describe }) => {
7173
+ const tile = tiles[action];
7174
+ if (tile.kind === "greyed") return /* @__PURE__ */ jsx(UnavailableActionTile, {
7175
+ title,
7176
+ tile
7177
+ }, action);
7178
+ if (tile.kind === "hidden") return null;
7179
+ return /* @__PURE__ */ jsxs("button", {
7180
+ type: "button",
7181
+ className: `rb-tile rb-tile--interactive cp-action-tile${danger ? " cp-action-tile--danger" : ""}`,
7182
+ disabled,
7183
+ onClick: () => choose(action),
7184
+ children: [/* @__PURE__ */ jsx("div", {
7185
+ className: "cp-action-tile__title",
7186
+ children: title
7187
+ }), /* @__PURE__ */ jsx("div", {
7188
+ className: "cp-action-tile__desc",
7189
+ children: describe(eventTitle)
7190
+ })]
7191
+ }, action);
7192
+ }) });
7193
+ }
6170
7194
  function summarizeGuests(guests) {
6171
7195
  const names = guests.map((g) => g.name).filter((n) => typeof n === "string" && n.trim().length > 0);
6172
7196
  if (names.length === 0) return "";
@@ -6204,10 +7228,11 @@ function getEventNonConfirmedBadge(event) {
6204
7228
  label: getEventStatusLabel(event)
6205
7229
  };
6206
7230
  }
6207
- function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true, onRefresh, onUpdateGuests }) {
7231
+ function EventRow({ event, siteTitle, isPast: isEventPast = false, showActionsColumn = true, onRefresh, onUpdateGuests }) {
6208
7232
  const { context } = usePortalDateDisplay();
6209
7233
  const api = useBlockApi();
6210
7234
  const [actionsOpen, setActionsOpen] = React$1.useState(false);
7235
+ const [rescheduleOpen, setRescheduleOpen] = React$1.useState(false);
6211
7236
  const [transferFormOpen, setTransferFormOpen] = React$1.useState(false);
6212
7237
  const [transferToEmail, setTransferToEmail] = React$1.useState("");
6213
7238
  const [transferToName, setTransferToName] = React$1.useState("");
@@ -6230,10 +7255,23 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
6230
7255
  const eventDetailsHref = event.eventOccurrencePath ?? event.eventPath ?? null;
6231
7256
  const canEditGuests = canAct && showGuestSection;
6232
7257
  const canViewTicket = canAct && !!event.ticketUrl;
6233
- const canCancel = canAct && event.actions.canCancel;
6234
- const canTransfer = canAct && event.actions.canTransfer;
7258
+ const tiles = portalEventActionTiles(event.actions, canAct, {
7259
+ startsAt: event.startsAt,
7260
+ timeZone: event.timeZone,
7261
+ isOnline: event.isOnline,
7262
+ kind: "class",
7263
+ studio: siteTitle
7264
+ }, context);
6235
7265
  const canViewEventDetails = !!eventDetailsHref;
6236
- const hasAnyActions = canViewEventDetails || canEditGuests || canViewTicket || canCancel || canTransfer;
7266
+ const hasAnyActions = canViewEventDetails || canEditGuests || canViewTicket || Object.values(tiles).some((tile) => tile.kind !== "hidden");
7267
+ const onRescheduled = React$1.useCallback(async (date) => {
7268
+ cancelFlow.reportSuccess(rescheduledRowNote(date, context));
7269
+ await onRefresh();
7270
+ }, [
7271
+ cancelFlow,
7272
+ context,
7273
+ onRefresh
7274
+ ]);
6237
7275
  const anySubmitting = cancelFlow.submitting || transferSubmitting || savingGuests;
6238
7276
  const startCancelFlow = () => {
6239
7277
  cancelFlow.clearFeedback();
@@ -6407,7 +7445,7 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
6407
7445
  })
6408
7446
  }),
6409
7447
  transferFormOpen && /* @__PURE__ */ jsx(PortalModal, {
6410
- title: "Transfer booking",
7448
+ title: "Transfer to someone else",
6411
7449
  titleId: `cp-transfer-${event.id}`,
6412
7450
  onClose: () => setTransferFormOpen(false),
6413
7451
  children: /* @__PURE__ */ jsxs("div", {
@@ -6458,7 +7496,7 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
6458
7496
  disabled: anySubmitting,
6459
7497
  variant: "primary",
6460
7498
  size: "sm",
6461
- label: transferSubmitting ? "Transferring…" : "Transfer"
7499
+ label: transferSubmitting ? "Transferring…" : "Transfer to someone else"
6462
7500
  })]
6463
7501
  })
6464
7502
  ]
@@ -6511,41 +7549,28 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
6511
7549
  children: expectedGuestCount === 1 ? "Add details for your guest." : `Add details for your ${expectedGuestCount} guests.`
6512
7550
  })]
6513
7551
  }),
6514
- canTransfer && /* @__PURE__ */ jsxs("button", {
6515
- type: "button",
6516
- className: "rb-tile rb-tile--interactive cp-action-tile",
7552
+ /* @__PURE__ */ jsx(ChangeActionTiles, {
7553
+ tiles,
7554
+ eventTitle: event.eventTitle,
6517
7555
  disabled: anySubmitting,
6518
- onClick: () => {
7556
+ choose: (action) => {
6519
7557
  setActionsOpen(false);
6520
- startTransferFlow();
6521
- },
6522
- children: [/* @__PURE__ */ jsx("div", {
6523
- className: "cp-action-tile__title",
6524
- children: "Transfer booking"
6525
- }), /* @__PURE__ */ jsx("div", {
6526
- className: "cp-action-tile__desc",
6527
- children: "Transfer this booking to another email."
6528
- })]
6529
- }),
6530
- canCancel && /* @__PURE__ */ jsxs("button", {
6531
- type: "button",
6532
- className: "rb-tile rb-tile--interactive cp-action-tile cp-action-tile--danger",
6533
- disabled: anySubmitting,
6534
- onClick: () => {
6535
- setActionsOpen(false);
6536
- startCancelFlow();
6537
- },
6538
- children: [/* @__PURE__ */ jsx("div", {
6539
- className: "cp-action-tile__title",
6540
- children: "Cancel booking"
6541
- }), /* @__PURE__ */ jsx("div", {
6542
- className: "cp-action-tile__desc",
6543
- children: "Cancel this booking."
6544
- })]
7558
+ if (action === "reschedule") {
7559
+ cancelFlow.clearFeedback();
7560
+ setRescheduleOpen(true);
7561
+ } else if (action === "transfer") startTransferFlow();
7562
+ else startCancelFlow();
7563
+ }
6545
7564
  })
6546
7565
  ]
6547
7566
  })
6548
7567
  }),
7568
+ rescheduleOpen && /* @__PURE__ */ jsx(PortalEventRescheduleFlow, {
7569
+ event,
7570
+ studio: siteTitle,
7571
+ onClose: () => setRescheduleOpen(false),
7572
+ onRescheduled
7573
+ }),
6549
7574
  cancelFlow.dialog.tag === "confirm" && /* @__PURE__ */ jsxs(PortalModal, {
6550
7575
  title: "Cancel booking?",
6551
7576
  titleId: `cp-cancel-${event.id}`,
@@ -6680,8 +7705,14 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
6680
7705
  }
6681
7706
  //#endregion
6682
7707
  //#region ../blocks/src/customer-portal/components/bookings/BookingsTable.tsx
6683
- function BookingsTable({ items, isPast = false, onRefresh, onUpdateGuests }) {
7708
+ function BookingsTable({ items, siteTitle, isPast = false, onRefresh, onUpdateGuests }) {
6684
7709
  const showActionsColumn = !isPast;
7710
+ const rowProps = {
7711
+ siteTitle,
7712
+ isPast,
7713
+ showActionsColumn,
7714
+ onRefresh
7715
+ };
6685
7716
  return /* @__PURE__ */ jsx("div", {
6686
7717
  className: "cp-table-wrap",
6687
7718
  "data-past": isPast ? "true" : "false",
@@ -6721,15 +7752,11 @@ function BookingsTable({ items, isPast = false, onRefresh, onUpdateGuests }) {
6721
7752
  })
6722
7753
  ] }) }), /* @__PURE__ */ jsx("tbody", { children: items.map((item) => item.kind === "event" ? /* @__PURE__ */ jsx(EventRow, {
6723
7754
  event: item.event,
6724
- isPast,
6725
- showActionsColumn,
6726
- onRefresh,
6727
- onUpdateGuests
7755
+ onUpdateGuests,
7756
+ ...rowProps
6728
7757
  }, `event:${item.event.id}`) : /* @__PURE__ */ jsx(EventSeriesRegistrationRow, {
6729
7758
  enrollment: item.enrollment,
6730
- isPast,
6731
- showActionsColumn,
6732
- onRefresh
7759
+ ...rowProps
6733
7760
  }, `course:${item.enrollment.id}`)) })]
6734
7761
  })
6735
7762
  });
@@ -6933,13 +7960,18 @@ function WaitlistsSection({ waitlists, focusedEntryId, onLeave, onRefresh, onFee
6933
7960
  }
6934
7961
  //#endregion
6935
7962
  //#region ../blocks/src/customer-portal/components/bookings/BookingsSection.tsx
6936
- function BookingsSection({ events, wholeSeriesRegistrations, waitlists = [], focusedWaitlistEntryId = null, emptyMessage, onRefresh, onWaitlistFeedback, onUpdateGuests, onLeaveWaitlist = async () => ({ outcome: "notFound" }) }) {
7963
+ function BookingsSection({ siteTitle, events, wholeSeriesRegistrations, waitlists = [], focusedWaitlistEntryId = null, emptyMessage, onRefresh, onWaitlistFeedback, onUpdateGuests, onLeaveWaitlist = async () => ({ outcome: "notFound" }) }) {
6937
7964
  const { now } = usePortalDateDisplay();
6938
7965
  const { items, upcoming, past } = React$1.useMemo(() => groupPortalBookings(events, wholeSeriesRegistrations, now), [
6939
7966
  events,
6940
7967
  wholeSeriesRegistrations,
6941
7968
  now
6942
7969
  ]);
7970
+ const tableProps = {
7971
+ siteTitle,
7972
+ onRefresh,
7973
+ onUpdateGuests
7974
+ };
6943
7975
  if (items.length === 0 && waitlists.length === 0) return /* @__PURE__ */ jsx("div", {
6944
7976
  className: "cp-section cp-section--events",
6945
7977
  children: /* @__PURE__ */ jsx("div", {
@@ -6966,8 +7998,7 @@ function BookingsSection({ events, wholeSeriesRegistrations, waitlists = [], foc
6966
7998
  children: "Upcoming bookings"
6967
7999
  }), /* @__PURE__ */ jsx(BookingsTable, {
6968
8000
  items: upcoming,
6969
- onRefresh,
6970
- onUpdateGuests
8001
+ ...tableProps
6971
8002
  })] }),
6972
8003
  past.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h3", {
6973
8004
  className: "cp-section-title",
@@ -6976,8 +8007,7 @@ function BookingsSection({ events, wholeSeriesRegistrations, waitlists = [], foc
6976
8007
  }), /* @__PURE__ */ jsx(BookingsTable, {
6977
8008
  items: past,
6978
8009
  isPast: true,
6979
- onRefresh,
6980
- onUpdateGuests
8010
+ ...tableProps
6981
8011
  })] })
6982
8012
  ]
6983
8013
  });
@@ -8930,6 +9960,7 @@ function CustomerPortalClient({ callbackPath: suppliedCallbackPath, logoutPath:
8930
9960
  onRefresh: fetchPortalData
8931
9961
  }),
8932
9962
  activeTab === "events" && canShowBookings && /* @__PURE__ */ jsx(BookingsSection, {
9963
+ siteTitle,
8933
9964
  events: data.events,
8934
9965
  waitlists: data.waitlists,
8935
9966
  focusedWaitlistEntryId: focusedWaitlistId(requestedTask),