@riverbankcms/sdk 0.155.0 → 0.156.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 (216) hide show
  1. package/dist/{PreviewEditorSidebar-CbSbqmz3.mjs → PreviewEditorSidebar-B4ESNPzL.mjs} +3 -3
  2. package/dist/{PreviewEditorUI-CKKnAw11.mjs → PreviewEditorUI-BdUVaGOh.mjs} +3 -3
  3. package/dist/{SdkPreviewModeRuntime-wLkXrWy9.mjs → SdkPreviewModeRuntime-C4V3BvxK.mjs} +1122 -1079
  4. package/dist/{SiteChromeCustomizeContext-BQ8vvKb-.mjs → SiteChromeCustomizeContext-3gmd26Mn.mjs} +1019 -517
  5. package/dist/_dts/ai/src/contracts/proposals.d.ts +624 -624
  6. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +856 -856
  7. package/dist/_dts/api/src/accountApi.d.ts +5 -5
  8. package/dist/_dts/api/src/aiPlayground.d.ts +2 -2
  9. package/dist/_dts/api/src/bookingRecords.d.ts +2 -22
  10. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +1 -1
  11. package/dist/_dts/api/src/contentRuntime.d.ts +5 -2
  12. package/dist/_dts/api/src/footerCompositionContracts.d.ts +1 -1
  13. package/dist/_dts/api/src/navigation/linkValue.d.ts +1 -1
  14. package/dist/_dts/api/src/navigation/types.d.ts +1 -1
  15. package/dist/_dts/api/src/public/types.d.ts +2 -1
  16. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +1 -1
  17. package/dist/_dts/api/src/publicExperience/eventEndpoints.d.ts +3 -3
  18. package/dist/_dts/api/src/publicExperience/siteEndpoints.d.ts +1 -1
  19. package/dist/_dts/api/src/sdkBlockContentAdmission.d.ts +1 -1
  20. package/dist/_dts/api/src/sdkConfig/contracts.d.ts +2 -1
  21. package/dist/_dts/api/src/sdkContracts.d.ts +2 -1
  22. package/dist/_dts/api/src/sdkPageDesign.d.ts +9 -9
  23. package/dist/_dts/api/src/sdkThemeWire.d.ts +182 -182
  24. package/dist/_dts/api/src/siteOnboarding.d.ts +1 -1
  25. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +3 -1
  26. package/dist/_dts/api/src/siteSettings.d.ts +2 -2
  27. package/dist/_dts/api/src/teamMembers.d.ts +1 -1
  28. package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/useLayoutGridMoveAnimation.d.ts +13 -0
  29. package/dist/_dts/blocks/src/client/portal.d.ts +5 -0
  30. package/dist/_dts/blocks/src/contracts/event-registration.d.ts +141 -0
  31. package/dist/_dts/blocks/src/contracts/events.d.ts +21 -0
  32. package/dist/_dts/blocks/src/contracts/footer.d.ts +130 -0
  33. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +1 -1
  34. package/dist/_dts/blocks/src/contracts/site-chrome.d.ts +10 -0
  35. package/dist/_dts/blocks/src/customer-portal/client.d.ts +62 -0
  36. package/dist/_dts/blocks/src/customer-portal/components/PortalLoginForm.d.ts +16 -0
  37. package/dist/_dts/blocks/src/customer-portal/components/badge.d.ts +6 -0
  38. package/dist/_dts/blocks/src/customer-portal/components/bookings/AppointmentBeforeYouComeTask.d.ts +29 -0
  39. package/dist/_dts/blocks/src/customer-portal/components/bookings/BookingsSection.d.ts +22 -0
  40. package/dist/_dts/blocks/src/customer-portal/components/bookings/BookingsTable.d.ts +9 -0
  41. package/dist/_dts/blocks/src/customer-portal/components/bookings/EventRow.d.ts +9 -0
  42. package/dist/_dts/blocks/src/customer-portal/components/bookings/EventSeriesRegistrationRow.d.ts +8 -0
  43. package/dist/_dts/blocks/src/customer-portal/components/bookings/EventSeriesRegistrationTableRow.d.ts +22 -0
  44. package/dist/_dts/blocks/src/customer-portal/components/bookings/PortalAppointmentRescheduleFlow.d.ts +7 -0
  45. package/dist/_dts/blocks/src/customer-portal/components/bookings/ScalarQuestionInput.d.ts +11 -0
  46. package/dist/_dts/blocks/src/customer-portal/components/bookings/WaitlistCard.d.ts +8 -0
  47. package/dist/_dts/blocks/src/customer-portal/components/bookings/WaitlistsSection.d.ts +19 -0
  48. package/dist/_dts/blocks/src/customer-portal/components/bookings/bookingsTypes.d.ts +11 -0
  49. package/dist/_dts/blocks/src/customer-portal/components/bookings/eventGuestDrafts.d.ts +6 -0
  50. package/dist/_dts/blocks/src/customer-portal/components/bookings/eventSeriesRegistrationPresentation.d.ts +8 -0
  51. package/dist/_dts/blocks/src/customer-portal/components/bookings/usePortalCancelFlow.d.ts +36 -0
  52. package/dist/_dts/blocks/src/customer-portal/components/bookings/usePortalCancelFlow.state.d.ts +43 -0
  53. package/dist/_dts/blocks/src/customer-portal/components/orders/OrdersSection.d.ts +8 -0
  54. package/dist/_dts/blocks/src/customer-portal/components/orders/orderInteraction.d.ts +63 -0
  55. package/dist/_dts/blocks/src/customer-portal/components/portal-modal.d.ts +8 -0
  56. package/dist/_dts/blocks/src/customer-portal/components/portalDeepLink.d.ts +19 -0
  57. package/dist/_dts/blocks/src/customer-portal/components/useMembershipCancelFlow.d.ts +13 -0
  58. package/dist/_dts/blocks/src/customer-portal/components/useMembershipCancelFlow.state.d.ts +32 -0
  59. package/dist/_dts/blocks/src/customer-portal/pages/AccessState.d.ts +11 -0
  60. package/dist/_dts/blocks/src/customer-portal/pages/DigitalProductView.d.ts +4 -0
  61. package/dist/_dts/blocks/src/customer-portal/pages/PageChrome.d.ts +9 -0
  62. package/dist/_dts/blocks/src/customer-portal/pages/PrintButton.d.ts +1 -0
  63. package/dist/_dts/blocks/src/customer-portal/pages/TicketCode.d.ts +3 -0
  64. package/dist/_dts/blocks/src/customer-portal/pages/TicketView.d.ts +4 -0
  65. package/dist/_dts/blocks/src/customer-portal/route-client.d.ts +9 -0
  66. package/dist/_dts/blocks/src/customer-portal/shared/bookingRoute.d.ts +9 -0
  67. package/dist/_dts/blocks/src/customer-portal/shared/checkoutUrls.d.ts +4 -0
  68. package/dist/_dts/blocks/src/customer-portal/shared/signedUrlUpload.d.ts +1 -0
  69. package/dist/_dts/blocks/src/customer-portal/shared/urlParams.d.ts +30 -0
  70. package/dist/_dts/blocks/src/customer-portal/state.d.ts +196 -0
  71. package/dist/_dts/blocks/src/customer-portal/tabs.d.ts +17 -0
  72. package/dist/_dts/blocks/src/portal/dateFormatting.d.ts +13 -0
  73. package/dist/_dts/blocks/src/portal/types.d.ts +7 -14
  74. package/dist/_dts/blocks/src/system/blocks/event-details.d.ts +1 -25
  75. package/dist/_dts/blocks/src/system/blocks/event-registration.d.ts +1 -141
  76. package/dist/_dts/blocks/src/system/blocks/events/eventSelectionFields.d.ts +3 -3
  77. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +3 -3
  78. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +135 -135
  79. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +3 -129
  80. package/dist/_dts/blocks/src/system/blocks/site-footer.d.ts +2 -5
  81. package/dist/_dts/blocks/src/system/blocks/site-header.d.ts +2 -5
  82. package/dist/_dts/blocks/src/system/constants/events.d.ts +1 -1
  83. package/dist/_dts/blocks/src/system/customize/facets.d.ts +2 -2
  84. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +82 -82
  85. package/dist/_dts/blocks/src/system/node/fragments/lookSlot.d.ts +2 -2
  86. package/dist/_dts/blocks/src/system/node/schema.d.ts +1 -1
  87. package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +21 -2
  88. package/dist/_dts/blocks/src/system/runtime/api/endpoints.d.ts +87 -3
  89. package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
  90. package/dist/_dts/blocks/src/system/runtime/api/schemas/events.d.ts +1 -1
  91. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +1 -1
  92. package/dist/_dts/blocks/src/system/runtime/api/types/portal.d.ts +16 -27
  93. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +6 -6
  94. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +4 -4
  95. package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableDates.d.ts +2 -5
  96. package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableSlots.d.ts +2 -5
  97. package/dist/_dts/blocks/src/system/runtime/lookSurfaces.d.ts +9 -9
  98. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/lookPresentation.d.ts +9 -9
  99. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +2 -2
  100. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +2 -2
  101. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +18 -18
  102. package/dist/_dts/blocks/src/system/runtime/nodes/form.interactive.d.ts +2 -10
  103. package/dist/_dts/blocks/src/system/runtime/nodes/form.types.d.ts +10 -0
  104. package/dist/_dts/blocks/src/system/runtime/nodes/shared/contract-schemas.d.ts +1 -1
  105. package/dist/_dts/blocks/src/system/runtime/shared/AppointmentRescheduleSlotOptions.d.ts +11 -0
  106. package/dist/_dts/blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.d.ts +73 -0
  107. package/dist/_dts/blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.state.d.ts +62 -0
  108. package/dist/_dts/blocks/src/system/runtime/shared/utils/demoPortalMagicLink.d.ts +1 -4
  109. package/dist/_dts/commerce/src/moneyDateUtils.d.ts +7 -0
  110. package/dist/_dts/core/src/booking-date-time.d.ts +5 -1
  111. package/dist/_dts/core/src/date-display.d.ts +4 -0
  112. package/dist/_dts/core/src/navigation-portal-labels.d.ts +1 -1
  113. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +13 -0
  114. package/dist/_dts/db/src/schemas/forms.d.ts +4 -4
  115. package/dist/_dts/preview-next/src/client/preview/PreviewEditingModeProvider.d.ts +7 -0
  116. package/dist/_dts/sdk/src/bookings/types.d.ts +0 -1
  117. package/dist/_dts/sdk/src/next/index.d.ts +1 -0
  118. package/dist/_dts/sdk/src/next/portal.d.ts +41 -0
  119. package/dist/_dts/sdk/src/next/resolveTheme.d.ts +4 -9
  120. package/dist/_dts/sdk/src/next/types.d.ts +8 -3
  121. package/dist/_dts/sdk/src/portal/client.d.ts +1 -0
  122. package/dist/_dts/sdk/src/portal/index.d.ts +4 -36
  123. package/dist/_dts/sdk/src/portal/token.d.ts +4 -20
  124. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +4 -1
  125. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +1 -28
  126. package/dist/_dts/sdk/src/version.d.ts +1 -1
  127. package/dist/_dts/theme-core/src/accordions/types.d.ts +4 -4
  128. package/dist/_dts/theme-core/src/buttons/types.d.ts +41 -41
  129. package/dist/_dts/theme-core/src/buttons/typography.d.ts +2 -2
  130. package/dist/_dts/theme-core/src/cards/types.d.ts +34 -34
  131. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  132. package/dist/_dts/theme-core/src/header/containerSchema.d.ts +2 -2
  133. package/dist/_dts/theme-core/src/hosted-booking-appearance.d.ts +1 -1
  134. package/dist/_dts/theme-core/src/inputs/types.d.ts +4 -4
  135. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +255 -255
  136. package/dist/_dts/theme-core/src/navigation/types.d.ts +6 -6
  137. package/dist/_dts/theme-core/src/palette/colors.d.ts +1 -1
  138. package/dist/_dts/theme-core/src/palette/curated/types.d.ts +2 -2
  139. package/dist/_dts/theme-core/src/schema.d.ts +294 -294
  140. package/dist/_dts/theme-core/src/shared/componentStyles.d.ts +1 -1
  141. package/dist/_dts/theme-core/src/site-styles/backgroundAppearance.d.ts +2 -2
  142. package/dist/_dts/theme-core/src/site-styles/compileFooterAgainstRow.d.ts +7 -7
  143. package/dist/_dts/theme-core/src/site-styles/headerPreferencesPersistence.d.ts +1 -1
  144. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +12 -12
  145. package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -2
  146. package/dist/_dts/theme-core/src/typography/schema.d.ts +27 -27
  147. package/dist/_dts/ui/src/button.d.ts +1 -1
  148. package/dist/_dts/ui/src/surface.d.ts +2 -2
  149. package/dist/_dts/ui/src/toggle.d.ts +2 -2
  150. package/dist/client/{BookingMailingListNote-CiW1dsz7.mjs → BookingMailingListNote-B9mP3Io9.mjs} +2 -2
  151. package/dist/client/{CardListItem-DVYTlYpS.mjs → CardListItem-D5rL2wPv.mjs} +3 -3
  152. package/dist/client/{CheckboxChoice-CUnPrBlC.mjs → CheckboxChoice-Bz6wLaBl.mjs} +1 -1
  153. package/dist/client/{DemoBookingPortalAccess-DEsn5F2C.mjs → DemoBookingPortalAccess-7BPVzfLU.mjs} +6 -10
  154. package/dist/client/{EventCombined.client-BdctbwnV.mjs → EventCombined.client-DZH5qHJl.mjs} +5 -5
  155. package/dist/client/{EventEmbeddedCheckoutStep-DAhQs6Jb.mjs → EventEmbeddedCheckoutStep-CV31Qvn2.mjs} +2 -2
  156. package/dist/client/{EventListing.client-BviZXfAE.mjs → EventListing.client-C19sjRGF.mjs} +2 -2
  157. package/dist/client/{LeafletStaticMap-BLTECfjU.mjs → LeafletStaticMap-DjUjYdzQ.mjs} +1 -1
  158. package/dist/client/{RichText-D3oE1_pw.mjs → RichText-DkKcVZwr.mjs} +2 -2
  159. package/dist/client/{ThemedButton-Ckj0Rfr_.mjs → ThemedButton-CTgpAXfL.mjs} +1 -1
  160. package/dist/client/{accordion-yBx6d4O2.mjs → accordion-R2-q5wo-.mjs} +1 -1
  161. package/dist/client/{bookingForm-CPDEsQci.mjs → bookingForm-VSU8nIdO.mjs} +12 -16
  162. package/dist/client/bookings.mjs +352 -64
  163. package/dist/client/{carousel-DCqjwd2s.mjs → carousel-BjPlY4ee.mjs} +2 -2
  164. package/dist/client/{carousel.client-Bx7XMF8-.mjs → carousel.client-Tnwvm0l1.mjs} +1 -1
  165. package/dist/client/{cart-DWJXrQxs.mjs → cart-DAPYTOP7.mjs} +3 -3
  166. package/dist/client/{checkout-CH4ypSLS.mjs → checkout-DGJTx4vB.mjs} +3 -3
  167. package/dist/client/client.mjs +61275 -61217
  168. package/dist/client/{context-BOs0m_iw.mjs → context-ByZBoKdq.mjs} +92 -209
  169. package/dist/client/{eventCalendar-CRylMllc.mjs → eventCalendar-CP5Z7iME.mjs} +8 -8
  170. package/dist/client/{eventCombined-DohTS3kp.mjs → eventCombined-D8nbUyxu.mjs} +4 -4
  171. package/dist/client/{eventDetails-qf-u9zcF.mjs → eventDetails-Bknq8k7E.mjs} +46 -44
  172. package/dist/client/{eventListing-Cg__X2vy.mjs → eventListing-BwMnPteX.mjs} +4 -4
  173. package/dist/client/{eventRegistration-CybWxswy.mjs → eventRegistration-COFk1mjw.mjs} +11 -11
  174. package/dist/client/{form-C-SGk6nq.mjs → form-BiWLd_me.mjs} +5 -5
  175. package/dist/client/{headerSection-BdzPaHqo.mjs → headerSection-BptDP4xF.mjs} +3 -3
  176. package/dist/client/hooks.mjs +22850 -22861
  177. package/dist/client/{locationMap-CEwIKmMb.mjs → locationMap-B-kPoqcK.mjs} +3 -3
  178. package/dist/client/{media-V_ShXXru.mjs → media-FjqQK4qS.mjs} +68 -1
  179. package/dist/client/{newsletterForm-CmwTltoS.mjs → newsletterForm-s_B8fCtT.mjs} +4 -4
  180. package/dist/client/portal/client.mjs +17419 -0
  181. package/dist/client/{productDetail-DjIzUwg3.mjs → productDetail-CS3GZMPi.mjs} +3 -3
  182. package/dist/client/{productList-D6JGFnMF.mjs → productList-Csc3WJDs.mjs} +3 -3
  183. package/dist/client/{propsDecoder-BRKz13eg.mjs → propsDecoder-Dn68GoQZ.mjs} +502 -2705
  184. package/dist/client/rendering/client.mjs +3303 -3612
  185. package/dist/client/rendering/islands.mjs +17 -17
  186. package/dist/client/rendering.mjs +46273 -46220
  187. package/dist/client/{routeIslandApiConfig-slAAILQ5.mjs → routeIslandApiConfig-DeBuevOO.mjs} +1 -1
  188. package/dist/client/{shop-C45K96_0.mjs → shop-B5EQbeUX.mjs} +7 -7
  189. package/dist/client/{shop-commerce-oGBiKT5d.mjs → shop-commerce-DYs7PdNL.mjs} +8 -8
  190. package/dist/client/{shop-commerce-store-H_HFPFZ8.mjs → shop-commerce-store-B2-DIPbg.mjs} +1 -1
  191. package/dist/client/{shopShared-D54T_LAV.mjs → shopShared-CE302Pfy.mjs} +4 -4
  192. package/dist/client/{useDiscountCodeUi-Dm2EUa03.mjs → useDiscountCodeUi-BZ02FBrV.mjs} +1 -1
  193. package/dist/client/{useEventPagination-0l_A8CxG.mjs → useEventPagination-VudQWKtG.mjs} +116 -6
  194. package/dist/preview-next/client/runtime.mjs +3 -3
  195. package/dist/{sdk-runtime-CjTM32Ah.mjs → sdk-runtime-C8Qh6r51.mjs} +1 -1
  196. package/dist/server/components.mjs +927 -262
  197. package/dist/server/config-template-validation.mjs +5 -3
  198. package/dist/server/config-validation.mjs +35200 -35211
  199. package/dist/server/config.mjs +35200 -35211
  200. package/dist/server/data.mjs +32783 -32794
  201. package/dist/server/date-time.mjs +14 -7
  202. package/dist/server/index.mjs +1 -1
  203. package/dist/server/navigation.mjs +1 -1
  204. package/dist/server/next.mjs +71470 -70677
  205. package/dist/server/page-converter.mjs +202 -213
  206. package/dist/server/portal.mjs +5 -51
  207. package/dist/server/prebuild.mjs +1 -1
  208. package/dist/server/rendering/server.mjs +1180 -722
  209. package/dist/server/rendering.mjs +922 -262
  210. package/dist/server/routing.mjs +39382 -41704
  211. package/dist/server/server.mjs +203 -214
  212. package/dist/server/theme-bridge.mjs +262 -2
  213. package/dist/{spinner-KVVZh8jd.mjs → spinner-Bi68Z_0o.mjs} +1 -1
  214. package/dist/styles/index.css +258 -2
  215. package/package.json +9 -1
  216. package/dist/_dts/sdk/src/portal/config.d.ts +0 -67
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { Ei as parseSiteId, En as defaultThemeTokens, Jn as paletteColorsSchema, K as corners, Nr as makeBoundaryId, Sr as assertNever$1, U as parseThemeForPersistence, Ui as __exportAll, Yn as paletteModeSchema, Zt as resolveSurface, ar as indexRenderableMediaAssets, gi as expectParsedBrandedId, ir as renderableMediaAssetSchema$1, mr as asDesignBlockId, mt as isThemeV2NormalEditorRawStyleFieldName, on as textColorStyle, or as resolveManagedMediaReference, rr as buildRenderableMediaAssetIndex, sr as mediaIdentifierSchema$2, vt as stripStaleTransitionStyleGroup, xr as asSiteStyleId, yr as asLayoutVariantKey } from "./ThemedButton-Bi0rgijy.mjs";
3
3
  import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-AR9eEn7j.mjs";
