@riverbankcms/sdk 0.147.0 → 0.149.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 (442) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/{PreviewEditorSidebar-DtpB3_sS.mjs → PreviewEditorSidebar-DBKln68M.mjs} +301 -205
  4. package/dist/{PreviewEditorUI-DxTLgaHo.mjs → PreviewEditorUI-DpRX4Mum.mjs} +68 -63
  5. package/dist/{PreviewQueryProvider-Dd4dxOiU.mjs → PreviewQueryProvider-C0mndwHB.mjs} +3 -3
  6. package/dist/{SdkPreviewModeRuntime-DMMNCngt.mjs → SdkPreviewModeRuntime-DJPmPY-r.mjs} +1247 -541
  7. package/dist/{SiteChromeCustomizeContext-DQXZXiqS.mjs → SiteChromeCustomizeContext-JYA0cJ_Z.mjs} +209720 -204978
  8. package/dist/_dts/ai/src/contracts/proposals.d.ts +0 -33
  9. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +0 -3
  10. package/dist/_dts/api/src/accessAdmin.d.ts +0 -4
  11. package/dist/_dts/api/src/accountApi.d.ts +1 -1
  12. package/dist/_dts/api/src/admin.d.ts +22 -22
  13. package/dist/_dts/api/src/aiPatch.d.ts +2 -2
  14. package/dist/_dts/api/src/aiPlayground.d.ts +1 -0
  15. package/dist/_dts/api/src/analytics.d.ts +2 -2
  16. package/dist/_dts/api/src/apiEndpointTypes.d.ts +2 -0
  17. package/dist/_dts/api/src/appointmentSetup.d.ts +2 -2
  18. package/dist/_dts/api/src/auth.d.ts +10 -10
  19. package/dist/_dts/api/src/availability.d.ts +6 -6
  20. package/dist/_dts/api/src/billing.d.ts +42 -15
  21. package/dist/_dts/api/src/billingEndpointDefinitions.d.ts +8 -0
  22. package/dist/_dts/api/src/billingEndpointTypes.d.ts +15 -6
  23. package/dist/_dts/api/src/blocks.d.ts +15 -14
  24. package/dist/_dts/api/src/blocksKeys.d.ts +2 -0
  25. package/dist/_dts/api/src/bookingConfig.d.ts +33 -50
  26. package/dist/_dts/api/src/bookingManagementEndpoints.d.ts +2 -6
  27. package/dist/_dts/api/src/bookingOperations.d.ts +9 -11
  28. package/dist/_dts/api/src/bookingRecords.d.ts +16 -11
  29. package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +5 -5
  30. package/dist/_dts/api/src/bookings.d.ts +7 -7
  31. package/dist/_dts/api/src/calendar.d.ts +9 -9
  32. package/dist/_dts/api/src/clientErrorReporting.d.ts +11 -0
  33. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +7 -8
  34. package/dist/_dts/api/src/common/cancellation.d.ts +23 -0
  35. package/dist/_dts/api/src/common/envelope.d.ts +2 -2
  36. package/dist/_dts/api/src/content-editor.d.ts +2 -2
  37. package/dist/_dts/api/src/contentEntries.d.ts +17 -48
  38. package/dist/_dts/api/src/contentRuntime.d.ts +51 -37
  39. package/dist/_dts/api/src/contentTypes.d.ts +11 -11
  40. package/dist/_dts/api/src/contentVersionHistoryClient.d.ts +6 -6
  41. package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +1 -1
  42. package/dist/_dts/api/src/documentLifecycle.d.ts +67 -0
  43. package/dist/_dts/api/src/domains.d.ts +16 -16
  44. package/dist/_dts/api/src/editLeaseEndpoints.d.ts +72 -0
  45. package/dist/_dts/api/src/emailSettings.d.ts +4 -4
  46. package/dist/_dts/api/src/endpoints.d.ts +135 -51
  47. package/dist/_dts/api/src/eventEmailTemplates.d.ts +2 -2
  48. package/dist/_dts/api/src/eventManagementContracts.d.ts +29 -7
  49. package/dist/_dts/api/src/eventManagementEndpointDefinitions.d.ts +0 -8
  50. package/dist/_dts/api/src/eventPageWords.d.ts +7 -12
  51. package/dist/_dts/api/src/footerSettings.d.ts +6 -6
  52. package/dist/_dts/api/src/index.d.ts +8 -7
  53. package/dist/_dts/api/src/indexCoreTypes.d.ts +1 -0
  54. package/dist/_dts/api/src/indexExtendedTypes.d.ts +1 -1
  55. package/dist/_dts/api/src/navigation.d.ts +5 -5
  56. package/dist/_dts/api/src/pageSurfaceEditorEndpoints.d.ts +55 -0
  57. package/dist/_dts/api/src/pageSurfaceEndpoints.d.ts +28 -7
  58. package/dist/_dts/api/src/pages.d.ts +7 -7
  59. package/dist/_dts/api/src/performance.d.ts +1 -1
  60. package/dist/_dts/api/src/public/index.d.ts +1 -1
  61. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +4 -2
  62. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +6 -29
  63. package/dist/_dts/api/src/redirects.d.ts +3 -3
  64. package/dist/_dts/api/src/request.d.ts +11 -2
  65. package/dist/_dts/api/src/resources.d.ts +4 -4
  66. package/dist/_dts/api/src/routes.d.ts +8 -3
  67. package/dist/_dts/api/src/sdk-event-upsert.d.ts +1 -2
  68. package/dist/_dts/api/src/sdkBlockUpsertContracts.d.ts +21 -0
  69. package/dist/_dts/api/src/sdkContracts.d.ts +5 -28
  70. package/dist/_dts/api/src/sdkEventEndpointDefinitions.d.ts +1 -1
  71. package/dist/_dts/api/src/sdkEventOccurrenceRequestContracts.d.ts +43 -0
  72. package/dist/_dts/api/src/sdkManagedEventContracts.d.ts +4 -2
  73. package/dist/_dts/api/src/sdkPullEventContracts.d.ts +9 -2
  74. package/dist/_dts/api/src/seo.d.ts +4 -4
  75. package/dist/_dts/api/src/services.d.ts +4 -4
  76. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +15 -8
  77. package/dist/_dts/api/src/siteMembers.d.ts +10 -10
  78. package/dist/_dts/api/src/siteOnboarding.d.ts +14 -0
  79. package/dist/_dts/api/src/siteOperations.d.ts +6 -2
  80. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +7 -3
  81. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +5 -12
  82. package/dist/_dts/api/src/siteRuntimeEntry.d.ts +31 -0
  83. package/dist/_dts/billing/src/checkout/platform.d.ts +77 -0
  84. package/dist/_dts/billing/src/components/index.d.ts +25 -40
  85. package/dist/_dts/billing/src/membership/index.d.ts +1 -3
  86. package/dist/_dts/billing/src/plans/entitlements.d.ts +80 -0
  87. package/dist/_dts/billing/src/plans/registry.d.ts +16 -16
  88. package/dist/_dts/billing/src/plans/standing.d.ts +9 -2
  89. package/dist/_dts/billing/src/plans/types.d.ts +5 -15
  90. package/dist/_dts/billing/src/site-arrangements.d.ts +2 -2
  91. package/dist/_dts/billing/src/subscriptions/standingEvidence.d.ts +2 -4
  92. package/dist/_dts/billing/src/subscriptions/store.d.ts +17 -11
  93. package/dist/_dts/block-form/src/backend/store-backend.d.ts +6 -7
  94. package/dist/_dts/block-form/src/backend/types.d.ts +7 -0
  95. package/dist/_dts/block-form/src/widgets/FieldFrame.d.ts +3 -1
  96. package/dist/_dts/blocks/src/client/events.d.ts +3 -0
  97. package/dist/_dts/blocks/src/contracts/index.d.ts +1 -1
  98. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +2 -2
  99. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +54 -14
  100. package/dist/_dts/blocks/src/pageRenderAdmission.d.ts +4 -13
  101. package/dist/_dts/blocks/src/pageRendererContracts.d.ts +2 -0
  102. package/dist/_dts/blocks/src/portal/types.d.ts +9 -8
  103. package/dist/_dts/blocks/src/system/blocks/contact-newsletter.d.ts +2 -1
  104. package/dist/_dts/blocks/src/system/blocks/event-registration.d.ts +3 -1
  105. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +28 -28
  106. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +7 -2
  107. package/dist/_dts/blocks/src/system/blocks/shared/bookingPaymentTerms.d.ts +84 -160
  108. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +2 -2
  109. package/dist/_dts/blocks/src/system/blocks/shop.shared.d.ts +31 -4
  110. package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +2 -2
  111. package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
  112. package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +4 -2
  113. package/dist/_dts/blocks/src/system/runtime/api/types/core.d.ts +3 -1
  114. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +6 -0
  115. package/dist/_dts/blocks/src/system/runtime/api/types/portal.d.ts +6 -0
  116. package/dist/_dts/blocks/src/system/runtime/api/types/shop.d.ts +4 -0
  117. package/dist/_dts/blocks/src/system/runtime/components/booking/SuccessMessage.d.ts +4 -1
  118. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +72 -12
  119. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +36 -6
  120. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingNowIso.d.ts +8 -0
  121. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +3 -0
  122. package/dist/_dts/blocks/src/system/runtime/hooks/usePaymentVerification.d.ts +2 -1
  123. package/dist/_dts/blocks/src/system/runtime/hooks/usePolling.d.ts +7 -48
  124. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.checkout-return-context.d.ts +7 -0
  125. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.completion.d.ts +3 -1
  126. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +4 -0
  127. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.interactive.d.ts +9 -0
  128. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.payment-confirmation.d.ts +13 -0
  129. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +17 -2
  130. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.submit-actions.d.ts +8 -0
  131. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.submit-handler.d.ts +1 -0
  132. package/dist/_dts/blocks/src/system/runtime/nodes/booking-runtime-sources.d.ts +1 -0
  133. package/dist/_dts/blocks/src/system/runtime/nodes/checkout.server.d.ts +2 -1
  134. package/dist/_dts/blocks/src/system/runtime/nodes/commerce/shared/display.d.ts +9 -2
  135. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +14 -2
  136. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationSurface.d.ts +2 -1
  137. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizard.d.ts +5 -0
  138. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +2 -0
  139. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SuccessStep.d.ts +4 -1
  140. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.d.ts +3 -3
  141. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +2 -0
  142. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +2 -5
  143. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +4 -0
  144. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +9 -5
  145. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.interactive.d.ts +6 -0
  146. package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/dates.d.ts +37 -3
  147. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.client.d.ts +1 -1
  148. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.d.ts +16 -1
  149. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCardPresentations.d.ts +13 -0
  150. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +29 -29
  151. package/dist/_dts/blocks/src/system/runtime/nodes/shared/MagicLinkForm.d.ts +1 -14
  152. package/dist/_dts/blocks/src/system/runtime/nodes/shared/MagicLinkForm.state.d.ts +12 -0
  153. package/dist/_dts/blocks/src/system/runtime/nodes/shop.interactive.d.ts +54 -6
  154. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +7 -2
  155. package/dist/_dts/blocks/src/system/runtime/shared/components/DemoBookingPortalAccess.d.ts +22 -0
  156. package/dist/_dts/blocks/src/system/runtime/shared/components/DemoPortalSignInLink.d.ts +4 -0
  157. package/dist/_dts/blocks/src/system/runtime/shared/components/index.d.ts +1 -0
  158. package/dist/_dts/blocks/src/system/runtime/shared/utils/demoBookingPassStorage.d.ts +10 -0
  159. package/dist/_dts/blocks/src/system/runtime/shared/utils/demoPortalMagicLink.d.ts +29 -0
  160. package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +54 -0
  161. package/dist/_dts/commerce/src/purchase/checkoutCommitPlan.d.ts +58 -13
  162. package/dist/_dts/commerce/src/purchase/checkoutErrorCodes.d.ts +1 -1
  163. package/dist/_dts/commerce/src/purchase/checkoutPaymentPlanPlanning.d.ts +16 -21
  164. package/dist/_dts/commerce/src/purchase/checkoutPaymentTerms.d.ts +23 -40
  165. package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +2 -2
  166. package/dist/_dts/commerce/src/purchase/checkoutStripeSessionPlanning.d.ts +5 -4
  167. package/dist/_dts/commerce/src/purchase/event-registration-errors.d.ts +4 -0
  168. package/dist/_dts/commerce/src/purchase/index.d.ts +1 -3
  169. package/dist/_dts/commerce/src/purchase/membershipOrderItemMetadata.d.ts +4 -0
  170. package/dist/_dts/commerce/src/purchase/oneTimeCheckoutPlanning.d.ts +9 -4
  171. package/dist/_dts/commerce/src/purchase/orderInstalmentClosure.d.ts +13 -1
  172. package/dist/_dts/commerce/src/purchase/orderInstalmentLifecycle.d.ts +5 -0
  173. package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +3 -1
  174. package/dist/_dts/commerce/src/purchase/orderTypes.d.ts +7 -1
  175. package/dist/_dts/commerce/src/purchase/refundRailSplit.d.ts +1 -1
  176. package/dist/_dts/commerce/src/purchase/stateTransitions.d.ts +2 -2
  177. package/dist/_dts/commerce/src/purchase/stripeMinimumCharge.d.ts +6 -0
  178. package/dist/_dts/commerce/src/purchase/types.d.ts +2 -1
  179. package/dist/_dts/content-editor/src/components/ContentFieldsForm.d.ts +2 -7
  180. package/dist/_dts/content-editor/src/controller/EditLeaseController.d.ts +39 -0
  181. package/dist/_dts/content-editor/src/controller/EditorWriteGate.d.ts +38 -0
  182. package/dist/_dts/content-editor/src/controller/EntryControllerProvider.d.ts +25 -61
  183. package/dist/_dts/content-editor/src/controller/LinkedEntryLeaseBanner.d.ts +7 -0
  184. package/dist/_dts/content-editor/src/controller/LinkedEntryLeaseControllers.d.ts +14 -0
  185. package/dist/_dts/content-editor/src/controller/deriveEditorUnpublishedState.d.ts +6 -0
  186. package/dist/_dts/content-editor/src/controller/documentValueBaseline.d.ts +25 -0
  187. package/dist/_dts/content-editor/src/controller/editLeaseHandover.d.ts +30 -0
  188. package/dist/_dts/content-editor/src/controller/editLeaseLossSignal.d.ts +6 -0
  189. package/dist/_dts/content-editor/src/controller/editLeaseNotice.d.ts +28 -0
  190. package/dist/_dts/content-editor/src/controller/editorClientId.d.ts +2 -0
  191. package/dist/_dts/content-editor/src/controller/editorEditability.d.ts +38 -0
  192. package/dist/_dts/content-editor/src/controller/editorLeaseParticipation.d.ts +34 -0
  193. package/dist/_dts/content-editor/src/controller/normalizedMetadataBaseline.d.ts +29 -0
  194. package/dist/_dts/content-editor/src/controller/pageSurfaceDocumentBaselines.d.ts +14 -0
  195. package/dist/_dts/content-editor/src/controller/pageSurfaceLifecycle.d.ts +11 -0
  196. package/dist/_dts/content-editor/src/controller/planDocumentBaselineRefresh.d.ts +19 -0
  197. package/dist/_dts/content-editor/src/controller/readDocumentLeaseBaselines.d.ts +19 -0
  198. package/dist/_dts/content-editor/src/controller/refreshDocumentLeaseBaseline.d.ts +12 -0
  199. package/dist/_dts/content-editor/src/controller/refreshLinkedEntry.d.ts +17 -0
  200. package/dist/_dts/content-editor/src/controller/replayRestoredEditorEffects.d.ts +2 -3
  201. package/dist/_dts/content-editor/src/controller/routeWrites.d.ts +26 -0
  202. package/dist/_dts/content-editor/src/controller/useAutosaveTriggers.d.ts +16 -17
  203. package/dist/_dts/content-editor/src/controller/useBlockedPublishPlan.d.ts +6 -2
  204. package/dist/_dts/content-editor/src/controller/useBlocksList.d.ts +3 -3
  205. package/dist/_dts/content-editor/src/controller/useEntryValueAutosaves.d.ts +21 -0
  206. package/dist/_dts/content-editor/src/controller/useInitialEditorUiStore.d.ts +24 -0
  207. package/dist/_dts/content-editor/src/controller/useServerBaselineReconciliation.d.ts +17 -0
  208. package/dist/_dts/content-editor/src/footerComposerPanelTypes.d.ts +1 -1
  209. package/dist/_dts/content-editor/src/hooks/applyBlockedPublishPlan.d.ts +5 -1
  210. package/dist/_dts/content-editor/src/hooks/blockDraftLifecycle.d.ts +8 -47
  211. package/dist/_dts/content-editor/src/hooks/editLeaseMachine.d.ts +120 -0
  212. package/dist/_dts/content-editor/src/hooks/publishability.d.ts +6 -10
  213. package/dist/_dts/content-editor/src/hooks/useAutosaveStatus.d.ts +3 -0
  214. package/dist/_dts/content-editor/src/hooks/useBlockAutosave.d.ts +5 -15
  215. package/dist/_dts/content-editor/src/hooks/useDebouncedLatestSave.d.ts +7 -5
  216. package/dist/_dts/content-editor/src/hooks/useEditLease.d.ts +28 -0
  217. package/dist/_dts/content-editor/src/hooks/useEntryActions.d.ts +25 -39
  218. package/dist/_dts/content-editor/src/hooks/useEntryMutations.d.ts +17 -19
  219. package/dist/_dts/content-editor/src/hooks/useLinkedEntryAutosave.d.ts +5 -8
  220. package/dist/_dts/content-editor/src/hooks/useValueAutosave.d.ts +64 -0
  221. package/dist/_dts/content-editor/src/hooks/validateBlocksForPublish.d.ts +0 -7
  222. package/dist/_dts/content-editor/src/index.d.ts +26 -7
  223. package/dist/_dts/content-editor/src/lib/browserStorage.d.ts +5 -0
  224. package/dist/_dts/content-editor/src/linkedEntries/domain.d.ts +12 -0
  225. package/dist/_dts/content-editor/src/linkedEntries/owner.d.ts +9 -0
  226. package/dist/_dts/content-editor/src/liveDrafts/draftProjection.d.ts +66 -0
  227. package/dist/_dts/content-editor/src/liveDrafts/linkedSaveHandovers.d.ts +37 -0
  228. package/dist/_dts/content-editor/src/liveDrafts/remoteDraftOverlay.d.ts +113 -0
  229. package/dist/_dts/content-editor/src/liveDrafts/useLiveDrafts.d.ts +32 -0
  230. package/dist/_dts/content-editor/src/liveDrafts/useRetentionTicks.d.ts +7 -0
  231. package/dist/_dts/content-editor/src/primitives/shared/activePreviewField.d.ts +6 -0
  232. package/dist/_dts/content-editor/src/primitives/shared/storeBinding.d.ts +1 -0
  233. package/dist/_dts/content-editor/src/services/contentEntryServices.d.ts +96 -19
  234. package/dist/_dts/content-editor/src/services/editorApiClient.d.ts +13 -0
  235. package/dist/_dts/content-editor/src/services/index.d.ts +2 -0
  236. package/dist/_dts/content-editor/src/services/pageSurfaceEditorServices.d.ts +23 -0
  237. package/dist/_dts/content-editor/src/sync/flushValues.d.ts +13 -0
  238. package/dist/_dts/content-editor/src/sync/lifecycleFailure.d.ts +51 -0
  239. package/dist/_dts/content-editor/src/sync/runLifecycle.d.ts +64 -0
  240. package/dist/_dts/content-editor/src/sync/schedulerValues.d.ts +27 -0
  241. package/dist/_dts/content-editor/src/sync/sendPlanning.d.ts +104 -0
  242. package/dist/_dts/content-editor/src/sync/valueSync.d.ts +114 -0
  243. package/dist/_dts/content-editor/src/ui/blockCollection.d.ts +8 -0
  244. package/dist/_dts/content-editor/src/ui/documentLifecycle.d.ts +18 -0
  245. package/dist/_dts/content-editor/src/ui/editorLeaseUiState.d.ts +7 -0
  246. package/dist/_dts/content-editor/src/ui/editorRefresh.d.ts +82 -0
  247. package/dist/_dts/content-editor/src/ui/editorSnapshot.d.ts +102 -127
  248. package/dist/_dts/content-editor/src/ui/editorTransactionState.d.ts +1 -1
  249. package/dist/_dts/content-editor/src/ui/editorUiStore.d.ts +126 -72
  250. package/dist/_dts/content-editor/src/ui/editorValueSnapshot.d.ts +18 -0
  251. package/dist/_dts/content-editor/src/ui/serverBlockAdmission.d.ts +26 -0
  252. package/dist/_dts/content-editor/src/ui/stores/autosaveStore.d.ts +16 -27
  253. package/dist/_dts/content-editor/src/ui/stores/blockVersionsStore.d.ts +24 -0
  254. package/dist/_dts/content-editor/src/ui/stores/linkedEntryLeaseStore.d.ts +54 -0
  255. package/dist/_dts/content-editor/src/ui/stores/linkedSaveHandoversStore.d.ts +11 -0
  256. package/dist/_dts/content-editor/src/ui/stores/remoteDraftsStore.d.ts +10 -0
  257. package/dist/_dts/content-editor/src/ui/stores/types.d.ts +63 -3
  258. package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +2 -2
  259. package/dist/_dts/content-editor/src/useFooterNavigationLayout.d.ts +1 -1
  260. package/dist/_dts/content-model/src/content-types/builtin-schemas.d.ts +4 -4
  261. package/dist/_dts/content-model/src/content-types/builtins.d.ts +4 -4
  262. package/dist/_dts/content-model/src/definitions/shared.d.ts +11 -2
  263. package/dist/_dts/content-model/src/entry-slots/index.d.ts +1 -0
  264. package/dist/_dts/content-model/src/entry-slots/serializeAllowedBlocks.d.ts +2 -0
  265. package/dist/_dts/content-model/src/metadataConfig.d.ts +10 -38
  266. package/dist/_dts/content-model/src/templates/defaults.d.ts +0 -1
  267. package/dist/_dts/content-model/src/types.d.ts +0 -1
  268. package/dist/_dts/core/src/block-content-identity.d.ts +49 -1
  269. package/dist/_dts/core/src/booking-flexible-balance.d.ts +2 -2
  270. package/dist/_dts/core/src/booking-instalment-deposit.d.ts +20 -0
  271. package/dist/_dts/core/src/booking-live-payment-terms.d.ts +72 -0
  272. package/dist/_dts/core/src/booking-payment-options.d.ts +24 -0
  273. package/dist/_dts/core/src/booking-payment-schemas.d.ts +522 -0
  274. package/dist/_dts/core/src/branded.d.ts +15 -0
  275. package/dist/_dts/core/src/currency-format.d.ts +8 -2
  276. package/dist/_dts/core/src/demo-lifecycle-status.d.ts +2 -2
  277. package/dist/_dts/core/src/demo-warm-pool-target.d.ts +8 -0
  278. package/dist/_dts/core/src/edit-lease.d.ts +60 -0
  279. package/dist/_dts/core/src/editor-state.d.ts +38 -13
  280. package/dist/_dts/core/src/editor-value-sync.d.ts +79 -0
  281. package/dist/_dts/core/src/html-entities.d.ts +6 -0
  282. package/dist/_dts/core/src/index.d.ts +7 -0
  283. package/dist/_dts/core/src/uuid.d.ts +7 -5
  284. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +456 -189
  285. package/dist/_dts/editor/src/EditorProvider.d.ts +5 -0
  286. package/dist/_dts/editor/src/chrome/EditorChrome.d.ts +14 -0
  287. package/dist/_dts/editor/src/chrome/EditorStatusBar.d.ts +1 -0
  288. package/dist/_dts/editor/src/chrome/statusBarPresentation.d.ts +0 -1
  289. package/dist/_dts/editor/src/index.d.ts +1 -1
  290. package/dist/_dts/editor-blocks/src/BlockEditor.d.ts +10 -9
  291. package/dist/_dts/editor-blocks/src/BlockForm.d.ts +1 -1
  292. package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +1 -1
  293. package/dist/_dts/editor-blocks/src/block-editor/BlockCardFrame.d.ts +1 -1
  294. package/dist/_dts/editor-blocks/src/block-editor/BlockSettingsModal.d.ts +1 -1
  295. package/dist/_dts/editor-blocks/src/block-editor/applyExtendedFieldDefaults.d.ts +3 -4
  296. package/dist/_dts/editor-blocks/src/block-editor/blockDraftBaselineSeed.d.ts +4 -8
  297. package/dist/_dts/editor-blocks/src/block-editor/editorBlockItem.d.ts +23 -0
  298. package/dist/_dts/editor-blocks/src/block-editor/generatedIconApplyCoordination.d.ts +2 -7
  299. package/dist/_dts/editor-blocks/src/block-editor/hooks/applyBlockStructureChange.d.ts +4 -0
  300. package/dist/_dts/editor-blocks/src/block-editor/hooks/buildInsertBlockHistoryCommand.d.ts +14 -5
  301. package/dist/_dts/editor-blocks/src/block-editor/hooks/useBlockBaselineSync.d.ts +21 -19
  302. package/dist/_dts/editor-blocks/src/block-editor/hooks/useBlockCreation.d.ts +2 -10
  303. package/dist/_dts/editor-blocks/src/block-editor/hooks/useBlockDuplication.d.ts +8 -16
  304. package/dist/_dts/editor-blocks/src/block-editor/owner.d.ts +6 -16
  305. package/dist/_dts/editor-blocks/src/block-editor/types.d.ts +37 -9
  306. package/dist/_dts/editor-blocks/src/index.d.ts +2 -1
  307. package/dist/_dts/editor-blocks/src/widgets/entry-picker/loaders.d.ts +1 -1
  308. package/dist/_dts/editor-blocks/src/widgets/link/loaders.d.ts +1 -1
  309. package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/loaders.d.ts +1 -1
  310. package/dist/_dts/editor-blocks/src/widgets/reference/loaders.d.ts +1 -1
  311. package/dist/_dts/editor-blocks/src/widgets/site-option-picker/loaders.d.ts +3 -2
  312. package/dist/_dts/media-core/src/fileStorage.d.ts +4 -0
  313. package/dist/_dts/media-editor/src/MediaPickerDialog.d.ts +3 -1
  314. package/dist/_dts/media-editor/src/MediaPickerMiniDialog.d.ts +10 -0
  315. package/dist/_dts/media-editor/src/context.d.ts +1 -1
  316. package/dist/_dts/media-editor/src/createMediaEditorProvider.d.ts +1 -2
  317. package/dist/_dts/media-editor/src/index.d.ts +2 -0
  318. package/dist/_dts/media-editor/src/provider.d.ts +3 -2
  319. package/dist/_dts/media-react/src/hooks/internal/classification.d.ts +1 -1
  320. package/dist/_dts/media-react/src/hooks/useApiMediaUploader.d.ts +3 -1
  321. package/dist/_dts/preview-next/src/client/blocks/composer/mergeDrafts.d.ts +8 -3
  322. package/dist/_dts/preview-next/src/client/blocks/composer/types.d.ts +6 -3
  323. package/dist/_dts/preview-next/src/client/blocks/linkedEntryRenderOverlay.d.ts +22 -2
  324. package/dist/_dts/preview-next/src/client/blocks/previewProjection/entryFieldRebinding.d.ts +13 -0
  325. package/dist/_dts/preview-next/src/client/blocks/previewProjection/index.d.ts +2 -1
  326. package/dist/_dts/preview-next/src/client/blocks/previewProjection/types.d.ts +11 -1
  327. package/dist/_dts/preview-next/src/client/blocks/renderPrecedence.d.ts +17 -0
  328. package/dist/_dts/preview-next/src/client/blocks/useLinkedSaveHandoverRetention.d.ts +20 -0
  329. package/dist/_dts/preview-next/src/client/index.d.ts +1 -1
  330. package/dist/_dts/preview-next/src/client/preview/EntryEditorPanel.d.ts +2 -1
  331. package/dist/_dts/preview-next/src/client/preview/EntrySlotBlockEditorPanel.d.ts +2 -1
  332. package/dist/_dts/preview-next/src/client/preview/PreviewAccessBanners.d.ts +7 -0
  333. package/dist/_dts/preview-next/src/client/preview/PreviewEditorSidebar.d.ts +2 -1
  334. package/dist/_dts/preview-next/src/client/preview/PreviewEntryControllerProvider.d.ts +23 -14
  335. package/dist/_dts/preview-next/src/client/preview/PreviewLeaseEditingMode.d.ts +2 -0
  336. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +9 -2
  337. package/dist/_dts/preview-next/src/client/preview/PreviewShellLayout.d.ts +1 -0
  338. package/dist/_dts/preview-next/src/client/preview/previewCustomizeAutosave.d.ts +5 -0
  339. package/dist/_dts/preview-next/src/client/preview/previewCustomizeWorkflowState.d.ts +3 -4
  340. package/dist/_dts/preview-next/src/client/preview/sdkConfig.d.ts +1 -0
  341. package/dist/_dts/preview-next/src/client/preview/usePreviewCustomizeWorkflowState.d.ts +4 -0
  342. package/dist/_dts/preview-next/src/client/previewAuthStore.d.ts +7 -0
  343. package/dist/_dts/preview-next/src/constants.d.ts +4 -0
  344. package/dist/_dts/preview-next/src/keepAlive.d.ts +1 -0
  345. package/dist/_dts/realtime/src/client.d.ts +3 -0
  346. package/dist/_dts/realtime/src/draftChannel.d.ts +91 -0
  347. package/dist/_dts/realtime/src/drafts.d.ts +210 -0
  348. package/dist/_dts/realtime/src/index.d.ts +3 -0
  349. package/dist/_dts/realtime/src/leaseChangeSubscriptions.d.ts +8 -0
  350. package/dist/_dts/realtime/src/types.d.ts +113 -0
  351. package/dist/_dts/realtime/src/useDraftChannel.d.ts +34 -0
  352. package/dist/_dts/realtime/src/useSiteRealtimeReload.d.ts +27 -0
  353. package/dist/_dts/sdk/src/public-api/contracts.d.ts +6 -55
  354. package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +1 -0
  355. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +1 -0
  356. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +2 -0
  357. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +2 -12
  358. package/dist/_dts/sdk/src/version.d.ts +1 -1
  359. package/dist/_dts/surfaces/src/index.d.ts +1 -0
  360. package/dist/_dts/theme-core/src/site-styles/designState.d.ts +2 -2
  361. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +0 -5
  362. package/dist/_dts/ui/src/color-picker.d.ts +1 -1
  363. package/dist/_dts/ui/src/palette/useHexDraft.d.ts +7 -0
  364. package/dist/client/{BookingMailingListNote-1n4Ch_u_.mjs → BookingMailingListNote-Cr3EeTP5.mjs} +504 -163
  365. package/dist/client/DemoBookingPortalAccess-BFGB1Fay.mjs +344 -0
  366. package/dist/client/{EventCombined.client-C0pgma9y.mjs → EventCombined.client-DKYV0_ft.mjs} +6 -6
  367. package/dist/client/{EventListing.client-4fhLOvHP.mjs → EventListing.client-B9UIcEYc.mjs} +2 -2
  368. package/dist/client/{LeafletStaticMap-DScC4F3w.mjs → LeafletStaticMap-CFLPkP0K.mjs} +1 -1
  369. package/dist/client/{TerminalPanel-B5ZUsYhe.mjs → TerminalPanel-JjmgxEsR.mjs} +1 -1
  370. package/dist/client/{ThemedButton-DoVIV1Ao.mjs → ThemedButton-CKV1Jh2m.mjs} +1 -1
  371. package/dist/client/{accordion-CoT5g7zo.mjs → accordion-DXWIfT3T.mjs} +1 -1
  372. package/dist/client/{bookingForm-BWxB46xD.mjs → bookingForm-CjZgHNvv.mjs} +216 -63
  373. package/dist/client/bookings.mjs +1187 -692
  374. package/dist/client/{carousel-DtNYWFd3.mjs → carousel-DSLikmvZ.mjs} +1 -1
  375. package/dist/client/{cart-z4qZih1Y.mjs → cart-HDjWReFt.mjs} +3 -3
  376. package/dist/client/{checkout-DpL7euFH.mjs → checkout-CUvRZA3W.mjs} +3 -3
  377. package/dist/client/{checkoutUrls-BEfR7kVu.mjs → checkoutUrls-CXhko2Rv.mjs} +1 -1
  378. package/dist/client/client.mjs +2711 -1684
  379. package/dist/client/{context-C8TinPJc.mjs → context-DFmaZa-Q.mjs} +4 -3
  380. package/dist/client/{dates-vwwxTeB0.mjs → dates-BBep1JnF.mjs} +56 -11
  381. package/dist/client/{eventCalendar-DIbHfJXO.mjs → eventCalendar-zEobhxo4.mjs} +9 -9
  382. package/dist/client/{eventCombined-DoGMJ6cg.mjs → eventCombined-Dp7bz5k-.mjs} +4 -4
  383. package/dist/client/{eventDetails-BjN9v6a1.mjs → eventDetails-FE-zqTt7.mjs} +4 -4
  384. package/dist/client/{eventListing-DajjWgOv.mjs → eventListing-BMt5snal.mjs} +4 -4
  385. package/dist/client/{eventRegistration-DMq9gMA-.mjs → eventRegistration-O6ZxHfOb.mjs} +422 -570
  386. package/dist/client/{form-Qf6qTbos.mjs → form-DFa1D8vt.mjs} +3 -3
  387. package/dist/client/{headerSection-D7qJrqFX.mjs → headerSection-CmjHLR-N.mjs} +3 -3
  388. package/dist/client/hooks.mjs +414 -182
  389. package/dist/client/{locationMap-CCF9-t_0.mjs → locationMap-BXKP_lGh.mjs} +3 -3
  390. package/dist/client/{media-CwBGetqC.mjs → media-Cl38iOMI.mjs} +10 -3
  391. package/dist/client/{newsletterForm-DzCLSP4S.mjs → newsletterForm-CU-HmxGx.mjs} +3 -3
  392. package/dist/client/{pricing-Cgxv2KLC.mjs → pricing-KEAEsibq.mjs} +1 -1
  393. package/dist/client/{productDetail-ru9w5GHx.mjs → productDetail-Ckp7MGnt.mjs} +3 -3
  394. package/dist/client/{productList-zaapKSl-.mjs → productList-D91V0sYa.mjs} +3 -3
  395. package/dist/client/{propsDecoder-CwvvNOHx.mjs → propsDecoder-DZd6RJeA.mjs} +244 -94
  396. package/dist/client/rendering/client.mjs +2656 -1705
  397. package/dist/client/rendering/islands.mjs +18 -18
  398. package/dist/client/rendering.mjs +3430 -2352
  399. package/dist/client/{routeIslandApiConfig-BwVFo0Y4.mjs → routeIslandApiConfig-E1EkhhYY.mjs} +1 -1
  400. package/dist/client/{shop-mktkXvbV.mjs → shop-4F2jLQPI.mjs} +131 -85
  401. package/dist/client/{shop-commerce-De7gEnkA.mjs → shop-commerce-BbfCJjB3.mjs} +25 -13
  402. package/dist/client/{shop-commerce-store-B3MCxIBW.mjs → shop-commerce-store-vicweP2K.mjs} +1 -1
  403. package/dist/client/{shopShared-TqExh235.mjs → shopShared-DlONJt0T.mjs} +4 -4
  404. package/dist/client/{useEventFilters-n_OjkIjX.mjs → useEventFilters-COYyL3m7.mjs} +32 -17
  405. package/dist/preview-next/before-render.mjs +207 -105
  406. package/dist/preview-next/client/runtime.mjs +4 -4
  407. package/dist/preview-next/constants.mjs +5 -1
  408. package/dist/preview-next/index.mjs +5 -1
  409. package/dist/preview-next/keepAlive.mjs +341 -165
  410. package/dist/preview-next/middleware.mjs +207 -105
  411. package/dist/{previewAuthStore-C_EHQ5XA.mjs → previewAuthStore-BBmV7UsW.mjs} +243 -112
  412. package/dist/{sdk-runtime-BIkJg5y1.mjs → sdk-runtime-CwvFFjB-.mjs} +2 -2
  413. package/dist/{separator-C9qDP95Z.mjs → separator-ByL72zUT.mjs} +1 -1
  414. package/dist/server/components.mjs +1839 -1475
  415. package/dist/server/config-validation.mjs +381 -166
  416. package/dist/server/config.mjs +381 -166
  417. package/dist/server/data.mjs +381 -166
  418. package/dist/server/index.mjs +214 -110
  419. package/dist/server/next.mjs +663 -351
  420. package/dist/server/page-converter.mjs +198 -79
  421. package/dist/server/prebuild.mjs +1 -1
  422. package/dist/server/rendering/server.mjs +1536 -1169
  423. package/dist/server/rendering.mjs +2432 -2068
  424. package/dist/server/routing.mjs +456 -173
  425. package/dist/server/server.mjs +447 -267
  426. package/package.json +1 -1
  427. package/dist/_dts/api/src/bookingPaymentTermSchemas.d.ts +0 -123
  428. package/dist/_dts/billing/src/plans/display.d.ts +0 -15
  429. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.mailing-list-note.d.ts +0 -3
  430. package/dist/_dts/commerce/src/purchase/checkoutPaymentTermPlanning.d.ts +0 -10
  431. package/dist/_dts/commerce/src/purchase/checkoutValidatedItemPlanning.d.ts +0 -55
  432. package/dist/_dts/commerce/src/purchase/orderInstalmentPayoff.d.ts +0 -24
  433. package/dist/_dts/content-editor/src/controller/buildBlockPublishedBaselines.d.ts +0 -4
  434. package/dist/_dts/content-editor/src/controller/buildPublishSuccessTransition.d.ts +0 -16
  435. package/dist/_dts/content-editor/src/controller/driver.d.ts +0 -14
  436. package/dist/_dts/content-editor/src/controller/seedDraftBaselinesFromBlocks.d.ts +0 -7
  437. package/dist/_dts/content-editor/src/controller/useEntrySyncHelpers.d.ts +0 -29
  438. package/dist/_dts/content-editor/src/hooks/autosaveScopePlanning.d.ts +0 -26
  439. package/dist/_dts/content-editor/src/hooks/useSimpleAutosave.d.ts +0 -64
  440. package/dist/_dts/content-editor/src/hooks/useStoreAutosave.d.ts +0 -48
  441. package/dist/_dts/content-editor/src/types.d.ts +0 -44
  442. package/dist/client/DiscountCodeDisclosure-CKJtz0mY.mjs +0 -137
