@riverbankcms/sdk 0.157.0 → 0.158.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 (170) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-B3AHhvIn.d.ts → BlocksIslandsHydrator-BgNBtEai.d.ts} +1 -1
  2. package/dist/_dts/{Page-BMaOSVCP.d.ts → Page-DpCo8zXD.d.ts} +9 -6
  3. package/dist/_dts/{SdkPreviewMode-CEwDDqfK.d.ts → SdkPreviewMode-Bv2TMscG.d.ts} +2 -2
  4. package/dist/_dts/{client-BRFVhGUB.d.ts → client-B960v2gW.d.ts} +1 -1
  5. package/dist/_dts/{content-types-tEy1rtQ5.d.ts → content-types-CN0Wy8V6.d.ts} +26 -3
  6. package/dist/_dts/{contracts-BwDSOVGj.d.ts → contracts-BFUrby76.d.ts} +5 -4
  7. package/dist/_dts/{footerPageOutline-BVp5EPJj.d.ts → footerPageOutline-CmoqleLS.d.ts} +6 -6
  8. package/dist/_dts/{generatePageMetadata-BQb1mvpc.d.ts → generatePageMetadata-Dkvivc3R.d.ts} +2 -2
  9. package/dist/_dts/{hosted-booking-appearance-BN2Zu93B.d.ts → hosted-booking-appearance-BIbit60h.d.ts} +8976 -47
  10. package/dist/_dts/{index-Ca3oD2id.d.ts → index-Ba6RmuxX.d.ts} +3 -3
  11. package/dist/_dts/{index-Br1TNJlL.d.ts → index-DCNu_8it.d.ts} +4 -4
  12. package/dist/_dts/{index-CSLkIKs3.d.ts → index-DPfI2t5A.d.ts} +2 -2
  13. package/dist/_dts/{index-B0wsEbm3.d.ts → index-DaS_z6ir.d.ts} +1 -1
  14. package/dist/_dts/{index-B0DzVcrB.d.ts → index-DfkFWUxt.d.ts} +4 -1
  15. package/dist/_dts/{index-BF3hkKvt.d.ts → index-DpgkhY-a.d.ts} +2 -2
  16. package/dist/_dts/{loadContent-Dz9fOZMZ.d.ts → loadContent-DvvKF4nB.d.ts} +10 -7
  17. package/dist/_dts/{navigation-DOZwagCE.d.ts → navigation-n-eTVTIQ.d.ts} +75 -4
  18. package/dist/_dts/{resolvePageContent-oHZ8cfaF.d.ts → resolvePageContent-D0lGwVD6.d.ts} +2 -2
  19. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  20. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client.d.ts +6 -6
  22. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  23. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  24. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/index.d.ts +8 -8
  26. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  27. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  28. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  29. package/dist/_dts/sdk/src/next/index.d.ts +10 -7
  30. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  31. package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
  32. package/dist/_dts/sdk/src/portal/client.d.ts +11 -4
  33. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  34. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  35. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  36. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  37. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  38. package/dist/_dts/sdk/src/rendering/index.d.ts +45 -6
  39. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  40. package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
  41. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  42. package/dist/_dts/sdk/src/server.d.ts +5 -5
  43. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  44. package/dist/_dts/{types-Dy1DNdIV.d.ts → types-BJrRUaY7.d.ts} +2 -2
  45. package/dist/_dts/{types-6q1MDqxg.d.ts → types-BY7PgnDi.d.ts} +7 -7
  46. package/dist/_dts/{types-BuWOkyqw.d.ts → types-maEnXL6Z.d.ts} +3 -3
  47. package/dist/_dts/{validation-BumblAOO.d.ts → validation-BjuVrMrs.d.ts} +4 -4
  48. package/dist/client/{BlocksIslandsHydrator-Cid8be1G.mjs → BlocksIslandsHydrator-WRLS96Ev.mjs} +17 -17
  49. package/dist/client/{BookingMailingListNote-BpzJTCZw.mjs → BookingMailingListNote-eovghMPa.mjs} +3 -56
  50. package/dist/client/{CalendarNavigationChevron-CBKHlGjE.mjs → CalendarNavigationChevron-CIcMQRc1.mjs} +5 -5
  51. package/dist/client/{DemoBookingPortalAccess-DpfgDMQ-.mjs → DemoBookingPortalAccess-CdnFgDyQ.mjs} +3 -3
  52. package/dist/client/{EventCalendar.client-DE5JHf4s.mjs → EventCalendar.client-Dc-ZLxKo.mjs} +8 -8
  53. package/dist/client/{EventCombined.client-DQLU3EAc.mjs → EventCombined.client-C93XqRIv.mjs} +6 -6
  54. package/dist/client/{EventItem-C9QTFafI.mjs → EventItem-DnCTygqk.mjs} +3 -3
  55. package/dist/client/{EventListWeekNavigation-6oYGdpNS.mjs → EventListWeekNavigation-9h97heuQ.mjs} +1 -1
  56. package/dist/client/{EventListing.client-D0N4Wj_4.mjs → EventListing.client-DFKlQvvs.mjs} +3 -3
  57. package/dist/client/{EventListing.view-Bish8-si.mjs → EventListing.view-pAuTDyrP.mjs} +4 -4
  58. package/dist/client/{EventRegistrationPayment-DLPYU2VU.mjs → EventRegistrationPayment-rgKlBvhP.mjs} +8 -7
  59. package/dist/client/{LeafletStaticMap-BmgEmEUS.mjs → LeafletStaticMap-3XiWSgy0.mjs} +1 -1
  60. package/dist/client/{Page-C-W_6VPx.mjs → Page-BmpeAwID.mjs} +750 -169
  61. package/dist/client/{StepIndicator-D8fvzhlS.mjs → StepIndicator-qEq6X5zP.mjs} +2 -2
  62. package/dist/client/{accordion-B5jBBoBC.mjs → accordion-DeObOasQ.mjs} +1 -1
  63. package/dist/client/{booking-form.client-xypjcfob.mjs → booking-form.client-DfWeF0lj.mjs} +36 -32
  64. package/dist/client/{bookingForm-CSE7NT54.mjs → bookingForm-TnzIBHx2.mjs} +4 -4
  65. package/dist/client/bookings.mjs +5 -5
  66. package/dist/client/{carousel-BrrLdGgn.mjs → carousel-kkFnbr5Z.mjs} +1 -1
  67. package/dist/client/{cart-QFgSKqia.mjs → cart-BAXNbFux.mjs} +3 -3
  68. package/dist/client/{cart.client-C6iA9v8X.mjs → cart.client-BczxUF70.mjs} +1 -1
  69. package/dist/client/{checkout-BAuLgA6Q.mjs → checkout-C5NRhPeP.mjs} +3 -3
  70. package/dist/client/{checkout.client-hbvBPpZR.mjs → checkout.client-BuDk3Td9.mjs} +1 -1
  71. package/dist/client/client.mjs +3 -2
  72. package/dist/client/{context-psG_Bwfs.mjs → context-CVsgML69.mjs} +1 -1
  73. package/dist/client/{cta-DrX2pzK9.mjs → cta-BWnUuJce.mjs} +1 -1
  74. package/dist/client/{demoPortalMagicLink-CClf0SHq.mjs → demoPortalMagicLink-CUlwvmxf.mjs} +1 -1
  75. package/dist/client/{enhanceHeaderSection-CqN7ig-2.mjs → enhanceHeaderSection-Cw8nnFj-.mjs} +2 -2
  76. package/dist/client/{event-details.client-CcYX4URD.mjs → event-details.client-Bl0E_6Vi.mjs} +2 -2
  77. package/dist/client/{event-registration.client-B8wVfnJ8.mjs → event-registration.client-DmfLg_LC.mjs} +15 -14
  78. package/dist/client/{eventCalendar-CRYN9-Vv.mjs → eventCalendar-D1Dwb9VA.mjs} +4 -4
  79. package/dist/client/{eventCombined-gGuj2_Vh.mjs → eventCombined-DfsqY1qR.mjs} +4 -4
  80. package/dist/client/{eventDetails-D1U7WEsJ.mjs → eventDetails-BmugDVoa.mjs} +2 -2
  81. package/dist/client/{eventListing-BY20rsvl.mjs → eventListing-BPAGJi3C.mjs} +4 -4
  82. package/dist/client/{eventRegistration-DnOZYpqh.mjs → eventRegistration-DBlz_x6u.mjs} +4 -4
  83. package/dist/client/{form-_q17Emh7.mjs → form-DVu3ZMjx.mjs} +3 -3
  84. package/dist/client/{form.client-BVaTf4FG.mjs → form.client-QZUyABIY.mjs} +3 -3
  85. package/dist/client/{form.parts-C9EmjE7U.mjs → form.parts-Bs0F3v08.mjs} +1 -1
  86. package/dist/client/formatDate-BD9D3dgo.mjs +26 -0
  87. package/dist/client/gifting/client.mjs +2 -2
  88. package/dist/client/{headerSection-CZ3unSkX.mjs → headerSection-BQwWW4Yy.mjs} +2 -2
  89. package/dist/client/{location-map.client-C_udm2_y.mjs → location-map.client-upKuwABk.mjs} +3 -10
  90. package/dist/client/{location-map.view-Bkd9gu_S.mjs → location-map.view-RuBCD10O.mjs} +87 -13
  91. package/dist/client/{locationMap-CunBAPoo.mjs → locationMap-1sCbsk0V.mjs} +2 -2
  92. package/dist/client/{newsletter-form.client-BkHhqPBi.mjs → newsletter-form.client-DBTU3oNv.mjs} +4 -4
  93. package/dist/client/{newsletter-form.parts-VGjM-NDG.mjs → newsletter-form.parts-C9I9JBhe.mjs} +1 -1
  94. package/dist/client/{newsletterForm-DGc1-NVR.mjs → newsletterForm-DTPtTxxG.mjs} +3 -3
  95. package/dist/client/{noop-D3wctocR.mjs → noop-DMFt3KdC.mjs} +19 -132
  96. package/dist/client/portal/client.mjs +589 -482
  97. package/dist/client/{product-detail.client-C_8N4OxU.mjs → product-detail.client-BX7M5o6p.mjs} +1 -1
  98. package/dist/client/{product-list.client-79qoSlLs.mjs → product-list.client-i32QNY4c.mjs} +1 -1
  99. package/dist/client/{productDetail-QGBXBpWb.mjs → productDetail-DWjE9zm7.mjs} +3 -3
  100. package/dist/client/{productList-Bdno11g6.mjs → productList-DZH9_brv.mjs} +3 -3
  101. package/dist/client/{propsDecoder-BpKsRqjG.mjs → propsDecoder-CTzHkEkh.mjs} +14 -3
  102. package/dist/client/{registry.server-D9GvC4EZ.mjs → registry.server-vJ5FlscU.mjs} +589 -246
  103. package/dist/client/rendering/client.mjs +23 -23
  104. package/dist/client/rendering/islands.mjs +1 -1
  105. package/dist/client/rendering.mjs +26 -4
  106. package/dist/client/{richText-coerce-Nln8Bw2P.mjs → richText-coerce-DXAmC72p.mjs} +1 -1
  107. package/dist/client/{routeIslandApiConfig-B4E30DaZ.mjs → routeIslandApiConfig-CmC7ygin.mjs} +1 -1
  108. package/dist/client/{shop-653-Nn74.mjs → shop-C7eL3B37.mjs} +3 -3
  109. package/dist/client/{shop-commerce-CfbvhT6h.mjs → shop-commerce-D8oRN0QJ.mjs} +9 -9
  110. package/dist/client/{shop-commerce-store-CfB26IXt.mjs → shop-commerce-store-CRnQ4M18.mjs} +1 -1
  111. package/dist/client/{shop.client-Bn7jUQOB.mjs → shop.client-X6d6KVmA.mjs} +9 -9
  112. package/dist/client/{shop.interactive-acMnyBZU.mjs → shop.interactive-DBMeM8VD.mjs} +155 -3
  113. package/dist/client/{shopShared-Du4efbgL.mjs → shopShared-Y182kN_s.mjs} +2 -2
  114. package/dist/client/{timetableModel-Duwk6gXe.mjs → timetableModel-D7PwpaBY.mjs} +5 -5
  115. package/dist/client/{useAvailableSlots-CbaAFr8M.mjs → useAvailableSlots-BDV6MHgJ.mjs} +2 -2
  116. package/dist/client/useBookingNowIso-DgJEv3ZY.mjs +58 -0
  117. package/dist/client/{useDiscountApply-DAl-GX21.mjs → useDiscountApply-BTu9EeT7.mjs} +1 -1
  118. package/dist/client/{useDiscountCodeUi-BUf9LuI6.mjs → useDiscountCodeUi-BfZxdxI-.mjs} +1 -1
  119. package/dist/client/{useEventPagination-hJDAEg-T.mjs → useEventPagination-pnvdHGeQ.mjs} +6 -6
  120. package/dist/client/{view-CFSMNvdC.mjs → view-BPEa6Okm.mjs} +8 -7
  121. package/dist/client/{view-4sSIJ6Ny.mjs → view-hJr_L4QC2.mjs} +3 -3
  122. package/dist/client/{wizardSteps-B3tRF3_2.mjs → wizardSteps-HdyGoIG3.mjs} +218 -47
  123. package/dist/preview-next/before-render.mjs +1 -1
  124. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BX5F0a_h.mjs → EventEmbeddedCheckoutStep-BFlBqSu4.mjs} +1 -1
  125. package/dist/preview-next/client/{PreviewEditorSidebar-DLzGdmTw.mjs → PreviewEditorSidebar-CXRUbqMp.mjs} +42 -26
  126. package/dist/preview-next/client/{PreviewEditorUI-Dru5AxOd.mjs → PreviewEditorUI-CxjEV0Fm.mjs} +31 -22
  127. package/dist/preview-next/client/{SdkPreviewModeRuntime-QVfwY0HY.mjs → SdkPreviewModeRuntime-BxI12BBS.mjs} +1310 -1226
  128. package/dist/preview-next/client/{SdkPreviewModeRuntime-V3absa-c.mjs → SdkPreviewModeRuntime-XdQSGGj_.mjs} +1 -1
  129. package/dist/preview-next/client/{SiteChromeCustomizeContext-RSPyKO_K.mjs → SiteChromeCustomizeContext-CfRQRwpH.mjs} +133891 -131593
  130. package/dist/preview-next/client/{ThemedButton-ADHirm0A.mjs → ThemedButton-BEOPss9H.mjs} +30 -4
  131. package/dist/preview-next/client/{previewChromeSurface-Cc4b9nBZ.mjs → previewChromeSurface-CH7hd5n7.mjs} +1 -1
  132. package/dist/preview-next/client/runtime.mjs +3 -3
  133. package/dist/preview-next/client/{sdk-runtime-CTLm99t6.mjs → sdk-runtime-C6xEU1LI.mjs} +1 -1
  134. package/dist/preview-next/client/{siteStyleAccess-YpHSMBBC.mjs → siteStyleAccess-CRXaC2oL.mjs} +2 -2
  135. package/dist/preview-next/client/{spinner-CsiSmy1g.mjs → spinner-BTf1CZmy.mjs} +1 -1
  136. package/dist/preview-next/keepAlive.mjs +1 -1
  137. package/dist/preview-next/middleware.mjs +1 -1
  138. package/dist/preview-next/{route-contract-dR_Jzpo5.mjs → route-contract-DM22uOXM.mjs} +41 -0
  139. package/dist/server/{Block.shared-BNrmEY1p.mjs → Block.shared-DLoilC2J.mjs} +4 -4
  140. package/dist/server/{bindings-C9zgT9uX.mjs → bindings-C7DKLVx_.mjs} +1 -1
  141. package/dist/server/{blocks-BLm-OxTv.mjs → blocks-jlIm0PWc.mjs} +953 -324
  142. package/dist/server/{client-CaQ1ElR3.mjs → client-CU4wlMLE.mjs} +2 -2
  143. package/dist/server/config-validation.mjs +1 -1
  144. package/dist/server/config.mjs +2 -2
  145. package/dist/server/index.mjs +2 -2
  146. package/dist/server/{loadContent-BFyU8YxS.mjs → loadContent-DmQ4BiiQ.mjs} +6 -4
  147. package/dist/server/{loadPage-DeQipVdO.mjs → loadPage-BBkDQA57.mjs} +3 -2
  148. package/dist/server/loadPage-ZrcfjG3X.mjs +2 -0
  149. package/dist/server/next.mjs +24 -12
  150. package/dist/server/{overrideResolution-D5nmZUYe.mjs → overrideResolution-ByeAbLSO.mjs} +1 -1
  151. package/dist/server/{overrides-BI13bIb7.mjs → overrides-BcA6ZPWf.mjs} +94 -30
  152. package/dist/server/page-converter.mjs +1 -1
  153. package/dist/server/{prebuild-UgDhSzy2.mjs → prebuild-8T-m7XjB.mjs} +1 -1
  154. package/dist/server/prebuild.mjs +1 -1
  155. package/dist/server/{prefetchBlockData-CLF-Y7h-.mjs → prefetchBlockData-Bjya-X9t.mjs} +6 -5
  156. package/dist/server/{publicProducts-vPbNQJsO.mjs → publicProducts-C3meXS2o.mjs} +41 -0
  157. package/dist/server/rendering/server.mjs +4 -4
  158. package/dist/server/rendering.mjs +26 -8
  159. package/dist/server/{resolveBlockData-C7J-pixy.mjs → resolveBlockData-D0ow8PRJ.mjs} +1 -1
  160. package/dist/server/routing.mjs +1 -1
  161. package/dist/server/server.mjs +3 -3
  162. package/dist/server/{siteChromeOverlayClearance-DLROm32h.mjs → siteChromeOverlayClearance-BangtD8A.mjs} +126 -1
  163. package/dist/server/{src-BZb5L4Fa.mjs → src-B935_bzN.mjs} +300 -2
  164. package/dist/server/theme-bridge.mjs +1 -1
  165. package/dist/server/{themeAdmission-x3uhdOWx.mjs → themeAdmission-D2-BnmDO.mjs} +314 -125
  166. package/dist/server/{validation-Ban_hxJG.mjs → validation-Cm41pDUB.mjs} +2 -2
  167. package/dist/server/{version-bkGVuskm.mjs → version-Bo9C3McI.mjs} +1 -1
  168. package/dist/styles/index.css +282 -0
  169. package/package.json +1 -1
  170. package/dist/server/loadPage-CvyKRtXK.mjs +0 -2
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  import { h as unsafeAsAppointmentResourceId } from "../renderableMediaAssetAdmission-DGjBr_e-.mjs";
4
4
  import { Ar as resolveFlexibleBalancePaymentEligibility, Mr as formatCurrencyAmount, Or as formatOrderInstalmentStatusLabel$1, i as ThemedButtonLink, jr as parsePositiveMoneyInputToCents, l as SpinnerNode, r as ThemedButton, t as ThemedActionsButton } from "../ThemedButton-DVBC_pS9.mjs";