4
- import { $ as canCycleBackgroundOverrideValue, $i as bindingSchema, $n as createRoutingHelpers, $o as isEdited, $t as FileField, Ai as getCurrentResolveImageUrlContext, An as mapOptionValueForSelect, Ar as publicRouteCandidatesSchema, At as createEditorApiClientFactory, B as arrangementBlockControlsFor, Ba as parseCanonicalRuntimeBackground, Bi as formCopyFragment, Bn as createManifestFormAdapter, Bo as Info, Br as systemCustomizeFacetAppliesToLayoutVariant, Bt as SiteOptionPickerField, Ci as plainTextToInlineText, Cn as clientComponentRegistry, Cr as containerResponsiveThemeCss, Ct as useUISelector, Da as resolveItemSurface, Di as resolveImageUrlWithContext, Dn as useSdkConfig, Dr as getBlockDefinition, Dt as useEntryEditorController, Ea as arrangementSlotNames, Ei as getLinkedContentEntryMeta, En as SdkConfigProvider, Er as makeDefaultBlockComponent, Fa as defaultSectionTransitionVariantForFamily, Fi as faqAccordionFragment, Fn as prepareBlockEditorManifest, Fr as visibleHeaderClearancePx, Ft as EditLeaseDiscardedNotice, G as usePreviewPageDesignEditorState, Ga as Select, Gi as ctaRowFragment, Gn as getBlockManifestFromSdkConfig, Go as ChevronRight, Gr as buildThemeRuntime, Gt as loadMailingListAuthoringContext, H as arrangementVisibilityValues, Hi as testimonialsHeadingFragment, Ho as GripVertical, Hr as systemCustomizeFacetDefinitionsForBlock, Ht as OfferingsPreviewGroupOrderField, Ia as sectionTransitionFamilies, Ii as faqHeadingFragment, In as stripTopLevelRoutingUi, Ir as parseStoredVariant, It as EditLeaseModal, Ja as SelectTrigger, Ji as getResponsiveScopeSpec, Jr as getDefaultComponentRegistry, Jt as IconPickerField, K as PreviewDesignHistoryOrderProvider, Ka as SelectContent, Ki as heroCopyFragment, Kn as ApiRequestError, Ko as ChevronLeft, Kr as escapeStyleContent, Kt as MailingListTargetingProvider, La as sectionTransitionFamilyForBoundaryOptionId, Li as blogFeaturedPostFragment, Ln as evaluateVisibility, Lr as compileManifestContentContract, Lt as EditorWriteSurface, Ma as boundaryLayout, Mi as richTextFragment, Mn as FieldFrame, Mo as RotateCcw, Mr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Mt as useRetentionTicks, Na as composeBoundary, Ni as headingFragment, Nn as useField, Nr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, Nt as VIEWING_PARTICIPATION, Oa as resolveLookSlotSurfaces, Oi as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, On as hasEmptyOption, Or as normalizeBlockContent, Pa as sectionFactsForContent, Pi as cardFragment, Pn as hideThemeV2RawStyleFields, Pr as planSiteOverlayHeaderClearance, Q as backgroundColorTokens, Qi as defineFragment, Qn as API_ENDPOINTS, Qo as baselineRevisionOf, Qr as offeringsListingFor, Qt as ButtonWidgetProvider, Ra as sectionTransitionVariantForBoundaryOptionId, Ri as singleButtonFragment, Rn as getFieldIntent, Rr as validateManifestDraft, Rt as createSiteOptionApiLoader, Si as isInlineTextEmpty, Sn as useApiMediaUploader, Sr as ThemeScope, Ti as coerceLinkedContentEntriesPayload, Tn as BlockApiProvider, To as Upload, Tr as createCustomBlockRegistry, Tt as EntryControllerProvider, U as nextArrangementLookPin, Ui as ctaCopyFragment, Ur as systemCustomizeFacetLabelForValue, Ut as OfferingsPreviewWidgetProvider, V as arrangementOwnedFieldIds, Va as resolveSectionBackground, Vi as testimonialsCarouselFragment, Vo as Image, Vr as systemCustomizeFacetCurrentValue, Vt as SiteOptionWidgetProvider, W as PreviewPageDesignEditorStateProvider, Wi as heroCtaRowFragment, Wn as blocksKeys, Wr as systemCustomizeFacetNextValue, Wt as MailingListTargetingField, Xi as bodyCopyFragment, Xn as SURFACE_IDS, Xr as buildAppointmentServicesView, Xt as EntryPickerWidgetProvider, Ya as SelectValue, Yi as ctaButton, Yn as SURFACE_DOCUMENT_DATA_ATTRIBUTE, Yo as Button, Yr as buildLoadedOfferingsPreviewListing, Yt as EntryPickerField, Zi as runTransforms, Zn as resolveSurfaceDocumentAttributes, Zo as cn, Zr as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, Zt as ButtonVariantField, _a as surfaceResolutionContextFromTheme, _i as isObjectRecord, _n as decodePublicProductCategorySelectorQuery, _r as renderedFieldChanges, ai as Text$1, an as RichTextWidgetProvider, ao as TabsList, as as sameMailingListPlacementTargeting, at as planBackgroundTransition, ba as getGradientPreset, bi as coerceInlineTextWithFallback, bn as MediaEditorContextProvider, br as unsafeAsLinkedContentEntryId, bt as PreviewTextEditor, c as PreviewThemeOverlayProvider, ca as readStoredMode, ci as siblingPath, cn as LinkField, co as DialogContent, cr as unwrapResponse, cs as selectedContentVersionId, ct as resolvePreviewSidebarTab, da as resolvePublishedLook, di as publicEventsArraySchema, dn as PaletteProvider, do as DialogHeader, dr as useOptionalEditorUiStoreInstance, dt as registerPreviewRenewalFetcher, ea as arrangementHooksFromContent, ei as parseBlockIconValue, en as MediaField, er as createSnapshotFromPageRecord, et as defaultBackgroundOverrideForMode, fa as componentRuntimeRulesForTheme, fi as bookingConsentCarrierSchema, fn as usePalette, fo as DialogTitle, ft as renewPreviewSession, gi as resolveRouteTarget, gn as MediaEditor, gr as renderSourceFor, gt as renderSiteChromeBlock, hi as resolvePageRouteTarget, hn as createStoreBackend, hr as remoteDraftValues, ia as compileEditorModelRuntime, ii as logger, in as RichTextField, io as TabsContent, ir as parseReferenceKind, is as parseMailingListPlacementTargeting, it as planBackgroundOverride, ja as formatSiteChromeBackgroundTokenLabel, ji as setContextResolveImageUrlContext, jn as unmapValueFromSelect, jo as SlidersHorizontal, jr as projectRecurringSchedule, jt as createPageSurfaceEditorServices, ki as buildResolveImageUrlContext, kn as mapCurrentValueForSelect, kr as offeringsPreviewBlockDefinition, l as usePreviewThemeOverlay, la as resolveEffectiveArrangement, li as defaultTransforms, ln as LinkWidgetProvider, lo as DialogDescription, lr as useEditorUiStore, ls as parseEditLeaseScope, lt as createGuardedPreviewApiClient, ma as getCuratedSiteStyle, mi as resolveEntryRouteTarget, mn as FormRenderer, mr as planLinkedSaveHandoverRetention, ms as assertNever$2, mt as usePreviewToken, n as useSiteChromeCustomizeOptional, na as readBlockComposition, ni as parseGeneratedIconSetId, nn as ReferenceWidgetProvider, nr as BUILT_IN_REFERENCE_KINDS, ns as buildMailingListSignupBlockSourceRef, nt as imagePoolForOverride, o as PreviewDesignCoordinatorProvider, oi as RichText$1, on as EditorProvider, oo as TabsTrigger, os as NO_BLOCK_VERSIONS, ot as rankBackgroundImagePoolItems, pa as designRuntimeRulesForTheme, pi as isRichTextDoc, pr as activeLinkedSaveHandover, ps as unsafeAsEditorBlockId, pt as usePreviewAuth, qa as SelectItem, qi as DEFAULT_THEME_RESPONSIVE_MODE, qr as mergeContentWithBlockStyleOverrides, qt as InlineTextField, ra as applyCompiledRuntimeFieldsToContent, ri as renderInlineText, rn as useRichTextImagePicker, ro as Tabs, rs as parseFooterModuleId, rt as parseBackgroundOverrideFromContent, sa as arrangementManifestFromVariants, si as getAtPath, sn as useEditor, so as Dialog, ss as readEditorBlockVersionsFromPlacement, st as resolveBackgroundCapability, t as SiteChromeCustomizeProvider, ta as blockLookFromContent, ti as parseGeneratedIconAssetId, tn as ReferenceField, ts as canEditorWrite, tt as enabledBackgroundModes, ua as resolveModeArrangement, ui as calendarWindowQuerySchema, uo as DialogFooter, ur as useEditorUiStoreInstance, ut as initPreviewAuth, va as gradientToCss, vi as isRecord$8, vn as DEFAULT_LAUNCH_READINESS_INPUT, vr as resolveRenderedValues, vt as PreviewRichTextEditor, wi as LINKED_CONTENT_ENTRY_META_KEY, wn as ImageResolveContextProvider, wo as X, wr as resolveSdkFooterMode, wt as EditableBlockProvider, xa as deriveSiteStyleBlockPolicy, xi as inlineTextToPlainText, xn as useMediaEditorOptional, xr as isSupportedLoaderEndpoint, xt as PREVIEW_EDITABLE_OUTLINE, ya as GRADIENT_PRESETS, yi as planSiteChromePlacement, yn as deriveLaunchReadiness, yt as PreviewInlineTextEditor, z as arrangementBackgroundControlFor, za as deriveSectionGround, zi as formEmbedFragment, zn as isHeaderField, zr as resolveArrangementKnobs, zt as createSiteOptionWidgetAdapters } from "./SiteChromeCustomizeContext-BQ8vvKb-.mjs";
4
+ import { $ as canCycleBackgroundOverrideValue, $i as bindingSchema, $n as API_ENDPOINTS, $o as isEdited, $t as FileField, Ai as getCurrentResolveImageUrlContext, An as mapCurrentValueForSelect, Ar as publicRouteCandidatesSchema, At as createEditorApiClientFactory, B as arrangementBlockControlsFor, Ba as parseCanonicalRuntimeBackground, Bi as formCopyFragment, Bn as isHeaderField, Bo as Info, Br as systemCustomizeFacetAppliesToLayoutVariant, Bt as SiteOptionPickerField, Ci as plainTextToInlineText, Cn as useApiMediaUploader, Cr as containerResponsiveThemeCss, Ct as useUISelector, Da as resolveItemSurface, Di as resolveImageUrlWithContext, Dn as SdkConfigProvider, Dr as getBlockDefinition, Dt as useEntryEditorController, Ea as arrangementSlotNames, Ei as getLinkedContentEntryMeta, En as BlockApiProvider, Er as makeDefaultBlockComponent, Fa as defaultSectionTransitionVariantForFamily, Fi as faqAccordionFragment, Fn as hideThemeV2RawStyleFields, Fr as visibleHeaderClearancePx, Ft as EditLeaseDiscardedNotice, G as usePreviewPageDesignEditorState, Ga as Select, Gi as ctaRowFragment, Gn as blocksKeys, Go as ChevronRight, Gr as buildThemeRuntime, Gt as loadMailingListAuthoringContext, H as arrangementVisibilityValues, Hi as testimonialsHeadingFragment, Ho as GripVertical, Hr as systemCustomizeFacetDefinitionsForBlock, Ht as OfferingsPreviewGroupOrderField, Ia as sectionTransitionFamilies, Ii as faqHeadingFragment, In as prepareBlockEditorManifest, Ir as parseStoredVariant, It as EditLeaseModal, Ja as SelectTrigger, Ji as getResponsiveScopeSpec, Jr as getDefaultComponentRegistry, Jt as IconPickerField, K as PreviewDesignHistoryOrderProvider, Ka as SelectContent, Ki as heroCopyFragment, Kn as getBlockManifestFromSdkConfig, Ko as ChevronLeft, Kr as escapeStyleContent, Kt as MailingListTargetingProvider, La as sectionTransitionFamilyForBoundaryOptionId, Li as blogFeaturedPostFragment, Ln as stripTopLevelRoutingUi, Lr as compileManifestContentContract, Lt as EditorWriteSurface, Ma as boundaryLayout, Mi as richTextFragment, Mn as unmapValueFromSelect, Mo as RotateCcw, Mr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Mt as useRetentionTicks, Na as composeBoundary, Ni as headingFragment, Nn as FieldFrame, Nr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, Nt as VIEWING_PARTICIPATION, Oa as resolveLookSlotSurfaces, Oi as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, On as useSdkConfig, Or as normalizeBlockContent, Pa as sectionFactsForContent, Pi as cardFragment, Pn as useField, Pr as planSiteOverlayHeaderClearance, Q as backgroundColorTokens, Qi as defineFragment, Qn as resolveSurfaceDocumentAttributes, Qo as baselineRevisionOf, Qr as offeringsListingFor, Qt as ButtonWidgetProvider, Ra as sectionTransitionVariantForBoundaryOptionId, Ri as singleButtonFragment, Rn as evaluateVisibility, Rr as validateManifestDraft, Rt as createSiteOptionApiLoader, Si as isInlineTextEmpty, Sn as useMediaEditorOptional, Sr as ThemeScope, Ti as coerceLinkedContentEntriesPayload, Tn as ImageResolveContextProvider, To as Upload, Tr as createCustomBlockRegistry, Tt as EntryControllerProvider, U as nextArrangementLookPin, Ui as ctaCopyFragment, Ur as systemCustomizeFacetLabelForValue, Ut as OfferingsPreviewWidgetProvider, V as arrangementOwnedFieldIds, Va as resolveSectionBackground, Vi as testimonialsCarouselFragment, Vn as createManifestFormAdapter, Vo as Image, Vr as systemCustomizeFacetCurrentValue, Vt as SiteOptionWidgetProvider, W as PreviewPageDesignEditorStateProvider, Wi as heroCtaRowFragment, Wr as systemCustomizeFacetNextValue, Wt as MailingListTargetingField, Xi as bodyCopyFragment, Xn as SURFACE_DOCUMENT_DATA_ATTRIBUTE, Xr as buildAppointmentServicesView, Xt as EntryPickerWidgetProvider, Ya as SelectValue, Yi as ctaButton, Yo as Button, Yr as buildLoadedOfferingsPreviewListing, Yt as EntryPickerField, Zi as runTransforms, Zn as SURFACE_IDS, Zo as cn, Zr as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, Zt as ButtonVariantField, _a as surfaceResolutionContextFromTheme, _i as isObjectRecord, _n as decodePublicProductCategorySelectorQuery, _r as renderSourceFor, ai as Text$1, an as RichTextWidgetProvider, ao as TabsList, ar as parseReferenceKind, as as sameMailingListPlacementTargeting, at as planBackgroundTransition, ba as getGradientPreset, bi as coerceInlineTextWithFallback, bn as isSupportedLoaderEndpoint, bt as PreviewTextEditor, c as PreviewThemeOverlayProvider, ca as readStoredMode, ci as siblingPath, cn as LinkField, co as DialogContent, cs as selectedContentVersionId, ct as resolvePreviewSidebarTab, da as resolvePublishedLook, di as publicEventsArraySchema, dn as PaletteProvider, do as DialogHeader, dr as useEditorUiStoreInstance, dt as registerPreviewRenewalFetcher, ea as arrangementHooksFromContent, ei as parseBlockIconValue, en as MediaField, er as createRoutingHelpers, et as defaultBackgroundOverrideForMode, fa as componentRuntimeRulesForTheme, fi as bookingConsentCarrierSchema, fn as usePalette, fo as DialogTitle, fr as useOptionalEditorUiStoreInstance, ft as renewPreviewSession, gi as resolveRouteTarget, gn as MediaEditor, gr as remoteDraftValues, gt as renderSiteChromeBlock, hi as resolvePageRouteTarget, hn as createStoreBackend, hr as planLinkedSaveHandoverRetention, ia as compileEditorModelRuntime, ii as logger, in as RichTextField, io as TabsContent, is as parseMailingListPlacementTargeting, it as planBackgroundOverride, ja as formatSiteChromeBackgroundTokenLabel, ji as setContextResolveImageUrlContext, jn as mapOptionValueForSelect, jo as SlidersHorizontal, jr as projectRecurringSchedule, jt as createPageSurfaceEditorServices, ki as buildResolveImageUrlContext, kn as hasEmptyOption, kr as offeringsPreviewBlockDefinition, l as usePreviewThemeOverlay, la as resolveEffectiveArrangement, li as defaultTransforms, ln as LinkWidgetProvider, lo as DialogDescription, lr as unwrapResponse, ls as parseEditLeaseScope, lt as createGuardedPreviewApiClient, ma as getCuratedSiteStyle, mi as resolveEntryRouteTarget, mn as FormRenderer, mr as activeLinkedSaveHandover, ms as assertNever$2, mt as usePreviewToken, n as useSiteChromeCustomizeOptional, na as readBlockComposition, ni as parseGeneratedIconSetId, nn as ReferenceWidgetProvider, ns as buildMailingListSignupBlockSourceRef, nt as imagePoolForOverride, o as PreviewDesignCoordinatorProvider, oi as RichText$1, on as EditorProvider, oo as TabsTrigger, os as NO_BLOCK_VERSIONS, ot as rankBackgroundImagePoolItems, pa as designRuntimeRulesForTheme, pi as isRichTextDoc, ps as unsafeAsEditorBlockId, pt as usePreviewAuth, qa as SelectItem, qi as DEFAULT_THEME_RESPONSIVE_MODE, qn as ApiRequestError, qr as mergeContentWithBlockStyleOverrides, qt as InlineTextField, ra as applyCompiledRuntimeFieldsToContent, ri as renderInlineText, rn as useRichTextImagePicker, ro as Tabs, rr as BUILT_IN_REFERENCE_KINDS, rs as parseFooterModuleId, rt as parseBackgroundOverrideFromContent, sa as arrangementManifestFromVariants, si as getAtPath, sn as useEditor, so as Dialog, ss as readEditorBlockVersionsFromPlacement, st as resolveBackgroundCapability, t as SiteChromeCustomizeProvider, ta as blockLookFromContent, ti as parseGeneratedIconAssetId, tn as ReferenceField, tr as createSnapshotFromPageRecord, ts as canEditorWrite, tt as enabledBackgroundModes, ua as resolveModeArrangement, ui as calendarWindowQuerySchema, uo as DialogFooter, ur as useEditorUiStore, ut as initPreviewAuth, va as gradientToCss, vi as isRecord$8, vn as DEFAULT_LAUNCH_READINESS_INPUT, vr as renderedFieldChanges, vt as PreviewRichTextEditor, wi as LINKED_CONTENT_ENTRY_META_KEY, wn as clientComponentRegistry, wo as X, wr as resolveSdkFooterMode, wt as EditableBlockProvider, xa as deriveSiteStyleBlockPolicy, xi as inlineTextToPlainText, xn as MediaEditorContextProvider, xr as unsafeAsLinkedContentEntryId, xt as PREVIEW_EDITABLE_OUTLINE, ya as GRADIENT_PRESETS, yi as planSiteChromePlacement, yn as deriveLaunchReadiness, yr as resolveRenderedValues, yt as PreviewInlineTextEditor, z as arrangementBackgroundControlFor, za as deriveSectionGround, zi as formEmbedFragment, zn as getFieldIntent, zr as resolveArrangementKnobs, zt as createSiteOptionWidgetAdapters } from "./SiteChromeCustomizeContext-3gmd26Mn.mjs";
5
5
  import * as React$1 from "react";