@@ -1,10 +1,11 @@
1
1
  "use client";
2
- import { $i as resolveSdkFooterMode, $n as resolveRouteTarget, $r as parseBackgroundAppearanceColorToken, $t as recordsEqual, Aa as Dialog, Ai as isRecord$11, An as ThemeScope, Ao as __exportAll, At as useRichTextImagePicker, Bn as resolveVariantKey, Bt as stripTopLevelRoutingUi, Ci as siblingPath, Cn as DEFAULT_LAUNCH_READINESS_INPUT, Co as parseMailingListPlacementTargeting, Cr as compileEditorModelRuntime, Ct as EntryPickerWidgetProvider, Da as TabsContent, Di as eventCalendarListLayoutOptions, Dn as useMediaEditorOptional, Do as expectParsedBrandedId, Dr as componentRuntimeRulesForTheme, Dt as MediaField, Ea as Tabs, Ei as eventCalendarListLayoutCompatibleDisplayModeValues, En as MediaEditorContextProvider, Eo as assertNever$2, Er as resolvePageDesignEditorBoundaryForChoice, Et as FileField, Fa as DialogTitle, Fi as asDesignBlockId, Fn as projectRecurringSchedule, Fr as gradientToCss, Ft as LinkField, G as confirmAutosaveBatch, Gi as textColorStyle, Gn as getResponsiveScopeSpec, Gr as sectionFactsForContent, Gt as useOptionalEditorUiStoreInstance, Hn as validateManifestDraft, Hr as userPinnedDesignChoice, Ii as assertNever$1, In as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Ir as GRADIENT_PRESETS, It as LinkWidgetProvider, J as idleEditorTransactionQueueState, Ji as ORDINARY_TEXT_MIN_CONTRAST_RATIO, Jn as readBlockComposition, Jr as sectionTransitionFamilies, Jt as createHistoryState, K as deriveTransactionCapabilities, Ki as defaultThemeTokens, Kn as escapeStyleContent, Kr as boundaryTreatmentForBoundaryOptionId, Kt as canRedoHistory, Li as makeBoundaryId, Ln as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, Lr as GRADIENT_PRESET_IDS, Ma as DialogDescription, Mi as isThemeV2NormalEditorRawStyleFieldName, Mn as createCustomBlockRegistry, Mt as RichTextWidgetProvider, Na as DialogFooter, Ni as pageDesignEditorBackgroundOverrideOwner, Nn as makeDefaultBlockComponent, Nt as EditorProvider, Oa as TabsList, Oi as bookingConsentCarrierSchema, On as useApiMediaUploader, Oo as parseMediaAssetId, Ot as ReferenceField, Pa as DialogHeader, Pi as stripStaleTransitionStyleGroup, Pn as getBlockDefinition, Pt as useEditor, Q as resolvePreviewSidebarTab, Qi as paletteModeSchema, Qn as resolvePageRouteTarget, Qr as backgroundAppearanceQuickColorTokenNames, Qt as unsafeAsLinkedContentEntryId, Rn as planSiteOverlayHeaderClearance, Rr as getGradientPreset, Rt as hideThemeV2RawStyleFields, Si as getAtPath, Sn as decodePublicProductCategorySelectorQuery, So as parseFooterModuleId, Sr as applyCompiledRuntimeFieldsToContent, St as EntryPickerField, Ti as calendarWindowQuerySchema, Tn as AMBIENT_BACKGROUND_ROLES, To as unsafeAsEditorBlockValues, Tr as planPageDesignLayoutLookCompatibility, Tt as ButtonWidgetProvider, Un as buildThemeRuntime, Ur as boundaryLayout, Ut as useEditorUiStore, Vn as compileManifestContentContract, Vr as autoDesignChoice, Vt as getBlockManifestFromSdkConfig, W as beginAutosaveBatch, Wn as DEFAULT_THEME_RESPONSIVE_MODE, Wr as composeBoundary, Wt as useEditorUiStoreInstance, Xa as X, Xn as defaultTransforms, Xr as sectionTransitionVariantForBoundaryOptionId, Xt as redoHistory, Y as rejectAutosaveBatch, Ya as cn, Yn as getDefaultComponentRegistry, Yr as sectionTransitionFamilyForBoundaryOptionId, Yt as pushHistoryEntry, Za as Upload, Zi as paletteColorsSchema, Zn as resolveEntryRouteTarget, Zr as backgroundAppearanceColorTokenNames, Zt as undoHistory, _ as reportPreviewDesignError, _a as SelectTrigger, _i as buildResolveImageUrlContext, _n as createStoreBackend, _o as ChevronLeft, _r as heroCtaRowFragment, _t as MailingListTargetingField, aa as hasEmptyOption, ai as runTransforms, ar as richTextFragment, bi as setContextResolveImageUrlContext, bn as getPageDesignEditorState, bo as buildMailingListSignupBlockSourceRef, br as bodyCopyFragment, bt as InlineTextField, ca as unmapValueFromSelect, ci as parseGeneratedIconSetId, cr as faqAccordionFragment, ct as EntryControllerProvider, d as PreviewDesignCoordinatorProvider, di as logger, dn as usePalette, dr as singleButtonFragment, dt as createSiteOptionApiLoader, ea as attachRenderableMediaAssetFields, ei as ctaButton, er as LINKED_CONTENT_ENTRY_META_KEY, et as renderSiteChromeBlock, fi as coerceInlineTextWithFallback, fo as Image, fr as formEmbedFragment, ft as createSiteOptionWidgetAdapters, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, ga as SelectItem, gi as RichText$1, gn as evaluateVisibility, go as ChevronRight, gr as ctaCopyFragment, gt as OfferingsPreviewWidgetProvider, h as PREVIEW_DESIGN_LOAD_ERROR_MESSAGE, ha as SelectContent, hi as Text$1, hn as FormRenderer, hr as testimonialsHeadingFragment, ht as OfferingsPreviewGroupOrderField, i as usePreviewDesignHistoryOrder, ia as useSdkConfig, ii as parseBackgroundContent, in as BUILT_IN_REFERENCE_KINDS, io as RotateCcw, ir as ImageResolveContextProvider, it as PREVIEW_EDITABLE_OUTLINE, ja as DialogContent, ji as corners, jn as containerResponsiveThemeCss, jr as surfaceResolutionContextFromTheme, jt as RichTextField, ka as TabsTrigger, ki as isObjectRecord, kn as isSupportedLoaderEndpoint, ko as parseSiteId, kr as designRuntimeRulesForTheme, kt as ReferenceWidgetProvider, la as FieldFrame, lr as faqHeadingFragment, m as usePreviewThemeOverlay, ma as Select, mi as isInlineTextEmpty, mr as testimonialsCarouselFragment, mt as SiteOptionWidgetProvider, n as useSiteChromeCustomizeOptional, na as isHeaderField, nn as createRoutingHelpers, nr as getLinkedContentEntryMeta, nt as PreviewInlineTextEditor, oa as mapCurrentValueForSelect, oi as parseBlockIconValue, on as parseReferenceKind, or as headingFragment, ot as useUISelector, p as PreviewThemeOverlayProvider, pi as inlineTextToPlainText, pn as createManifestFormAdapter, po as GripVertical, pr as formCopyFragment, pt as SiteOptionPickerField, q as enqueueTransaction, qa as Button, qi as parseThemeForPersistence, qn as mergeContentWithBlockStyleOverrides, qr as defaultSectionTransitionVariantForFamily, qt as canUndoHistory, r as PreviewDesignHistoryOrderProvider, ra as SdkConfigProvider, ri as planSiteChromePlacement, rn as createSnapshotFromPageRecord, rr as clientComponentRegistry, rt as PreviewTextEditor, sa as mapOptionValueForSelect, si as parseGeneratedIconAssetId, sr as cardFragment, st as EditableBlockProvider, t as SiteChromeCustomizeProvider, ta as getFieldIntent, ti as bindingSchema, tn as useDebouncedLatestSave, tr as coerceLinkedContentEntriesPayload, tt as PreviewRichTextEditor, ua as useField, ui as renderInlineText, un as PaletteProvider, ur as blogFeaturedPostFragment, ut as useEntryEditorController, va as SelectValue, vi as getCurrentResolveImageUrlContext, vn as MediaEditor, vr as ctaRowFragment, vt as loadMailingListAuthoringContext, wi as BlockApiProvider, wn as deriveLaunchReadiness, wo as unsafeAsEditorBlockId, wr as formatSiteChromeBackgroundTokenLabel, wt as ButtonVariantField, xi as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, xo as sameMailingListPlacementTargeting, xr as defineFragment, xt as IconPickerField, yi as resolveImageUrlWithContext, yn as applyPageDesignEditorAction, yr as heroCopyFragment, yt as MailingListTargetingProvider, zn as visibleHeaderClearancePx, zr as parseGradientPresetId, zt as prepareBlockEditorManifest } from "./SiteChromeCustomizeContext-DQXZXiqS.mjs";
3
- import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-Dd4dxOiU.mjs";
4
- import { _ as API_ENDPOINTS, a as usePreviewToken, c as createBearerAPIClient, d as unwrapResponse, g as resolveSurfaceDocumentAttributes, h as SURFACE_IDS, i as usePreviewAuthFetch, m as SURFACE_DOCUMENT_DATA_ATTRIBUTE, n as markPreviewAuthExpired, o as isPreviewRuntimeSessionEditable, r as usePreviewAuth, s as ApiRequestError, t as initPreviewAuth } from "./previewAuthStore-C_EHQ5XA.mjs";
2
+ import { $a as DialogFooter, $n as canUndoHistory, $r as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, $t as createStoreBackend, Aa as attachRenderableMediaAssetFields, Ao as GripVertical, Ar as parseGeneratedIconSetId, At as MailingListTargetingProvider, Bi as gradientToCss, Bo as baselineRevisionOf, Br as bookingConsentCarrierSchema, Bt as ReferenceWidgetProvider, Ca as makeBoundaryId, Ci as parseBackgroundContent, Cn as stripTopLevelRoutingUi, Cr as escapeStyleContent, Ct as createSiteOptionWidgetAdapters, Da as bodyCopyFragment, Di as planPageDesignLayoutLookCompatibility, Dn as createManifestFormAdapter, Dt as OfferingsPreviewWidgetProvider, Ea as ctaButton, Ei as formatSiteChromeBackgroundTokenLabel, En as isHeaderField, Er as getDefaultComponentRegistry, Et as OfferingsPreviewGroupOrderField, Fa as SelectContent, Fi as parseThemeForPersistence, Fr as RichText$1, Ft as ButtonVariantField, G as confirmAutosaveBatch, Go as buildMailingListSignupBlockSourceRef, Gr as resolvePageRouteTarget, Gt as useEditor, Hi as GRADIENT_PRESET_IDS, Hn as useEditorUiStore, Ho as recordsEqual, Hr as eventCalendarListLayoutCompatibleDisplayModeValues, Ht as RichTextField, Ia as SelectItem, Ii as resolveSdkFooterMode, In as BUILT_IN_REFERENCE_KINDS, Ir as getAtPath, It as ButtonWidgetProvider, J as idleEditorTransactionQueueState, Ja as TabsList, Jn as remoteDraftValues, Jo as parseMailingListPlacementTargeting, Jr as isRecord$11, K as deriveTransactionCapabilities, Ka as Tabs, Kn as activeLinkedSaveHandover, Ko as sameMailingListPlacementTargeting, Kr as resolveRouteTarget, Kt as LinkField, La as SelectTrigger, Lo as Button, Lr as siblingPath, Lt as FileField, Mn as getBlockManifestFromSdkConfig, Mr as renderInlineText, Mt as IconPickerField, Ni as surfaceResolutionContextFromTheme, Nn as createRoutingHelpers, No as ChevronRight, Nr as logger, Nt as EntryPickerField, Oa as defineFragment, Oi as resolvePageDesignEditorBoundaryForChoice, Or as parseBlockIconValue, Ot as MailingListTargetingField, Pa as Select, Pi as corners, Pn as createSnapshotFromPageRecord, Po as ChevronLeft, Pr as Text$1, Pt as EntryPickerWidgetProvider, Q as resolvePreviewSidebarTab, Qa as DialogDescription, Qn as canRedoHistory, Qr as setContextResolveImageUrlContext, Qt as FormRenderer, Ra as SelectValue, Rn as parseReferenceKind, Rr as defaultTransforms, Rt as MediaField, Sa as assertNever$1, Si as heroCopyFragment, Sn as prepareBlockEditorManifest, Sr as getResponsiveScopeSpec, St as createSiteOptionApiLoader, Ta as runTransforms, Ti as compileEditorModelRuntime, Tn as getFieldIntent, Tr as readBlockComposition, Tt as SiteOptionWidgetProvider, Ui as getGradientPreset, Un as useEditorUiStoreInstance, Ur as eventCalendarListLayoutOptions, Ut as RichTextWidgetProvider, Vi as GRADIENT_PRESETS, Vo as isEdited, Vr as isRichTextDoc, Vt as useRichTextImagePicker, W as beginAutosaveBatch, Wi as parseGradientPresetId, Wn as useOptionalEditorUiStoreInstance, Wo as canEditorWrite, Wr as resolveEntryRouteTarget, Wt as EditorProvider, Xa as Dialog, Xn as renderedFieldChanges, Xo as selectedContentVersionId, Xr as getCurrentResolveImageUrlContext, Xt as usePalette, Y as rejectAutosaveBatch, Ya as TabsTrigger, Yn as renderSourceFor, Yo as NO_BLOCK_VERSIONS, Yr as buildResolveImageUrlContext, Yt as PaletteProvider, Za as DialogContent, Zn as resolveRenderedValues, Zo as parseEditLeaseScope, Zr as resolveImageUrlWithContext, _ as reportPreviewDesignError, _i as testimonialsCarouselFragment, _n as mapOptionValueForSelect, _r as resolveVariantKey, _t as VIEWING_PARTICIPATION, aa as boundaryTreatmentForBoundaryOptionId, ai as LINKED_CONTENT_ENTRY_META_KEY, an as deriveLaunchReadiness, ar as unsafeAsLinkedContentEntryId, as as parseSiteId, ba as defaultThemeTokens, bi as heroCtaRowFragment, bn as useField, br as buildThemeRuntime, bt as EditLeaseModal, ca as sectionTransitionFamilyForBoundaryOptionId, ci as richTextFragment, cn as useMediaEditorOptional, cr as containerResponsiveThemeCss, ct as EntryControllerProvider, d as PreviewDesignCoordinatorProvider, da as pageDesignEditorBackgroundOverrideOwner, di as faqAccordionFragment, dn as ImageResolveContextProvider, dr as getBlockDefinition, ea as autoDesignChoice, ei as planSiteChromePlacement, en as MediaEditor, eo as DialogHeader, er as createHistoryState, et as renderSiteChromeBlock, fa as stripStaleTransitionStyleGroup, fi as faqHeadingFragment, fn as BlockApiProvider, fr as projectRecurringSchedule, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, ga as textColorStyle, gi as formCopyFragment, gn as mapCurrentValueForSelect, gr as visibleHeaderClearancePx, gt as useRetentionTicks, h as PREVIEW_DESIGN_LOAD_ERROR_MESSAGE, ha as parseBackgroundAppearanceColorToken, hi as formEmbedFragment, hn as hasEmptyOption, hr as planSiteOverlayHeaderClearance, ht as createPageSurfaceEditorServices, i as usePreviewDesignHistoryOrder, ia as sectionFactsForContent, ii as plainTextToInlineText, in as DEFAULT_LAUNCH_READINESS_INPUT, ir as toEditorBlockItem, is as parseMediaAssetId, it as PREVIEW_EDITABLE_OUTLINE, ji as designRuntimeRulesForTheme, jn as blocksKeys, jt as InlineTextField, ka as bindingSchema, ki as componentRuntimeRulesForTheme, ko as Image, kr as parseGeneratedIconAssetId, kt as loadMailingListAuthoringContext, la as sectionTransitionVariantForBoundaryOptionId, li as headingFragment, ln as useApiMediaUploader, lr as createCustomBlockRegistry, m as usePreviewThemeOverlay, ma as backgroundAppearanceQuickColorTokenNames, mi as singleButtonFragment, mn as useSdkConfig, mo as Upload, mr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, mt as createEditorApiClientFactory, n as useSiteChromeCustomizeOptional, na as boundaryLayout, ni as inlineTextToPlainText, nn as getPageDesignEditorState, nr as redoHistory, ns as assertNever$2, nt as PreviewInlineTextEditor, oa as defaultSectionTransitionVariantForFamily, oi as coerceLinkedContentEntriesPayload, on as AMBIENT_BACKGROUND_ROLES, or as isSupportedLoaderEndpoint, os as __exportAll, ot as useUISelector, p as PreviewThemeOverlayProvider, pa as backgroundAppearanceColorTokenNames, pi as blogFeaturedPostFragment, pn as SdkConfigProvider, po as X, pr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, pt as useDebouncedLatestSave, q as enqueueTransaction, qa as TabsContent, qn as planLinkedSaveHandoverRetention, qo as parseFooterModuleId, qr as isObjectRecord, qt as LinkWidgetProvider, r as PreviewDesignHistoryOrderProvider, ra as composeBoundary, ri as isInlineTextEmpty, rn as decodePublicProductCategorySelectorQuery, rr as undoHistory, rs as expectParsedBrandedId, rt as PreviewTextEditor, sa as sectionTransitionFamilies, si as getLinkedContentEntryMeta, sn as MediaEditorContextProvider, sr as ThemeScope, st as EditableBlockProvider, t as SiteChromeCustomizeProvider, ta as userPinnedDesignChoice, ti as coerceInlineTextWithFallback, tn as applyPageDesignEditorAction, to as DialogTitle, tr as pushHistoryEntry, ts as unsafeAsEditorBlockId, tt as PreviewRichTextEditor, ua as isThemeV2NormalEditorRawStyleFieldName, ui as cardFragment, un as clientComponentRegistry, ur as makeDefaultBlockComponent, ut as useEntryEditorController, va as paletteColorsSchema, vi as testimonialsHeadingFragment, vn as unmapValueFromSelect, vr as compileManifestContentContract, wa as ORDINARY_TEXT_MIN_CONTRAST_RATIO, wi as applyCompiledRuntimeFieldsToContent, wn as evaluateVisibility, wr as mergeContentWithBlockStyleOverrides, wt as SiteOptionPickerField, xa as asDesignBlockId, xi as ctaRowFragment, xn as hideThemeV2RawStyleFields, xo as RotateCcw, xr as DEFAULT_THEME_RESPONSIVE_MODE, xt as EditorWriteSurface, ya as paletteModeSchema, yi as ctaCopyFragment, yn as FieldFrame, yr as validateManifestDraft, yt as EditLeaseDiscardedNotice, zo as cn, zr as calendarWindowQuerySchema, zt as ReferenceField } from "./SiteChromeCustomizeContext-JYA0cJ_Z.mjs";
3
+ import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-C0mndwHB.mjs";
4
+ import { _ as SURFACE_IDS, a as usePreviewAuth, g as SURFACE_DOCUMENT_DATA_ATTRIBUTE, i as setPreviewAccessToken, l as isPreviewRuntimeSessionEditable, n as initPreviewAuth, o as usePreviewAuthFetch, p as unwrapResponse, r as markPreviewAuthExpired, s as usePreviewToken, t as createGuardedPreviewApiClient, u as ApiRequestError, v as resolveSurfaceDocumentAttributes, y as API_ENDPOINTS } from "./previewAuthStore-BBmV7UsW.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";
8
+ import { useQueryClient } from "@tanstack/react-query";
8
9
  import { z } from "zod";
