@riverbankcms/sdk 0.79.0 → 0.80.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 (160) hide show
  1. package/dist/PreviewEditorSidebar-QZG37QIF.mjs +2655 -0
  2. package/dist/{PreviewEditorUI-27KJVEET.mjs → PreviewEditorUI-AXIKSMZA.mjs} +27 -4
  3. package/dist/SdkPreviewModeRuntime-XE5M4UKM.mjs +8 -0
  4. package/dist/_dts/ai/src/contracts/proposals.d.ts +20 -0
  5. package/dist/_dts/api/src/endpoints.d.ts +24 -0
  6. package/dist/_dts/api/src/index.d.ts +1 -1
  7. package/dist/_dts/api/src/siteInfrastructure.d.ts +124 -0
  8. package/dist/_dts/api/src/siteOnboarding.d.ts +13 -0
  9. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +10 -1
  10. package/dist/_dts/block-form/src/client/index.d.ts +2 -0
  11. package/dist/_dts/block-form/src/index.d.ts +2 -0
  12. package/dist/_dts/block-form/src/utils/evaluateVisibility.d.ts +2 -1
  13. package/dist/_dts/blocks/src/client/header.d.ts +1 -1
  14. package/dist/_dts/blocks/src/client.d.ts +12 -12
  15. package/dist/_dts/blocks/src/index.d.ts +1 -1
  16. package/dist/_dts/blocks/src/system/blocks/events/event-listing.d.ts +2 -2
  17. package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +2 -1
  18. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +4 -1
  19. package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +7 -1
  20. package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +21 -12
  21. package/dist/_dts/blocks/src/system/fields/boxStyles.d.ts +4 -2
  22. package/dist/_dts/blocks/src/system/fragments/library/faqHeading.d.ts +1 -0
  23. package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +5 -0
  24. package/dist/_dts/blocks/src/system/node/fragments/headingDecoration.d.ts +1 -4
  25. package/dist/_dts/blocks/src/system/node/validation-constants.d.ts +1 -1
  26. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +7 -7
  27. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +3 -3
  28. package/dist/_dts/blocks/src/system/runtime/header/enhanceHeaderSection.d.ts +10 -2
  29. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.interactive.d.ts +5 -5
  30. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.server.d.ts +2 -2
  31. package/dist/_dts/blocks/src/system/runtime/nodes/events/EventSpotlight.d.ts +2 -2
  32. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.d.ts +2 -2
  33. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventDetailModal.d.ts +2 -2
  34. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventModals.d.ts +2 -2
  35. package/dist/_dts/blocks/src/system/runtime/nodes/header-section.client.d.ts +2 -2
  36. package/dist/_dts/blocks/src/system/transforms/registry/boxStyles.d.ts +3 -0
  37. package/dist/_dts/blocks/src/system/transforms/registry/layout.d.ts +9 -0
  38. package/dist/_dts/blocks/src/system/transforms/typed.d.ts +14 -1
  39. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +9 -3
  40. package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +2 -6
  41. package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +2 -6
  42. package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +2 -6
  43. package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +2 -6
  44. package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +6 -4
  45. package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +2 -6
  46. package/dist/_dts/editor-blocks/src/index.d.ts +2 -0
  47. package/dist/_dts/preview-next/src/client/blocks/BlockToolbar.d.ts +5 -1
  48. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeControlPlan.d.ts +24 -0
  49. package/dist/_dts/preview-next/src/client/blocks/useBlockCustomizeControls.d.ts +34 -0
  50. package/dist/_dts/preview-next/src/client/preview/PageBlockEditorPanel.d.ts +2 -5
  51. package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +4 -1
  52. package/dist/_dts/preview-next/src/client/preview/PreviewBlockCustomizeSelectionContext.d.ts +20 -0
  53. package/dist/_dts/preview-next/src/client/preview/PreviewOpenEditorButton.d.ts +2 -0
  54. package/dist/_dts/preview-next/src/client/preview/SelectedBlockCustomizePanel.d.ts +13 -0
  55. package/dist/_dts/preview-next/src/client/preview/previewCustomizeEditorDraftPatch.d.ts +13 -0
  56. package/dist/_dts/preview-next/src/client/preview/previewCustomizeRuntimePatch.d.ts +2 -0
  57. package/dist/_dts/preview-next/src/client/preview/storeTypes.d.ts +4 -0
  58. package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +3 -1
  59. package/dist/_dts/sdk/src/cli/commands/webhooks.d.ts +44 -0
  60. package/dist/_dts/sdk/src/client/management/index.d.ts +1 -1
  61. package/dist/_dts/sdk/src/client/management/types.d.ts +56 -0
  62. package/dist/_dts/sdk/src/client/management/webhooks.d.ts +3 -0
  63. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +6 -3
  64. package/dist/_dts/sdk/src/version.d.ts +1 -1
  65. package/dist/_dts/theme-core/src/accordions/siteStyleDefaults.d.ts +220 -0
  66. package/dist/_dts/theme-core/src/accordions/types.d.ts +45 -2
  67. package/dist/_dts/theme-core/src/blockOverrides.d.ts +8 -0
  68. package/dist/_dts/theme-core/src/blocks/types.d.ts +1 -1
  69. package/dist/_dts/theme-core/src/blocks/vars/testimonials.d.ts +4 -1
  70. package/dist/_dts/theme-core/src/buttons/personalities/types.d.ts +1 -1
  71. package/dist/_dts/theme-core/src/cards/core.d.ts +20 -0
  72. package/dist/_dts/theme-core/src/cards/generateDefaultCardSystem.d.ts +6 -3
  73. package/dist/_dts/theme-core/src/cards/siteStyleDefaults.d.ts +105 -0
  74. package/dist/_dts/theme-core/src/cards/types.d.ts +177 -0
  75. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  76. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +156 -18
  77. package/dist/_dts/theme-core/src/palette/variants/index.d.ts +15 -0
  78. package/dist/_dts/theme-core/src/palette/variants/soft-natural.d.ts +16 -0
  79. package/dist/_dts/theme-core/src/palette/variants/types.d.ts +1 -1
  80. package/dist/_dts/theme-core/src/schema.d.ts +446 -52
  81. package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +86 -17
  82. package/dist/_dts/theme-core/src/site-styles/appearancePresetTypes.d.ts +2 -3
  83. package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +86 -17
  84. package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +110 -1
  85. package/dist/_dts/theme-core/src/site-styles/footerLooks.d.ts +20 -1
  86. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -0
  87. package/dist/_dts/theme-core/src/site-styles/headerLooks.d.ts +286 -6
  88. package/dist/_dts/theme-core/src/site-styles/index.d.ts +2 -0
  89. package/dist/_dts/theme-core/src/site-styles/logoBranding.d.ts +193 -0
  90. package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +2 -8
  91. package/dist/_dts/theme-core/src/site-styles/rawStyleFields.d.ts +2 -0
  92. package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +10 -7
  93. package/dist/_dts/theme-core/src/site-styles/siteStyleThemeCompiler.d.ts +11 -0
  94. package/dist/_dts/theme-core/src/site-styles/sourceCatalogs.d.ts +2 -2
  95. package/dist/_dts/theme-core/src/site-styles/styleTags.d.ts +1 -1
  96. package/dist/_dts/theme-core/src/site-styles/testimonialQuotePresets.d.ts +15 -0
  97. package/dist/_dts/theme-core/src/site-styles/tokenRecipes.d.ts +1 -1
  98. package/dist/_dts/theme-core/src/site-styles/types.d.ts +7 -29
  99. package/dist/{PreviewEditorSidebar-56NMJMIK.mjs → chunk-5NZGBSJF.mjs} +1423 -2451
  100. package/dist/{chunk-4HCW7FHJ.mjs → chunk-7PCYG6YV.mjs} +215 -137
  101. package/dist/{chunk-K2IIF34C.mjs → chunk-BBLZSQEY.mjs} +24 -0
  102. package/dist/{chunk-V47ZU33I.mjs → chunk-GYXKAUFV.mjs} +2785 -785
  103. package/dist/{chunk-GP555I66.mjs → chunk-HTB4BMKD.mjs} +94 -46
  104. package/dist/{chunk-A3HHFKVT.mjs → chunk-MPBNEVPB.mjs} +1 -1
  105. package/dist/cli/index.mjs +2100 -545
  106. package/dist/cli/init-docs/content/workflow-isr-revalidation.md +16 -4
  107. package/dist/client/{accordion-QLA7KBYO.mjs → accordion-QFZMNB7O.mjs} +1 -1
  108. package/dist/client/{bookingForm-PYZIPA5G.mjs → bookingForm-NCIXFWIG.mjs} +3 -3
  109. package/dist/client/bookings.mjs +1144 -329
  110. package/dist/client/{carousel-5EIULWBI.mjs → carousel-EO4BJMWD.mjs} +2 -2
  111. package/dist/client/{cart-DOP3FNI4.mjs → cart-FTYCLYUW.mjs} +5 -5
  112. package/dist/client/{checkout-BVMF6FBV.mjs → checkout-NFGLVCOX.mjs} +5 -5
  113. package/dist/client/{chunk-TYONZMST.mjs → chunk-4W66ALYT.mjs} +1 -1
  114. package/dist/client/{chunk-44K2U3QI.mjs → chunk-6GVVWSPU.mjs} +4 -4
  115. package/dist/client/{chunk-UDS3NTWA.mjs → chunk-IWFZSQNZ.mjs} +1 -1
  116. package/dist/client/{chunk-R5ESWNKX.mjs → chunk-PUOELU4O.mjs} +89 -5
  117. package/dist/client/{chunk-YLDYVRZL.mjs → chunk-PYRBIURC.mjs} +4 -4
  118. package/dist/client/{chunk-GG4M2NP6.mjs → chunk-T6UIP6UZ.mjs} +1 -1
  119. package/dist/client/{chunk-V6M5FCR5.mjs → chunk-VDS5YFLX.mjs} +1 -1
  120. package/dist/client/{chunk-CCNTDRCF.mjs → chunk-Y37KDO7P.mjs} +1 -1
  121. package/dist/client/client.mjs +4205 -2324
  122. package/dist/client/{courseRegistration-E6EAA6NL.mjs → courseRegistration-2EORROPS.mjs} +3 -3
  123. package/dist/client/{eventCalendar-HBG3HAK6.mjs → eventCalendar-WZI4VL6N.mjs} +5 -5
  124. package/dist/client/{eventCombined-6K5ZZWAK.mjs → eventCombined-QCB2TCNL.mjs} +5 -5
  125. package/dist/client/{eventDetails-Q75ICXLT.mjs → eventDetails-TFTATAPH.mjs} +5 -5
  126. package/dist/client/{eventListing-27P5F7DZ.mjs → eventListing-A2CQEHEQ.mjs} +5 -5
  127. package/dist/client/{eventRegistration-IQ7AMASR.mjs → eventRegistration-OELPVLUY.mjs} +5 -5
  128. package/dist/client/{form-JRTD65FN.mjs → form-NTIFD6WQ.mjs} +1 -1
  129. package/dist/client/{headerSection-7FPSSZHS.mjs → headerSection-7TBNKCLA.mjs} +65 -24
  130. package/dist/client/hooks.mjs +3354 -2006
  131. package/dist/client/{locationMap-7NGFNYBH.mjs → locationMap-LRLB5A3H.mjs} +1 -1
  132. package/dist/client/{newsletterForm-F3BADCI2.mjs → newsletterForm-XI52RZSN.mjs} +1 -1
  133. package/dist/client/{productDetail-V3HP7ITJ.mjs → productDetail-GSNKBFLY.mjs} +5 -5
  134. package/dist/client/{productList-L3EGJUF2.mjs → productList-BGCGT4KZ.mjs} +5 -5
  135. package/dist/client/rendering/client.mjs +2570 -1657
  136. package/dist/client/rendering/islands.mjs +18 -18
  137. package/dist/client/rendering.mjs +4275 -2394
  138. package/dist/client/{shop-DQUB5E2C.mjs → shop-RQHUCLNY.mjs} +5 -5
  139. package/dist/preview-next/before-render.mjs +24 -0
  140. package/dist/preview-next/client/runtime.mjs +5 -5
  141. package/dist/preview-next/middleware.mjs +24 -0
  142. package/dist/{sdk-runtime-AF6KXJU4.mjs → sdk-runtime-A4LHT2RS.mjs} +6 -6
  143. package/dist/server/components.mjs +4063 -2293
  144. package/dist/server/config-validation.mjs +3525 -2176
  145. package/dist/server/config.mjs +3525 -2176
  146. package/dist/server/data.mjs +3354 -2006
  147. package/dist/server/index.mjs +25 -1
  148. package/dist/server/next.mjs +4006 -2236
  149. package/dist/server/page-converter.mjs +2747 -1816
  150. package/dist/server/prebuild.mjs +1 -1
  151. package/dist/server/rendering/server.mjs +4063 -2293
  152. package/dist/server/rendering.mjs +4063 -2293
  153. package/dist/server/routing.mjs +3508 -2111
  154. package/dist/server/server.mjs +3372 -2024
  155. package/dist/server/theme-bridge.mjs +1436 -310
  156. package/dist/server/theme.mjs +409 -219
  157. package/dist/styles/index.css +300 -33
  158. package/package.json +1 -1
  159. package/dist/SdkPreviewModeRuntime-H4BSP6E7.mjs +0 -8
  160. package/dist/chunk-LCY32PXF.mjs +0 -1175
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { assertNever2, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, unwrapResponse, useDebouncedLatestSave, applyPageDesignEditorAction, AMBIENT_BACKGROUND_ROLES, unsafeAsEditorBlockId, unsafeAsEditorBlockValues, resolvePreviewSidebarTab, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, createHistoryState, redoHistory, undoHistory, pushHistoryEntry, canRedoHistory, canUndoHistory, backgroundOverrideEquals, planPageDesignLayoutLookCompatibility } from './chunk-V47ZU33I.mjs';
3
- import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-K2IIF34C.mjs';
2
+ import { assertNever2, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, unwrapResponse, useDebouncedLatestSave, applyPageDesignEditorAction, AMBIENT_BACKGROUND_ROLES, resolvePreviewSidebarTab, applyBackgroundOverrideContentPatch, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, unsafeAsEditorBlockId, createHistoryState, redoHistory, undoHistory, pushHistoryEntry, canRedoHistory, canUndoHistory, backgroundOverrideEquals, planPageDesignLayoutLookCompatibility, unsafeAsEditorBlockValues } from './chunk-GYXKAUFV.mjs';
3
+ import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-BBLZSQEY.mjs';
4
4
  import { createContext, useState, useRef, useEffect, useMemo, useContext } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