6
6
  import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -2279,666 +2279,97 @@ function joinSiteChromeClassNames(...values) {
2279
2279
  return className.length > 0 ? className : void 0;
2280
2280
  }
2281
2281
  //#endregion
2282
- //#region ../blocks/src/system/data/utils.ts
2282
+ //#region ../blocks/src/primitives/content/primitives.tsx
2283
+ const Text = Text$1;
2284
+ const RichText = RichText$1;
2285
+ //#endregion
2286
+ //#region ../db/src/schemas/forms.ts
2283
2287
  /**
2284
- * Normalize data loaders from block definition
2288
+ * Form Settings Schemas
2289
+ *
2290
+ * Zod schemas for validating form settings JSON stored in the database.
2291
+ * These schemas are the single source of truth for form settings validation
2292
+ * across API routes, type guards, and client-side form submission.
2285
2293
  */
2286
- function normalizeDataLoaders(def) {
2287
- if (!def?.dataLoaders) return [];
2288
- return Object.entries(def.dataLoaders).map(([key, loader]) => ({
2289
- key,
2290
- loader
2291
- }));
2292
- }
2294
+ const sensitiveCollectionModeSchema = z.enum(["standard", "sensitive"]).default("standard");
2295
+ const sensitiveCollectionConfirmationVersionSchema = z.union([z.literal(1), z.null()]);
2296
+ const formPresentationSettingsShape = {
2297
+ submitLabel: z.string().min(1).max(40).nullable().optional(),
2298
+ templateKey: z.string().min(1).nullable().optional()
2299
+ };
2300
+ const formPresentationSettingsSchema = z.object(formPresentationSettingsShape).strict();
2301
+ const sensitiveCollectionConfigSchema = z.object({
2302
+ enabledAt: z.string().datetime().nullable(),
2303
+ enabledByUserId: z.string().uuid().nullable(),
2304
+ confirmationVersion: sensitiveCollectionConfirmationVersionSchema
2305
+ }).strict();
2293
2306
  /**
2294
- * Normalize block content for data loading.
2295
- * Priority: draftContent > content > publishedContent
2307
+ * Email notification settings for contact forms
2296
2308
  */
2297
- function normalizeContent(block) {
2298
- const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
2299
- if (!isObjectRecord(source)) return {};
2300
- if ("data" in source) {
2301
- const data = source.data;
2302
- if (isObjectRecord(data)) return data;
2303
- if (data === null || data === void 0) return {};
2304
- }
2305
- return source;
2306
- }
2309
+ const emailNotificationSchema = z.object({
2310
+ enabled: z.boolean(),
2311
+ recipients: z.array(z.string().email()).optional()
2312
+ }).strict();
2307
2313
  /**
2308
- * Normalize params for API calls.
2309
- * Converts supplied values to strings, preserving absent versus explicitly empty params.
2314
+ * Submitter auto-reply settings for contact forms.
2315
+ *
2316
+ * Intentionally does not include form field values; overrides are purely template strings.
2310
2317
  */
2311
- function normalizeParams(input) {
2312
- if (!input || typeof input !== "object") return {};
2313
- const output = {};
2314
- for (const [key, value] of Object.entries(input)) if (value !== void 0 && value !== null) output[key] = coerceToString(value);
2315
- return output;
2316
- }
2317
- function isNonArrayObject(value) {
2318
- return typeof value === "object" && value !== null && !Array.isArray(value);
2319
- }
2320
- function safeJsonStringify(value) {
2321
- try {
2322
- return JSON.stringify(value);
2323
- } catch {
2324
- return;
2325
- }
2326
- }
2318
+ const submitterAutoReplySchema = z.object({
2319
+ enabled: z.boolean(),
2320
+ override: z.object({
2321
+ subjectTemplate: z.string().max(200),
2322
+ bodyTemplate: z.string().max(1e4)
2323
+ }).strict().optional()
2324
+ }).strict();
2327
2325
  /**
2328
- * Coerce value to string for API params
2326
+ * Webhook notification settings for forms
2329
2327
  */
2330
- function coerceToString(value) {
2331
- if (value === null || value === void 0) return "";
2332
- if (Array.isArray(value)) {
2333
- if (value.some(isNonArrayObject)) {
2334
- const json = safeJsonStringify(value);
2335
- if (typeof json === "string") return json;
2336
- }
2337
- return value.map(coerceToString).join(",");
2338
- }
2339
- if (isNonArrayObject(value)) {
2340
- const json = safeJsonStringify(value);
2341
- if (typeof json === "string") return json;
2342
- }
2343
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
2344
- return "";
2345
- }
2328
+ const webhookNotificationSchema = z.object({
2329
+ enabled: z.boolean(),
2330
+ url: z.string().url().optional(),
2331
+ headers: z.record(z.string(), z.string()).optional()
2332
+ }).strict();
2346
2333
  /**
2347
- * The appointment-services catalogue (issue 1403) pairs the services with the
2348
- * site's ordered categories. Both are needed to group them, so that response
2349
- * is passed through whole; any other `{ services }` wrapper is unwrapped.
2334
+ * Notification settings structure
2350
2335
  */