5
- import { Ct as toScheduledBookingDateTime, St as toScheduledBookingDateRange, at as formatTime, bt as resolveBookingTimeZoneId, ft as formatBookingDateTime, pt as formatBookingRange, rt as formatDateTime$1, t as logger, tt as formatDate$1, vt as parseUtcIsoDateTimeString, wt as toUtcIsoDateTimeString } from "../noop-D3wctocR.mjs";
5
+ import { Ct as toUtcIsoDateTimeString, bt as resolveBookingTimeZoneId, ct as resolveBookingDisplayContext, it as formatDateTimeRange, rt as formatDateTime$1, t as logger, tt as formatDate$1, vt as parseUtcIsoDateTimeString } from "../noop-DMFt3KdC.mjs";
6
6
  import { t as assertNever } from "../src-7cXhT0G_.mjs";
7
7
  import { t as resolveDedicatedBookingHref } from "../bookingRoute-Bqlyu5Vb.mjs";
8
8
  import { t as CheckboxChoice } from "../CheckboxChoice-BF9eCNno.mjs";
@@ -10,11 +10,13 @@ import { t as DemoPortalSignInLink } from "../DemoPortalSignInLink-DHxYgkT6.mjs"
10
10
  import { t as ModalShell } from "../ModalShell-B_fHWK71.mjs";
11
11
  import { t as TabBarFragment } from "../TabBarFragment-DvzIV75f.mjs";
12
12
  import { i as getPortalCreditProductCreditNoun, r as getCreditProductTypeLabel, t as deriveCreditProductLabels } from "../creditProducts-BOWi1QLp.mjs";
13
- import { i as createBlockApi, n as useBlockApi, t as BlockApiProvider } from "../context-psG_Bwfs.mjs";
14
- import { n as useAvailableDates, o as getRuntimeTimeZone, t as useAvailableSlots } from "../useAvailableSlots-CbaAFr8M.mjs";
15
- import { n as buildPortalCallbackUrl, r as requestDemoPortalMagicLink } from "../demoPortalMagicLink-CClf0SHq.mjs";
13
+ import { t as formatDate$2 } from "../formatDate-BD9D3dgo.mjs";
14
+ import { i as createBlockApi, n as useBlockApi, t as BlockApiProvider } from "../context-CVsgML69.mjs";
15
+ import { n as useAvailableDates, t as useAvailableSlots } from "../useAvailableSlots-BDV6MHgJ.mjs";
16
+ import { t as useBookingNowIso } from "../useBookingNowIso-DgJEv3ZY.mjs";
17
+ import { n as buildPortalCallbackUrl, r as requestDemoPortalMagicLink } from "../demoPortalMagicLink-CUlwvmxf.mjs";
16
18
  import * as React$1 from "react";
17
- import React, { useCallback, useEffect, useMemo, useReducer, useState } from "react";
19
+ import React, { createContext, useCallback, useContext, useEffect, useMemo, useReducer, useState } from "react";
18
20
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
19
21
  //#region ../core/src/appointment-lifecycle.ts