@@ -746,6 +746,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
746
746
  case "set-layout":
747
747
  return {
748
748
  blockId: action.blockId,
749
+ ownedRuntimeFieldPaths: [],
749
750
  previousContent,
750
751
  nextContent: contentWithLayoutVariant(
751
752
  previousContent,
@@ -765,6 +766,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
765
766
  if (!definition) return null;
766
767
  return {
767
768
  blockId: action.blockId,
769
+ ownedRuntimeFieldPaths: [],
768
770
  previousContent,
769
771
  nextContent: systemCustomizeFacetApplyContentPatch(
770
772
  definition,
@@ -781,6 +783,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
781
783
  case "set-background":
782
784
  return {
783
785
  blockId: action.blockId,
786
+ ownedRuntimeFieldPaths: ["_sectionStyles.background"],
784
787
  previousContent,
785
788
  nextContent: applyBackgroundOverrideContentPatch(
786
789
  previousContent,
@@ -832,6 +835,84 @@ function contentWithPreviousBackground(currentContent, previousContent) {
832
835
  function isRecord(value) {
833
836
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
834
837
  }
838
+
839
+ // ../preview-next/src/client/preview/previewCustomizeEditorDraftPatch.ts
840
+ function applyPreviewCustomizeDraftPatch(uiStore, patch, editorModel) {
841
+ return replaceLocalBlockContentWithoutHistory({
842
+ uiStore,
843
+ targetBlockId: patch.blockId,
844
+ nextContent: patch.nextContent,
845
+ previousContent: patch.previousContent,
846
+ editorModel
847
+ });
848
+ }
849
+ function rollbackPreviewCustomizeDraftPatch(uiStore, patch) {
850
+ if (!patch) return { kind: "missing-current-content" };
851
+ const currentContent = currentLocalBlockContent(uiStore, patch.blockId);
852
+ if (!currentContent) return { kind: "missing-current-content" };
853
+ return replaceLocalBlockContentWithoutHistory({
854
+ uiStore,
855
+ targetBlockId: patch.blockId,
856
+ nextContent: patch.rollback(currentContent),
857
+ previousContent: patch.previousContent,
858
+ editorModel: null
859
+ });
860
+ }
861
+ function currentLocalBlockContent(uiStore, targetBlockId) {
862
+ const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
863
+ return isRecord2(current) ? current : null;
864
+ }
865
+ function replaceLocalBlockContentWithoutHistory(input) {
866
+ const editorBlockId = unsafeAsEditorBlockId(input.targetBlockId);
867
+ const history = input.uiStore.getState().history;
868
+ const snapshot = history.getState().present;
869
+ const draft = snapshot.drafts[editorBlockId];
870
+ const nextDraft = draft ? applyDraftContentPatch(draft, input.nextContent) : localRuntimeDraftForBlock({
871
+ editorBlockId,
872
+ targetBlockId: input.targetBlockId,
873
+ editorModel: input.editorModel,
874
+ previousContent: input.previousContent,
875
+ nextContent: input.nextContent
876
+ });
877
+ if (!nextDraft) return { kind: "missing-block-model" };
878
+ history.restorePresent({
879
+ ...snapshot,
880
+ drafts: {
881
+ ...snapshot.drafts,
882
+ [editorBlockId]: nextDraft
883
+ }
884
+ });
885
+ return { kind: "applied" };
886
+ }
887
+ function applyDraftContentPatch(draft, nextContent) {
888
+ return {
889
+ ...draft,
890
+ version: draft.version + 1,
891
+ current: unsafeAsEditorBlockValues(nextContent)
892
+ };
893
+ }
894
+ function localRuntimeDraftForBlock(input) {
895
+ const block = input.editorModel?.blocks.find(
896
+ (candidate) => candidate.blockId === input.targetBlockId
897
+ ) ?? null;
898
+ if (!block) return null;
899
+ return {
900
+ id: input.editorBlockId,
901
+ version: 1,
902
+ baseline: unsafeAsEditorBlockValues(input.previousContent),
903
+ current: unsafeAsEditorBlockValues(input.nextContent),
904
+ syncState: { kind: "pending" },
905
+ meta: {
906
+ kind: block.blockKind,
907
+ purpose: null,
908
+ orderIndex: null,
909
+ publishedContent: null
910
+ }
911
+ };
912
+ }
913
+ function isRecord2(value) {
914
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
915
+ }
835
916
  var PREVIEW_CUSTOMIZE_STALE_MESSAGE = "This page changed since that design choice. Refresh the preview, then try again.";
836
917
  var PageDesignEditorStateContext = createContext({
837
918
  state: { kind: "unsupported" },
@@ -1002,7 +1083,7 @@ function PreviewPageDesignEditorStateProvider({
1002
1083
  backgroundImagePool,
1003
1084
  backgroundImagePoolStatus,
1004
1085
  loadBackgroundImagePool,
1005
- applyAction: async (action) => {
1086
+ applyAction: async (action, options) => {
1006
1087
  if (!enabled) return skippedPreviewCustomizeOutcome("disabled");
1007
1088
  if (!pageId) return skippedPreviewCustomizeOutcome("missing-page");
1008
1089
  const previousWorkflow = workflowState;
@@ -1010,7 +1091,12 @@ function PreviewPageDesignEditorStateProvider({
1010
1091
  if (begin.kind === "skipped") return begin;
1011
1092
  const previousPageState = previewCustomizeWorkflowPageState(previousWorkflow);
1012
1093
  if (previousPageState.kind === "loaded" && uiStore) {
1013
- applyLocalRuntimePatch(uiStore, action, previousPageState.editorModel);
1094
+ applyLocalRuntimePatch(
1095
+ uiStore,
1096
+ action,
1097
+ previousPageState.editorModel,
1098
+ options?.runtimeContent ?? null
1099
+ );
1014
1100
  }
1015
1101
  setWorkflowState(begin.state);
1016
1102
  autosave.trigger();
@@ -1205,35 +1291,21 @@ function classifyApplyActionError(error) {
1205
1291
  function usePreviewPageDesignEditorState() {
1206
1292
  return useContext(PageDesignEditorStateContext);
1207
1293
  }
1208
- function applyLocalRuntimePatch(uiStore, action, editorModel) {
1294
+ function applyLocalRuntimePatch(uiStore, action, editorModel, fallbackContent = null) {
1209
1295
  if (classifyPreviewCustomizeActionDomain(action).kind !== "block-content-write") {
1210
1296
  return null;
1211
1297
  }
1212
1298
  const patch = derivePreviewCustomizeRuntimePatch({
1213
1299
  action,
1214
1300
  editorModel,
1215
- currentContent: currentLocalBlockContent(
1216
- uiStore,
1217
- blockIdForRuntimePatch(action)
1218
- )
1301
+ currentContent: currentLocalBlockContent(uiStore, blockIdForRuntimePatch(action)) ?? fallbackContent
1219
1302
  });
1220
1303
  if (!patch) return null;
1221
- replaceLocalBlockContentWithoutHistory(
1222
- uiStore,
1223
- patch.blockId,
1224
- patch.nextContent
1225
- );
1304
+ applyPreviewCustomizeDraftPatch(uiStore, patch, editorModel);
1226
1305
  return patch;
1227
1306
  }
1228
1307
  function rollbackLocalRuntimePatch(uiStore, patch) {
1229
- if (!patch) return;
1230
- const currentContent = currentLocalBlockContent(uiStore, patch.blockId);
1231
- if (!currentContent) return;
1232
- replaceLocalBlockContentWithoutHistory(
1233
- uiStore,
1234
- patch.blockId,
1235
- patch.rollback(currentContent)
1236
- );
1308
+ rollbackPreviewCustomizeDraftPatch(uiStore, patch);
1237
1309
  }
1238
1310
  function blockIdForRuntimePatch(action) {
1239
1311
  switch (action.kind) {
@@ -1249,30 +1321,6 @@ function blockIdForRuntimePatch(action) {
1249
1321
  return assertNever2(action, "Unhandled runtime patch action");
1250
1322
  }
1251
1323
  }
1252
- function currentLocalBlockContent(uiStore, targetBlockId) {
1253
- const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
1254
- return isRecord2(current) ? current : null;
1255
- }
1256
- function replaceLocalBlockContentWithoutHistory(uiStore, targetBlockId, nextContent) {
1257
- const editorBlockId = unsafeAsEditorBlockId(targetBlockId);
1258
- const history = uiStore.getState().history;
1259
- const snapshot = history.getState().present;
1260
- const draft = snapshot.drafts[editorBlockId];
1261
- if (!draft) return;
1262
- history.restorePresent({
1263
- ...snapshot,
1264
- drafts: {
1265
- ...snapshot.drafts,
1266
- [editorBlockId]: {
1267
- ...draft,
1268
- current: unsafeAsEditorBlockValues(nextContent)
1269
- }
1270
- }
1271
- });
1272
- }
1273
- function isRecord2(value) {
1274
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1275
- }
1276
1324
 
1277
1325
  // ../preview-next/src/client/preview/previewChromeSurface.ts
1278
1326
  var PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { ApiRequestError, markPreviewAuthExpired } from './chunk-K2IIF34C.mjs';
2
+ import { ApiRequestError, markPreviewAuthExpired } from './chunk-BBLZSQEY.mjs';
3
3
  import { createContext, useContext, useRef } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5
  import { QueryClient, MutationCache, QueryCache, QueryClientProvider } from '@tanstack/react-query';