9
10
  import { createPortal } from "react-dom";
10
11
  //#region ../ui/src/fixed-bottom-surface.tsx
@@ -174,70 +175,6 @@ function ResizableSplitPane({ left, right, defaultSplit = 40, minLeftWidth = 300
174
175
  });
175
176
  }
176
177
  //#endregion
177
- //#region ../blocks/src/system/icons/generatedAssets.ts
178
- function isRecord$10(value) {
179
- return typeof value === "object" && value !== null && !Array.isArray(value);
180
- }
181
- function generatedIconAssetRefKey(ref) {
182
- return `${ref.setId}\u0000${ref.assetId}`;
183
- }
184
- function collectGeneratedIconAssetRefs(page) {
185
- const blocks = [];
186
- for (const block of page.blocks) {
187
- if (block.kind !== "block.feature-cards" || typeof block.id !== "string") continue;
188
- const content = isRecord$10(block.draftContent) ? block.draftContent : isRecord$10(block.content) ? block.content : null;
189
- const cards = Array.isArray(content?.cards) ? content.cards : [];
190
- const refs = /* @__PURE__ */ new Map();
191
- for (const card of cards) {
192
- if (!isRecord$10(card)) continue;
193
- const icon = parseBlockIconValue(card.icon);
194
- if (icon.kind !== "generated") continue;
195
- const ref = {
196
- setId: icon.setId,
197
- assetId: icon.assetId
198
- };
199
- refs.set(generatedIconAssetRefKey(ref), ref);
200
- }
201
- if (refs.size > 0) blocks.push({
202
- blockId: block.id,
203
- refs: [...refs.values()]
204
- });
205
- }
206
- return blocks;
207
- }
208
- function dedupeGeneratedIconAssetRefs(blocks) {
209
- return [...new Map(blocks.flatMap((block) => block.refs).map((ref) => [generatedIconAssetRefKey(ref), ref])).values()];
210
- }
211
- function mapGeneratedIconAssetsToBlocks(blocks, resolvedAssets) {
212
- const byKey = new Map(resolvedAssets.map((asset) => [generatedIconAssetRefKey(asset), asset]));
213
- return Object.fromEntries(blocks.flatMap((block) => {
214
- const assets = block.refs.flatMap((ref) => {
215
- const asset = byKey.get(generatedIconAssetRefKey(ref));
216
- if (!asset) return [];
217
- const setId = parseGeneratedIconSetId(asset.setId);
218
- const assetId = parseGeneratedIconAssetId(asset.assetId);
219
- if (!setId || !assetId) return [];
220
- return [{
221
- setId,
222
- assetId,
223
- src: asset.src,
224
- ...asset.width === void 0 ? {} : { width: asset.width },
225
- ...asset.height === void 0 ? {} : { height: asset.height }
226
- }];
227
- });
228
- return assets.length > 0 ? [[block.blockId, assets]] : [];
229
- }));
230
- }
231
- function mergeGeneratedIconAssetsIntoResolvedData(resolvedData, assetsByBlock) {
232
- if (Object.keys(assetsByBlock).length === 0) return resolvedData;
233
- const merged = { ...resolvedData };
234
- for (const [blockId, generatedIconAssets] of Object.entries(assetsByBlock)) merged[blockId] = {
235
- ...merged[blockId] ?? {},
236
- generatedIconAssets
237
- };
238
- return merged;
239
- }
240
- //#endregion
241
178
  //#region ../blocks/src/system/fragments/library/headerCta.ts