20
22
  const appointmentStatusLabels = {
@@ -29,6 +31,94 @@ function appointmentStatusLabel(status) {
29
31
  return appointmentStatusLabels[status];
30
32
  }
31
33
  //#endregion
34
+ //#region ../blocks/src/portal/dateFormatting.ts
35
+ /** Optional API timestamps enter the display model here; invalid values never render a Date. */
36
+ function readInstant(value) {
37
+ const result = value ? parseUtcIsoDateTimeString(value) : null;
38
+ return result?.ok ? result.value : null;
39
+ }
40
+ function formatDate(value, context, style = "short") {
41
+ const instant = readInstant(value);
42
+ return instant ? formatDate$1({
43
+ kind: "instant",
44
+ value: instant
45
+ }, context, { date: style }) : "—";
46
+ }
47
+ function formatEntitlementEnd(value, context, style = "short") {
48
+ const instant = readInstant(value);
49
+ const lastValid = instant ? /* @__PURE__ */ new Date(Date.parse(instant) - 1) : null;
50
+ return lastValid && Number.isFinite(lastValid.getTime()) ? formatDate$1({
51
+ kind: "instant",
52
+ value: toUtcIsoDateTimeString(lastValid.toISOString())
53
+ }, context, { date: style }) : "—";
54
+ }
55
+ function formatDateTime(value, context, style = "short", zone = "omit") {
56
+ const instant = readInstant(value);
57
+ return instant ? formatDateTime$1(instant, context, {
58
+ date: style,
59
+ zone
60
+ }) : "—";
61
+ }
62
+ function portalSessionDisplay(facts, site) {
63
+ return resolveBookingDisplayContext({
64
+ sessionTimeZone: resolveBookingTimeZoneId(facts.timeZone, site.timeZone),
65
+ siteTimeZone: site.timeZone,
66
+ locale: site.locale,
67
+ isOnline: facts.isOnline ?? false,
68
+ surface: "public"
69
+ });
70
+ }
71
+ function formatPortalSession(start, end, facts, site) {
72
+ const { context, zone } = portalSessionDisplay(facts, site);
73
+ const startsAt = readInstant(start);
74
+ const endsAt = readInstant(end);
75
+ if (!startsAt) return "—";
76
+ return endsAt && Date.parse(endsAt) >= Date.parse(startsAt) ? formatDateTimeRange({
77
+ start: startsAt,
78
+ end: endsAt
79
+ }, context, {
80
+ date: "short",
81
+ zone
82
+ }) : formatDateTime$1(startsAt, context, {
83
+ date: "short",
84
+ zone
85
+ });
86
+ }
87
+ function isPast(value, now) {
88
+ const instant = readInstant(value);
89
+ return instant !== null && Date.parse(instant) < Date.parse(now);
90
+ }
91
+ //#endregion
92
+ //#region ../blocks/src/customer-portal/dateDisplay.tsx
93
+ const PortalDateContext = createContext(null);
94
+ /** Hosts supply business context and one SSR snapshot; the existing clock owns reconciliation. */
95
+ function PortalDateDisplayProvider({ context, now: snapshot, children }) {
96
+ const now = useBookingNowIso(snapshot, { kind: "relative" });
97
+ return /* @__PURE__ */ jsx(PortalDateContext.Provider, {
98
+ value: {
99
+ context,
100
+ now
101
+ },
102
+ children
103
+ });
104
+ }
105
+ function usePortalDateDisplay() {
106
+ const display = useContext(PortalDateContext);
107
+ if (!display) throw new Error("Portal host must supply its date display context");
108
+ return display;
109
+ }
110
+ function usePortalDateFormatting() {
111
+ const { context, now } = usePortalDateDisplay();
112
+ return {
113
+ context,
114
+ now,
115
+ formatDate: (value, style = "short") => formatDate(value, context, style),
116
+ formatDateTime: (value, style = "short") => formatDateTime(value, context, style),
117
+ formatEntitlementEnd: (value, style = "short") => formatEntitlementEnd(value, context, style),
118
+ isPast: (value) => isPast(value, now)
119
+ };
120
+ }
121
+ //#endregion
32
122
  //#region ../blocks/src/customer-portal/tabs.ts
33
123
  function resolveInitialCustomerPortalTab(options) {
34
124
  if (options.showEvents || options.showWholeSeries) return "events";
@@ -602,53 +692,6 @@ function portalRebookHref(appointment, route) {
602
692
  return `${route.kind === "host" ? route.path : path}?${params.toString()}`;
603
693
  }
604
694
  //#endregion
605
- //#region ../blocks/src/portal/dateFormatting.ts
606
- function safeDate(dateString) {
607
- if (!dateString) return null;
608
- const date = new Date(dateString);
609
- return Number.isNaN(date.getTime()) ? null : date;
610
- }
611
- function formatDate(dateString) {
612
- const date = safeDate(dateString);
613
- if (!date) return "—";
614
- return date.toLocaleDateString("en-US", {
615
- month: "short",
616
- day: "numeric",
617
- year: "numeric"
618
- });
619
- }
620
- function formatDateTime(dateString) {
621
- const date = safeDate(dateString);
622
- if (!date) return "—";
623
- return date.toLocaleDateString("en-US", {
624
- month: "short",
625
- day: "numeric",
626
- year: "numeric",
627
- hour: "numeric",
628
- minute: "2-digit"
629
- });
630
- }
631
- /**
632
- * Check if a date is in the past
633
- */
634
- function isPast(dateStr) {
635
- const date = safeDate(dateStr);
636
- if (!date) return false;
637
- return date < /* @__PURE__ */ new Date();
638
- }
639
- function formatWaitlistDateTime(value, timeZone) {
640
- const instant = parseUtcIsoDateTimeString(value);
641
- if (!instant.ok) return "—";
642
- return formatDateTime$1(instant.value, {
643
- locale: "en-GB",
644
- timeZone: resolveBookingTimeZoneId(timeZone || getRuntimeTimeZone())
645
- }, {
646
- date: "long",
647
- year: "omit",
648
- zone: "omit"
649
- });
650
- }
651
- //#endregion
652
695
  //#region ../blocks/src/portal/types.ts
653
696
  /**
654
697
  * Get badge variant for pass status
@@ -887,20 +930,20 @@ function ScalarQuestionInput({ field, value, disabled, error, onChange }) {
887
930
  }
888
931
  //#endregion
889
932
  //#region ../blocks/src/customer-portal/components/bookings/AppointmentBeforeYouComeTask.tsx
890
- function summarizeStatus(task) {
933
+ function summarizeStatus(task, display) {
891
934
  if (task.status === "complete") return {
892
935
  label: "Complete",
893
- meta: `Completed ${formatDateTime(task.completedAt ?? task.dueAt)}`,
936
+ meta: `Completed ${formatDateTime(task.completedAt ?? task.dueAt, display.context, "short", display.zone)}`,
894
937
  actionLabel: "View answers"
895
938
  };
896
939
  if (task.status === "overdue") return {
897
940
  label: "Overdue",
898
- meta: `This was due ${formatDateTime(task.dueAt)}`,
941
+ meta: `This was due ${formatDateTime(task.dueAt, display.context, "long", display.zone)}`,
899
942
  actionLabel: "Complete now"
900
943
  };
901
944
  return {
902
945
  label: "Still to complete",
903
- meta: `Please complete this by ${formatDateTime(task.dueAt)}`,
946
+ meta: `Please complete this by ${formatDateTime(task.dueAt, display.context, "long", display.zone)}`,
904
947
  actionLabel: "Complete now"
905
948
  };
906
949
  }
@@ -1078,8 +1121,7 @@ function TaskFieldInput({ field, value, disabled, uploading, error, onChange, on
1078
1121
  });
1079
1122
  }
1080
1123
  }
1081
- function BeforeYouComeTask({ entityId, task, loadTask, saveTask, createUploadUrl, finalizeUpload, onRefresh }) {
1082
- const summary = summarizeStatus(task);
1124
+ function BeforeYouComeTask({ entityId, task, session, loadTask, saveTask, createUploadUrl, finalizeUpload, onRefresh }) {
1083
1125
  const [detail, setDetail] = React$1.useState(null);
1084
1126
  const [formValues, setFormValues] = React$1.useState({});
1085
1127
  const [fieldErrors, setFieldErrors] = React$1.useState({});
@@ -1171,6 +1213,105 @@ function BeforeYouComeTask({ entityId, task, loadTask, saveTask, createUploadUrl
1171
1213
  onRefresh,
1172
1214
  saveTask
1173
1215
  ]);
1216
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(TaskSummary, {
1217
+ task,
1218
+ session,
1219
+ onOpen: () => void openTask()
1220
+ }), open ? /* @__PURE__ */ jsx(PortalModal, {
1221
+ title: detail?.title ?? "Before you come",
1222
+ titleId: `cp-before-you-come-${entityId}`,
1223
+ onClose: closeTask,
1224
+ children: loading ? /* @__PURE__ */ jsx("div", { children: "Loading…" }) : error ? /* @__PURE__ */ jsx("div", {
1225
+ className: "cp-alert cp-alert--error",
1226
+ children: error
1227
+ }) : detail ? /* @__PURE__ */ jsxs("div", {
1228
+ className: "rb-space-y-4",
1229
+ children: [
1230
+ detail.introTitle ? /* @__PURE__ */ jsxs("div", {
1231
+ className: "rb-space-y-1",
1232
+ children: [/* @__PURE__ */ jsx("h3", {
1233
+ className: "rb-font-medium",
1234
+ children: detail.introTitle
1235
+ }), detail.introBody ? /* @__PURE__ */ jsx("p", {
1236
+ className: "rb-caption status-muted cp-before-you-come__body",
1237
+ children: detail.introBody
1238
+ }) : null]
1239
+ }) : detail.introBody ? /* @__PURE__ */ jsx("p", {
1240
+ className: "rb-caption status-muted cp-before-you-come__body",
1241
+ children: detail.introBody
1242
+ }) : null,
1243
+ detail.sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", {
1244
+ className: "rb-space-y-4",
1245
+ children: [detail.shape === "detailed-questionnaire" || sectionIndex > 0 ? /* @__PURE__ */ jsxs("div", {
1246
+ className: "rb-space-y-1",
1247
+ children: [/* @__PURE__ */ jsx("h4", {
1248
+ className: "rb-font-medium",
1249
+ children: section.title
1250
+ }), section.description ? /* @__PURE__ */ jsx("p", {
1251
+ className: "rb-caption status-muted",
1252
+ children: section.description
1253
+ }) : null]
1254
+ }) : null, section.items.map((field) => /* @__PURE__ */ jsxs("div", {
1255
+ className: "cp-field",
1256
+ children: [
1257
+ /* @__PURE__ */ jsxs("label", {
1258
+ htmlFor: field.id,
1259
+ className: "form-label",
1260
+ children: [field.label, field.required ? /* @__PURE__ */ jsx("span", {
1261
+ className: "required-marker",
1262
+ children: "*"
1263
+ }) : null]
1264
+ }),
1265
+ field.helpText ? /* @__PURE__ */ jsx("p", {
1266
+ className: "rb-caption status-muted",
1267
+ children: field.helpText
1268
+ }) : null,
1269
+ /* @__PURE__ */ jsx(TaskFieldInput, {
1270
+ field,
1271
+ value: formValues[field.id] ?? getInitialFieldValue(field, {}),
1272
+ disabled: viewOnly || saving,
1273
+ uploading: Boolean(uploadingFieldIds[field.id]),
1274
+ error: fieldErrors[field.id] ?? null,
1275
+ onChange: (next) => {
1276
+ setFormValues((current) => ({
1277
+ ...current,
1278
+ [field.id]: next
1279
+ }));
1280
+ },
1281
+ onUploadFile: field.type === "document_upload" ? async (file) => handleDocumentUpload(field.id, file) : void 0
1282
+ }),
1283
+ fieldErrors[field.id] ? /* @__PURE__ */ jsx("p", {
1284
+ className: "rb-caption status-error",
1285
+ children: fieldErrors[field.id]
1286
+ }) : null
1287
+ ]
1288
+ }, field.id))]
1289
+ }, section.id)),
1290
+ /* @__PURE__ */ jsxs("div", {
1291
+ className: "cp-modal__actions",
1292
+ children: [/* @__PURE__ */ jsx(ThemedButton, {
1293
+ type: "button",
1294
+ onClick: closeTask,
1295
+ disabled: saving,
1296
+ variant: "secondary",
1297
+ size: "sm",
1298
+ label: viewOnly ? "Close" : "Cancel"
1299
+ }), !viewOnly ? /* @__PURE__ */ jsx(ThemedButton, {
1300
+ type: "button",
1301
+ onClick: () => void submit(),
1302
+ disabled: saving || hasActiveUploads,
1303
+ variant: "primary",
1304
+ size: "sm",
1305
+ label: saving ? "Saving…" : hasActiveUploads ? "Uploading…" : "Save details"
1306
+ }) : null]
1307
+ })
1308
+ ]
1309
+ }) : null
1310
+ }) : null] });
1311
+ }
1312
+ function TaskSummary({ task, session, onOpen }) {
1313
+ const { context } = usePortalDateDisplay();
1314
+ const summary = summarizeStatus(task, portalSessionDisplay(session, context));
1174
1315
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1175
1316
  /* @__PURE__ */ jsxs("div", {
1176
1317
  className: "cp-card-meta",
@@ -1187,103 +1328,12 @@ function BeforeYouComeTask({ entityId, task, loadTask, saveTask, createUploadUrl
1187
1328
  className: "cp-card-actions",
1188
1329
  children: /* @__PURE__ */ jsx(ThemedButton, {
1189
1330
  type: "button",
1190
- onClick: () => void openTask(),
1331
+ onClick: onOpen,
1191
1332
  variant: "secondary",
1192
1333
  size: "sm",
1193
1334
  label: summary.actionLabel
1194
1335
  })
1195
- }),
1196
- open ? /* @__PURE__ */ jsx(PortalModal, {
1197
- title: detail?.title ?? "Before you come",
1198
- titleId: `cp-before-you-come-${entityId}`,
1199
- onClose: closeTask,
1200
- children: loading ? /* @__PURE__ */ jsx("div", { children: "Loading…" }) : error ? /* @__PURE__ */ jsx("div", {
1201
- className: "cp-alert cp-alert--error",
1202
- children: error
1203
- }) : detail ? /* @__PURE__ */ jsxs("div", {
1204
- className: "rb-space-y-4",
1205
- children: [
1206
- detail.introTitle ? /* @__PURE__ */ jsxs("div", {
1207
- className: "rb-space-y-1",
1208
- children: [/* @__PURE__ */ jsx("h3", {
1209
- className: "rb-font-medium",
1210
- children: detail.introTitle
1211
- }), detail.introBody ? /* @__PURE__ */ jsx("p", {
1212
- className: "rb-caption status-muted cp-before-you-come__body",
1213
- children: detail.introBody
1214
- }) : null]
1215
- }) : detail.introBody ? /* @__PURE__ */ jsx("p", {
1216
- className: "rb-caption status-muted cp-before-you-come__body",
1217
- children: detail.introBody
1218
- }) : null,
1219
- detail.sections.map((section, sectionIndex) => /* @__PURE__ */ jsxs("div", {
1220
- className: "rb-space-y-4",
1221
- children: [detail.shape === "detailed-questionnaire" || sectionIndex > 0 ? /* @__PURE__ */ jsxs("div", {
1222
- className: "rb-space-y-1",
1223
- children: [/* @__PURE__ */ jsx("h4", {
1224
- className: "rb-font-medium",
1225
- children: section.title
1226
- }), section.description ? /* @__PURE__ */ jsx("p", {
1227
- className: "rb-caption status-muted",
1228
- children: section.description
1229
- }) : null]
1230
- }) : null, section.items.map((field) => /* @__PURE__ */ jsxs("div", {
1231
- className: "cp-field",
1232
- children: [
1233
- /* @__PURE__ */ jsxs("label", {
1234
- htmlFor: field.id,
1235
- className: "form-label",
1236
- children: [field.label, field.required ? /* @__PURE__ */ jsx("span", {
1237
- className: "required-marker",
1238
- children: "*"
1239
- }) : null]
1240
- }),
1241
- field.helpText ? /* @__PURE__ */ jsx("p", {
1242
- className: "rb-caption status-muted",
1243
- children: field.helpText
1244
- }) : null,
1245
- /* @__PURE__ */ jsx(TaskFieldInput, {
1246
- field,
1247
- value: formValues[field.id] ?? getInitialFieldValue(field, {}),
1248
- disabled: viewOnly || saving,
1249
- uploading: Boolean(uploadingFieldIds[field.id]),
1250
- error: fieldErrors[field.id] ?? null,
1251
- onChange: (next) => {
1252
- setFormValues((current) => ({
1253
- ...current,
1254
- [field.id]: next
1255
- }));
1256
- },
1257
- onUploadFile: field.type === "document_upload" ? async (file) => handleDocumentUpload(field.id, file) : void 0
1258
- }),
1259
- fieldErrors[field.id] ? /* @__PURE__ */ jsx("p", {
1260
- className: "rb-caption status-error",
1261
- children: fieldErrors[field.id]
1262
- }) : null
1263
- ]
1264
- }, field.id))]
1265
- }, section.id)),
1266
- /* @__PURE__ */ jsxs("div", {
1267
- className: "cp-modal__actions",
1268
- children: [/* @__PURE__ */ jsx(ThemedButton, {
1269
- type: "button",
1270
- onClick: closeTask,
1271
- disabled: saving,
1272
- variant: "secondary",
1273
- size: "sm",
1274
- label: viewOnly ? "Close" : "Cancel"
1275
- }), !viewOnly ? /* @__PURE__ */ jsx(ThemedButton, {
1276
- type: "button",
1277
- onClick: () => void submit(),
1278
- disabled: saving || hasActiveUploads,
1279
- variant: "primary",
1280
- size: "sm",
1281
- label: saving ? "Saving…" : hasActiveUploads ? "Uploading…" : "Save details"
1282
- }) : null]
1283
- })
1284
- ]
1285
- }) : null
1286
- }) : null
1336
+ })
1287
1337
  ] });
1288
1338
  }
1289
1339
  function BeforeYouComeTaskDisplay({ task, ...props }) {
@@ -1296,6 +1346,42 @@ function BeforeYouComeTaskDisplay({ task, ...props }) {
1296
1346
  });
1297
1347
  }
1298
1348
  //#endregion
