@riverbankcms/sdk 0.164.0 → 0.166.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 (252) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-CubPwupc.d.ts → BlocksIslandsHydrator-CPvN6RBW.d.ts} +1 -1
  2. package/dist/_dts/{Page-CDzsagB2.d.ts → Page-rW0xgQCA.d.ts} +18 -256
  3. package/dist/_dts/{SdkPreviewMode-CPRQbRCI.d.ts → SdkPreviewMode-BWZh2WCk.d.ts} +107 -72
  4. package/dist/_dts/{client-CbeYTSry.d.ts → client-D4BXQEZc.d.ts} +5 -1
  5. package/dist/_dts/{content-types--uYRIcIF.d.ts → content-types-MUzta0l9.d.ts} +3 -3
  6. package/dist/_dts/{contracts-DJQYAOsv.d.ts → contracts-Cl9Xh1DO.d.ts} +4 -4
  7. package/dist/_dts/{footerPageOutline-CKkhBwgJ.d.ts → footerPageOutline-4BgLKehl.d.ts} +6 -6
  8. package/dist/_dts/{generatePageMetadata--qd7NCIA.d.ts → generatePageMetadata-BsmJ0qKh.d.ts} +2 -2
  9. package/dist/_dts/{index-wegfy7lf.d.ts → index--qflsCiy.d.ts} +4 -3
  10. package/dist/_dts/{index-CjdIn9-_.d.ts → index-BgJ2aU5c.d.ts} +2 -2
  11. package/dist/_dts/{index-BZE-1azr.d.ts → index-Bmboeb49.d.ts} +2 -2
  12. package/dist/_dts/{index-BpEbwDM7.d.ts → index-DdcwPqQN.d.ts} +4 -4
  13. package/dist/_dts/{index-DriYVLfT.d.ts → index-ahxQCUc7.d.ts} +2 -2
  14. package/dist/_dts/{index-DYQFmf--.d.ts → index-kQ5xkM6X.d.ts} +1 -1
  15. package/dist/_dts/{index-JS8WYgD3.d.ts → index-mMMvLLAJ.d.ts} +2996 -3079
  16. package/dist/_dts/{index-D_pQO-AS.d.ts → index-wbBZ0awa.d.ts} +49398 -48202
  17. package/dist/_dts/{loadContent-DUi94Qfk.d.ts → loadContent-BG5IAV-V.d.ts} +9 -6
  18. package/dist/_dts/resolveBlockData-Cmcle_zV.d.ts +136 -0
  19. package/dist/_dts/{resolvePageContent-JDE0ry6T.d.ts → resolvePageContent-BRJUTFoH.d.ts} +3 -2
  20. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client.d.ts +9 -6
  23. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +20 -0
  27. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +2 -0
  28. package/dist/_dts/sdk/src/data/types.d.ts +54 -0
  29. package/dist/_dts/sdk/src/index.d.ts +8 -8
  30. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  31. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  32. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  33. package/dist/_dts/sdk/src/next/index.d.ts +9 -8
  34. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  35. package/dist/_dts/sdk/src/page-converter/index.d.ts +36 -48
  36. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  37. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  38. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  41. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  42. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +2 -0
  43. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +3 -0
  44. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +257 -0
  45. package/dist/_dts/sdk/src/rendering/index.d.ts +8 -7
  46. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  47. package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
  48. package/dist/_dts/{themeAdmission-D_qtGYAT.d.ts → sdk/src/rendering/themeAdmission.d.ts} +3 -1
  49. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  50. package/dist/_dts/sdk/src/server.d.ts +7 -5
  51. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  52. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  53. package/dist/_dts/{types-DiciZDrk.d.ts → types-BX3Y-EW3.d.ts} +3 -3
  54. package/dist/_dts/{types-DubJnBnI.d.ts → types-DF54stxv.d.ts} +8 -7
  55. package/dist/_dts/{types-W40f2olO.d.ts → types-DuiHLiPo.d.ts} +2 -2
  56. package/dist/_dts/{validation-BF4_zNkR.d.ts → validation-Bxi0f81D.d.ts} +4 -4
  57. package/dist/client/{BlocksIslandsHydrator-64hFxF02.mjs → BlocksIslandsHydrator-DwiRGtgh.mjs} +31 -24
  58. package/dist/client/{BookingMailingListNote-CSQyFm9J.mjs → BookingMailingListNote-DOWOZYlK.mjs} +2 -2
  59. package/dist/client/{CalendarNavigationChevron-Bvkx8Z7Y.mjs → CalendarNavigationChevron-5a0x0vcC.mjs} +7 -7
  60. package/dist/client/{CheckboxChoice-3PhxDxgR.mjs → CheckboxChoice-CZ-anOqV.mjs} +1 -1
  61. package/dist/client/{DemoBookingPortalAccess-pt2xXBQp.mjs → DemoBookingPortalAccess-B2qLkPRB.mjs} +6 -6
  62. package/dist/client/{DemoPortalSignInLink-Qw780EfW.mjs → DemoPortalSignInLink-B9YrzZt2.mjs} +1 -1
  63. package/dist/client/{EventCalendar.client-DWoboRW5.mjs → EventCalendar.client-BhADnDCg.mjs} +17 -10
  64. package/dist/client/{EventCombined.client-C98ucpcP.mjs → EventCombined.client-jik34zTb.mjs} +8 -8
  65. package/dist/client/{EventEmbeddedCheckoutStep-DHRlFfkp.mjs → EventEmbeddedCheckoutStep-D_14yqAU.mjs} +27 -2
  66. package/dist/client/{EventItem-hrSyTApW.mjs → EventItem-CMKrtkT7.mjs} +33 -12
  67. package/dist/client/{EventListWeekNavigation-C3t7H13W.mjs → EventListWeekNavigation-AGHjxy6C.mjs} +1 -1
  68. package/dist/client/{EventListing.client-Cp11sBX_.mjs → EventListing.client-DZeDM0Qt.mjs} +3 -3
  69. package/dist/client/{EventListing.view-Dd5QHIAf.mjs → EventListing.view-3BBRdNVa.mjs} +70 -15
  70. package/dist/client/{EventRegistrationPayment-ByT88VHR.mjs → EventRegistrationPayment-CpNcpga4.mjs} +108 -11
  71. package/dist/client/{LocationMapActions-BsepG5Vv.mjs → LocationMapActions-D5-H9ooQ.mjs} +2 -2
  72. package/dist/client/{MapDrawingSvg-R4JMT4yd.mjs → MapDrawingSvg-C30geMl-.mjs} +1 -1
  73. package/dist/client/{Page-Dub71o3c.mjs → Page-DNDZLRlB.mjs} +3388 -11530
  74. package/dist/client/{ProtectedSubmitButton-DGbgGvdh.mjs → ProtectedSubmitButton-8DuDw2ag.mjs} +1 -1
  75. package/dist/client/{SpamProtectionWidget-CRsKTQV-.mjs → SpamProtectionWidget-CCF6YLUX.mjs} +5 -3
  76. package/dist/client/{StepIndicator-Bp7MyutT.mjs → StepIndicator-Bin7YR0A.mjs} +3 -3
  77. package/dist/client/{TabBarFragment-C4WJyybx.mjs → TabBarFragment-_IAthZVM.mjs} +1 -1
  78. package/dist/client/{ThemedButton-BGVwNwE-.mjs → ThemedButton-8jUc02mZ.mjs} +64 -2
  79. package/dist/client/{accordion-vCG_JC5t.mjs → accordion-uVqNowRX.mjs} +1 -1
  80. package/dist/client/{altchaProtection-BWchRM3v.mjs → altchaProtection-DjIV9A5n.mjs} +1 -1
  81. package/dist/client/{booking-form.client-CHTbcZJM.mjs → booking-form.client-w-PvyWBv.mjs} +19 -14
  82. package/dist/client/{bookingForm-BxbUbzUr.mjs → bookingForm-DNMojb6A.mjs} +4 -4
  83. package/dist/client/bookings.mjs +6 -6
  84. package/dist/client/{carousel-FM1mkkL0.mjs → carousel-C8kxI3Dm.mjs} +2 -2
  85. package/dist/client/{carousel.client-ChoLiWwD.mjs → carousel.client-BO7sCEpH.mjs} +1 -1
  86. package/dist/client/{cart-BDFhbh9j.mjs → cart-DCxjE3Is.mjs} +3 -3
  87. package/dist/client/{cart.client-x3HOke6T.mjs → cart.client-Ceeng8fB.mjs} +1 -1
  88. package/dist/client/{checkout-BibhwnTd.mjs → checkout-B0EKbeVv.mjs} +3 -3
  89. package/dist/client/{checkout.client-CE4jUi0G.mjs → checkout.client-DtPj3fYk.mjs} +1 -1
  90. package/dist/client/client.mjs +9465 -15
  91. package/dist/client/{context-BNAM7NsW.mjs → context-n6IZigd3.mjs} +8 -6
  92. package/dist/client/cta-CDeAwYoN.mjs +121 -0
  93. package/dist/client/{dateFormatting-QwBSo0hK.mjs → dateFormatting-BWPzdeZE.mjs} +1 -1
  94. package/dist/client/{demoPortalMagicLink-NwKJk6gn.mjs → demoPortalMagicLink-BdXu0fj-.mjs} +1 -1
  95. package/dist/client/{enhanceHeaderSection-D4zqEBDl.mjs → enhanceHeaderSection-VHfv8M6-.mjs} +3 -3
  96. package/dist/client/{event-details.client-jFyFjOIC.mjs → event-details.client-Cfr1_Cj4.mjs} +2 -2
  97. package/dist/client/{event-registration.client-BK_jVv3R.mjs → event-registration.client-BhygihpQ.mjs} +43 -17
  98. package/dist/client/{eventCalendar-DSkzejQh.mjs → eventCalendar-B4XCL9u6.mjs} +4 -4
  99. package/dist/client/{eventCombined-BG-BEaYh.mjs → eventCombined-DVjz4wdf.mjs} +4 -4
  100. package/dist/client/{eventDetails-BhIwXAKe.mjs → eventDetails-B0DA1Nw1.mjs} +2 -2
  101. package/dist/client/{eventListing-DQtyO1Xj.mjs → eventListing-2-xjn2nz.mjs} +4 -4
  102. package/dist/client/{eventRegistration-DRTz8X0M.mjs → eventRegistration-ng4iGo9O.mjs} +4 -4
  103. package/dist/client/{form-GXqjObPC.mjs → form-BeNQiZ2V.mjs} +3 -3
  104. package/dist/client/{form.client-CoKNba2e.mjs → form.client-BFdCKlp7.mjs} +7 -7
  105. package/dist/client/{form.parts-magB_epJ.mjs → form.parts-C7gLK3jh.mjs} +3 -3
  106. package/dist/client/{formatDate-BiloOyjS.mjs → formatDate-CWfelfMt.mjs} +1 -1
  107. package/dist/client/gifting/client.mjs +4 -5
  108. package/dist/client/{headerSection-BMQCPHT3.mjs → headerSection-CalNAShx.mjs} +2 -2
  109. package/dist/client/{mediaAssets-BX-vWwQc.mjs → mediaAssets-DpPauppt.mjs} +1 -1
  110. package/dist/client/{mediaContext-CdqGYlWl.mjs → mediaContext-BLo4NtjP.mjs} +25 -19
  111. package/dist/client/{newsletter-form.client-8orCez1z.mjs → newsletter-form.client-Dq7GHGXU.mjs} +9 -9
  112. package/dist/client/{newsletter-form.parts-D8NgHY_F.mjs → newsletter-form.parts-BSMDYQiS.mjs} +2 -2
  113. package/dist/client/{newsletterForm-BhBNsS3n.mjs → newsletterForm-snzZ4L6i.mjs} +3 -3
  114. package/dist/client/{noop-C2vZse15.mjs → noop-D-RG9eR3.mjs} +399 -169
  115. package/dist/client/portal/client.mjs +13 -14
  116. package/dist/client/{product-detail.client-CQ0k0fbH.mjs → product-detail.client-Gu0INDb7.mjs} +1 -1
  117. package/dist/client/{product-list.client-Xlr1P0x9.mjs → product-list.client-BmH40fNf.mjs} +1 -1
  118. package/dist/client/{productDetail-BsCao6X4.mjs → productDetail-DsPUmJ0z.mjs} +3 -3
  119. package/dist/client/{productList-Cc-PmbEe.mjs → productList-DjGrjOwD.mjs} +3 -3
  120. package/dist/client/{propsDecoder-DikkDJ9x.mjs → propsDecoder-kTVPMnfD.mjs} +4 -4
  121. package/dist/client/{registry.server-BpLZo3bC.mjs → registry.server-CKK_RXZo.mjs} +350 -424
  122. package/dist/client/rendering/client.mjs +29 -28
  123. package/dist/client/rendering/islands.mjs +1 -1
  124. package/dist/client/rendering.mjs +70 -8
  125. package/dist/client/{richText-coerce-WuMYrBm3.mjs → richText-coerce-BcjTX-7h.mjs} +1 -1
  126. package/dist/client/{routeIslandApiConfig-DNx6b07x.mjs → routeIslandApiConfig-CaXesATK.mjs} +1 -1
  127. package/dist/client/{shop-DyXtB5TD.mjs → shop-DLufMauE.mjs} +3 -3
  128. package/dist/client/{shop-commerce-xjWH7-Ym.mjs → shop-commerce-BxYYXLNK.mjs} +12 -12
  129. package/dist/client/{shop-commerce-store-CbBsS1kD.mjs → shop-commerce-store-Dp3Nl5YK.mjs} +1 -1
  130. package/dist/client/{shop.client-QOKqQPgK.mjs → shop.client-CBy9_alG.mjs} +13 -13
  131. package/dist/client/{shop.interactive-BQdm441g.mjs → shop.interactive-BM0NRsFQ.mjs} +265 -24
  132. package/dist/client/{shopShared-CyW6MU48.mjs → shopShared-lS23OQE-.mjs} +2 -2
  133. package/dist/client/site-styles-D8jEPGxA.mjs +3 -0
  134. package/dist/{preview-next/client/ThemedButton-g7NPrsGp.mjs → client/site-styles-DELkUk9s.mjs} +25654 -17259
  135. package/dist/client/spam-protection.mjs +2 -2
  136. package/dist/client/src-DjnxOjXG.mjs +217 -0
  137. package/dist/client/surfaceTransportMarker-BXepAVF6.mjs +152 -0
  138. package/dist/client/{timetableModel-BgdkhRuA.mjs → timetableModel-DzRWikCU.mjs} +157 -139
  139. package/dist/client/types-sF-IrGQr.mjs +633 -0
  140. package/dist/client/{useAvailableSlots-wmdo6uZ8.mjs → useAvailableSlots-C3LphWDX.mjs} +8 -5
  141. package/dist/client/{useBookingNowIso-CUExAee1.mjs → useBookingNowIso-Da-f9iHw.mjs} +1 -1
  142. package/dist/client/{useDiscountApply-BRM-OoTN.mjs → useDiscountApply-SLoWhcen.mjs} +3 -3
  143. package/dist/client/{useDiscountCodeUi-BEIvL31G.mjs → useDiscountCodeUi-D6a2BJij.mjs} +1 -1
  144. package/dist/client/{useEventPagination-Dk3g64we.mjs → useEventPagination-Ccr4TZlm.mjs} +12 -159
  145. package/dist/client/{view-BnaOmrap.mjs → view-8w4GA8rf.mjs} +4 -4
  146. package/dist/client/{view-vhKGFfC3.mjs → view-DAVEoe8A.mjs} +310 -247
  147. package/dist/client/{wizardSteps-xqU4q63H.mjs → wizardSteps-DNpajrAH.mjs} +495 -173
  148. package/dist/preview-next/before-render.mjs +4 -141
  149. package/dist/preview-next/client/ArrangementLookControls-DY5TzhEa.mjs +31197 -0
  150. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-43wIAWr4.mjs → EventEmbeddedCheckoutStep-C_h1cMYm.mjs} +33 -4
  151. package/dist/preview-next/client/{LocationPickerEnvironment-QtSG2Bl-.mjs → LocationPickerEnvironment-D56RD3e_.mjs} +1 -1
  152. package/dist/preview-next/client/{MapLibreEditMap-B-rohNcG.mjs → MapLibreEditMap-DFnyCckr.mjs} +2 -2
  153. package/dist/preview-next/client/PreviewEditorSidebar-DdnhmdFO.mjs +37049 -0
  154. package/dist/preview-next/client/PreviewEditorUI-C7ZmYE33.mjs +1189 -0
  155. package/dist/preview-next/client/PreviewShell-DnO38NaL.mjs +4707 -0
  156. package/dist/preview-next/client/SdkPreviewModeRuntime-D2OtoRMB.mjs +4258 -0
  157. package/dist/preview-next/client/SiteChromeCustomizeButton-eIu2RejJ.mjs +71144 -0
  158. package/dist/preview-next/client/ThemedButton-C0dgGJ5k.mjs +2006 -0
  159. package/dist/preview-next/client/{lucide-react-CA9cpo0P.mjs → lucide-react-CPBCf6QT.mjs} +15 -2
  160. package/dist/preview-next/client/previewAssistantSlot-Bp1AlAxx.mjs +110560 -0
  161. package/dist/preview-next/client/previewChromeSurface-D2cREDJ5.mjs +190 -0
  162. package/dist/preview-next/client/runtime.mjs +3 -3
  163. package/dist/preview-next/client/sdk-runtime-DK0PUhLL.mjs +5 -0
  164. package/dist/preview-next/client/useAutosaveStatus--Pw8vnef.mjs +138 -0
  165. package/dist/preview-next/client/useBlockCustomizeControls-C1Rl73N4.mjs +2724 -0
  166. package/dist/preview-next/client/useOpenBlockForSetup-CL3842FM.mjs +28 -0
  167. package/dist/preview-next/keepAlive.mjs +27 -4
  168. package/dist/preview-next/middleware.mjs +2 -2
  169. package/dist/preview-next/{route-contract-D5tHZEz5.mjs → route-contract-Bq7SUX3K.mjs} +143 -126
  170. package/dist/preview-next/{session-P1R_ajT7.mjs → session-DU6zpYUQ.mjs} +1 -1
  171. package/dist/preview-next/session.mjs +1 -1
  172. package/dist/server/{Block.shared-Iy7g11iP.mjs → Block.shared-wXr7Iwhs.mjs} +7 -4
  173. package/dist/server/{src-cbbK3Bho.mjs → ThemeScopeCore-BI2mld9R.mjs} +1153 -2523
  174. package/dist/server/accessibleSurfaces-CuN8U_iU.mjs +2102 -0
  175. package/dist/server/{bindings-BVJGgUT0.mjs → bindings-DjdUq9FR.mjs} +2 -3
  176. package/dist/server/{publicProducts-D3Fc5TKk.mjs → client-07UeMDzA.mjs} +2492 -357
  177. package/dist/server/config-validation.mjs +1 -1
  178. package/dist/server/config.mjs +33 -2
  179. package/dist/server/data/dataLoaderContext.mjs +2 -0
  180. package/dist/server/data/resolveBlockData.mjs +2 -0
  181. package/dist/server/data/types.mjs +1 -0
  182. package/dist/server/dataLoaderContext-B3fXA54R.mjs +47 -0
  183. package/dist/server/identity-Bn9OQiT1.mjs +6 -0
  184. package/dist/server/index.mjs +3 -3
  185. package/dist/server/{loadContent-BuintpdO.mjs → loadContent-ClpaSlBb.mjs} +6 -5
  186. package/dist/server/{loadPage-Dk4wea8M.mjs → loadPage-BwtVqpaA.mjs} +4 -2
  187. package/dist/server/manifest.mjs +1 -1
  188. package/dist/server/media-DnlczCMA.mjs +231 -0
  189. package/dist/server/mode-Cv_TG9gP.mjs +63 -0
  190. package/dist/server/next/middleware.mjs +1 -1
  191. package/dist/server/next/revalidate.mjs +1 -1
  192. package/dist/server/next.mjs +13 -13
  193. package/dist/server/opaqueSurface-3YSDPtDe.mjs +54 -0
  194. package/dist/server/{overrideResolution-BDiQWM7D.mjs → overrideResolution-Du_w3LY4.mjs} +2 -1
  195. package/dist/server/overrides-CD4d-1w7.mjs +177 -0
  196. package/dist/server/page-converter.mjs +243 -91
  197. package/dist/server/pageRenderPlan-BShULdc2.mjs +4055 -0
  198. package/dist/server/{themeAdmission-BdY8lP-K.mjs → pageRuntimeSupport-C4Dh5-mB.mjs} +13 -28
  199. package/dist/server/{overrides-DVemf-GV.mjs → pageShared-HdKFBpaX.mjs} +3594 -1726
  200. package/dist/server/parseThemeForPersistence-CJMrEkze.mjs +52 -0
  201. package/dist/server/{prebuild-DubLNgRH.mjs → prebuild-Cl-bkaMA.mjs} +1 -1
  202. package/dist/server/prebuild.mjs +1 -1
  203. package/dist/server/prefetchBlockData-C4yUmz-r.mjs +786 -0
  204. package/dist/server/publicProducts-W9hDRwjz.mjs +64 -0
  205. package/dist/server/{registry-zjd1P2Dl.mjs → registry-TFPJdGQi.mjs} +20901 -792
  206. package/dist/server/rendering/components/pageShared.mjs +2 -0
  207. package/dist/server/rendering/helpers/loadPage.mjs +2 -0
  208. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +2 -0
  209. package/dist/server/rendering/server.mjs +5 -4
  210. package/dist/server/rendering/themeAdmission.mjs +2 -0
  211. package/dist/server/rendering.mjs +11 -10
  212. package/dist/server/repeaterFields-MIz7r1ez.mjs +9 -0
  213. package/dist/server/{resolveBlockData-CZJ--nH6.mjs → resolveBlockData-OHlOXlOE.mjs} +6 -48
  214. package/dist/server/resolveButtonColourStates-lry2ORwX.mjs +2672 -0
  215. package/dist/server/{richTextSchema-YYc85FX4.mjs → richTextSchema-Euhuj-7V.mjs} +26 -1
  216. package/dist/server/routing.mjs +1 -1
  217. package/dist/server/schema-C2PqHrMo.mjs +2523 -0
  218. package/dist/server/server.mjs +3 -3
  219. package/dist/server/theme-bridge.mjs +1031 -1
  220. package/dist/server/theme.mjs +2 -1
  221. package/dist/server/themeAdmission-DGSAlFUK.mjs +18 -0
  222. package/dist/server/{three-pass-converter-Chnb1XD-.mjs → three-pass-converter-_j2UE2tR.mjs} +1 -1
  223. package/dist/server/validation-CDd6m8Ry.mjs +140 -0
  224. package/dist/server/{validation-CGH-Xs4E.mjs → validation-DIBFZeMB.mjs} +419 -3
  225. package/dist/server/{version-DoOG6F13.mjs → version-DZWZM1H6.mjs} +1 -1
  226. package/dist/styles/index.css +924 -10
  227. package/package.json +39 -1
  228. package/dist/_dts/previewCompiler-BVVgDSdq.d.ts +0 -1
  229. package/dist/client/cta-ChiN1Vgg.mjs +0 -80
  230. package/dist/client/purchase-BMsWpx8y.mjs +0 -894
  231. package/dist/client/schema-DMUkBtIO.mjs +0 -15915
  232. package/dist/client/site-styles-BLHYJ8S7.mjs +0 -12339
  233. package/dist/client/src-VIsPY-kw.mjs +0 -62
  234. package/dist/preview-next/client/PreviewEditorSidebar-C3AQVxQt.mjs +0 -5441
  235. package/dist/preview-next/client/PreviewEditorUI-C-1zDCR_.mjs +0 -756
  236. package/dist/preview-next/client/SdkPreviewModeRuntime-B47yHFL0.mjs +0 -9130
  237. package/dist/preview-next/client/SdkPreviewModeRuntime-C6Rhm2NQ.mjs +0 -3
  238. package/dist/preview-next/client/previewAuthStore-By_zfrS5.mjs +0 -212195
  239. package/dist/preview-next/client/previewChromeSurface-Cjwxv90x.mjs +0 -85
  240. package/dist/preview-next/client/result-BjJUoxUF.mjs +0 -16
  241. package/dist/preview-next/client/sdk-runtime-BG2HYvQj.mjs +0 -4
  242. package/dist/preview-next/client/siteStyleAccess-BiSyYyyr.mjs +0 -14178
  243. package/dist/preview-next/client/spinner-DnWpeDp2.mjs +0 -67
  244. package/dist/preview-next/refresh-contract-uQ6BXgLJ.mjs +0 -25
  245. package/dist/server/bindings-Dgt_0goJ.mjs +0 -17
  246. package/dist/server/client-CiKaE8ms.mjs +0 -2330
  247. package/dist/server/effectiveNavLinkStyle-EDSdd_oK.mjs +0 -11574
  248. package/dist/server/loadPage-BwjncpJf.mjs +0 -2
  249. package/dist/server/prefetchBlockData-Bnbwoe5n.mjs +0 -4156
  250. package/dist/server/schema-BlTWmTSl.mjs +0 -16142
  251. package/dist/server/site-styles-yHytcXIB.mjs +0 -768
  252. package/dist/server/siteChromeOverlayClearance-D0uCNZ7E.mjs +0 -802