2351
- function coerceServicesPayload(record) {
2352
- return Array.isArray(record.services) && Array.isArray(record.categories) ? {
2353
- services: record.services,
2354
- categories: record.categories
2355
- } : record.services;
2356
- }
2336
+ const notificationSettingsSchema = z.object({
2337
+ email: emailNotificationSchema.optional(),
2338
+ autoReply: submitterAutoReplySchema.optional(),
2339
+ webhook: webhookNotificationSchema.optional(),
2340
+ emails: z.array(z.string().email()).optional()
2341
+ }).strict().optional();
2342
+ const standardContactOptionalFieldSettingsSchema = z.object({ visible: z.boolean() }).strict();
2343
+ const contactFormDefinitionSettingsSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("custom-contact") }).strict(), z.object({
2344
+ kind: z.literal("standard-contact"),
2345
+ optionalFields: z.object({
2346
+ name: standardContactOptionalFieldSettingsSchema,
2347
+ phone: standardContactOptionalFieldSettingsSchema
2348
+ }).strict()
2349
+ }).strict()]);
2357
2350
  /**
2358
- * Extract data from API response.
2359
- * Unwraps common response wrappers: { data }, { form }, { entries }, { services }, { teamMembers }
2351
+ * Contact form settings
2352
+ * Used for general inquiry forms that send notifications to site owners
2353
+ */
2354
+ const contactFormSettingsSchema = z.object({
2355
+ type: z.literal("contact"),
2356
+ successMessage: z.string().optional(),
2357
+ sensitiveCollectionMode: sensitiveCollectionModeSchema.optional(),
2358
+ sensitiveCollection: sensitiveCollectionConfigSchema.optional(),
2359
+ notifications: notificationSettingsSchema,
2360
+ definition: contactFormDefinitionSettingsSchema.default({ kind: "custom-contact" })
2361
+ }).strict();
2362
+ /**
2363
+ * Booking form settings
2364
+ * Used for appointment booking forms that create appointments in the system
2360
2365
  *
2361
- * Note: We check that properties are NOT functions to avoid returning
2362
- * built-in methods like Array.prototype.entries
2363
- */
2364
- function coercePayload(payload) {
2365
- const linkedContentEntries = coerceLinkedContentEntriesPayload(payload);
2366
- if (linkedContentEntries !== payload) return linkedContentEntries;
2367
- if (payload && typeof payload === "object" && !Array.isArray(payload)) {
2368
- const record = payload;
2369
- if ("data" in record && typeof record.data !== "function") return record.data;
2370
- if ("form" in record && typeof record.form !== "function") return record.form;
2371
- if ("entries" in record && typeof record.entries !== "function") return record.entries;
2372
- if ("services" in record && typeof record.services !== "function") return coerceServicesPayload(record);
2373
- if ("teamMembers" in record && typeof record.teamMembers !== "function") return record.teamMembers;
2374
- }
2375
- return payload;
2376
- }
2377
- //#endregion
2378
- //#region ../blocks/src/system/data/fetchLoaderData.ts
2379
- const ALL_PAGE_SIZE = 50;
2380
- /** The shared loader owns All pagination and rejects adapters that repeat a page. */
2381
- async function fetchLoaderData(apiClient, endpoint, params) {
2382
- if (params.limit === "all") return fetchAllPages(apiClient, endpoint, params, 0, /* @__PURE__ */ new Set());
2383
- return coercePayload(await apiClient({
2384
- endpoint,
2385
- params
2386
- }));
2387
- }
2388
- function planLoaderPage(data, offset, seenPages) {
2389
- if (!isUnknownArray$1(data)) return {
2390
- kind: "invalid",
2391
- message: "Expected paged loader entries"
2392
- };
2393
- if (data.length < ALL_PAGE_SIZE) return {
2394
- kind: "complete",
2395
- entries: data
2396
- };
2397
- const ids = data.map((entry) => isObjectRecord(entry) && typeof entry.id === "string" ? entry.id : null);
2398
- const key = JSON.stringify(ids.every((id) => id !== null) ? [...ids].sort() : data);
2399
- if (seenPages.has(key)) return {
2400
- kind: "invalid",
2401
- message: "Paged loader made no progress"
2402
- };
2403
- return {
2404
- kind: "continue",
2405
- entries: data,
2406
- offset: offset + data.length,
2407
- seenPages: /* @__PURE__ */ new Set([...seenPages, key])
2408
- };
2409
- }
2410
- async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
2411
- const page = planLoaderPage(coercePayload(await apiClient({
2412
- endpoint,
2413
- params: {
2414
- ...params,
2415
- limit: String(ALL_PAGE_SIZE),
2416
- offset: String(offset)
2417
- }
2418
- })), offset, seenPages);
2419
- switch (page.kind) {
2420
- case "invalid": throw new Error(page.message);
2421
- case "complete": return page.entries;
2422
- case "continue": return [...page.entries, ...await fetchAllPages(apiClient, endpoint, params, page.offset, page.seenPages)];
2423
- default: return assertNever$2(page);
2424
- }
2425
- }
2426
- function isUnknownArray$1(value) {
2427
- return Array.isArray(value);
2428
- }
2429
- //#endregion
2430
- //#region ../blocks/src/system/runtime/bindings.ts
2431
- const shouldLogWarnings = isNonProductionEnv();
2432
- function isPlainObject(value) {
2433
- return typeof value === "object" && value !== null && !Array.isArray(value);
2434
- }
2435
- function isRouteMapEntry(value) {
2436
- if (typeof value === "string") return true;
2437
- return isPlainObject(value);
2438
- }
2439
- function isRouteMap(value) {
2440
- if (!isPlainObject(value)) return false;
2441
- return Object.values(value).every(isRouteMapEntry);
2442
- }
2443
- function isPageIdentifierMap(value) {
2444
- if (!isPlainObject(value)) return false;
2445
- return Object.values(value).every((v) => typeof v === "string");
2446
- }
2447
- function isEntryIdentifierMap(value) {
2448
- if (!isPlainObject(value)) return false;
2449
- for (const v of Object.values(value)) {
2450
- if (!isPlainObject(v)) return false;
2451
- if (!Object.values(v).every((inner) => typeof inner === "string")) return false;
2452
- }
2453
- return true;
2454
- }
2455
- function buildTransformContext(vm) {
2456
- const root = vm.$root;
2457
- const stage = root && isPlainObject(root) && root.previewStage === "preview" ? "preview" : "published";
2458
- const routes = root && isPlainObject(root) && isRouteMap(root.routes) ? root.routes : void 0;
2459
- const pagesByIdentifier = root && isPlainObject(root) && isPageIdentifierMap(root.pagesByIdentifier) ? root.pagesByIdentifier : void 0;
2460
- const entriesByIdentifier = root && isPlainObject(root) && isEntryIdentifierMap(root.entriesByIdentifier) ? root.entriesByIdentifier : void 0;
2461
- return {
2462
- theme: defaultThemeTokens,
2463
- stage,
2464
- data: vm.content,
2465
- routes,
2466
- pagesByIdentifier,
2467
- entriesByIdentifier
2468
- };
2469
- }
2470
- function resolveParamsBindings(input, vm, meta) {
2471
- if (input === null || typeof input !== "object") return input;
2472
- if (Array.isArray(input)) return input.map((v) => resolveParamsBindings(v, vm, meta));
2473
- const maybeBind = input.$bind;
2474
- if (maybeBind && typeof maybeBind === "object") try {
2475
- const binding = bindingSchema.parse(maybeBind);
2476
- const value = resolveBinding(binding.from, vm);
2477
- const resolved = value === void 0 || value === null ? binding.fallback : runTransforms(value, binding.transforms, buildTransformContext(vm), defaultTransforms);
2478
- if (resolved === void 0 || resolved === null || resolved === "") return binding.fallback;
2479
- return resolved;
2480
- } catch (err) {
2481
- if (shouldLogWarnings) console.warn(`bindings: failed to parse loader param binding for block "${meta?.blockKind ?? "unknown"}"`, err);
2482
- return;
2483
- }
2484
- const out = {};
2485
- for (const [k, v] of Object.entries(input)) out[k] = resolveParamsBindings(v, vm, meta);
2486
- return out;
2487
- }
2488
- function resolveBinding(path, vm) {
2489
- const segments = splitPath(path);
2490
- if (!segments.length) return void 0;
2491
- const [first, ...rest] = segments;
2492
- let source = vm;
2493
- if (first === "$root") {
2494
- source = vm;
2495
- return readFromSource(source, [first, ...rest]);
2496
- }
2497
- if (first === "content") {
2498
- source = vm.content;
2499
- return readFromSource(source, rest);
2500
- }
2501
- const contentResult = readFromSource(vm.content, segments);
2502
- if (contentResult !== void 0) return contentResult;
2503
- return readFromSource(vm, segments);
2504
- }
2505
- function splitPath(path) {
2506
- const PATH_SEPARATOR_REGEX = /\./g;
2507
- const BRACKET_ACCESS_REGEX = /\[(?<token>[^\]]+)\]/g;
2508
- const segments = [];
2509
- const parts = path.split(PATH_SEPARATOR_REGEX);
2510
- for (const raw of parts) {
2511
- if (!raw) continue;
2512
- const baseMatch = raw.match(/^([^\[]+)/);
2513
- if (baseMatch && baseMatch[1]) segments.push(baseMatch[1]);
2514
- const bracketMatches = raw.matchAll(BRACKET_ACCESS_REGEX);
2515
- for (const match of bracketMatches) {
2516
- const token = match.groups?.token ?? "";
2517
- if (token.startsWith("\"") || token.startsWith("'")) segments.push(token.slice(1, -1));
2518
- else if (/^\d+$/.test(token)) segments.push(Number(token));
2519
- else segments.push(token);
2520
- }
2521
- if (!baseMatch && !raw.includes("[")) segments.push(raw);
2522
- }
2523
- return segments;
2524
- }
2525
- function readFromSource(source, segments) {
2526
- return segments.reduce((current, segment) => {
2527
- if (current === void 0 || current === null) return void 0;
2528
- if (typeof segment === "number") {
2529
- if (Array.isArray(current)) return current[segment];
2530
- return;
2531
- }
2532
- if (typeof current === "object" && current !== null && segment in current) return current[segment];
2533
- }, source);
2534
- }
2535
- function isNonProductionEnv() {
2536
- if (typeof globalThis === "undefined") return true;
2537
- return globalThis.process?.env?.NODE_ENV !== "production";
2538
- }
2539
- //#endregion
2540
- //#region ../blocks/src/system/data/prefetchBlockData.ts
2541
- /**
2542
- * Core block data prefetching logic (framework-agnostic).
2543
- *
2544
- * This module provides the shared implementation for prefetching block data loaders.
2545
- * It works with any API client by accepting it as a parameter (dependency injection).
2546
- *
2547
- * Usage:
2548
- * - Frontend: provide internal API client
2549
- * - SDK: provide SDK client with endpoint mapping
2550
- */
2551
- function projectDataLoaders(loaders, shouldLoad, blockId, blockKind) {
2552
- if (!shouldLoad) return [...loaders];
2553
- return loaders.filter(({ key }) => shouldLoad({
2554
- blockId,
2555
- blockKind,
2556
- loaderKey: key
2557
- }));
2558
- }
2559
- function shouldSkipResolvedLoader(input) {
2560
- if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
2561
- return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
2562
- }
2563
- /**
2564
- * Core data prefetching logic (framework-agnostic).
2565
- *
2566
- * This function is shared between frontend and SDK implementations.
2567
- * It handles:
2568
- * - Extracting data loaders from block definitions
2569
- * - Resolving loader params with block content
2570
- * - Executing server-mode loaders in parallel
2571
- * - Organizing results by block ID and loader key
2572
- *
2573
- * @example
2574
- * ```typescript
2575
- * const resolved = await prefetchBlockData(page, context, {
2576
- * apiClient: async ({ endpoint, params }) => {
2577
- * return await myApiClient({ endpoint, params });
2578
- * },
2579
- * isValidEndpoint: (endpoint) => endpoint in API_ENDPOINTS,
2580
- * });
2581
- * ```
2582
- */
2583
- async function prefetchBlockData(page, context, options) {
2584
- return (await prefetchBlockDataWithFailures(page, context, options)).resolvedData;
2585
- }
2586
- async function prefetchBlockDataWithFailures(page, context, options) {
2587
- const { apiClient, isValidEndpoint, onError, getCustomBlockLoaders, getBlockDefinition: getBlockDefinition$1 = getBlockDefinition, resolveParamsBindings: resolveParamsBindings$1 = resolveParamsBindings, shouldLoad } = options;
2588
- const results = {};
2589
- const loaderFailures = {};
2590
- const tasks = [];
2591
- for (const block of page.blocks) {
2592
- const blockId = block.id;
2593
- if (!blockId) continue;
2594
- let loaders;
2595
- const def = getBlockDefinition$1(block.kind);
2596
- if (def) loaders = normalizeDataLoaders(def);
2597
- else if (getCustomBlockLoaders) {
2598
- const customLoaders = getCustomBlockLoaders(block.kind);
2599
- loaders = customLoaders ? Object.entries(customLoaders).map(([key, loader]) => ({
2600
- key,
2601
- loader
2602
- })) : [];
2603
- } else loaders = [];
2604
- loaders = projectDataLoaders(loaders, shouldLoad, blockId, block.kind);
2605
- if (loaders.length === 0) continue;
2606
- const root = {
2607
- ...context.root ?? {},
2608
- siteId: context.siteId,
2609
- pageId: context.pageId,
2610
- previewStage: context.previewStage
2611
- };
2612
- const vm = {
2613
- content: plannedLoaderContent(block, def, context),
2614
- $root: root
2615
- };
2616
- for (const { key, loader } of loaders) {
2617
- if (loader.mode === "client") continue;
2618
- if (typeof loader.when !== "undefined") {
2619
- if (resolveParamsBindings$1(loader.when, vm, { blockKind: block.kind }) !== true) continue;
2620
- }
2621
- const params = normalizeParams(resolveParamsBindings$1(loader.params, vm, { blockKind: block.kind }));
2622
- const endpoint = loader.endpoint;
2623
- if (shouldSkipResolvedLoader({
2624
- loader,
2625
- endpoint,
2626
- params,
2627
- isValidEndpoint
2628
- })) continue;
2629
- tasks.push((async () => {
2630
- try {
2631
- const data = await fetchLoaderData(apiClient, endpoint, params);
2632
- const blockResults = results[blockId] ?? (results[blockId] = {});
2633
- blockResults[key] = data;
2634
- } catch (error) {
2635
- const blockFailures = loaderFailures[blockId] ?? (loaderFailures[blockId] = {});
2636
- blockFailures[key] = {
2637
- endpoint,
2638
- params
2639
- };
2640
- if (onError) onError(error, {
2641
- block: block.kind,
2642
- loader: key
2643
- });
2644
- }
2645
- })());
2646
- }
2647
- }
2648
- if (tasks.length > 0) await Promise.all(tasks);
2649
- return {
2650
- resolvedData: results,
2651
- loaderFailures
2652
- };
2653
- }
2654
- /** Prefetch executes the render-plan content stage before resolving loader bindings. */
2655
- function plannedLoaderContent(block, definition, context) {
2656
- const content = normalizeContent(block);
2657
- if (!definition || content._arrangementLooks === void 0) return content;
2658
- return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
2659
- }
2660
- //#endregion
2661
- //#region ../blocks/src/system/data/batching.ts
2662
- function stableNormalize(value) {
2663
- if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
2664
- if (Array.isArray(value)) return value.map(stableNormalize);
2665
- if (typeof value === "object" && value) {
2666
- const obj = value;
2667
- const keys = Object.keys(obj).sort();
2668
- const out = {};
2669
- for (const key of keys) {
2670
- const v = obj[key];
2671
- if (v === void 0) continue;
2672
- out[key] = stableNormalize(v);
2673
- }
2674
- return out;
2675
- }
2676
- if (typeof value === "bigint" || typeof value === "symbol" || typeof value === "undefined") return String(value);
2677
- return null;
2678
- }
2679
- function stableSerialize(value) {
2680
- return JSON.stringify(stableNormalize(value));
2681
- }
2682
- function createMicrobatcher(options) {
2683
- const schedule = options.schedule ?? ((fn) => queueMicrotask(fn));
2684
- const inFlight = /* @__PURE__ */ new Map();
2685
- const queued = /* @__PURE__ */ new Map();
2686
- let flushPromise = null;
2687
- let nextRequestId = 0;
2688
- const flush = async () => {
2689
- while (queued.size > 0) {
2690
- const batchEntries = Array.from(queued.entries()).slice(0, options.maxBatchSize);
2691
- const batch = batchEntries.map(([, value]) => value);
2692
- for (const [key] of batchEntries) queued.delete(key);
2693
- const requests = batch.map((item) => item.request);
2694
- try {
2695
- const results = await options.runBatch(requests);
2696
- for (const item of batch) {
2697
- const result = results[item.request.id];
2698
- if (!result) {
2699
- item.reject(/* @__PURE__ */ new Error("Missing batch result"));
2700
- continue;
2701
- }
2702
- if (result.ok) item.resolve(result.data);
2703
- else item.reject(new Error(result.error.message));
2704
- }
2705
- } catch (error) {
2706
- for (const item of batch) item.reject(error);
2707
- }
2708
- }
2709
- };
2710
- const scheduleFlush = () => {
2711
- if (flushPromise) return flushPromise;
2712
- flushPromise = new Promise((resolve, reject) => {
2713
- schedule(() => {
2714
- flush().then(resolve, reject);
2715
- });
2716
- }).finally(() => {
2717
- flushPromise = null;
2718
- if (queued.size > 0) scheduleFlush();
2719
- });
2720
- return flushPromise;
2721
- };
2722
- const getOrEnqueue = (key, makeRequest) => {
2723
- const existing = inFlight.get(key);
2724
- if (existing) return existing;
2725
- const promise = new Promise((resolve, reject) => {
2726
- const id = `r${nextRequestId++}`;
2727
- queued.set(key, {
2728
- request: makeRequest(id),
2729
- resolve,
2730
- reject
2731
- });
2732
- }).finally(() => {
2733
- inFlight.delete(key);
2734
- });
2735
- inFlight.set(key, promise);
2736
- scheduleFlush();
2737
- return promise;
2738
- };
2739
- return { getOrEnqueue };
2740
- }
2741
- //#endregion
2742
- //#region ../blocks/src/system/data/normalizeLoaderParams.ts
2743
- function toStringParams(value) {
2744
- if (!isObjectRecord(value)) return {};
2745
- const out = {};
2746
- for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
2747
- return out;
2748
- }
2749
- function stripEmptyStringValues(params, endpoint) {
2750
- for (const [key, value] of Object.entries(params)) if (value === "" && !(key === "seriesIds" && (endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow"))) delete params[key];
2751
- }
2752
- function ensureSiteId(params, context) {
2753
- if (!params.siteId && typeof context.siteId === "string" && context.siteId) params.siteId = context.siteId;
2754
- }
2755
- /**
2756
- * Map the embed block's author-facing order values onto the public
2757
- * `listPublishedEntries` `order` contract enum.
2758
- *
2759
- * `'order'` ("Custom order field") is the MANUAL-ORDERING axis: it means "render
2760
- * entries in the content type's author-defined order". It intentionally maps to
2761
- * `undefined` (endpoint default) here rather than a fixed `manual.asc`, because
2762
- * this transform is schema-blind — it can't tell whether the embedded content
2763
- * type actually opts into `ordering.mode: 'manual'`. Forcing `manual.asc` for a
2764
- * non-manual type would silently flip its default sort (all `manualOrder` values
2765
- * are equal, so it would degrade to createdAt-asc) — a render regression.
2766
- *
2767
- * The manual-ordering HONOR therefore lives server-side where the schema IS
2768
- * known: `listContentEntries` (content/entries/list.ts) applies `manualOrder ASC`
2769
- * as the default for manual-ordered types (plan 8.3). That is the path
2770
- * `block-loaders/content.ts` renders through. The embed/`listPublishedEntries`
2771
- * loader path (contentEntryLoaders) is not yet schema-aware for its default
2772
- * ordering; honoring manual order there for the default `'order'` value is a
2773
- * bounded follow-up (recorded in plan 8.3), not this change.
2774
- */
2775
- function normalizeOrder(orderBy) {
2776
- switch (orderBy) {
2777
- case "newest": return "published_at.desc";
2778
- case "oldest": return "published_at.asc";
2779
- case "title": return "title.asc";
2780
- case "order": return;
2781
- default: return;
2782
- }
2783
- }
2784
- /**
2785
- * Normalize loader params emitted by the block runtime into a consistent shape
2786
- * (canonical keys + required context-derived fields).
2787
- *
2788
- * Note: params are already stringified by the core prefetch implementation.
2789
- */
2790
- function normalizeLoaderParams(endpoint, params, context) {
2791
- const out = toStringParams(params);
2792
- stripEmptyStringValues(out, endpoint);
2793
- if (endpoint === "getPublicFormById") {
2794
- ensureSiteId(out, context);
2795
- if (!out.formId && out.formSlug) {
2796
- out.formId = out.formSlug;
2797
- delete out.formSlug;
2798
- }
2799
- return out;
2800
- }
2801
- if (endpoint === "getPublicBookingServices") {
2802
- ensureSiteId(out, context);
2803
- return out;
2804
- }
2805
- if (endpoint === "getPublicWeeklySlotAvailability") {
2806
- ensureSiteId(out, context);
2807
- return out;
2808
- }
2809
- if (endpoint === "listPublicEvents" || endpoint === "listPublicRecurringSchedule" || endpoint === "listPublicEventCalendarWindow") {
2810
- ensureSiteId(out, context);
2811
- return out;
2812
- }
2813
- if (endpoint === "getPublicEventDetails") {
2814
- ensureSiteId(out, context);
2815
- return out;
2816
- }
2817
- if (endpoint === "listPublicProducts") {
2818
- ensureSiteId(out, context);
2819
- return out;
2820
- }
2821
- if (endpoint === "listPublicTeamMembers") {
2822
- ensureSiteId(out, context);
2823
- return out;
2824
- }
2825
- if (endpoint === "listPublicRouteCandidates") {
2826
- ensureSiteId(out, context);
2827
- return out;
2828
- }
2829
- if (endpoint === "getPublishedEntryPreview") {
2830
- ensureSiteId(out, context);
2831
- return out;
2832
- }
2833
- ensureSiteId(out, context);
2834
- return out;
2835
- }
2836
- /**
2837
- * Normalize loader params into the shapes expected by the public API endpoints.
2838
- *
2839
- * Prefer this when the loader endpoint maps 1:1 to a public API route.
2840
- */
2841
- function normalizePublicApiLoaderParams(endpoint, params, context) {
2842
- const out = normalizeLoaderParams(endpoint, params, context);
2843
- if (endpoint === "listPublishedEntries" && !out.order && out.orderBy) {
2844
- const mapped = normalizeOrder(out.orderBy);
2845
- if (mapped) out.order = mapped;
2846
- delete out.orderBy;
2847
- }
2848
- return out;
2849
- }
2850
- //#endregion
2851
- //#region ../blocks/src/primitives/content/primitives.tsx
2852
- const Text = Text$1;
2853
- const RichText = RichText$1;
2854
- //#endregion
2855
- //#region ../db/src/schemas/forms.ts
2856
- /**
2857
- * Form Settings Schemas
2858
- *
2859
- * Zod schemas for validating form settings JSON stored in the database.
2860
- * These schemas are the single source of truth for form settings validation
2861
- * across API routes, type guards, and client-side form submission.
2862
- */
2863
- const sensitiveCollectionModeSchema = z.enum(["standard", "sensitive"]).default("standard");
2864
- const sensitiveCollectionConfirmationVersionSchema = z.union([z.literal(1), z.null()]);
2865
- const formPresentationSettingsShape = {
2866
- submitLabel: z.string().min(1).max(40).nullable().optional(),
2867
- templateKey: z.string().min(1).nullable().optional()
2868
- };
2869
- const formPresentationSettingsSchema = z.object(formPresentationSettingsShape).strict();
2870
- const sensitiveCollectionConfigSchema = z.object({
2871
- enabledAt: z.string().datetime().nullable(),
2872
- enabledByUserId: z.string().uuid().nullable(),
2873
- confirmationVersion: sensitiveCollectionConfirmationVersionSchema
2874
- }).strict();
2875
- /**
2876
- * Email notification settings for contact forms
2877
- */
2878
- const emailNotificationSchema = z.object({
2879
- enabled: z.boolean(),
2880
- recipients: z.array(z.string().email()).optional()
2881
- }).strict();
2882
- /**
2883
- * Submitter auto-reply settings for contact forms.
2884
- *
2885
- * Intentionally does not include form field values; overrides are purely template strings.
2886
- */
2887
- const submitterAutoReplySchema = z.object({
2888
- enabled: z.boolean(),
2889
- override: z.object({
2890
- subjectTemplate: z.string().max(200),
2891
- bodyTemplate: z.string().max(1e4)
2892
- }).strict().optional()
2893
- }).strict();
2894
- /**
2895
- * Webhook notification settings for forms
2896
- */
2897
- const webhookNotificationSchema = z.object({
2898
- enabled: z.boolean(),
2899
- url: z.string().url().optional(),
2900
- headers: z.record(z.string(), z.string()).optional()
2901
- }).strict();
2902
- /**
2903
- * Notification settings structure
2904
- */
2905
- const notificationSettingsSchema = z.object({
2906
- email: emailNotificationSchema.optional(),
2907
- autoReply: submitterAutoReplySchema.optional(),
2908
- webhook: webhookNotificationSchema.optional(),
2909
- emails: z.array(z.string().email()).optional()
2910
- }).strict().optional();
2911
- const standardContactOptionalFieldSettingsSchema = z.object({ visible: z.boolean() }).strict();
2912
- const contactFormDefinitionSettingsSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("custom-contact") }).strict(), z.object({
2913
- kind: z.literal("standard-contact"),
2914
- optionalFields: z.object({
2915
- name: standardContactOptionalFieldSettingsSchema,
2916
- phone: standardContactOptionalFieldSettingsSchema
2917
- }).strict()
2918
- }).strict()]);
2919
- /**
2920
- * Contact form settings
2921
- * Used for general inquiry forms that send notifications to site owners
2922
- */
2923
- const contactFormSettingsSchema = z.object({
2924
- type: z.literal("contact"),
2925
- successMessage: z.string().optional(),
2926
- sensitiveCollectionMode: sensitiveCollectionModeSchema.optional(),
2927
- sensitiveCollection: sensitiveCollectionConfigSchema.optional(),
2928
- notifications: notificationSettingsSchema,
2929
- definition: contactFormDefinitionSettingsSchema.default({ kind: "custom-contact" })
2930
- }).strict();
2931
- /**
2932
- * Booking form settings
2933
- * Used for appointment booking forms that create appointments in the system
2934
- *
2935
- * Service configuration:
2936
- * - serviceId: Single service (backward compatible)
2937
- * - serviceIds: Multiple services (user selects at booking time)
2938
- * - If neither provided: Shows all available services for the site
2939
- *
2940
- * Note: Form can have either serviceId OR serviceIds, not both.
2941
- * XOR validation enforces this constraint.
2366
+ * Service configuration:
2367
+ * - serviceId: Single service (backward compatible)
2368
+ * - serviceIds: Multiple services (user selects at booking time)
2369
+ * - If neither provided: Shows all available services for the site
2370
+ *
2371
+ * Note: Form can have either serviceId OR serviceIds, not both.
2372
+ * XOR validation enforces this constraint.
2942
2373
  */
2943
2374
  const bookingFormSettingsSchema = z.object({
2944
2375
  type: z.literal("booking"),
@@ -5309,477 +4740,1046 @@ function PreviewBlockCustomizeSelectionProvider({ children }) {
5309
4740
  children
5310
4741
  });
5311
4742
  }