1349
+ //#region ../blocks/src/customer-portal/components/bookings/eventSeriesRegistrationPresentation.ts
1350
+ function assertEventSeriesRegistrationHasSessions(enrollment) {
1351
+ if (enrollment.sessions.length === 0) throw new Error(`Event series registration ${enrollment.id} must include at least one session.`);
1352
+ }
1353
+ function getSortedEventSessions(enrollment) {
1354
+ assertEventSeriesRegistrationHasSessions(enrollment);
1355
+ return [...enrollment.sessions].sort((a, b) => a.startsAt.localeCompare(b.startsAt));
1356
+ }
1357
+ function selectPrimaryEventSession(enrollment) {
1358
+ const sessions = getSortedEventSessions(enrollment);
1359
+ if (enrollment.nextSessionAt) {
1360
+ const nextSession = sessions.find((session) => session.startsAt === enrollment.nextSessionAt);
1361
+ if (nextSession) return nextSession;
1362
+ }
1363
+ return sessions[sessions.length - 1] ?? sessions[0];
1364
+ }
1365
+ function getEventSeriesRegistrationSortDate(enrollment) {
1366
+ return selectPrimaryEventSession(enrollment).startsAt;
1367
+ }
1368
+ function formatEventSessionDate(session, context, isOnline) {
1369
+ return formatPortalSession(session.startsAt, session.endsAt, {
1370
+ timeZone: session.timeZone,
1371
+ isOnline
1372
+ }, context);
1373
+ }
1374
+ function getPrimaryEventSessionDateLabel(enrollment, context) {
1375
+ const primarySession = selectPrimaryEventSession(enrollment);
1376
+ return `${enrollment.nextSessionAt === primarySession.startsAt ? "Next session" : "Last session"}: ${formatEventSessionDate(primarySession, context, enrollment.isOnline)}`;
1377
+ }
1378
+ function getSessionDatesSummary(enrollment, context) {
1379
+ return `Session dates: ${getSortedEventSessions(enrollment).map((session) => formatEventSessionDate(session, context, enrollment.isOnline)).join(", ")}`;
1380
+ }
1381
+ function getEventSessionCountLabel(enrollment) {
1382
+ return `${enrollment.sessionsCount} session${enrollment.sessionsCount === 1 ? "" : "s"}`;
1383
+ }
1384
+ //#endregion
1299
1385
  //#region ../blocks/src/customer-portal/components/bookings/EventSeriesRegistrationTableRow.tsx
1300
1386
  function RegistrationDetails({ enrollment, primaryDateLabel, sessionDatesSummary, sessionCountLabel, statusBadge }) {
1301
1387
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1347,7 +1433,6 @@ function RegistrationTicketCells({ enrollment, additionalParticipants }) {
1347
1433
  })] });
1348
1434
  }
1349
1435
  function EventSeriesRegistrationTableRow({ enrollment, primaryDateLabel, sessionDatesSummary, sessionCountLabel, statusBadge, isMuted, showActionsColumn, hasAnyActions, additionalParticipants, cancelFlow, openActions, onRefresh }) {
1350
- const api = useBlockApi();
1351
1436
  const actionsButton = hasAnyActions ? /* @__PURE__ */ jsx(ThemedActionsButton, {
1352
1437
  type: "button",
1353
1438
  variant: "secondary",
@@ -1370,15 +1455,10 @@ function EventSeriesRegistrationTableRow({ enrollment, primaryDateLabel, session
1370
1455
  sessionCountLabel,
1371
1456
  statusBadge
1372
1457
  }),
1373
- enrollment.beforeYouCome ? /* @__PURE__ */ jsx(BeforeYouComeTaskDisplay, {
1374
- entityId: enrollment.id,
1375
- task: enrollment.beforeYouCome,
1376
- loadTask: () => api.getPortalWholeSeriesBookingQuestions(enrollment.id),
1377
- saveTask: (data) => api.updatePortalWholeSeriesBookingQuestions(enrollment.id, data),
1378
- createUploadUrl: (data) => api.createPortalWholeSeriesBookingQuestionsUploadUrl(enrollment.id, data),
1379
- finalizeUpload: (data) => api.finalizePortalWholeSeriesBookingQuestionsUpload(enrollment.id, data),
1458
+ /* @__PURE__ */ jsx(RegistrationTask, {
1459
+ enrollment,
1380
1460
  onRefresh
1381
- }) : null,
1461
+ }),
1382
1462
  showActionsColumn && hasAnyActions ? /* @__PURE__ */ jsx("div", {
1383
1463
  className: "cp-row-mobile-actions cp-only-mobile",
1384
1464
  children: actionsButton
@@ -1399,41 +1479,21 @@ function EventSeriesRegistrationTableRow({ enrollment, primaryDateLabel, session
1399
1479
  ]
1400
1480
  });
1401
1481
  }
1402
- //#endregion
1403
- //#region ../blocks/src/customer-portal/components/bookings/eventSeriesRegistrationPresentation.ts
1404
- function assertEventSeriesRegistrationHasSessions(enrollment) {
1405
- if (enrollment.sessions.length === 0) throw new Error(`Event series registration ${enrollment.id} must include at least one session.`);
1406
- }
1407
- function getSortedEventSessions(enrollment) {
1408
- assertEventSeriesRegistrationHasSessions(enrollment);
1409
- return [...enrollment.sessions].sort((a, b) => a.startsAt.localeCompare(b.startsAt));
1410
- }
1411
- function selectPrimaryEventSession(enrollment) {
1412
- const sessions = getSortedEventSessions(enrollment);
1413
- if (enrollment.nextSessionAt) {
1414
- const nextSession = sessions.find((session) => session.startsAt === enrollment.nextSessionAt);
1415
- if (nextSession) return nextSession;
1416
- }
1417
- return sessions[sessions.length - 1] ?? sessions[0];
1418
- }
1419
- function getEventSeriesRegistrationSortDate(enrollment) {
1420
- return selectPrimaryEventSession(enrollment).startsAt;
1421
- }
1422
- function formatEventSessionDate(session) {
1423
- return formatBookingDateTime(toScheduledBookingDateTime({
1424
- startsAt: session.startsAt,
1425
- timeZone: session.timeZone
1426
- }));
1427
- }
1428
- function getPrimaryEventSessionDateLabel(enrollment) {
1429
- const primarySession = selectPrimaryEventSession(enrollment);
1430
- return `${enrollment.nextSessionAt === primarySession.startsAt ? "Next session" : "Last session"}: ${formatEventSessionDate(primarySession)}`;
1431
- }
1432
- function getSessionDatesSummary(enrollment) {
1433
- return `Session dates: ${getSortedEventSessions(enrollment).map(formatEventSessionDate).join(", ")}`;
1434
- }
1435
- function getEventSessionCountLabel(enrollment) {
1436
- return `${enrollment.sessionsCount} session${enrollment.sessionsCount === 1 ? "" : "s"}`;
1482
+ function RegistrationTask({ enrollment, onRefresh }) {
1483
+ const api = useBlockApi();
1484
+ return /* @__PURE__ */ jsx(Fragment, { children: enrollment.beforeYouCome ? /* @__PURE__ */ jsx(BeforeYouComeTaskDisplay, {
1485
+ entityId: enrollment.id,
1486
+ task: enrollment.beforeYouCome,
1487
+ session: {
1488
+ timeZone: selectPrimaryEventSession(enrollment).timeZone,
1489
+ isOnline: enrollment.isOnline
1490
+ },
1491
+ loadTask: () => api.getPortalWholeSeriesBookingQuestions(enrollment.id),
1492
+ saveTask: (data) => api.updatePortalWholeSeriesBookingQuestions(enrollment.id, data),
1493
+ createUploadUrl: (data) => api.createPortalWholeSeriesBookingQuestionsUploadUrl(enrollment.id, data),
1494
+ finalizeUpload: (data) => api.finalizePortalWholeSeriesBookingQuestionsUpload(enrollment.id, data),
1495
+ onRefresh
1496
+ }) : null });
1437
1497
  }
1438
1498
  //#endregion
1439
1499
  //#region ../blocks/src/customer-portal/components/bookings/usePortalCancelFlow.state.ts
@@ -1660,21 +1720,14 @@ function EventSeriesCancellationDialog({ enrollmentId, cancelFlow }) {
1660
1720
  });
1661
1721
  }
1662
1722
  function EventSeriesRegistrationRow({ enrollment, isPast = false, showActionsColumn = true, onRefresh }) {
1723
+ const { context } = usePortalDateDisplay();
1663
1724
  const api = useBlockApi();
1664
1725
  const [actionsOpen, setActionsOpen] = React$1.useState(false);
1665
1726
  const cancelFlow = usePortalCancelFlow({
1666
1727
  cancel: React$1.useCallback((opts) => api.cancelWholeSeriesRegistration(enrollment.id, { confirmCancelWithoutRefund: opts?.confirmCancelWithoutRefund }), [api, enrollment.id]),
1667
1728
  onRefresh
1668
1729
  });
1669
- const primaryDateLabel = React$1.useMemo(() => getPrimaryEventSessionDateLabel(enrollment), [enrollment]);
1670
- const sessionDatesSummary = React$1.useMemo(() => getSessionDatesSummary(enrollment), [enrollment]);
1671
- const sessionCountLabel = React$1.useMemo(() => getEventSessionCountLabel(enrollment), [enrollment]);
1672
- const canCancel = !isPast && enrollment.status !== "cancelled" && enrollment.status !== "completed";
1673
- const canViewEventDetails = !!enrollment.eventPath;
1674
- const hasAnyActions = canCancel || canViewEventDetails;
1675
- const statusBadge = getWholeSeriesNonEnrolledBadge(enrollment);
1676
- const isMuted = isPast || enrollment.status === "cancelled";
1677
- const additionalParticipants = enrollment.participants.filter((participant) => !participant.isBooker);
1730
+ const { primaryDateLabel, sessionDatesSummary, sessionCountLabel, canCancel, canViewEventDetails, hasAnyActions, statusBadge, isMuted, additionalParticipants } = presentEventSeriesRegistration(enrollment, isPast, context);
1678
1731
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(EventSeriesRegistrationDialogs, {
1679
1732
  enrollment,
1680
1733
  actionsOpen,
@@ -1697,6 +1750,21 @@ function EventSeriesRegistrationRow({ enrollment, isPast = false, showActionsCol
1697
1750
  onRefresh
1698
1751
  })] });
1699
1752
  }
1753
+ function presentEventSeriesRegistration(enrollment, isPast, context) {
1754
+ const canCancel = !isPast && enrollment.status !== "cancelled" && enrollment.status !== "completed";
1755
+ const canViewEventDetails = Boolean(enrollment.eventPath);
1756
+ return {
1757
+ primaryDateLabel: getPrimaryEventSessionDateLabel(enrollment, context),
1758
+ sessionDatesSummary: getSessionDatesSummary(enrollment, context),
1759
+ sessionCountLabel: getEventSessionCountLabel(enrollment),
1760
+ canCancel,
1761
+ canViewEventDetails,
1762
+ hasAnyActions: canCancel || canViewEventDetails,
1763
+ statusBadge: getWholeSeriesNonEnrolledBadge(enrollment),
1764
+ isMuted: isPast || enrollment.status === "cancelled",
1765
+ additionalParticipants: enrollment.participants.filter((participant) => !participant.isBooker)
1766
+ };
1767
+ }
1700
1768
  //#endregion
1701
1769
  //#region ../blocks/src/customer-portal/components/bookings/eventGuestDrafts.ts
1702
1770
  /** Guest indices, not response ordering, identify each additional ticket holder. */
@@ -1749,6 +1817,7 @@ function getEventNonConfirmedBadge(event) {
1749
1817
  };
1750
1818
  }
1751
1819
  function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true, onRefresh, onUpdateGuests }) {
1820
+ const { context } = usePortalDateDisplay();
1752
1821
  const api = useBlockApi();
1753
1822
  const [actionsOpen, setActionsOpen] = React$1.useState(false);
1754
1823
  const [transferFormOpen, setTransferFormOpen] = React$1.useState(false);
@@ -2158,14 +2227,12 @@ function EventRow({ event, isPast: isEventPast = false, showActionsColumn = true
2158
2227
  }),
2159
2228
  /* @__PURE__ */ jsxs("div", {
2160
2229
  className: "cp-row-meta",
2161
- children: [/* @__PURE__ */ jsx("span", { children: formatBookingDateTime(toScheduledBookingDateTime({
2162
- startsAt: event.startsAt,
2163
- timeZone: event.timeZone
2164
- })) }), event.venueName && /* @__PURE__ */ jsx("span", { children: event.venueName })]
2230
+ children: [/* @__PURE__ */ jsx("span", { children: formatPortalSession(event.startsAt, event.endsAt, event, context) }), event.venueName && /* @__PURE__ */ jsx("span", { children: event.venueName })]
2165
2231
  }),
2166
2232
  event.beforeYouCome ? /* @__PURE__ */ jsx(BeforeYouComeTaskDisplay, {
2167
2233
  entityId: event.id,
2168
2234
  task: event.beforeYouCome,
2235
+ session: event,
2169
2236
  loadTask: () => api.getPortalEventBookingQuestions(event.id),
2170
2237
  saveTask: (data) => api.updatePortalEventBookingQuestions(event.id, data),
2171
2238
  createUploadUrl: (data) => api.createPortalEventBookingQuestionsUploadUrl(event.id, data),
@@ -2288,7 +2355,8 @@ function queuePositionLabel(position) {
2288
2355
  return `You're ${position}${mod100 >= 11 && mod100 <= 13 ? "th" : position % 10 === 1 ? "st" : position % 10 === 2 ? "nd" : position % 10 === 3 ? "rd" : "th"} in the queue`;
2289
2356
  }
2290
2357
  function WaitlistStatus({ entry }) {
2291
- const timeZone = entry.subject.kind === "occurrence" ? entry.subject.timeZone : void 0;
2358
+ const { context: site } = usePortalDateDisplay();
2359
+ const { context, zone } = portalSessionDisplay(entry.subject, site);
2292
2360
  if (entry.status === "waiting") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
2293
2361
  className: "cp-waitlist-card__position",
2294
2362
  children: queuePositionLabel(entry.queuePosition)
@@ -2298,19 +2366,19 @@ function WaitlistStatus({ entry }) {
2298
2366
  })] });
2299
2367
  if (entry.status === "placeAvailable") return /* @__PURE__ */ jsxs("p", {
2300
2368
  className: "cp-waitlist-card__position",
2301
- children: ["Book by ", formatWaitlistDateTime(entry.claimExpiresAt, timeZone)]
2369
+ children: ["Book by ", formatDateTime(entry.claimExpiresAt, context, "long", zone)]
2302
2370
  });