242
179
  const headerCtaFragment = defineFragment({
243
180
  id: "headerCta",
@@ -345,6 +282,70 @@ function getFragmentRegistry() {
345
282
  return fragmentRegistry;
346
283
  }
347
284
  //#endregion
285
+ //#region ../blocks/src/system/icons/generatedAssets.ts
286
+ function isRecord$10(value) {
287
+ return typeof value === "object" && value !== null && !Array.isArray(value);
288
+ }
289
+ function generatedIconAssetRefKey(ref) {
290
+ return `${ref.setId}\u0000${ref.assetId}`;
291
+ }
292
+ function collectGeneratedIconAssetRefs(page) {
293
+ const blocks = [];
294
+ for (const block of page.blocks) {
295
+ if (block.kind !== "block.feature-cards" || typeof block.id !== "string") continue;
296
+ const content = isRecord$10(block.draftContent) ? block.draftContent : isRecord$10(block.content) ? block.content : null;
297
+ const cards = Array.isArray(content?.cards) ? content.cards : [];
298
+ const refs = /* @__PURE__ */ new Map();
299
+ for (const card of cards) {
300
+ if (!isRecord$10(card)) continue;
301
+ const icon = parseBlockIconValue(card.icon);
302
+ if (icon.kind !== "generated") continue;
303
+ const ref = {
304
+ setId: icon.setId,
305
+ assetId: icon.assetId
306
+ };
307
+ refs.set(generatedIconAssetRefKey(ref), ref);
308
+ }
309
+ if (refs.size > 0) blocks.push({
310
+ blockId: block.id,
311
+ refs: [...refs.values()]
312
+ });
313
+ }
314
+ return blocks;
315
+ }
316
+ function dedupeGeneratedIconAssetRefs(blocks) {
317
+ return [...new Map(blocks.flatMap((block) => block.refs).map((ref) => [generatedIconAssetRefKey(ref), ref])).values()];
318
+ }
319
+ function mapGeneratedIconAssetsToBlocks(blocks, resolvedAssets) {
320
+ const byKey = new Map(resolvedAssets.map((asset) => [generatedIconAssetRefKey(asset), asset]));
321
+ return Object.fromEntries(blocks.flatMap((block) => {
322
+ const assets = block.refs.flatMap((ref) => {
323
+ const asset = byKey.get(generatedIconAssetRefKey(ref));
324
+ if (!asset) return [];
325
+ const setId = parseGeneratedIconSetId(asset.setId);
326
+ const assetId = parseGeneratedIconAssetId(asset.assetId);
327
+ if (!setId || !assetId) return [];
328
+ return [{
329
+ setId,
330
+ assetId,
331
+ src: asset.src,
332
+ ...asset.width === void 0 ? {} : { width: asset.width },
333
+ ...asset.height === void 0 ? {} : { height: asset.height }
334
+ }];
335
+ });
336
+ return assets.length > 0 ? [[block.blockId, assets]] : [];
337
+ }));
338
+ }
339
+ function mergeGeneratedIconAssetsIntoResolvedData(resolvedData, assetsByBlock) {
340
+ if (Object.keys(assetsByBlock).length === 0) return resolvedData;
341
+ const merged = { ...resolvedData };
342
+ for (const [blockId, generatedIconAssets] of Object.entries(assetsByBlock)) merged[blockId] = {
343
+ ...merged[blockId] ?? {},
344
+ generatedIconAssets
345
+ };
346
+ return merged;
347
+ }
348
+ //#endregion
348
349
  //#region ../blocks/src/pageRenderingMode.ts
349
350
  var MissingBlockOverrideError = class extends Error {
350
351
  constructor(blockKind) {
@@ -564,6 +565,7 @@ function buildPageRendererRootRuntime(dataContext) {
564
565
  const { siteId = null, siteName, pageId = null, pathname = null, bookingTimeZone, previewStage = "published", apiBaseUrl = null, portalToken = null, readAuthority, bookingOfferingPresets = [], appointmentServicePathPrefix = null, mailingList = { tag: "not_configured" }, eventRegistrationOverlayEnabled = false, loaderFailures = {} } = dataContext ?? {};
565
566
  return {
566
567
  siteId,
568
+ demoEmailSuppressed: resolveDemoEmailSuppression(dataContext),
567
569
  siteName,
568
570
  pageId,
569
571
  pathname,
@@ -579,6 +581,9 @@ function buildPageRendererRootRuntime(dataContext) {
579
581
  loaderFailures
580
582
  };
581
583
  }
584
+ function resolveDemoEmailSuppression(dataContext) {
585
+ return dataContext?.demoEmailSuppressed === true;
586
+ }
582
587
  //#endregion
583
588
  //#region ../blocks/src/pageRenderAudience.tsx
584
589
  /**
@@ -1001,15 +1006,17 @@ function planNewsletterBlockSubmission(placement) {
1001
1006
  sourceRef
1002
1007
  } : { tag: "unavailable" };
1003
1008
  }
1004
- if (placement.publishedPlacement && "kind" in placement.publishedPlacement) return { tag: "unpublished-settings" };
1005
- if (placement.publishedPlacement) return planNewsletterPreviewSubmission({
1006
- blockId: placement.blockId,
1007
- publishedContentId: placement.publishedPlacement.id,
1008
- renderedContent: placement.renderedContent,
1009
- publishedContent: placement.publishedPlacement.content
1010
- });
1011
- if (placement.stage === "preview") return { tag: "unpublished-form" };
1012
- return { tag: "unavailable" };
1009
+ const published = placement.publishedPlacement;
1010
+ if (published === null) return placement.stage === "preview" ? { tag: "unpublished-form" } : { tag: "unavailable" };
1011
+ switch (published.kind) {
1012
+ case "incomplete": return { tag: "unpublished-settings" };
1013
+ case "published": return planNewsletterPreviewSubmission({
1014
+ blockId: placement.blockId,
1015
+ publishedContentId: published.id,
1016
+ renderedContent: placement.renderedContent,
1017
+ publishedContent: published.content
1018
+ });
1019
+ }
1013
1020
  }
1014
1021
  /** Decide whether the visible draft can safely cite the published placement. */
1015
1022
  function planNewsletterPreviewSubmission(placement) {
@@ -1256,19 +1263,6 @@ function createBlockErrorBoundary() {
1256
1263
  const BlockErrorBoundary = createBlockErrorBoundary();
1257
1264
  //#endregion
1258
1265
  //#region ../blocks/src/pageRenderAdmission.ts
1259
- /** Pair a published version with the content it authorises at the render boundary. */
1260
- function readPublishedBlockPlacement(id, content) {
1261
- if (id == null && content == null) return null;
1262
- if (id == null || content == null) return {
1263
- kind: "incomplete",
1264
- id: id ?? null,
1265
- content: content ?? null
1266
- };
1267
- return {
1268
- id,
1269
- content
1270
- };
1271
- }
1272
1266
  function toEditorPresentationPage(page) {
1273
1267
  if (!page) return null;
1274
1268
  return {
@@ -2842,11 +2836,16 @@ function isNonEmptyString(value) {
2842
2836
  function hasText(value) {
2843
2837
  return isNonEmptyString(value);
2844
2838
  }
2845
- ({
2839
+ const FILE_STORAGE_BUCKETS = {
2846
2840
  publicSite: unsafeAsStorageBucketName("media"),
2847
2841
  privateSite: unsafeAsStorageBucketName("site-files-private"),
2848
- temporary: unsafeAsStorageBucketName("temp-uploads")
2849
- }).publicSite;
2842
+ temporary: unsafeAsStorageBucketName("temp-uploads"),
2843
+ siteAssets: unsafeAsStorageBucketName("site-assets"),
2844
+ siteFonts: unsafeAsStorageBucketName("site-fonts"),
2845
+ bookingRequirementDocuments: unsafeAsStorageBucketName("booking-requirement-documents")
2846
+ };
2847
+ FILE_STORAGE_BUCKETS.publicSite, FILE_STORAGE_BUCKETS.siteAssets, FILE_STORAGE_BUCKETS.siteFonts;
2848
+ FILE_STORAGE_BUCKETS.publicSite, FILE_STORAGE_BUCKETS.privateSite, FILE_STORAGE_BUCKETS.temporary, FILE_STORAGE_BUCKETS.siteAssets, FILE_STORAGE_BUCKETS.siteFonts, FILE_STORAGE_BUCKETS.bookingRequirementDocuments;
2850
2849
  const IMAGE_FILE_FORMATS = [
2851
2850
  "jpeg",
2852
2851
  "png",
@@ -3782,9 +3781,9 @@ function MediaEditorProvider({ siteId, apiClient, children, bucket = DEFAULT_MED
3782
3781
  });
3783
3782
  }, [baseAssetsSnapshotKey, siteId]);
3784
3783
  const repo = useMemo(() => {
3785
- const clientFn = ((request) => {
3784
+ const clientFn = (request) => {
3786
3785
  return apiClient(augmentRequest ? augmentRequest(request, { siteId }) : request);
3787
- });
3786
+ };
3788
3787
  return createCachedMediaRepo(createApiMediaRepo({ client: clientFn }));
3789
3788
  }, [
3790
3789
  apiClient,
@@ -5166,6 +5165,11 @@ function canInspectSiteStyle(access) {
5166
5165
  return access.kind === "apply-allowed";
5167
5166
  }
5168
5167
  //#endregion
5168
+ //#region ../preview-next/src/constants.ts
5169
+ const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
5170
+ const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
5171
+ const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
5172
+ //#endregion
5169
5173
  //#region ../preview-next/src/client/preview/previewChromeSurface.ts
5170
5174
  const PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
5171
5175
  const PREVIEW_CHROME_PORTAL_CLASS_NAME = "builder-editor-chrome";
@@ -5195,6 +5199,25 @@ function applyPreviewChromeSurfaceToElement(element, surface, options) {
5195
5199
  element.removeAttribute(SURFACE_DOCUMENT_DATA_ATTRIBUTE);
5196
5200
  }
5197
5201
  //#endregion
5202
+ //#region ../preview-next/src/client/preview/previewCustomizeAutosave.ts
5203
+ /** Work selection and checkpoint capture share the existing transaction objects. */
5204
+ function previewCustomizeCanAutosave(workflow) {
5205
+ return workflow.kind === "loaded" && (workflow.mutation.kind === "dirty" || workflow.mutation.kind === "failed") && workflow.mutation.actions.length > 0;
5206
+ }
5207
+ /** Preserve transaction identity and history while a checkpoint waits for an active save. */
5208
+ function previewCustomizePendingBatch(workflow) {
5209
+ if (workflow.kind !== "loaded") return { transactions: [] };
5210
+ switch (workflow.mutation.kind) {
5211
+ case "dirty":
5212
+ case "failed": return { transactions: workflow.mutation.actions };
5213
+ case "applying": return { transactions: workflow.mutation.queuedActions };
5214
+ case "idle":
5215
+ case "undoing":
5216
+ case "redoing":
5217
+ case "stale": return { transactions: [] };
5218
+ }
5219
+ }
5220
+ //#endregion
5198
5221
  //#region ../blocks/src/system/customize/serializeBackgroundOverride.ts
5199
5222
  function serializeBackgroundOverride(override) {
5200
5223
  switch (override.kind) {
@@ -6019,10 +6042,10 @@ function beginPreviewCustomizeApply(workflow, action) {
6019
6042
  }
6020
6043
  };
6021
6044
  }
6022
- function beginPreviewCustomizeAutosave(workflow) {
6045
+ function beginPreviewCustomizeAutosave(workflow, captured) {
6023
6046
  if (workflow.kind !== "loaded") return skippedPreviewCustomizeBeginResult("not-loaded");
6024
- if (workflow.mutation.kind !== "dirty" && workflow.mutation.kind !== "failed") return skippedPreviewCustomizeBeginResult("no-history-entry");
6025
- const nextMutation = previewCustomizeMutationFromQueueState(beginAutosaveBatch(previewCustomizeQueueStateFromMutation(workflow.mutation)));
6047
+ if (!previewCustomizeCanAutosave(workflow)) return skippedPreviewCustomizeBeginResult("no-history-entry");
6048
+ const nextMutation = previewCustomizeMutationFromQueueState(beginAutosaveBatch(previewCustomizeQueueStateFromMutation(workflow.mutation), captured));
6026
6049
  if (nextMutation.kind !== "applying") return skippedPreviewCustomizeBeginResult("no-history-entry");
6027
6050
  const actions = nextMutation.batch.transactions.map((intent) => intent.action);
6028
6051
  if (actions.length === 0) return skippedPreviewCustomizeBeginResult("no-history-entry");
@@ -6200,21 +6223,6 @@ function isPendingMutation(mutation) {
6200
6223
  default: return assertNever$1(mutation, "Unhandled preview customize mutation");
6201
6224
  }
6202
6225
  }
6203
- function pendingCustomizeIntents(mutation) {
6204
- switch (mutation.kind) {
6205
- case "dirty": return mutation.actions;
6206
- case "applying": return mutation.queuedActions;
6207
- case "failed": return mutation.actions;
6208
- case "idle":
6209
- case "undoing":
6210
- case "redoing":
6211
- case "stale": return [];
6212
- default: return assertNever$1(mutation, "Unhandled preview customize mutation");
6213
- }
6214
- }
6215
- function previewCustomizePendingActions(workflow) {
6216
- return workflow.kind === "loaded" ? pendingCustomizeIntents(workflow.mutation).map((intent) => intent.action) : [];
6217
- }
6218
6226
  function previewCustomizeTargetKey(action) {
6219
6227
  switch (action.kind) {
6220
6228
  case "set-layout": return `block:${action.blockId}:layout`;
@@ -6395,6 +6403,22 @@ function optimisticBoundaryChoice(action) {
6395
6403
  }
6396
6404
  }
6397
6405
  //#endregion
6406
+ //#region ../preview-next/src/client/preview/usePreviewCustomizeWorkflowState.ts
6407
+ /** Update the scheduler's authoritative workflow before its next serialized request. */
6408
+ function usePreviewCustomizeWorkflowState() {
6409
+ const [state, setRenderedState] = useState(unsupportedPreviewCustomizeWorkflowState);
6410
+ const stateRef = useRef(state);
6411
+ return [
6412
+ state,
6413
+ useCallback((next) => {
6414
+ const value = typeof next === "function" ? next(stateRef.current) : next;
6415
+ stateRef.current = value;
6416
+ setRenderedState(value);
6417
+ }, []),
6418
+ stateRef
6419
+ ];
6420
+ }
6421
+ //#endregion
6398
6422
  //#region ../blocks/src/system/customize/facets.ts
6399
6423
  function defineCustomizeFacet(definition) {
6400
6424
  return definition;
@@ -6600,56 +6624,37 @@ function currentLocalBlockContent(uiStore, targetBlockId) {
6600
6624
  const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
6601
6625
  return isRecord$5(current) ? current : null;
6602
6626
  }
6627
+ /**
6628
+ * The customize runtime drives these values and owns their undo, so they go in as a
6629
+ * history-free `edited` event (issue 1553). A block the store hasn't loaded is created
6630
+ * first, pristine at the content the runtime started from.
6631
+ */
6603
6632
  function replaceLocalBlockContentWithoutHistory(input) {
6604
6633
  const editorBlockId = unsafeAsEditorBlockId(input.targetBlockId);
6605
- const history = input.uiStore.getState().history;
6606
- const snapshot = history.getState().present;
6607
- const draft = snapshot.drafts[editorBlockId];
6608
- const nextDraft = draft ? applyDraftContentPatch(draft, input.nextContent, input.baselineEquivalentContent) : localRuntimeDraftForBlock({
6609
- editorBlockId,
6610
- targetBlockId: input.targetBlockId,
6611
- editorModel: input.editorModel,
6612
- previousContent: input.previousContent,
6613
- nextContent: input.nextContent
6614
- });
6615
- if (!nextDraft) return { kind: "missing-block-model" };
6616
- history.restorePresent({
6617
- ...snapshot,
6618
- drafts: {
6619
- ...snapshot.drafts,
6620
- [editorBlockId]: nextDraft
6621
- }
6622
- });
6634
+ const drafts = input.uiStore.getState().drafts;
6635
+ const draft = drafts.getBlockSnapshot(editorBlockId);
6636
+ if (!draft && !initRuntimeBlock(input.uiStore, editorBlockId, input)) return { kind: "missing-block-model" };
6637
+ drafts.editWithoutHistory(editorBlockId, shownContent(draft, input.nextContent, input.baselineEquivalentContent));
6623
6638
  return { kind: "applied" };
6624
6639
  }
6625
- function applyDraftContentPatch(draft, nextContent, baselineEquivalentContent) {
6626
- const nextValues = unsafeAsEditorBlockValues(nextContent);
6627
- const baselineEquivalentValues = baselineEquivalentContent ? unsafeAsEditorBlockValues(baselineEquivalentContent) : null;
6628
- const current = baselineEquivalentValues && recordsEqual(nextValues, baselineEquivalentValues) ? draft.baseline : nextValues;
6629
- return {
6630
- ...draft,
6631
- version: draft.version + 1,
6632
- current,
6633
- syncState: recordsEqual(draft.baseline, current) ? { kind: "baseline" } : { kind: "pending" }
6634
- };
6640
+ /** Content equivalent to the baseline shows the baseline itself, so the block is pristine again. */
6641
+ function shownContent(draft, nextContent, baselineEquivalentContent) {
6642
+ return draft && baselineEquivalentContent && recordsEqual(nextContent, baselineEquivalentContent) ? draft.sync.baseline.values : nextContent;
6635
6643
  }
6636
- function localRuntimeDraftForBlock(input) {
6644
+ function initRuntimeBlock(uiStore, editorBlockId, input) {
6637
6645
  const block = input.editorModel?.blocks.find((candidate) => candidate.blockId === input.targetBlockId) ?? null;
6638
- if (!block) return null;
6639
- return {
6640
- id: input.editorBlockId,
6641
- version: 1,
6642
- baseline: unsafeAsEditorBlockValues(input.previousContent),
6643
- current: unsafeAsEditorBlockValues(input.nextContent),
6644
- syncState: { kind: "pending" },
6645
- meta: {
6646
+ if (!block) return false;
6647
+ const state = uiStore.getState();
6648
+ state.admitServerBlocks([{
6649
+ block: {
6650
+ id: editorBlockId,
6646
6651
  kind: block.blockKind,
6647
- purpose: null,
6648
- orderIndex: null,
6649
- publishedContent: null,
6650
- optimisticHash: null
6651
- }
6652
- };
6652
+ content: input.previousContent,
6653
+ versions: state.blockVersions.require(editorBlockId)
6654
+ },
6655
+ action: "reconcile"
6656
+ }]);
6657
+ return true;
6653
6658
  }
6654
6659
  function isRecord$5(value) {
6655
6660
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
@@ -6674,17 +6679,13 @@ const PageDesignEditorStateContext = createContext({
6674
6679
  });
6675
6680
  function PreviewPageDesignEditorStateProvider({ apiClient, siteId, pageId, enabled, autosaveDelayMs, children }) {
6676
6681
  const [reloadKey, setReloadKey] = useState(0);
6677
- const [workflowState, setWorkflowState] = useState(unsupportedPreviewCustomizeWorkflowState);
6682
+ const [workflowState, setWorkflowState, workflowStateRef] = usePreviewCustomizeWorkflowState();
6678
6683
  const [backgroundImagePool, setBackgroundImagePool] = useState([]);
6679
6684
  const [backgroundImagePoolStatus, setBackgroundImagePoolStatus] = useState("idle");
6680
- const workflowStateRef = useRef(workflowState);
6681
6685
  const pendingDesignHistoryOrderRecordRef = useRef(false);
6682
6686
  const previewDesignHistoryOrder = usePreviewDesignHistoryOrder();
6683
6687
  const backgroundImagePoolRequestRef = useRef(null);
6684
6688
  const uiStore = useOptionalEditorUiStoreInstance();
6685
- useEffect(() => {
6686
- workflowStateRef.current = workflowState;
6687
- }, [workflowState]);
6688
6689
  useEffect(() => {
6689
6690
  if (!enabled || !pageId) {
6690
6691
  setWorkflowState(unsupportedPreviewCustomizeWorkflowState());
@@ -6754,9 +6755,9 @@ function PreviewPageDesignEditorStateProvider({ apiClient, siteId, pageId, enabl
6754
6755
  siteId
6755
6756
  ]);
6756
6757
  const autosave = useDebouncedLatestSave({
6757
- getSnapshot: () => previewCustomizePendingActions(workflowStateRef.current),
6758
- buildPayload: (actions) => actions,
6759
- shouldSkip: (actions) => actions.length === 0 || !enabled || !pageId,
6758
+ getSnapshot: () => previewCustomizePendingBatch(workflowStateRef.current),
6759
+ buildPayload: (batch) => batch.transactions.map((transaction) => transaction.action),
6760
+ shouldSkip: (batch) => batch.transactions.length === 0 || !enabled || !pageId || !previewCustomizeCanAutosave(workflowStateRef.current),
6760
6761
  delay: autosaveDelayMs,
6761
6762
  save: async (actions) => {
6762
6763
  if (!pageId) return null;
@@ -6769,9 +6770,9 @@ function PreviewPageDesignEditorStateProvider({ apiClient, siteId, pageId, enabl
6769
6770
  editorModel: currentPageState.kind === "loaded" ? currentPageState.editorModel : null
6770
6771
  });
6771
6772
  },
6772
- onSaving: () => {
6773
+ onSaving: (batch) => {
6773
6774
  setWorkflowState((current) => {
6774
- const begin = beginPreviewCustomizeAutosave(current);
6775
+ const begin = beginPreviewCustomizeAutosave(current, batch);
6775
6776
  if (begin.kind !== "started") return current;
6776
6777
  pendingDesignHistoryOrderRecordRef.current = begin.recordsHistoryEntry;
6777
6778
  return begin.state;
@@ -6794,7 +6795,7 @@ function PreviewPageDesignEditorStateProvider({ apiClient, siteId, pageId, enabl
6794
6795
  });
6795
6796
  useLayoutEffect(() => {
6796
6797
  return () => {
6797
- autosave.flush();
6798
+ autosave.flush().catch(() => {});
6798
6799
  };
6799
6800
  }, [autosave]);
6800
6801
  const value = useMemo(() => ({
@@ -7045,7 +7046,7 @@ function blockIdForRuntimePatch(action) {
7045
7046
  function PreviewAuthInit({ children, session, siteId, siteSlug, pageId, token }) {
7046
7047
  const lastInitRef = useRef(null);
7047
7048
  const sessionKey = session ? session.kind === "userSession" ? `${session.kind}:${session.canEdit}:${session.canManage}:${session.expiresAt ?? "no-expiry"}` : `${session.kind}:${session.expiresAt ?? "no-expiry"}` : "none";
7048
- const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ? "has-token" : "no-token"}`;
7049
+ const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ?? "no-token"}`;
7049
7050
  if (lastInitRef.current !== currentKey) {
7050
7051
  initPreviewAuth({
7051
7052
  session,
@@ -7075,169 +7076,578 @@ const PAGE_CONTENT_TYPE_SCHEMA = {
7075
7076
  }
7076
7077
  };
7077
7078
  //#endregion
7078
- //#region ../preview-next/src/client/preview/PreviewEntryControllerProvider.tsx
7079
- function toEditorInitialBlock(block, index) {
7080
- return {
7081
- id: block.id,
7082
- draftContentId: block.draftContentId ?? null,
7083
- publishedContentId: block.publishedContentId ?? null,
7084
- kind: block.kind,
7085
- orderIndex: typeof block.orderIndex === "number" ? block.orderIndex : index,
7086
- content: block.content ?? null,
7087
- draftContent: block.draftContent ?? null,
7088
- publishedContent: block.publishedContent ?? null,
7089
- bindings: block.bindings ?? null,
7090
- optimisticHash: block.optimisticHash ?? null
7091
- };
7079
+ //#region ../preview-next/src/client/blocks/linkedEntryRenderOverlay.ts
7080
+ /**
7081
+ * What a tab rendering its own edits lays over the server render for one record:
7082
+ * its edit, or else its accepted save until the render catches up (rows H1, H3, H4).
7083
+ * A pristine record with no handover (even one kept after a discard, issue 1553 D2)
7084
+ * contributes nothing, so it never masks later server-rendered content.
7085
+ */
7086
+ function ownEditsOverlay(entry, handovers) {
7087
+ if (isEdited(entry.sync)) {
7088
+ const content = resolveRenderedValues("own-edits", entry, null);
7089
+ return content ? {
7090
+ content: { ...content },
7091
+ optimisticHash: baselineRevisionOf(entry.sync) ?? null
7092
+ } : null;
7093
+ }
7094
+ const handover = activeLinkedSaveHandover(handovers, entry.meta.entryId, entry.sync);
7095
+ const saved = entry.sync.baseline.values;
7096
+ return handover && saved ? {
7097
+ content: { ...saved },
7098
+ optimisticHash: handover.revision,
7099
+ handoverRevision: handover.revision
7100
+ } : null;
7092
7101
  }
7093
- function PreviewEntryControllerProvider({ children, siteId, pageId, routeId: providedRouteId, entryData, contentTypeSchema, draftContent, initialStatus = "draft", initialBlocks, pageMetadata, apiClient }) {
7094
- const { isEditingMode } = useEditor();
7095
- const schema = contentTypeSchema ?? PAGE_CONTENT_TYPE_SCHEMA;
7096
- const initialEntry = useMemo(() => {
7097
- if (entryData) {
7098
- const draftPath = entryData.draftPath ?? entryData.path ?? "";
7099
- const publishedPath = entryData.path ?? "";
7100
- return {
7101
- kind: "routable",
7102
- id: entryData.id,
7103
- draft: {
7104
- title: entryData.title ?? "",
7105
- slug: entryData.slug || "",
7106
- status: entryData.status ?? "draft",
7107
- publishAt: entryData.publishAt ?? null,
7108
- path: draftPath
7109
- },
7110
- published: {
7111
- title: entryData.title ?? "",
7112
- path: publishedPath,
7113
- status: entryData.status ?? "draft",
7114
- publishAt: entryData.publishAt ?? null
7115
- },
7116
- status: entryData.status ?? "draft",
7117
- route: {
7118
- draftMetaTitle: entryData.draftMetaTitle ?? null,
7119
- draftMetaDescription: entryData.draftMetaDescription ?? null,
7120
- publishedMetaTitle: entryData.metaTitle ?? null,
7121
- publishedMetaDescription: entryData.metaDescription ?? null,
7122
- ogImageId: entryData.ogImageId ?? null
7123
- }
7124
- };
7125
- }
7126
- if (!pageMetadata || !pageId) return void 0;
7127
- const routing = createRoutingHelpers(schema, { slug: null });
7128
- return createSnapshotFromPageRecord({
7129
- id: pageId,
7130
- draftTitle: pageMetadata.draftTitle,
7131
- draftPath: pageMetadata.draftPath,
7132
- draftStatus: pageMetadata.draftStatus,
7133
- title: pageMetadata.title,
7134
- path: pageMetadata.path,
7135
- status: pageMetadata.status,
7136
- publishedAt: pageMetadata.publishedAt,
7137
- draftMetaTitle: pageMetadata.draftMetaTitle,
7138
- draftMetaDescription: pageMetadata.draftMetaDescription,
7139
- publishedMetaTitle: pageMetadata.publishedMetaTitle,
7140
- publishedMetaDescription: pageMetadata.publishedMetaDescription,
7141
- ogImageId: pageMetadata.ogImageId
7142
- }, routing, {
7143
- title: "",
7144
- slug: null
7102
+ /** A viewer lays another tab's live draft over the render, and nothing else. */
7103
+ function liveDraftOverlay(entry, remote) {
7104
+ const content = remote ? resolveRenderedValues("live-drafts", entry, remote) : null;
7105
+ return content ? {
7106
+ content: { ...content },
7107
+ optimisticHash: baselineRevisionOf(entry.sync) ?? null
7108
+ } : null;
7109
+ }
7110
+ /**
7111
+ * The linked-entry values the preview renders, following the tab's render source
7112
+ * (its own edits, or another tab's live drafts while it only views). Entries only
7113
+ * another tab is editing are included too. A viewer never reads its own handovers,
7114
+ * so a later external write is never masked (row H8).
7115
+ */
7116
+ function linkedEntryRenderOverlaysFromStore(uiStore) {
7117
+ const state = uiStore.getState();
7118
+ const source = renderSourceFor(state.editability);
7119
+ const entries = state.linkedEntries.inspect();
7120
+ const local = entries.flatMap((entry) => {
7121
+ const remote = remoteDraftValues(state.remoteDrafts, {
7122
+ kind: "linked-entry",
7123
+ id: entry.meta.entryId
7145
7124
  });
7146
- }, [
7147
- entryData,
7148
- pageMetadata,
7149
- pageId,
7150
- schema
7151
- ]);
7152
- const normalizedInitialBlocks = useMemo(() => {
7153
- return (initialBlocks ?? []).map(toEditorInitialBlock);
7154
- }, [initialBlocks]);
7155
- const entityId = pageId || entryData?.id || "";
7156
- const entityType = entryData ? entryData.type : "page";
7157
- const entityLabel = entryData ? "Entry" : "Page";
7158
- const routeId = providedRouteId ?? void 0;
7159
- const initialContent = entryData ? draftContent ?? entryData.content ?? {} : null;
7160
- const common = {
7161
- apiClient,
7162
- type: entityType || "page",
7163
- siteId,
7164
- owner: {
7165
- kind: "contentEntry",
7166
- contentEntryId: entityId
7167
- },
7168
- routeId,
7169
- schema,
7170
- entityLabel,
7171
- initialEntry,
7172
- initialBlocks: normalizedInitialBlocks,
7173
- historyShortcutsEnabled: isEditingMode
7174
- };
7175
- return entryData ? /* @__PURE__ */ jsx(EntryControllerProvider, {
7176
- ...common,
7177
- kind: "content",
7178
- initialContent,
7179
- children
7180
- }) : /* @__PURE__ */ jsx(EntryControllerProvider, {
7181
- ...common,
7182
- kind: "page",
7183
- initialStatus,
7184
- children
7125
+ const overlay = source === "own-edits" ? ownEditsOverlay(entry, state.linkedSaveHandovers) : liveDraftOverlay(entry, remote);
7126
+ return overlay ? [[entry.meta.entryId, overlay]] : [];
7185
7127
  });
7128
+ const localIds = new Set(entries.map((entry) => entry.meta.entryId));
7129
+ const remoteOnly = [...state.remoteDrafts?.values() ?? []].flatMap((entry) => {
7130
+ if (entry.item.kind !== "linked-entry") return [];
7131
+ const entryId = unsafeAsLinkedContentEntryId(entry.item.id);
7132
+ return localIds.has(entryId) ? [] : [[entryId, { content: entry.item.values }]];
7133
+ });
7134
+ return new Map([...local, ...remoteOnly]);
7186
7135
  }
7187
- //#endregion
7188
- //#region ../preview-next/src/client/preview/usePreviewKeepAlive.ts
7189
- const DEFAULT_INTERVAL_MS = 600 * 1e3;
7190
- function withJitter(baseMs) {
7191
- const jitter = .1 * baseMs;
7192
- const delta = (Math.random() * 2 - 1) * jitter;
7193
- return Math.max(15e3, Math.round(baseMs + delta));
7194
- }
7195
- function usePreviewKeepAlive({ enabled, fetcher, onExpired, intervalMs = DEFAULT_INTERVAL_MS }) {
7196
- useEffect(() => {
7197
- if (!enabled) return void 0;
7198
- let isActive = true;
7199
- async function keepAlive() {
7200
- try {
7201
- const response = await fetcher("/api/preview/keep-alive", { method: "POST" }, "keep-alive");
7202
- if (response.status === 401 && isActive) {
7203
- onExpired("keep-alive");
7204
- return;
7205
- }
7206
- if (!response.ok && isActive) console.warn("Preview keep-alive failed", await response.text());
7207
- } catch (error) {
7208
- if (isActive) console.warn("Preview keep-alive error", error);
7209
- }
7210
- }
7211
- keepAlive();
7212
- const id = window.setInterval(keepAlive, withJitter(intervalMs));
7213
- return () => {
7214
- isActive = false;
7215
- window.clearInterval(id);
7216
- };
7217
- }, [
7218
- enabled,
7219
- fetcher,
7220
- intervalMs,
7221
- onExpired
7222
- ]);
7136
+ function applyLinkedEntryRenderOverlay(value, overlays) {
7137
+ if (overlays.size === 0) return value;
7138
+ return overlayValue(value, overlays);
7223
7139
  }
7224
- //#endregion
7225
- //#region ../preview-next/src/client/preview/PreviewKeepAliveClient.tsx
7226
- function PreviewKeepAliveClient({ baseFetch }) {
7140
+ function applyLinkedEntryRenderOverlayToDataContext(dataContext, overlays) {
7141
+ if (!dataContext?.resolvedData || overlays.size === 0) return dataContext;
7142
+ const resolvedData = applyLinkedEntryRenderOverlay(dataContext.resolvedData, overlays);
7143
+ if (resolvedData === dataContext.resolvedData) return dataContext;
7144
+ return {
7145
+ ...dataContext,
7146
+ resolvedData
7147
+ };
7148
+ }
7149
+ function overlayValue(value, overlays) {
7150
+ if (Array.isArray(value)) {
7151
+ let changed = false;
7152
+ const next = value.map((item) => {
7153
+ const overlaid = overlayValue(item, overlays);
7154
+ if (overlaid !== item) changed = true;
7155
+ return overlaid;
7156
+ });
7157
+ return changed ? next : value;
7158
+ }
7159
+ if (!isRecord$4(value)) return value;
7160
+ const match = matchingOverlay(value, overlays);
7161
+ if (match) return overlaidEntry(value, match.meta, match.overlay);
7162
+ let changed = false;
7163
+ const next = {};
7164
+ for (const [key, child] of Object.entries(value)) {
7165
+ const overlaid = overlayValue(child, overlays);
7166
+ if (overlaid !== child) changed = true;
7167
+ next[key] = overlaid;
7168
+ }
7169
+ return changed ? next : value;
7170
+ }
7171
+ /**
7172
+ * The overlay for a rendered linked entry, if one applies. A handover stops at an
7173
+ * occurrence already rendered at the saved revision (issue 1553, DP6).
7174
+ */
7175
+ function matchingOverlay(value, overlays) {
7176
+ const meta = parseLinkedEntryMeta(value[LINKED_CONTENT_ENTRY_META_KEY]);
7177
+ const overlay = meta ? overlays.get(unsafeAsLinkedContentEntryId(meta.entryId)) : void 0;
7178
+ if (!meta || !overlay) return null;
7179
+ return overlay.handoverRevision !== void 0 && meta.optimisticHash === overlay.handoverRevision ? null : {
7180
+ meta,
7181
+ overlay
7182
+ };
7183
+ }
7184
+ function overlaidEntry(value, meta, overlay) {
7185
+ const displayProjections = resolveOverlayDisplayProjections(overlay.content, meta);
7186
+ const titleProjection = resolveOverlayTitleProjection({
7187
+ currentValue: value,
7188
+ content: overlay.content,
7189
+ meta,
7190
+ displayProjections
7191
+ });
7192
+ const title = titleProjection ? { title: titleProjection } : {};
7193
+ return {
7194
+ ...value,
7195
+ ...displayProjections,
7196
+ ...title,
7197
+ content: overlay.content,
7198
+ optimisticHash: overlayRevision(overlay, meta),
7199
+ [LINKED_CONTENT_ENTRY_META_KEY]: {
7200
+ ...meta,
7201
+ ...title,
7202
+ optimisticHash: overlayRevision(overlay, meta)
7203
+ }
7204
+ };
7205
+ }
7206
+ /**
7207
+ * Each linked entry's rendered revisions, one per occurrence in the loader data, read
7208
+ * before any overlay. Local handover retention compares them with the saved revision
7209
+ * (issue 1553, DP7).
7210
+ */
7211
+ function renderedLinkedRevisions(dataContext) {
7212
+ const occurrences = linkedEntryOccurrences(dataContext?.resolvedData);
7213
+ const entryIds = [...new Set(occurrences.map((meta) => meta.entryId))];
7214
+ return new Map(entryIds.map((entryId) => [unsafeAsLinkedContentEntryId(entryId), occurrences.filter((meta) => meta.entryId === entryId).map((meta) => meta.optimisticHash)]));
7215
+ }
7216
+ function linkedEntryOccurrences(value) {
7217
+ if (Array.isArray(value)) return value.flatMap(linkedEntryOccurrences);
7218
+ if (!isRecord$4(value)) return [];
7219
+ const meta = parseLinkedEntryMeta(value[LINKED_CONTENT_ENTRY_META_KEY]);
7220
+ const nested = Object.entries(value).filter(([key]) => key !== LINKED_CONTENT_ENTRY_META_KEY).flatMap(([, child]) => linkedEntryOccurrences(child));
7221
+ return meta ? [meta, ...nested] : nested;
7222
+ }
7223
+ function resolveOverlayDisplayProjections(content, meta) {
7224
+ const projections = {};
7225
+ for (const source of meta.fieldSources) {
7226
+ if (source.kind !== "content-field") continue;
7227
+ if (source.displayPath.startsWith("content.")) continue;
7228
+ if (source.displayPath.includes(".")) continue;
7229
+ if (!(source.fieldPath in content)) continue;
7230
+ projections[source.displayPath] = content[source.fieldPath];
7231
+ }
7232
+ return projections;
7233
+ }
7234
+ function resolveOverlayTitleProjection(input) {
7235
+ const projectedTitle = input.displayProjections.title;
7236
+ if (typeof projectedTitle === "string") return projectedTitle;
7237
+ if (input.meta.fieldSources.find((source) => source.displayPath === "title")?.kind === "read-only") {
7238
+ const currentTitle = input.currentValue.title;
7239
+ return typeof currentTitle === "string" ? currentTitle : input.meta.title;
7240
+ }
7241
+ return resolveOverlayTitle(input.content, input.meta);
7242
+ }
7243
+ function resolveOverlayTitle(content, meta) {
7244
+ const titleField = meta.contentType.titleField;
7245
+ if (titleField) {
7246
+ const value = content[titleField];
7247
+ if (typeof value === "string" && value.trim().length > 0) return value;
7248
+ }
7249
+ return meta.title;
7250
+ }
7251
+ function parseLinkedEntryMeta(value) {
7252
+ return getLinkedContentEntryMeta({ [LINKED_CONTENT_ENTRY_META_KEY]: value });
7253
+ }
7254
+ function isRecord$4(value) {
7255
+ return typeof value === "object" && value !== null && !Array.isArray(value);
7256
+ }
7257
+ function overlayRevision(overlay, meta) {
7258
+ return overlay.optimisticHash === void 0 ? meta.optimisticHash : overlay.optimisticHash;
7259
+ }
7260
+ //#endregion
7261
+ //#region ../preview-next/src/client/blocks/renderPrecedence.ts
7262
+ /** A block's content as the preview renders it, from the tab's render source. */
7263
+ function renderedBlockContent(uiStore, blockId) {
7264
+ const state = uiStore.getState();
7265
+ return resolveRenderedValues(renderSourceFor(state.editability), state.drafts.getBlockSnapshot(blockId), remoteDraftValues(state.remoteDrafts, {
7266
+ kind: "block",
7267
+ id: blockId
7268
+ }));
7269
+ }
7270
+ /**
7271
+ * An entry template page renders the entry's own fields from `contentEntry`. The
7272
+ * server sent them as they were on load; the editor's rendered values (local
7273
+ * edits, then another tab's live draft) take over from there.
7274
+ */
7275
+ function withRenderedContentEntry(dataContext, content) {
7276
+ if (!dataContext?.contentEntry || !content) return dataContext;
7277
+ return {
7278
+ ...dataContext,
7279
+ contentEntry: {
7280
+ ...dataContext.contentEntry,
7281
+ ...content
7282
+ }
7283
+ };
7284
+ }
7285
+ /** Loader data fetched in the browser replaces the server's, block by block. */
7286
+ function mergeResolvedDataContext(dataContext, liveResolvedData) {
7287
+ if (!dataContext || !liveResolvedData) return dataContext;
7288
+ return {
7289
+ ...dataContext,
7290
+ resolvedData: {
7291
+ ...dataContext.resolvedData ?? {},
7292
+ ...liveResolvedData
7293
+ }
7294
+ };
7295
+ }
7296
+ //#endregion
7297
+ //#region ../preview-next/src/client/blocks/useLinkedSaveHandoverRetention.ts
7298
+ /**
7299
+ * The host's refresh of its server data: the same callback live drafts give a viewer
7300
+ * whose saved remote draft lags. Absent when the host supplies none.
7301
+ */
7302
+ const PreviewRefreshBaselinesContext = createContext(null);
7303
+ /** Changes whenever a handover is recorded or dropped, so the renderer re-renders. */
7304
+ function linkedSaveHandoversVersion(handovers) {
7305
+ return [...handovers].map(([entryId, handover]) => `${entryId}@${handover.revision}`).join("|");
7306
+ }
7307
+ /**
7308
+ * Local retention of this tab's linked-entry save handovers (issue 1553, DP7). The
7309
+ * renderer holds the rendered data, so it decides catch-up: a handover whose entry is
7310
+ * rendered at the saved revision everywhere drops with no refresh (row H1b); otherwise
7311
+ * the shared timing asks the host for one refresh, then drops it (row H2).
7312
+ */
7313
+ function useLinkedSaveHandoverRetention(uiStore, dataContext, liveResolvedData) {
7314
+ const rendered = useMemo(() => renderedLinkedRevisions(mergeResolvedDataContext(dataContext, liveResolvedData)), [dataContext, liveResolvedData]);
7315
+ const refreshBaselines = useContext(PreviewRefreshBaselinesContext);
7316
+ const refreshRef = useRef(refreshBaselines);
7317
+ useEffect(() => {
7318
+ refreshRef.current = refreshBaselines;
7319
+ });
7320
+ useRetentionTicks(uiStore, useCallback(() => {
7321
+ const state = uiStore.getState();
7322
+ if (state.linkedSaveHandovers.size === 0) return;
7323
+ const plan = planLinkedSaveHandoverRetention(state.linkedSaveHandovers, rendered, Date.now());
7324
+ if (!plan.changed) return;
7325
+ state.setLinkedSaveHandovers(plan.entries);
7326
+ if (plan.refresh) refreshRef.current?.();
7327
+ }, [rendered, uiStore]));
7328
+ }
7329
+ //#endregion
7330
+ //#region ../preview-next/src/client/preview/PreviewEntryControllerProvider.tsx
7331
+ function toEditorInitialBlock(block, index) {
7332
+ return {
7333
+ ...block,
7334
+ orderIndex: typeof block.orderIndex === "number" ? block.orderIndex : index
7335
+ };
7336
+ }
7337
+ function previewLiveDraftsConfig(liveDrafts, previewToken, siteId, scope) {
7338
+ if (!liveDrafts || !previewToken) return null;
7339
+ return {
7340
+ client: liveDrafts.client,
7341
+ auth: {
7342
+ kind: "token",
7343
+ accessToken: previewToken
7344
+ },
7345
+ siteId,
7346
+ scope,
7347
+ refreshBaselines: liveDrafts.refreshBaselines
7348
+ };
7349
+ }
7350
+ function previewEntryRoute(entryData) {
7351
+ return {
7352
+ draftMetaTitle: entryData.draftMetaTitle ?? null,
7353
+ draftMetaDescription: entryData.draftMetaDescription ?? null,
7354
+ publishedMetaTitle: entryData.metaTitle ?? null,
7355
+ publishedMetaDescription: entryData.metaDescription ?? null,
7356
+ ogImageId: entryData.ogImageId ?? null
7357
+ };
7358
+ }
7359
+ function snapshotFromPreviewEntry(entryData) {
7360
+ const title = entryData.title ?? "";
7361
+ const status = entryData.status ?? "draft";
7362
+ const publishAt = entryData.publishAt ?? null;
7363
+ return {
7364
+ kind: "routable",
7365
+ id: entryData.id,
7366
+ draft: {
7367
+ title,
7368
+ slug: entryData.slug || "",
7369
+ status,
7370
+ publishAt,
7371
+ path: entryData.draftPath ?? entryData.path ?? ""
7372
+ },
7373
+ published: {
7374
+ title,
7375
+ path: entryData.path ?? "",
7376
+ status,
7377
+ publishAt
7378
+ },
7379
+ status,
7380
+ route: previewEntryRoute(entryData)
7381
+ };
7382
+ }
7383
+ function snapshotFromPreviewPage(pageId, metadata, schema) {
7384
+ return createSnapshotFromPageRecord({
7385
+ id: pageId,
7386
+ draftTitle: metadata.draftTitle,
7387
+ draftPath: metadata.draftPath,
7388
+ draftStatus: metadata.draftStatus,
7389
+ title: metadata.title,
7390
+ path: metadata.path,
7391
+ status: metadata.status,
7392
+ publishedAt: metadata.publishedAt,
7393
+ draftMetaTitle: metadata.draftMetaTitle,
7394
+ draftMetaDescription: metadata.draftMetaDescription,
7395
+ publishedMetaTitle: metadata.publishedMetaTitle,
7396
+ publishedMetaDescription: metadata.publishedMetaDescription,
7397
+ ogImageId: metadata.ogImageId
7398
+ }, createRoutingHelpers(schema, { slug: null }), {
7399
+ title: "",
7400
+ slug: null
7401
+ });
7402
+ }
7403
+ function initialPreviewEntry(entryData, pageMetadata, pageId, schema) {
7404
+ if (entryData) return snapshotFromPreviewEntry(entryData);
7405
+ return pageMetadata && pageId ? snapshotFromPreviewPage(pageId, pageMetadata, schema) : void 0;
7406
+ }
7407
+ function previewEntity(pageId, pageNodeType, entryData, routeId) {
7408
+ return {
7409
+ id: pageId || entryData?.id || "",
7410
+ type: entryData?.type || "page",
7411
+ label: entryData && pageNodeType !== "page_surface" ? "Entry" : "Page",
7412
+ routeId: routeId ?? void 0
7413
+ };
7414
+ }
7415
+ function previewValues(entryData, pageMetadata) {
7416
+ if (!entryData) return {
7417
+ kind: "page",
7418
+ metadataRevision: pageMetadata?.draftUpdatedAt ?? null
7419
+ };
7420
+ const revision = entryData.editorRevision;
7421
+ if (!revision?.content) throw new Error("Preview draft is missing its editor revision");
7422
+ return {
7423
+ kind: "content",
7424
+ content: revision.contentValues,
7425
+ publishedContent: revision.publishedContent,
7426
+ contentRevision: revision.content,
7427
+ metadataRevision: revision.metadata
7428
+ };
7429
+ }
7430
+ function PreviewEntryControllerProvider({ children, siteId, pageId, pageNodeType = "page", routeId: providedRouteId, entryData, contentTypeSchema, initialStatus = "draft", initialBlocks, blockFieldExtensions, pageMetadata, apiClient, subscribeToLeaseChanges, onLeaseGranted, liveDrafts }) {
7431
+ const { isEditingMode, requestedEditingMode } = useEditor();
7432
+ const previewToken = usePreviewToken();
7433
+ const schema = contentTypeSchema ?? PAGE_CONTENT_TYPE_SCHEMA;
7434
+ const initialEntry = useMemo(() => initialPreviewEntry(entryData, pageMetadata, pageId, schema), [
7435
+ entryData,
7436
+ pageMetadata,
7437
+ pageId,
7438
+ schema
7439
+ ]);
7440
+ const normalizedInitialBlocks = useMemo(() => (initialBlocks ?? []).map(toEditorInitialBlock), [initialBlocks]);
7441
+ const entity = previewEntity(pageId, pageNodeType, entryData, providedRouteId);
7442
+ const leaseScope = requiredPreviewLeaseScope({
7443
+ nodeType: previewLeaseNodeType(pageNodeType, entryData),
7444
+ nodeId: entity.id
7445
+ });
7446
+ const values = previewValues(entryData, pageMetadata);
7447
+ const rendered = /* @__PURE__ */ jsx(RefreshBaselinesForRender, {
7448
+ liveDrafts,
7449
+ children
7450
+ });
7451
+ const editLease = usePreviewLeaseParticipation({
7452
+ requestedEditingMode,
7453
+ siteId,
7454
+ pageId,
7455
+ pageNodeType,
7456
+ leaseScope,
7457
+ subscribeToLeaseChanges,
7458
+ onLeaseGranted
7459
+ });
7460
+ const common = {
7461
+ apiClientFactory: useMemo(() => createEditorApiClientFactory(apiClient), [apiClient]),
7462
+ editLease,
7463
+ type: entity.type,
7464
+ siteId,
7465
+ owner: {
7466
+ kind: "contentEntry",
7467
+ contentEntryId: entity.id
7468
+ },
7469
+ routeId: entity.routeId,
7470
+ schema,
7471
+ entityLabel: entity.label,
7472
+ initialEntry,
7473
+ initialMetadataRevision: values.metadataRevision,
7474
+ initialBlocks: pageNodeType === "page_surface" ? void 0 : normalizedInitialBlocks,
7475
+ blockFieldExtensions,
7476
+ historyShortcutsEnabled: isEditingMode,
7477
+ liveDrafts: previewLiveDraftsConfig(liveDrafts, previewToken, siteId, leaseScope)
7478
+ };
7479
+ if (pageNodeType === "page_surface" && pageId && pageMetadata) {
7480
+ if (values.kind !== "content") throw new Error("Preview draft is missing its editor revision");
7481
+ return /* @__PURE__ */ jsx(PreviewPageSurfaceController, {
7482
+ common,
7483
+ pageSurfaceId: pageId,
7484
+ pageMetadata,
7485
+ values,
7486
+ children: rendered
7487
+ });
7488
+ }
7489
+ return values.kind === "content" ? /* @__PURE__ */ jsx(EntryControllerProvider, {
7490
+ ...common,
7491
+ kind: "content",
7492
+ initialContent: values.content,
7493
+ initialPublishedContent: values.publishedContent,
7494
+ initialContentRevision: values.contentRevision,
7495
+ children: rendered
7496
+ }) : /* @__PURE__ */ jsx(EntryControllerProvider, {
7497
+ ...common,
7498
+ kind: "page",
7499
+ initialStatus,
7500
+ children: rendered
7501
+ });
7502
+ }
7503
+ /** Lease participation and its server-read invalidation share the same preview identity. */
7504
+ function usePreviewLeaseParticipation({ requestedEditingMode, siteId, pageId, pageNodeType, leaseScope, subscribeToLeaseChanges, onLeaseGranted }) {
7505
+ const queryClient = useQueryClient();
7506
+ return requestedEditingMode ? {
7507
+ siteId,
7508
+ scope: leaseScope,
7509
+ subscribeToLeaseChanges,
7510
+ onGranted: () => {
7511
+ onLeaseGranted?.();
7512
+ if (pageId) queryClient.invalidateQueries({ queryKey: previewBlocksQueryKey(siteId, pageId, pageNodeType) });
7513
+ }
7514
+ } : VIEWING_PARTICIPATION;
7515
+ }
7516
+ function RefreshBaselinesForRender({ liveDrafts, children }) {
7517
+ return /* @__PURE__ */ jsx(PreviewRefreshBaselinesContext.Provider, {
7518
+ value: liveDrafts?.refreshBaselines ?? null,
7519
+ children
7520
+ });
7521
+ }
7522
+ /**
7523
+ * An event's page in preview: its content is the page surface's, saved and
7524
+ * published through the page-surface services. Its published content is what
7525
+ * the draft is compared with, and a page with none has never been published,
7526
+ * so it has no Discard.
7527
+ */
7528
+ function PreviewPageSurfaceController({ common, pageSurfaceId, pageMetadata, values, children }) {
7529
+ const route = {
7530
+ draftTitle: pageMetadata.draftTitle,
7531
+ draftPath: pageMetadata.draftPath
7532
+ };
7533
+ const siteId = common.siteId;
7534
+ return /* @__PURE__ */ jsx(EntryControllerProvider, {
7535
+ ...common,
7536
+ kind: "content",
7537
+ owner: {
7538
+ kind: "pageSurface",
7539
+ pageSurfaceId
7540
+ },
7541
+ services: (client) => createPageSurfaceEditorServices({
7542
+ siteId,
7543
+ pageSurfaceId,
7544
+ route
7545
+ }, { apiClient: client }),
7546
+ initialContent: values.content,
7547
+ initialContentRevision: values.contentRevision,
7548
+ initialPublishedContent: values.publishedContent,
7549
+ children
7550
+ });
7551
+ }
7552
+ function previewLeaseNodeType(pageNodeType, entryData) {
7553
+ if (pageNodeType === "page_surface") return "page_surface";
7554
+ return entryData ? "content_entry" : "page";
7555
+ }
7556
+ /** The blocks a lease grant re-reads, so they reflect the latest server state. */
7557
+ function previewBlocksQueryKey(siteId, pageId, pageNodeType) {
7558
+ return pageNodeType === "page_surface" ? blocksKeys.surfaceSlots(siteId, pageId) : blocksKeys.list(siteId, pageId);
7559
+ }
7560
+ function requiredPreviewLeaseScope(input) {
7561
+ const scope = parseEditLeaseScope(input);
7562
+ if (!scope) throw new Error("Invalid preview editor lease scope");
7563
+ return scope;
7564
+ }
7565
+ //#endregion
7566
+ //#region ../preview-next/src/client/preview/usePreviewKeepAlive.ts
7567
+ function withJitter(baseMs) {
7568
+ const jitter = PREVIEW_KEEP_ALIVE_JITTER_RATIO * baseMs;
7569
+ const delta = (Math.random() * 2 - 1) * jitter;
7570
+ return Math.max(15e3, Math.round(baseMs + delta));
7571
+ }
7572
+ async function readCurrentAccessToken(response) {
7573
+ const payload = await response.json();
7574
+ if (typeof payload !== "object" || payload === null || !("accessToken" in payload) || typeof payload.accessToken !== "string" || !payload.accessToken) throw new Error("Preview keep-alive returned no access token");
7575
+ return payload.accessToken;
7576
+ }
7577
+ function usePreviewKeepAlive({ enabled, fetcher, onExpired, intervalMs = PREVIEW_KEEP_ALIVE_INTERVAL_MS }) {
7578
+ useEffect(() => {
7579
+ if (!enabled) return void 0;
7580
+ const requestState = {
7581
+ active: true,
7582
+ pending: false
7583
+ };
7584
+ async function keepAlive() {
7585
+ if (requestState.pending) return;
7586
+ requestState.pending = true;
7587
+ try {
7588
+ const response = await fetcher("/api/preview/keep-alive", { method: "POST" }, "keep-alive");
7589
+ if (response.status === 401 && requestState.active) {
7590
+ onExpired("keep-alive");
7591
+ return;
7592
+ }
7593
+ if (!response.ok && requestState.active) {
7594
+ console.warn("Preview keep-alive failed", await response.text());
7595
+ return;
7596
+ }
7597
+ const currentToken = await readCurrentAccessToken(response);
7598
+ if (requestState.active) setPreviewAccessToken(currentToken);
7599
+ } catch (error) {
7600
+ if (requestState.active) console.warn("Preview keep-alive error", error);
7601
+ } finally {
7602
+ requestState.pending = false;
7603
+ }
7604
+ }
7605
+ function checkWhenVisible() {
7606
+ if (document.visibilityState === "visible") keepAlive();
7607
+ }
7608
+ keepAlive();
7609
+ const id = window.setInterval(keepAlive, withJitter(intervalMs));
7610
+ document.addEventListener("visibilitychange", checkWhenVisible);
7611
+ return () => {
7612
+ requestState.active = false;
7613
+ window.clearInterval(id);
7614
+ document.removeEventListener("visibilitychange", checkWhenVisible);
7615
+ };
7616
+ }, [
7617
+ enabled,
7618
+ fetcher,
7619
+ intervalMs,
7620
+ onExpired
7621
+ ]);
7622
+ }
7623
+ //#endregion
7624
+ //#region ../preview-next/src/client/preview/PreviewKeepAliveClient.tsx
7625
+ function PreviewKeepAliveClient({ baseFetch }) {
7227
7626
  const { canEdit } = usePreviewAuth();
7228
- const guardedFetch = usePreviewAuthFetch(baseFetch ?? fetch);
7229
- const { setEditingMode } = useEditor();
7230
7627
  usePreviewKeepAlive({
7231
7628
  enabled: canEdit,
7232
- fetcher: guardedFetch,
7629
+ fetcher: usePreviewAuthFetch(baseFetch ?? fetch),
7233
7630
  onExpired: useCallback((source) => {
7234
7631
  markPreviewAuthExpired(source);
7235
- setEditingMode(false);
7236
- }, [setEditingMode])
7632
+ }, [])
7237
7633
  });
7238
7634
  return null;
7239
7635
  }
7240
7636
  //#endregion
7637
+ //#region ../preview-next/src/client/preview/PreviewLeaseEditingMode.tsx
7638
+ /** Derives preview editing permission from the live auth and lease authorities. */
7639
+ function PreviewLeaseEditingMode() {
7640
+ const { canEdit } = usePreviewAuth();
7641
+ const editable = useEditorUiStore((state) => canEditorWrite(state.editability));
7642
+ const { setEditingAllowed } = useEditor();
7643
+ useEffect(() => setEditingAllowed(canEdit && editable), [
7644
+ canEdit,
7645
+ editable,
7646
+ setEditingAllowed
7647
+ ]);
7648
+ return null;
7649
+ }
7650
+ //#endregion
7241
7651
  //#region ../preview-next/src/client/preview/previewSetupGuidance.ts
7242
7652
  function resolvePreviewSetupBannerState(input) {
7243
7653
  if (input.authMode === "onboardingGrant") return input.dashboardUnlocked ? "dashboard_ready" : "awaiting_confirmation";
@@ -7500,25 +7910,25 @@ const INITIAL_ONBOARDING_CONFIRMATION_STATE = {
7500
7910
  resendFeedback: null,
7501
7911
  statusLoadFailed: false
7502
7912
  };
7503
- function isRecord$4(value) {
7913
+ function isRecord$3(value) {
7504
7914
  return value !== null && typeof value === "object";
7505
7915
  }
7506
7916
  function getErrorMessageFromEnvelope(payload, fallback) {
7507
- const error = isRecord$4(payload) ? payload.error : null;
7508
- const message = isRecord$4(error) ? error.message : null;
7917
+ const error = isRecord$3(payload) ? payload.error : null;
7918
+ const message = isRecord$3(error) ? error.message : null;
7509
7919
  return typeof message === "string" && message.trim().length > 0 ? message : fallback;
7510
7920
  }
7511
7921
  function isLaunchReadiness(value) {
7512
- return isRecord$4(value) && Array.isArray(value.requirements) && typeof value.pendingRequiredCount === "number" && typeof value.pendingRecommendedCount === "number" && typeof value.pendingOptionalCount === "number" && isRecord$4(value.goLiveDecision) && (value.goLiveDecision.kind === "allowed" || value.goLiveDecision.kind === "blocked");
7922
+ return isRecord$3(value) && Array.isArray(value.requirements) && typeof value.pendingRequiredCount === "number" && typeof value.pendingRecommendedCount === "number" && typeof value.pendingOptionalCount === "number" && isRecord$3(value.goLiveDecision) && (value.goLiveDecision.kind === "allowed" || value.goLiveDecision.kind === "blocked");
7513
7923
  }
7514
7924
  function isOnboardingPreviewStatusResponse(value) {
7515
- return isRecord$4(value) && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
7925
+ return isRecord$3(value) && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
7516
7926
  }
7517
7927
  function isResendOnboardingPreviewConfirmationResponse(value) {
7518
- return isRecord$4(value) && (value.result === "resent" || value.result === "already_confirmed") && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
7928
+ return isRecord$3(value) && (value.result === "resent" || value.result === "already_confirmed") && typeof value.dashboardUnlocked === "boolean" && typeof value.requiresEmailConfirmation === "boolean" && isLaunchReadiness(value.launchReadiness);
7519
7929
  }
7520
7930
  function getSuccessData(payload, isData) {
7521
- if (!isRecord$4(payload) || payload.success !== true || !isData(payload.data)) return null;
7931
+ if (!isRecord$3(payload) || payload.success !== true || !isData(payload.data)) return null;
7522
7932
  return payload.data;
7523
7933
  }
7524
7934
  function useOnboardingConfirmationCheck(input) {
@@ -7887,6 +8297,36 @@ function PreviewAuthBanner({ dashboardBaseUrl = null, surfaceId }) {
7887
8297
  })] });
7888
8298
  }
7889
8299
  //#endregion
8300
+ //#region ../preview-next/src/client/preview/PreviewAccessBanners.tsx
8301
+ function previewLeaseThing(isEntry, pageNodeType) {
8302
+ if (pageNodeType === "page_surface") return "this event page";
8303
+ return isEntry ? "this entry" : "this page";
8304
+ }
8305
+ function PreviewAccessBanners({ dashboardBaseUrl, surfaceId, isEntry, pageNodeType }) {
8306
+ const { state } = usePreviewAuth();
8307
+ const { requestedEditingMode, setEditingMode } = useEditor();
8308
+ const showDiscardedNotice = useEditorUiStore((editor) => canEditorWrite(editor.editability) && editor.leaseDiscardedChanges);
8309
+ const thing = previewLeaseThing(isEntry, pageNodeType);
8310
+ const active = state !== "expired";
8311
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
8312
+ /* @__PURE__ */ jsx(PreviewAuthBanner, {
8313
+ dashboardBaseUrl,
8314
+ surfaceId
8315
+ }),
8316
+ active && requestedEditingMode ? /* @__PURE__ */ jsx(EditLeaseModal, {
8317
+ thing,
8318
+ onKeepViewing: () => setEditingMode(false)
8319
+ }) : null,
8320
+ active && showDiscardedNotice ? /* @__PURE__ */ jsx(FixedBottomSurface, {
8321
+ variant: "light",
8322
+ width: "centered",
8323
+ offsetCssVar: "--builder-editor-chrome-offset",
8324
+ reserveOffsetCssVar: "--builder-preview-banner-offset",
8325
+ children: /* @__PURE__ */ jsx(EditLeaseDiscardedNotice, { thing })
8326
+ }) : null
8327
+ ] });
8328
+ }
8329
+ //#endregion
7890
8330
  //#region ../preview-next/src/client/preview/sidebarTabPreference.ts
7891
8331
  const STORAGE_KEY = "preview-sidebar-tab";
7892
8332
  function getPreviewSidebarTab() {
@@ -9402,10 +9842,10 @@ function resolveShellThemeRoles(props) {
9402
9842
  }
9403
9843
  const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
9404
9844
  const PreviewEditorSidebar = React.lazy(async () => {
9405
- return { default: (await import("./PreviewEditorSidebar-DtpB3_sS.mjs")).PreviewEditorSidebar };
9845
+ return { default: (await import("./PreviewEditorSidebar-DBKln68M.mjs")).PreviewEditorSidebar };
9406
9846
  });
9407
9847
  const PreviewEditorUI = React.lazy(async () => {
9408
- return { default: (await import("./PreviewEditorUI-DxTLgaHo.mjs")).PreviewEditorUI };
9848
+ return { default: (await import("./PreviewEditorUI-DpRX4Mum.mjs")).PreviewEditorUI };
9409
9849
  });
9410
9850
  const previewPaneContainmentStyle = {
9411
9851
  contain: "layout paint",
@@ -9639,6 +10079,7 @@ function PreviewShellLayout(props) {
9639
10079
  siteId,
9640
10080
  dashboardBaseUrl,
9641
10081
  pageId,
10082
+ pageNodeType: props.pageNodeType,
9642
10083
  entryData,
9643
10084
  contentTypeSchema,
9644
10085
  referenceContentTypeKeys,
@@ -9695,15 +10136,17 @@ function PreviewShellLayout(props) {
9695
10136
  apiClient
9696
10137
  })
9697
10138
  }),
9698
- /* @__PURE__ */ jsx(PreviewAuthBanner, {
10139
+ /* @__PURE__ */ jsx(PreviewAccessBanners, {
9699
10140
  dashboardBaseUrl,
9700
- surfaceId
10141
+ surfaceId,
10142
+ isEntry: Boolean(entryData),
10143
+ pageNodeType: props.pageNodeType
9701
10144
  }),
9702
10145
  /* @__PURE__ */ jsx("div", {
9703
10146
  className: "fixed inset-0 overflow-hidden bg-background",
9704
10147
  children: isOpen ? /* @__PURE__ */ jsx(ResizableSplitPane, {
9705
10148
  left: leftPane,
9706
- right: rightPane,
10149
+ right: /* @__PURE__ */ jsx(EditorWriteSurface, { children: rightPane }),
9707
10150
  defaultSplit: 100 - sidebarWidth,
9708
10151
  minLeftWidth: 400,
9709
10152
  minRightWidth: 320,
@@ -9730,13 +10173,14 @@ function resolveShellLayoutProps(input) {
9730
10173
  siteId: props.siteId,
9731
10174
  dashboardBaseUrl: props.dashboardBaseUrl ?? null,
9732
10175
  pageId: props.pageId,
10176
+ pageNodeType: props.pageNodeType,
9733
10177
  entryData: props.entryData ?? null,
9734
10178
  contentTypeSchema: props.contentTypeSchema,
9735
10179
  referenceContentTypeKeys: props.referenceContentTypeKeys ?? [],
9736
10180
  draftContent: props.draftContent,
9737
10181
  currentTemplate: props.currentTemplate,
9738
10182
  apiClient: input.apiClient,
9739
- bearerToken: props.previewToken,
10183
+ bearerToken: input.bearerToken,
9740
10184
  themeId: props.themeId ?? null,
9741
10185
  themeSelectionId: props.themeSelectionId ?? null,
9742
10186
  themeSelectionVersion: props.themeSelectionVersion ?? null,
@@ -9778,9 +10222,52 @@ function wrapPreviewSiteFontStorage(children, siteFontStorageUrl) {
9778
10222
  children
9779
10223
  });
9780
10224
  }
10225
+ function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
10226
+ const { apiClient } = useEntryEditorController();
10227
+ const bearerToken = usePreviewToken();
10228
+ return /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
10229
+ apiClient,
10230
+ siteId: props.siteId,
10231
+ pageId: props.pageId,
10232
+ enabled: designEditorEnabled,
10233
+ children: /* @__PURE__ */ jsxs(MediaEditorProvider, {
10234
+ siteId: props.siteId,
10235
+ apiClient,
10236
+ bearerToken,
10237
+ supabaseUrl: props.supabaseUrl,
10238
+ mediaAssets: props.mediaAssets,
10239
+ children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch: props.baseFetch }), wrapPreviewSiteFontStorage(renderShellLayout({
10240
+ props,
10241
+ apiClient,
10242
+ siteStyleAccess,
10243
+ bearerToken
10244
+ }), props.siteFontStorageUrl)]
10245
+ })
10246
+ }) });
10247
+ }
10248
+ function PreviewBlockApiProvider({ config, children }) {
10249
+ const token = usePreviewToken();
10250
+ return /* @__PURE__ */ jsx(BlockApiProvider, {
10251
+ config: useMemo(() => {
10252
+ if (!config || !token) return config;
10253
+ return {
10254
+ ...config,
10255
+ auth: config.auth.type === "bearer" ? {
10256
+ ...config.auth,
10257
+ token
10258
+ } : config.auth,
10259
+ readAuthority: config.readAuthority?.kind === "preview" ? {
10260
+ ...config.readAuthority,
10261
+ token
10262
+ } : config.readAuthority
10263
+ };
10264
+ }, [config, token]),
10265
+ children
10266
+ });
10267
+ }
9781
10268
  function PreviewShell(props) {
9782
- const { children, apiBaseUrl, blockApiConfig, siteId, siteSlug, editableId, previewSession, previewToken, dashboardBaseUrl = null, surfaceId, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, pageId, routeId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, initialStatus, initialBlocks, pageMetadata, isSiteLaunched, maintenanceModeEnabled, entrySubrouteContext, assistantPanel, sdkConfig, mediaAssets, bookingOfferingPresets, supabaseUrl, designEditorEligibility, hideSiteStyleConfigurator = false, baseFetch, onFooterSaved } = props;
9783
- const apiClient = useMemo(() => createBearerAPIClient(previewToken, apiBaseUrl), [previewToken, apiBaseUrl]);
10269
+ const { apiBaseUrl, blockApiConfig, siteId, siteSlug, editableId, previewSession, previewToken, pageId, routeId, entryData, contentTypeSchema, initialStatus, initialBlocks, pageMetadata, designEditorEligibility, hideSiteStyleConfigurator = false } = props;
10270
+ const apiClient = useMemo(() => createGuardedPreviewApiClient(apiBaseUrl), [apiBaseUrl]);
9784
10271
  const { designEditorEnabled, siteStyleAccess } = resolveShellAccess({
9785
10272
  previewSession,
9786
10273
  designEditorEligibility,
@@ -9788,50 +10275,41 @@ function PreviewShell(props) {
9788
10275
  entryData,
9789
10276
  hideSiteStyleConfigurator
9790
10277
  });
9791
- const shellLayout = renderShellLayout({
9792
- props,
9793
- apiClient,
9794
- siteStyleAccess
9795
- });
9796
- return /* @__PURE__ */ jsx(BlockApiProvider, {
9797
- config: blockApiConfig,
9798
- children: /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
9799
- session: previewSession,
9800
- token: previewToken,
9801
- siteId,
9802
- siteSlug,
9803
- pageId: editableId,
10278
+ return /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
10279
+ session: previewSession,
10280
+ token: previewToken,
10281
+ siteId,
10282
+ siteSlug,
10283
+ pageId: editableId,
10284
+ children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
10285
+ config: blockApiConfig,
9804
10286
  children: /* @__PURE__ */ jsx(EditorProvider, {
9805
- initialEditingMode: true,
9806
- children: /* @__PURE__ */ jsx(PreviewEntryControllerProvider, {
10287
+ initialEditingMode: false,
10288
+ initialEditingAllowed: false,
10289
+ children: /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
10290
+ blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
9807
10291
  siteId,
9808
10292
  pageId,
10293
+ pageNodeType: props.pageNodeType,
9809
10294
  routeId,
9810
10295
  entryData,
9811
10296
  contentTypeSchema,
9812
- draftContent,
9813
10297
  initialStatus,
9814
10298
  initialBlocks,
9815
10299
  pageMetadata,
9816
10300
  apiClient,
9817
- children: /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
9818
- apiClient,
9819
- siteId,
9820
- pageId,
9821
- enabled: designEditorEnabled,
9822
- children: /* @__PURE__ */ jsxs(MediaEditorProvider, {
9823
- siteId,
9824
- apiClient,
9825
- bearerToken: previewToken,
9826
- supabaseUrl,
9827
- mediaAssets,
9828
- children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch }), wrapPreviewSiteFontStorage(shellLayout, props.siteFontStorageUrl)]
9829
- })
9830
- }) })
10301
+ subscribeToLeaseChanges: props.subscribeToLeaseChanges,
10302
+ onLeaseGranted: props.onLeaseGranted,
10303
+ liveDrafts: props.liveDrafts ?? void 0,
10304
+ children: [/* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}), /* @__PURE__ */ jsx(PreviewEditorBody, {
10305
+ props,
10306
+ designEditorEnabled,
10307
+ siteStyleAccess
10308
+ })]
9831
10309
  })
9832
10310
  })
9833
- }) })
9834
- });
10311
+ })
10312
+ }) });
9835
10313
  }
9836
10314
  function defaultDesignEditorEligibility(input) {
9837
10315
  if (input.entryData) return { kind: "content-entry" };
@@ -9852,11 +10330,11 @@ function resolveShellAccess(input) {
9852
10330
  //#region ../preview-next/src/client/utils/path.ts
9853
10331
  const PATH_SEPARATOR_REGEX = /\./g;
9854
10332
  const BRACKET_ACCESS_REGEX = /\[([^\]]+)\]/g;
9855
- function isRecord$3(value) {
10333
+ function isRecord$2(value) {
9856
10334
  return typeof value === "object" && value !== null && !Array.isArray(value);
9857
10335
  }
9858
10336
  function isPathContainer(value) {
9859
- return Array.isArray(value) || isRecord$3(value);
10337
+ return Array.isArray(value) || isRecord$2(value);
9860
10338
  }
9861
10339
  function createPathContainer(nextIsIndex) {
9862
10340
  return nextIsIndex ? [] : {};
@@ -10028,15 +10506,317 @@ function runtimeFieldsByBlockId(blocks) {
10028
10506
  function applyRuntimeContentDecorationProjection(block, content, projection) {
10029
10507
  const blockId = designBlockIdFromBlockItem(block);
10030
10508
  const fields = blockId ? projection.fieldsByBlockId.get(blockId) : void 0;
10031
- return applyCompiledRuntimeFieldsToContent(isRecord$2(content) ? content : {}, fields);
10509
+ return applyCompiledRuntimeFieldsToContent(isRecord$1(content) ? content : {}, fields);
10032
10510
  }
10033
10511
  function designBlockIdFromBlockItem(block) {
10034
10512
  return typeof block.id === "string" && block.id.length > 0 ? asDesignBlockId(block.id) : null;
10035
10513
  }
10036
- function isRecord$2(value) {
10514
+ function isRecord$1(value) {
10037
10515
  return typeof value === "object" && value !== null && !Array.isArray(value);
10038
10516
  }
10039
10517
  //#endregion
10518
+ //#region ../field-primitives/src/bindings/index.ts
10519
+ const BINDING_TRANSFORMS = {
10520
+ RICHTEXT_FIRST_PARAGRAPH: "richtext.firstParagraph",
10521
+ DATE_FORMAT_SHORT: "date.formatShort",
10522
+ DATE_FORMAT_LONG: "date.formatLong",
10523
+ TEXT_INLINE_TEXT: "text.inlineText"
10524
+ };
10525
+ Object.values(BINDING_TRANSFORMS);
10526
+ //#endregion
10527
+ //#region ../blocks/src/bindings/types.ts
10528
+ /**
10529
+ * Shared types for template binding resolution.
10530
+ *
10531
+ * Used by SDK, site-renderer, and dashboard for resolving
10532
+ * bindings in template blocks to actual content values.
10533
+ */
10534
+ /**
10535
+ * Available transform function names.
10536
+ */
10537
+ const TRANSFORMS = BINDING_TRANSFORMS;
10538
+ const BINDING_SOURCES = [
10539
+ "field",
10540
+ "meta",
10541
+ "literal",
10542
+ "transform",
10543
+ "fallback"
10544
+ ];
10545
+ //#endregion
10546
+ //#region ../blocks/src/bindings/index.ts
10547
+ /**
10548
+ * Resolves a binding map to actual content values.
10549
+ *
10550
+ * Returns only keys whose binding resolved to a non-null, non-undefined value.
10551
+ * To merge resolved bindings over a base content object (the dashboard
10552
+ * template preview's use case), see {@link applyBindingsToContent}.
10553
+ *
10554
+ * @param bindings - Map of field keys to binding descriptors
10555
+ * @param context - Entry data context (fields and meta)
10556
+ * @returns Resolved content object with actual values
10557
+ *
10558
+ * @example
10559
+ * ```typescript
10560
+ * const content = applyBindings(
10561
+ * {
10562
+ * headline: { source: 'meta', path: 'title' },
10563
+ * body: { source: 'field', path: 'content' },
10564
+ * },
10565
+ * {
10566
+ * fields: { content: 'Hello world' },
10567
+ * meta: { title: 'My Post', slug: 'my-post' },
10568
+ * }
10569
+ * );
10570
+ * // Result: { headline: 'My Post', body: 'Hello world' }
10571
+ * ```
10572
+ */
10573
+ function applyBindings(bindings, context) {
10574
+ const result = {};
10575
+ for (const [key, bindingSpec] of Object.entries(bindings)) {
10576
+ if (isBindingDescriptor(bindingSpec)) {
10577
+ const value = resolveBindingValue(bindingSpec, context);
10578
+ if (value !== void 0 && value !== null) setBindingValue(result, key, value);
10579
+ continue;
10580
+ }
10581
+ if (typeof bindingSpec === "string") {
10582
+ const value = resolveBindingValue({
10583
+ source: "field",
10584
+ path: bindingSpec
10585
+ }, context);
10586
+ if (value !== void 0 && value !== null) setBindingValue(result, key, value);
10587
+ continue;
10588
+ }
10589
+ if (isRecord$11(bindingSpec)) {
10590
+ const nested = applyBindings(bindingSpec, context);
10591
+ if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
10592
+ }
10593
+ }
10594
+ return result;
10595
+ }
10596
+ /**
10597
+ * Resolve a binding map and merge the result over a base content object.
10598
+ *
10599
+ * Use this when a block has *some* hard-coded content (from a template's
10600
+ * `block.content`) and *some* values driven by template bindings against
10601
+ * an entry. The base provides defaults; resolved bindings override them.
10602
+ *
10603
+ * Same null-handling as {@link applyBindings}: keys whose binding resolves
10604
+ * to `null`/`undefined` do NOT overwrite the base. This means "no resolved
10605
+ * value" leaves the base value (or absence) intact, which is the correct
10606
+ * semantic for both the SDK/frontend render paths and the dashboard preview.
10607
+ *
10608
+ * Replaces the dashboard's bespoke `applyBindings` that lived in
10609
+ * `apps/dashboard/src/lib/templates/applyBindings.ts` — its divergent
10610
+ * "always-set-null" behaviour produced the `subheadline: null` regression
10611
+ * documented in Phase 1.
10612
+ *
10613
+ * @example
10614
+ * ```typescript
10615
+ * const content = applyBindingsToContent(
10616
+ * { eyebrow: 'Default eyebrow', headline: 'Default headline' },
10617
+ * { headline: { source: 'meta', path: 'title' } },
10618
+ * { fields: {}, meta: { title: 'Entry title' } },
10619
+ * );
10620
+ * // Result: { eyebrow: 'Default eyebrow', headline: 'Entry title' }
10621
+ * ```
10622
+ */
10623
+ function applyBindingsToContent(baseContent, bindings, context) {
10624
+ return mergeResolvedBindings(baseContent, applyBindings(bindings, context));
10625
+ }
10626
+ function mergeResolvedBindings(base, resolved) {
10627
+ const merged = { ...base };
10628
+ for (const [key, resolvedValue] of Object.entries(resolved)) {
10629
+ const baseValue = merged[key];
10630
+ merged[key] = isRecord$11(baseValue) && isRecord$11(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
10631
+ }
10632
+ return merged;
10633
+ }
10634
+ function setBindingValue(target, path, value) {
10635
+ const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
10636
+ if (segments.length === 0) return;
10637
+ const firstSegment = segments[0];
10638
+ if (!firstSegment) return;
10639
+ if (segments.length === 1) {
10640
+ target[firstSegment] = value;
10641
+ return;
10642
+ }
10643
+ const isIndex = (segment) => /^\d+$/.test(segment);
10644
+ let current = target;
10645
+ for (let i = 0; i < segments.length; i++) {
10646
+ const segment = segments[i];
10647
+ if (!segment) return;
10648
+ const last = i === segments.length - 1;
10649
+ const nextSegment = segments[i + 1];
10650
+ if (last) {
10651
+ if (Array.isArray(current) && isIndex(segment)) {
10652
+ current[Number(segment)] = value;
10653
+ return;
10654
+ }
10655
+ if (isRecord$11(current)) current[segment] = value;
10656
+ return;
10657
+ }
10658
+ const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
10659
+ if (Array.isArray(current) && isIndex(segment)) {
10660
+ const index = Number(segment);
10661
+ const existing = current[index];
10662
+ if (nextWantsArray) {
10663
+ if (!Array.isArray(existing)) current[index] = [];
10664
+ } else if (!isRecord$11(existing)) current[index] = {};
10665
+ current = current[index];
10666
+ continue;
10667
+ }
10668
+ if (isRecord$11(current)) {
10669
+ const existing = current[segment];
10670
+ if (nextWantsArray) {
10671
+ if (!Array.isArray(existing)) current[segment] = [];
10672
+ } else if (!isRecord$11(existing)) current[segment] = {};
10673
+ current = current[segment];
10674
+ continue;
10675
+ }
10676
+ return;
10677
+ }
10678
+ }
10679
+ /**
10680
+ * Resolves a single binding descriptor to its value.
10681
+ */
10682
+ function resolveBindingValue(descriptor, context) {
10683
+ switch (descriptor.source) {
10684
+ case "field": return descriptor.path ? getPath(context.fields, descriptor.path) : void 0;
10685
+ case "meta": return descriptor.path ? getPath(context.meta, descriptor.path) : void 0;
10686
+ case "literal": return descriptor.value;
10687
+ case "transform": {
10688
+ const inputDescriptor = descriptor.input && isBindingDescriptorLike(descriptor.input) ? normalizeBindingInput(descriptor.input) : descriptor.path ? normalizeBindingInput(descriptor.path) : null;
10689
+ const inputValue = inputDescriptor ? resolveBindingValue(inputDescriptor, context) : void 0;
10690
+ return applyTransform(descriptor.transform, inputValue);
10691
+ }
10692
+ case "fallback":
10693
+ for (const option of descriptor.options ?? []) {
10694
+ const normalized = normalizeBindingInput(option);
10695
+ if (!normalized) continue;
10696
+ const value = resolveBindingValue(normalized, context);
10697
+ if (value !== void 0 && value !== null && value !== "") return value;
10698
+ }
10699
+ return null;
10700
+ default: return null;
10701
+ }
10702
+ }
10703
+ /**
10704
+ * Gets a nested path from an object.
10705
+ */
10706
+ function getPath(source, path) {
10707
+ const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
10708
+ let current = source;
10709
+ for (const segment of segments) {
10710
+ if (!isRecord$11(current)) return void 0;
10711
+ current = current[segment];
10712
+ }
10713
+ return current;
10714
+ }
10715
+ /**
10716
+ * Applies a transform function to a value.
10717
+ */
10718
+ function applyTransform(name, value) {
10719
+ if (!name) return value;
10720
+ switch (name) {
10721
+ case TRANSFORMS.RICHTEXT_FIRST_PARAGRAPH: return extractFirstParagraph(value);
10722
+ case TRANSFORMS.DATE_FORMAT_SHORT: return formatDate(value, { dateStyle: "medium" });
10723
+ case TRANSFORMS.DATE_FORMAT_LONG: return formatDate(value, {
10724
+ dateStyle: "long",
10725
+ timeStyle: "short"
10726
+ });
10727
+ case TRANSFORMS.TEXT_INLINE_TEXT: return textToInlineText(value);
10728
+ default: return value;
10729
+ }
10730
+ }
10731
+ function textToInlineText(value) {
10732
+ if (typeof value !== "string") return null;
10733
+ return plainTextToInlineText(value);
10734
+ }
10735
+ /**
10736
+ * Extracts the first paragraph text from a TipTap/ProseMirror document.
10737
+ *
10738
+ * Accepts the canonical unwrapped form (`{ type: 'doc', content: [...] }`).
10739
+ */
10740
+ function extractFirstParagraph(value) {
10741
+ if (!isRichTextDoc(value)) return null;
10742
+ for (const node of value.content) {
10743
+ if (!isRecord$11(node)) continue;
10744
+ if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
10745
+ const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
10746
+ if (text.length > 0) return text;
10747
+ }
10748
+ return null;
10749
+ }
10750
+ /**
10751
+ * Formats a date string using Intl.DateTimeFormat.
10752
+ */
10753
+ function formatDate(value, options) {
10754
+ if (typeof value !== "string") return null;
10755
+ const date = new Date(value);
10756
+ if (Number.isNaN(date.getTime())) return null;
10757
+ return new Intl.DateTimeFormat(void 0, options).format(date);
10758
+ }
10759
+ /**
10760
+ * Type guard to check if a value is a valid binding descriptor.
10761
+ */
10762
+ function isBindingDescriptor(value) {
10763
+ if (!isRecord$11(value) || typeof value.source !== "string") return false;
10764
+ if (!BINDING_SOURCES.includes(value.source)) return false;
10765
+ switch (value.source) {
10766
+ case "field":
10767
+ case "meta": return typeof value.path === "string";
10768
+ case "literal": return "value" in value;
10769
+ case "transform": return typeof value.transform === "string" && (value.input === void 0 || isBindingDescriptorLike(value.input)) && (value.path === void 0 || typeof value.path === "string");
10770
+ case "fallback": return Array.isArray(value.options);
10771
+ default: return false;
10772
+ }
10773
+ }
10774
+ /**
10775
+ * Type guard to check if a value is binding-descriptor-like (can be normalized).
10776
+ */
10777
+ function isBindingDescriptorLike(value) {
10778
+ return isBindingDescriptor(value) || typeof value === "string" || isRecord$11(value) && typeof value.source === "string" && typeof value.path === "string";
10779
+ }
10780
+ /**
10781
+ * Normalizes a binding input to a binding descriptor.
10782
+ *
10783
+ * Converts string shorthand to field descriptors and validates
10784
+ * that objects have valid binding source values.
10785
+ */
10786
+ function normalizeBindingInput(value) {
10787
+ if (isBindingDescriptor(value)) return value;
10788
+ if (typeof value === "string") return {
10789
+ source: "field",
10790
+ path: value
10791
+ };
10792
+ return null;
10793
+ }
10794
+ //#endregion
10795
+ //#region ../preview-next/src/client/blocks/previewProjection/entryFieldRebinding.ts
10796
+ /**
10797
+ * Only the entry fields that changed are bound in again: unchanged fields keep
10798
+ * the server's materialised value, which may be richer than the stored one
10799
+ * (media the loaders have hydrated, for instance).
10800
+ */
10801
+ function entryFieldRebindingProjection(changedFields) {
10802
+ return Object.keys(changedFields).length === 0 ? null : {
10803
+ kind: "entry-field-rebinding",
10804
+ source: "entry-draft",
10805
+ changedFields
10806
+ };
10807
+ }
10808
+ /**
10809
+ * Binds the changed entry fields into a block with template bindings. A binding
10810
+ * whose source did not change resolves to nothing and leaves the content as it is.
10811
+ */
10812
+ function applyEntryFieldRebindingProjection(block, content, projection) {
10813
+ if (!isRecord$11(block.bindings)) return content;
10814
+ return applyBindingsToContent(content ?? {}, block.bindings, {
10815
+ fields: { ...projection.changedFields },
10816
+ meta: {}
10817
+ });
10818
+ }
10819
+ //#endregion
10040
10820
  //#region ../preview-next/src/client/blocks/previewProjection/applyPreviewProjections.ts
10041
10821
  function applyPreviewStructureProjections(blockItems, projections) {
10042
10822
  return projections.reduce((current, projection) => {
@@ -10052,6 +10832,7 @@ function applyPreviewContentFieldProjections(blockId, content, projections) {
10052
10832
  }
10053
10833
  function applyPreviewRuntimeContentProjections(block, content, projections) {
10054
10834
  return projections.reduce((current, projection) => {
10835
+ if (projection.kind === "entry-field-rebinding") return applyEntryFieldRebindingProjection(block, current, projection);
10055
10836
  if (projection.kind !== "runtime-content-decoration") return current;
10056
10837
  return applyRuntimeContentDecorationProjection(block, current, projection);
10057
10838
  }, content);
@@ -10060,108 +10841,25 @@ function blockHasPreviewContentFieldProjection(blockId, projections) {
10060
10841
  return projections.some((projection) => projection.kind === "content-field-overrides" && blockHasContentFieldOverrideProjection(blockId, projection));
10061
10842
  }
10062
10843
  //#endregion
10063
- //#region ../preview-next/src/client/blocks/linkedEntryRenderOverlay.ts
10064
- function applyLinkedEntryRenderOverlay(value, overlays) {
10065
- if (overlays.size === 0) return value;
10066
- return overlayValue(value, overlays);
10067
- }
10068
- function applyLinkedEntryRenderOverlayToDataContext(dataContext, overlays) {
10069
- if (!dataContext?.resolvedData || overlays.size === 0) return dataContext;
10070
- const resolvedData = applyLinkedEntryRenderOverlay(dataContext.resolvedData, overlays);
10071
- if (resolvedData === dataContext.resolvedData) return dataContext;
10072
- return {
10073
- ...dataContext,
10074
- resolvedData
10075
- };
10076
- }
10077
- function overlayValue(value, overlays) {
10078
- if (Array.isArray(value)) {
10079
- let changed = false;
10080
- const next = value.map((item) => {
10081
- const overlaid = overlayValue(item, overlays);
10082
- if (overlaid !== item) changed = true;
10083
- return overlaid;
10084
- });
10085
- return changed ? next : value;
10086
- }
10087
- if (!isRecord$1(value)) return value;
10088
- const meta = parseLinkedEntryMeta(value[LINKED_CONTENT_ENTRY_META_KEY]);
10089
- if (meta) {
10090
- const overlay = overlays.get(unsafeAsLinkedContentEntryId(meta.entryId));
10091
- if (overlay) {
10092
- const displayProjections = resolveOverlayDisplayProjections(overlay.content, meta);
10093
- const titleProjection = resolveOverlayTitleProjection({
10094
- currentValue: value,
10095
- content: overlay.content,
10096
- meta,
10097
- displayProjections
10098
- });
10099
- return {
10100
- ...value,
10101
- ...displayProjections,
10102
- ...titleProjection ? { title: titleProjection } : {},
10103
- content: overlay.content,
10104
- optimisticHash: overlay.optimisticHash,
10105
- [LINKED_CONTENT_ENTRY_META_KEY]: {
10106
- ...meta,
10107
- ...titleProjection ? { title: titleProjection } : {},
10108
- optimisticHash: overlay.optimisticHash
10109
- }
10110
- };
10111
- }
10112
- }
10113
- let changed = false;
10114
- const next = {};
10115
- for (const [key, child] of Object.entries(value)) {
10116
- const overlaid = overlayValue(child, overlays);
10117
- if (overlaid !== child) changed = true;
10118
- next[key] = overlaid;
10119
- }
10120
- return changed ? next : value;
10121
- }
10122
- function resolveOverlayDisplayProjections(content, meta) {
10123
- const projections = {};
10124
- for (const source of meta.fieldSources) {
10125
- if (source.kind !== "content-field") continue;
10126
- if (source.displayPath.startsWith("content.")) continue;
10127
- if (source.displayPath.includes(".")) continue;
10128
- if (!(source.fieldPath in content)) continue;
10129
- projections[source.displayPath] = content[source.fieldPath];
10130
- }
10131
- return projections;
10132
- }
10133
- function resolveOverlayTitleProjection(input) {
10134
- const projectedTitle = input.displayProjections.title;
10135
- if (typeof projectedTitle === "string") return projectedTitle;
10136
- if (input.meta.fieldSources.find((source) => source.displayPath === "title")?.kind === "read-only") {
10137
- const currentTitle = input.currentValue.title;
10138
- return typeof currentTitle === "string" ? currentTitle : input.meta.title;
10139
- }
10140
- return resolveOverlayTitle(input.content, input.meta);
10141
- }
10142
- function resolveOverlayTitle(content, meta) {
10143
- const titleField = meta.contentType.titleField;
10144
- if (titleField) {
10145
- const value = content[titleField];
10146
- if (typeof value === "string" && value.trim().length > 0) return value;
10147
- }
10148
- return meta.title;
10149
- }
10150
- function parseLinkedEntryMeta(value) {
10151
- return getLinkedContentEntryMeta({ [LINKED_CONTENT_ENTRY_META_KEY]: value });
10152
- }
10153
- function isRecord$1(value) {
10154
- return typeof value === "object" && value !== null && !Array.isArray(value);
10155
- }
10156
- //#endregion
10157
10844
  //#region ../preview-next/src/client/blocks/composer/mergeDrafts.ts
10158
10845
  const EMPTY_LINKED_ENTRY_OVERLAY = /* @__PURE__ */ new Map();
10846
+ /**
10847
+ * Draft snapshots as the preview renders them: `current` follows the tab's render
10848
+ * source (its own edits, or another tab's live drafts while it only views).
10849
+ */
10159
10850
  function getDraftSnapshots(uiStore) {
10160
- const snapshots = uiStore.getState().drafts.inspect();
10161
- return new Map(snapshots.map((snap) => [snap.id, snap]));
10851
+ const state = uiStore.getState();
10852
+ const source = renderSourceFor(state.editability);
10853
+ return new Map(state.drafts.inspect().map((snap) => [snap.id, {
10854
+ id: snap.id,
10855
+ baseline: snap.sync.baseline.values,
10856
+ current: resolveRenderedValues(source, snap, remoteDraftValues(state.remoteDrafts, {
10857
+ kind: "block",
10858
+ id: snap.id
10859
+ }))
10860
+ }]));
10162
10861
  }
10163
- function mergeBlockWithDraft(block, draftMap, index, projections = [], linkedEntryOverlays = EMPTY_LINKED_ENTRY_OVERLAY) {
10164
- const { draftContentId = null, publishedContentId = null } = block;
10862
+ function mergeBlockWithDraft(block, draftMap, index, projections = [], linkedEntryOverlays = EMPTY_LINKED_ENTRY_OVERLAY, versions = NO_BLOCK_VERSIONS) {
10165
10863
  const id = block.id ?? null;
10166
10864
  const editorBlockId = id ? unsafeAsEditorBlockId(id) : null;
10167
10865
  const snap = editorBlockId ? draftMap.get(editorBlockId) ?? null : null;
@@ -10169,14 +10867,12 @@ function mergeBlockWithDraft(block, draftMap, index, projections = [], linkedEnt
10169
10867
  const baseline = blockBaseline(block, snap);
10170
10868
  return {
10171
10869
  id,
10172
- draftContentId,
10173
- publishedContentId,
10174
10870
  kind: block.kind,
10175
10871
  purpose: "content",
10176
10872
  orderIndex: block.orderIndex ?? index,
10177
- content: renderContent(block, baseline, projections, linkedEntryOverlays),
10178
- draftContent: renderContent(block, draftContent, projections, linkedEntryOverlays),
10179
- publishedContent: block.publishedContent ?? null,
10873
+ content: renderBlockContent(block, baseline, projections, linkedEntryOverlays),
10874
+ draftContent: renderBlockContent(block, draftContent, projections, linkedEntryOverlays),
10875
+ versions,
10180
10876
  bindings: block.bindings ?? null
10181
10877
  };
10182
10878
  }
@@ -10184,19 +10880,18 @@ function readProjectedDraftRenderContent(block, editorBlockId, snap, projections
10184
10880
  return applyPreviewContentFieldProjections(editorBlockId, snap?.current ?? blockBaseline(block, snap), projections);
10185
10881
  }
10186
10882
  function blockBaseline(block, snapshot) {
10187
- return snapshot?.baseline ?? block.content ?? block.publishedContent ?? null;
10883
+ return snapshot?.baseline ?? block.content ?? null;
10188
10884
  }
10189
- function renderContent(block, content, projections, linkedEntryOverlays) {
10885
+ function renderBlockContent(block, content, projections, linkedEntryOverlays = EMPTY_LINKED_ENTRY_OVERLAY) {
10190
10886
  return applyPreviewRuntimeContentProjections(block, applyLinkedEntryRenderOverlay(content, linkedEntryOverlays), projections);
10191
10887
  }
10192
10888
  //#endregion
10193
10889
  //#region ../preview-next/src/client/blocks/composer/transformBlock.ts
10194
10890
  function transformToPageBlock(enriched) {
10195
- const publishedPlacement = readPublishedBlockPlacement(enriched.publishedContentId, enriched.publishedContent);
10196
10891
  return {
10197
10892
  id: enriched.id,
10198
- publishedPlacement,
10199
- contentVersionId: enriched.draftContentId ?? enriched.publishedContentId,
10893
+ publishedPlacement: enriched.versions.publishedPlacement,
10894
+ contentVersionId: selectedContentVersionId(enriched.versions),
10200
10895
  kind: enriched.kind,
10201
10896
  purpose: enriched.purpose,
10202
10897
  content: enriched.content ?? {},
@@ -10233,45 +10928,46 @@ function composePageFromBlocks(args, cacheRef) {
10233
10928
  const { page, blockItems, projections = [], uiStore } = args;
10234
10929
  const draftMap = getDraftSnapshots(uiStore);
10235
10930
  const aiProjections = previewProjectionsFromAiOverlays(uiStore.getState().aiOverlays);
10236
- const linkedEntryOverlays = getLinkedEntryRenderOverlays(uiStore);
10931
+ const entryProjections = entryDraftProjections(uiStore);
10932
+ const linkedEntryOverlays = linkedEntryRenderOverlaysFromStore(uiStore);
10237
10933
  return composePreviewRenderPage({
10238
10934
  page,
10239
10935
  blockItems,
10240
10936
  draftSnapshots: Array.from(draftMap.values()),
10241
- projections: [...aiProjections, ...projections],
10242
- linkedEntryOverlays
10937
+ projections: [
10938
+ ...entryProjections,
10939
+ ...aiProjections,
10940
+ ...projections
10941
+ ],
10942
+ linkedEntryOverlays,
10943
+ blockVersions: uiStore.getState().blockVersions.get
10243
10944
  }, cacheRef);
10244
10945
  }
10245
10946
  function composePreviewRenderPage(args, cacheRef) {
10246
- const { page, blockItems, draftSnapshots, projections, linkedEntryOverlays } = args;
10947
+ const { page, blockItems, draftSnapshots, projections, linkedEntryOverlays, blockVersions } = args;
10247
10948
  if (!page) return page;
10248
10949
  if (!blockItems.length) return {
10249
10950
  ...page,
10250
10951
  blocks: page.blocks.map((block) => ({
10251
10952
  ...block,
10953
+ content: renderBlockContent(block, block.content ?? null, projections, linkedEntryOverlays) ?? void 0,
10954
+ draftContent: block.draftContent ? renderBlockContent(block, block.draftContent, projections, linkedEntryOverlays) : block.draftContent,
10252
10955
  publishedPlacement: null,
10253
10956
  contentVersionId: null
10254
10957
  }))
10255
10958
  };
10256
10959
  const draftMap = draftSnapshotMap(draftSnapshots);
10257
- const renderedBlocks = applyCacheOptimization([...applyPreviewStructureProjections(blockItems, projections).map((block, index) => mergeBlockWithDraft(block, draftMap, index, projections, linkedEntryOverlays))].sort((a, b) => (a.orderIndex ?? 0) - (b.orderIndex ?? 0)), cacheRef);
10960
+ const renderedBlocks = applyCacheOptimization([...applyPreviewStructureProjections(blockItems, projections).map((block, index) => mergeBlockWithDraft(block, draftMap, index, projections, linkedEntryOverlays, (block.id ? blockVersions(unsafeAsEditorBlockId(block.id)) : null) ?? NO_BLOCK_VERSIONS))].sort((a, b) => (a.orderIndex ?? 0) - (b.orderIndex ?? 0)), cacheRef);
10258
10961
  return {
10259
10962
  ...page,
10260
10963
  blocks: renderedBlocks
10261
10964
  };
10262
10965
  }
10263
- function getLinkedEntryRenderOverlays(uiStore) {
10264
- const linkedEntries = uiStore.getState().linkedEntries.inspect();
10265
- const overlays = /* @__PURE__ */ new Map();
10266
- for (const linkedEntry of linkedEntries) {
10267
- const content = linkedEntry.current ?? linkedEntry.baseline;
10268
- if (!content) continue;
10269
- overlays.set(linkedEntry.meta.entryId, {
10270
- content,
10271
- optimisticHash: linkedEntry.meta.optimisticHash
10272
- });
10273
- }
10274
- return overlays;
10966
+ /** Entry fields changed in the editor (locally or live from another tab) are bound in first. */
10967
+ function entryDraftProjections(uiStore) {
10968
+ const state = uiStore.getState();
10969
+ const projection = entryFieldRebindingProjection(renderedFieldChanges(renderSourceFor(state.editability), state.content?.getSnapshot() ?? null, remoteDraftValues(state.remoteDrafts, { kind: "content" })));
10970
+ return projection ? [projection] : [];
10275
10971
  }
10276
10972
  function draftSnapshotMap(snapshots) {
10277
10973
  return new Map(snapshots.map((snap) => [snap.id, snap]));
@@ -11842,22 +12538,27 @@ function EditablePageRenderer(props) {
11842
12538
  snapshots.map((s) => `${s.id}:${s.version}`).join("|"),
11843
12539
  linkedEntries.map((entry) => `${entry.meta.entryId}:${entry.version}`).join("|"),
11844
12540
  `overlay:${overlayRevision}`,
11845
- `generated-icons:${state.generatedIconAssets?.revision ?? 0}`
12541
+ `generated-icons:${state.generatedIconAssets?.revision ?? 0}`,
12542
+ linkedSaveHandoversVersion(state.linkedSaveHandovers),
12543
+ `block-versions:${state.blockVersions.revision}`
11846
12544
  ].join("|");
11847
12545
  });
11848
- const linkedEntryOverlays = useMemo(() => {
11849
- const overlays = /* @__PURE__ */ new Map();
11850
- for (const linkedEntry of uiStore.getState().linkedEntries.inspect()) {
11851
- const content = linkedEntry.current ?? linkedEntry.baseline;
11852
- if (!content) continue;
11853
- overlays.set(linkedEntry.meta.entryId, {
11854
- content,
11855
- optimisticHash: linkedEntry.meta.optimisticHash
11856
- });
11857
- }
11858
- return overlays;
11859
- }, [uiStore, renderStateVersion]);
11860
- const linkedEntryDataContext = useMemo(() => applyLinkedEntryRenderOverlayToDataContext(pageRendererProps.dataContext, linkedEntryOverlays), [linkedEntryOverlays, pageRendererProps.dataContext]);
12546
+ const remoteDrafts = useEditorUiStore((state) => state.remoteDrafts);
12547
+ const contentSnapshot = useEditorUiStore((state) => state.content.getSnapshot());
12548
+ const renderSource = useEditorUiStore((state) => renderSourceFor(state.editability));
12549
+ const linkedEntryOverlays = useMemo(() => linkedEntryRenderOverlaysFromStore(uiStore), [
12550
+ uiStore,
12551
+ renderStateVersion,
12552
+ remoteDrafts,
12553
+ renderSource
12554
+ ]);
12555
+ const entryDataContext = useMemo(() => withRenderedContentEntry(pageRendererProps.dataContext, resolveRenderedValues(renderSource, contentSnapshot, remoteDraftValues(remoteDrafts, { kind: "content" }))), [
12556
+ contentSnapshot,
12557
+ pageRendererProps.dataContext,
12558
+ remoteDrafts,
12559
+ renderSource
12560
+ ]);
12561
+ const linkedEntryDataContext = useMemo(() => applyLinkedEntryRenderOverlayToDataContext(entryDataContext, linkedEntryOverlays), [linkedEntryOverlays, entryDataContext]);
11861
12562
  const aiProjections = useMemo(() => previewProjectionsFromAiOverlays(uiStore.getState().aiOverlays), [uiStore, renderStateVersion]);
11862
12563
  const previewTheme = pageRendererProps.rendering?.kind === "overrides-only" ? null : pageRendererProps.theme;
11863
12564
  const runtimePreviewSource = useMemo(() => resolveRuntimePreviewSourceForTheme(pageDesignState, previewTheme), [pageDesignState, previewTheme]);
@@ -11878,7 +12579,10 @@ function EditablePageRenderer(props) {
11878
12579
  pageRendererProps.page,
11879
12580
  renderProjections,
11880
12581
  uiStore,
11881
- renderStateVersion
12582
+ renderStateVersion,
12583
+ remoteDrafts,
12584
+ contentSnapshot,
12585
+ renderSource
11882
12586
  ]) ?? {
11883
12587
  name: "",
11884
12588
  path: "",
@@ -11925,7 +12629,7 @@ function EditablePageRenderer(props) {
11925
12629
  blockId,
11926
12630
  children: rendered
11927
12631
  });
11928
- const rawContent = uiStore.getState().drafts.getBlockSnapshot(editorBlockId)?.current ?? block.content ?? {};
12632
+ const rawContent = renderedBlockContent(uiStore, editorBlockId) ?? block.content ?? {};
11929
12633
  const content = applyPreviewRuntimeContentProjections(block, applyPreviewContentFieldProjections(editorBlockId, rawContent, aiProjections) ?? rawContent, renderProjections);
11930
12634
  return /* @__PURE__ */ jsx(EditableBlockProvider, {
11931
12635
  blockId,
@@ -11960,23 +12664,17 @@ function EditablePageRenderer(props) {
11960
12664
  dataContext: linkedEntryDataContext,
11961
12665
  apiClient: blockDataApiClient
11962
12666
  });
11963
- const generatedIconAssetOverlay = useMemo(() => {
11964
- const byBlock = {};
11965
- for (const block of renderPage.blocks) {
11966
- if (!block.id) continue;
11967
- const assets = uiStore.getState().generatedIconAssets?.getForBlock(unsafeAsEditorBlockId(block.id)) ?? [];
11968
- if (assets.length > 0) byBlock[block.id] = assets;
11969
- }
11970
- return byBlock;
11971
- }, [
12667
+ useLinkedSaveHandoverRetention(uiStore, entryDataContext, liveResolvedData);
12668
+ const generatedIconAssetOverlay = useMemo(() => generatedIconAssetsByBlock(uiStore, renderPage.blocks), [
11972
12669
  renderPage.blocks,
11973
12670
  renderStateVersion,
11974
12671
  uiStore
11975
12672
  ]);
11976
- const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(mergeResolvedDataContext(linkedEntryDataContext, liveResolvedData), generatedIconAssetOverlay), [
12673
+ const dataContext = useMemo(() => mergeGeneratedIconAssetsIntoDataContext(applyLinkedEntryRenderOverlayToDataContext(mergeResolvedDataContext(linkedEntryDataContext, liveResolvedData), linkedEntryOverlays), generatedIconAssetOverlay), [
11977
12674
  generatedIconAssetOverlay,
11978
12675
  linkedEntryDataContext,
11979
- liveResolvedData
12676
+ liveResolvedData,
12677
+ linkedEntryOverlays
11980
12678
  ]);
11981
12679
  return /* @__PURE__ */ jsx(EditorPageRenderer, {
11982
12680
  ...pageRendererProps,
@@ -12008,8 +12706,7 @@ function usePreviewBlockResolvedData(args) {
12008
12706
  id: block.id,
12009
12707
  kind: block.kind,
12010
12708
  content: block.content ?? null,
12011
- draftContent: block.draftContent ?? null,
12012
- publishedContent: block.publishedContent ?? null
12709
+ draftContent: block.draftContent ?? null
12013
12710
  }))
12014
12711
  });
12015
12712
  }, [
@@ -12085,15 +12782,13 @@ function buildPreviewBlockDataContext(dataContext) {
12085
12782
  }
12086
12783
  };
12087
12784
  }
12088
- function mergeResolvedDataContext(dataContext, liveResolvedData) {
12089
- if (!dataContext || !liveResolvedData) return dataContext;
12090
- return {
12091
- ...dataContext,
12092
- resolvedData: {
12093
- ...dataContext.resolvedData ?? {},
12094
- ...liveResolvedData
12095
- }
12096
- };
12785
+ /** Each rendered block's generated icon assets, for blocks that have any. */
12786
+ function generatedIconAssetsByBlock(uiStore, blocks) {
12787
+ const assets = uiStore.getState().generatedIconAssets;
12788
+ return Object.fromEntries(blocks.flatMap((block) => {
12789
+ const forBlock = block.id ? assets?.getForBlock(unsafeAsEditorBlockId(block.id)) ?? [] : [];
12790
+ return block.id && forBlock.length > 0 ? [[block.id, forBlock]] : [];
12791
+ }));
12097
12792
  }
12098
12793
  function createPreviewBlockDataApiClient(dashboardApiClient, context) {
12099
12794
  const batcher = createMicrobatcher({
@@ -12226,23 +12921,35 @@ function resolveContentStorageUrl(content) {
12226
12921
  //#endregion
12227
12922
  //#region ../preview-next/src/client/sdk/SdkPreviewModeRuntime.tsx
12228
12923
  var SdkPreviewModeRuntime_exports = /* @__PURE__ */ __exportAll({ SdkPreviewModeRuntime: () => SdkPreviewModeRuntime });
12924
+ function SdkEditablePageRenderer(props) {
12925
+ const previewToken = usePreviewToken();
12926
+ return /* @__PURE__ */ jsx(EditablePageRenderer, {
12927
+ ...props,
12928
+ dataContext: {
12929
+ ...props.dataContext,
12930
+ previewToken
12931
+ }
12932
+ });
12933
+ }
12229
12934
  function isSdkCustomBlockArray(value) {
12230
12935
  return Array.isArray(value);
12231
12936
  }
12937
+ function recordOrNull(value) {
12938
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
12939
+ }
12232
12940
  function toPreviewBlock(block, index) {
12233
- const publishedContent = block.publishedContent;
12234
- return {
12941
+ return toEditorBlockItem({
12235
12942
  id: block.id,
12236
- draftContentId: typeof block.draftContentId === "string" ? block.draftContentId : null,
12237
- publishedContentId: typeof block.publishedContentId === "string" ? block.publishedContentId : null,
12238
12943
  kind: block.kind,
12239
12944
  purpose: block.purpose,
12240
12945
  orderIndex: index,
12241
12946
  content: block.content ?? null,
12242
12947
  draftContent: block.draftContent ?? null,
12243
- publishedContent: publishedContent && typeof publishedContent === "object" && !Array.isArray(publishedContent) ? publishedContent : null,
12244
- bindings: block.bindings ?? null
12245
- };
12948
+ bindings: block.bindings ?? null,
12949
+ draftContentId: typeof block.draftContentId === "string" ? block.draftContentId : null,
12950
+ publishedContentId: typeof block.publishedContentId === "string" ? block.publishedContentId : null,
12951
+ publishedContent: recordOrNull(block.publishedContent)
12952
+ });
12246
12953
  }
12247
12954
  function getSdkConfigForPreview(value) {
12248
12955
  if (!value || typeof value !== "object") return null;
@@ -12278,7 +12985,7 @@ function SdkPreviewModeRuntime(props) {
12278
12985
  previewToken,
12279
12986
  siteId
12280
12987
  ]);
12281
- const editablePage = model.rendering.kind === "overrides-only" ? /* @__PURE__ */ jsx(EditablePageRenderer, {
12988
+ const editablePage = model.rendering.kind === "overrides-only" ? /* @__PURE__ */ jsx(SdkEditablePageRenderer, {
12282
12989
  rendering: { kind: "overrides-only" },
12283
12990
  page,
12284
12991
  dataContext,
@@ -12286,7 +12993,7 @@ function SdkPreviewModeRuntime(props) {
12286
12993
  blockOverrides: typedBlockOverrides ?? {},
12287
12994
  sdkConfig: sdkConfig ?? void 0,
12288
12995
  customBlocks: customBlocks ?? void 0
12289
- }) : /* @__PURE__ */ jsx(EditablePageRenderer, {
12996
+ }) : /* @__PURE__ */ jsx(SdkEditablePageRenderer, {
12290
12997
  theme: requireSdkPreviewTheme(model.theme),
12291
12998
  page,
12292
12999
  dataContext,
@@ -12355,7 +13062,6 @@ function resolveSdkPreviewRuntimeModel(props) {
12355
13062
  siteId,
12356
13063
  apiBaseUrl,
12357
13064
  portalToken: null,
12358
- previewToken: props.previewToken,
12359
13065
  resolvedData: content.resolvedData,
12360
13066
  routes: routeMap,
12361
13067
  pagesByIdentifier: content.pagesByIdentifier ?? void 0,
@@ -12401,4 +13107,4 @@ function deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl) {
12401
13107
  }
12402
13108
  }
12403
13109
  //#endregion
12404
- export { FixedBottomSurface as C, getSiteFontsStorageUrl as S, usePreviewBlockCustomizeSelectionOptional as _, usePreviewPageDesignEditorState as a, buildFontPreviewUrl as b, applyPreviewChromeSurfaceToElement as c, buildPreviewDashboardSetupUrl as d, resolvePreviewDashboardSetupHandoff as f, useBlockCustomizeControls as g, usePreviewSiteFontStorageUrl as h, PreviewShellLayout as i, resolvePreviewChromeSurface as l, resolvePreviewSidebarChromeModel as m, SdkPreviewModeRuntime_exports as n, PREVIEW_CHROME_PORTAL_CLASS_NAME as o, resolvePreviewEditorGuidanceModel as p, PreviewShell as r, PREVIEW_CHROME_THEME_CLASS_NAME as s, SdkPreviewModeRuntime as t, canInspectSiteStyle as u, PreviewFormProvider as v, generateFontFaceCss as x, previewWidgetOverrides as y };
13110
+ export { getSiteFontsStorageUrl as C, generateFontFaceCss as S, useBlockCustomizeControls as _, usePreviewPageDesignEditorState as a, previewWidgetOverrides as b, applyPreviewChromeSurfaceToElement as c, canInspectSiteStyle as d, buildPreviewDashboardSetupUrl as f, usePreviewSiteFontStorageUrl as g, resolvePreviewSidebarChromeModel as h, PreviewShellLayout as i, resolvePreviewChromeSurface as l, resolvePreviewEditorGuidanceModel as m, SdkPreviewModeRuntime_exports as n, PREVIEW_CHROME_PORTAL_CLASS_NAME as o, resolvePreviewDashboardSetupHandoff as p, PreviewShell as r, PREVIEW_CHROME_THEME_CLASS_NAME as s, SdkPreviewModeRuntime as t, PREVIEW_THEME_COOKIE_NAME as u, usePreviewBlockCustomizeSelectionOptional as v, FixedBottomSurface as w, buildFontPreviewUrl as x, PreviewFormProvider as y };