5312
- function usePreviewBlockCustomizeSelectionOptional() {
5313
- return useContext(PreviewBlockCustomizeSelectionContext);
4743
+ function usePreviewBlockCustomizeSelectionOptional() {
4744
+ return useContext(PreviewBlockCustomizeSelectionContext);
4745
+ }
4746
+ //#endregion
4747
+ //#region ../preview-next/src/client/blocks/previewCustomizeControlPlan.ts
4748
+ const ABSOLUTE_MAX_QUICK_FIELDS = 3;
4749
+ function createPreviewCustomizeControlPlan({ fields, content, visibilityValues = null, quickFieldPriority = [], maxQuickFields = ABSOLUTE_MAX_QUICK_FIELDS }) {
4750
+ const valueReader = createVisibilityValueReader(content, visibilityValues);
4751
+ const quickPriorityIndex = new Map(quickFieldPriority.map((fieldId, index) => [fieldId, index]));
4752
+ const maxQuick = Math.max(0, Math.min(ABSOLUTE_MAX_QUICK_FIELDS, maxQuickFields));
4753
+ const visibleControls = [];
4754
+ const hiddenControls = [];
4755
+ for (const field of fields) {
4756
+ if (isThemeV2NormalEditorRawStyleFieldName(field.id)) {
4757
+ hiddenControls.push({
4758
+ fieldId: field.id,
4759
+ reason: "theme-v2-raw-style-field"
4760
+ });
4761
+ continue;
4762
+ }
4763
+ if (isHeaderField(field)) {
4764
+ hiddenControls.push({
4765
+ fieldId: field.id,
4766
+ reason: "header-field"
4767
+ });
4768
+ continue;
4769
+ }
4770
+ const intent = getFieldIntent(field);
4771
+ if (intent !== "display" && intent !== "behavior") {
4772
+ hiddenControls.push({
4773
+ fieldId: field.id,
4774
+ reason: "unsupported-intent"
4775
+ });
4776
+ continue;
4777
+ }
4778
+ if (!evaluateVisibility(field, valueReader, field.id)) {
4779
+ hiddenControls.push({
4780
+ fieldId: field.id,
4781
+ reason: "not-visible"
4782
+ });
4783
+ continue;
4784
+ }
4785
+ visibleControls.push({
4786
+ kind: "manifest-field",
4787
+ field: fieldWithDecidedVisibility(field),
4788
+ placement: "panel",
4789
+ intent
4790
+ });
4791
+ }
4792
+ const quickFieldIds = new Set(visibleControls.filter((control) => quickPriorityIndex.has(control.field.id)).sort((left, right) => (quickPriorityIndex.get(left.field.id) ?? Number.MAX_SAFE_INTEGER) - (quickPriorityIndex.get(right.field.id) ?? Number.MAX_SAFE_INTEGER)).slice(0, maxQuick).map((control) => control.field.id));
4793
+ return {
4794
+ quickControls: visibleControls.filter((control) => quickFieldIds.has(control.field.id)).map((control) => ({
4795
+ ...control,
4796
+ placement: "quick"
4797
+ })),
4798
+ panelControls: visibleControls.filter((control) => !quickFieldIds.has(control.field.id)),
4799
+ hiddenControls
4800
+ };
4801
+ }
4802
+ /** Top-level visibility is already decided; forms must not reread raw values. */
4803
+ function fieldWithDecidedVisibility(field) {
4804
+ if (!field.ui || !("visibleWhen" in field.ui)) return field;
4805
+ const { visibleWhen: _visibleWhen, ...ui } = field.ui;
4806
+ return {
4807
+ ...field,
4808
+ ui
4809
+ };
4810
+ }
4811
+ function createVisibilityValueReader(content, appearance) {
4812
+ return { getValue: (path) => appearance && path === "blockLook" ? appearance.lookId : appearance && path === appearance.arrangementField ? appearance.arrangement : getValueAtPath(content, path) };
4813
+ }
4814
+ function getValueAtPath(source, path) {
4815
+ if (!path) return source;
4816
+ let current = source;
4817
+ for (const segment of path.split(".")) {
4818
+ if (!current || typeof current !== "object") return;
4819
+ current = current[segment];
4820
+ }
4821
+ return current;
4822
+ }
4823
+ function useBlockCustomizeControls({ blockId, blockKind, content, uiStore, theme, sdkConfig, maxQuickFields = 3, maxPopoverRows, builtInPopoverRows = 0 }) {
4824
+ const { blockFieldOptions, blockFieldExtensions, sdkConfig: contextSdkConfig } = useSdkConfig();
4825
+ const effectiveSdkConfig = sdkConfig ?? contextSdkConfig;
4826
+ const manifest = useMemo(() => resolveBlockManifest(blockKind, effectiveSdkConfig ?? null), [blockKind, effectiveSdkConfig]);
4827
+ const preparedManifest = useMemo(() => {
4828
+ if (!manifest) return null;
4829
+ return prepareBlockEditorManifest({
4830
+ manifest,
4831
+ blockKind,
4832
+ theme,
4833
+ blockFieldOptions,
4834
+ blockFieldExtensions,
4835
+ visibilityPolicy: hideThemeV2RawStyleFields
4836
+ });
4837
+ }, [
4838
+ blockFieldExtensions,
4839
+ blockFieldOptions,
4840
+ blockKind,
4841
+ manifest,
4842
+ theme
4843
+ ]);
4844
+ const { state: pageDesignState } = usePreviewPageDesignEditorState();
4845
+ const designBlock = useMemo(() => pageDesignState.kind === "loaded" ? pageDesignState.editorModel.blocks.find((block) => String(block.blockId) === String(blockId)) ?? null : null, [blockId, pageDesignState]);
4846
+ const ownedFieldIds = useMemo(() => arrangementOwnedFieldIds(designBlock), [designBlock]);
4847
+ const visibilityValues = useMemo(() => arrangementVisibilityValues(designBlock), [designBlock]);
4848
+ const fields = useMemo(() => {
4849
+ if (!preparedManifest) return [];
4850
+ return createManifestFormAdapter(preparedManifest.renderManifest).fields.filter((field) => !ownedFieldIds.includes(field.id));
4851
+ }, [ownedFieldIds, preparedManifest]);
4852
+ const preliminaryPlan = useMemo(() => createPreviewCustomizeControlPlan({
4853
+ fields,
4854
+ content,
4855
+ visibilityValues,
4856
+ quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
4857
+ maxQuickFields
4858
+ }), [
4859
+ content,
4860
+ visibilityValues,
4861
+ fields,
4862
+ manifest?.previewCustomize?.quickFieldPriority,
4863
+ maxQuickFields
4864
+ ]);
4865
+ const budgetedMaxQuickFields = resolveQuickFieldBudget({
4866
+ requestedMaxQuickFields: maxQuickFields,
4867
+ maxPopoverRows,
4868
+ builtInPopoverRows,
4869
+ hasOverflowControls: preliminaryPlan.panelControls.length > 0
4870
+ });
4871
+ const controlPlan = useMemo(() => {
4872
+ if (budgetedMaxQuickFields === maxQuickFields) return preliminaryPlan;
4873
+ return createPreviewCustomizeControlPlan({
4874
+ fields,
4875
+ content,
4876
+ visibilityValues,
4877
+ quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
4878
+ maxQuickFields: budgetedMaxQuickFields
4879
+ });
4880
+ }, [
4881
+ budgetedMaxQuickFields,
4882
+ content,
4883
+ fields,
4884
+ manifest?.previewCustomize?.quickFieldPriority,
4885
+ maxQuickFields,
4886
+ preliminaryPlan,
4887
+ visibilityValues
4888
+ ]);
4889
+ const quickFields = useMemo(() => controlPlan.quickControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.quickControls]);
4890
+ const panelFields = useMemo(() => controlPlan.panelControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.panelControls]);
4891
+ return {
4892
+ manifest,
4893
+ controlPlan,
4894
+ quickFields,
4895
+ panelFields,
4896
+ backend: useMemo(() => {
4897
+ if (!preparedManifest) return null;
4898
+ return createStoreBackend({
4899
+ scope: "blocks",
4900
+ store: uiStore,
4901
+ blockId
4902
+ });
4903
+ }, [
4904
+ blockId,
4905
+ preparedManifest,
4906
+ uiStore
4907
+ ]),
4908
+ hasControls: quickFields.length > 0 || panelFields.length > 0,
4909
+ hasOverflowControls: panelFields.length > 0
4910
+ };
4911
+ }
4912
+ function resolveQuickFieldBudget({ requestedMaxQuickFields, maxPopoverRows, builtInPopoverRows, hasOverflowControls }) {
4913
+ const cappedRequested = Math.max(0, Math.min(3, requestedMaxQuickFields));
4914
+ if (typeof maxPopoverRows !== "number") return cappedRequested;
4915
+ const customizeRowCount = hasOverflowControls ? 1 : 0;
4916
+ const availableRows = maxPopoverRows - builtInPopoverRows - customizeRowCount;
4917
+ return Math.max(0, Math.min(cappedRequested, availableRows));
4918
+ }
4919
+ function resolveBlockManifest(blockKind, sdkConfig) {
4920
+ return getBlockManifestFromSdkConfig(blockKind, sdkConfig) ?? getBlockDefinition(blockKind)?.manifest ?? null;
4921
+ }
4922
+ //#endregion
4923
+ //#region ../preview-next/src/client/preview/PreviewSiteFontStorageContext.tsx
4924
+ const PreviewSiteFontStorageContext = createContext(void 0);
4925
+ function PreviewSiteFontStorageProvider({ siteFontStorageUrl, children }) {
4926
+ return /* @__PURE__ */ jsx(PreviewSiteFontStorageContext.Provider, {
4927
+ value: siteFontStorageUrl,
4928
+ children
4929
+ });
4930
+ }
4931
+ function usePreviewSiteFontStorageUrl() {
4932
+ return useContext(PreviewSiteFontStorageContext);
5314
4933
  }
5315
4934
  //#endregion