2303
2371
  return /* @__PURE__ */ jsxs("p", { children: [
2304
2372
  "This offer expired on ",
2305
- formatWaitlistDateTime(entry.claimExpiredAt, timeZone),
2373
+ formatDateTime(entry.claimExpiredAt, context, "long", zone),
2306
2374
  " and is no longer available."
2307
2375
  ] });
2308
2376
  }
2309
- function waitlistCardPresentation(entry) {
2377
+ function waitlistCardPresentation(entry, context) {
2310
2378
  const placeAvailable = entry.status === "placeAvailable";
2311
2379
  const expired = entry.status === "offerExpired";
2312
2380
  return {
2313
- summary: entry.subject.kind === "occurrence" ? formatWaitlistDateTime(entry.subject.startsAt, entry.subject.timeZone) : entry.subject.scheduleSummary,
2381
+ summary: entry.subject.kind === "occurrence" ? formatPortalSession(entry.subject.startsAt, entry.subject.endsAt, entry.subject, context) : entry.subject.scheduleSummary,
2314
2382
  title: placeAvailable ? entry.requestedPlaces === 1 ? "A place is ready for you" : "Places are ready for you" : entry.eventTitle,
2315
2383
  badge: placeAvailable ? "Place available" : expired ? "Offer expired" : "On the waitlist",
2316
2384
  badgeVariant: placeAvailable ? "success" : expired ? "error" : "info",
@@ -2318,7 +2386,8 @@ function waitlistCardPresentation(entry) {
2318
2386
  };
2319
2387
  }
2320
2388
  function WaitlistCard({ entry, focused, focusedRef, onLeave }) {
2321
- const presentation = waitlistCardPresentation(entry);
2389
+ const { context } = usePortalDateDisplay();
2390
+ const presentation = waitlistCardPresentation(entry, context);
2322
2391
  return /* @__PURE__ */ jsxs("article", {
2323
2392
  ref: focused ? focusedRef : void 0,
2324
2393
  className: `cp-card cp-waitlist-card${focused ? " cp-waitlist-card--focused" : ""}`,
@@ -2477,21 +2546,12 @@ function WaitlistsSection({ waitlists, focusedEntryId, onLeave, onRefresh, onFee
2477
2546
  //#endregion
2478
2547
  //#region ../blocks/src/customer-portal/components/bookings/BookingsSection.tsx
2479
2548
  function BookingsSection({ events, wholeSeriesRegistrations, waitlists = [], focusedWaitlistEntryId = null, emptyMessage, onRefresh, onWaitlistFeedback, onUpdateGuests, onLeaveWaitlist = async () => ({ outcome: "notFound" }) }) {
2480
- const items = React$1.useMemo(() => {
2481
- const eventItems = events.map((event) => ({
2482
- kind: "event",
2483
- startsAt: event.startsAt,
2484
- event
2485
- }));
2486
- const wholeSeriesItems = wholeSeriesRegistrations.map((enrollment) => ({
2487
- kind: "eventSeriesRegistration",
2488
- startsAt: getEventSeriesRegistrationSortDate(enrollment),
2489
- enrollment
2490
- }));
2491
- return [...eventItems, ...wholeSeriesItems];
2492
- }, [wholeSeriesRegistrations, events]);
2493
- const upcoming = React$1.useMemo(() => items.filter((i) => !isPast(i.startsAt)).sort((a, b) => a.startsAt.localeCompare(b.startsAt)), [items]);
2494
- const past = React$1.useMemo(() => items.filter((i) => isPast(i.startsAt)).sort((a, b) => b.startsAt.localeCompare(a.startsAt)), [items]);
2549
+ const { now } = usePortalDateDisplay();
2550
+ const { items, upcoming, past } = React$1.useMemo(() => groupPortalBookings(events, wholeSeriesRegistrations, now), [
2551
+ events,
2552
+ wholeSeriesRegistrations,
2553
+ now
2554
+ ]);
2495
2555
  if (items.length === 0 && waitlists.length === 0) return /* @__PURE__ */ jsx("div", {
2496
2556
  className: "cp-section cp-section--events",
2497
2557
  children: /* @__PURE__ */ jsx("div", {
@@ -2534,6 +2594,22 @@ function BookingsSection({ events, wholeSeriesRegistrations, waitlists = [], foc
2534
2594
  ]
2535
2595
  });
2536
2596
  }
2597
+ function groupPortalBookings(events, wholeSeriesRegistrations, now) {
2598
+ const items = [...events.map((event) => ({
2599
+ kind: "event",
2600
+ startsAt: event.startsAt,
2601
+ event
2602
+ })), ...wholeSeriesRegistrations.map((enrollment) => ({
2603
+ kind: "eventSeriesRegistration",
2604
+ startsAt: getEventSeriesRegistrationSortDate(enrollment),
2605
+ enrollment
2606
+ }))];
2607
+ return {
2608
+ items,
2609
+ upcoming: items.filter((item) => !isPast(item.startsAt, now)).sort((a, b) => a.startsAt.localeCompare(b.startsAt)),
2610
+ past: items.filter((item) => isPast(item.startsAt, now)).sort((a, b) => b.startsAt.localeCompare(a.startsAt))
2611
+ };
2612
+ }
2537
2613
  //#endregion
2538
2614
  //#region ../blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.state.ts
2539
2615
  const ANY_PRACTITIONER_SENTINEL = "__any__";
@@ -2684,7 +2760,6 @@ function resolveAppointmentRescheduleAvailabilityResourceId(state, currentResour
2684
2760
  //#endregion
2685
2761
  //#region ../blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.ts
2686
2762
  const appointmentRescheduleFlowDeps = {
2687
- getRuntimeTimeZone,
2688
2763
  useAvailableDates,
2689
2764
  useAvailableSlots
2690
2765
  };
@@ -2738,8 +2813,9 @@ function canShowAppointmentRescheduleControls(viewState) {
2738
2813
  default: return assertNever(viewState);
2739
2814
  }
2740
2815
  }
2741
- function useAppointmentRescheduleFlow({ serviceId, currentResourceId, currentPractitionerLabel, resources, resourcesLoading = false }) {
2816
+ function useAppointmentRescheduleFlow({ timeZone, serviceId, currentResourceId, currentPractitionerLabel, resources, resourcesLoading = false }) {
2742
2817
  return useAppointmentRescheduleFlowWithDeps({
2818
+ timeZone,
2743
2819
  serviceId,
2744
2820
  currentResourceId,
2745
2821
  currentPractitionerLabel,
@@ -2747,25 +2823,21 @@ function useAppointmentRescheduleFlow({ serviceId, currentResourceId, currentPra
2747
2823
  resourcesLoading
2748
2824
  }, appointmentRescheduleFlowDeps);
2749
2825
  }
2750
- function useAppointmentRescheduleFlowWithDeps({ serviceId, currentResourceId, currentPractitionerLabel, resources, resourcesLoading = false }, deps) {
2751
- const viewerTimeZone = deps.getRuntimeTimeZone();
2826
+ function useAppointmentRescheduleFlowWithDeps({ timeZone: viewerTimeZone, serviceId, currentResourceId, currentPractitionerLabel, resources, resourcesLoading = false }, deps) {
2752
2827
  const [state, dispatch] = React$1.useReducer(appointmentRescheduleFlowReducer, initialAppointmentRescheduleFlowState);
2753
2828
  const switchingPractitioner = isSwitchingAppointmentReschedulePractitioner(state);
2754
2829
  const practitionerSelection = getAppointmentReschedulePractitionerSelection(state);
2755
2830
  const selectedPractitionerId = getAppointmentRescheduleSelectedPractitionerId(state);
2756
2831
  const availabilityResourceId = resolveAppointmentRescheduleAvailabilityResourceId(state, currentResourceId);
2757
2832
  const selectedPractitionerIsAny = practitionerSelection?.kind === "any";
2758
- const { availableDates, isLoading: datesLoading, error: datesError, hasMore, loadMore } = deps.useAvailableDates({
2759
- serviceId,
2760
- resourceId: availabilityResourceId,
2761
- timezone: viewerTimeZone
2762
- });
2763
- const { slots, isLoading: slotsLoading, error: slotsError } = deps.useAvailableSlots({
2833
+ const { dates, slots: availableSlots } = useRescheduleAvailability({
2764
2834
  serviceId,
2765
2835
  resourceId: availabilityResourceId,
2766
2836
  selectedDate: state.selectedDate,
2767
2837
  timezone: viewerTimeZone
2768
- });
2838
+ }, deps);
2839
+ const { availableDates, isLoading: datesLoading, error: datesError, hasMore, loadMore } = dates;
2840
+ const { slots, isLoading: slotsLoading, error: slotsError } = availableSlots;
2769
2841
  const sortedDates = React$1.useMemo(() => [...availableDates].sort(), [availableDates]);
2770
2842
  const selectedSlot = React$1.useMemo(() => resolveAppointmentRescheduleSelectedSlot(slots, state.selectedSlot), [slots, state.selectedSlot]);
2771
2843
  const selectedSlotIdentity = getAppointmentRescheduleSelectedSlotIdentity(state.selectedSlot);
@@ -2845,6 +2917,16 @@ function useAppointmentRescheduleFlowWithDeps({ serviceId, currentResourceId, cu
2845
2917
  selectSlot
2846
2918
  };
2847
2919
  }
2920
+ function useRescheduleAvailability(input, deps) {
2921
+ const { selectedDate, ...dateOptions } = input;
2922
+ return {
2923
+ dates: deps.useAvailableDates(dateOptions),
2924
+ slots: deps.useAvailableSlots({
2925
+ ...dateOptions,
2926
+ selectedDate
2927
+ })
2928
+ };
2929
+ }
2848
2930
  //#endregion
2849
2931
  //#region ../blocks/src/system/runtime/shared/AppointmentRescheduleSlotOptions.tsx
2850
2932
  function AppointmentRescheduleSlotOptions({ slots, resources, switchingPractitioner, selectedPractitionerIsAny, formatSlotStartAt }) {
@@ -2860,6 +2942,8 @@ function AppointmentRescheduleSlotOptions({ slots, resources, switchingPractitio
2860
2942
  //#endregion
2861
2943
  //#region ../blocks/src/customer-portal/components/bookings/PortalAppointmentRescheduleFlow.tsx
2862
2944
  function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
2945
+ const { context: site } = usePortalDateDisplay();
2946
+ const { context, zone } = portalSessionDisplay(appointment, site);
2863
2947
  const api = useBlockApi();
2864
2948
  const [resources, setResources] = React$1.useState([]);
2865
2949
  const [resourcesLoading, setResourcesLoading] = React$1.useState(true);
@@ -2890,6 +2974,7 @@ function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
2890
2974
  };
2891
2975
  }, [api, appointment.serviceId]);
2892
2976
  const { switchingPractitioner, selectedPractitionerId, selectedPractitionerIsAny, selectedDate, selectedSlotValue, sortedDates, datesLoading, datesError, hasMore, loadMore, slots, slotsLoading, slotsError, selectedSlot, selectedPractitionerName, viewState, canShowRescheduleControls, startSwitchingPractitioner, selectPractitionerOptionValue, selectDate, selectSlot } = useAppointmentRescheduleFlow({
2977
+ timeZone: context.timeZone,
2893
2978
  serviceId: appointment.serviceId,
2894
2979
  currentResourceId: appointment.resourceId ? unsafeAsAppointmentResourceId(appointment.resourceId) : null,
2895
2980
  currentPractitionerLabel: appointment.resourceName ?? "your practitioner",
@@ -2934,20 +3019,7 @@ function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
2934
3019
  children: /* @__PURE__ */ jsxs("div", {
2935
3020
  className: "cp-card",
2936
3021
  children: [
2937
- /* @__PURE__ */ jsx("div", {
2938
- className: "cp-card-header",
2939
- children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
2940
- className: "cp-card-title",
2941
- children: appointment.serviceName
2942
- }), appointment.resourceName ? /* @__PURE__ */ jsxs("p", {
2943
- className: "cp-card-subtitle",
2944
- children: ["with ", appointment.resourceName]
2945
- }) : null] })
2946
- }),
2947
- /* @__PURE__ */ jsx("div", {
2948
- className: "cp-card-meta",
2949
- children: /* @__PURE__ */ jsxs("span", { children: ["Current time: ", formatDateTime(appointment.startAt)] })
2950
- }),
3022
+ /* @__PURE__ */ jsx(CurrentAppointment, { appointment }),
2951
3023
  resourceError ? /* @__PURE__ */ jsx("p", {
2952
3024
  className: "cp-card-subtitle cp-card-subtitle--spaced",
2953
3025
  children: resourceError
@@ -3026,7 +3098,7 @@ function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
3026
3098
  children: "Choose a date…"
3027
3099
  }), sortedDates.map((date) => /* @__PURE__ */ jsx("option", {
3028
3100
  value: date,
3029
- children: date
3101
+ children: formatDate$2(date, context, { date: "short" }) ?? "—"
3030
3102
  }, date))]
3031
3103
  }),
3032
3104
  hasMore ? /* @__PURE__ */ jsx(ThemedButton, {
@@ -3056,7 +3128,7 @@ function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
3056
3128
  resources,
3057
3129
  switchingPractitioner,
3058
3130
  selectedPractitionerIsAny,
3059
- formatSlotStartAt: formatDateTime
3131
+ formatSlotStartAt: (startAt) => formatDateTime(startAt, context, "short", zone)
3060
3132
  })]
3061
3133
  })]
3062
3134
  }) : null,
@@ -3088,6 +3160,22 @@ function PortalAppointmentRescheduleFlow({ appointment, onClose, onSuccess }) {
3088
3160
  })
3089
3161
  });
3090
3162
  }
3163
+ function CurrentAppointment({ appointment }) {
3164
+ const { context: site } = usePortalDateDisplay();
3165
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
3166
+ className: "cp-card-header",
3167
+ children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
3168
+ className: "cp-card-title",
3169
+ children: appointment.serviceName
3170
+ }), appointment.resourceName ? /* @__PURE__ */ jsxs("p", {
3171
+ className: "cp-card-subtitle",
3172
+ children: ["with ", appointment.resourceName]
3173
+ }) : null] })
3174
+ }), /* @__PURE__ */ jsx("div", {
3175
+ className: "cp-card-meta",
3176
+ children: /* @__PURE__ */ jsxs("span", { children: ["Current time: ", formatPortalSession(appointment.startAt, appointment.endAt, appointment, site)] })
3177
+ })] });
3178
+ }
3091
3179
  //#endregion