@@ -1,4156 +0,0 @@
1
- import { Cn as ok, Dn as parseResolvedSurface, Dt as indexRenderableMediaAssets, Et as renderableMediaAssetSchema, Lt as asDesignBlockId, On as parseSurfaceTree, Ot as resolveManagedMediaReference, Sn as err, St as mediaSchema, Ut as asSiteStyleId, Vt as asLayoutVariantKey, _n as parseSiteTermsVersionId, bt as stripStaleTransitionStyleGroup, dn as parseApiKeyId, dr as defaultThemeTokens, gn as parseSiteId, kn as resolveSurface, r as themeSchema, tn as makeBoundaryId, vn as parseUserId, wn as mapDrawingStyle, wt as runtimeMediaSchema } from "./schema-BlTWmTSl.mjs";
2
- import { $r as lookSkinSlotTransform, Ai as validateManifestLookField, Br as parseRuntimeBackgroundContent, Bt as buildEventListWeek, Ci as blockCategoryEnum, Da as toUtcIsoDateTimeString, Ei as fieldSchema, F as projectRecurringSchedule, Fi as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, G as resolveCalendarReadProfile, Gn as headerRuntimeTransforms, Gt as eventCalendarWeekStart, Hn as readRuntimeNow, Hr as resolveSurfaceForegroundStyles, Jr as BACKGROUND_POSITION_PRESET_VALUES, Ki as augmentManifest, Kn as chromeLogoTransforms, Mi as validateSdkBlockDeclaration, Ni as NodeSchema, Pi as bindingSchema, Pr as boxStylesTransforms, Qr as lookQuoteLimitTransform, Rn as contentTransforms, Rr as parseBackgroundContent, Ti as builtInBlockKindsSchema, Un as resolveDateRuntimeContext, Ur as resolveBackgroundColorValue, Vr as resolveSectionSurfaceForeground, W as calendarWindowQuerySchema, Wn as mediaTransforms, Xn as uiTransforms, Xr as lookCarouselRegionTransform, Yn as resolveHeroTitleLength, Yr as getAnchorClasses, Zn as formattingTransforms, Zr as lookLeadSlotTransform, aa as parseMailingListProviderScope, bt as eventCalendarListLayoutOptions, ei as asPartialObject, ji as sdkBlockPresentationShape, la as locationValueSchema, ni as runTransforms, nt as computeMediaTransformStyle, pr as standardAspectRatioOptions, pt as resolveEventSelection, qn as layoutTransforms, qr as standardImageShapeOptions, t as getBlockDefinition, ti as createTransformRegistry, vt as eventCalendarListGroupingDecision, wi as blockSectionDeclarationShape, xa as getLocalScheduleDate, xt as resolveEventCalendarReadPlan, yt as eventCalendarListLayoutCompatibleDisplayModeValues, zr as parseBackgroundOverlay } from "./registry-zjd1P2Dl.mjs";
3
- import { t as assertNever } from "./assert-never-ku-PUn9U.mjs";
4
- import { m as SUPPORTED_LOADER_ENDPOINTS$1, n as parsePublicProductCategorySelector } from "./publicProducts-D3Fc5TKk.mjs";
5
- import { D as getGradientPreset, E as gradientToCss, G as resolveEffectiveKnobs, K as cardListFamilyBlocks, O as parseGradientPresetId, _ as readStoredMode, b as resolvePublishedLook, g as arrangementManifestFromVariants, h as resolveLookSlotSurfaces, m as resolveItemSurface, p as arrangementSlotNames, q as cardListKnobBlocks, v as resolveEffectiveArrangement, x as deriveSiteStyleBlockPolicy, y as resolveModeArrangement } from "./effectiveNavLinkStyle-EDSdd_oK.mjs";
6
- import { a as deriveSectionGround, c as resolveSectionBackground, i as applyLookPhotoTreatment, n as composeBoundary, o as heroPhotoPaintsGround, r as sectionFactsForContent, s as parseCanonicalRuntimeBackground, t as boundaryLayout } from "./site-styles-yHytcXIB.mjs";
7
- import { i as isObjectRecord, t as RichTextDocSchema } from "./richTextSchema-YYc85FX4.mjs";
8
- import { i as resolveRouteTargetForStage$1 } from "./dist-Xevqwf1U.mjs";
9
- import { z } from "zod";
10
- //#region ../core/src/rich-text.ts
11
- function isRecord$3(value) {
12
- return typeof value === "object" && value !== null && !Array.isArray(value);
13
- }
14
- function hasOnlyKeys(value, allowed) {
15
- return Object.keys(value).every((key) => allowed.has(key));
16
- }
17
- const rootKeys = /* @__PURE__ */ new Set(["type", "content"]);
18
- const nodeKeys = /* @__PURE__ */ new Set([
19
- "type",
20
- "content",
21
- "text",
22
- "attrs",
23
- "marks"
24
- ]);
25
- const markKeys = /* @__PURE__ */ new Set(["type", "attrs"]);
26
- function isDenseArrayOf(value, predicate) {
27
- for (let index = 0; index < value.length; index += 1) if (!(index in value) || !predicate(value[index])) return false;
28
- return true;
29
- }
30
- function isTipTapMark(value) {
31
- return isRecord$3(value) && hasOnlyKeys(value, markKeys) && typeof value.type === "string" && value.type.length > 0 && (value.attrs === void 0 || isRecord$3(value.attrs));
32
- }
33
- function isTipTapNode(value) {
34
- if (!isRecord$3(value) || !hasOnlyKeys(value, nodeKeys) || typeof value.type !== "string" || value.type.length === 0 || value.type === "doc" || value.attrs !== void 0 && !isRecord$3(value.attrs) || value.marks !== void 0 && (!Array.isArray(value.marks) || !isDenseArrayOf(value.marks, isTipTapMark)) || value.content !== void 0 && (!Array.isArray(value.content) || !isDenseArrayOf(value.content, isTipTapNode))) return false;
35
- if (value.type === "text") return typeof value.text === "string" && value.text.length > 0 && value.content === void 0;
36
- return value.text === void 0;
37
- }
38
- function isCanonicalRichTextDoc(value) {
39
- return isRecord$3(value) && hasOnlyKeys(value, rootKeys) && value.type === "doc" && Array.isArray(value.content) && isDenseArrayOf(value.content, isTipTapNode);
40
- }
41
- //#endregion
42
- //#region ../core/src/secret.ts
43
- /**
44
- * Credential values that must remain inert when they cross diagnostics,
45
- * logging, or serialization boundaries.
46
- *
47
- * The value is deliberately held behind a non-enumerable capability rather
48
- * than exposed as a property. The capability uses a global symbol so a Secret
49
- * created by another bundled copy of core remains consumable at an approved
50
- * `exposeSecret` boundary.
51
- */
52
- const secretValueSymbol = Symbol.for("riverbank.secret.value");
53
- const SECRET_INSPECT_SYMBOL = Symbol.for("nodejs.util.inspect.custom");
54
- function placeholderFor(kind) {
55
- return `[riverbank:redacted:${kind}]`;
56
- }
57
- /** Create an opaque secret after a caller has parsed/validated its boundary. */
58
- function createSecret(kind, value) {
59
- return createSecretInternal(kind, value);
60
- }
61
- /** Construct a Secret for an already validated kind/value pair. */
62
- function createSecretInternal(kind, value) {
63
- const placeholder = placeholderFor(kind);
64
- const secret = {
65
- kind: "secret",
66
- secretType: kind,
67
- toString: () => placeholder,
68
- toJSON: () => placeholder,
69
- [SECRET_INSPECT_SYMBOL]: () => placeholder
70
- };
71
- Object.defineProperty(secret, secretValueSymbol, {
72
- configurable: false,
73
- enumerable: false,
74
- value: () => value,
75
- writable: false
76
- });
77
- return Object.freeze(secret);
78
- }
79
- /**
80
- * Parse an untrusted management API key before constructing its Secret value.
81
- *
82
- * The Secret type protects an already validated value from accidental
83
- * disclosure; this boundary is what validates the value's wire format.
84
- */
85
- function parseManagementKey(raw) {
86
- if (typeof raw !== "string" || !raw.startsWith("bld_mgmt_sk_") || raw.length === 12) return err({ kind: "invalid-management-key" });
87
- return ok(createSecretInternal("management-key", raw));
88
- }
89
- //#endregion
90
- //#region ../core/src/booking-vertical-preset.ts
91
- const BOOKING_ENGINE_BY_BEHAVIOUR = {
92
- class: "event_series",
93
- workshop: "event_series",
94
- course: "event_series",
95
- retreat: "event_series",
96
- performance: "event_series",
97
- appointment: "appointment_service"
98
- };
99
- function verticalBookingPreset(id, verticalId, canonicalBehaviour, label, pluralLabel, description, availability = "onboarding") {
100
- return {
101
- id,
102
- verticalId,
103
- canonicalBehaviour,
104
- engine: BOOKING_ENGINE_BY_BEHAVIOUR[canonicalBehaviour],
105
- availability,
106
- label,
107
- pluralLabel,
108
- description
109
- };
110
- }
111
- //#endregion
112
- //#region ../core/src/booking-vertical-definitions.ts
113
- const VERTICAL_DEFINITIONS = [
114
- {
115
- id: "yoga_wellness",
116
- label: "Yoga, meditation or mindfulness",
117
- description: "Yoga studios, wellness teachers, and movement practitioners."
118
- },
119
- {
120
- id: "fitness_pt",
121
- label: "Fitness and personal training",
122
- description: "Personal trainers, group training, and fitness programmes."
123
- },
124
- {
125
- id: "dance_school",
126
- label: "Dance school",
127
- description: "Dance classes, courses or terms, workshops, private lessons, and shows."
128
- },
129
- {
130
- id: "physiotherapy_physical_health",
131
- label: "Physiotherapy & physical health",
132
- description: "Physiotherapists, chiropractors, osteopaths, sports therapists, and rehabilitation practitioners."
133
- },
134
- {
135
- id: "massage_bodywork",
136
- label: "Massage & bodywork",
137
- description: "Massage therapists, bodyworkers, and somatic practitioners."
138
- },
139
- {
140
- id: "therapist_practitioner",
141
- label: "Therapist or practitioner",
142
- description: "Appointments, sessions, consultations, and occasional group work."
143
- },
144
- {
145
- id: "beauty_spa",
146
- label: "Beauty or spa",
147
- description: "Treatment-led businesses with optional workshops."
148
- },
149
- {
150
- id: "consultant_coach",
151
- label: "Consultant or coach",
152
- description: "One-to-one calls, workshops, courses, and retreats."
153
- },
154
- {
155
- id: "training_provider",
156
- label: "Training provider",
157
- description: "Courses, workshops, classes, appointments, and residential training."
158
- },
159
- {
160
- id: "retreat_centre",
161
- label: "Retreat centre",
162
- description: "Residential retreats, workshops, classes, courses, and private sessions."
163
- },
164
- {
165
- id: "music_school",
166
- label: "Music teacher or school",
167
- description: "Lessons, classes, terms, workshops, and performances."
168
- },
169
- {
170
- id: "voice_singing",
171
- label: "Voice & Singing",
172
- description: "Singing lessons, choirs, voice circles, workshops, and performances."
173
- },
174
- {
175
- id: "performing_arts_school",
176
- label: "Theatre or performing arts school",
177
- description: "Classes, terms, workshops, performances, and lessons."
178
- },
179
- {
180
- id: "community_wellbeing",
181
- label: "Community or wellbeing centre",
182
- description: "Groups, workshops, courses, appointments, and retreats."
183
- },
184
- {
185
- id: "venue_event_space",
186
- label: "Venue or event space",
187
- description: "Room, resource, or access bookings. Depends on the future capacity-booking domain."
188
- }
189
- ];
190
- VERTICAL_DEFINITIONS.map(({ id }) => id);
191
- //#endregion
192
- //#region ../core/src/booking-vertical-catalog.ts
193
- const VERTICAL_BOOKING_PRESETS = [
194
- verticalBookingPreset("yoga_wellness.classes", "yoga_wellness", "class", "Class", "Classes", "Regular scheduled classes and group sessions."),
195
- verticalBookingPreset("yoga_wellness.workshops", "yoga_wellness", "workshop", "Workshop", "Workshops", "One-off workshops, day retreats, or special sessions."),
196
- verticalBookingPreset("yoga_wellness.courses", "yoga_wellness", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups."),
197
- verticalBookingPreset("yoga_wellness.retreats", "yoga_wellness", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats and immersive experiences."),
198
- verticalBookingPreset("yoga_wellness.appointments", "yoga_wellness", "appointment", "Appointment", "Appointments", "Private sessions, consultations, or one-to-one support."),
199
- verticalBookingPreset("fitness_pt.group_training", "fitness_pt", "class", "Group training", "Group training", "Regular scheduled classes and group sessions."),
200
- verticalBookingPreset("fitness_pt.personal_training", "fitness_pt", "appointment", "Personal training", "Personal training", "One-to-one sessions booked from your availability."),
201
- verticalBookingPreset("fitness_pt.programmes", "fitness_pt", "course", "Programme", "Programmes", "Multi-session programmes like bootcamps or courses."),
202
- verticalBookingPreset("fitness_pt.workshops", "fitness_pt", "workshop", "Workshop", "Workshops", "One-off workshops, events, or special sessions."),
203
- verticalBookingPreset("fitness_pt.retreats", "fitness_pt", "retreat", "Retreat", "Retreats", "Multi-day or residential fitness experiences."),
204
- verticalBookingPreset("dance_school.classes", "dance_school", "class", "Class", "Classes", "Regular group classes and weekly sessions."),
205
- {
206
- ...verticalBookingPreset("dance_school.terms", "dance_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
207
- eventPresetOverride: "term"
208
- },
209
- verticalBookingPreset("dance_school.courses", "dance_school", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups.", "settings"),
210
- verticalBookingPreset("dance_school.workshops", "dance_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
211
- verticalBookingPreset("dance_school.private_lessons", "dance_school", "appointment", "Private lesson", "Private lessons", "One-to-one lessons or coaching sessions."),
212
- verticalBookingPreset("dance_school.shows", "dance_school", "performance", "Show", "Shows", "Ticketed performances, showcases, and recitals."),
213
- verticalBookingPreset("physiotherapy_physical_health.appointments", "physiotherapy_physical_health", "appointment", "Appointment", "Appointments", "Assessments, treatments, follow-ups, and rehabilitation sessions."),
214
- verticalBookingPreset("physiotherapy_physical_health.rehab_classes", "physiotherapy_physical_health", "class", "Rehab class", "Rehab classes", "Regular rehabilitation, mobility, strength, or recovery classes."),
215
- verticalBookingPreset("physiotherapy_physical_health.workshops", "physiotherapy_physical_health", "workshop", "Workshop", "Workshops", "One-off workshops, talks, or practical group sessions."),
216
- verticalBookingPreset("massage_bodywork.treatments", "massage_bodywork", "appointment", "Treatment", "Treatments", "Massage treatments, bodywork sessions, and one-to-one appointments."),
217
- verticalBookingPreset("massage_bodywork.group_sessions", "massage_bodywork", "class", "Group session", "Group sessions", "Regular bodywork, somatic movement, or self-massage sessions."),
218
- verticalBookingPreset("massage_bodywork.workshops", "massage_bodywork", "workshop", "Workshop", "Workshops", "One-off bodywork, self-massage, or somatic practice workshops."),
219
- verticalBookingPreset("therapist_practitioner.appointments", "therapist_practitioner", "appointment", "Appointment", "Appointments", "Sessions, consultations, treatments, or assessments."),
220
- verticalBookingPreset("therapist_practitioner.workshops", "therapist_practitioner", "workshop", "Workshop", "Workshops", "One-off group workshops, talks, or wellbeing sessions."),
221
- verticalBookingPreset("therapist_practitioner.retreats", "therapist_practitioner", "retreat", "Retreat", "Retreats", "Multi-day retreats or immersive group experiences."),
222
- verticalBookingPreset("beauty_spa.appointments", "beauty_spa", "appointment", "Appointment", "Appointments", "Treatments, consultations, services, and sessions."),
223
- verticalBookingPreset("beauty_spa.workshops", "beauty_spa", "workshop", "Workshop", "Workshops", "Skincare workshops, makeup lessons, demos, or group events."),
224
- verticalBookingPreset("consultant_coach.appointments", "consultant_coach", "appointment", "Appointment", "Appointments", "One-to-one calls, consultations, reviews, or coaching sessions."),
225
- verticalBookingPreset("consultant_coach.workshops", "consultant_coach", "workshop", "Workshop", "Workshops", "One-off group sessions, webinars, or strategy days."),
226
- verticalBookingPreset("consultant_coach.courses", "consultant_coach", "course", "Course", "Courses", "Fixed-schedule cohorts or multi-session group programmes."),
227
- verticalBookingPreset("consultant_coach.retreats", "consultant_coach", "retreat", "Retreat", "Retreats", "Multi-day coaching retreats or immersive experiences."),
228
- verticalBookingPreset("training_provider.courses", "training_provider", "course", "Course", "Courses", "Fixed-schedule courses, cohorts, and multi-session training."),
229
- verticalBookingPreset("training_provider.workshops", "training_provider", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, and short training sessions."),
230
- verticalBookingPreset("training_provider.appointments", "training_provider", "appointment", "Appointment", "Appointments", "Consultations, assessments, mentoring, or office hours."),
231
- verticalBookingPreset("training_provider.classes", "training_provider", "class", "Class", "Classes", "Regular classes, sessions, or groups.", "settings"),
232
- verticalBookingPreset("training_provider.residentials", "training_provider", "retreat", "Residential", "Residentials", "Residential courses or multi-day training experiences.", "settings"),
233
- verticalBookingPreset("retreat_centre.retreats", "retreat_centre", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats with richer booking needs."),
234
- verticalBookingPreset("retreat_centre.workshops", "retreat_centre", "workshop", "Workshop", "Workshops", "One-day retreats, ceremonies, workshops, or special events."),
235
- verticalBookingPreset("retreat_centre.classes", "retreat_centre", "class", "Class", "Classes", "Regular sessions like guided meditations or group practices."),
236
- verticalBookingPreset("retreat_centre.courses", "retreat_centre", "course", "Course", "Courses", "Fixed-schedule programmes or multi-session experiences."),
237
- verticalBookingPreset("retreat_centre.appointments", "retreat_centre", "appointment", "Appointment", "Appointments", "Private sessions, therapies, consultations, or add-ons."),
238
- verticalBookingPreset("music_school.lessons", "music_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, consultations, or coaching sessions."),
239
- verticalBookingPreset("music_school.classes", "music_school", "class", "Class", "Classes", "Regular group classes, ensembles, or recurring sessions."),
240
- {
241
- ...verticalBookingPreset("music_school.terms", "music_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date group courses."),
242
- eventPresetOverride: "term"
243
- },
244
- verticalBookingPreset("music_school.workshops", "music_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
245
- verticalBookingPreset("music_school.performances", "music_school", "performance", "Performance", "Performances", "Concerts, recitals, showcases, or ticketed performances."),
246
- verticalBookingPreset("voice_singing.lessons", "voice_singing", "appointment", "Voice session", "Voice sessions", "One-to-one singing lessons, voice coaching, or private practice sessions."),
247
- verticalBookingPreset("voice_singing.classes", "voice_singing", "class", "Ongoing weekly session", "Ongoing weekly sessions", "Regular choirs, voice circles, community singing, or group practice."),
248
- {
249
- ...verticalBookingPreset("voice_singing.terms", "voice_singing", "course", "Singing term", "Singing terms", "Multi-week choir terms, voice courses, or fixed-date group programmes."),
250
- eventPresetOverride: "term"
251
- },
252
- verticalBookingPreset("voice_singing.workshops", "voice_singing", "workshop", "Workshop", "Workshops", "One-off singing workshops, voice journeys, or devotional singing sessions."),
253
- verticalBookingPreset("voice_singing.performances", "voice_singing", "performance", "Performance", "Performances", "Choir concerts, sharing events, recitals, or community performances."),
254
- verticalBookingPreset("performing_arts_school.classes", "performing_arts_school", "class", "Class", "Classes", "Regular group classes, rehearsals, or weekly sessions."),
255
- {
256
- ...verticalBookingPreset("performing_arts_school.terms", "performing_arts_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
257
- eventPresetOverride: "term"
258
- },
259
- verticalBookingPreset("performing_arts_school.workshops", "performing_arts_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
260
- verticalBookingPreset("performing_arts_school.performances", "performing_arts_school", "performance", "Performance", "Performances", "Shows, showcases, productions, or ticketed performances."),
261
- verticalBookingPreset("performing_arts_school.lessons", "performing_arts_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, coaching, or audition prep."),
262
- verticalBookingPreset("community_wellbeing.classes", "community_wellbeing", "class", "Class", "Classes", "Regular groups, sessions, practices, or weekly activities."),
263
- verticalBookingPreset("community_wellbeing.workshops", "community_wellbeing", "workshop", "Workshop", "Workshops", "One-off workshops, talks, events, or gatherings."),
264
- verticalBookingPreset("community_wellbeing.courses", "community_wellbeing", "course", "Course", "Courses", "Fixed-schedule courses, study groups, or multi-session programmes."),
265
- verticalBookingPreset("community_wellbeing.appointments", "community_wellbeing", "appointment", "Appointment", "Appointments", "One-to-one appointments, consultations, or support sessions."),
266
- verticalBookingPreset("community_wellbeing.retreats", "community_wellbeing", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats."),
267
- verticalBookingPreset("venue_event_space.resource_hire", "venue_event_space", "appointment", "Hire slot", "Hire slots", "Future room, venue, and resource hire bookings.", "future")
268
- ];
269
- //#endregion
270
- //#region ../core/src/booking-vertical-config.ts
271
- const VERTICAL_ID_SET = new Set(VERTICAL_DEFINITIONS.map(({ id }) => id));
272
- const VERTICAL_PRESET_ID_SET = new Set(VERTICAL_BOOKING_PRESETS.map((presetDefinition) => presetDefinition.id));
273
- function parseVerticalId(value) {
274
- return typeof value === "string" && VERTICAL_ID_SET.has(value) ? value : null;
275
- }
276
- function parseVerticalPresetId(value) {
277
- return typeof value === "string" && VERTICAL_PRESET_ID_SET.has(value) ? value : null;
278
- }
279
- function getVerticalPresetDefinition(presetId) {
280
- const definition = VERTICAL_BOOKING_PRESETS.find((presetDefinition) => presetDefinition.id === presetId);
281
- if (definition === void 0) throw new Error(`Unhandled vertical preset id: ${presetId}`);
282
- return definition;
283
- }
284
- function createConfiguredSiteVerticalBookingConfig(verticalId, selectedPresetIds) {
285
- return {
286
- verticalId,
287
- selectedPresetIds
288
- };
289
- }
290
- function toNonEmptyVerticalPresetIds(presetIds) {
291
- const firstPresetId = presetIds[0];
292
- return firstPresetId ? [firstPresetId, ...presetIds.slice(1)] : null;
293
- }
294
- const DEFAULT_SITE_VERTICAL_BOOKING_CONFIG = {
295
- verticalId: null,
296
- selectedPresetIds: []
297
- };
298
- function appendUniqueIssue(issues, issue) {
299
- return issues.some((existing) => existing.code === issue.code) ? issues : [...issues, issue];
300
- }
301
- function collectRawConfigIssues(rawConfig, config) {
302
- const rawPresetValue = rawConfig.selectedPresetIds;
303
- const rawPresetIds = Array.isArray(rawPresetValue) ? rawPresetValue : [];
304
- let issues = [];
305
- if (rawConfig.verticalId != null && config.verticalId === null) issues = appendUniqueIssue(issues, {
306
- code: "unknown_vertical",
307
- rawValue: rawConfig.verticalId
308
- });
309
- if (config.verticalId === null && config.selectedPresetIds.length > 0) issues = appendUniqueIssue(issues, { code: "missing_vertical" });
310
- if (rawPresetValue !== void 0 && !Array.isArray(rawPresetValue) || rawPresetIds.some((presetId) => parseVerticalPresetId(presetId) === null)) issues = appendUniqueIssue(issues, {
311
- code: "unknown_preset",
312
- rawValue: rawPresetValue
313
- });
314
- if (rawConfig.verticalId != null && config.selectedPresetIds.length === 0) issues = appendUniqueIssue(issues, { code: "empty_selected_presets" });
315
- return issues;
316
- }
317
- function collectPresetConfigIssues(config) {
318
- const seenPresetIds = /* @__PURE__ */ new Set();
319
- const seenBehaviours = /* @__PURE__ */ new Set();
320
- let issues = [];
321
- for (const presetId of config.selectedPresetIds) {
322
- const presetDefinition = getVerticalPresetDefinition(presetId);
323
- if (seenPresetIds.has(presetId)) issues = appendUniqueIssue(issues, { code: "duplicate_preset_id" });
324
- seenPresetIds.add(presetId);
325
- if (config.verticalId !== null && presetDefinition.verticalId !== config.verticalId) issues = appendUniqueIssue(issues, { code: "preset_vertical_mismatch" });
326
- if (presetDefinition.availability === "future") issues = appendUniqueIssue(issues, { code: "future_preset_selected" });
327
- if (seenBehaviours.has(presetDefinition.canonicalBehaviour)) issues = appendUniqueIssue(issues, { code: "duplicate_canonical_behaviour" });
328
- seenBehaviours.add(presetDefinition.canonicalBehaviour);
329
- }
330
- return issues;
331
- }
332
- function getSiteVerticalConfigIssues(rawConfig, config) {
333
- let issues = collectRawConfigIssues(rawConfig, config);
334
- for (const issue of collectPresetConfigIssues(config)) issues = appendUniqueIssue(issues, issue);
335
- return issues;
336
- }
337
- function resolveSiteVerticalBookingConfig(rawConfig) {
338
- if (rawConfig == null) return {
339
- kind: "unconfigured",
340
- config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
341
- };
342
- const verticalId = parseVerticalId(rawConfig.verticalId);
343
- const selectedPresetIds = (Array.isArray(rawConfig.selectedPresetIds) ? rawConfig.selectedPresetIds : []).map(parseVerticalPresetId).filter((presetId) => Boolean(presetId));
344
- const config = {
345
- verticalId,
346
- selectedPresetIds
347
- };
348
- if (rawConfig.verticalId == null && selectedPresetIds.length === 0) return {
349
- kind: "unconfigured",
350
- config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
351
- };
352
- const issues = getSiteVerticalConfigIssues(rawConfig, config);
353
- if (issues.length > 0) return {
354
- kind: "invalid",
355
- config,
356
- issues
357
- };
358
- const nonEmptyPresetIds = toNonEmptyVerticalPresetIds(selectedPresetIds);
359
- const configuredConfig = verticalId !== null && nonEmptyPresetIds !== null ? createConfiguredSiteVerticalBookingConfig(verticalId, nonEmptyPresetIds) : null;
360
- if (configuredConfig === null) return {
361
- kind: "invalid",
362
- config,
363
- issues: [{ code: "empty_selected_presets" }]
364
- };
365
- return {
366
- kind: "configured",
367
- config: configuredConfig,
368
- selectedPresets: configuredConfig.selectedPresetIds.map(getVerticalPresetDefinition)
369
- };
370
- }
371
- //#endregion
372
- //#region ../blocks/src/system/data/selectBlockContent.ts
373
- /** Canonical admitted content: legacy publishedContent never selects a version. */
374
- function selectBlockContent(block, stage = "published") {
375
- const source = stage === "preview" && block.draftContent ? block.draftContent : block.content;
376
- return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
377
- }
378
- //#endregion
379
- //#region ../blocks/src/system/manifest/variantKey.ts
380
- /** Parse stored content only; defaults belong to resolveEffectiveArrangement. */
381
- function parseStoredVariant(manifest, content) {
382
- const variants = manifest.variants;
383
- const key = [content.variant, content.layout].find((value) => typeof value === "string" && Boolean(variants && Object.prototype.hasOwnProperty.call(variants, value)));
384
- return key ? {
385
- kind: "explicit",
386
- key: asLayoutVariantKey(key)
387
- } : { kind: "absent" };
388
- }
389
- //#endregion
390
- //#region ../blocks/src/pageRenderAdmission.ts
391
- function toPresentationPage(page) {
392
- if (!page) return null;
393
- return {
394
- ...page,
395
- blocks: page.blocks.map((block) => {
396
- const presentationMetadata = {
397
- id: block.id,
398
- kind: block.kind,
399
- purpose: block.purpose,
400
- ...block.contentVersionId ? { contentVersionId: block.contentVersionId } : {},
401
- ...block.draftContentId !== void 0 ? { draftContentId: block.draftContentId } : {},
402
- publishedPlacement: block.publishedPlacement,
403
- ...block.bindings ? { bindings: block.bindings } : {}
404
- };
405
- return block.admission.kind === "renderable" ? {
406
- ...presentationMetadata,
407
- content: block.admission.content,
408
- presentationAdmission: { kind: "renderable" }
409
- } : {
410
- ...presentationMetadata,
411
- presentationAdmission: {
412
- kind: "invalid",
413
- error: block.admission.error
414
- }
415
- };
416
- })
417
- };
418
- }
419
- function toEditorPresentationPage(page) {
420
- if (!page) return null;
421
- return {
422
- ...page,
423
- blocks: page.blocks.map((block) => ({
424
- ...block,
425
- publishedPlacement: block.publishedPlacement,
426
- presentationAdmission: { kind: "editor" }
427
- }))
428
- };
429
- }
430
- //#endregion
431
- //#region ../blocks/src/system/customize/arrangementKnobs.ts
432
- /**
433
- * Content stage for knobs, shared by the renderer and the editor so what the
434
- * options show and what renders can't disagree. Knob buffets are the block's
435
- * customise facets; the Look exposes, forces or narrows them and the style's
436
- * offer can only remove or narrow further.
437
- */
438
- function resolveArrangementKnobs(input) {
439
- const length = input.blockKind === "block.hero" ? resolveHeroTitleLength({ ...input.content }, "look") : null;
440
- const exposure = arrangementKnobExposure(input.blockKind, input.look, length, storedSplitPhotoSide(input.blockKind, input.content));
441
- return {
442
- length,
443
- exposure,
444
- knobs: resolveEffectiveKnobs({
445
- exposure,
446
- content: normalizedHeadlinePreference(input.content)
447
- })
448
- };
449
- }
450
- function arrangementKnobExposure(blockKind, look, length, splitPhotoSide) {
451
- return systemCustomizeFacetDefinitionsForBlock(blockKind).flatMap((facet) => {
452
- if (facet.knob === void 0 || facet.target.kind !== "content-field") return [];
453
- const id = facet.target.field;
454
- const defaults = look.look.structure.knobDefaults ?? {};
455
- const storedDefault = id === "imagePosition" ? splitPhotoSide : null;
456
- return [{
457
- definition: {
458
- id,
459
- defaultValue: defaults[id] ?? storedDefault ?? facet.defaultValue,
460
- values: facet.values.map((value) => value.value),
461
- ...knobKindMetadata(facet.knob)
462
- },
463
- exposed: exposedKnobIds(look).includes(id),
464
- forced: look.look.structure.forcedKnobs?.[id],
465
- lookValues: look.look.structure.knobValues?.[id],
466
- styleValues: look.knobValues[id],
467
- lengthValues: id === "titleSize" ? headlineAllowedValues(length) : void 0
468
- }];
469
- });
470
- }
471
- /**
472
- * A hero stored as "Split, photo on the left" or "Split, photo on the right"
473
- * already says which side its photo is on. Under a Look that side is the Photo
474
- * side default, so the photo stays where it was until the owner picks a side.
475
- */
476
- function storedSplitPhotoSide(blockKind, content) {
477
- if (blockKind !== "block.hero") return null;
478
- switch (content.variant) {
479
- case "split": return "left";
480
- case "splitReverse": return "right";
481
- default: return null;
482
- }
483
- }
484
- function knobKindMetadata(knob) {
485
- return knob.kind === "fixed" ? { ordered: knob.ordered } : {
486
- ordered: false,
487
- textMaxLength: knob.maxLength
488
- };
489
- }
490
- function headlineAllowedValues(length) {
491
- switch (length) {
492
- case "long": return ["quiet"];
493
- case "medium": return ["quiet", "auto"];
494
- case "short": return [
495
- "quiet",
496
- "auto",
497
- "display"
498
- ];
499
- case null: return;
500
- }
501
- }
502
- /** `titleSize` keeps its five stored values; under a Look they read as three steps. */
503
- function normalizedHeadlinePreference(content) {
504
- switch (content.titleSize) {
505
- case "editorial": return {
506
- ...content,
507
- titleSize: "auto"
508
- };
509
- case "poster": return {
510
- ...content,
511
- titleSize: "display"
512
- };
513
- default: return content;
514
- }
515
- }
516
- function exposedKnobIds(look) {
517
- return [...look.look.structure.knobs, ...look.addKnobs ?? []].filter((id) => !look.removeKnobs.some((removed) => removed === id));
518
- }
519
- //#endregion
520
- //#region ../blocks/src/system/customize/facets.ts
521
- function defineCustomizeFacet(definition) {
522
- return definition;
523
- }
524
- const eventCalendarListLayoutFacet = defineCustomizeFacet({
525
- blockKind: "block.event-calendar",
526
- id: "eventCalendar.listLayout",
527
- label: "List style",
528
- legacyOnly: true,
529
- values: eventCalendarListLayoutOptions.map((option) => ({
530
- value: option.id,
531
- label: option.label
532
- })),
533
- defaultValue: "stack",
534
- target: { kind: "event-calendar-list-layout-content" },
535
- appliesToLayoutVariants: eventCalendarListLayoutCompatibleDisplayModeValues
536
- });
537
- const fixedKnob = (blockKind, id, label, values, defaultValue, ordered = false, boolean = false) => ({
538
- blockKind,
539
- id,
540
- label,
541
- values,
542
- defaultValue,
543
- knob: {
544
- kind: "fixed",
545
- ordered
546
- },
547
- target: {
548
- kind: "content-field",
549
- field: id,
550
- ...boolean ? { boolean: true } : {}
551
- }
552
- });
553
- const textKnob = (id, label, maxLength) => ({
554
- blockKind: "block.hero",
555
- id,
556
- label,
557
- values: [],
558
- defaultValue: "",
559
- knob: {
560
- kind: "text",
561
- maxLength
562
- },
563
- target: {
564
- kind: "content-field",
565
- field: id
566
- }
567
- });
568
- const onOff = [{
569
- value: "true",
570
- label: "On"
571
- }, {
572
- value: "false",
573
- label: "Off"
574
- }];
575
- const systemCustomizeFacetDefinitions = [
576
- eventCalendarListLayoutFacet,
577
- fixedKnob("block.offerings-preview", "dates", "Dates", [{
578
- value: "summary",
579
- label: "Summary"
580
- }, {
581
- value: "next-dates",
582
- label: "Next dates"
583
- }], "summary"),
584
- {
585
- ...fixedKnob("block.feature-cards", "actionStyle", "Item actions", [{
586
- value: "button",
587
- label: "Button"
588
- }, {
589
- value: "link",
590
- label: "Link"
591
- }], "button"),
592
- blockKinds: cardListKnobBlocks
593
- },
594
- fixedKnob("block.testimonials", "quoteCount", "How many quotes", [
595
- {
596
- value: "1",
597
- label: "1"
598
- },
599
- {
600
- value: "2",
601
- label: "2"
602
- },
603
- {
604
- value: "3",
605
- label: "3"
606
- },
607
- {
608
- value: "all",
609
- label: "All"
610
- }
611
- ], "3", true),
612
- fixedKnob("block.testimonials", "tilt", "Tilt the small cards", onOff, "true", false, true),
613
- {
614
- ...fixedKnob("block.testimonials", "archFrame", "Arch frame", onOff, "true", false, true),
615
- blockKinds: [
616
- "block.testimonials",
617
- "block.newsletter-signup",
618
- "block.form"
619
- ]
620
- },
621
- fixedKnob("block.hero", "candleGlow", "Candle glow", onOff, "true", false, true),
622
- fixedKnob("block.hero", "columnGuides", "Column guides", onOff, "true", false, true),
623
- fixedKnob("block.hero", "titleSize", "Headline size", [
624
- {
625
- value: "quiet",
626
- label: "Quieter"
627
- },
628
- {
629
- value: "auto",
630
- label: "Standard"
631
- },
632
- {
633
- value: "display",
634
- label: "Louder"
635
- }
636
- ], "auto", true),
637
- fixedKnob("block.hero", "imagePosition", "Photo side", [{
638
- value: "left",
639
- label: "Left"
640
- }, {
641
- value: "right",
642
- label: "Right"
643
- }], "right"),
644
- fixedKnob("block.intro", "imageShape", "Media shape", standardImageShapeOptions, "default"),
645
- fixedKnob("block.intro", "imagePosition", "Photo side", [{
646
- value: "left",
647
- label: "Left"
648
- }, {
649
- value: "right",
650
- label: "Right"
651
- }], "left"),
652
- fixedKnob("block.media-text", "imagePosition", "Photo side", [{
653
- value: "left",
654
- label: "Left"
655
- }, {
656
- value: "right",
657
- label: "Right"
658
- }], "left"),
659
- fixedKnob("block.media-text", "imageShape", "Media shape", standardImageShapeOptions, "default"),
660
- fixedKnob("block.media-text", "aspectRatio", "Media aspect ratio", standardAspectRatioOptions, "auto"),
661
- textKnob("stickerLine", "Sticker line", 32),
662
- textKnob("smallCaption", "Small caption", 24),
663
- {
664
- ...fixedKnob("block.feature-cards", "showPhotos", "Show photos", onOff, "true", false, true),
665
- blockKinds: cardListFamilyBlocks
666
- },
667
- fixedKnob("block.event-calendar", "showPhotos", "Photos", [{
668
- value: "true",
669
- label: "Show"
670
- }, {
671
- value: "false",
672
- label: "Hide"
673
- }], "true", false, true),
674
- {
675
- ...fixedKnob("block.feature-cards", "cardMarker", "Item markers", [
676
- {
677
- value: "icons",
678
- label: "Icons"
679
- },
680
- {
681
- value: "numbers",
682
- label: "Numbers"
683
- },
684
- {
685
- value: "none",
686
- label: "None"
687
- }
688
- ], "icons"),
689
- blockKinds: cardListFamilyBlocks
690
- },
691
- {
692
- ...fixedKnob("block.event-calendar", "showCapacity", "Places left", onOff, "true", false, true),
693
- description: "Show how many places are left on each event"
694
- }
695
- ];
696
- systemCustomizeFacetDefinitions.map((definition) => definition.id);
697
- Array.from(new Set(systemCustomizeFacetDefinitions.flatMap((definition) => definition.values.map((option) => option.value))));
698
- function systemCustomizeFacetDefinitionsForBlock(blockKind) {
699
- return systemCustomizeFacetDefinitions.filter((definition) => definition.blockKind === blockKind || "blockKinds" in definition && definition.blockKinds?.some((kind) => kind === blockKind));
700
- }
701
- //#endregion
702
- //#region ../blocks/src/system/transforms/registry/offeringsPreview.ts
703
- /** Reuse the existing occurrence read for the date strip and card date rows. */
704
- const offeringsPreviewDatesReadEnabled = {
705
- id: "events.offeringsPreviewDatesReadEnabled",
706
- kind: "formatter",
707
- summary: "Load one occurrence batch for catalogue dates or next-date cards",
708
- run(value) {
709
- const content = asPartialObject(value);
710
- const dates = asPartialObject(asPartialObject(content?._effectiveKnobs)?.dates);
711
- return content?.displayMode === "catalogue" || dates?.value === "next-dates";
712
- }
713
- };
714
- //#endregion
715
- //#region ../blocks/src/system/helpers/backgroundMedia.ts
716
- function resolveBackgroundMedia(input) {
717
- const parsedMedia = runtimeMediaSchema.safeParse(input.image);
718
- if (!parsedMedia.success) return null;
719
- switch (parsedMedia.data.type) {
720
- case "image":
721
- case "video": return {
722
- ...parsedMedia.data,
723
- type: parsedMedia.data.type
724
- };
725
- case "audio":
726
- case "document":
727
- case "spreadsheet":
728
- case "archive": return null;
729
- }
730
- }
731
- function backgroundVideoMobileClassNames(input) {
732
- if (resolveBackgroundMedia(input)?.type !== "video") return "";
733
- return input.showVideoOnMobile === true ? "" : "rb-hidden rb-md-block";
734
- }
735
- //#endregion
736
- //#region ../blocks/src/system/transforms/registry/background.ts
737
- const isString = (value) => typeof value === "string" && value.trim().length > 0;
738
- const isNumber = (value) => typeof value === "number" && !isNaN(value);
739
- function backgroundMotionClassNames(input) {
740
- return input.motion === "fixed-frame" ? "rb-bg-motion-fixed-frame" : "";
741
- }
742
- function appendBackgroundMediaClasses(baseClassName, input) {
743
- return [
744
- baseClassName,
745
- backgroundMotionClassNames(input),
746
- backgroundVideoMobileClassNames(input)
747
- ].filter(Boolean).join(" ");
748
- }
749
- function gradientPresetCss(value) {
750
- const presetId = parseGradientPresetId(value);
751
- if (!presetId) return null;
752
- const preset = getGradientPreset(presetId);
753
- return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, `rgb(var(--tb-${stop.color}))`])));
754
- }
755
- const backgroundTransforms = [
756
- {
757
- id: "background.resolveMedia",
758
- kind: "formatter",
759
- summary: "Resolve media only from a canonical image or video background",
760
- run: (value) => parseMediaBackground(value)?.image ?? null
761
- },
762
- {
763
- id: "background.resolveStyle",
764
- kind: "formatter",
765
- summary: "Resolve inline styles for background color/gradient layers",
766
- run: (value, options, context) => {
767
- const fallbackToken = options?.fallbackToken;
768
- return resolveBackgroundLayerStyle(value, fallbackToken, context);
769
- }
770
- },
771
- {
772
- id: "background.resolveColorsStyle",
773
- kind: "formatter",
774
- summary: "Resolve surface foreground colors from a background object into scoped CSS vars",
775
- run: (value, options, context) => asPartialObject(options)?.arrangementInherits === true && context.data?._lookSlots !== void 0 ? {} : resolveSurfaceForegroundStyles(value, context)
776
- },
777
- {
778
- id: "background.resolveFrameClassName",
779
- kind: "formatter",
780
- summary: "Resolve clipping on a decorative background frame without clipping foreground content",
781
- run: (value, options) => {
782
- const baseClass = options?.baseClass?.trim() ?? "";
783
- const input = parseMediaBackground(value);
784
- if (!input) return `${baseClass} rb-overflow-hidden`.trim();
785
- if (input.overflow === true) return `${baseClass} rb-overflow-visible`.trim();
786
- const objectFit = input.objectFit ?? null;
787
- const scale = isString(input.scale) ? input.scale.trim() : isNumber(input.scale) ? String(input.scale) : null;
788
- return `${baseClass} ${Boolean((objectFit === "custom" || objectFit === "original") && scale && scale.trim().length > 0) ? "rb-overflow-visible" : "rb-overflow-hidden"}`.trim();
789
- }
790
- },
791
- {
792
- id: "background.resolveImageStyle",
793
- kind: "formatter",
794
- summary: "Resolve inline styles for background image elements",
795
- run: (value, _options, _context) => {
796
- const input = parseMediaBackground(value);
797
- if (!input) return {};
798
- const objectFit = input.objectFit ?? null;
799
- const opacity = input.opacity ?? null;
800
- const position = isString(input.position) ? input.position.trim() : null;
801
- let scaleValue = null;
802
- if (objectFit === "custom" || objectFit === "original") {
803
- if (isString(input.scale)) {
804
- const scaleStr = input.scale.trim();
805
- if (scaleStr) if (/\d+(%|px|vh|vw|rem|em)$/.test(scaleStr)) scaleValue = scaleStr;
806
- else {
807
- const num = parseFloat(scaleStr);
808
- if (!isNaN(num)) scaleValue = `${num}%`;
809
- }
810
- }
811
- }
812
- const style = {};
813
- switch (objectFit) {
814
- case "fill":
815
- case null:
816
- style.objectFit = "cover";
817
- break;
818
- case "fit":
819
- style.objectFit = "contain";
820
- break;
821
- case "original":
822
- case "custom":
823
- style.objectFit = "none";
824
- break;
825
- }
826
- if (opacity !== null) style.opacity = String(opacity);
827
- if (scaleValue) {
828
- style.width = scaleValue;
829
- style.height = scaleValue;
830
- }
831
- if (position && !BACKGROUND_POSITION_PRESET_VALUES.includes(position)) style.objectPosition = position;
832
- const backgroundMedia = resolveBackgroundMedia(input);
833
- if (backgroundMedia) {
834
- const mergedStyle = computeMediaTransformStyle(backgroundMedia, style);
835
- if (mergedStyle) Object.assign(style, mergedStyle);
836
- }
837
- return style;
838
- }
839
- },
840
- {
841
- id: "background.resolveImageClassName",
842
- kind: "string",
843
- summary: "Resolve className for background image based on objectFit, scale and position",
844
- run: (value, options, _context) => {
845
- const baseClass = options?.baseClass ?? "rb-absolute rb-z-neg-10";
846
- const input = parseMediaBackground(value);
847
- if (!input) return `${baseClass} rb-inset-0 rb-h-full rb-w-full`;
848
- const objectFit = input.objectFit ?? null;
849
- const position = isString(input.position) ? input.position.trim() : null;
850
- if (objectFit === "fill" || objectFit === "fit" || objectFit === null) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full rb-object-${objectFit === "fit" ? "contain" : "cover"}`, input);
851
- let needsAnchoring = false;
852
- if (objectFit === "custom" || objectFit === "original") {
853
- if (isString(input.scale)) {
854
- if (input.scale.trim()) needsAnchoring = true;
855
- }
856
- }
857
- if (!needsAnchoring) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full`, input);
858
- const isPreset = position && BACKGROUND_POSITION_PRESET_VALUES.includes(position);
859
- if (position && !isPreset) return appendBackgroundMediaClasses(baseClass, input);
860
- return appendBackgroundMediaClasses(`${baseClass} ${getAnchorClasses(position)}`, input);
861
- }
862
- },
863
- {
864
- id: "background.resolveOverlayStyle",
865
- kind: "formatter",
866
- summary: "Resolve inline styles for background overlay",
867
- run: (value, _options, context) => {
868
- const input = parseBackgroundOverlay(value);
869
- if (!input || input.type === "none") return {};
870
- const color = input.type === "color" && isString(input.color) ? input.color.trim() : null;
871
- const gradient = input.type === "gradient" && isString(input.gradient) ? input.gradient.trim() : null;
872
- const opacity = input.opacity ?? null;
873
- const style = {};
874
- if (input.type === "color" && color) style.backgroundColor = context?.theme?.palette?.[color] ?? color;
875
- if (input.type === "gradient" && gradient) style.backgroundImage = gradient;
876
- if (opacity !== null) style.opacity = String(opacity);
877
- return style;
878
- }
879
- }
880
- ];
881
- function parseMediaBackground(value) {
882
- const background = parseRuntimeBackgroundContent(value);
883
- return background?.type === "image" || background?.type === "video" ? background : null;
884
- }
885
- function resolveBackgroundLayerStyle(value, fallbackToken, context) {
886
- const background = parseRuntimeBackgroundContent(value);
887
- const style = {};
888
- const gradient = background?.type === "gradient" ? isString(background.gradient) ? background.gradient.trim() : gradientPresetCss(background.gradientPresetId) : null;
889
- const color = background?.type === "color" && isString(background.color) ? background.color.trim() : null;
890
- const resolvedColor = color ? resolveBackgroundColorValue(color, context) : !gradient && isString(fallbackToken) ? resolveBackgroundColorValue(fallbackToken.trim(), context) : null;
891
- if (resolvedColor) style.backgroundColor = resolvedColor;
892
- if (gradient) style.backgroundImage = gradient;
893
- const opacity = backgroundMediaOpacity(background);
894
- if (opacity !== null) style.opacity = String(opacity);
895
- return style;
896
- }
897
- function backgroundMediaOpacity(background) {
898
- return background?.type === "image" || background?.type === "video" ? background.opacity ?? null : null;
899
- }
900
- //#endregion
901
- //#region ../blocks/src/system/links/resolve.ts
902
- function resolveRouteTarget(routeIdValue, routes) {
903
- return resolveRouteTargetForStage(routeIdValue, routes, "published");
904
- }
905
- function resolveRouteTargetForStage(routeIdValue, routes, stageInput) {
906
- return resolveRouteTargetForStage$1(routeIdValue, routes, stageInput);
907
- }
908
- function resolvePageRouteTarget(link, context) {
909
- if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
910
- const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
911
- if (existing) return existing;
912
- }
913
- const identifier = typeof link.identifier === "string" ? link.identifier : null;
914
- if (!identifier || !context.pagesByIdentifier) return null;
915
- const routeId = context.pagesByIdentifier[identifier];
916
- if (!routeId) return null;
917
- return resolveRouteTargetForStage(routeId, context.routes, context.stage);
918
- }
919
- function resolveEntryRouteTarget(link, context) {
920
- if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
921
- const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
922
- if (existing) return existing;
923
- }
924
- const contentType = typeof link.contentType === "string" ? link.contentType : null;
925
- const identifier = typeof link.identifier === "string" ? link.identifier : null;
926
- if (!contentType || !identifier || !context.entriesByIdentifier) return null;
927
- const entryMap = context.entriesByIdentifier[contentType];
928
- if (!entryMap) return null;
929
- const routeId = entryMap[identifier];
930
- if (!routeId) return null;
931
- return resolveRouteTargetForStage(routeId, context.routes, context.stage);
932
- }
933
- function resolveFallbackHref(link) {
934
- if (typeof link.href !== "string") return null;
935
- const href = link.href.trim();
936
- return href.length > 0 ? href : null;
937
- }
938
- //#endregion
939
- //#region ../blocks/src/system/transforms/registry/links.ts
940
- /** Resolve internal link via routeId lookup, falling back to href */
941
- function resolveInternalLink(link, context) {
942
- const resolved = resolveRouteFromMap(link.routeId, context);
943
- if (resolved) return resolved;
944
- return resolveFallbackHref(link);
945
- }
946
- function resolveRouteFromMap(routeIdValue, context) {
947
- return resolveRouteTargetForStage(routeIdValue, context.routes, context.stage)?.href ?? null;
948
- }
949
- /** Resolve page identifier link via pagesByIdentifier lookup */
950
- function resolvePageLink(link, context) {
951
- const resolved = resolvePageRouteTarget(link, context);
952
- if (resolved) return resolved.href;
953
- return resolveFallbackHref(link);
954
- }
955
- /** Resolve entry identifier link via entriesByIdentifier lookup */
956
- function resolveEntryLink(link, context) {
957
- const resolved = resolveEntryRouteTarget(link, context);
958
- if (resolved) return resolved.href;
959
- return resolveFallbackHref(link);
960
- }
961
- /** Resolve external or url link by returning trimmed href */
962
- function resolveExternalLink(link) {
963
- return resolveFallbackHref(link);
964
- }
965
- const linksTransforms = [{
966
- id: "links.resolve",
967
- kind: "formatter",
968
- summary: "Resolve LinkValue objects to href strings using the route map",
969
- run: (value, _options, context) => resolveAuthoredLinkHref(value, context)
970
- }, {
971
- id: "links.label",
972
- kind: "formatter",
973
- summary: "Extract a human-readable label from link objects",
974
- run: (value) => {
975
- if (!value || typeof value !== "object") return null;
976
- const link = value;
977
- if (typeof link.label === "string") {
978
- const label = link.label.trim();
979
- if (label.length > 0) return label;
980
- }
981
- if (typeof link.title === "string") {
982
- const title = link.title.trim();
983
- if (title.length > 0) return title;
984
- }
985
- if (typeof link.identifier === "string") {
986
- const identifier = link.identifier.trim();
987
- if (identifier.length > 0) return identifier;
988
- }
989
- if (typeof link.href === "string") {
990
- const href = link.href.trim();
991
- if (href.length > 0) return href;
992
- }
993
- return null;
994
- }
995
- }];
996
- function resolveAuthoredLinkHref(value, context = {}) {
997
- if (!value || typeof value !== "object") return null;
998
- const link = value;
999
- switch (link.kind) {
1000
- case "internal": return resolveInternalLink(link, context);
1001
- case "page": return resolvePageLink(link, context);
1002
- case "entry": return resolveEntryLink(link, context);
1003
- case "external":
1004
- case "url": return resolveExternalLink(link);
1005
- default: return resolvePreResolvedLink(link);
1006
- }
1007
- }
1008
- function resolvePreResolvedLink(link) {
1009
- return !(typeof link.kind === "string" ? link.kind : null) && typeof link.href === "string" ? resolveExternalLink(link) : null;
1010
- }
1011
- //#endregion
1012
- //#region ../blocks/src/system/transforms/registry/mapDrawing.ts
1013
- /**
1014
- * Map tokens for the section ground a drawing sits on. The value is the
1015
- * section's `_sectionStyles.background`, resolved by the same owner as the
1016
- * section's own foreground; theme-core decides every map colour from it.
1017
- */
1018
- const mapDrawingStyleTransform = {
1019
- id: "mapDrawing.resolveStyle",
1020
- kind: "formatter",
1021
- summary: "Resolve map drawing tokens from the section ground and site style",
1022
- run: (value, options, context) => mapDrawingStyle({
1023
- foreground: resolveSectionSurfaceForeground(value ?? sectionFallbackBackground(options?.fallbackToken), context, { fallbackToken: options?.fallbackToken }),
1024
- palette: context.theme.palette,
1025
- skin: context.theme.skin
1026
- })
1027
- };
1028
- function sectionFallbackBackground(token) {
1029
- return token === void 0 ? void 0 : {
1030
- type: "color",
1031
- color: token
1032
- };
1033
- }
1034
- const eventCalendarSelectionParam = {
1035
- id: "events.calendarSelectionParam",
1036
- kind: "formatter",
1037
- summary: "Resolve selected events instead of discovery filters",
1038
- schema: z.object({ key: z.enum([
1039
- "seriesIds",
1040
- "eventSurface",
1041
- "filterEventPresets",
1042
- "scheduleScope",
1043
- "filterCategoryIds",
1044
- "filterStaffMemberId",
1045
- "filterVenueId"
1046
- ]) }),
1047
- run(value, { key }) {
1048
- const content = asPartialObject(value) ?? {};
1049
- const selection = resolveEventSelection(content.eventSelection, content.selectedEventSeriesIds);
1050
- if (selection.kind === "selected") return key === "seriesIds" ? selection.seriesIds : void 0;
1051
- return key === "seriesIds" ? void 0 : content[key];
1052
- }
1053
- };
1054
- const readJobSchema = z.object({ job: z.enum([
1055
- "list",
1056
- "calendar",
1057
- "schedule"
1058
- ]) });
1059
- const eventCalendarReadProfile = {
1060
- id: "events.calendarReadProfile",
1061
- kind: "formatter",
1062
- summary: "Select media enrichment for the calendar display mode",
1063
- run(value) {
1064
- return resolveCalendarReadProfile(asPartialObject(value) ?? {});
1065
- }
1066
- };
1067
- const eventCalendarReadEnabled = {
1068
- id: "events.calendarReadEnabled",
1069
- kind: "formatter",
1070
- summary: "Choose the read projection required by the calendar display mode",
1071
- schema: readJobSchema,
1072
- run(value, options) {
1073
- const plan = resolveEventCalendarReadPlan(asPartialObject(value) ?? {});
1074
- return plan.jobs === options.job || plan.jobs === "both" && options.job !== "schedule";
1075
- }
1076
- };
1077
- //#endregion
1078
- //#region ../blocks/src/system/transforms/registry/index.ts
1079
- const builtinTransformDefinitions = [
1080
- offeringsPreviewDatesReadEnabled,
1081
- lookLeadSlotTransform,
1082
- lookQuoteLimitTransform,
1083
- lookCarouselRegionTransform,
1084
- lookSkinSlotTransform,
1085
- {
1086
- id: "events.calendarListWindow",
1087
- kind: "formatter",
1088
- schema: z.object({ key: z.enum(["from", "to"]) }),
1089
- run(_value, { key }, context) {
1090
- const content = context.data ?? {};
1091
- if (eventCalendarListGroupingDecision({
1092
- ...content,
1093
- arrangementLooks: content._lookSlots !== void 0
1094
- }).grouping !== "week") return void 0;
1095
- const timeZone = context.dateContext.timeZone;
1096
- const startOfWeek = eventCalendarWeekStart(timeZone, content.startOfWeek === "sunday" || content.startOfWeek === "monday" ? content.startOfWeek : void 0);
1097
- return buildEventListWeek(getLocalScheduleDate(new Date(readRuntimeNow(context.now)), timeZone), startOfWeek, timeZone)[key];
1098
- }
1099
- },
1100
- eventCalendarSelectionParam,
1101
- eventCalendarReadEnabled,
1102
- eventCalendarReadProfile,
1103
- {
1104
- id: "events.calendarBanded",
1105
- kind: "formatter",
1106
- summary: "Paint the week-board band only on a section with no background of its own",
1107
- run(value) {
1108
- const content = asPartialObject(value) ?? {};
1109
- const sectionStyles = asPartialObject(content._sectionStyles);
1110
- return content.banded === true && parseBackgroundContent(sectionStyles?.background) === null;
1111
- }
1112
- },
1113
- ...formattingTransforms,
1114
- ...layoutTransforms,
1115
- ...chromeLogoTransforms,
1116
- ...uiTransforms,
1117
- ...mediaTransforms,
1118
- ...backgroundTransforms,
1119
- ...linksTransforms,
1120
- ...boxStylesTransforms,
1121
- ...contentTransforms,
1122
- ...headerRuntimeTransforms,
1123
- mapDrawingStyleTransform
1124
- ];
1125
- const defaultTransforms = createTransformRegistry(builtinTransformDefinitions);
1126
- //#endregion
1127
- //#region ../blocks/src/system/data/linkedContentEntries.ts
1128
- const LINKED_CONTENT_ENTRY_META_KEY = "__rbLinkedContentEntry";
1129
- function coerceLinkedContentEntriesPayload(payload) {
1130
- if (!isRecord$2(payload)) return payload;
1131
- const response = payload;
1132
- if (!Array.isArray(response.entries)) return payload;
1133
- const contentType = parsePublicContentTypeMeta(response.contentType);
1134
- if (!contentType) return response.entries;
1135
- return response.entries.map((entry) => enrichLinkedContentEntry(entry, contentType));
1136
- }
1137
- function getLinkedContentEntryMeta(value) {
1138
- if (!isRecord$2(value)) return null;
1139
- const candidate = value[LINKED_CONTENT_ENTRY_META_KEY];
1140
- return isLinkedContentEntryMeta(candidate) ? candidate : null;
1141
- }
1142
- function buildLinkedContentEditTarget(input) {
1143
- const { entry, sourceBlockId, sourceBlockKind, itemIndex } = input;
1144
- if (!isRecord$2(entry)) return null;
1145
- const meta = getLinkedContentEntryMeta(entry);
1146
- if (!meta || meta.support.kind !== "supported") return null;
1147
- const content = isRecord$2(entry.content) ? entry.content : {};
1148
- return {
1149
- kind: "linked-content-entry",
1150
- entryId: meta.entryId,
1151
- contentTypeKey: meta.contentTypeKey,
1152
- contentTypeLabel: meta.contentTypeLabel,
1153
- title: meta.title,
1154
- optimisticHash: meta.optimisticHash,
1155
- sourceBlockId: sourceBlockId ?? null,
1156
- sourceBlockKind: sourceBlockKind ?? null,
1157
- itemIndex,
1158
- content: { ...content },
1159
- contentType: meta.contentType
1160
- };
1161
- }
1162
- function resolveLinkedEntryInlineFieldEligibility(input) {
1163
- const meta = getLinkedContentEntryMeta(input.entry);
1164
- if (!meta) return {
1165
- kind: "read-only",
1166
- reason: "missing-entry-meta"
1167
- };
1168
- if (meta.support.kind !== "supported") return {
1169
- kind: "read-only",
1170
- reason: "unsupported-content-type"
1171
- };
1172
- const source = resolveLinkedEntryFieldSource(meta, input.displayPath);
1173
- if (!source) return {
1174
- kind: "read-only",
1175
- reason: "unmapped-display-path"
1176
- };
1177
- if (source.kind === "read-only") return {
1178
- kind: "read-only",
1179
- reason: source.reason
1180
- };
1181
- const field = meta.contentType.fields.find((candidate) => candidate.id === source.fieldPath);
1182
- if (!field) return {
1183
- kind: "read-only",
1184
- reason: "missing-field-schema"
1185
- };
1186
- const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
1187
- if (!fieldType || fieldType !== source.fieldType) return {
1188
- kind: "read-only",
1189
- reason: "unsupported-field-type"
1190
- };
1191
- if (input.renderedNodeType === "richText" && fieldType !== "richText") return {
1192
- kind: "read-only",
1193
- reason: "unsupported-field-type"
1194
- };
1195
- if (input.renderedNodeType === "text" && fieldType !== "text") return {
1196
- kind: "read-only",
1197
- reason: "unsupported-field-type"
1198
- };
1199
- return {
1200
- kind: "editable",
1201
- displayPath: input.displayPath,
1202
- write: {
1203
- kind: "linked-entry-write-field",
1204
- entryId: meta.entryId,
1205
- fieldPath: source.fieldPath,
1206
- fieldType
1207
- }
1208
- };
1209
- }
1210
- function enrichLinkedContentEntry(entry, contentType) {
1211
- if (!isRecord$2(entry)) return entry;
1212
- const entryId = typeof entry.id === "string" ? entry.id : null;
1213
- if (!entryId) return entry;
1214
- const title = typeof entry.title === "string" && entry.title.trim().length > 0 ? entry.title : entryId;
1215
- const optimisticHash = typeof entry.optimisticHash === "string" && entry.optimisticHash.length > 0 ? entry.optimisticHash : null;
1216
- const content = isRecord$2(entry.content) ? entry.content : {};
1217
- const meta = {
1218
- kind: "linked-content-entry",
1219
- entryId,
1220
- contentTypeKey: contentType.key,
1221
- contentTypeLabel: contentTypeKeyToLabel(contentType.key),
1222
- title,
1223
- optimisticHash,
1224
- support: resolveLinkedContentEditSupport(contentType),
1225
- contentType,
1226
- fieldSources: deriveLinkedEntryFieldSources(entry, contentType, content)
1227
- };
1228
- return {
1229
- ...entry,
1230
- [LINKED_CONTENT_ENTRY_META_KEY]: meta
1231
- };
1232
- }
1233
- function deriveLinkedEntryFieldSources(entry, contentType, content) {
1234
- const sources = [];
1235
- for (const field of contentType.fields) {
1236
- const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
1237
- if (!fieldType) {
1238
- sources.push({
1239
- kind: "read-only",
1240
- displayPath: `content.${field.id}`,
1241
- reason: "unsupported-field-type"
1242
- });
1243
- continue;
1244
- }
1245
- sources.push({
1246
- kind: "content-field",
1247
- displayPath: `content.${field.id}`,
1248
- fieldPath: field.id,
1249
- fieldType
1250
- });
1251
- if (field.id === "excerpt" && fieldType === "text" && typeof entry.excerpt === "string" && typeof content.excerpt === "string" && entry.excerpt === content.excerpt) sources.push({
1252
- kind: "content-field",
1253
- displayPath: "excerpt",
1254
- fieldPath: "excerpt",
1255
- fieldType
1256
- });
1257
- if (field.id === contentType.titleField && fieldType === "text" && typeof entry.title === "string" && typeof content[field.id] === "string" && entry.title === content[field.id]) sources.push({
1258
- kind: "content-field",
1259
- displayPath: "title",
1260
- fieldPath: field.id,
1261
- fieldType
1262
- });
1263
- }
1264
- for (const displayPath of [
1265
- "title",
1266
- "slug",
1267
- "path",
1268
- "publishedAt",
1269
- "status",
1270
- "image"
1271
- ]) if (displayPath in entry && !sources.some((source) => source.displayPath === displayPath)) sources.push({
1272
- kind: "read-only",
1273
- displayPath,
1274
- reason: displayPath === "image" ? "derived-field" : "route-field"
1275
- });
1276
- return sources;
1277
- }
1278
- function resolveLinkedEntryFieldSource(meta, displayPath) {
1279
- return meta.fieldSources.find((candidate) => candidate.displayPath === displayPath) ?? null;
1280
- }
1281
- function resolvePreviewLinkedEntryInlineFieldType(fieldType) {
1282
- if (fieldType === "richText") return "richText";
1283
- if (fieldType === "text" || fieldType === "textarea") return "text";
1284
- return null;
1285
- }
1286
- function resolveLinkedContentEditSupport(contentType) {
1287
- if (contentType.fields.length === 0) return {
1288
- kind: "unsupported-missing-schema",
1289
- reason: "Content type has no public field metadata."
1290
- };
1291
- const metadata = contentType.previewLinkedEntryEditing;
1292
- if (!metadata) return {
1293
- kind: "unsupported-content-type",
1294
- reason: "Content type has not enabled linked-entry preview editing."
1295
- };
1296
- switch (metadata.kind) {
1297
- case "generic": return { kind: "supported" };
1298
- case "unsupported-domain-backed": return {
1299
- kind: "unsupported-domain-backed",
1300
- reason: metadata.reason
1301
- };
1302
- default: return assertNever(metadata);
1303
- }
1304
- }
1305
- function contentTypeKeyToLabel(key) {
1306
- return (key.endsWith("ies") ? `${key.slice(0, -3)}y` : key.endsWith("s") ? key.slice(0, -1) : key).split(/[-_\s]+/).filter((part) => part.length > 0).map((part, index) => index === 0 ? capitalize(part) : part.toLowerCase()).join(" ");
1307
- }
1308
- function capitalize(value) {
1309
- return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
1310
- }
1311
- function parsePublicContentTypeMeta(value) {
1312
- if (!isRecord$2(value)) return null;
1313
- if (typeof value.key !== "string" || value.key.trim().length === 0) return null;
1314
- return {
1315
- key: value.key,
1316
- titleField: typeof value.titleField === "string" ? value.titleField : null,
1317
- fields: Array.isArray(value.fields) ? value.fields.flatMap(parsePublicContentTypeFieldMeta) : [],
1318
- previewLinkedEntryEditing: parsePublicContentTypeLinkedEntryEditing(value.previewLinkedEntryEditing)
1319
- };
1320
- }
1321
- function parsePublicContentTypeLinkedEntryEditing(value) {
1322
- if (!isRecord$2(value) || typeof value.kind !== "string") return null;
1323
- switch (value.kind) {
1324
- case "generic": return { kind: "generic" };
1325
- case "unsupported-domain-backed": return {
1326
- kind: "unsupported-domain-backed",
1327
- reason: typeof value.reason === "string" ? value.reason : "Domain-backed entries need a dedicated editor workflow."
1328
- };
1329
- default: return null;
1330
- }
1331
- }
1332
- function parsePublicContentTypeFieldMeta(value) {
1333
- if (!isRecord$2(value)) return [];
1334
- if (typeof value.id !== "string" || typeof value.type !== "string") return [];
1335
- return [{
1336
- id: value.id,
1337
- type: value.type,
1338
- mediaKinds: parseStringArray(value.mediaKinds),
1339
- fileKinds: parseStringArray(value.fileKinds)
1340
- }];
1341
- }
1342
- function parseStringArray(value) {
1343
- if (value === null || typeof value === "undefined") return null;
1344
- if (!Array.isArray(value)) return null;
1345
- return value.filter((item) => typeof item === "string");
1346
- }
1347
- function isLinkedContentEntryMeta(value) {
1348
- if (!isRecord$2(value)) return false;
1349
- if (value.kind !== "linked-content-entry") return false;
1350
- if (typeof value.entryId !== "string") return false;
1351
- if (typeof value.contentTypeKey !== "string") return false;
1352
- if (typeof value.contentTypeLabel !== "string") return false;
1353
- if (typeof value.title !== "string") return false;
1354
- if (!(value.optimisticHash === null || typeof value.optimisticHash === "string")) return false;
1355
- if (!isRecord$2(value.contentType)) return false;
1356
- if (!isLinkedEntryFieldSourceArray(value.fieldSources)) return false;
1357
- return isLinkedContentEditSupport(value.support);
1358
- }
1359
- function isLinkedEntryFieldSourceArray(value) {
1360
- return Array.isArray(value) && value.every(isLinkedEntryFieldSource);
1361
- }
1362
- function isLinkedEntryFieldSource(value) {
1363
- if (!isRecord$2(value)) return false;
1364
- if (typeof value.displayPath !== "string") return false;
1365
- switch (value.kind) {
1366
- case "content-field": return typeof value.fieldPath === "string" && (value.fieldType === "text" || value.fieldType === "richText");
1367
- case "read-only": return isLinkedEntryInlineFieldReadOnlyReason(value.reason);
1368
- default: return false;
1369
- }
1370
- }
1371
- function isLinkedEntryInlineFieldReadOnlyReason(value) {
1372
- switch (value) {
1373
- case "missing-entry-meta":
1374
- case "unsupported-content-type":
1375
- case "missing-field-schema":
1376
- case "unsupported-field-type":
1377
- case "unmapped-display-path":
1378
- case "route-field":
1379
- case "derived-field": return true;
1380
- default: return false;
1381
- }
1382
- }
1383
- function isLinkedContentEditSupport(value) {
1384
- if (!isRecord$2(value) || typeof value.kind !== "string") return false;
1385
- switch (value.kind) {
1386
- case "supported": return true;
1387
- case "unsupported-domain-backed":
1388
- case "unsupported-content-type":
1389
- case "unsupported-missing-schema": return typeof value.reason === "string";
1390
- default: return false;
1391
- }
1392
- }
1393
- function isRecord$2(value) {
1394
- return typeof value === "object" && value !== null && !Array.isArray(value);
1395
- }
1396
- //#endregion
1397
- //#region ../blocks/src/sdkBlockTransform.ts
1398
- /**
1399
- * Transforms an SDK custom block into a BlockManifest.
1400
- *
1401
- * If the block has a `layout`, it can be rendered declaratively without React code.
1402
- * If no layout, the block MUST use blockOverrides for rendering.
1403
- */
1404
- function transformSdkBlockToManifest(sdkBlock) {
1405
- const hasLayout = Boolean(sdkBlock.layout) || Boolean(sdkBlock.variants && Object.keys(sdkBlock.variants).length > 0);
1406
- return augmentManifest({
1407
- variantMeaning: { kind: "arrangement" },
1408
- name: sdkBlock.id,
1409
- version: "1.0.0",
1410
- title: sdkBlock.title,
1411
- titleSource: sdkBlock.titleSource,
1412
- description: sdkBlock.description,
1413
- component: sdkBlock.id,
1414
- fields: sdkBlock.fields,
1415
- slots: [],
1416
- category: sdkBlock.category,
1417
- tags: sdkBlock.tags,
1418
- icon: sdkBlock.icon,
1419
- layout: sdkBlock.layout,
1420
- variants: sdkBlock.variants,
1421
- defaultVariant: sdkBlock.defaultVariant,
1422
- variantOptions: sdkBlock.variantOptions,
1423
- promotedFields: sdkBlock.promotedFields,
1424
- lookField: sdkBlock.lookField,
1425
- behaviours: {
1426
- supportsThemeSwitching: true,
1427
- inlineEditing: hasLayout,
1428
- animation: hasLayout,
1429
- paletteHidden: false
1430
- }
1431
- });
1432
- }
1433
- /**
1434
- * Transforms an SDK custom block into a SystemBlockDefinition.
1435
- *
1436
- * This creates a minimal definition with just the manifest - no data loaders
1437
- * or content normalizers since SDK blocks handle their own rendering.
1438
- */
1439
- function transformSdkBlockToDefinition(sdkBlock) {
1440
- return {
1441
- manifest: transformSdkBlockToManifest(sdkBlock),
1442
- dataLoaders: sdkBlock.dataLoaders
1443
- };
1444
- }
1445
- //#endregion
1446
- //#region ../blocks/src/customBlockRegistry.ts
1447
- const defaultCustomBlockSourcePolicy = { kind: "canonical-db-fallback-sdk" };
1448
- function isCustomBlockKind(blockKind) {
1449
- return blockKind.startsWith("custom.");
1450
- }
1451
- function transformToBlockDescriptor(sdkBlock, source = "sdk") {
1452
- return {
1453
- name: sdkBlock.id,
1454
- title: sdkBlock.title,
1455
- description: sdkBlock.description,
1456
- category: sdkBlock.category,
1457
- tags: sdkBlock.tags,
1458
- icon: sdkBlock.icon,
1459
- definition: transformSdkBlockToDefinition(sdkBlock),
1460
- source
1461
- };
1462
- }
1463
- function toResolvedCustomBlock(manifest, source) {
1464
- return {
1465
- blockKind: manifest.id,
1466
- manifest: transformSdkBlockToManifest(manifest),
1467
- source,
1468
- descriptor: transformToBlockDescriptor(manifest, source.kind === "managed-database" ? "database" : "sdk")
1469
- };
1470
- }
1471
- function planCustomBlockRegistryResolution({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy }) {
1472
- switch (policy.kind) {
1473
- case "canonical-db-fallback-sdk": {
1474
- const entriesByKind = /* @__PURE__ */ new Map();
1475
- const conflicts = [];
1476
- for (const customBlock of customBlocks) entriesByKind.set(customBlock.manifest.id, toResolvedCustomBlock(customBlock.manifest, customBlock.source));
1477
- for (const sdkBlock of sdkConfig?.customBlocks ?? []) {
1478
- const existing = entriesByKind.get(sdkBlock.id);
1479
- if (existing) {
1480
- conflicts.push({
1481
- kind: "conflict",
1482
- blockKind: existing.blockKind,
1483
- winner: existing.source,
1484
- loser: { kind: "sdk-config" },
1485
- reason: "db-canonical-sdk-fallback"
1486
- });
1487
- continue;
1488
- }
1489
- entriesByKind.set(sdkBlock.id, toResolvedCustomBlock(sdkBlock, { kind: "sdk-config" }));
1490
- }
1491
- return {
1492
- policy,
1493
- entries: Array.from(entriesByKind.values()),
1494
- conflicts
1495
- };
1496
- }
1497
- }
1498
- }
1499
- function createCustomBlockRegistry({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy, onConflict }) {
1500
- const plan = planCustomBlockRegistryResolution({
1501
- sdkConfig,
1502
- customBlocks,
1503
- policy
1504
- });
1505
- const entriesByKind = new Map(plan.entries.map((entry) => [entry.blockKind, entry]));
1506
- for (const conflict of plan.conflicts) onConflict?.(`Using ${sourceLabel(conflict.winner)} custom block "${conflict.blockKind}" - ${sourceLabel(conflict.loser)} block is fallback only`);
1507
- return {
1508
- entries: plan.entries,
1509
- conflicts: plan.conflicts,
1510
- findManifest: (blockKind) => {
1511
- if (!isCustomBlockKind(blockKind)) return void 0;
1512
- return entriesByKind.get(blockKind);
1513
- }
1514
- };
1515
- }
1516
- function sourceLabel(source) {
1517
- switch (source.kind) {
1518
- case "managed-database": return "DB";
1519
- case "sdk-synced": return "SDK-synced DB";
1520
- case "sdk-config": return "SDK config";
1521
- default: return assertNever(source);
1522
- }
1523
- }
1524
- //#endregion
1525
- //#region ../blocks/src/pageRenderJoins.ts
1526
- /**
1527
- * Re-points joins across omitted blocks. Pure over joins.
1528
- *
1529
- * Joins are keyed by adjacent block-id pairs, so dropping B from [A, B, C]
1530
- * removes the A→C join as well as B's own, because no A→C join was ever
1531
- * resolved. For each surviving pair the original join is kept when the pair
1532
- * was already adjacent. Across a gap, the treatment comes from the join
1533
- * entering the omitted run (A→first omitted), falling back to the one leaving
1534
- * it (last omitted→C). Nothing visual is carried: the survivors are composed
1535
- * from their own content afterwards.
1536
- *
1537
- * `survivors` are compared by identity against `originalBlocks`.
1538
- */
1539
- function retargetJoinsAcrossOmissions(input) {
1540
- const { joins, originalBlocks, survivingBlocks } = input;
1541
- if (joins.length === 0) return joins;
1542
- if (originalBlocks.every((block) => survivingBlocks.has(block))) return joins;
1543
- const byPair = joinsByPair(joins);
1544
- const retargeted = [];
1545
- let previousSurvivor = null;
1546
- let run = [];
1547
- for (const block of originalBlocks) {
1548
- if (!survivingBlocks.has(block)) {
1549
- run.push(block);
1550
- continue;
1551
- }
1552
- if (previousSurvivor?.id && block.id) {
1553
- const join = run.length === 0 ? byPair.get(pairKey(previousSurvivor.id, block.id)) : joinAcrossRun(byPair, previousSurvivor.id, block.id, run);
1554
- if (join) retargeted.push(join);
1555
- }
1556
- previousSurvivor = block;
1557
- run = [];
1558
- }
1559
- return retargeted;
1560
- }
1561
- function joinAcrossRun(byPair, previousBlockId, nextBlockId, run) {
1562
- const firstOmittedId = run[0]?.id;
1563
- const lastOmittedId = run[run.length - 1]?.id;
1564
- const entering = firstOmittedId ? byPair.get(pairKey(previousBlockId, firstOmittedId)) : void 0;
1565
- const exiting = lastOmittedId ? byPair.get(pairKey(lastOmittedId, nextBlockId)) : void 0;
1566
- const donor = entering ?? exiting;
1567
- return donor ? {
1568
- previousBlockId,
1569
- nextBlockId,
1570
- treatment: donor.treatment
1571
- } : void 0;
1572
- }
1573
- /**
1574
- * The single composition site. For every adjacent pair of survivors with ids,
1575
- * finds its join and composes it from both survivors' final content: what
1576
- * each paints with and the frame each draws.
1577
- */
1578
- function composePageJoins(input) {
1579
- const byPair = joinsByPair(input.joins);
1580
- return input.survivors.flatMap((previous, index) => {
1581
- const next = input.survivors[index + 1];
1582
- if (!next || !previous.id || !next.id) return [];
1583
- const join = byPair.get(pairKey(previous.id, next.id));
1584
- return [{
1585
- previousBlockId: previous.id,
1586
- nextBlockId: next.id,
1587
- join: join ? composeJoin(join, previous, next) : null
1588
- }];
1589
- });
1590
- }
1591
- function composeJoin(join, previous, next) {
1592
- return {
1593
- boundaryId: pairKey(join.previousBlockId, join.nextBlockId),
1594
- previousBlockId: join.previousBlockId,
1595
- nextBlockId: join.nextBlockId,
1596
- treatment: join.treatment,
1597
- outcome: composeBoundary(sectionFactsForContent(previous.content), sectionFactsForContent(next.content))
1598
- };
1599
- }
1600
- /** Placement, reserves and paint for a join that draws; null otherwise. */
1601
- function renderedJoinLayout(join) {
1602
- if (!join || join.outcome.kind !== "shown") return null;
1603
- return boundaryLayout(join.treatment, join.outcome.composition);
1604
- }
1605
- /** Joins with a missing id on either side cannot sit between two blocks. */
1606
- function joinsByPair(joins) {
1607
- return new Map(joins.flatMap((join) => join.previousBlockId && join.nextBlockId ? [[pairKey(join.previousBlockId, join.nextBlockId), join]] : []));
1608
- }
1609
- /** Slot lookup key for an adjacent pair, in the one boundary-id scheme. */
1610
- function joinSlotKey(previousBlockId, nextBlockId) {
1611
- return pairKey(previousBlockId, nextBlockId);
1612
- }
1613
- function pairKey(previousBlockId, nextBlockId) {
1614
- return makeBoundaryId(asDesignBlockId(previousBlockId), asDesignBlockId(nextBlockId));
1615
- }
1616
- //#endregion
1617
- //#region ../blocks/src/pageRenderPlan.ts
1618
- /**
1619
- * Decides, once per page render, which blocks can render and what happens to
1620
- * the ones that cannot.
1621
- *
1622
- * Pure. Effects — logging in particular — belong at the call site, because this
1623
- * runs inside a `useMemo` whose recomputation React makes no promises about.
1624
- */
1625
- function buildPageRenderPlan(input) {
1626
- const resolveTarget = createRenderTargetResolver(input);
1627
- const outcomes = input.page.blocks.map((block) => planPageBlock(block, input, resolveTarget));
1628
- const entries = outcomes.flatMap((outcome) => outcome.kind === "admitted" ? [outcome.entry] : []);
1629
- return {
1630
- entries: entries.map(applyArrangementRhythm),
1631
- omitted: outcomes.flatMap((outcome) => outcome.kind === "omitted" ? [outcome.omission] : []),
1632
- runtimeJoins: retargetJoinsAcrossOmissions({
1633
- joins: input.runtimeJoins ?? [],
1634
- originalBlocks: input.page.blocks,
1635
- survivingBlocks: new Set(entries.map((entry) => entry.block))
1636
- })
1637
- };
1638
- }
1639
- /**
1640
- * Mirrors the order of the checks `MemoBlockSection` used to make inline, so no
1641
- * case changes meaning: admission first, then definition/override resolution,
1642
- * then the layout requirement.
1643
- */
1644
- function planBlock(block, renderableContent, resolveTarget, audience, siteStyleId) {
1645
- const common = {
1646
- block,
1647
- renderableContent
1648
- };
1649
- if (block.presentationAdmission.kind === "invalid") return {
1650
- ...common,
1651
- kind: "diagnostic",
1652
- reason: {
1653
- kind: "invalid-admission",
1654
- blockKind: block.kind,
1655
- error: block.presentationAdmission.error
1656
- }
1657
- };
1658
- const { definition, systemDefinition, override } = resolveTarget(block.kind);
1659
- const isCustom = block.kind.startsWith("custom.");
1660
- if (!definition) return override ? {
1661
- ...common,
1662
- kind: "override-only",
1663
- override
1664
- } : {
1665
- ...common,
1666
- kind: "diagnostic",
1667
- reason: {
1668
- kind: "missing-definition",
1669
- blockKind: block.kind,
1670
- isCustom
1671
- }
1672
- };
1673
- const manifestHasLayout = Boolean(definition.manifest.layout) || Object.keys(definition.manifest.variants ?? {}).length > 0;
1674
- if (!override && !manifestHasLayout) return {
1675
- ...common,
1676
- kind: "diagnostic",
1677
- reason: {
1678
- kind: "missing-layout",
1679
- blockKind: block.kind,
1680
- isCustom
1681
- }
1682
- };
1683
- return renderableBlockPlan(common, {
1684
- definition,
1685
- systemDefinition,
1686
- override
1687
- }, audience, siteStyleId);
1688
- }
1689
- function renderableBlockPlan(common, target, audience, siteStyleId) {
1690
- const { definition, systemDefinition, override } = target;
1691
- const renderableContent = planArrangementContent(common.block.kind, definition.manifest, common.renderableContent, audience);
1692
- const effectiveArrangementKey = resolveEffectiveArrangement({
1693
- manifest: arrangementManifestFromVariants(definition.manifest),
1694
- ...definition.manifest.variantMeaning.kind !== "mode" ? { look: effectiveLookFromContent(renderableContent)?.look } : {},
1695
- storedVariant: parseStoredVariant(definition.manifest, renderableContent),
1696
- policy: siteStyleId === null ? void 0 : deriveSiteStyleBlockPolicy({
1697
- siteStyleId: asSiteStyleId(siteStyleId),
1698
- blockKind: common.block.kind
1699
- })
1700
- }).key;
1701
- return {
1702
- ...common,
1703
- renderableContent,
1704
- kind: "renderable",
1705
- definition,
1706
- override,
1707
- effectiveArrangementKey,
1708
- effectiveListArrangementKey: definition.manifest.variantMeaning.kind === "mode" && renderableContent._lookMonthArrangement === void 0 ? resolveModeArrangement({
1709
- declaration: definition.manifest.variantMeaning,
1710
- content: renderableContent,
1711
- look: effectiveLookFromContent(renderableContent)?.look,
1712
- mode: readStoredMode({
1713
- ...arrangementManifestFromVariants(definition.manifest),
1714
- variantMeaning: definition.manifest.variantMeaning
1715
- }, renderableContent)
1716
- }).key : null,
1717
- variantKey: systemDefinition ? effectiveArrangementKey : null,
1718
- managesOwnWrapper: Boolean(systemDefinition?.manifest.behaviours?.managesOwnWrapper)
1719
- };
1720
- }
1721
- /**
1722
- * Resolves definition + override once per block kind, and builds the
1723
- * custom-block registry at most once per plan rather than once per custom
1724
- * block, which is what the previous inline path did.
1725
- */
1726
- function createRenderTargetResolver(input) {
1727
- const cache = /* @__PURE__ */ new Map();
1728
- let customRegistry = null;
1729
- const customRegistryOnce = () => {
1730
- customRegistry ?? (customRegistry = createCustomBlockRegistry({
1731
- sdkConfig: input.sdkConfig,
1732
- customBlocks: (input.customBlocks ?? []).map((manifest) => ({
1733
- manifest,
1734
- source: { kind: "managed-database" }
1735
- }))
1736
- }));
1737
- return customRegistry;
1738
- };
1739
- return (blockKind) => {
1740
- const cached = cache.get(blockKind);
1741
- if (cached) return cached;
1742
- const systemDefinition = getBlockDefinition(blockKind);
1743
- const resolved = {
1744
- definition: systemDefinition ?? (blockKind.startsWith("custom.") ? customRegistryOnce().findManifest(blockKind)?.descriptor.definition : void 0),
1745
- systemDefinition,
1746
- override: getBlockOverride(blockKind, input.blockOverrides)
1747
- };
1748
- cache.set(blockKind, resolved);
1749
- return resolved;
1750
- };
1751
- }
1752
- /**
1753
- * Look up a block override component by block kind.
1754
- * Supports both full ("block.hero") and short ("hero") keys.
1755
- */
1756
- function getBlockOverride(blockKind, overrides) {
1757
- if (!overrides) return void 0;
1758
- if (overrides[blockKind]) return overrides[blockKind];
1759
- return overrides[blockKind.replace(/^block\./, "")];
1760
- }
1761
- /**
1762
- * Resolves block content based on stage priority.
1763
- * For draft/preview: draftContent takes priority over content.
1764
- * For published: content is the source of truth.
1765
- */
1766
- /**
1767
- * The content a block renders with. Every render path (public, preview,
1768
- * templates, SDK) chooses content here, so this is also where a stale
1769
- * `site-style-transition-*` styleGroup is dropped; authored values survive.
1770
- */
1771
- function getRenderableContent(block, previewStage = "published") {
1772
- return selectBlockContent(block, previewStage);
1773
- }
1774
- function arrangementRuntime(content) {
1775
- const value = parseSurfaceTree(content._arrangementLooks);
1776
- return isObjectRecord(value) && isObjectRecord(value.byMode) && Array.isArray(value.available) && Array.isArray(value.rhythm) ? restoreArrangementRuntime(value) : null;
1777
- }
1778
- /**
1779
- * JSON transports carry resolver inputs; rebuild every surface at this boundary.
1780
- * A payload cached before compiled looks carried `slotRoles` gets the Look's own.
1781
- */
1782
- function restoreCompiledLook(look) {
1783
- const transported = look;
1784
- return {
1785
- ...look,
1786
- slotRoles: transported.slotRoles ?? look.look.structure.slotRoles ?? {},
1787
- itemSurfaces: Object.fromEntries(Object.entries(look.itemSurfaces).map(([slot, surface]) => [slot, parseResolvedSurface(surface)])),
1788
- ...look.roleSurfaces ? { roleSurfaces: {
1789
- card: parseResolvedSurface(look.roleSurfaces.card),
1790
- statement: parseResolvedSurface(look.roleSurfaces.statement),
1791
- highlight: parseResolvedSurface(look.roleSurfaces.highlight)
1792
- } } : {}
1793
- };
1794
- }
1795
- function restoreArrangementRuntime(runtime) {
1796
- return {
1797
- ...runtime,
1798
- available: runtime.available.map(restoreCompiledLook),
1799
- byMode: Object.fromEntries(Object.entries(runtime.byMode).map(([mode, look]) => [mode, restoreCompiledLook(look)]))
1800
- };
1801
- }
1802
- function effectiveLookFromContent(content) {
1803
- const value = content._effectiveLook;
1804
- return isObjectRecord(value) && isObjectRecord(value.look) ? restoreCompiledLook(value) : null;
1805
- }
1806
- function planArrangementContent(blockKind, manifest, content, audience) {
1807
- const runtime = arrangementRuntime(content);
1808
- if (!runtime) return content;
1809
- const mode = readStoredMode({
1810
- ...arrangementManifestFromVariants(manifest),
1811
- variantMeaning: manifest.variantMeaning
1812
- }, content);
1813
- const selected = runtime.byMode[mode ?? "default"];
1814
- if (!selected) return content;
1815
- const { facts } = arrangementContentFacts(content);
1816
- const published = resolvePublishedLook({
1817
- look: selected.look,
1818
- contentFacts: facts,
1819
- audience,
1820
- catalogue: runtime.available.map((entry) => entry.look)
1821
- });
1822
- const effective = runtime.available.find((entry) => entry.look.id === published.id) ?? selected;
1823
- const { length, knobs } = resolveArrangementKnobs({
1824
- blockKind,
1825
- look: effective,
1826
- content
1827
- });
1828
- const values = Object.fromEntries(Object.entries(knobs).flatMap(([key, knob]) => knob.kind === "kept" ? [] : [[key, knob.value]]));
1829
- const effectiveContent = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, effectiveContentKnobValue(blockKind, key, value)]));
1830
- const activeContent = Object.fromEntries(Object.entries(content).filter(([key]) => knobs[key]?.kind !== "kept"));
1831
- const photoContent = arrangementPhotoContent(activeContent, effectiveContent);
1832
- const visiblePhotos = arrangementContentFacts({
1833
- ...activeContent,
1834
- ...effectiveContent,
1835
- ...photoContent
1836
- });
1837
- return {
1838
- ...activeContent,
1839
- ...arrangementPhotoTreatmentContent(activeContent, effective.look),
1840
- ...mode !== null ? { variant: mode } : {},
1841
- ...effectiveContent,
1842
- ...photoContent,
1843
- ...arrangementShapeContent(effective.look.id, {
1844
- ...activeContent,
1845
- ...effectiveContent
1846
- }),
1847
- ...arrangementPanelContent(activeContent, effective, mode),
1848
- ...arrangementQuoteContent(blockKind, effective, values),
1849
- _arrangementLooks: runtime,
1850
- _effectiveLook: effective,
1851
- _lookHooks: arrangementContentHooks(effective, mode, length, {
1852
- ...facts,
1853
- photo: visiblePhotos.facts.photo
1854
- }, values, visiblePhotos.photoCount),
1855
- _effectiveKnobs: knobs,
1856
- _lookAudience: audience,
1857
- _lookSlots: arrangementContentSlots(blockKind),
1858
- blockLook: effective.look.id
1859
- };
1860
- }
1861
- /** Typed Look composition owns contrast treatment; parsing preserves authored paint. */
1862
- function arrangementPhotoTreatmentContent(content, look) {
1863
- if (!look.structure.photoTreatment) return {};
1864
- const authored = parseCanonicalRuntimeBackground(content);
1865
- if (authored.kind === "none") return {};
1866
- return { _sectionStyles: {
1867
- ...isObjectRecord(content._sectionStyles) ? content._sectionStyles : {},
1868
- background: applyLookPhotoTreatment(authored.background, look.structure.photoTreatment)
1869
- } };
1870
- }
1871
- /** Widget section hooks use the theme; hero background geometry never travels to list islands. */
1872
- function arrangementContentSlots(blockKind) {
1873
- return Object.fromEntries(arrangementSlotNames.filter((slot) => (!slot.startsWith("price-") || blockKind === "block.shop") && slot !== "schedule-section" && slot !== "shop-section" && (slot !== "background" || blockKind === "block.hero")).map((slot) => [slot, slot]));
1874
- }
1875
- /** C photo Looks render shape-specific crops without rewriting authored preferences. */
1876
- function arrangementShapeContent(lookId, content) {
1877
- if (lookId !== "intro-photo-beside-text" && lookId !== "media-text-photo-beside-text") return {};
1878
- return content.imageShape === "circle" ? { aspectRatio: "1/1" } : content.imageShape === "arch" ? { aspectRatio: "4/5" } : {};
1879
- }
1880
- function arrangementQuoteContent(blockKind, effective, values) {
1881
- if (blockKind !== "block.testimonials") return {};
1882
- const single = effective.look.structure.byMode.default === "single";
1883
- return {
1884
- _quoteCount: single ? 1 : values.quoteCount === "all" ? null : Number(values.quoteCount),
1885
- _quoteLoaderLimit: values.quoteCount === "all" && !single ? "all" : "50"
1886
- };
1887
- }
1888
- function arrangementPanelContent(content, effective, mode) {
1889
- if (mode === "calendar") return {
1890
- _lookMonthArrangement: effective.look.structure.byMode.calendar,
1891
- defaultCalendarView: "month"
1892
- };
1893
- const arrangement = effective.look.structure.byMode[mode ?? "default"];
1894
- if (arrangement === "event-header") return { heading: void 0 };
1895
- if (arrangement !== "compact" && arrangement !== "details-panel") return {};
1896
- return {
1897
- heading: void 0,
1898
- _lookPanelHeading: content.heading
1899
- };
1900
- }
1901
- function arrangementPhotoContent(content, knobs) {
1902
- if (knobs.showPhotos !== false || !Array.isArray(content.cards)) return {};
1903
- return { cards: content.cards.map((card) => {
1904
- if (!isObjectRecord(card)) return card;
1905
- const { media: _hiddenMedia, ...copy } = card;
1906
- return copy;
1907
- }) };
1908
- }
1909
- function arrangementContentFacts(content) {
1910
- const photoCount = arrangementPhotoCount(content);
1911
- const featured = typeof content.featured === "string" ? content.featured.trim().length > 0 : content.featured !== void 0 && content.featured !== null;
1912
- return {
1913
- photoCount,
1914
- facts: {
1915
- photo: photoCount > 0,
1916
- facts: Array.isArray(content.facts) && content.facts.length > 0,
1917
- featured,
1918
- outcome: typeof content.outcome === "string" && content.outcome.length > 0,
1919
- figure: typeof content.figure === "string" && content.figure.trim().length > 0,
1920
- entrance: isObjectRecord(content.entrancePhoto)
1921
- }
1922
- };
1923
- }
1924
- /** The content stage owns media presence for every arrangement consumer. */
1925
- function arrangementPhotoCount(content) {
1926
- if (Array.isArray(content.cards)) return content.cards.filter((card) => isObjectRecord(card) && isObjectRecord(card.media)).length;
1927
- if (Array.isArray(content.members)) return content.members.filter((member) => isObjectRecord(member) && isObjectRecord(member.photo)).length;
1928
- if (Array.isArray(content.images)) return content.images.filter((item) => isObjectRecord(item) && isObjectRecord(item.image)).length;
1929
- if (isObjectRecord(content.media) || isObjectRecord(content.entrancePhoto)) return 1;
1930
- const section = isObjectRecord(content._sectionStyles) ? content._sectionStyles : {};
1931
- return isObjectRecord((isObjectRecord(section.background) ? section.background : {}).image) ? 1 : 0;
1932
- }
1933
- function effectiveContentKnobValue(blockKind, key, value) {
1934
- const facet = systemCustomizeFacetDefinitionsForBlock(blockKind).find((entry) => entry.target.kind === "content-field" && entry.target.field === key);
1935
- return facet?.target.kind === "content-field" && facet.target.boolean ? value === "true" : value;
1936
- }
1937
- function arrangementContentHooks(effective, mode, length, facts, values, photoCount) {
1938
- return {
1939
- "data-look": effective.look.id,
1940
- "data-treat": effective.treatment,
1941
- "data-arrangement": effective.look.structure.byMode[mode ?? "default"],
1942
- ...mode !== null ? { "data-mode": mode } : {},
1943
- ...length !== null ? { "data-length": length } : {},
1944
- ...Object.fromEntries(Object.entries(facts).map(([key, value]) => [`data-has-${key}`, String(value)])),
1945
- "data-photo-count": String(photoCount),
1946
- ...Object.fromEntries(Object.entries(values).map(([key, value]) => [`data-knob-${key === "titleSize" ? "headline" : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`, value]))
1947
- };
1948
- }
1949
- function applyArrangementRhythm(entry, position) {
1950
- const runtime = arrangementRuntime(entry.renderableContent);
1951
- const look = effectiveLookFromContent(entry.renderableContent);
1952
- if (!runtime || !look) return entry;
1953
- const rhythm = runtime.rhythm.length === 0 ? null : runtime.rhythm[position % runtime.rhythm.length];
1954
- const content = entry.renderableContent;
1955
- const resolved = resolveSectionBackground(parseCanonicalRuntimeBackground(content), null, rhythm, heroPhotoGround(entry));
1956
- const updated = applyResolvedArrangementBackground(content, resolved);
1957
- const surface = arrangementGroundToken(resolved);
1958
- const grounded = resolveArrangementRoleSurfaces(look, runtime, resolved);
1959
- const tinted = resolveArrangementTints(updated, grounded, runtime, surface) ?? grounded;
1960
- return {
1961
- ...entry,
1962
- styleBackground: arrangementGroundToken(resolveSectionBackground({ kind: "none" }, null, rhythm)),
1963
- renderableContent: {
1964
- ...updated,
1965
- _effectiveLook: tinted,
1966
- _lookHooks: {
1967
- ...isObjectRecord(updated._lookHooks) ? updated._lookHooks : {},
1968
- "data-surface": surface
1969
- }
1970
- }
1971
- };
1972
- }
1973
- function arrangementGroundToken(resolved) {
1974
- if (resolved.kind === "base") return "background";
1975
- switch (resolved.background.type) {
1976
- case "image":
1977
- case "video": return "media";
1978
- case "color": return resolved.background.color ?? "background";
1979
- case "gradient": return "gradient";
1980
- }
1981
- }
1982
- function applyResolvedArrangementBackground(content, resolved) {
1983
- const section = isObjectRecord(content._sectionStyles) ? content._sectionStyles : {};
1984
- const photo = isObjectRecord(section.background) ? section.background.image : void 0;
1985
- const ground = resolved.kind === "base" ? void 0 : resolved.background;
1986
- const background = photo !== void 0 ? {
1987
- ...ground ?? {
1988
- type: "color",
1989
- color: "background"
1990
- },
1991
- image: photo
1992
- } : ground;
1993
- return {
1994
- ...content,
1995
- _sectionStyles: {
1996
- ...section,
1997
- background
1998
- }
1999
- };
2000
- }
2001
- function planPageBlock(block, input, resolveTarget) {
2002
- const outcome = planBlock(block, getRenderableContent(block, input.previewStage), resolveTarget, input.audience, input.siteStyleId ?? null);
2003
- if (outcome.kind !== "diagnostic") return {
2004
- kind: "admitted",
2005
- entry: outcome
2006
- };
2007
- const resolved = resolveTarget(block.kind);
2008
- const debug = blockDiagnosticContext(resolved, input);
2009
- return input.audience === "public" ? {
2010
- kind: "omitted",
2011
- omission: {
2012
- blockId: block.id ?? null,
2013
- blockKind: block.kind,
2014
- reason: outcome.reason,
2015
- override: resolved.override,
2016
- debug
2017
- }
2018
- } : {
2019
- kind: "admitted",
2020
- entry: {
2021
- ...outcome,
2022
- debug
2023
- }
2024
- };
2025
- }
2026
- function blockDiagnosticContext(resolved, input) {
2027
- return {
2028
- hasOverride: Boolean(resolved.override),
2029
- sdkCustomBlocksCount: input.sdkConfig?.customBlocks?.length ?? 0,
2030
- dbCustomBlocksCount: input.customBlocks?.length ?? 0,
2031
- manifestKeys: resolved.definition ? Object.keys(resolved.definition.manifest).sort() : null
2032
- };
2033
- }
2034
- function resolveArrangementTints(content, look, runtime, ground) {
2035
- if (!look.surfaceTints) return null;
2036
- const context = runtime.surfaceContext;
2037
- const surfaces = arrangementSlotNames.flatMap((slot) => {
2038
- const tint = look.surfaceTints?.[slot];
2039
- if (!tint || tint.knob && content[tint.knob] !== true) return [];
2040
- const owned = look.itemSurfaces[slot];
2041
- return [[slot, resolveSurface({
2042
- kind: "tint",
2043
- base: owned?.kind === "owned" && owned.paint.kind === "solid" ? owned.paint.token : ground,
2044
- source: tint.source,
2045
- opacity: tint.opacity,
2046
- gradient: tint.gradient
2047
- }, context)]];
2048
- });
2049
- return {
2050
- ...look,
2051
- itemSurfaces: {
2052
- ...look.itemSurfaces,
2053
- ...Object.fromEntries(surfaces)
2054
- }
2055
- };
2056
- }
2057
- function resolveArrangementRoleSurfaces(look, runtime, background) {
2058
- const ground = deriveSectionGround(background, runtime.surfaceContext.palette);
2059
- const style = {
2060
- roleMap: look.roleMap,
2061
- surfaces: runtime.surfaces,
2062
- context: runtime.surfaceContext
2063
- };
2064
- const roleSurfaces = {
2065
- card: resolveItemSurface("card", ground, style),
2066
- statement: resolveItemSurface("statement", ground, style),
2067
- highlight: resolveItemSurface("highlight", ground, style)
2068
- };
2069
- return {
2070
- ...look,
2071
- ground,
2072
- roleSurfaces,
2073
- itemSurfaces: resolveLookSlotSurfaces(look, look.itemRoles, roleSurfaces)
2074
- };
2075
- }
2076
- /** The arrangement key is resolved once by planBlock, including pinned Looks. */
2077
- function heroPhotoGround(entry) {
2078
- return entry.kind === "renderable" && entry.block.kind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(entry.effectiveArrangementKey ?? void 0) } : void 0;
2079
- }
2080
- //#endregion
2081
- //#region ../blocks/src/system/data/utils.ts
2082
- /**
2083
- * Normalize data loaders from block definition
2084
- */
2085
- function normalizeDataLoaders(def) {
2086
- if (!def?.dataLoaders) return [];
2087
- return Object.entries(def.dataLoaders).map(([key, loader]) => ({
2088
- key,
2089
- loader
2090
- }));
2091
- }
2092
- /**
2093
- * Normalize params for API calls.
2094
- * Converts supplied values to strings, preserving absent versus explicitly empty params.
2095
- */
2096
- function normalizeParams(input) {
2097
- if (!input || typeof input !== "object") return {};
2098
- const output = {};
2099
- for (const [key, value] of Object.entries(input)) if (value !== void 0 && value !== null) output[key] = coerceToString(value);
2100
- return output;
2101
- }
2102
- function isNonArrayObject(value) {
2103
- return typeof value === "object" && value !== null && !Array.isArray(value);
2104
- }
2105
- function safeJsonStringify(value) {
2106
- try {
2107
- return JSON.stringify(value);
2108
- } catch {
2109
- return;
2110
- }
2111
- }
2112
- /**
2113
- * Coerce value to string for API params
2114
- */
2115
- function coerceToString(value) {
2116
- if (value === null || value === void 0) return "";
2117
- if (Array.isArray(value)) {
2118
- if (value.some(isNonArrayObject)) {
2119
- const json = safeJsonStringify(value);
2120
- if (typeof json === "string") return json;
2121
- }
2122
- return value.map(coerceToString).join(",");
2123
- }
2124
- if (isNonArrayObject(value)) {
2125
- const json = safeJsonStringify(value);
2126
- if (typeof json === "string") return json;
2127
- }
2128
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
2129
- return "";
2130
- }
2131
- /**
2132
- * The appointment-services catalogue (issue 1403) pairs the services with the
2133
- * site's ordered categories. Both are needed to group them, so that response
2134
- * is passed through whole; any other `{ services }` wrapper is unwrapped.
2135
- */
2136
- function coerceServicesPayload(record) {
2137
- return Array.isArray(record.services) && Array.isArray(record.categories) ? {
2138
- services: record.services,
2139
- categories: record.categories
2140
- } : record.services;
2141
- }
2142
- /**
2143
- * Extract data from API response.
2144
- * Unwraps common response wrappers: { data }, { form }, { entries }, { services }, { teamMembers }
2145
- *
2146
- * Note: We check that properties are NOT functions to avoid returning
2147
- * built-in methods like Array.prototype.entries
2148
- */
2149
- function coercePayload(payload) {
2150
- const linkedContentEntries = coerceLinkedContentEntriesPayload(payload);
2151
- if (linkedContentEntries !== payload) return linkedContentEntries;
2152
- if (payload && typeof payload === "object" && !Array.isArray(payload)) {
2153
- const record = payload;
2154
- if ("data" in record && typeof record.data !== "function") return record.data;
2155
- if ("form" in record && typeof record.form !== "function") return record.form;
2156
- if ("entries" in record && typeof record.entries !== "function") return record.entries;
2157
- if ("services" in record && typeof record.services !== "function") return coerceServicesPayload(record);
2158
- if ("teamMembers" in record && typeof record.teamMembers !== "function") return record.teamMembers;
2159
- }
2160
- return payload;
2161
- }
2162
- //#endregion
2163
- //#region ../blocks/src/system/data/fetchLoaderData.ts
2164
- const ALL_PAGE_SIZE = 50;
2165
- /** The shared loader owns All pagination and rejects adapters that repeat a page. */
2166
- async function fetchLoaderData(apiClient, endpoint, params) {
2167
- if (params.limit === "all") return fetchAllPages(apiClient, endpoint, params, 0, /* @__PURE__ */ new Set());
2168
- return coercePayload(await apiClient({
2169
- endpoint,
2170
- params
2171
- }));
2172
- }
2173
- function planLoaderPage(data, offset, seenPages) {
2174
- if (!isUnknownArray(data)) return {
2175
- kind: "invalid",
2176
- message: "Expected paged loader entries"
2177
- };
2178
- if (data.length < ALL_PAGE_SIZE) return {
2179
- kind: "complete",
2180
- entries: data
2181
- };
2182
- const ids = data.map((entry) => isObjectRecord(entry) && typeof entry.id === "string" ? entry.id : null);
2183
- const key = JSON.stringify(ids.every((id) => id !== null) ? [...ids].sort() : data);
2184
- if (seenPages.has(key)) return {
2185
- kind: "invalid",
2186
- message: "Paged loader made no progress"
2187
- };
2188
- return {
2189
- kind: "continue",
2190
- entries: data,
2191
- offset: offset + data.length,
2192
- seenPages: /* @__PURE__ */ new Set([...seenPages, key])
2193
- };
2194
- }
2195
- async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
2196
- const page = planLoaderPage(coercePayload(await apiClient({
2197
- endpoint,
2198
- params: {
2199
- ...params,
2200
- limit: String(ALL_PAGE_SIZE),
2201
- offset: String(offset)
2202
- }
2203
- })), offset, seenPages);
2204
- switch (page.kind) {
2205
- case "invalid": throw new Error(page.message);
2206
- case "complete": return page.entries;
2207
- case "continue": return [...page.entries, ...await fetchAllPages(apiClient, endpoint, params, page.offset, page.seenPages)];
2208
- default: return assertNever(page);
2209
- }
2210
- }
2211
- function isUnknownArray(value) {
2212
- return Array.isArray(value);
2213
- }
2214
- //#endregion
2215
- //#region ../blocks/src/system/runtime/bindings.ts
2216
- const shouldLogWarnings = isNonProductionEnv();
2217
- function isPlainObject(value) {
2218
- return typeof value === "object" && value !== null && !Array.isArray(value);
2219
- }
2220
- function isRouteMapEntry(value) {
2221
- if (typeof value === "string") return true;
2222
- return isPlainObject(value);
2223
- }
2224
- function isRouteMap(value) {
2225
- if (!isPlainObject(value)) return false;
2226
- return Object.values(value).every(isRouteMapEntry);
2227
- }
2228
- function isPageIdentifierMap(value) {
2229
- if (!isPlainObject(value)) return false;
2230
- return Object.values(value).every((v) => typeof v === "string");
2231
- }
2232
- function isEntryIdentifierMap(value) {
2233
- if (!isPlainObject(value)) return false;
2234
- for (const v of Object.values(value)) {
2235
- if (!isPlainObject(v)) return false;
2236
- if (!Object.values(v).every((inner) => typeof inner === "string")) return false;
2237
- }
2238
- return true;
2239
- }
2240
- function buildTransformContext(vm, dateContext, now) {
2241
- const root = vm.$root;
2242
- const stage = root && isPlainObject(root) && root.previewStage === "preview" ? "preview" : "published";
2243
- const routes = root && isPlainObject(root) && isRouteMap(root.routes) ? root.routes : void 0;
2244
- const pagesByIdentifier = root && isPlainObject(root) && isPageIdentifierMap(root.pagesByIdentifier) ? root.pagesByIdentifier : void 0;
2245
- const entriesByIdentifier = root && isPlainObject(root) && isEntryIdentifierMap(root.entriesByIdentifier) ? root.entriesByIdentifier : void 0;
2246
- return {
2247
- theme: defaultThemeTokens,
2248
- dateContext,
2249
- now,
2250
- stage,
2251
- data: vm.content,
2252
- routes,
2253
- pagesByIdentifier,
2254
- entriesByIdentifier
2255
- };
2256
- }
2257
- function resolveParamsBindings(input, vm, meta, dateContext = resolveDateRuntimeContext(typeof vm.$root?.bookingTimeZone === "string" ? vm.$root.bookingTimeZone : void 0), now = readRuntimeNow(vm.$root?.now)) {
2258
- return resolveLoaderParam(input, {
2259
- vm,
2260
- meta,
2261
- transforms: buildTransformContext(vm, dateContext, now)
2262
- });
2263
- }
2264
- function resolveLoaderParam(input, runtime) {
2265
- if (input === null || typeof input !== "object") return input;
2266
- if (Array.isArray(input)) return input.map((value) => resolveLoaderParam(value, runtime));
2267
- const inputRecord = input;
2268
- const binding = inputRecord.$bind;
2269
- if (binding && typeof binding === "object") return resolveBoundLoaderParam(binding, runtime);
2270
- return Object.fromEntries(Object.entries(inputRecord).map(([key, value]) => [key, resolveLoaderParam(value, runtime)]));
2271
- }
2272
- function resolveBoundLoaderParam(input, runtime) {
2273
- try {
2274
- const binding = bindingSchema.parse(input);
2275
- const value = resolveBinding(binding.from, runtime.vm);
2276
- const resolved = value === void 0 || value === null ? binding.fallback : runTransforms(value, binding.transforms, runtime.transforms, defaultTransforms);
2277
- return resolved === void 0 || resolved === null || resolved === "" ? binding.fallback : resolved;
2278
- } catch (err) {
2279
- if (shouldLogWarnings) console.warn(`bindings: failed to parse loader param binding for block "${runtime.meta?.blockKind ?? "unknown"}"`, err);
2280
- return;
2281
- }
2282
- }
2283
- function resolveBinding(path, vm) {
2284
- const segments = splitPath(path);
2285
- if (!segments.length) return void 0;
2286
- const [first, ...rest] = segments;
2287
- let source = vm;
2288
- if (first === "$root") {
2289
- source = vm;
2290
- return readFromSource(source, [first, ...rest]);
2291
- }
2292
- if (first === "content") {
2293
- source = vm.content;
2294
- return readFromSource(source, rest);
2295
- }
2296
- const contentResult = readFromSource(vm.content, segments);
2297
- if (contentResult !== void 0) return contentResult;
2298
- return readFromSource(vm, segments);
2299
- }
2300
- function splitPath(path) {
2301
- const PATH_SEPARATOR_REGEX = /\./g;
2302
- const BRACKET_ACCESS_REGEX = /\[(?<token>[^\]]+)\]/g;
2303
- const segments = [];
2304
- const parts = path.split(PATH_SEPARATOR_REGEX);
2305
- for (const raw of parts) {
2306
- if (!raw) continue;
2307
- const baseMatch = raw.match(/^([^\[]+)/);
2308
- if (baseMatch && baseMatch[1]) segments.push(baseMatch[1]);
2309
- const bracketMatches = raw.matchAll(BRACKET_ACCESS_REGEX);
2310
- for (const match of bracketMatches) {
2311
- const token = match.groups?.token ?? "";
2312
- if (token.startsWith("\"") || token.startsWith("'")) segments.push(token.slice(1, -1));
2313
- else if (/^\d+$/.test(token)) segments.push(Number(token));
2314
- else segments.push(token);
2315
- }
2316
- if (!baseMatch && !raw.includes("[")) segments.push(raw);
2317
- }
2318
- return segments;
2319
- }
2320
- function readFromSource(source, segments) {
2321
- return segments.reduce((current, segment) => {
2322
- if (current === void 0 || current === null) return void 0;
2323
- if (typeof segment === "number") {
2324
- if (Array.isArray(current)) return current[segment];
2325
- return;
2326
- }
2327
- if (typeof current === "object" && current !== null && segment in current) return current[segment];
2328
- }, source);
2329
- }
2330
- function isNonProductionEnv() {
2331
- if (typeof globalThis === "undefined") return true;
2332
- return globalThis.process?.env?.NODE_ENV !== "production";
2333
- }
2334
- //#endregion
2335
- //#region ../blocks/src/system/data/prefetchBlockData.ts
2336
- /**
2337
- * Core block data prefetching logic (framework-agnostic).
2338
- *
2339
- * This module provides the shared implementation for prefetching block data loaders.
2340
- * It works with any API client by accepting it as a parameter (dependency injection).
2341
- *
2342
- * Usage:
2343
- * - Frontend: provide internal API client
2344
- * - SDK: provide SDK client with endpoint mapping
2345
- */
2346
- function projectDataLoaders(loaders, shouldLoad, blockId, blockKind) {
2347
- if (!shouldLoad) return [...loaders];
2348
- return loaders.filter(({ key }) => shouldLoad({
2349
- blockId,
2350
- blockKind,
2351
- loaderKey: key
2352
- }));
2353
- }
2354
- function shouldSkipResolvedLoader(input) {
2355
- if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
2356
- return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
2357
- }
2358
- async function prefetchBlockDataWithFailures$1(page, context, options) {
2359
- const runtime = admitLoaderDateRuntime(context);
2360
- const blocks = page.blocks.flatMap((block) => block.id ? [planBlockRequests(block, block.id, context, options, runtime)] : []);
2361
- return {
2362
- ...projectLoaderOutcomes(blocks, await Promise.all(blocks.flatMap((block) => block.requests.map((request) => executeLoaderRequest(request, options))))),
2363
- loaderSnapshot: {
2364
- stage: context.previewStage === "preview" ? "draft" : "published",
2365
- blocks: Object.fromEntries(blocks.map((block) => [block.id, {
2366
- kind: block.kind,
2367
- content: block.content,
2368
- requests: Object.fromEntries(block.requests.map(({ key, endpoint, params }) => [key, {
2369
- endpoint,
2370
- params
2371
- }]))
2372
- }]))
2373
- }
2374
- };
2375
- }
2376
- function planBlockRequests(block, id, context, options, runtime) {
2377
- const definition = (options.getBlockDefinition ?? getBlockDefinition)(block.kind);
2378
- const loaders = definition ? normalizeDataLoaders(definition) : customLoaders(block.kind, options);
2379
- const vm = {
2380
- content: plannedLoaderContent(block, definition, context),
2381
- $root: {
2382
- ...context.root,
2383
- siteId: context.siteId,
2384
- pageId: context.pageId,
2385
- previewStage: context.previewStage
2386
- }
2387
- };
2388
- const requests = projectDataLoaders(loaders, options.shouldLoad, id, block.kind).flatMap((entry) => {
2389
- const request = planLoaderRequest(entry, block, id, vm, options, runtime);
2390
- return request ? [request] : [];
2391
- });
2392
- return {
2393
- id,
2394
- kind: block.kind,
2395
- content: selectBlockContent(block, context.previewStage),
2396
- requests
2397
- };
2398
- }
2399
- function customLoaders(kind, options) {
2400
- return Object.entries(options.getCustomBlockLoaders?.(kind) ?? {}).map(([key, loader]) => ({
2401
- key,
2402
- loader
2403
- }));
2404
- }
2405
- function planLoaderRequest({ key, loader }, block, blockId, vm, options, runtime) {
2406
- if (loader.mode === "client") return null;
2407
- const resolve = options.resolveParamsBindings ?? resolveParamsBindings;
2408
- const coordinates = { blockKind: block.kind };
2409
- if (loader.when !== void 0 && resolve(loader.when, vm, coordinates, runtime.dateContext, runtime.now) !== true) return null;
2410
- const params = normalizeParams(resolve(loader.params, vm, coordinates, runtime.dateContext, runtime.now));
2411
- if (shouldSkipResolvedLoader({
2412
- loader,
2413
- endpoint: loader.endpoint,
2414
- params,
2415
- isValidEndpoint: options.isValidEndpoint
2416
- })) return null;
2417
- return {
2418
- blockId,
2419
- blockKind: block.kind,
2420
- key,
2421
- endpoint: loader.endpoint,
2422
- params
2423
- };
2424
- }
2425
- async function executeLoaderRequest(request, options) {
2426
- try {
2427
- return {
2428
- kind: "loaded",
2429
- request,
2430
- data: await fetchLoaderData(options.apiClient, request.endpoint, request.params)
2431
- };
2432
- } catch (error) {
2433
- options.onError?.(error, {
2434
- block: request.blockKind,
2435
- loader: request.key
2436
- });
2437
- return {
2438
- kind: "failed",
2439
- request
2440
- };
2441
- }
2442
- }
2443
- function projectLoaderOutcomes(blocks, outcomes) {
2444
- return {
2445
- resolvedData: Object.fromEntries(blocks.flatMap((block) => {
2446
- const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "loaded" ? [[outcome.request.key, outcome.data]] : []);
2447
- return values.length ? [[block.id, Object.fromEntries(values)]] : [];
2448
- })),
2449
- loaderFailures: Object.fromEntries(blocks.flatMap((block) => {
2450
- const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "failed" ? [[outcome.request.key, {
2451
- endpoint: outcome.request.endpoint,
2452
- params: outcome.request.params
2453
- }]] : []);
2454
- return values.length ? [[block.id, Object.fromEntries(values)]] : [];
2455
- }))
2456
- };
2457
- }
2458
- /** Prefetch executes the render-plan content stage before resolving loader bindings. */
2459
- function plannedLoaderContent(block, definition, context) {
2460
- const content = selectBlockContent(block, context.previewStage);
2461
- if (!definition || content._arrangementLooks === void 0) return content;
2462
- return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
2463
- }
2464
- function admitLoaderDateRuntime(context) {
2465
- const root = context.root;
2466
- return {
2467
- now: root?.now === void 0 ? toUtcIsoDateTimeString((/* @__PURE__ */ new Date()).toISOString()) : readRuntimeNow(root.now),
2468
- dateContext: resolveDateRuntimeContext(typeof root?.bookingTimeZone === "string" ? root.bookingTimeZone : void 0)
2469
- };
2470
- }
2471
- //#endregion
2472
- //#region ../blocks/src/system/data/normalizeLoaderParams.ts
2473
- function toStringParams(value) {
2474
- if (!isObjectRecord(value)) return {};
2475
- const out = {};
2476
- for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
2477
- return out;
2478
- }
2479
- function stripEmptyStringValues(params, endpoint) {
2480
- for (const [key, value] of Object.entries(params)) if (value === "" && !(key === "seriesIds" && (endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow"))) delete params[key];
2481
- }
2482
- function ensureSiteId(params, context) {
2483
- if (!params.siteId && typeof context.siteId === "string" && context.siteId) params.siteId = context.siteId;
2484
- }
2485
- /**
2486
- * Normalize loader params emitted by the block runtime into a consistent shape
2487
- * (canonical keys + required context-derived fields).
2488
- *
2489
- * Note: params are already stringified by the core prefetch implementation.
2490
- */
2491
- function normalizeLoaderParams(endpoint, params, context) {
2492
- const out = toStringParams(params);
2493
- stripEmptyStringValues(out, endpoint);
2494
- if (endpoint === "getPublicFormById") {
2495
- ensureSiteId(out, context);
2496
- if (!out.formId && out.formSlug) {
2497
- out.formId = out.formSlug;
2498
- delete out.formSlug;
2499
- }
2500
- return out;
2501
- }
2502
- if (endpoint === "getPublicBookingServices") {
2503
- ensureSiteId(out, context);
2504
- return out;
2505
- }
2506
- if (endpoint === "getPublicWeeklySlotAvailability") {
2507
- ensureSiteId(out, context);
2508
- return out;
2509
- }
2510
- if (endpoint === "listPublicEvents" || endpoint === "listPublicRecurringSchedule" || endpoint === "listPublicEventCalendarWindow") {
2511
- ensureSiteId(out, context);
2512
- return out;
2513
- }
2514
- if (endpoint === "getPublicEventDetails") {
2515
- ensureSiteId(out, context);
2516
- return out;
2517
- }
2518
- if (endpoint === "listPublicProducts") {
2519
- ensureSiteId(out, context);
2520
- return out;
2521
- }
2522
- if (endpoint === "listPublicTeamMembers") {
2523
- ensureSiteId(out, context);
2524
- return out;
2525
- }
2526
- if (endpoint === "listPublicRouteCandidates") {
2527
- ensureSiteId(out, context);
2528
- return out;
2529
- }
2530
- if (endpoint === "getPublishedEntryPreview") {
2531
- ensureSiteId(out, context);
2532
- return out;
2533
- }
2534
- ensureSiteId(out, context);
2535
- return out;
2536
- }
2537
- //#endregion
2538
- //#region ../theme-core/src/footer/mode.ts
2539
- const footerModeSchema = z.enum([
2540
- "default",
2541
- "blocks",
2542
- "default+blocks",
2543
- "none"
2544
- ]);
2545
- /** Reads only SDK footer intent; unrelated config and theme fields are not authorities. */
2546
- function resolveSdkFooterMode(config) {
2547
- const parsed = z.object({ layout: z.object({ footerMode: footerModeSchema.optional() }).optional() }).safeParse(config);
2548
- return parsed.success ? parsed.data.layout?.footerMode ?? "default" : "default";
2549
- }
2550
- z.object({
2551
- variant: z.enum([
2552
- "simple",
2553
- "columns",
2554
- "split",
2555
- "centred"
2556
- ]),
2557
- showLogoText: z.boolean().optional(),
2558
- logo: z.object({
2559
- showLogo: z.boolean().optional(),
2560
- showLogoText: z.boolean().optional()
2561
- }).optional()
2562
- });
2563
- /**
2564
- * Resolve what to render for the footer given the current mode and whether the
2565
- * site is SDK-managed.
2566
- *
2567
- * Backwards compatible: missing/undefined mode is treated as 'default'.
2568
- */
2569
- function resolveFooterRenderPlan(params) {
2570
- if (!params.isSdkSite) return {
2571
- mode: "default",
2572
- renderDefaultFooter: true,
2573
- renderFooterBlocks: false
2574
- };
2575
- switch (params.mode ?? "default") {
2576
- case "blocks": return {
2577
- mode: "blocks",
2578
- renderDefaultFooter: false,
2579
- renderFooterBlocks: true
2580
- };
2581
- case "default+blocks": return {
2582
- mode: "default+blocks",
2583
- renderDefaultFooter: true,
2584
- renderFooterBlocks: true
2585
- };
2586
- case "none": return {
2587
- mode: "none",
2588
- renderDefaultFooter: false,
2589
- renderFooterBlocks: false
2590
- };
2591
- default: return {
2592
- mode: "default",
2593
- renderDefaultFooter: true,
2594
- renderFooterBlocks: false
2595
- };
2596
- }
2597
- }
2598
- z.object({ refreshToken: z.string().min(1).max(4096) }).strict();
2599
- z.object({
2600
- accessToken: z.string().min(1).max(4096),
2601
- refreshToken: z.string().min(1).max(4096)
2602
- }).strict();
2603
- z.object({ accessToken: z.string().min(1).max(8192) }).strict();
2604
- z.object({
2605
- type: z.literal("riverbank:preview-height"),
2606
- height: z.number().finite().positive()
2607
- }).strict();
2608
- z.object({ type: z.literal("riverbank:preview-failed") }).strict();
2609
- const ACCOUNT_SITE_CURSOR_MAX_LENGTH = 2048;
2610
- const ACCOUNT_SITE_TIMESTAMP_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,6}))?(Z|[+-]\d{2}:\d{2})$/;
2611
- /** Strict, injection-safe PostgreSQL/RFC3339 timestamp text used in cursors. */
2612
- function isAccountSiteTimestamp(value) {
2613
- if (typeof value !== "string") return false;
2614
- const match = ACCOUNT_SITE_TIMESTAMP_PATTERN.exec(value);
2615
- if (!match) return false;
2616
- const [, year, month, day, hour, minute, second, , offset] = match;
2617
- const date = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
2618
- const offsetValue = offset ?? "";
2619
- const offsetIsValid = offsetValue === "Z" || (() => {
2620
- const offsetMatch = /^(?:[+-])(\d{2}):(\d{2})$/.exec(offsetValue);
2621
- if (!offsetMatch) return false;
2622
- return Number(offsetMatch[1]) <= 23 && Number(offsetMatch[2]) <= 59;
2623
- })();
2624
- return date.getUTCFullYear() === Number(year) && date.getUTCMonth() === Number(month) - 1 && date.getUTCDate() === Number(day) && Number(hour) <= 23 && Number(minute) <= 59 && Number(second) <= 59 && offsetIsValid;
2625
- }
2626
- const accountSiteTimestampSchema = z.string().refine(isAccountSiteTimestamp, { message: "Expected a strict account site timestamp" });
2627
- z.enum([
2628
- "managed",
2629
- "headless_cms",
2630
- "headless_full"
2631
- ]);
2632
- z.object({ title: z.string().trim().min(1).max(120) });
2633
- const abandonedStandardKeyIdsSchema = z.object({
2634
- live: z.string().uuid().optional(),
2635
- management: z.string().uuid().optional()
2636
- }).strict();
2637
- const abandonedPreviewKeyIdsSchema = z.object({
2638
- live: z.string().uuid().optional(),
2639
- management: z.string().uuid().optional(),
2640
- preview: z.string().uuid().optional()
2641
- }).strict();
2642
- z.discriminatedUnion("operation", [
2643
- z.object({
2644
- operation: z.literal("issue_standard"),
2645
- siteId: z.string().uuid(),
2646
- operationId: z.string().uuid(),
2647
- projectName: z.string().trim().min(1).max(120),
2648
- abandonedKeyIds: abandonedStandardKeyIdsSchema.default({})
2649
- }).strict(),
2650
- z.object({
2651
- operation: z.literal("issue_with_preview"),
2652
- siteId: z.string().uuid(),
2653
- operationId: z.string().uuid(),
2654
- projectName: z.string().trim().min(1).max(120),
2655
- abandonedKeyIds: abandonedPreviewKeyIdsSchema.default({})
2656
- }).strict(),
2657
- z.object({
2658
- operation: z.literal("revalidate_standard"),
2659
- siteId: z.string().uuid(),
2660
- operationId: z.string().uuid(),
2661
- projectName: z.string().trim().min(1).max(120),
2662
- keyIds: z.object({
2663
- live: z.string().uuid(),
2664
- management: z.string().uuid()
2665
- }).strict()
2666
- }).strict(),
2667
- z.object({
2668
- operation: z.literal("revalidate_with_preview"),
2669
- siteId: z.string().uuid(),
2670
- operationId: z.string().uuid(),
2671
- projectName: z.string().trim().min(1).max(120),
2672
- keyIds: z.object({
2673
- live: z.string().uuid(),
2674
- management: z.string().uuid(),
2675
- preview: z.string().uuid()
2676
- }).strict()
2677
- }).strict()
2678
- ]);
2679
- z.object({
2680
- cursor: z.string().min(1).max(ACCOUNT_SITE_CURSOR_MAX_LENGTH).optional(),
2681
- limit: z.coerce.number().int().min(1).max(100).default(50),
2682
- search: z.string().trim().min(1).max(120).optional()
2683
- });
2684
- //#endregion
2685
- //#region ../api/src/utils/isRecord.ts
2686
- function isRecord$1(value) {
2687
- return typeof value === "object" && value !== null && !Array.isArray(value);
2688
- }
2689
- z.object({
2690
- formulaVersion: z.literal("managed-domain-overage-v1"),
2691
- conversionRule: z.literal("usd-to-gbp-1-to-1-v1"),
2692
- registrarAnnualCost: z.number().nonnegative(),
2693
- registrarCurrency: z.literal("USD"),
2694
- includedAnnualAllowance: z.number().nonnegative(),
2695
- includedAnnualAllowanceCurrency: z.literal("USD"),
2696
- monthlyAmountCents: z.number().int().nonnegative(),
2697
- monthlyCurrency: z.literal("gbp")
2698
- });
2699
- //#endregion
2700
- //#region ../api/src/navigation/contracts.ts
2701
- /**
2702
- * Canonical navigation/link Zod contracts.
2703
- *
2704
- * Goal: a single source-of-truth for link shapes used across dashboard + SDK.
2705
- * - Types live in `packages/api/src/navigation/types.ts`
2706
- * - Schemas live here and are tied to types via `satisfies z.ZodType<...>`
2707
- */
2708
- const portalLinkPayloadSchema = z.object({
2709
- kind: z.literal("portal"),
2710
- path: z.string().trim().startsWith("/").optional(),
2711
- labels: z.object({
2712
- loggedOut: z.string().trim().min(1).optional(),
2713
- loggedIn: z.string().trim().min(1).optional()
2714
- }).optional()
2715
- });
2716
- const cartLinkLabelConfigSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("icon-only") }), z.object({
2717
- kind: z.literal("icon-with-label"),
2718
- label: z.string().trim().min(1)
2719
- })]);
2720
- const cartLinkPayloadSchema = z.object({
2721
- kind: z.literal("cart"),
2722
- badge: z.enum(["show-count", "hidden"]),
2723
- label: cartLinkLabelConfigSchema
2724
- });
2725
- const internalLinkPayloadSchema = z.object({
2726
- kind: z.literal("internal"),
2727
- routeId: z.string().uuid(),
2728
- entityId: z.string().uuid(),
2729
- entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES),
2730
- href: z.string().min(1),
2731
- title: z.string().min(1),
2732
- typeLabel: z.string().min(1),
2733
- contentTypeKey: z.string().nullable().optional(),
2734
- contentTypeName: z.string().nullable().optional(),
2735
- updatedAt: z.string().nullable().optional()
2736
- }).passthrough();
2737
- const externalLinkSchema = z.object({
2738
- kind: z.literal("external"),
2739
- href: z.string().url()
2740
- });
2741
- const customLinkSchema = z.object({
2742
- kind: z.literal("url"),
2743
- href: z.string().min(1)
2744
- });
2745
- const pageLinkSchema = z.object({
2746
- kind: z.literal("page"),
2747
- identifier: z.string().min(1)
2748
- });
2749
- const entryLinkSchema = z.object({
2750
- kind: z.literal("entry"),
2751
- contentType: z.string().min(1),
2752
- identifier: z.string().min(1)
2753
- });
2754
- const linkPayloadSchema = z.discriminatedUnion("kind", [
2755
- internalLinkPayloadSchema,
2756
- pageLinkSchema,
2757
- entryLinkSchema,
2758
- externalLinkSchema,
2759
- customLinkSchema,
2760
- portalLinkPayloadSchema,
2761
- cartLinkPayloadSchema
2762
- ]);
2763
- const navigationLinkInputSchemaOptions = [
2764
- pageLinkSchema,
2765
- entryLinkSchema,
2766
- externalLinkSchema,
2767
- customLinkSchema,
2768
- portalLinkPayloadSchema,
2769
- cartLinkPayloadSchema
2770
- ];
2771
- z.discriminatedUnion("kind", navigationLinkInputSchemaOptions);
2772
- //#endregion
2773
- //#region ../api/src/sdkConfig/contracts.ts
2774
- /**
2775
- * Canonical SDK config Zod contracts.
2776
- *
2777
- * Goal: a single source-of-truth for request payload shapes used across dashboard + SDK.
2778
- * - Endpoint request/response types live in `packages/api/src/types.ts`
2779
- * - Schemas live here and are tied to those types via `satisfies z.ZodType<...>`
2780
- *
2781
- * NOTE: These schemas represent the *wire/input* shape for API requests.
2782
- * Service-layer code should parse/normalize again (defaults/refinements) into domain types.
2783
- */
2784
- /**
2785
- * UNSAFE: Retype an existing Zod schema to a different (compile-time) output type.
2786
- *
2787
- * Use only for cases where:
2788
- * - the runtime schema is known to accept the desired *input/wire* shape, but
2789
- * - Zod's inferred output type doesn't match the desired TS type due to transforms/defaults.
2790
- *
2791
- * If used incorrectly, this can lie to TypeScript and cause drift.
2792
- *
2793
- * @internal
2794
- */
2795
- function unsafeRetypeZodSchema(schema) {
2796
- return schema;
2797
- }
2798
- const navIdListSchema = z.preprocess((value) => {
2799
- if (!Array.isArray(value)) return void 0;
2800
- const filtered = value.filter((v) => typeof v === "string" && v.trim().length > 0);
2801
- return filtered.length > 0 ? filtered : void 0;
2802
- }, z.array(z.string()).max(200).optional());
2803
- const dashboardNavVisibilityBaseSchema = z.object({
2804
- mode: z.enum(["augment", "restrict"]).optional(),
2805
- allowIds: navIdListSchema,
2806
- denyIds: navIdListSchema
2807
- }).strip();
2808
- const dashboardNavVisibilityRolesSchema = z.object({
2809
- administrator: dashboardNavVisibilityBaseSchema.optional(),
2810
- editor: dashboardNavVisibilityBaseSchema.optional(),
2811
- team_member: dashboardNavVisibilityBaseSchema.optional()
2812
- }).strip().optional();
2813
- const dashboardNavVisibilitySchema = dashboardNavVisibilityBaseSchema.extend({ roles: dashboardNavVisibilityRolesSchema }).strip();
2814
- const dashboardNavigationConfigSchema = z.object({
2815
- siteNav: dashboardNavVisibilitySchema.optional(),
2816
- settingsNav: dashboardNavVisibilitySchema.optional()
2817
- }).strip();
2818
- const dashboardConfigSchema = z.object({
2819
- previewEditingEnabled: z.boolean().optional(),
2820
- navigation: dashboardNavigationConfigSchema.optional()
2821
- }).strip();
2822
- /**
2823
- * Canonical field schema comes from @riverbankcms/blocks.
2824
- *
2825
- * It accepts FieldDefinitionInput (pre-defaults) and outputs FieldDefinition (post-defaults).
2826
- * This `satisfies` assertion prevents drift in the *accepted wire shape* without forcing
2827
- * the schema output type to match the input type.
2828
- */
2829
- const fieldDefinitionInputSchema = unsafeRetypeZodSchema(fieldSchema);
2830
- const sdkLoaderEndpointSchema = z.enum(SUPPORTED_LOADER_ENDPOINTS$1);
2831
- const loaderFallbackScalarSchema = z.union([
2832
- z.string(),
2833
- z.number(),
2834
- z.boolean(),
2835
- z.null()
2836
- ]);
2837
- const loaderParamBindingSchema = z.object({ $bind: z.object({
2838
- from: z.string().min(1, "Binding path is required"),
2839
- fallback: loaderFallbackScalarSchema.optional()
2840
- }) });
2841
- const loaderParamValueSchema = z.union([
2842
- z.string(),
2843
- z.number(),
2844
- z.boolean(),
2845
- loaderParamBindingSchema
2846
- ]);
2847
- const sdkConfigLoaderSchema = z.object({
2848
- endpoint: sdkLoaderEndpointSchema,
2849
- params: z.record(z.string(), loaderParamValueSchema),
2850
- requiredParams: z.array(z.string().min(1)).optional(),
2851
- mode: z.enum(["server", "client"]).default("server")
2852
- });
2853
- const sdkDataLoadersSchema = z.record(z.string(), sdkConfigLoaderSchema).refine((loaders) => Object.keys(loaders).length <= 5, { message: "Maximum 5 data loaders per block" }).optional();
2854
- const sdkCustomBlockIdSchema = z.string().min(8).regex(/^custom\.[a-z][a-z0-9-]*$/, { message: "Block ID must start with 'custom.' followed by lowercase letters, numbers, or hyphens" }).transform((value) => value);
2855
- const sdkCustomBlockInputSchema = z.object({
2856
- id: sdkCustomBlockIdSchema,
2857
- title: z.string().min(1),
2858
- titleSource: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional(),
2859
- description: z.string().optional(),
2860
- category: blockCategoryEnum,
2861
- icon: z.string().optional(),
2862
- tags: z.array(z.string()).optional(),
2863
- fields: fieldDefinitionInputSchema.array().min(1),
2864
- dataLoaders: sdkDataLoadersSchema,
2865
- layout: NodeSchema.optional(),
2866
- ...sdkBlockPresentationShape,
2867
- ...blockSectionDeclarationShape
2868
- }).superRefine(validateManifestLookField).superRefine(validateSdkBlockDeclaration);
2869
- const sdkBlockFieldExtensionInputSchema = z.object({
2870
- fields: fieldDefinitionInputSchema.array().min(1),
2871
- ...blockSectionDeclarationShape
2872
- }).superRefine(validateManifestLookField);
2873
- const sdkBlockFieldExtensionsInputSchema = z.record(z.string().min(1), sdkBlockFieldExtensionInputSchema);
2874
- const sdkThemePaletteSchema = z.record(z.string(), z.string());
2875
- const sdkThemeConfigSchema = z.object({ palette: sdkThemePaletteSchema });
2876
- const sdkSectionBackgroundSchema = z.object({
2877
- id: z.string().min(1),
2878
- label: z.string().min(1),
2879
- token: z.string().min(1)
2880
- });
2881
- const sdkSectionOptionsConfigSchema = z.object({
2882
- backgroundColor: z.boolean().optional(),
2883
- backgroundImage: z.boolean().optional(),
2884
- backgroundGradient: z.boolean().optional(),
2885
- spacing: z.union([z.array(z.enum([
2886
- "compact",
2887
- "default",
2888
- "spacious"
2889
- ])), z.boolean()]).optional(),
2890
- textColor: z.boolean().optional()
2891
- });
2892
- const sdkContainerOptionsConfigSchema = z.object({
2893
- maxWidth: z.union([z.array(z.enum([
2894
- "narrow",
2895
- "default",
2896
- "wide",
2897
- "full"
2898
- ])), z.boolean()]).optional(),
2899
- alignment: z.union([z.array(z.enum([
2900
- "left",
2901
- "center",
2902
- "right"
2903
- ])), z.boolean()]).optional()
2904
- });
2905
- const sdkSiteStyleConfigSchema = z.object({
2906
- sectionBackgrounds: z.array(sdkSectionBackgroundSchema).optional(),
2907
- sectionOptions: sdkSectionOptionsConfigSchema.optional(),
2908
- containerOptions: sdkContainerOptionsConfigSchema.optional()
2909
- });
2910
- const sdkSiteLayoutConfigSchema = z.object({
2911
- footerMode: footerModeSchema.optional(),
2912
- footerBlocks: z.array(z.object({
2913
- id: z.string().min(1).optional(),
2914
- kind: z.string().min(1),
2915
- content: z.record(z.string(), z.unknown()).optional()
2916
- })).optional()
2917
- });
2918
- const sdkFieldSelectOptionSchema = z.object({
2919
- value: z.string(),
2920
- label: z.string()
2921
- });
2922
- const sdkBlockFieldConfigSchema = z.object({ options: z.array(sdkFieldSelectOptionSchema).optional() });
2923
- const sdkBlockFieldOptionsMapSchema = z.record(z.string().regex(/^(block\.|custom\.)[a-z][a-z0-9-]*$/, { message: "Block ID must be 'block.*' or 'custom.*' format" }), z.record(z.string().min(1), sdkBlockFieldConfigSchema)).optional();
2924
- const sdkContentTypeTemplateConfigSchema = z.object({ blocks: z.array(z.unknown()) }).passthrough();
2925
- const sdkContentTypeOrderingConfigSchema = z.object({ mode: z.enum(["default", "manual"]).optional() }).optional();
2926
- const sdkContentTypeConfigSchema = z.object({
2927
- key: z.string().min(1),
2928
- fields: z.array(z.unknown()),
2929
- ordering: sdkContentTypeOrderingConfigSchema,
2930
- template: sdkContentTypeTemplateConfigSchema.nullable().optional()
2931
- }).passthrough();
2932
- const sdkContentConfigSchema = z.object({
2933
- contentTypes: z.array(sdkContentTypeConfigSchema).optional(),
2934
- pages: z.array(z.unknown()).optional(),
2935
- entries: z.array(z.unknown()).optional(),
2936
- navigationMenus: z.array(z.unknown()).optional(),
2937
- settings: z.unknown().optional()
2938
- }).passthrough();
2939
- const SDK_WORKFLOW_ID_PATTERN = /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/;
2940
- const SDK_WORKFLOW_ENDPOINT_PATTERN = /^\//;
2941
- const sdkWorkflowIdSchema = z.string().min(1).max(120).regex(SDK_WORKFLOW_ID_PATTERN, { message: "Workflow ID must start with a lowercase letter and use lowercase letters, numbers, dots, underscores, or hyphens" });
2942
- const sdkWorkflowEndpointSchema = z.string().min(1).max(500).regex(SDK_WORKFLOW_ENDPOINT_PATTERN, { message: "Workflow endpoint must be a site-relative path starting with \"/\"" });
2943
- const sdkWorkflowManualTriggerSchema = z.object({ type: z.literal("manual") }).strict();
2944
- const sdkWorkflowTriggerFieldSchema = z.string().trim().min(1).max(120).refine((field) => !field.includes("."), { message: "Workflow trigger fields must be top-level content field IDs, not paths" });
2945
- const sdkWorkflowFieldChangedConditionSchema = z.object({
2946
- field: sdkWorkflowTriggerFieldSchema,
2947
- changed: z.literal(true)
2948
- }).strict();
2949
- const sdkWorkflowFieldEmptyConditionSchema = z.object({
2950
- field: sdkWorkflowTriggerFieldSchema,
2951
- isEmpty: z.boolean()
2952
- }).strict();
2953
- const sdkWorkflowEntryDraftUpdatedTriggerSchema = z.object({
2954
- type: z.literal("entry.draft.updated"),
2955
- when: z.array(z.union([sdkWorkflowFieldChangedConditionSchema, sdkWorkflowFieldEmptyConditionSchema])).min(1).max(10)
2956
- }).strict();
2957
- const sdkWorkflowTriggerSchema = z.discriminatedUnion("type", [sdkWorkflowManualTriggerSchema, sdkWorkflowEntryDraftUpdatedTriggerSchema]);
2958
- const sdkWorkflowConfirmationSchema = z.object({
2959
- title: z.string().trim().min(1).max(120),
2960
- body: z.string().trim().min(1).max(500).optional()
2961
- }).strict();
2962
- const sdkWorkflowConfigSchema = z.object({
2963
- id: sdkWorkflowIdSchema,
2964
- title: z.string().trim().min(1).max(120),
2965
- description: z.string().trim().min(1).max(500).optional(),
2966
- contentType: z.string().trim().min(1).max(120),
2967
- endpoint: sdkWorkflowEndpointSchema,
2968
- triggers: z.array(sdkWorkflowTriggerSchema).min(1).max(5),
2969
- confirmation: sdkWorkflowConfirmationSchema.optional()
2970
- }).strict();
2971
- const sdkWorkflowsSchema = z.array(sdkWorkflowConfigSchema).max(50, "Maximum 50 workflows per site").refine((workflows) => {
2972
- const ids = workflows.map((workflow) => workflow.id);
2973
- return ids.length === new Set(ids).size;
2974
- }, { message: "Workflow IDs must be unique" }).optional();
2975
- const riverbankSiteConfigInputSchema = z.object({
2976
- siteId: z.string().uuid(),
2977
- builtInBlocks: builtInBlockKindsSchema.optional(),
2978
- previewUrl: z.string().url().optional(),
2979
- liveUrl: z.string().url().optional(),
2980
- theme: sdkThemeConfigSchema.optional(),
2981
- styles: sdkSiteStyleConfigSchema.optional(),
2982
- layout: sdkSiteLayoutConfigSchema.optional(),
2983
- customBlocks: z.array(sdkCustomBlockInputSchema).max(100, "Maximum 100 custom blocks per site").refine((blocks) => {
2984
- const ids = blocks.map((b) => b.id);
2985
- return ids.length === new Set(ids).size;
2986
- }, { message: "Block IDs must be unique" }).optional(),
2987
- blockFieldOptions: sdkBlockFieldOptionsMapSchema,
2988
- blockFieldExtensions: sdkBlockFieldExtensionsInputSchema.optional(),
2989
- workflows: sdkWorkflowsSchema,
2990
- content: sdkContentConfigSchema.optional(),
2991
- contentDir: z.string().optional(),
2992
- sync: z.object({ existingEntries: z.enum(["skip", "update"]).optional() }).optional(),
2993
- deploy: z.object({
2994
- verifyCommand: z.string().optional(),
2995
- prebuildOutput: z.string().optional()
2996
- }).optional(),
2997
- themeSource: z.enum(["local", "cms"]).optional(),
2998
- activeTheme: z.string().optional(),
2999
- enablePortal: z.boolean().optional(),
3000
- dashboard: dashboardConfigSchema.optional()
3001
- }).strict();
3002
- z.object({
3003
- config: riverbankSiteConfigInputSchema,
3004
- forceContentTypes: z.boolean().optional(),
3005
- mode: z.enum(["apply", "preview"]).optional(),
3006
- expectedMailingListProviderScope: z.unknown().transform((value, ctx) => {
3007
- if (value === void 0) return void 0;
3008
- const parsed = parseMailingListProviderScope(value);
3009
- if (parsed.ok) return parsed.value;
3010
- ctx.addIssue({
3011
- code: "custom",
3012
- message: "Invalid mailing-list provider scope"
3013
- });
3014
- return z.NEVER;
3015
- }).optional()
3016
- }).strict();
3017
- //#endregion
3018
- //#region ../api/src/sdkThemeWire.ts
3019
- /**
3020
- * Validate a wire value without replacing it with the schema's parsed output.
3021
- * The returned type is deliberately the schema input, not its canonical output.
3022
- */
3023
- function losslessValidatedSchema(schema) {
3024
- return z.unknown().superRefine((value, ctx) => {
3025
- const parsed = schema.safeParse(value);
3026
- if (parsed.success) return;
3027
- for (const issue of parsed.error.issues) ctx.addIssue({
3028
- code: "custom",
3029
- path: issue.path,
3030
- message: issue.message,
3031
- params: { validationCode: issue.code }
3032
- });
3033
- }).transform((value) => value);
3034
- }
3035
- losslessValidatedSchema(themeSchema);
3036
- //#endregion
3037
- //#region ../api/src/siteOnboarding.ts
3038
- const LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS = { configure_appointments: {
3039
- requirementId: "configure_appointments",
3040
- reason: "launch_anyway"
3041
- } };
3042
- z.discriminatedUnion("requirementId", [z.object({ requirementId: z.literal("review_generated_site") }), z.object({
3043
- requirementId: z.literal(LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS.configure_appointments.requirementId),
3044
- overrideReason: z.literal(LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS.configure_appointments.reason)
3045
- })]);
3046
- z.object({ acceptExtraSiteCharge: z.boolean().optional() });
3047
- //#endregion
3048
- //#region ../api/src/accountApi.ts
3049
- const siteRoleSchema = z.enum([
3050
- "owner",
3051
- "administrator",
3052
- "editor",
3053
- "team_member"
3054
- ]);
3055
- const linkCapabilitySchema = z.discriminatedUnion("tag", [z.object({ tag: z.literal("linkable") }), z.object({
3056
- tag: z.literal("insufficient_role"),
3057
- requiredRole: siteRoleSchema
3058
- })]);
3059
- const accountSiteBaseSchema = z.object({
3060
- id: brandedIdSchema(parseSiteId, "site id"),
3061
- title: z.string(),
3062
- slug: z.string().min(1),
3063
- createdAt: accountSiteTimestampSchema.nullable(),
3064
- role: siteRoleSchema
3065
- });
3066
- const managedSiteSchema = accountSiteBaseSchema.extend({
3067
- deploymentMode: z.literal("managed"),
3068
- linkCapability: z.object({
3069
- tag: z.literal("ineligible_deployment_mode"),
3070
- deploymentMode: z.literal("managed")
3071
- })
3072
- });
3073
- const headlessSiteSchemas = [accountSiteBaseSchema.extend({
3074
- deploymentMode: z.literal("headless_cms"),
3075
- linkCapability: linkCapabilitySchema
3076
- }), accountSiteBaseSchema.extend({
3077
- deploymentMode: z.literal("headless_full"),
3078
- linkCapability: linkCapabilitySchema
3079
- })];
3080
- function brandedIdSchema(parse, label) {
3081
- return z.string().transform((value, context) => {
3082
- const parsed = parse(value);
3083
- if (parsed.ok) return parsed.value;
3084
- context.addIssue({
3085
- code: "custom",
3086
- message: `Expected a valid ${label}`
3087
- });
3088
- return z.NEVER;
3089
- });
3090
- }
3091
- z.object({
3092
- userId: brandedIdSchema(parseUserId, "userId"),
3093
- email: z.string().email().nullable(),
3094
- displayName: z.string().min(1).nullable()
3095
- });
3096
- const siteSchema = z.discriminatedUnion("deploymentMode", [managedSiteSchema, ...headlessSiteSchemas]);
3097
- z.object({
3098
- sites: z.array(siteSchema),
3099
- nextCursor: z.string().min(1).max(ACCOUNT_SITE_CURSOR_MAX_LENGTH).nullable()
3100
- });
3101
- z.object({
3102
- id: brandedIdSchema(parseSiteId, "site id"),
3103
- title: z.string(),
3104
- slug: z.string().min(1)
3105
- });
3106
- z.object({
3107
- signedUrl: z.string().url(),
3108
- token: z.string().min(1),
3109
- storagePath: z.string().min(1)
3110
- }).strict();
3111
- const backupManifestSchema = z.object({
3112
- siteId: z.string().min(1),
3113
- siteSlug: z.string().min(1),
3114
- siteTitle: z.string(),
3115
- exportedAt: z.string().min(1),
3116
- tableCount: z.number().int().nonnegative(),
3117
- totalRecords: z.number().int().nonnegative(),
3118
- pageCount: z.number().int().nonnegative(),
3119
- blockCount: z.number().int().nonnegative(),
3120
- contentEntryCount: z.number().int().nonnegative(),
3121
- formCount: z.number().int().nonnegative(),
3122
- navigationMenuCount: z.number().int().nonnegative(),
3123
- mediaCount: z.number().int().nonnegative(),
3124
- mediaBytes: z.number().int().nonnegative()
3125
- }).strict();
3126
- z.object({
3127
- ok: z.literal(true),
3128
- manifest: backupManifestSchema,
3129
- storagePath: z.string().min(1)
3130
- }).strict();
3131
- z.object({
3132
- ok: z.literal(true),
3133
- siteId: brandedIdSchema(parseSiteId, "site id"),
3134
- slug: z.string().min(1),
3135
- title: z.string(),
3136
- counts: z.record(z.string(), z.object({
3137
- created: z.number().int().nonnegative(),
3138
- updated: z.number().int().nonnegative(),
3139
- skipped: z.number().int().nonnegative(),
3140
- failed: z.number().int().nonnegative()
3141
- }).strict()),
3142
- warnings: z.array(z.string()),
3143
- errors: z.array(z.object({
3144
- table: z.string(),
3145
- id: z.string(),
3146
- error: z.string()
3147
- }).strict())
3148
- }).strict();
3149
- z.object({ deleted: z.boolean() }).strict();
3150
- const apiKeyIdSchema = brandedIdSchema(parseApiKeyId, "API key id");
3151
- const standardKeyIdsSchema = z.object({
3152
- live: apiKeyIdSchema.optional(),
3153
- management: apiKeyIdSchema.optional()
3154
- }).strict();
3155
- const previewKeyIdsSchema = z.object({
3156
- live: apiKeyIdSchema.optional(),
3157
- management: apiKeyIdSchema.optional(),
3158
- preview: apiKeyIdSchema.optional()
3159
- }).strict();
3160
- const liveCredentialSchema = z.object({
3161
- key: z.string().regex(/^bld_live_sk_.+$/).transform((value) => createSecret("content-key", value)),
3162
- keyId: apiKeyIdSchema
3163
- }).strict();
3164
- const managementCredentialSchema = z.object({
3165
- key: z.string().transform((value, context) => {
3166
- const parsed = parseManagementKey(value);
3167
- if (!parsed.ok) {
3168
- context.addIssue({
3169
- code: "custom",
3170
- message: "Expected a valid management key"
3171
- });
3172
- return z.NEVER;
3173
- }
3174
- return parsed.value;
3175
- }),
3176
- keyId: apiKeyIdSchema
3177
- }).strict();
3178
- const previewCredentialSchema = z.object({
3179
- key: z.string().regex(/^bld_preview_sk_.+$/).transform((value) => createSecret("preview-key", value)),
3180
- keyId: apiKeyIdSchema
3181
- }).strict();
3182
- z.discriminatedUnion("operation", [
3183
- z.object({
3184
- operation: z.literal("issue_standard"),
3185
- siteId: brandedIdSchema(parseSiteId, "site id"),
3186
- operationId: z.string().uuid(),
3187
- revokedAbandonedKeyIds: standardKeyIdsSchema,
3188
- credentials: z.object({
3189
- live: liveCredentialSchema,
3190
- management: managementCredentialSchema
3191
- }).strict()
3192
- }).strict(),
3193
- z.object({
3194
- operation: z.literal("issue_with_preview"),
3195
- siteId: brandedIdSchema(parseSiteId, "site id"),
3196
- operationId: z.string().uuid(),
3197
- revokedAbandonedKeyIds: previewKeyIdsSchema,
3198
- credentials: z.object({
3199
- live: liveCredentialSchema,
3200
- management: managementCredentialSchema,
3201
- preview: previewCredentialSchema
3202
- }).strict()
3203
- }).strict(),
3204
- z.object({
3205
- operation: z.literal("recovery_standard"),
3206
- siteId: brandedIdSchema(parseSiteId, "site id"),
3207
- operationId: z.string().uuid(),
3208
- issuedKeyIds: standardKeyIdsSchema,
3209
- revokedAbandonedKeyIds: standardKeyIdsSchema,
3210
- remainingAbandonedKeyIds: standardKeyIdsSchema,
3211
- failureTag: z.enum(["ACCOUNT_CREDENTIALS_ISSUANCE_FAILED", "ACCOUNT_CREDENTIALS_RECOVERY_REVOKE_FAILED"])
3212
- }).strict(),
3213
- z.object({
3214
- operation: z.literal("recovery_with_preview"),
3215
- siteId: brandedIdSchema(parseSiteId, "site id"),
3216
- operationId: z.string().uuid(),
3217
- issuedKeyIds: previewKeyIdsSchema,
3218
- revokedAbandonedKeyIds: previewKeyIdsSchema,
3219
- remainingAbandonedKeyIds: previewKeyIdsSchema,
3220
- failureTag: z.enum(["ACCOUNT_CREDENTIALS_ISSUANCE_FAILED", "ACCOUNT_CREDENTIALS_RECOVERY_REVOKE_FAILED"])
3221
- }).strict(),
3222
- z.object({
3223
- operation: z.literal("revalidate_standard"),
3224
- siteId: brandedIdSchema(parseSiteId, "site id"),
3225
- operationId: z.string().uuid(),
3226
- checks: z.object({
3227
- live: z.object({
3228
- keyId: apiKeyIdSchema,
3229
- status: z.literal("active")
3230
- }).strict(),
3231
- management: z.object({
3232
- keyId: apiKeyIdSchema,
3233
- status: z.literal("active")
3234
- }).strict()
3235
- }).strict()
3236
- }).strict(),
3237
- z.object({
3238
- operation: z.literal("revalidate_with_preview"),
3239
- siteId: brandedIdSchema(parseSiteId, "site id"),
3240
- operationId: z.string().uuid(),
3241
- checks: z.object({
3242
- live: z.object({
3243
- keyId: apiKeyIdSchema,
3244
- status: z.literal("active")
3245
- }).strict(),
3246
- management: z.object({
3247
- keyId: apiKeyIdSchema,
3248
- status: z.literal("active")
3249
- }).strict(),
3250
- preview: z.object({
3251
- keyId: apiKeyIdSchema,
3252
- status: z.literal("active")
3253
- }).strict()
3254
- }).strict()
3255
- }).strict()
3256
- ]);
3257
- const CANONICAL_REFUND_PLANNER_ERROR_CODES = [
3258
- ...[
3259
- "already_refunded",
3260
- "idempotency_amount_mismatch",
3261
- "idempotency_method_mismatch",
3262
- "idempotency_receipt_mismatch",
3263
- "idempotency_scope_mismatch",
3264
- "refund_in_progress"
3265
- ],
3266
- "invalid_amount",
3267
- "amount_exceeds_remaining",
3268
- "pass_revoke_requires_full_refund",
3269
- "refund_failed"
3270
- ];
3271
- const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
3272
- "refund_blocked_by_live_payment_terms",
3273
- ...CANONICAL_REFUND_PLANNER_ERROR_CODES,
3274
- "payment_intent_not_found",
3275
- "stripe_error",
3276
- "stale_pending_missing_context",
3277
- "non_refundable_deposit_remaining",
3278
- "deposit_refund_override_required",
3279
- "refund_revoke_requires_full_line_refund",
3280
- "payment_receipt_not_found",
3281
- "payment_receipt_not_refundable",
3282
- "payment_receipt_attribution_required"
3283
- ];
3284
- [...CANONICAL_REFUND_PLANNER_ERROR_CODES];
3285
- //#endregion
3286
- //#region ../api/src/bookingRefundOutcomes.ts
3287
- const STANDARD_LINE_ITEM_REFUND_INVALID_CODES = [
3288
- "refund_blocked_by_live_payment_terms",
3289
- "missing_amount",
3290
- "invalid_amount",
3291
- "amount_exceeds_remaining",
3292
- "credit_refunds_disabled",
3293
- "missing_credit_customer",
3294
- "deposit_refund_override_required",
3295
- "refund_revoke_requires_full_line_refund",
3296
- "unified_order_link_required",
3297
- "payment_receipt_not_found",
3298
- "payment_receipt_not_refundable",
3299
- "payment_receipt_attribution_required"
3300
- ];
3301
- const EVENT_ATTENDEE_REFUND_INVALID_CODES = ["manual_booking_not_refundable", ...STANDARD_LINE_ITEM_REFUND_INVALID_CODES];
3302
- [...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
3303
- [...EVENT_ATTENDEE_REFUND_INVALID_CODES, ...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
3304
- [...STANDARD_LINE_ITEM_REFUND_INVALID_CODES, ...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
3305
- //#endregion
3306
- //#region ../api/src/bookingVerticals.ts
3307
- /**
3308
- * Transport adapters for the booking-vertical domain.
3309
- *
3310
- * The domain catalog and all pure resolution/selection rules live in core;
3311
- * this module owns only the Zod boundary used by API payloads.
3312
- */
3313
- function formatRawDiagnosticValue(value) {
3314
- const serialized = JSON.stringify(value);
3315
- return serialized === void 0 ? String(value) : serialized;
3316
- }
3317
- function describeSiteVerticalConfigIssue(issue) {
3318
- switch (issue.code) {
3319
- case "unknown_vertical": return `${issue.code}: ${formatRawDiagnosticValue(issue.rawValue)}`;
3320
- case "unknown_preset": return `${issue.code}: ${formatRawDiagnosticValue(issue.rawValue)}`;
3321
- case "missing_vertical":
3322
- case "empty_selected_presets":
3323
- case "preset_vertical_mismatch":
3324
- case "duplicate_preset_id":
3325
- case "duplicate_canonical_behaviour":
3326
- case "future_preset_selected": return issue.code;
3327
- default: return assertNever(issue);
3328
- }
3329
- }
3330
- const VerticalIdSchema = z.string().trim().transform((value, ctx) => {
3331
- const parsed = parseVerticalId(value);
3332
- if (!parsed) {
3333
- ctx.addIssue({
3334
- code: z.ZodIssueCode.custom,
3335
- message: "Unknown booking vertical"
3336
- });
3337
- return z.NEVER;
3338
- }
3339
- return parsed;
3340
- });
3341
- const VerticalPresetIdSchema = z.string().trim().transform((value, ctx) => {
3342
- const parsed = parseVerticalPresetId(value);
3343
- if (!parsed) {
3344
- ctx.addIssue({
3345
- code: z.ZodIssueCode.custom,
3346
- message: "Unknown booking preset"
3347
- });
3348
- return z.NEVER;
3349
- }
3350
- return parsed;
3351
- });
3352
- z.object({
3353
- verticalId: VerticalIdSchema.nullable(),
3354
- selectedPresetIds: z.array(VerticalPresetIdSchema).max(20)
3355
- }).transform((value, ctx) => {
3356
- const resolved = resolveSiteVerticalBookingConfig(value);
3357
- if (resolved.kind === "invalid") {
3358
- ctx.addIssue({
3359
- code: z.ZodIssueCode.custom,
3360
- message: `Invalid booking vertical config: ${resolved.issues.map(describeSiteVerticalConfigIssue).join(", ")}`
3361
- });
3362
- return z.NEVER;
3363
- }
3364
- return resolved.config;
3365
- });
3366
- //#endregion
3367
- //#region ../api/src/appointmentServiceVisibility.ts
3368
- const APPOINTMENT_SERVICE_VISIBILITY_VALUES = ["public", "unlisted"];
3369
- //#endregion
3370
- //#region ../api/src/appointmentSetup.ts
3371
- const APPOINTMENT_SETUP_MAX_MINUTES = 1440;
3372
- const appointmentSetupRefSchema = z.discriminatedUnion("kind", [z.object({
3373
- kind: z.literal("existing"),
3374
- id: z.string().min(1)
3375
- }), z.object({
3376
- kind: z.literal("new"),
3377
- draftId: z.string().min(1)
3378
- })]);
3379
- const appointmentSetupVenueChoiceSchema = z.discriminatedUnion("kind", [
3380
- z.object({ kind: z.literal("none") }),
3381
- z.object({
3382
- kind: z.literal("existing"),
3383
- venueId: z.string().min(1)
3384
- }),
3385
- z.object({
3386
- kind: z.literal("create"),
3387
- draftId: z.string().min(1),
3388
- title: z.string().trim().min(1),
3389
- description: z.string().nullable(),
3390
- timezone: z.string().trim().min(1).nullable(),
3391
- locationValue: locationValueSchema.nullable().optional(),
3392
- addressJson: z.record(z.string(), z.unknown()).optional(),
3393
- locationJson: z.object({
3394
- lat: z.number(),
3395
- lng: z.number()
3396
- }).nullable().optional()
3397
- })
3398
- ]);
3399
- const appointmentSetupPaymentDraftSchema = z.discriminatedUnion("kind", [
3400
- z.object({ kind: z.literal("free") }),
3401
- z.object({ kind: z.literal("paid_online") }),
3402
- z.object({ kind: z.literal("paid_offline") })
3403
- ]);
3404
- const appointmentSetupServiceAssignmentDraftSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("all_practitioners") }), z.object({
3405
- kind: z.literal("selected_practitioners"),
3406
- resourceRefs: z.array(appointmentSetupRefSchema)
3407
- })]);
3408
- const appointmentSetupServiceDraftSchema = z.object({
3409
- ref: appointmentSetupRefSchema,
3410
- title: z.string().trim().min(1),
3411
- description: z.string().nullable(),
3412
- durationMinutes: z.number().int().positive().max(APPOINTMENT_SETUP_MAX_MINUTES),
3413
- prepMinutes: z.number().int().nonnegative().max(APPOINTMENT_SETUP_MAX_MINUTES).default(0),
3414
- cleanupMinutes: z.number().int().nonnegative().max(APPOINTMENT_SETUP_MAX_MINUTES).default(0),
3415
- priceAmount: z.number().int().nonnegative().nullable(),
3416
- isActive: z.boolean(),
3417
- visibility: z.enum(APPOINTMENT_SERVICE_VISIBILITY_VALUES).default("public"),
3418
- locationType: z.union([
3419
- z.literal("virtual"),
3420
- z.literal("in_person"),
3421
- z.literal("hybrid")
3422
- ]),
3423
- venue: appointmentSetupVenueChoiceSchema,
3424
- timezone: z.string().trim().min(1).nullable(),
3425
- payment: appointmentSetupPaymentDraftSchema,
3426
- assignment: appointmentSetupServiceAssignmentDraftSchema,
3427
- /**
3428
- * The service's category, or null for "Other" (issue 1403). Omitted leaves
3429
- * an existing service's category alone and puts a new one in "Other".
3430
- */
3431
- categoryId: z.string().uuid().nullable().optional()
3432
- }).superRefine((service, ctx) => {
3433
- if (service.payment.kind !== "free" && (service.priceAmount === null || service.priceAmount <= 0)) ctx.addIssue({
3434
- code: "custom",
3435
- path: ["priceAmount"],
3436
- message: "Paid appointment services need a positive price."
3437
- });
3438
- if (service.payment.kind === "free" && service.priceAmount !== null && service.priceAmount > 0) ctx.addIssue({
3439
- code: "custom",
3440
- path: ["priceAmount"],
3441
- message: "Free appointment services cannot carry a positive price."
3442
- });
3443
- });
3444
- const appointmentSetupPractitionerDraftSchema = z.object({
3445
- ref: appointmentSetupRefSchema,
3446
- displayName: z.string().trim().min(1),
3447
- bio: z.string().nullable(),
3448
- timezone: z.string().trim().min(1),
3449
- colorHex: z.string().nullable()
3450
- });
3451
- const appointmentSetupWeeklyWindowDraftSchema = z.object({
3452
- weekday: z.number().int().min(0).max(6),
3453
- startTime: z.string(),
3454
- endTime: z.string()
3455
- });
3456
- const appointmentSetupStartTimePolicyDraftSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("automatic_spacing") }), z.object({
3457
- kind: z.literal("regular_interval"),
3458
- intervalMinutes: z.union([
3459
- z.literal(10),
3460
- z.literal(15),
3461
- z.literal(20),
3462
- z.literal(30),
3463
- z.literal(45),
3464
- z.literal(60)
3465
- ])
3466
- })]);
3467
- const appointmentSetupAvailabilityDraftSchema = z.object({
3468
- kind: z.literal("weekly_windows"),
3469
- resourceRef: appointmentSetupRefSchema,
3470
- serviceRef: appointmentSetupRefSchema.nullable(),
3471
- windows: z.array(appointmentSetupWeeklyWindowDraftSchema),
3472
- startTimePolicy: appointmentSetupStartTimePolicyDraftSchema.optional()
3473
- });
3474
- const appointmentSetupBookingNoticeSchema = z.object({
3475
- minLeadMinutes: z.number().int().nonnegative().max(672 * 60),
3476
- maxBookingNoticeMinutes: z.number().int().nonnegative().max(10 * 365 * 24 * 60)
3477
- });
3478
- z.object({
3479
- services: z.array(appointmentSetupServiceDraftSchema),
3480
- practitioners: z.array(appointmentSetupPractitionerDraftSchema),
3481
- availability: z.array(appointmentSetupAvailabilityDraftSchema),
3482
- bookingNotice: appointmentSetupBookingNoticeSchema
3483
- });
3484
- //#endregion
3485
- //#region ../api/src/siteBanner.ts
3486
- const SITE_BANNER_SCOPE_VALUES = ["homepage", "all-pages"];
3487
- const SITE_BANNER_TONE_VALUES = [
3488
- "announcement",
3489
- "promotion",
3490
- "notice",
3491
- "warning"
3492
- ];
3493
- const siteBannerScopeSchema = z.enum(SITE_BANNER_SCOPE_VALUES);
3494
- const siteBannerToneSchema = z.enum(SITE_BANNER_TONE_VALUES);
3495
- const siteBannerBodySchema = RichTextDocSchema;
3496
- const siteBannerCtaSchema = z.object({
3497
- label: z.string().trim().min(1),
3498
- link: linkPayloadSchema
3499
- });
3500
- z.discriminatedUnion("enabled", [z.object({ enabled: z.literal(false) }), z.object({
3501
- enabled: z.literal(true),
3502
- scope: siteBannerScopeSchema,
3503
- tone: siteBannerToneSchema,
3504
- body: siteBannerBodySchema,
3505
- cta: siteBannerCtaSchema.nullable()
3506
- })]).superRefine((value, ctx) => {
3507
- if (!value.enabled) return;
3508
- const analysis = analyzeSiteBannerBody(value.body);
3509
- for (const issue of analysis.issues) ctx.addIssue({
3510
- code: z.ZodIssueCode.custom,
3511
- path: ["body"],
3512
- message: siteBannerBodyIssueMessage(issue)
3513
- });
3514
- });
3515
- const EMPTY_SITE_BANNER_BODY = {
3516
- type: "doc",
3517
- content: [{
3518
- type: "paragraph",
3519
- content: []
3520
- }]
3521
- };
3522
- function analyzeSiteBannerBody(body) {
3523
- const parsed = RichTextDocSchema.safeParse(body);
3524
- const sanitizedBody = parsed.success ? sanitizeSiteBannerBodyInternal(parsed.data, { limitParagraphs: false }) : EMPTY_SITE_BANNER_BODY;
3525
- const paragraphs = collectParagraphs(sanitizedBody);
3526
- const textLength = paragraphs.reduce((total, paragraph) => total + paragraphTextLength(paragraph), 0);
3527
- const issues = [];
3528
- if (textLength === 0) issues.push("empty");
3529
- if (paragraphs.length > 2) issues.push("too-many-paragraphs");
3530
- if (textLength > 320) issues.push("too-long");
3531
- return {
3532
- sanitizedBody,
3533
- textLength,
3534
- paragraphCount: paragraphs.length,
3535
- issues
3536
- };
3537
- }
3538
- function siteBannerBodyIssueMessage(issue) {
3539
- switch (issue) {
3540
- case "empty": return "Banner message is required when the banner is enabled.";
3541
- case "too-many-paragraphs": return `Banner message must be 2 paragraphs or fewer.`;
3542
- case "too-long": return `Banner message must be 320 characters or fewer.`;
3543
- }
3544
- }
3545
- function sanitizeSiteBannerBodyInternal(input, options) {
3546
- const content = normalizeTopLevelNodes(input.content, options);
3547
- return {
3548
- type: "doc",
3549
- content: content.length > 0 ? content : EMPTY_SITE_BANNER_BODY.content
3550
- };
3551
- }
3552
- function normalizeTopLevelNodes(nodes, options) {
3553
- const out = [];
3554
- let inlineBuffer = [];
3555
- const flushInlineBuffer = () => {
3556
- if (inlineBuffer.length === 0) return;
3557
- out.push({
3558
- type: "paragraph",
3559
- content: inlineBuffer
3560
- });
3561
- inlineBuffer = [];
3562
- };
3563
- for (const node of nodes) {
3564
- const normalized = sanitizeNode(node, options);
3565
- for (const child of normalized) {
3566
- if (child.type === "text") {
3567
- inlineBuffer.push(child);
3568
- continue;
3569
- }
3570
- flushInlineBuffer();
3571
- out.push(child);
3572
- }
3573
- }
3574
- flushInlineBuffer();
3575
- return options.limitParagraphs ? out.slice(0, 2) : out;
3576
- }
3577
- function sanitizeNode(node, options) {
3578
- if (node.type === "paragraph") return [{
3579
- type: "paragraph",
3580
- content: sanitizeInlineNodes(node.content ?? [])
3581
- }];
3582
- if (node.type === "text") {
3583
- const text = typeof node.text === "string" ? node.text : "";
3584
- const marks = sanitizeMarks(node.marks);
3585
- return text.length > 0 ? [{
3586
- type: "text",
3587
- text,
3588
- ...marks ? { marks } : {}
3589
- }] : [];
3590
- }
3591
- if (Array.isArray(node.content)) return normalizeTopLevelNodes(node.content, options);
3592
- return [];
3593
- }
3594
- function sanitizeInlineNodes(nodes) {
3595
- return nodes.flatMap((node) => {
3596
- if (node.type === "text") {
3597
- const text = typeof node.text === "string" ? node.text : "";
3598
- if (text.length === 0) return [];
3599
- const marks = sanitizeMarks(node.marks);
3600
- return [{
3601
- type: "text",
3602
- text,
3603
- ...marks ? { marks } : {}
3604
- }];
3605
- }
3606
- if (Array.isArray(node.content)) return sanitizeInlineNodes(node.content);
3607
- return [];
3608
- });
3609
- }
3610
- function sanitizeMarks(marks) {
3611
- if (!Array.isArray(marks) || marks.length === 0) return;
3612
- const sanitized = marks.flatMap((mark) => {
3613
- if (mark.type === "bold" || mark.type === "strong" || mark.type === "italic" || mark.type === "em") return [{ type: mark.type }];
3614
- if (mark.type === "link" && isRecord$1(mark.attrs) && typeof mark.attrs.href === "string") {
3615
- const attrs = { href: mark.attrs.href };
3616
- if (typeof mark.attrs.target === "string" && mark.attrs.target.trim().length > 0) attrs.target = mark.attrs.target;
3617
- if (typeof mark.attrs.rel === "string" && mark.attrs.rel.trim().length > 0) attrs.rel = mark.attrs.rel;
3618
- return [{
3619
- type: "link",
3620
- attrs
3621
- }];
3622
- }
3623
- return [];
3624
- });
3625
- return sanitized.length > 0 ? sanitized : void 0;
3626
- }
3627
- function paragraphTextLength(paragraph) {
3628
- return collectText(paragraph).length;
3629
- }
3630
- function collectParagraphs(doc) {
3631
- return (doc.content ?? []).filter((node) => node.type === "paragraph");
3632
- }
3633
- function collectText(node) {
3634
- if (node.type === "text") return node.text ?? "";
3635
- return (node.content ?? []).map(collectText).join("");
3636
- }
3637
- z.object({ expectedRevision: z.number().int().nonnegative() }).strict();
3638
- z.enum(["public", "unlisted"], { error: "visibility must be 'public' or 'unlisted'" });
3639
- z.object({
3640
- restoredOccurrenceIds: z.array(z.string().uuid()),
3641
- excludedBookings: z.array(z.object({
3642
- attendeeId: z.string().uuid(),
3643
- occurrenceId: z.string().uuid(),
3644
- customerId: z.string().uuid(),
3645
- customerName: z.string().nullable(),
3646
- customerEmail: z.string().nullable()
3647
- }))
3648
- });
3649
- //#endregion
3650
- //#region ../api/src/navigationMenuValidation.ts
3651
- function hasChildren(item) {
3652
- return Array.isArray(item.children) && item.children.length > 0;
3653
- }
3654
- function isCartLinkMissingVisibleLabel(link) {
3655
- return link?.kind === "cart" && link.label?.kind === "icon-with-label" && (typeof link.label.label !== "string" || link.label.label.trim().length === 0);
3656
- }
3657
- /**
3658
- * Recursively collects portal-link constraints for a single menu tree.
3659
- * Rules:
3660
- * - At most one portal link per menu.
3661
- * - Portal links must be root-level.
3662
- * - Portal links cannot have children.
3663
- */
3664
- function collectPortalLinkStats(items, depth = 0) {
3665
- const result = {
3666
- count: 0,
3667
- nestedLabels: [],
3668
- withChildrenLabels: []
3669
- };
3670
- for (const item of items) {
3671
- if (item.link?.kind === "portal") {
3672
- result.count += 1;
3673
- if (depth > 0) result.nestedLabels.push(item.label);
3674
- if (hasChildren(item)) result.withChildrenLabels.push(item.label);
3675
- }
3676
- if (hasChildren(item)) {
3677
- const child = collectPortalLinkStats((item.children ?? []).filter(isNavigationMenuValidationItem), depth + 1);
3678
- result.count += child.count;
3679
- result.nestedLabels.push(...child.nestedLabels);
3680
- result.withChildrenLabels.push(...child.withChildrenLabels);
3681
- }
3682
- }
3683
- return result;
3684
- }
3685
- /**
3686
- * Recursively collects cart-link constraints for a single menu tree.
3687
- * Rules:
3688
- * - Cart links must be root-level.
3689
- * - Cart links cannot have children.
3690
- * - Cart links cannot be CTA items.
3691
- * - Cart links using `icon-with-label` must provide visible text.
3692
- */
3693
- function collectCartLinkStats(items, depth = 0) {
3694
- const result = {
3695
- count: 0,
3696
- nestedLabels: [],
3697
- withChildrenLabels: [],
3698
- ctaLabels: [],
3699
- missingVisibleTextLabels: []
3700
- };
3701
- for (const item of items) {
3702
- if (item.link?.kind === "cart") {
3703
- result.count += 1;
3704
- if (depth > 0) result.nestedLabels.push(item.label);
3705
- if (hasChildren(item)) result.withChildrenLabels.push(item.label);
3706
- if (item.isCta === true) result.ctaLabels.push(item.label);
3707
- if (isCartLinkMissingVisibleLabel(item.link ?? null)) result.missingVisibleTextLabels.push(item.label);
3708
- }
3709
- if (hasChildren(item)) {
3710
- const child = collectCartLinkStats((item.children ?? []).filter(isNavigationMenuValidationItem), depth + 1);
3711
- result.count += child.count;
3712
- result.nestedLabels.push(...child.nestedLabels);
3713
- result.withChildrenLabels.push(...child.withChildrenLabels);
3714
- result.ctaLabels.push(...child.ctaLabels);
3715
- result.missingVisibleTextLabels.push(...child.missingVisibleTextLabels);
3716
- }
3717
- }
3718
- return result;
3719
- }
3720
- function isNavigationMenuValidationItem(value) {
3721
- if (!isRecord$1(value)) return false;
3722
- return typeof value.label === "string";
3723
- }
3724
- //#endregion
3725
- //#region ../api/src/aiPlayground.ts
3726
- const PreparedPagePreconditionSchema = z.object({
3727
- pageId: z.string().uuid(),
3728
- revision: z.number().int().nonnegative()
3729
- }).strict();
3730
- /**
3731
- * RFC-6902 JSON Patch Operations
3732
- * Standard JSON Patch format for AI Playground content updates
3733
- */
3734
- const Rfc6902PatchOp = z.discriminatedUnion("op", [
3735
- z.object({
3736
- op: z.literal("add"),
3737
- path: z.string(),
3738
- value: z.unknown()
3739
- }),
3740
- z.object({
3741
- op: z.literal("remove"),
3742
- path: z.string()
3743
- }),
3744
- z.object({
3745
- op: z.literal("replace"),
3746
- path: z.string(),
3747
- value: z.unknown()
3748
- }),
3749
- z.object({
3750
- op: z.literal("move"),
3751
- from: z.string(),
3752
- path: z.string()
3753
- }),
3754
- z.object({
3755
- op: z.literal("copy"),
3756
- from: z.string(),
3757
- path: z.string()
3758
- }),
3759
- z.object({
3760
- op: z.literal("add_block"),
3761
- blockKind: z.string(),
3762
- afterBlockId: z.string().nullable(),
3763
- content: z.record(z.string(), z.unknown()),
3764
- rationale: z.string()
3765
- }),
3766
- z.object({
3767
- op: z.literal("delete_block"),
3768
- blockId: z.string(),
3769
- rationale: z.string()
3770
- }),
3771
- z.object({
3772
- op: z.literal("reorder_block"),
3773
- blockId: z.string(),
3774
- afterBlockId: z.string().nullable(),
3775
- rationale: z.string()
3776
- })
3777
- ]);
3778
- z.object({ request: z.string().min(1).max(2e3) });
3779
- const ModelMultiPagePatchEnvelope = z.object({
3780
- pageId: z.string(),
3781
- blockId: z.string().optional(),
3782
- blockKind: z.string().optional(),
3783
- blockPurpose: z.string().optional().nullable(),
3784
- ops: z.array(Rfc6902PatchOp),
3785
- rationale: z.string(),
3786
- currentContent: z.record(z.string(), z.unknown()).optional()
3787
- });
3788
- const ModelMultiPageUpdateResponse = z.object({
3789
- patches: z.array(ModelMultiPagePatchEnvelope),
3790
- assistantMessage: z.string(),
3791
- pagesModified: z.number(),
3792
- toolCallsUsed: z.number()
3793
- });
3794
- /** Server-stamped wire proposals always carry their original page evidence. */
3795
- const MultiPagePatchEnvelope = ModelMultiPagePatchEnvelope.extend({ preparedAgainst: PreparedPagePreconditionSchema });
3796
- ModelMultiPageUpdateResponse.extend({ patches: z.array(MultiPagePatchEnvelope) });
3797
- //#endregion
3798
- //#region ../api/src/siteTerms.ts
3799
- const versionIdSchema = z.string().uuid().transform((value, ctx) => {
3800
- const parsed = parseSiteTermsVersionId(value);
3801
- if (parsed.ok) return parsed.value;
3802
- ctx.addIssue({
3803
- code: "custom",
3804
- message: "Invalid site terms version"
3805
- });
3806
- return z.NEVER;
3807
- });
3808
- z.object({
3809
- shown: z.discriminatedUnion("kind", [
3810
- z.object({ kind: z.literal("nothing") }),
3811
- z.object({
3812
- kind: z.literal("checkbox"),
3813
- versionId: versionIdSchema
3814
- }),
3815
- z.object({
3816
- kind: z.literal("already_agreed_line"),
3817
- versionId: versionIdSchema
3818
- })
3819
- ]),
3820
- agreed: z.boolean()
3821
- });
3822
- const siteTermsSourceSchema = z.discriminatedUnion("kind", [z.object({
3823
- kind: z.literal("written"),
3824
- body: z.custom(isCanonicalRichTextDoc)
3825
- }), z.object({
3826
- kind: z.literal("link"),
3827
- destination: z.discriminatedUnion("kind", [z.object({
3828
- kind: z.literal("page"),
3829
- identifier: z.string().trim().min(1)
3830
- }), z.object({
3831
- kind: z.literal("url"),
3832
- href: z.url({ protocol: /^https?$/ })
3833
- })])
3834
- })]);
3835
- z.discriminatedUnion("kind", [z.object({
3836
- kind: z.literal("publish"),
3837
- expectedRevision: z.number().int().positive().nullable(),
3838
- source: siteTermsSourceSchema,
3839
- askAgain: z.boolean()
3840
- }).strict(), z.object({
3841
- kind: z.literal("stop"),
3842
- expectedRevision: z.number().int().positive()
3843
- }).strict()]);
3844
- //#endregion
3845
- //#region src/data/materializeLoaderMedia.ts
3846
- function materializeMediaNode(value, index) {
3847
- if (Array.isArray(value)) return value.map((item) => materializeMediaNode(item, index));
3848
- if (!value || typeof value !== "object") return value;
3849
- if ("identifier" in value) {
3850
- const reference = mediaSchema.safeParse(value);
3851
- if (reference.success) {
3852
- const resolution = resolveManagedMediaReference(reference.data, index);
3853
- if (resolution.kind === "resolved") {
3854
- const { identifier: _identifier, ...usage } = reference.data;
3855
- return {
3856
- ...usage,
3857
- asset: resolution.asset
3858
- };
3859
- }
3860
- }
3861
- }
3862
- return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, materializeMediaNode(item, index)]));
3863
- }
3864
- /** Resolve render-only asset references before loader coercion removes response sidecars. */
3865
- function materializeLoaderMedia(payload) {
3866
- if (!payload || typeof payload !== "object" || !("mediaAssets" in payload) || !Array.isArray(payload.mediaAssets) || !payload.mediaAssets.length) return payload;
3867
- const index = indexRenderableMediaAssets(payload.mediaAssets.flatMap((asset) => {
3868
- const parsed = renderableMediaAssetSchema.safeParse(asset);
3869
- return parsed.success ? [parsed.data] : [];
3870
- }));
3871
- return index ? materializeMediaNode(payload, index) : payload;
3872
- }
3873
- //#endregion
3874
- //#region src/data/prefetchBlockData.ts
3875
- const SUPPORTED_LOADER_ENDPOINTS = SUPPORTED_LOADER_ENDPOINTS$1;
3876
- function isSupportedLoaderEndpoint(endpoint) {
3877
- return SUPPORTED_LOADER_ENDPOINTS.includes(endpoint);
3878
- }
3879
- const ENTRY_REF_KEYS = [
3880
- "identifier",
3881
- "entryIdentifier",
3882
- "meditationIdentifier",
3883
- "entryId",
3884
- "slug"
3885
- ];
3886
- function isRecord(value) {
3887
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
3888
- }
3889
- function extractManualEntryRef(item) {
3890
- if (typeof item === "string") {
3891
- const trimmed = item.trim();
3892
- return trimmed.length > 0 ? trimmed : null;
3893
- }
3894
- if (!isRecord(item)) return null;
3895
- for (const key of ENTRY_REF_KEYS) {
3896
- const raw = item[key];
3897
- if (typeof raw === "string" && raw.trim().length > 0) return raw.trim();
3898
- }
3899
- const fallbackId = item.id;
3900
- if (typeof fallbackId === "string" && fallbackId.trim().length > 0) return fallbackId.trim();
3901
- return null;
3902
- }
3903
- function extractManualEntryRefsFromArray(items) {
3904
- return items.map(extractManualEntryRef).filter((ref) => typeof ref === "string");
3905
- }
3906
- function parseManualEntryRefsValue(value) {
3907
- if (Array.isArray(value)) {
3908
- const refs = extractManualEntryRefsFromArray(value);
3909
- return refs.length > 0 ? refs : void 0;
3910
- }
3911
- if (typeof value === "string" && value.trim()) try {
3912
- const parsed = JSON.parse(value);
3913
- if (!Array.isArray(parsed)) return void 0;
3914
- const refs = extractManualEntryRefsFromArray(parsed);
3915
- return refs.length > 0 ? refs : void 0;
3916
- } catch (error) {
3917
- if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") console.warn("[prefetchBlockData] Failed to parse manual entry refs JSON", {
3918
- value,
3919
- error: error instanceof Error ? error.message : String(error)
3920
- });
3921
- return;
3922
- }
3923
- }
3924
- function parseManualEntryRefs(...values) {
3925
- for (const value of values) {
3926
- const parsed = parseManualEntryRefsValue(value);
3927
- if (parsed && parsed.length > 0) return parsed;
3928
- }
3929
- }
3930
- const loaderAdapters = {
3931
- listPublishedEntries,
3932
- getPublishedEntryPreview,
3933
- listPublicEvents,
3934
- listPublicEventCalendarWindow: ({ client, params }) => client.listPublicEventCalendarWindow({
3935
- ...calendarWindowQuerySchema.parse(params),
3936
- siteId: requireStringParam(params, "siteId", "listPublicEventCalendarWindow")
3937
- }),
3938
- listPublicRecurringSchedule,
3939
- getPublicEventDetails,
3940
- listPublicRouteCandidates,
3941
- listPublicTeamMembers,
3942
- listPublicProducts,
3943
- listPublicPasses,
3944
- listPublicMemberships,
3945
- getPublicFormById,
3946
- getPublicBookingServices,
3947
- getPublicWeeklySlotAvailability
3948
- };
3949
- function readStringParam(params, key) {
3950
- const value = params[key];
3951
- return value && value.length > 0 ? value : void 0;
3952
- }
3953
- function requireStringParam(params, key, endpoint) {
3954
- const value = readStringParam(params, key);
3955
- if (!value) throw new Error(`${endpoint} requires ${key} param`);
3956
- return value;
3957
- }
3958
- function parsePositiveIntegerParam(params, key) {
3959
- const value = params[key];
3960
- const parsed = value === void 0 ? void 0 : Number.parseInt(value, 10);
3961
- return typeof parsed === "number" && Number.isInteger(parsed) && parsed > 0 ? parsed : void 0;
3962
- }
3963
- function parseEntryOrder(value) {
3964
- if (value === void 0) return void 0;
3965
- switch (value) {
3966
- case "order": return "manual";
3967
- case "newest":
3968
- case "oldest":
3969
- case "title": return value;
3970
- default: return;
3971
- }
3972
- }
3973
- function parsePublicEventKind(value) {
3974
- if (value === void 0) return void 0;
3975
- switch (value) {
3976
- case "all":
3977
- case "events": return value;
3978
- default: return;
3979
- }
3980
- }
3981
- async function listPublishedEntries({ client, params }) {
3982
- const siteId = requireStringParam(params, "siteId", "listPublishedEntries");
3983
- const type = requireStringParam(params, "type", "listPublishedEntries");
3984
- const stage = readStringParam(params, "stage");
3985
- const mode = readStringParam(params, "mode");
3986
- const parsedEntryRefs = mode === "manual" ? parseManualEntryRefs(params.identifiers, params.entryRefs, params.entryIds) : void 0;
3987
- if (mode === "manual" && (!parsedEntryRefs || parsedEntryRefs.length === 0)) return { entries: [] };
3988
- if (mode === "manual" && parsedEntryRefs) return await client.getEntriesByIdentifiers({
3989
- siteId,
3990
- contentType: type,
3991
- identifiers: parsedEntryRefs,
3992
- preview: stage === "preview"
3993
- });
3994
- return await client.getEntries(mapEntriesLoaderQuery(params, siteId, type));
3995
- }
3996
- function mapEntriesLoaderQuery(params, siteId, contentType) {
3997
- const rawOffset = readStringParam(params, "offset");
3998
- const offset = rawOffset === void 0 ? void 0 : Number(rawOffset);
3999
- return {
4000
- siteId,
4001
- contentType,
4002
- limit: parsePositiveIntegerParam(params, "limit"),
4003
- offset: offset !== void 0 && Number.isInteger(offset) && offset >= 0 ? offset : void 0,
4004
- order: parseEntryOrder(readStringParam(params, "orderBy")),
4005
- preview: readStringParam(params, "stage") === "preview"
4006
- };
4007
- }
4008
- async function getPublishedEntryPreview({ client, params }) {
4009
- return await client.getEntry({
4010
- siteId: requireStringParam(params, "siteId", "getPublishedEntryPreview"),
4011
- contentType: requireStringParam(params, "type", "getPublishedEntryPreview"),
4012
- slug: requireStringParam(params, "slug", "getPublishedEntryPreview")
4013
- });
4014
- }
4015
- async function listPublicEvents({ client, params }) {
4016
- return await client.listPublicEvents({
4017
- siteId: requireStringParam(params, "siteId", "listPublicEvents"),
4018
- limit: parsePositiveIntegerParam(params, "limit"),
4019
- from: readStringParam(params, "from"),
4020
- to: readStringParam(params, "to"),
4021
- afterStartsAt: readStringParam(params, "afterStartsAt"),
4022
- afterId: readStringParam(params, "afterId"),
4023
- stage: readStringParam(params, "stage"),
4024
- categoryIds: readStringParam(params, "categoryIds"),
4025
- venueId: readStringParam(params, "venueId"),
4026
- staffMemberId: readStringParam(params, "staffMemberId"),
4027
- kind: parsePublicEventKind(readStringParam(params, "kind")),
4028
- eventSurface: readStringParam(params, "eventSurface"),
4029
- eventPresets: readStringParam(params, "eventPresets"),
4030
- scheduleScope: readStringParam(params, "scheduleScope"),
4031
- detailLevel: readStringParam(params, "detailLevel") === "listing" ? "listing" : void 0,
4032
- readProfile: readStringParam(params, "readProfile"),
4033
- seriesId: readStringParam(params, "seriesId"),
4034
- includeOccurrenceId: readStringParam(params, "includeOccurrenceId")
4035
- });
4036
- }
4037
- async function listPublicRecurringSchedule(input) {
4038
- return projectRecurringSchedule(await listPublicEvents(input));
4039
- }
4040
- async function getPublicEventDetails({ client, params }) {
4041
- return await client.getPublicEventDetails({
4042
- siteId: requireStringParam(params, "siteId", "getPublicEventDetails"),
4043
- limit: parsePositiveIntegerParam(params, "limit"),
4044
- from: readStringParam(params, "from"),
4045
- to: readStringParam(params, "to"),
4046
- afterStartsAt: readStringParam(params, "afterStartsAt"),
4047
- afterId: readStringParam(params, "afterId"),
4048
- stage: readStringParam(params, "stage"),
4049
- categoryIds: readStringParam(params, "categoryIds"),
4050
- venueId: readStringParam(params, "venueId"),
4051
- staffMemberId: readStringParam(params, "staffMemberId"),
4052
- kind: readStringParam(params, "kind"),
4053
- eventSurface: readStringParam(params, "eventSurface"),
4054
- eventPresets: readStringParam(params, "eventPresets"),
4055
- scheduleScope: readStringParam(params, "scheduleScope"),
4056
- seriesId: readStringParam(params, "seriesId"),
4057
- includeOccurrenceId: readStringParam(params, "includeOccurrenceId")
4058
- });
4059
- }
4060
- async function listPublicRouteCandidates({ client, params }) {
4061
- const siteId = requireStringParam(params, "siteId", "listPublicRouteCandidates");
4062
- return { routes: (await client.getAllPublishedRoutes({ siteId })).items.flatMap((item) => {
4063
- if (!item.path) return [];
4064
- return [{
4065
- entityId: item.entityId,
4066
- path: item.path,
4067
- title: item.title,
4068
- kind: item.entityType,
4069
- contentTypeKey: item.contentTypeKey ?? null
4070
- }];
4071
- }) };
4072
- }
4073
- async function listPublicTeamMembers({ client, params }) {
4074
- return await client.listPublicTeamMembers({
4075
- siteId: requireStringParam(params, "siteId", "listPublicTeamMembers"),
4076
- stage: readStringParam(params, "stage")
4077
- });
4078
- }
4079
- async function listPublicProducts({ client, params }) {
4080
- return await client.listPublicProducts({
4081
- siteId: requireStringParam(params, "siteId", "listPublicProducts"),
4082
- stage: readStringParam(params, "stage") === "preview" ? "preview" : "published",
4083
- categorySelector: parsePublicProductCategorySelector(params.categorySelector)
4084
- });
4085
- }
4086
- async function listPublicPasses({ client, params }) {
4087
- return await client.listPublicPasses({
4088
- siteId: requireStringParam(params, "siteId", "listPublicPasses"),
4089
- categories: readStringParam(params, "categories")
4090
- });
4091
- }
4092
- async function listPublicMemberships({ client, params }) {
4093
- return await client.listPublicMemberships({
4094
- siteId: requireStringParam(params, "siteId", "listPublicMemberships"),
4095
- categories: readStringParam(params, "categories")
4096
- });
4097
- }
4098
- async function getPublicFormById({ client, params }) {
4099
- return await client.getPublicFormById({
4100
- formId: requireStringParam(params, "formId", "getPublicFormById"),
4101
- siteId: requireStringParam(params, "siteId", "getPublicFormById")
4102
- });
4103
- }
4104
- async function getPublicBookingServices({ client, params }) {
4105
- return await client.getPublicBookingServices({
4106
- siteId: requireStringParam(params, "siteId", "getPublicBookingServices"),
4107
- ids: readStringParam(params, "ids")
4108
- });
4109
- }
4110
- async function getPublicWeeklySlotAvailability({ client, params }) {
4111
- return await client.getPublicWeeklySlotAvailability({
4112
- siteId: requireStringParam(params, "siteId", "getPublicWeeklySlotAvailability"),
4113
- serviceId: requireStringParam(params, "serviceId", "getPublicWeeklySlotAvailability"),
4114
- resourceId: readStringParam(params, "resourceId"),
4115
- horizonWeeks: parsePositiveIntegerParam(params, "horizonWeeks"),
4116
- timezone: readStringParam(params, "timezone")
4117
- });
4118
- }
4119
- /** Rendering consumers retain the request identity with the loaded values. */
4120
- async function prefetchBlockDataWithFailures(page, context, client, options) {
4121
- return prefetchBlockDataWithFailures$1(page, context, sdkPrefetchOptions(normalizeLoaderParams, context, client, options));
4122
- }
4123
- function sdkPrefetchOptions(normalize, context, client, options) {
4124
- const { customBlocks } = options ?? {};
4125
- const customBlockMap = new Map((customBlocks ?? []).map((block) => [block.id, block]));
4126
- return {
4127
- apiClient: async ({ endpoint, params }) => {
4128
- if (!isSupportedLoaderEndpoint(endpoint)) throw new Error(`Unsupported loader endpoint: ${endpoint}. SDK only supports: ${SUPPORTED_LOADER_ENDPOINTS.join(", ")}`);
4129
- const resolvedParams = normalize(endpoint, params, context);
4130
- return materializeLoaderMedia(await loaderAdapters[endpoint]({
4131
- client,
4132
- params: resolvedParams
4133
- }));
4134
- },
4135
- isValidEndpoint: isSupportedLoaderEndpoint,
4136
- onError: (error, { block, loader }) => {
4137
- console.warn("[prefetchBlockData] failed to prefetch block data", {
4138
- block,
4139
- loader,
4140
- error
4141
- });
4142
- },
4143
- getCustomBlockLoaders: (kind) => sdkCustomLoaders(customBlockMap.get(kind))
4144
- };
4145
- }
4146
- function sdkCustomLoaders(block) {
4147
- return block?.dataLoaders ? Object.fromEntries(Object.entries(block.dataLoaders).map(([key, loader]) => [key, {
4148
- endpoint: loader.endpoint,
4149
- params: loader.params,
4150
- requiredParams: loader.requiredParams,
4151
- mode: loader.mode,
4152
- when: loader.when
4153
- }])) : void 0;
4154
- }
4155
- //#endregion
4156
- export { resolvePageRouteTarget as C, parseStoredVariant as D, toPresentationPage as E, isCanonicalRichTextDoc as O, resolveEntryRouteTarget as S, toEditorPresentationPage as T, buildLinkedContentEditTarget as _, SDK_WORKFLOW_ENDPOINT_PATTERN as a, defaultTransforms as b, navigationLinkInputSchemaOptions as c, resolveSdkFooterMode as d, buildPageRenderPlan as f, retargetJoinsAcrossOmissions as g, renderedJoinLayout as h, collectPortalLinkStats as i, footerModeSchema as l, joinSlotKey as m, prefetchBlockDataWithFailures as n, SDK_WORKFLOW_ID_PATTERN as o, composePageJoins as p, collectCartLinkStats as r, loaderFallbackScalarSchema as s, SUPPORTED_LOADER_ENDPOINTS as t, resolveFooterRenderPlan as u, resolveLinkedEntryInlineFieldEligibility as v, resolveRouteTarget as w, resolveAuthoredLinkHref as x, builtinTransformDefinitions as y };