5316
- //#region ../preview-next/src/client/blocks/previewCustomizeControlPlan.ts
5317
- const ABSOLUTE_MAX_QUICK_FIELDS = 3;
5318
- function createPreviewCustomizeControlPlan({ fields, content, visibilityValues = null, quickFieldPriority = [], maxQuickFields = ABSOLUTE_MAX_QUICK_FIELDS }) {
5319
- const valueReader = createVisibilityValueReader(content, visibilityValues);
5320
- const quickPriorityIndex = new Map(quickFieldPriority.map((fieldId, index) => [fieldId, index]));
5321
- const maxQuick = Math.max(0, Math.min(ABSOLUTE_MAX_QUICK_FIELDS, maxQuickFields));
5322
- const visibleControls = [];
5323
- const hiddenControls = [];
5324
- for (const field of fields) {
5325
- if (isThemeV2NormalEditorRawStyleFieldName(field.id)) {
5326
- hiddenControls.push({
5327
- fieldId: field.id,
5328
- reason: "theme-v2-raw-style-field"
5329
- });
5330
- continue;
5331
- }
5332
- if (isHeaderField(field)) {
5333
- hiddenControls.push({
5334
- fieldId: field.id,
5335
- reason: "header-field"
5336
- });
5337
- continue;
5338
- }
5339
- const intent = getFieldIntent(field);
5340
- if (intent !== "display" && intent !== "behavior") {
5341
- hiddenControls.push({
5342
- fieldId: field.id,
5343
- reason: "unsupported-intent"
5344
- });
5345
- continue;
4935
+ //#region ../preview-next/src/client/preview/previewChromeSurfacePolicy.ts
4936
+ const PREVIEW_CHROME_SURFACE_POLICIES = {
4937
+ core: {
4938
+ banner: {
4939
+ tone: "default",
4940
+ bannerClassName: "border border-emerald-200/70 bg-white/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-white/92",
4941
+ summaryClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",
4942
+ dialogItemClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2",
4943
+ titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
4944
+ descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
4945
+ detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
4946
+ summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
4947
+ summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
4948
+ secondaryButtonClassName: "",
4949
+ primaryButtonClassName: "",
4950
+ dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
4951
+ dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
4952
+ dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
4953
+ dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
4954
+ ctaLabel: "Complete setup in dashboard",
4955
+ copyByState: {
4956
+ awaiting_confirmation: {
4957
+ title: "Your draft preview is ready",
4958
+ description: "Explore your site here, then confirm your email to unlock the dashboard and finish launch setup.",
4959
+ detail: "Once your email is confirmed, Complete setup in dashboard will take you straight to the remaining checklist.",
4960
+ checklistNote: "Email confirmation is the only blocker before dashboard access. The rest of the launch checklist lives in the dashboard."
4961
+ },
4962
+ dashboard_ready: {
4963
+ title: "Your dashboard is unlocked",
4964
+ description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
4965
+ detail: "The dashboard is the place to complete the remaining checklist and get your site ready to launch.",
4966
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
4967
+ },
4968
+ dashboard_resume: {
4969
+ title: "Your draft site is ready",
4970
+ description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
4971
+ detail: "The dashboard is the normal place to finish setup for this site.",
4972
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
4973
+ }
4974
+ },
4975
+ dialog: {
4976
+ title: "What still happens in the dashboard",
4977
+ description: "Your preview is ready, but launch steps still happen in the dashboard so you can finish setup safely.",
4978
+ pendingIntro: "Your preview is live now, but the launch checklist stays in the dashboard so the final setup steps happen in the right place.",
4979
+ unlockedIntro: "Your preview is live now, and the same checklist will follow you into the dashboard when you are ready to finish setup.",
4980
+ outro: "You can keep exploring this preview now, then jump back into the dashboard when you're ready to finish setup."
4981
+ }
4982
+ },
4983
+ sidebar: {
4984
+ tone: "default",
4985
+ rootClassName: "bg-background",
4986
+ headerClassName: "border-b",
4987
+ guidance: {
4988
+ title: "Make quick edits in preview",
4989
+ description: "Use preview for copy and layout tweaks. Complete setup in dashboard to add offerings, connect payments, and finish the rest of your launch checklist.",
4990
+ ctaLabel: "Complete setup in dashboard",
4991
+ cardClassName: "rounded-lg border border-emerald-200/70 bg-emerald-50/70 px-3 py-3"
4992
+ }
5346
4993
  }
5347
- if (!evaluateVisibility(field, valueReader, field.id)) {
5348
- hiddenControls.push({
5349
- fieldId: field.id,
5350
- reason: "not-visible"
5351
- });
5352
- continue;
4994
+ },
4995
+ macadamia: {
4996
+ banner: {
4997
+ tone: "studio",
4998
+ bannerClassName: "border border-border bg-background shadow-xl",
4999
+ summaryClassName: "rounded-xl border border-border bg-surface px-3 py-2 text-xs text-foreground",
5000
+ dialogItemClassName: "rounded-xl border border-border bg-surface px-3 py-2",
5001
+ titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
5002
+ descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
5003
+ detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
5004
+ summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
5005
+ summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
5006
+ secondaryButtonClassName: "border border-border bg-surface text-foreground hover:bg-button-outline-hover",
5007
+ primaryButtonClassName: "border border-primary bg-primary text-primary-foreground hover:bg-primary-hover",
5008
+ dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
5009
+ dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
5010
+ dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
5011
+ dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
5012
+ ctaLabel: "Complete setup in Macadamia",
5013
+ copyByState: {
5014
+ awaiting_confirmation: {
5015
+ title: "Confirm your email to carry on",
5016
+ description: "We've created the bones of your site. To carry on finishing setup, and to edit your site, you need to confirm your email to activate your account.",
5017
+ detail: "",
5018
+ checklistNote: ""
5019
+ },
5020
+ dashboard_ready: {
5021
+ title: "Here's your site preview",
5022
+ description: "We've created the bones of your site. Have a look around. If you like, you can add your site content here, or you can go straight to your dashboard to complete your setup. You'll be able to edit your site at any time, so don't worry if it's not perfect right now.",
5023
+ detail: "",
5024
+ checklistNote: ""
5025
+ },
5026
+ dashboard_resume: {
5027
+ title: "Your studio site is ready",
5028
+ description: "Keep exploring here, then use Complete setup in Macadamia to review your pages, add offerings, connect payments, and finish launch setup.",
5029
+ detail: "Macadamia is the normal place to finish setup for this studio site.",
5030
+ checklistNote: "The remaining launch steps are tracked in the same checklist you will see in Macadamia."
5031
+ }
5032
+ },
5033
+ dialog: {
5034
+ title: "What still happens in Macadamia",
5035
+ description: "Your preview is ready, but launch steps still happen in Macadamia so you can finish setup safely.",
5036
+ pendingIntro: "Your studio preview is live now, but the launch checklist stays in Macadamia so the final setup steps happen in the right place.",
5037
+ unlockedIntro: "Your studio preview is live now, and the same checklist will follow you into Macadamia when you are ready to finish setup.",
5038
+ outro: "You can keep exploring this preview now, then jump back into Macadamia when you're ready to finish setup."
5039
+ }
5040
+ },
5041
+ sidebar: {
5042
+ tone: "studio",
5043
+ rootClassName: "bg-stone-50/80",
5044
+ headerClassName: "border-b border-amber-200/70 bg-amber-50/70",
5045
+ guidance: {
5046
+ title: "Polish your studio preview",
5047
+ description: "Use preview for copy and layout tweaks. Complete setup in Macadamia to add offerings, connect payments, and finish the rest of your launch checklist.",
5048
+ ctaLabel: "Complete setup in Macadamia",
5049
+ cardClassName: "rounded-2xl border border-amber-200/80 bg-gradient-to-br from-amber-50 via-white to-orange-50 px-4 py-4 shadow-sm"
5050
+ }
5353
5051
  }
5354
- visibleControls.push({
5355
- kind: "manifest-field",
5356
- field: fieldWithDecidedVisibility(field),
5357
- placement: "panel",
5358
- intent
5359
- });
5360
5052
  }
5361
- const quickFieldIds = new Set(visibleControls.filter((control) => quickPriorityIndex.has(control.field.id)).sort((left, right) => (quickPriorityIndex.get(left.field.id) ?? Number.MAX_SAFE_INTEGER) - (quickPriorityIndex.get(right.field.id) ?? Number.MAX_SAFE_INTEGER)).slice(0, maxQuick).map((control) => control.field.id));
5053
+ };
5054
+ function getPreviewChromeSurfacePolicy(surfaceId) {
5055
+ return PREVIEW_CHROME_SURFACE_POLICIES[surfaceId];
5056
+ }
5057
+ function resolvePreviewSetupBannerModel(input) {
5058
+ if (!input.bannerState) return null;
5059
+ const policy = getPreviewChromeSurfacePolicy(input.surfaceId).banner;
5060
+ return {
5061
+ tone: policy.tone,
5062
+ bannerClassName: policy.bannerClassName,
5063
+ summaryClassName: policy.summaryClassName,
5064
+ dialogItemClassName: policy.dialogItemClassName,
5065
+ titleClassName: policy.titleClassName,
5066
+ descriptionClassName: policy.descriptionClassName,
5067
+ detailClassName: policy.detailClassName,
5068
+ summaryTitleClassName: policy.summaryTitleClassName,
5069
+ summaryBodyClassName: policy.summaryBodyClassName,
5070
+ secondaryButtonClassName: policy.secondaryButtonClassName,
5071
+ primaryButtonClassName: policy.primaryButtonClassName,
5072
+ dialogBodyClassName: policy.dialogBodyClassName,
5073
+ dialogItemTitleClassName: policy.dialogItemTitleClassName,
5074
+ dialogItemMetaClassName: policy.dialogItemMetaClassName,
5075
+ dialogItemDescriptionClassName: policy.dialogItemDescriptionClassName,
5076
+ ctaLabel: policy.ctaLabel,
5077
+ copy: policy.copyByState[input.bannerState],
5078
+ dialogTitle: policy.dialog.title,
5079
+ dialogDescription: policy.dialog.description,
5080
+ dialogIntro: input.dashboardUnlocked ? policy.dialog.unlockedIntro : policy.dialog.pendingIntro,
5081
+ dialogOutro: policy.dialog.outro
5082
+ };
5083
+ }
5084
+ function resolvePreviewSidebarChromeModel(surfaceId) {
5085
+ const policy = getPreviewChromeSurfacePolicy(surfaceId).sidebar;
5086
+ return {
5087
+ tone: policy.tone,
5088
+ rootClassName: policy.rootClassName,
5089
+ headerClassName: policy.headerClassName
5090
+ };
5091
+ }
5092
+ function resolvePreviewEditorGuidanceModel(input) {
5093
+ if (!input.canEdit || !input.hasDashboardSetupHandoff) return null;
5094
+ const policy = getPreviewChromeSurfacePolicy(input.surfaceId).sidebar;
5095
+ return {
5096
+ tone: policy.tone,
5097
+ title: policy.guidance.title,
5098
+ description: policy.guidance.description,
5099
+ ctaLabel: policy.guidance.ctaLabel,
5100
+ cardClassName: policy.guidance.cardClassName
5101
+ };
5102
+ }
5103
+ //#endregion
5104
+ //#region ../preview-next/src/client/preview/sanitizeDashboardPath.ts
5105
+ function sanitizeDashboardPath(value) {
5106
+ if (!value) return null;
5107
+ const trimmed = value.trim();
5108
+ if (!trimmed || /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return null;
5109
+ const normalized = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
5110
+ try {
5111
+ const parsed = new URL(normalized, "https://preview.local");
5112
+ return `${parsed.pathname}${parsed.search}${parsed.hash}`;
5113
+ } catch {
5114
+ return null;
5115
+ }
5116
+ }
5117
+ //#endregion
5118
+ //#region ../preview-next/src/client/preview/previewDashboardHandoff.ts
5119
+ function resolvePreviewDashboardSetupHandoffFromSearch(search) {
5120
+ const params = new URLSearchParams(search);
5121
+ if (params.get("preview_handoff") !== "dashboard_setup") return null;
5122
+ const dashboardPath = sanitizeDashboardPath(params.get("preview_dashboard"));
5123
+ if (!dashboardPath) return null;
5362
5124
  return {
5363
- quickControls: visibleControls.filter((control) => quickFieldIds.has(control.field.id)).map((control) => ({
5364
- ...control,
5365
- placement: "quick"
5366
- })),
5367
- panelControls: visibleControls.filter((control) => !quickFieldIds.has(control.field.id)),
5368
- hiddenControls
5125
+ kind: "dashboard_setup",
5126
+ dashboardPath
5369
5127
  };
5370
5128
  }
5371
- /** Top-level visibility is already decided; forms must not reread raw values. */
5372
- function fieldWithDecidedVisibility(field) {
5373
- if (!field.ui || !("visibleWhen" in field.ui)) return field;
5374
- const { visibleWhen: _visibleWhen, ...ui } = field.ui;
5129
+ function resolvePreviewDashboardSetupHandoff() {
5130
+ if (typeof window === "undefined") return null;
5131
+ return resolvePreviewDashboardSetupHandoffFromSearch(window.location.search);
5132
+ }
5133
+ function buildPreviewDashboardSetupUrl(dashboardBaseUrl, handoff) {
5134
+ if (!dashboardBaseUrl || !handoff) return null;
5135
+ return new URL(handoff.dashboardPath, dashboardBaseUrl).toString();
5136
+ }
5137
+ //#endregion
5138
+ //#region ../preview-next/src/client/preview/siteStyleAccess.ts
5139
+ function resolveSiteStyleAccess(session) {
5140
+ if (session?.kind === "userSession" && session.canEdit) return { kind: "apply-allowed" };
5141
+ return { kind: "hidden" };
5142
+ }
5143
+ function canInspectSiteStyle(access) {
5144
+ return access.kind === "apply-allowed";
5145
+ }
5146
+ //#endregion
5147
+ //#region ../preview-next/src/constants.ts
5148
+ const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
5149
+ const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
5150
+ const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
5151
+ //#endregion
5152
+ //#region ../preview-next/src/client/preview/previewChromeSurface.ts
5153
+ const PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
5154
+ const PREVIEW_CHROME_PORTAL_CLASS_NAME = "builder-editor-chrome";
5155
+ function resolvePreviewChromeSurface(surfaceId) {
5156
+ if (!surfaceId) return {
5157
+ surfaceClassName: null,
5158
+ dataSurface: null
5159
+ };
5160
+ const surfaceDocument = resolveSurfaceDocumentAttributes(surfaceId);
5375
5161
  return {
5376
- ...field,
5377
- ui
5162
+ surfaceClassName: surfaceDocument.htmlClassName ?? null,
5163
+ dataSurface: surfaceDocument.dataSurface ?? null
5378
5164
  };
5379
5165
  }
5380
- function createVisibilityValueReader(content, appearance) {
5381
- return { getValue: (path) => appearance && path === "blockLook" ? appearance.lookId : appearance && path === appearance.arrangementField ? appearance.arrangement : getValueAtPath(content, path) };
5166
+ function getPreviewChromeSurfaceDataProps(surface) {
5167
+ return surface.dataSurface ? { [SURFACE_DOCUMENT_DATA_ATTRIBUTE]: surface.dataSurface } : {};
5382
5168
  }
5383
- function getValueAtPath(source, path) {
5384
- if (!path) return source;
5385
- let current = source;
5386
- for (const segment of path.split(".")) {
5387
- if (!current || typeof current !== "object") return;
5388
- current = current[segment];
5169
+ function applyPreviewChromeSurfaceToElement(element, surface, options) {
5170
+ element.classList.add(PREVIEW_CHROME_THEME_CLASS_NAME);
5171
+ if (options?.includePortalClass) element.classList.add(PREVIEW_CHROME_PORTAL_CLASS_NAME);
5172
+ for (const candidateSurfaceId of SURFACE_IDS) element.classList.remove(`surface-${candidateSurfaceId}`);
5173
+ if (surface.surfaceClassName) element.classList.add(surface.surfaceClassName);
5174
+ if (surface.dataSurface) {
5175
+ element.setAttribute(SURFACE_DOCUMENT_DATA_ATTRIBUTE, surface.dataSurface);
5176
+ return;
5389
5177
  }
5390
- return current;
5178
+ element.removeAttribute(SURFACE_DOCUMENT_DATA_ATTRIBUTE);
5391
5179
  }
5392
- function useBlockCustomizeControls({ blockId, blockKind, content, uiStore, theme, sdkConfig, maxQuickFields = 3, maxPopoverRows, builtInPopoverRows = 0 }) {
5393
- const { blockFieldOptions, blockFieldExtensions, sdkConfig: contextSdkConfig } = useSdkConfig();
5394
- const effectiveSdkConfig = sdkConfig ?? contextSdkConfig;
5395
- const manifest = useMemo(() => resolveBlockManifest(blockKind, effectiveSdkConfig ?? null), [blockKind, effectiveSdkConfig]);
5396
- const preparedManifest = useMemo(() => {
5397
- if (!manifest) return null;
5398
- return prepareBlockEditorManifest({
5399
- manifest,
5400
- blockKind,
5401
- theme,
5402
- blockFieldOptions,
5403
- blockFieldExtensions,
5404
- visibilityPolicy: hideThemeV2RawStyleFields
5405
- });
5406
- }, [
5407
- blockFieldExtensions,
5408
- blockFieldOptions,
5409
- blockKind,
5410
- manifest,
5411
- theme
5412
- ]);
5413
- const { state: pageDesignState } = usePreviewPageDesignEditorState();
5414
- const designBlock = useMemo(() => pageDesignState.kind === "loaded" ? pageDesignState.editorModel.blocks.find((block) => String(block.blockId) === String(blockId)) ?? null : null, [blockId, pageDesignState]);
5415
- const ownedFieldIds = useMemo(() => arrangementOwnedFieldIds(designBlock), [designBlock]);
5416
- const visibilityValues = useMemo(() => arrangementVisibilityValues(designBlock), [designBlock]);
5417
- const fields = useMemo(() => {
5418
- if (!preparedManifest) return [];
5419
- return createManifestFormAdapter(preparedManifest.renderManifest).fields.filter((field) => !ownedFieldIds.includes(field.id));
5420
- }, [ownedFieldIds, preparedManifest]);
5421
- const preliminaryPlan = useMemo(() => createPreviewCustomizeControlPlan({
5422
- fields,
5423
- content,
5424
- visibilityValues,
5425
- quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
5426
- maxQuickFields
5427
- }), [
5428
- content,
5429
- visibilityValues,
5430
- fields,
5431
- manifest?.previewCustomize?.quickFieldPriority,
5432
- maxQuickFields
5433
- ]);
5434
- const budgetedMaxQuickFields = resolveQuickFieldBudget({
5435
- requestedMaxQuickFields: maxQuickFields,
5436
- maxPopoverRows,
5437
- builtInPopoverRows,
5438
- hasOverflowControls: preliminaryPlan.panelControls.length > 0
5439
- });
5440
- const controlPlan = useMemo(() => {
5441
- if (budgetedMaxQuickFields === maxQuickFields) return preliminaryPlan;
5442
- return createPreviewCustomizeControlPlan({
5443
- fields,
5444
- content,
5445
- visibilityValues,
5446
- quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
5447
- maxQuickFields: budgetedMaxQuickFields
5180
+ //#endregion
5181
+ //#region ../preview-next/src/client/preview/PreviewAuthInit.tsx
5182
+ function PreviewAuthInit({ children, session, siteId, siteSlug, pageId, token }) {
5183
+ const lastInitRef = useRef(null);
5184
+ const sessionKey = session ? session.kind === "userSession" ? `${session.kind}:${session.canEdit}:${session.canManage}:${session.expiresAt ?? "no-expiry"}` : `${session.kind}:${session.expiresAt ?? "no-expiry"}` : "none";
5185
+ const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ?? "no-token"}`;
5186
+ if (lastInitRef.current !== currentKey) {
5187
+ initPreviewAuth({
5188
+ session,
5189
+ siteId,
5190
+ siteSlug,
5191
+ pageId,
5192
+ token
5448
5193
  });
5449
- }, [
5450
- budgetedMaxQuickFields,
5451
- content,
5452
- fields,
5453
- manifest?.previewCustomize?.quickFieldPriority,
5454
- maxQuickFields,
5455
- preliminaryPlan,
5456
- visibilityValues
5457
- ]);
5458
- const quickFields = useMemo(() => controlPlan.quickControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.quickControls]);
5459
- const panelFields = useMemo(() => controlPlan.panelControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.panelControls]);
5460
- return {
5461
- manifest,
5462
- controlPlan,
5463
- quickFields,
5464
- panelFields,
5465
- backend: useMemo(() => {
5466
- if (!preparedManifest) return null;
5467
- return createStoreBackend({
5468
- scope: "blocks",
5469
- store: uiStore,
5470
- blockId
5471
- });
5472
- }, [
5473
- blockId,
5474
- preparedManifest,
5475
- uiStore
5476
- ]),
5477
- hasControls: quickFields.length > 0 || panelFields.length > 0,
5478
- hasOverflowControls: panelFields.length > 0
5479
- };
5194
+ lastInitRef.current = currentKey;
5195
+ }
5196
+ return /* @__PURE__ */ jsx(Fragment$1, { children });
5197
+ }
5198
+ //#endregion
5199
+ //#region ../preview-next/src/client/preview/pageSchema.ts
5200
+ const PAGE_CONTENT_TYPE_SCHEMA = {
5201
+ version: 1,
5202
+ fields: [],
5203
+ labels: {
5204
+ singular: "Page",
5205
+ plural: "Pages"
5206
+ },
5207
+ routing: {
5208
+ enabled: true,
5209
+ pattern: "/{slug}",
5210
+ slugField: "slug",
5211
+ prefix: "/"
5212
+ }
5213
+ };
5214
+ //#endregion
5215
+ //#region ../blocks/src/system/data/utils.ts
5216
+ /**
5217
+ * Normalize data loaders from block definition
5218
+ */
5219
+ function normalizeDataLoaders(def) {
5220
+ if (!def?.dataLoaders) return [];
5221
+ return Object.entries(def.dataLoaders).map(([key, loader]) => ({
5222
+ key,
5223
+ loader
5224
+ }));
5225
+ }
5226
+ /**
5227
+ * Normalize block content for data loading.
5228
+ * Priority: draftContent > content > publishedContent
5229
+ */
5230
+ function normalizeContent(block) {
5231
+ const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
5232
+ if (!isObjectRecord(source)) return {};
5233
+ if ("data" in source) {
5234
+ const data = source.data;
5235
+ if (isObjectRecord(data)) return data;
5236
+ if (data === null || data === void 0) return {};
5237
+ }
5238
+ return source;
5239
+ }
5240
+ /**
5241
+ * Normalize params for API calls.
5242
+ * Converts supplied values to strings, preserving absent versus explicitly empty params.
5243
+ */
5244
+ function normalizeParams(input) {
5245
+ if (!input || typeof input !== "object") return {};
5246
+ const output = {};
5247
+ for (const [key, value] of Object.entries(input)) if (value !== void 0 && value !== null) output[key] = coerceToString(value);
5248
+ return output;
5249
+ }
5250
+ function isNonArrayObject(value) {
5251
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5252
+ }
5253
+ function safeJsonStringify(value) {
5254
+ try {
5255
+ return JSON.stringify(value);
5256
+ } catch {
5257
+ return;
5258
+ }
5259
+ }
5260
+ /**
5261
+ * Coerce value to string for API params
5262
+ */
5263
+ function coerceToString(value) {
5264
+ if (value === null || value === void 0) return "";
5265
+ if (Array.isArray(value)) {
5266
+ if (value.some(isNonArrayObject)) {
5267
+ const json = safeJsonStringify(value);
5268
+ if (typeof json === "string") return json;
5269
+ }
5270
+ return value.map(coerceToString).join(",");
5271
+ }
5272
+ if (isNonArrayObject(value)) {
5273
+ const json = safeJsonStringify(value);
5274
+ if (typeof json === "string") return json;
5275
+ }
5276
+ if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
5277
+ return "";
5480
5278
  }
5481
- function resolveQuickFieldBudget({ requestedMaxQuickFields, maxPopoverRows, builtInPopoverRows, hasOverflowControls }) {
5482
- const cappedRequested = Math.max(0, Math.min(3, requestedMaxQuickFields));
5483
- if (typeof maxPopoverRows !== "number") return cappedRequested;
5484
- const customizeRowCount = hasOverflowControls ? 1 : 0;
5485
- const availableRows = maxPopoverRows - builtInPopoverRows - customizeRowCount;
5486
- return Math.max(0, Math.min(cappedRequested, availableRows));
5279
+ /**
5280
+ * The appointment-services catalogue (issue 1403) pairs the services with the
5281
+ * site's ordered categories. Both are needed to group them, so that response
5282
+ * is passed through whole; any other `{ services }` wrapper is unwrapped.
5283
+ */
5284
+ function coerceServicesPayload(record) {
5285
+ return Array.isArray(record.services) && Array.isArray(record.categories) ? {
5286
+ services: record.services,
5287
+ categories: record.categories
5288
+ } : record.services;
5487
5289
  }
5488
- function resolveBlockManifest(blockKind, sdkConfig) {
5489
- return getBlockManifestFromSdkConfig(blockKind, sdkConfig) ?? getBlockDefinition(blockKind)?.manifest ?? null;
5290
+ /**
5291
+ * Extract data from API response.
5292
+ * Unwraps common response wrappers: { data }, { form }, { entries }, { services }, { teamMembers }
5293
+ *
5294
+ * Note: We check that properties are NOT functions to avoid returning
5295
+ * built-in methods like Array.prototype.entries
5296
+ */
5297
+ function coercePayload(payload) {
5298
+ const linkedContentEntries = coerceLinkedContentEntriesPayload(payload);
5299
+ if (linkedContentEntries !== payload) return linkedContentEntries;
5300
+ if (payload && typeof payload === "object" && !Array.isArray(payload)) {
5301
+ const record = payload;
5302
+ if ("data" in record && typeof record.data !== "function") return record.data;
5303
+ if ("form" in record && typeof record.form !== "function") return record.form;
5304
+ if ("entries" in record && typeof record.entries !== "function") return record.entries;
5305
+ if ("services" in record && typeof record.services !== "function") return coerceServicesPayload(record);
5306
+ if ("teamMembers" in record && typeof record.teamMembers !== "function") return record.teamMembers;
5307
+ }
5308
+ return payload;
5490
5309
  }
5491
5310
  //#endregion
5492
- //#region ../preview-next/src/client/preview/PreviewSiteFontStorageContext.tsx
5493
- const PreviewSiteFontStorageContext = createContext(void 0);
5494
- function PreviewSiteFontStorageProvider({ siteFontStorageUrl, children }) {
5495
- return /* @__PURE__ */ jsx(PreviewSiteFontStorageContext.Provider, {
5496
- value: siteFontStorageUrl,
5497
- children
5498
- });
5311
+ //#region ../blocks/src/system/data/fetchLoaderData.ts
5312
+ const ALL_PAGE_SIZE = 50;
5313
+ /** The shared loader owns All pagination and rejects adapters that repeat a page. */
5314
+ async function fetchLoaderData(apiClient, endpoint, params) {
5315
+ if (params.limit === "all") return fetchAllPages(apiClient, endpoint, params, 0, /* @__PURE__ */ new Set());
5316
+ return coercePayload(await apiClient({
5317
+ endpoint,
5318
+ params
5319
+ }));
5499
5320
  }
5500
- function usePreviewSiteFontStorageUrl() {
5501
- return useContext(PreviewSiteFontStorageContext);
5321
+ function planLoaderPage(data, offset, seenPages) {
5322
+ if (!isUnknownArray$1(data)) return {
5323
+ kind: "invalid",
5324
+ message: "Expected paged loader entries"
5325
+ };
5326
+ if (data.length < ALL_PAGE_SIZE) return {
5327
+ kind: "complete",
5328
+ entries: data
5329
+ };
5330
+ const ids = data.map((entry) => isObjectRecord(entry) && typeof entry.id === "string" ? entry.id : null);
5331
+ const key = JSON.stringify(ids.every((id) => id !== null) ? [...ids].sort() : data);
5332
+ if (seenPages.has(key)) return {
5333
+ kind: "invalid",
5334
+ message: "Paged loader made no progress"
5335
+ };
5336
+ return {
5337
+ kind: "continue",
5338
+ entries: data,
5339
+ offset: offset + data.length,
5340
+ seenPages: /* @__PURE__ */ new Set([...seenPages, key])
5341
+ };
5502
5342
  }
5503
- //#endregion
5504
- //#region ../preview-next/src/client/preview/previewChromeSurfacePolicy.ts
5505
- const PREVIEW_CHROME_SURFACE_POLICIES = {
5506
- core: {
5507
- banner: {
5508
- tone: "default",
5509
- bannerClassName: "border border-emerald-200/70 bg-white/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-white/92",
5510
- summaryClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",
5511
- dialogItemClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2",
5512
- titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
5513
- descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
5514
- detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
5515
- summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
5516
- summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
5517
- secondaryButtonClassName: "",
5518
- primaryButtonClassName: "",
5519
- dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
5520
- dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
5521
- dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
5522
- dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
5523
- ctaLabel: "Complete setup in dashboard",
5524
- copyByState: {
5525
- awaiting_confirmation: {
5526
- title: "Your draft preview is ready",
5527
- description: "Explore your site here, then confirm your email to unlock the dashboard and finish launch setup.",
5528
- detail: "Once your email is confirmed, Complete setup in dashboard will take you straight to the remaining checklist.",
5529
- checklistNote: "Email confirmation is the only blocker before dashboard access. The rest of the launch checklist lives in the dashboard."
5530
- },
5531
- dashboard_ready: {
5532
- title: "Your dashboard is unlocked",
5533
- description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
5534
- detail: "The dashboard is the place to complete the remaining checklist and get your site ready to launch.",
5535
- checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
5536
- },
5537
- dashboard_resume: {
5538
- title: "Your draft site is ready",
5539
- description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
5540
- detail: "The dashboard is the normal place to finish setup for this site.",
5541
- checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
5542
- }
5543
- },
5544
- dialog: {
5545
- title: "What still happens in the dashboard",
5546
- description: "Your preview is ready, but launch steps still happen in the dashboard so you can finish setup safely.",
5547
- pendingIntro: "Your preview is live now, but the launch checklist stays in the dashboard so the final setup steps happen in the right place.",
5548
- unlockedIntro: "Your preview is live now, and the same checklist will follow you into the dashboard when you are ready to finish setup.",
5549
- outro: "You can keep exploring this preview now, then jump back into the dashboard when you're ready to finish setup."
5550
- }
5551
- },
5552
- sidebar: {
5553
- tone: "default",
5554
- rootClassName: "bg-background",
5555
- headerClassName: "border-b",
5556
- guidance: {
5557
- title: "Make quick edits in preview",
5558
- description: "Use preview for copy and layout tweaks. Complete setup in dashboard to add offerings, connect payments, and finish the rest of your launch checklist.",
5559
- ctaLabel: "Complete setup in dashboard",
5560
- cardClassName: "rounded-lg border border-emerald-200/70 bg-emerald-50/70 px-3 py-3"
5561
- }
5562
- }
5563
- },
5564
- macadamia: {
5565
- banner: {
5566
- tone: "studio",
5567
- bannerClassName: "border border-border bg-background shadow-xl",
5568
- summaryClassName: "rounded-xl border border-border bg-surface px-3 py-2 text-xs text-foreground",
5569
- dialogItemClassName: "rounded-xl border border-border bg-surface px-3 py-2",
5570
- titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
5571
- descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
5572
- detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
5573
- summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
5574
- summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
5575
- secondaryButtonClassName: "border border-border bg-surface text-foreground hover:bg-button-outline-hover",
5576
- primaryButtonClassName: "border border-primary bg-primary text-primary-foreground hover:bg-primary-hover",
5577
- dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
5578
- dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
5579
- dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
5580
- dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
5581
- ctaLabel: "Complete setup in Macadamia",
5582
- copyByState: {
5583
- awaiting_confirmation: {
5584
- title: "Confirm your email to carry on",
5585
- description: "We've created the bones of your site. To carry on finishing setup, and to edit your site, you need to confirm your email to activate your account.",
5586
- detail: "",
5587
- checklistNote: ""
5588
- },
5589
- dashboard_ready: {
5590
- title: "Here's your site preview",
5591
- description: "We've created the bones of your site. Have a look around. If you like, you can add your site content here, or you can go straight to your dashboard to complete your setup. You'll be able to edit your site at any time, so don't worry if it's not perfect right now.",
5592
- detail: "",
5593
- checklistNote: ""
5594
- },
5595
- dashboard_resume: {
5596
- title: "Your studio site is ready",
5597
- description: "Keep exploring here, then use Complete setup in Macadamia to review your pages, add offerings, connect payments, and finish launch setup.",
5598
- detail: "Macadamia is the normal place to finish setup for this studio site.",
5599
- checklistNote: "The remaining launch steps are tracked in the same checklist you will see in Macadamia."
5600
- }
5601
- },
5602
- dialog: {
5603
- title: "What still happens in Macadamia",
5604
- description: "Your preview is ready, but launch steps still happen in Macadamia so you can finish setup safely.",
5605
- pendingIntro: "Your studio preview is live now, but the launch checklist stays in Macadamia so the final setup steps happen in the right place.",
5606
- unlockedIntro: "Your studio preview is live now, and the same checklist will follow you into Macadamia when you are ready to finish setup.",
5607
- outro: "You can keep exploring this preview now, then jump back into Macadamia when you're ready to finish setup."
5608
- }
5609
- },
5610
- sidebar: {
5611
- tone: "studio",
5612
- rootClassName: "bg-stone-50/80",
5613
- headerClassName: "border-b border-amber-200/70 bg-amber-50/70",
5614
- guidance: {
5615
- title: "Polish your studio preview",
5616
- description: "Use preview for copy and layout tweaks. Complete setup in Macadamia to add offerings, connect payments, and finish the rest of your launch checklist.",
5617
- ctaLabel: "Complete setup in Macadamia",
5618
- cardClassName: "rounded-2xl border border-amber-200/80 bg-gradient-to-br from-amber-50 via-white to-orange-50 px-4 py-4 shadow-sm"
5619
- }
5343
+ async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
5344
+ const page = planLoaderPage(coercePayload(await apiClient({
5345
+ endpoint,
5346
+ params: {
5347
+ ...params,
5348
+ limit: String(ALL_PAGE_SIZE),
5349
+ offset: String(offset)
5620
5350
  }
5351
+ })), offset, seenPages);
5352
+ switch (page.kind) {
5353
+ case "invalid": throw new Error(page.message);
5354
+ case "complete": return page.entries;
5355
+ case "continue": return [...page.entries, ...await fetchAllPages(apiClient, endpoint, params, page.offset, page.seenPages)];
5356
+ default: return assertNever$2(page);
5621
5357
  }
5622
- };
5623
- function getPreviewChromeSurfacePolicy(surfaceId) {
5624
- return PREVIEW_CHROME_SURFACE_POLICIES[surfaceId];
5625
5358
  }
5626
- function resolvePreviewSetupBannerModel(input) {
5627
- if (!input.bannerState) return null;
5628
- const policy = getPreviewChromeSurfacePolicy(input.surfaceId).banner;
5629
- return {
5630
- tone: policy.tone,
5631
- bannerClassName: policy.bannerClassName,
5632
- summaryClassName: policy.summaryClassName,
5633
- dialogItemClassName: policy.dialogItemClassName,
5634
- titleClassName: policy.titleClassName,
5635
- descriptionClassName: policy.descriptionClassName,
5636
- detailClassName: policy.detailClassName,
5637
- summaryTitleClassName: policy.summaryTitleClassName,
5638
- summaryBodyClassName: policy.summaryBodyClassName,
5639
- secondaryButtonClassName: policy.secondaryButtonClassName,
5640
- primaryButtonClassName: policy.primaryButtonClassName,
5641
- dialogBodyClassName: policy.dialogBodyClassName,
5642
- dialogItemTitleClassName: policy.dialogItemTitleClassName,
5643
- dialogItemMetaClassName: policy.dialogItemMetaClassName,
5644
- dialogItemDescriptionClassName: policy.dialogItemDescriptionClassName,
5645
- ctaLabel: policy.ctaLabel,
5646
- copy: policy.copyByState[input.bannerState],
5647
- dialogTitle: policy.dialog.title,
5648
- dialogDescription: policy.dialog.description,
5649
- dialogIntro: input.dashboardUnlocked ? policy.dialog.unlockedIntro : policy.dialog.pendingIntro,
5650
- dialogOutro: policy.dialog.outro
5651
- };
5359
+ function isUnknownArray$1(value) {
5360
+ return Array.isArray(value);
5361
+ }
5362
+ //#endregion
5363
+ //#region ../blocks/src/system/runtime/bindings.ts
5364
+ const shouldLogWarnings = isNonProductionEnv();
5365
+ function isPlainObject(value) {
5366
+ return typeof value === "object" && value !== null && !Array.isArray(value);
5367
+ }
5368
+ function isRouteMapEntry(value) {
5369
+ if (typeof value === "string") return true;
5370
+ return isPlainObject(value);
5371
+ }
5372
+ function isRouteMap(value) {
5373
+ if (!isPlainObject(value)) return false;
5374
+ return Object.values(value).every(isRouteMapEntry);
5375
+ }
5376
+ function isPageIdentifierMap(value) {
5377
+ if (!isPlainObject(value)) return false;
5378
+ return Object.values(value).every((v) => typeof v === "string");
5652
5379
  }
5653
- function resolvePreviewSidebarChromeModel(surfaceId) {
5654
- const policy = getPreviewChromeSurfacePolicy(surfaceId).sidebar;
5655
- return {
5656
- tone: policy.tone,
5657
- rootClassName: policy.rootClassName,
5658
- headerClassName: policy.headerClassName
5659
- };
5380
+ function isEntryIdentifierMap(value) {
5381
+ if (!isPlainObject(value)) return false;
5382
+ for (const v of Object.values(value)) {
5383
+ if (!isPlainObject(v)) return false;
5384
+ if (!Object.values(v).every((inner) => typeof inner === "string")) return false;
5385
+ }
5386
+ return true;
5660
5387
  }
5661
- function resolvePreviewEditorGuidanceModel(input) {
5662
- if (!input.canEdit || !input.hasDashboardSetupHandoff) return null;
5663
- const policy = getPreviewChromeSurfacePolicy(input.surfaceId).sidebar;
5388
+ function buildTransformContext(vm) {
5389
+ const root = vm.$root;
5390
+ const stage = root && isPlainObject(root) && root.previewStage === "preview" ? "preview" : "published";
5391
+ const routes = root && isPlainObject(root) && isRouteMap(root.routes) ? root.routes : void 0;
5392
+ const pagesByIdentifier = root && isPlainObject(root) && isPageIdentifierMap(root.pagesByIdentifier) ? root.pagesByIdentifier : void 0;
5393
+ const entriesByIdentifier = root && isPlainObject(root) && isEntryIdentifierMap(root.entriesByIdentifier) ? root.entriesByIdentifier : void 0;
5664
5394
  return {
5665
- tone: policy.tone,
5666
- title: policy.guidance.title,
5667
- description: policy.guidance.description,
5668
- ctaLabel: policy.guidance.ctaLabel,
5669
- cardClassName: policy.guidance.cardClassName
5395
+ theme: defaultThemeTokens,
5396
+ stage,
5397
+ data: vm.content,
5398
+ routes,
5399
+ pagesByIdentifier,
5400
+ entriesByIdentifier
5670
5401
  };
5671
5402
  }
5672
- //#endregion
5673
- //#region ../preview-next/src/client/preview/sanitizeDashboardPath.ts
5674
- function sanitizeDashboardPath(value) {
5675
- if (!value) return null;
5676
- const trimmed = value.trim();
5677
- if (!trimmed || /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return null;
5678
- const normalized = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
5679
- try {
5680
- const parsed = new URL(normalized, "https://preview.local");
5681
- return `${parsed.pathname}${parsed.search}${parsed.hash}`;
5682
- } catch {
5683
- return null;
5403
+ function resolveParamsBindings(input, vm, meta) {
5404
+ if (input === null || typeof input !== "object") return input;
5405
+ if (Array.isArray(input)) return input.map((v) => resolveParamsBindings(v, vm, meta));
5406
+ const maybeBind = input.$bind;
5407
+ if (maybeBind && typeof maybeBind === "object") try {
5408
+ const binding = bindingSchema.parse(maybeBind);
5409
+ const value = resolveBinding(binding.from, vm);
5410
+ const resolved = value === void 0 || value === null ? binding.fallback : runTransforms(value, binding.transforms, buildTransformContext(vm), defaultTransforms);
5411
+ if (resolved === void 0 || resolved === null || resolved === "") return binding.fallback;
5412
+ return resolved;
5413
+ } catch (err) {
5414
+ if (shouldLogWarnings) console.warn(`bindings: failed to parse loader param binding for block "${meta?.blockKind ?? "unknown"}"`, err);
5415
+ return;
5416
+ }
5417
+ const out = {};
5418
+ for (const [k, v] of Object.entries(input)) out[k] = resolveParamsBindings(v, vm, meta);
5419
+ return out;
5420
+ }
5421
+ function resolveBinding(path, vm) {
5422
+ const segments = splitPath(path);
5423
+ if (!segments.length) return void 0;
5424
+ const [first, ...rest] = segments;
5425
+ let source = vm;
5426
+ if (first === "$root") {
5427
+ source = vm;
5428
+ return readFromSource(source, [first, ...rest]);
5429
+ }
5430
+ if (first === "content") {
5431
+ source = vm.content;
5432
+ return readFromSource(source, rest);
5433
+ }
5434
+ const contentResult = readFromSource(vm.content, segments);
5435
+ if (contentResult !== void 0) return contentResult;
5436
+ return readFromSource(vm, segments);
5437
+ }
5438
+ function splitPath(path) {
5439
+ const PATH_SEPARATOR_REGEX = /\./g;
5440
+ const BRACKET_ACCESS_REGEX = /\[(?<token>[^\]]+)\]/g;
5441
+ const segments = [];
5442
+ const parts = path.split(PATH_SEPARATOR_REGEX);
5443
+ for (const raw of parts) {
5444
+ if (!raw) continue;
5445
+ const baseMatch = raw.match(/^([^\[]+)/);
5446
+ if (baseMatch && baseMatch[1]) segments.push(baseMatch[1]);
5447
+ const bracketMatches = raw.matchAll(BRACKET_ACCESS_REGEX);
5448
+ for (const match of bracketMatches) {
5449
+ const token = match.groups?.token ?? "";
5450
+ if (token.startsWith("\"") || token.startsWith("'")) segments.push(token.slice(1, -1));
5451
+ else if (/^\d+$/.test(token)) segments.push(Number(token));
5452
+ else segments.push(token);
5453
+ }
5454
+ if (!baseMatch && !raw.includes("[")) segments.push(raw);
5684
5455
  }
5456
+ return segments;
5457
+ }
5458
+ function readFromSource(source, segments) {
5459
+ return segments.reduce((current, segment) => {
5460
+ if (current === void 0 || current === null) return void 0;
5461
+ if (typeof segment === "number") {
5462
+ if (Array.isArray(current)) return current[segment];
5463
+ return;
5464
+ }
5465
+ if (typeof current === "object" && current !== null && segment in current) return current[segment];
5466
+ }, source);
5467
+ }
5468
+ function isNonProductionEnv() {
5469
+ if (typeof globalThis === "undefined") return true;
5470
+ return globalThis.process?.env?.NODE_ENV !== "production";
5685
5471
  }
5686
5472
  //#endregion
5687
- //#region ../preview-next/src/client/preview/previewDashboardHandoff.ts
5688
- function resolvePreviewDashboardSetupHandoffFromSearch(search) {
5689
- const params = new URLSearchParams(search);
5690
- if (params.get("preview_handoff") !== "dashboard_setup") return null;
5691
- const dashboardPath = sanitizeDashboardPath(params.get("preview_dashboard"));
5692
- if (!dashboardPath) return null;
5473
+ //#region ../blocks/src/system/data/prefetchBlockData.ts
5474
+ /**
5475
+ * Core block data prefetching logic (framework-agnostic).
5476
+ *
5477
+ * This module provides the shared implementation for prefetching block data loaders.
5478
+ * It works with any API client by accepting it as a parameter (dependency injection).
5479
+ *
5480
+ * Usage:
5481
+ * - Frontend: provide internal API client
5482
+ * - SDK: provide SDK client with endpoint mapping
5483
+ */
5484
+ function projectDataLoaders(loaders, shouldLoad, blockId, blockKind) {
5485
+ if (!shouldLoad) return [...loaders];
5486
+ return loaders.filter(({ key }) => shouldLoad({
5487
+ blockId,
5488
+ blockKind,
5489
+ loaderKey: key
5490
+ }));
5491
+ }
5492
+ function shouldSkipResolvedLoader(input) {
5493
+ if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
5494
+ return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
5495
+ }
5496
+ /**
5497
+ * Core data prefetching logic (framework-agnostic).
5498
+ *
5499
+ * This function is shared between frontend and SDK implementations.
5500
+ * It handles:
5501
+ * - Extracting data loaders from block definitions
5502
+ * - Resolving loader params with block content
5503
+ * - Executing server-mode loaders in parallel
5504
+ * - Organizing results by block ID and loader key
5505
+ *
5506
+ * @example
5507
+ * ```typescript
5508
+ * const resolved = await prefetchBlockData(page, context, {
5509
+ * apiClient: async ({ endpoint, params }) => {
5510
+ * return await myApiClient({ endpoint, params });
5511
+ * },
5512
+ * isValidEndpoint: (endpoint) => endpoint in API_ENDPOINTS,
5513
+ * });
5514
+ * ```
5515
+ */
5516
+ async function prefetchBlockData(page, context, options) {
5517
+ return (await prefetchBlockDataWithFailures(page, context, options)).resolvedData;
5518
+ }
5519
+ async function prefetchBlockDataWithFailures(page, context, options) {
5520
+ const { apiClient, isValidEndpoint, onError, getCustomBlockLoaders, getBlockDefinition: getBlockDefinition$1 = getBlockDefinition, resolveParamsBindings: resolveParamsBindings$1 = resolveParamsBindings, shouldLoad } = options;
5521
+ const results = {};
5522
+ const loaderFailures = {};
5523
+ const tasks = [];
5524
+ for (const block of page.blocks) {
5525
+ const blockId = block.id;
5526
+ if (!blockId) continue;
5527
+ let loaders;
5528
+ const def = getBlockDefinition$1(block.kind);
5529
+ if (def) loaders = normalizeDataLoaders(def);
5530
+ else if (getCustomBlockLoaders) {
5531
+ const customLoaders = getCustomBlockLoaders(block.kind);
5532
+ loaders = customLoaders ? Object.entries(customLoaders).map(([key, loader]) => ({
5533
+ key,
5534
+ loader
5535
+ })) : [];
5536
+ } else loaders = [];
5537
+ loaders = projectDataLoaders(loaders, shouldLoad, blockId, block.kind);
5538
+ if (loaders.length === 0) continue;
5539
+ const root = {
5540
+ ...context.root ?? {},
5541
+ siteId: context.siteId,
5542
+ pageId: context.pageId,
5543
+ previewStage: context.previewStage
5544
+ };
5545
+ const vm = {
5546
+ content: plannedLoaderContent(block, def, context),
5547
+ $root: root
5548
+ };
5549
+ for (const { key, loader } of loaders) {
5550
+ if (loader.mode === "client") continue;
5551
+ if (typeof loader.when !== "undefined") {
5552
+ if (resolveParamsBindings$1(loader.when, vm, { blockKind: block.kind }) !== true) continue;
5553
+ }
5554
+ const params = normalizeParams(resolveParamsBindings$1(loader.params, vm, { blockKind: block.kind }));
5555
+ const endpoint = loader.endpoint;
5556
+ if (shouldSkipResolvedLoader({
5557
+ loader,
5558
+ endpoint,
5559
+ params,
5560
+ isValidEndpoint
5561
+ })) continue;
5562
+ tasks.push((async () => {
5563
+ try {
5564
+ const data = await fetchLoaderData(apiClient, endpoint, params);
5565
+ const blockResults = results[blockId] ?? (results[blockId] = {});
5566
+ blockResults[key] = data;
5567
+ } catch (error) {
5568
+ const blockFailures = loaderFailures[blockId] ?? (loaderFailures[blockId] = {});
5569
+ blockFailures[key] = {
5570
+ endpoint,
5571
+ params
5572
+ };
5573
+ if (onError) onError(error, {
5574
+ block: block.kind,
5575
+ loader: key
5576
+ });
5577
+ }
5578
+ })());
5579
+ }
5580
+ }
5581
+ if (tasks.length > 0) await Promise.all(tasks);
5693
5582
  return {
5694
- kind: "dashboard_setup",
5695
- dashboardPath
5583
+ resolvedData: results,
5584
+ loaderFailures
5696
5585
  };
5697
5586
  }
5698
- function resolvePreviewDashboardSetupHandoff() {
5699
- if (typeof window === "undefined") return null;
5700
- return resolvePreviewDashboardSetupHandoffFromSearch(window.location.search);
5587
+ /** Prefetch executes the render-plan content stage before resolving loader bindings. */
5588
+ function plannedLoaderContent(block, definition, context) {
5589
+ const content = normalizeContent(block);
5590
+ if (!definition || content._arrangementLooks === void 0) return content;
5591
+ return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
5592
+ }
5593
+ //#endregion
5594
+ //#region ../blocks/src/system/data/batching.ts
5595
+ function stableNormalize(value) {
5596
+ if (value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean") return value;
5597
+ if (Array.isArray(value)) return value.map(stableNormalize);
5598
+ if (typeof value === "object" && value) {
5599
+ const obj = value;
5600
+ const keys = Object.keys(obj).sort();
5601
+ const out = {};
5602
+ for (const key of keys) {
5603
+ const v = obj[key];
5604
+ if (v === void 0) continue;
5605
+ out[key] = stableNormalize(v);
5606
+ }
5607
+ return out;
5608
+ }
5609
+ if (typeof value === "bigint" || typeof value === "symbol" || typeof value === "undefined") return String(value);
5610
+ return null;
5611
+ }
5612
+ function stableSerialize(value) {
5613
+ return JSON.stringify(stableNormalize(value));
5701
5614
  }
5702
- function buildPreviewDashboardSetupUrl(dashboardBaseUrl, handoff) {
5703
- if (!dashboardBaseUrl || !handoff) return null;
5704
- return new URL(handoff.dashboardPath, dashboardBaseUrl).toString();
5615
+ function createMicrobatcher(options) {
5616
+ const schedule = options.schedule ?? ((fn) => queueMicrotask(fn));
5617
+ const inFlight = /* @__PURE__ */ new Map();
5618
+ const queued = /* @__PURE__ */ new Map();
5619
+ let flushPromise = null;
5620
+ let nextRequestId = 0;
5621
+ const flush = async () => {
5622
+ while (queued.size > 0) {
5623
+ const batchEntries = Array.from(queued.entries()).slice(0, options.maxBatchSize);
5624
+ const batch = batchEntries.map(([, value]) => value);
5625
+ for (const [key] of batchEntries) queued.delete(key);
5626
+ const requests = batch.map((item) => item.request);
5627
+ try {
5628
+ const results = await options.runBatch(requests);
5629
+ for (const item of batch) {
5630
+ const result = results[item.request.id];
5631
+ if (!result) {
5632
+ item.reject(/* @__PURE__ */ new Error("Missing batch result"));
5633
+ continue;
5634
+ }
5635
+ if (result.ok) item.resolve(result.data);
5636
+ else item.reject(new Error(result.error.message));
5637
+ }
5638
+ } catch (error) {
5639
+ for (const item of batch) item.reject(error);
5640
+ }
5641
+ }
5642
+ };
5643
+ const scheduleFlush = () => {
5644
+ if (flushPromise) return flushPromise;
5645
+ flushPromise = new Promise((resolve, reject) => {
5646
+ schedule(() => {
5647
+ flush().then(resolve, reject);
5648
+ });
5649
+ }).finally(() => {
5650
+ flushPromise = null;
5651
+ if (queued.size > 0) scheduleFlush();
5652
+ });
5653
+ return flushPromise;
5654
+ };
5655
+ const getOrEnqueue = (key, makeRequest) => {
5656
+ const existing = inFlight.get(key);
5657
+ if (existing) return existing;
5658
+ const promise = new Promise((resolve, reject) => {
5659
+ const id = `r${nextRequestId++}`;
5660
+ queued.set(key, {
5661
+ request: makeRequest(id),
5662
+ resolve,
5663
+ reject
5664
+ });
5665
+ }).finally(() => {
5666
+ inFlight.delete(key);
5667
+ });
5668
+ inFlight.set(key, promise);
5669
+ scheduleFlush();
5670
+ return promise;
5671
+ };
5672
+ return { getOrEnqueue };
5705
5673
  }
5706
5674
  //#endregion
5707
- //#region ../preview-next/src/client/preview/siteStyleAccess.ts
5708
- function resolveSiteStyleAccess(session) {
5709
- if (session?.kind === "userSession" && session.canEdit) return { kind: "apply-allowed" };
5710
- return { kind: "hidden" };
5711
- }
5712
- function canInspectSiteStyle(access) {
5713
- return access.kind === "apply-allowed";
5675
+ //#region ../blocks/src/system/data/normalizeLoaderParams.ts
5676
+ function toStringParams(value) {
5677
+ if (!isObjectRecord(value)) return {};
5678
+ const out = {};
5679
+ for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
5680
+ return out;
5714
5681
  }
5715
- //#endregion
5716
- //#region ../preview-next/src/constants.ts
5717
- const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
5718
- const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
5719
- const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
5720
- //#endregion
5721
- //#region ../preview-next/src/client/preview/previewChromeSurface.ts
5722
- const PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
5723
- const PREVIEW_CHROME_PORTAL_CLASS_NAME = "builder-editor-chrome";
5724
- function resolvePreviewChromeSurface(surfaceId) {
5725
- if (!surfaceId) return {
5726
- surfaceClassName: null,
5727
- dataSurface: null
5728
- };
5729
- const surfaceDocument = resolveSurfaceDocumentAttributes(surfaceId);
5730
- return {
5731
- surfaceClassName: surfaceDocument.htmlClassName ?? null,
5732
- dataSurface: surfaceDocument.dataSurface ?? null
5733
- };
5682
+ function stripEmptyStringValues(params, endpoint) {
5683
+ for (const [key, value] of Object.entries(params)) if (value === "" && !(key === "seriesIds" && (endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow"))) delete params[key];
5734
5684
  }
5735
- function getPreviewChromeSurfaceDataProps(surface) {
5736
- return surface.dataSurface ? { [SURFACE_DOCUMENT_DATA_ATTRIBUTE]: surface.dataSurface } : {};
5685
+ function ensureSiteId(params, context) {
5686
+ if (!params.siteId && typeof context.siteId === "string" && context.siteId) params.siteId = context.siteId;
5737
5687
  }
5738
- function applyPreviewChromeSurfaceToElement(element, surface, options) {
5739
- element.classList.add(PREVIEW_CHROME_THEME_CLASS_NAME);
5740
- if (options?.includePortalClass) element.classList.add(PREVIEW_CHROME_PORTAL_CLASS_NAME);
5741
- for (const candidateSurfaceId of SURFACE_IDS) element.classList.remove(`surface-${candidateSurfaceId}`);
5742
- if (surface.surfaceClassName) element.classList.add(surface.surfaceClassName);
5743
- if (surface.dataSurface) {
5744
- element.setAttribute(SURFACE_DOCUMENT_DATA_ATTRIBUTE, surface.dataSurface);
5745
- return;
5688
+ /**
5689
+ * Map the embed block's author-facing order values onto the public
5690
+ * `listPublishedEntries` `order` contract enum.
5691
+ *
5692
+ * `'order'` ("Custom order field") is the MANUAL-ORDERING axis: it means "render
5693
+ * entries in the content type's author-defined order". It intentionally maps to
5694
+ * `undefined` (endpoint default) here rather than a fixed `manual.asc`, because
5695
+ * this transform is schema-blind — it can't tell whether the embedded content
5696
+ * type actually opts into `ordering.mode: 'manual'`. Forcing `manual.asc` for a
5697
+ * non-manual type would silently flip its default sort (all `manualOrder` values
5698
+ * are equal, so it would degrade to createdAt-asc) — a render regression.
5699
+ *
5700
+ * The manual-ordering HONOR therefore lives server-side where the schema IS
5701
+ * known: `listContentEntries` (content/entries/list.ts) applies `manualOrder ASC`
5702
+ * as the default for manual-ordered types (plan 8.3). That is the path
5703
+ * `block-loaders/content.ts` renders through. The embed/`listPublishedEntries`
5704
+ * loader path (contentEntryLoaders) is not yet schema-aware for its default
5705
+ * ordering; honoring manual order there for the default `'order'` value is a
5706
+ * bounded follow-up (recorded in plan 8.3), not this change.
5707
+ */
5708
+ function normalizeOrder(orderBy) {
5709
+ switch (orderBy) {
5710
+ case "newest": return "published_at.desc";
5711
+ case "oldest": return "published_at.asc";
5712
+ case "title": return "title.asc";
5713
+ case "order": return;
5714
+ default: return;
5746
5715
  }
5747
- element.removeAttribute(SURFACE_DOCUMENT_DATA_ATTRIBUTE);
5748
5716
  }
5749
- //#endregion
5750
- //#region ../preview-next/src/client/preview/PreviewAuthInit.tsx
5751
- function PreviewAuthInit({ children, session, siteId, siteSlug, pageId, token }) {
5752
- const lastInitRef = useRef(null);
5753
- const sessionKey = session ? session.kind === "userSession" ? `${session.kind}:${session.canEdit}:${session.canManage}:${session.expiresAt ?? "no-expiry"}` : `${session.kind}:${session.expiresAt ?? "no-expiry"}` : "none";
5754
- const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ?? "no-token"}`;
5755
- if (lastInitRef.current !== currentKey) {
5756
- initPreviewAuth({
5757
- session,
5758
- siteId,
5759
- siteSlug,
5760
- pageId,
5761
- token
5762
- });
5763
- lastInitRef.current = currentKey;
5717
+ /**
5718
+ * Normalize loader params emitted by the block runtime into a consistent shape
5719
+ * (canonical keys + required context-derived fields).
5720
+ *
5721
+ * Note: params are already stringified by the core prefetch implementation.
5722
+ */
5723
+ function normalizeLoaderParams(endpoint, params, context) {
5724
+ const out = toStringParams(params);
5725
+ stripEmptyStringValues(out, endpoint);
5726
+ if (endpoint === "getPublicFormById") {
5727
+ ensureSiteId(out, context);
5728
+ if (!out.formId && out.formSlug) {
5729
+ out.formId = out.formSlug;
5730
+ delete out.formSlug;
5731
+ }
5732
+ return out;
5764
5733
  }
5765
- return /* @__PURE__ */ jsx(Fragment$1, { children });
5734
+ if (endpoint === "getPublicBookingServices") {
5735
+ ensureSiteId(out, context);
5736
+ return out;
5737
+ }
5738
+ if (endpoint === "getPublicWeeklySlotAvailability") {
5739
+ ensureSiteId(out, context);
5740
+ return out;
5741
+ }
5742
+ if (endpoint === "listPublicEvents" || endpoint === "listPublicRecurringSchedule" || endpoint === "listPublicEventCalendarWindow") {
5743
+ ensureSiteId(out, context);
5744
+ return out;
5745
+ }
5746
+ if (endpoint === "getPublicEventDetails") {
5747
+ ensureSiteId(out, context);
5748
+ return out;
5749
+ }
5750
+ if (endpoint === "listPublicProducts") {
5751
+ ensureSiteId(out, context);
5752
+ return out;
5753
+ }
5754
+ if (endpoint === "listPublicTeamMembers") {
5755
+ ensureSiteId(out, context);
5756
+ return out;
5757
+ }
5758
+ if (endpoint === "listPublicRouteCandidates") {
5759
+ ensureSiteId(out, context);
5760
+ return out;
5761
+ }
5762
+ if (endpoint === "getPublishedEntryPreview") {
5763
+ ensureSiteId(out, context);
5764
+ return out;
5765
+ }
5766
+ ensureSiteId(out, context);
5767
+ return out;
5766
5768
  }
5767
- //#endregion
5768
- //#region ../preview-next/src/client/preview/pageSchema.ts
5769
- const PAGE_CONTENT_TYPE_SCHEMA = {
5770
- version: 1,
5771
- fields: [],
5772
- labels: {
5773
- singular: "Page",
5774
- plural: "Pages"
5775
- },
5776
- routing: {
5777
- enabled: true,
5778
- pattern: "/{slug}",
5779
- slugField: "slug",
5780
- prefix: "/"
5769
+ /**
5770
+ * Normalize loader params into the shapes expected by the public API endpoints.
5771
+ *
5772
+ * Prefer this when the loader endpoint maps 1:1 to a public API route.
5773
+ */
5774
+ function normalizePublicApiLoaderParams(endpoint, params, context) {
5775
+ const out = normalizeLoaderParams(endpoint, params, context);
5776
+ if (endpoint === "listPublishedEntries" && !out.order && out.orderBy) {
5777
+ const mapped = normalizeOrder(out.orderBy);
5778
+ if (mapped) out.order = mapped;
5779
+ delete out.orderBy;
5781
5780
  }
5782
- };
5781
+ return out;
5782
+ }
5783
5783
  //#endregion
5784
5784
  //#region ../preview-next/src/client/blocks/linkedEntryRenderOverlay.ts
5785
5785
  /**
@@ -6363,6 +6363,50 @@ function usePreviewModeRootAttribute(isEditingMode) {
6363
6363
  }, [isEditingMode]);
6364
6364
  }
6365
6365
  //#endregion
6366
+ //#region ../preview-next/src/client/preview/PreviewEditingModeProvider.tsx
6367
+ function resolvePreviewEditingMode(stored) {
6368
+ return stored === "edit";
6369
+ }
6370
+ /** Tab-local intent only. Auth and the destination's lease still own write permission. */
6371
+ function PreviewEditingModeProvider({ children, siteId }) {
6372
+ return /* @__PURE__ */ jsxs(EditorProvider, {
6373
+ initialEditingAllowed: false,
6374
+ children: [/* @__PURE__ */ jsx(PreviewEditingModePersistence, { siteId }), children]
6375
+ }, siteId);
6376
+ }
6377
+ function readMode(key) {
6378
+ try {
6379
+ return resolvePreviewEditingMode(window.sessionStorage.getItem(key));
6380
+ } catch {
6381
+ return false;
6382
+ }
6383
+ }
6384
+ function writeMode(key, requested) {
6385
+ try {
6386
+ window.sessionStorage.setItem(key, previewModeValue(requested));
6387
+ } catch {}
6388
+ }
6389
+ function PreviewEditingModePersistence({ siteId }) {
6390
+ const { requestedEditingMode, setEditingMode } = useEditor();
6391
+ const [restored, setRestored] = useState(false);
6392
+ const key = `riverbank:preview-mode:${siteId}`;
6393
+ useEffect(() => {
6394
+ const restore = () => setEditingMode(readMode(key));
6395
+ restore();
6396
+ setRestored(true);
6397
+ window.addEventListener("pageshow", restore);
6398
+ return () => window.removeEventListener("pageshow", restore);
6399
+ }, [key, setEditingMode]);
6400
+ useEffect(() => {
6401
+ if (restored) writeMode(key, requestedEditingMode);
6402
+ }, [
6403
+ key,
6404
+ requestedEditingMode,
6405
+ restored
6406
+ ]);
6407
+ return null;
6408
+ }
6409
+ //#endregion
6366
6410
  //#region ../preview-next/src/client/preview/previewSetupGuidance.ts
6367
6411
  function resolvePreviewSetupBannerState(input) {
6368
6412
  if (input.authMode === "onboardingGrant") return input.dashboardUnlocked ? "dashboard_ready" : "awaiting_confirmation";
@@ -8679,10 +8723,10 @@ function resolveShellThemeRoles(props) {
8679
8723
  }
8680
8724
  const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
8681
8725
  const PreviewEditorSidebar = React.lazy(async () => {
8682
- return { default: (await import("./PreviewEditorSidebar-CbSbqmz3.mjs")).PreviewEditorSidebar };
8726
+ return { default: (await import("./PreviewEditorSidebar-B4ESNPzL.mjs")).PreviewEditorSidebar };
8683
8727
  });
8684
8728
  const PreviewEditorUI = React.lazy(async () => {
8685
- return { default: (await import("./PreviewEditorUI-CKKnAw11.mjs")).PreviewEditorUI };
8729
+ return { default: (await import("./PreviewEditorUI-BdUVaGOh.mjs")).PreviewEditorUI };
8686
8730
  });
8687
8731
  const previewPaneContainmentStyle = {
8688
8732
  contain: "layout paint",
@@ -9134,9 +9178,8 @@ function PreviewShell(props) {
9134
9178
  pageId: editableId,
9135
9179
  children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
9136
9180
  config: blockApiConfig,
9137
- children: /* @__PURE__ */ jsx(EditorProvider, {
9138
- initialEditingMode: false,
9139
- initialEditingAllowed: false,
9181
+ children: /* @__PURE__ */ jsx(PreviewEditingModeProvider, {
9182
+ siteId,
9140
9183
  children: /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
9141
9184
  blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
9142
9185
  businessTimeZone: props.businessTimeZone,