3092
3180
  //#region ../blocks/src/customer-portal/components/bookings/appointmentRequestPresentation.ts
3093
3181
  function appointmentCancelCopy(appointment) {
@@ -3120,9 +3208,10 @@ function rescheduleNote(appointment) {
3120
3208
  }
3121
3209
  }
3122
3210
  function presentPortalAppointment(appointment, display) {
3123
- const slot = describePortalAppointmentSlot(appointment.startAt, display.context);
3211
+ const session = portalSessionDisplay(appointment, display.context);
3212
+ const slot = { when: formatDateTime(appointment.startAt, session.context, "long", session.zone) };
3124
3213
  const ordinary = {
3125
- when: `${slot.date} at ${slot.time}`,
3214
+ when: formatPortalSession(appointment.startAt, appointment.endAt, appointment, display.context),
3126
3215
  statusLabel: portalAppointmentStatusLabel(appointment.status),
3127
3216
  badgeVariant: getAppointmentBadgeVariant(appointment.status),
3128
3217
  hint: null,
@@ -3134,7 +3223,7 @@ function presentPortalAppointment(appointment, display) {
3134
3223
  hint: "We'll email you once it's been looked at.",
3135
3224
  cancel: {
3136
3225
  buttonLabel: "Cancel request",
3137
- title: `Cancel your request for ${appointment.serviceName} on ${slot.date} at ${slot.time}?`,
3226
+ title: `Cancel your request for ${appointment.serviceName} on ${slot.when}?`,
3138
3227
  body: display.siteTitle ? `We'll let ${display.siteTitle} know.` : "We'll let them know.",
3139
3228
  keepLabel: "Keep it",
3140
3229
  confirmLabel: "Cancel request"
@@ -3158,22 +3247,6 @@ function portalAppointmentStatusLabel(status) {
3158
3247
  case "requested": return appointmentStatusLabel(status);
3159
3248
  }
3160
3249
  }
3161
- function describePortalAppointmentSlot(startAt, context) {
3162
- const value = toUtcIsoDateTimeString(startAt);
3163
- return {
3164
- date: formatDate$1({
3165
- kind: "instant",
3166
- value
3167
- }, context, {
3168
- weekday: "short",
3169
- year: "omit"
3170
- }),
3171
- time: formatTime(value, context, {
3172
- zone: "omit",
3173
- clock: "24-hour"
3174
- })
3175
- };
3176
- }
3177
3250
  //#endregion
3178
3251
  //#region ../blocks/src/customer-portal/shared/checkoutUrls.ts
3179
3252
  function buildCheckoutReturnUrls(paramName, anchorId) {
@@ -3287,6 +3360,7 @@ function selectOrderInteraction(state, orders) {
3287
3360
  //#endregion
3288
3361
  //#region ../blocks/src/customer-portal/components/orders/OrdersSection.tsx
3289
3362
  function OrdersSection({ orders, emptyMessage, requestedOrderId = null, onRequestedOrderResolved }) {
3363
+ const { formatDateTime } = usePortalDateFormatting();
3290
3364
  const api = useBlockApi();
3291
3365
  const [filterPreference, setFilterPreference] = React$1.useState("all");
3292
3366
  const [storedInteraction, dispatch] = React$1.useReducer(orderInteractionReducer, initialOrderInteraction);
@@ -3496,6 +3570,7 @@ function OrdersSection({ orders, emptyMessage, requestedOrderId = null, onReques
3496
3570
  });
3497
3571
  }
3498
3572
  function OrderDetailsModal({ order, balanceEligibility, payingOrderId, orderActionError, isCustomAmountOpen, customAmountInput, onChangeCustomAmount, onClose, onPayNow, onToggleCustomAmount, onSubmitCustomAmount }) {
3573
+ const { formatDate, formatDateTime } = usePortalDateFormatting();
3499
3574
  const note = getOrderAttentionMessage(order);
3500
3575
  const canEnterCustomAmount = order.actions.canPayOnline && balanceEligibility?.kind === "eligible";
3501
3576
  const isPaying = payingOrderId === order.id;
@@ -3509,40 +3584,7 @@ function OrderDetailsModal({ order, balanceEligibility, payingOrderId, orderActi
3509
3584
  gap: "1rem"
3510
3585
  },
3511
3586
  children: [
3512
- /* @__PURE__ */ jsxs("div", {
3513
- style: {
3514
- display: "grid",
3515
- gap: "0.375rem"
3516
- },
3517
- children: [
3518
- /* @__PURE__ */ jsx("div", {
3519
- className: "cp-card-subtitle",
3520
- children: formatDateTime(order.createdAt)
3521
- }),
3522
- /* @__PURE__ */ jsxs("div", {
3523
- style: {
3524
- display: "flex",
3525
- flexWrap: "wrap",
3526
- gap: "0.5rem"
3527
- },
3528
- children: [/* @__PURE__ */ jsx(Badge, {
3529
- variant: getOrderStatusBadgeVariant(order.status),
3530
- children: formatOrderStatusLabel(order.status)
3531
- }), /* @__PURE__ */ jsx(Badge, {
3532
- variant: getOrderPaymentStateBadgeVariant(order.paymentState),
3533
- children: formatOrderPaymentStateLabel(order.paymentState)
3534
- })]
3535
- }),
3536
- /* @__PURE__ */ jsxs("div", {
3537
- className: "cp-card-subtitle",
3538
- children: [
3539
- summarizeOrderKinds(order),
3540
- " · ",
3541
- summarizeOrderQuantity(order)
3542
- ]
3543
- })
3544
- ]
3545
- }),
3587
+ /* @__PURE__ */ jsx(OrderDetailHeader, { order }),
3546
3588
  note && /* @__PURE__ */ jsx("div", {
3547
3589
  className: "cp-row-note",
3548
3590
  children: note
@@ -3918,6 +3960,43 @@ function getPayNowLabel(order) {
3918
3960
  if (order.instalmentPlan) return "Pay the rest now";
3919
3961
  return "Pay now";
3920
3962
  }
3963
+ function OrderDetailHeader({ order }) {
3964
+ const { formatDateTime } = usePortalDateFormatting();
3965
+ return /* @__PURE__ */ jsxs("div", {
3966
+ style: {
3967
+ display: "grid",
3968
+ gap: "0.375rem"
3969
+ },
3970
+ children: [
3971
+ /* @__PURE__ */ jsx("div", {
3972
+ className: "cp-card-subtitle",
3973
+ children: formatDateTime(order.createdAt)
3974
+ }),
3975
+ /* @__PURE__ */ jsxs("div", {
3976
+ style: {
3977
+ display: "flex",
3978
+ flexWrap: "wrap",
3979
+ gap: "0.5rem"
3980
+ },
3981
+ children: [/* @__PURE__ */ jsx(Badge, {
3982
+ variant: getOrderStatusBadgeVariant(order.status),
3983
+ children: formatOrderStatusLabel(order.status)
3984
+ }), /* @__PURE__ */ jsx(Badge, {
3985
+ variant: getOrderPaymentStateBadgeVariant(order.paymentState),
3986
+ children: formatOrderPaymentStateLabel(order.paymentState)
3987
+ })]
3988
+ }),
3989
+ /* @__PURE__ */ jsxs("div", {
3990
+ className: "cp-card-subtitle",
3991
+ children: [
3992
+ summarizeOrderKinds(order),
3993
+ " · ",
3994
+ summarizeOrderQuantity(order)
3995
+ ]
3996
+ })
3997
+ ]
3998
+ });
3999
+ }
3921
4000
  //#endregion
3922
4001
  //#region ../blocks/src/customer-portal/components/useMembershipCancelFlow.state.ts
3923
4002
  const initialMembershipCancelState = {
@@ -4122,7 +4201,7 @@ async function loadOptionalPortalSectionWithFallback(label, load, buildFallback)
4122
4201
  * Provides authenticated customers access to their passes, memberships,
4123
4202
  * event registrations, appointments, and profile.
4124
4203
  */
4125
- function CustomerPortalClient({ callbackPath: suppliedCallbackPath, logoutPath: suppliedLogoutPath, bookPath: suppliedBookPath, hasInitialPortalToken = false, siteTitle, siteTimeZone, demoEmailSuppressed, className, showPasses = true, showMemberships = true, showEvents = true, showWholeSeries = true, showAppointments = true, showOrders = true, showCredit = true, showProfile = true, loginTitle = "Customer Portal", loginSubtitle = "Enter your email to access your account", loginButtonText = getDefaultLoginButtonText(demoEmailSuppressed), passesTabLabel, membershipsTabLabel = "Memberships", eventsTabLabel = "Bookings", appointmentsTabLabel = "Appointments", ordersTabLabel = "Orders", creditTabLabel = "Credit", profileTabLabel = "Profile", emptyPassesMessage, emptyMembershipsMessage = "You don't have any active memberships.", emptyEventsMessage = "You're not registered for any events.", emptyAppointmentsMessage = "You don't have any appointments scheduled.", emptyOrdersMessage = "You don't have any orders yet." }) {
4204
+ function CustomerPortalClient({ callbackPath: suppliedCallbackPath, logoutPath: suppliedLogoutPath, bookPath: suppliedBookPath, hasInitialPortalToken = false, siteTitle, demoEmailSuppressed, className, showPasses = true, showMemberships = true, showEvents = true, showWholeSeries = true, showAppointments = true, showOrders = true, showCredit = true, showProfile = true, loginTitle = "Customer Portal", loginSubtitle = "Enter your email to access your account", loginButtonText = getDefaultLoginButtonText(demoEmailSuppressed), passesTabLabel, membershipsTabLabel = "Memberships", eventsTabLabel = "Bookings", appointmentsTabLabel = "Appointments", ordersTabLabel = "Orders", creditTabLabel = "Credit", profileTabLabel = "Profile", emptyPassesMessage, emptyMembershipsMessage = "You don't have any active memberships.", emptyEventsMessage = "You're not registered for any events.", emptyAppointmentsMessage = "You don't have any appointments scheduled.", emptyOrdersMessage = "You don't have any orders yet." }) {
4126
4205
  const { callbackPath, logoutPath, bookPath } = resolvePortalHostPaths({
4127
4206
  callbackPath: suppliedCallbackPath,
4128
4207
  logoutPath: suppliedLogoutPath,
@@ -4495,7 +4574,6 @@ function CustomerPortalClient({ callbackPath: suppliedCallbackPath, logoutPath:
4495
4574
  activeTab === "appointments" && canShowAppointments && /* @__PURE__ */ jsx(AppointmentsSection, {
4496
4575
  bookPath,
4497
4576
  siteTitle,
4498
- siteTimeZone,
4499
4577
  appointments: data.appointments,
4500
4578
  emptyMessage: emptyAppointmentsMessage,
4501
4579
  onRefresh: fetchPortalData
@@ -4551,23 +4629,7 @@ async function finalizeFocusedBookingQuestionsUpload(api, taskLink, data) {
4551
4629
  }
4552
4630
  }
4553
4631
  function FocusedBookingQuestionsTask({ taskLink, api, onRefresh }) {
4554
- const [detail, setDetail] = useState(null);
4555
- const [loading, setLoading] = useState(true);
4556
- const [error, setError] = useState(null);
4557
- const refreshTask = useCallback(async () => {
4558
- setLoading(true);
4559
- setError(null);
4560
- try {
4561
- setDetail(await loadFocusedBookingQuestionsTask(api, taskLink));
4562
- } catch (cause) {
4563
- setError(cause instanceof Error ? cause.message : "We could not load this task. Please try the link again.");
4564
- } finally {
4565
- setLoading(false);
4566
- }
4567
- }, [api, taskLink]);
4568
- useEffect(() => {
4569
- refreshTask();
4570
- }, [refreshTask]);
4632
+ const { detail, setDetail, loading, error, refreshTask } = useFocusedBookingQuestionsTask(api, taskLink);
4571
4633
  return /* @__PURE__ */ jsxs("section", {
4572
4634
  className: "cp-section cp-section--focused-task",
4573
4635
  children: [/* @__PURE__ */ jsx("h2", {
@@ -4588,6 +4650,7 @@ function FocusedBookingQuestionsTask({ taskLink, api, onRefresh }) {
4588
4650
  }) : detail ? /* @__PURE__ */ jsx(BeforeYouComeTask, {
4589
4651
  entityId: taskLink.id,
4590
4652
  task: toBeforeYouComeTaskSummary(detail),
4653
+ session: detail,
4591
4654
  loadTask: () => Promise.resolve(detail),
4592
4655
  saveTask: async (data) => {
4593
4656
  const updated = await saveFocusedBookingQuestionsTask(api, taskLink, data);
@@ -4635,61 +4698,67 @@ function PassesAndMembershipsSection({ showPasses, showMemberships, passes, memb
4635
4698
  function PassesCards({ passes }) {
4636
4699
  return /* @__PURE__ */ jsx("div", {
4637
4700
  className: "cp-cards",
4638
- children: passes.map((pass) => {
4639
- const percentUsed = pass.creditsTotal > 0 ? (pass.creditsTotal - pass.creditsRemaining) / pass.creditsTotal * 100 : 0;
4640
- return /* @__PURE__ */ jsxs("div", {
4641
- className: "cp-card",
4642
- children: [
4643
- /* @__PURE__ */ jsxs("div", {
4644
- className: "cp-card-header",
4645
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
4646
- className: "cp-card-title",
4647
- children: pass.passName
4648
- }), pass.passDescription && /* @__PURE__ */ jsx("p", {
4649
- className: "cp-card-subtitle",
4650
- children: pass.passDescription
4651
- })] }), /* @__PURE__ */ jsx(Badge, {
4652
- variant: getPassBadgeVariant(pass.status),
4653
- children: pass.status
4654
- })]
4655
- }),
4656
- /* @__PURE__ */ jsxs("div", {
4657
- className: "cp-card-body",
4658
- children: [/* @__PURE__ */ jsx("div", {
4659
- className: "cp-progress",
4660
- children: /* @__PURE__ */ jsx("div", {
4661
- className: "cp-progress__fill",
4662
- style: { width: `${100 - percentUsed}%` }
4663
- })
4664
- }), /* @__PURE__ */ jsxs("div", {
4665
- className: "cp-card-meta",
4666
- children: [/* @__PURE__ */ jsxs("span", { children: [
4667
- pass.creditsRemaining,
4668
- " of ",
4669
- pass.creditsTotal,
4670
- " ",
4671
- getPortalCreditProductCreditNoun(pass.productUseCase, pass.creditsRemaining),
4672
- " ",
4673
- "remaining"
4674
- ] }), /* @__PURE__ */ jsx("span", { children: getCreditProductTypeLabel(pass.productUseCase) })]
4675
- })]
4676
- }),
4677
- /* @__PURE__ */ jsxs("div", {
4678
- className: "cp-card-meta",
4679
- children: [/* @__PURE__ */ jsxs("span", { children: ["Purchased ", formatDate(pass.purchasedAt)] }), pass.expiresAt && /* @__PURE__ */ jsxs("span", { children: ["Expires ", formatDate(pass.expiresAt)] })]
4680
- }),
4681
- pass.creditHistory.length > 0 ? /* @__PURE__ */ jsx("div", {
4682
- className: "cp-card-meta",
4683
- children: pass.creditHistory.slice(0, 3).map((entry) => /* @__PURE__ */ jsx("span", { children: formatCustomerPassCreditHistoryEntry(entry, pass.productUseCase) }, `${entry.kind}:${entry.id}`))
4684
- }) : null
4685
- ]
4686
- }, pass.id);
4687
- })
4701
+ children: passes.map((pass) => /* @__PURE__ */ jsx(PassCard, { pass }, pass.id))
4702
+ });
4703
+ }
4704
+ function PassCard({ pass }) {
4705
+ return /* @__PURE__ */ jsxs("div", {
4706
+ className: "cp-card",
4707
+ children: [
4708
+ /* @__PURE__ */ jsxs("div", {
4709
+ className: "cp-card-header",
4710
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
4711
+ className: "cp-card-title",
4712
+ children: pass.passName
4713
+ }), pass.passDescription && /* @__PURE__ */ jsx("p", {
4714
+ className: "cp-card-subtitle",
4715
+ children: pass.passDescription
4716
+ })] }), /* @__PURE__ */ jsx(Badge, {
4717
+ variant: getPassBadgeVariant(pass.status),
4718
+ children: pass.status
4719
+ })]
4720
+ }),
4721
+ /* @__PURE__ */ jsx(PassCredits, { pass }),
4722
+ /* @__PURE__ */ jsx(PassDates, { pass })
4723
+ ]
4688
4724
  });
4689
4725
  }
4690
- function formatCustomerPassCreditHistoryEntry(entry, productUseCase) {
4726
+ function PassCredits({ pass }) {
4727
+ return /* @__PURE__ */ jsxs("div", {
4728
+ className: "cp-card-body",
4729
+ children: [/* @__PURE__ */ jsx("div", {
4730
+ className: "cp-progress",
4731
+ children: /* @__PURE__ */ jsx("div", {
4732
+ className: "cp-progress__fill",
4733
+ style: { width: `${pass.creditsTotal > 0 ? pass.creditsRemaining / pass.creditsTotal * 100 : 100}%` }
4734
+ })
4735
+ }), /* @__PURE__ */ jsxs("div", {
4736
+ className: "cp-card-meta",
4737
+ children: [/* @__PURE__ */ jsxs("span", { children: [
4738
+ pass.creditsRemaining,
4739
+ " of ",
4740
+ pass.creditsTotal,
4741
+ " ",
4742
+ getPortalCreditProductCreditNoun(pass.productUseCase, pass.creditsRemaining),
4743
+ " ",
4744
+ "remaining"
4745
+ ] }), /* @__PURE__ */ jsx("span", { children: getCreditProductTypeLabel(pass.productUseCase) })]
4746
+ })]
4747
+ });
4748
+ }
4749
+ function PassDates({ pass }) {
4750
+ const { context, formatDate, formatEntitlementEnd } = usePortalDateFormatting();
4751
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4752
+ className: "cp-card-meta",
4753
+ children: [/* @__PURE__ */ jsxs("span", { children: ["Purchased ", formatDate(pass.purchasedAt)] }), pass.expiresAt && /* @__PURE__ */ jsxs("span", { children: ["Expires ", formatEntitlementEnd(pass.expiresAt)] })]
4754
+ }), pass.creditHistory.length > 0 ? /* @__PURE__ */ jsx("div", {
4755
+ className: "cp-card-meta",
4756
+ children: pass.creditHistory.slice(0, 3).map((entry) => /* @__PURE__ */ jsx("span", { children: formatCustomerPassCreditHistoryEntry(entry, pass.productUseCase, context) }, `${entry.kind}:${entry.id}`))
4757
+ }) : null] });
4758
+ }
4759
+ function formatCustomerPassCreditHistoryEntry(entry, productUseCase, context) {
4691
4760
  const creditNoun = getPortalCreditProductCreditNoun(productUseCase, entry.credits);
4692
- return `${entry.kind === "restoration" ? "Restored" : "Used"} ${entry.credits} ${creditNoun} on ${formatDate(entry.occurredAt)}`;
4761
+ return `${entry.kind === "restoration" ? "Restored" : "Used"} ${entry.credits} ${creditNoun} on ${formatDate(entry.occurredAt, context, "long")}`;
4693
4762
  }
4694
4763
  function MembershipsCards({ memberships, onRefresh }) {
4695
4764
  const cancelFlow = useMembershipCancelFlow({
@@ -4717,27 +4786,7 @@ function MembershipsCards({ memberships, onRefresh }) {
4717
4786
  children: membership.status.replace("_", " ")
4718
4787
  })]
4719
4788
  }),
4720
- /* @__PURE__ */ jsxs("div", {
4721
- className: "cp-card-meta",
4722
- children: [/* @__PURE__ */ jsxs("span", { children: [
4723
- "Billed ",
4724
- membership.billingInterval,
4725
- "ly"
4726
- ] }), membership.status === "canceled" ? /* @__PURE__ */ jsxs("span", { children: [
4727
- "Ended",
4728
- " ",
4729
- formatDate(membership.canceledAt ?? membership.currentPeriodEnd)
4730
- ] }) : membership.cancelAtPeriodEnd ? /* @__PURE__ */ jsxs("span", { children: ["Valid until ", formatDate(membership.currentPeriodEnd)] }) : membership.currentPeriodEnd ? /* @__PURE__ */ jsxs("span", { children: ["Renews ", formatDate(membership.currentPeriodEnd)] }) : /* @__PURE__ */ jsx("span", { children: "Renewal date unavailable" })]
4731
- }),
4732
- membership.status !== "canceled" && membership.cancelAtPeriodEnd && /* @__PURE__ */ jsxs("div", {
4733
- className: "cp-alert cp-alert--success cp-alert--mt",
4734
- children: [
4735
- "Cancels at period end (active until",
4736
- " ",
4737
- formatDate(membership.currentPeriodEnd),
4738
- ")"
4739
- ]
4740
- }),
4789
+ /* @__PURE__ */ jsx(MembershipDates, { membership }),
4741
4790
  !membership.cancelAtPeriodEnd && membership.status !== "canceled" && /* @__PURE__ */ jsx(Fragment, { children: cancelFlow.dialog.tag !== "closed" && cancelFlow.dialog.membershipId === membership.id ? /* @__PURE__ */ jsx(MembershipCancelConfirmation, {
4742
4791
  membership,
4743
4792
  isSubmitting: cancelFlow.dialog.tag === "submitting",
@@ -4760,6 +4809,29 @@ function MembershipsCards({ memberships, onRefresh }) {
4760
4809
  }, membership.id))
4761
4810
  })] });
4762
4811
  }
4812
+ function MembershipDates({ membership }) {
4813
+ const { formatDate, formatEntitlementEnd } = usePortalDateFormatting();
4814
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
4815
+ className: "cp-card-meta",
4816
+ children: [/* @__PURE__ */ jsxs("span", { children: [
4817
+ "Billed ",
4818
+ membership.billingInterval,
4819
+ "ly"
4820
+ ] }), membership.status === "canceled" ? /* @__PURE__ */ jsxs("span", { children: [
4821
+ "Ended",
4822
+ " ",
4823
+ formatDate(membership.canceledAt ?? membership.currentPeriodEnd)
4824
+ ] }) : membership.cancelAtPeriodEnd ? /* @__PURE__ */ jsxs("span", { children: ["Valid until ", formatEntitlementEnd(membership.currentPeriodEnd)] }) : membership.currentPeriodEnd ? /* @__PURE__ */ jsxs("span", { children: ["Renews ", formatDate(membership.currentPeriodEnd)] }) : /* @__PURE__ */ jsx("span", { children: "Renewal date unavailable" })]
4825
+ }), membership.status !== "canceled" && membership.cancelAtPeriodEnd && /* @__PURE__ */ jsxs("div", {
4826
+ className: "cp-alert cp-alert--success cp-alert--mt",
4827
+ children: [
4828
+ "Cancels at period end (active until",
4829
+ " ",
4830
+ formatEntitlementEnd(membership.currentPeriodEnd, "long"),
4831
+ ")"
4832
+ ]
4833
+ })] });
4834
+ }
4763
4835
  function CreditSection({ credit }) {
4764
4836
  return /* @__PURE__ */ jsxs("div", {
4765
4837
  className: "cp-section cp-section--credit",
@@ -4803,33 +4875,12 @@ function CreditSection({ credit }) {
4803
4875
  children: "Recent activity"
4804
4876
  }), /* @__PURE__ */ jsx("div", {
4805
4877
  className: "cp-cards",
4806
- children: credit.transactions.map((t) => {
4807
- const sign = t.amountCents >= 0 ? "+" : "-";
4808
- const amount = formatCurrencyCents(Math.abs(t.amountCents), t.currency);
4809
- return /* @__PURE__ */ jsxs("div", {
4810
- className: "cp-card",
4811
- children: [/* @__PURE__ */ jsxs("div", {
4812
- className: "cp-card-header",
4813
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
4814
- className: "cp-card-title",
4815
- children: formatCreditTransactionType(t.type)
4816
- }), t.reason ? /* @__PURE__ */ jsx("p", {
4817
- className: "cp-card-subtitle",
4818
- children: t.reason
4819
- }) : null] }), /* @__PURE__ */ jsxs("div", {
4820
- className: "cp-card-title",
4821
- children: [sign, amount]
4822
- })]
4823
- }), /* @__PURE__ */ jsx("div", {
4824
- className: "cp-card-meta",
4825
- children: /* @__PURE__ */ jsx("span", { children: formatDateTime(t.createdAt) })
4826
- })]
4827
- }, t.id);
4828
- })
4878
+ children: credit.transactions.map((transaction) => /* @__PURE__ */ jsx(CreditTransactionCard, { transaction }, transaction.id))
4829
4879
  })] })]
4830
4880
  });
4831
4881
  }
4832
4882
  function MembershipCancelConfirmation({ membership, isSubmitting, onConfirm, onCancel }) {
4883
+ const { formatEntitlementEnd } = usePortalDateFormatting();
4833
4884
  return /* @__PURE__ */ jsxs("div", {
4834
4885
  className: "cp-alert cp-alert--error cp-cancel-confirm",
4835
4886
  children: [
@@ -4842,7 +4893,7 @@ function MembershipCancelConfirmation({ membership, isSubmitting, onConfirm, onC
4842
4893
  children: [
4843
4894
  "Your access will remain active until",
4844
4895
  " ",
4845
- formatDate(membership.currentPeriodEnd),
4896
+ formatEntitlementEnd(membership.currentPeriodEnd, "long"),
4846
4897
  "."
4847
4898
  ]
4848
4899
  }),
@@ -4931,10 +4982,7 @@ function DigitalProductsSection({ digitalProducts, onRefresh }) {
4931
4982
  children: product.accessState
4932
4983
  })]
4933
4984
  }),
4934
- /* @__PURE__ */ jsxs("div", {
4935
- className: "cp-card-meta",
4936
- children: [product.lastEmailSentAt ? /* @__PURE__ */ jsxs("span", { children: ["Last email: ", formatDateTime(product.lastEmailSentAt)] }) : /* @__PURE__ */ jsx("span", { children: "Email not sent yet" }), product.accessState === "revoked" && product.revokedReason ? /* @__PURE__ */ jsxs("span", { children: ["Reason: ", product.revokedReason] }) : null]
4937
- }),
4985
+ /* @__PURE__ */ jsx(DigitalProductDates, { product }),
4938
4986
  /* @__PURE__ */ jsxs("div", {
4939
4987
  className: "cp-card-actions",
4940
4988
  children: [
@@ -4969,7 +5017,8 @@ function DigitalProductsSection({ digitalProducts, onRefresh }) {
4969
5017
  })
4970
5018
  });
4971
5019
  }
4972
- function AppointmentsSection({ bookPath, siteTitle, siteTimeZone = "UTC", appointments, emptyMessage, onRefresh }) {
5020
+ function AppointmentsSection({ bookPath, siteTitle, appointments, emptyMessage, onRefresh }) {
5021
+ const { isPast } = usePortalDateFormatting();
4973
5022
  if (appointments.length === 0) return /* @__PURE__ */ jsx("div", {
4974
5023
  className: "cp-section cp-section--appointments",
4975
5024
  children: /* @__PURE__ */ jsx("div", {
@@ -4988,14 +5037,12 @@ function AppointmentsSection({ bookPath, siteTitle, siteTimeZone = "UTC", appoin
4988
5037
  appointments: upcomingAppointments,
4989
5038
  bookPath,
4990
5039
  siteTitle,
4991
- siteTimeZone,
4992
5040
  onRefresh,
4993
5041
  title: "Upcoming Appointments"
4994
5042
  }), /* @__PURE__ */ jsx(AppointmentGroup, {
4995
5043
  appointments: pastAppointments,
4996
5044
  bookPath,
4997
5045
  siteTitle,
4998
- siteTimeZone,
4999
5046
  onRefresh,
5000
5047
  title: "Past Appointments",
5001
5048
  isPast: true,
@@ -5003,7 +5050,7 @@ function AppointmentsSection({ bookPath, siteTitle, siteTimeZone = "UTC", appoin
5003
5050
  })]
5004
5051
  });
5005
5052
  }
5006
- function AppointmentGroup({ appointments, bookPath, siteTitle, siteTimeZone, onRefresh, title, isPast, spaced }) {
5053
+ function AppointmentGroup({ appointments, bookPath, siteTitle, onRefresh, title, isPast, spaced }) {
5007
5054
  if (appointments.length === 0) return null;
5008
5055
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("h3", {
5009
5056
  className: "cp-section-title",
@@ -5015,7 +5062,6 @@ function AppointmentGroup({ appointments, bookPath, siteTitle, siteTimeZone, onR
5015
5062
  appointment,
5016
5063
  bookPath,
5017
5064
  siteTitle,
5018
- siteTimeZone,
5019
5065
  onRefresh,
5020
5066
  isPast
5021
5067
  }, appointment.id))
@@ -5027,12 +5073,10 @@ function PortalCardNote({ text }) {
5027
5073
  children: text
5028
5074
  }) : null;
5029
5075
  }
5030
- function AppointmentCard({ appointment, bookPath, siteTitle, siteTimeZone = "UTC", isPast: isApptPast = false, onRefresh }) {
5076
+ function AppointmentCard({ appointment, bookPath, siteTitle, isPast: isApptPast = false, onRefresh }) {
5077
+ const { context } = usePortalDateDisplay();
5031
5078
  const presentation = presentPortalAppointment(appointment, {
5032
- context: {
5033
- locale: "en-GB",
5034
- timeZone: resolveBookingTimeZoneId(siteTimeZone)
5035
- },
5079
+ context,
5036
5080
  siteTitle
5037
5081
  });
5038
5082
  const cancelCopy = presentation.cancel;
@@ -5115,6 +5159,7 @@ function AppointmentCard({ appointment, bookPath, siteTitle, siteTimeZone = "UTC
5115
5159
  appointment.beforeYouCome ? /* @__PURE__ */ jsx(BeforeYouComeTaskDisplay, {
5116
5160
  entityId: appointment.id,
5117
5161
  task: appointment.beforeYouCome,
5162
+ session: appointment,
5118
5163
  loadTask: () => api.getPortalAppointmentBookingQuestions(appointment.id),
5119
5164
  saveTask: (data) => api.updatePortalAppointmentBookingQuestions(appointment.id, data),
5120
5165
  createUploadUrl: (data) => api.createPortalAppointmentBookingQuestionsUploadUrl(appointment.id, data),
@@ -5330,23 +5375,84 @@ function ProfileSection({ customer, onUpdate }) {
5330
5375
  })
5331
5376
  });
5332
5377
  }
5378
+ function CreditTransactionCard({ transaction: t }) {
5379
+ const { formatDateTime } = usePortalDateFormatting();
5380
+ const sign = t.amountCents >= 0 ? "+" : "-";
5381
+ const amount = formatCurrencyCents(Math.abs(t.amountCents), t.currency);
5382
+ return /* @__PURE__ */ jsxs("div", {
5383
+ className: "cp-card",
5384
+ children: [/* @__PURE__ */ jsxs("div", {
5385
+ className: "cp-card-header",
5386
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
5387
+ className: "cp-card-title",
5388
+ children: formatCreditTransactionType(t.type)
5389
+ }), t.reason ? /* @__PURE__ */ jsx("p", {
5390
+ className: "cp-card-subtitle",
5391
+ children: t.reason
5392
+ }) : null] }), /* @__PURE__ */ jsxs("div", {
5393
+ className: "cp-card-title",
5394
+ children: [sign, amount]
5395
+ })]
5396
+ }), /* @__PURE__ */ jsx("div", {
5397
+ className: "cp-card-meta",
5398
+ children: /* @__PURE__ */ jsx("span", { children: formatDateTime(t.createdAt) })
5399
+ })]
5400
+ });
5401
+ }
5402
+ function DigitalProductDates({ product }) {
5403
+ const { formatDateTime } = usePortalDateFormatting();
5404
+ return /* @__PURE__ */ jsxs("div", {
5405
+ className: "cp-card-meta",
5406
+ children: [product.lastEmailSentAt ? /* @__PURE__ */ jsxs("span", { children: ["Last email: ", formatDateTime(product.lastEmailSentAt)] }) : /* @__PURE__ */ jsx("span", { children: "Email not sent yet" }), product.accessState === "revoked" && product.revokedReason ? /* @__PURE__ */ jsxs("span", { children: ["Reason: ", product.revokedReason] }) : null]
5407
+ });
5408
+ }
5409
+ function useFocusedBookingQuestionsTask(api, taskLink) {
5410
+ const [detail, setDetail] = useState(null);
5411
+ const [loading, setLoading] = useState(true);
5412
+ const [error, setError] = useState(null);
5413
+ const refreshTask = useCallback(async () => {
5414
+ setLoading(true);
5415
+ setError(null);
5416
+ try {
5417
+ setDetail(await loadFocusedBookingQuestionsTask(api, taskLink));
5418
+ } catch (cause) {
5419
+ setError(cause instanceof Error ? cause.message : "We could not load this task. Please try the link again.");
5420
+ } finally {
5421
+ setLoading(false);
5422
+ }
5423
+ }, [api, taskLink]);
5424
+ useEffect(() => {
5425
+ refreshTask();
5426
+ }, [refreshTask]);
5427
+ return {
5428
+ detail,
5429
+ setDetail,
5430
+ loading,
5431
+ error,
5432
+ refreshTask
5433
+ };
5434
+ }
5333
5435
  //#endregion
5334
5436
  //#region ../blocks/src/customer-portal/route-client.tsx
5335
5437
  /** Reserved customer route, shared by managed and headless hosts. The host supplies theme scope. */
5336
- function CustomerPortal({ apiBaseUrl, portalToken, siteId, ...props }) {
5337
- return /* @__PURE__ */ jsx(BlockApiProvider, {
5338
- config: {
5339
- baseUrl: apiBaseUrl,
5340
- auth: { type: "none" },
5341
- authOverrides: { portal: portalToken ? {
5342
- type: "bearer",
5343
- token: portalToken
5344
- } : { type: "none" } },
5345
- siteId
5346
- },
5347
- children: /* @__PURE__ */ jsx(CustomerPortalClient, {
5348
- hasInitialPortalToken: portalToken !== null,
5349
- ...props
5438
+ function CustomerPortal({ apiBaseUrl, portalToken, siteId, dateContext, now, ...props }) {
5439
+ return /* @__PURE__ */ jsx(PortalDateDisplayProvider, {
5440
+ context: dateContext,
5441
+ now,
5442
+ children: /* @__PURE__ */ jsx(BlockApiProvider, {
5443
+ config: {
5444
+ baseUrl: apiBaseUrl,
5445
+ auth: { type: "none" },
5446
+ authOverrides: { portal: portalToken ? {
5447
+ type: "bearer",
5448
+ token: portalToken
5449
+ } : { type: "none" } },
5450
+ siteId
5451
+ },
5452
+ children: /* @__PURE__ */ jsx(CustomerPortalClient, {
5453
+ hasInitialPortalToken: portalToken !== null,
5454
+ ...props
5455
+ })
5350
5456
  })
5351
5457
  });
5352
5458
  }
@@ -5405,17 +5511,9 @@ function TicketQr({ src }) {
5405
5511
  })]
5406
5512
  });
5407
5513
  }
5408
- function TicketDetails({ ticket }) {
5514
+ function TicketDetails({ ticket, dateContext }) {
5409
5515
  const { registration } = ticket;
5410
- const dateTime = formatBookingRange(toScheduledBookingDateRange({
5411
- startsAt: registration.startsAt,
5412
- endsAt: registration.endsAt,
5413
- timeZone: registration.timeZone
5414
- }), { dateFormat: {
5415
- month: "short",
5416
- day: "numeric",
5417
- year: "numeric"
5418
- } });
5516
+ const dateTime = formatPortalSession(registration.startsAt, registration.endsAt, registration, dateContext);
5419
5517
  return /* @__PURE__ */ jsxs("div", {
5420
5518
  className: "cp-page-stack",
5421
5519
  children: [
@@ -5462,7 +5560,7 @@ function TicketDetails({ ticket }) {
5462
5560
  ]
5463
5561
  });
5464
5562
  }
5465
- function PortalTicketView({ ticket }) {
5563
+ function PortalTicketView({ ticket, dateContext }) {
5466
5564
  return /* @__PURE__ */ jsx("main", {
5467
5565
  "data-block": "customer-portal",
5468
5566
  className: "cp-page cp-page--white",
@@ -5479,7 +5577,10 @@ function PortalTicketView({ ticket }) {
5479
5577
  })] }), /* @__PURE__ */ jsx(PrintButton, {})]
5480
5578
  }), /* @__PURE__ */ jsxs("div", {
5481
5579
  className: "cp-ticket__body",
5482
- children: [/* @__PURE__ */ jsx(TicketQr, { src: ticket.qrImageUrl }), /* @__PURE__ */ jsx(TicketDetails, { ticket })]
5580
+ children: [/* @__PURE__ */ jsx(TicketQr, { src: ticket.qrImageUrl }), /* @__PURE__ */ jsx(TicketDetails, {
5581
+ ticket,
5582
+ dateContext
5583
+ })]
5483
5584
  })]
5484
5585
  })
5485
5586
  });
@@ -5507,7 +5608,7 @@ function DigitalProductCard({ title, children, maxWidth }) {
5507
5608
  }
5508
5609
  //#endregion
5509
5610
  //#region ../blocks/src/customer-portal/pages/DigitalProductView.tsx
5510
- function PortalDigitalProductView({ detail }) {
5611
+ function PortalDigitalProductView({ detail, dateContext }) {
5511
5612
  return /* @__PURE__ */ jsx(DigitalProductPageShell, { children: /* @__PURE__ */ jsx(DigitalProductCard, {
5512
5613
  title: detail.product.productTitle,
5513
5614
  children: detail.product.accessState === "revoked" ? /* @__PURE__ */ jsxs("div", {
@@ -5526,25 +5627,31 @@ function PortalDigitalProductView({ detail }) {
5526
5627
  })]
5527
5628
  }, file.assetId))
5528
5629
  })]
5529
- }) : /* @__PURE__ */ jsxs("div", {
5530
- className: "cp-page-stack",
5531
- children: [
5532
- /* @__PURE__ */ jsx("p", { children: "This product is delivered by email." }),
5533
- detail.product.lastEmailSentAt ? /* @__PURE__ */ jsxs("p", { children: ["Last sent: ", formatDateTime(detail.product.lastEmailSentAt)] }) : /* @__PURE__ */ jsx("p", { children: "The fulfillment email has not been sent yet." }),
5534
- /* @__PURE__ */ jsxs("p", { children: [
5535
- "You can also access your purchases from your portal at",
5536
- " ",
5537
- /* @__PURE__ */ jsx("a", {
5538
- className: "cp-page-link",
5539
- href: "/portal",
5540
- children: "/portal"
5541
- }),
5542
- "."
5543
- ] })
5544
- ]
5630
+ }) : /* @__PURE__ */ jsx(EmailDelivery, {
5631
+ detail,
5632
+ dateContext
5545
5633
  })
5546
5634
  }) });
5547
5635
  }
5636
+ function EmailDelivery({ detail, dateContext }) {
5637
+ return /* @__PURE__ */ jsxs("div", {
5638
+ className: "cp-page-stack",
5639
+ children: [
5640
+ /* @__PURE__ */ jsx("p", { children: "This product is delivered by email." }),
5641
+ detail.product.lastEmailSentAt ? /* @__PURE__ */ jsxs("p", { children: ["Last sent: ", formatDateTime(detail.product.lastEmailSentAt, dateContext)] }) : /* @__PURE__ */ jsx("p", { children: "The fulfillment email has not been sent yet." }),
5642
+ /* @__PURE__ */ jsxs("p", { children: [
5643
+ "You can also access your purchases from your portal at",
5644
+ " ",
5645
+ /* @__PURE__ */ jsx("a", {
5646
+ className: "cp-page-link",
5647
+ href: "/portal",
5648
+ children: "/portal"
5649
+ }),
5650
+ "."
5651
+ ] })
5652
+ ]
5653
+ });
5654
+ }
5548
5655
  //#endregion
5549
5656
  //#region ../blocks/src/customer-portal/pages/AccessState.tsx
5550
5657
  const pageCopy = {