@riverbankcms/sdk 0.78.2 → 0.79.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 (159) hide show
  1. package/README.md +80 -0
  2. package/dist/{PreviewEditorSidebar-4DXLYX2V.mjs → PreviewEditorSidebar-56NMJMIK.mjs} +724 -47
  3. package/dist/{PreviewEditorUI-CS5P4N3P.mjs → PreviewEditorUI-27KJVEET.mjs} +3 -3
  4. package/dist/SdkPreviewModeRuntime-H4BSP6E7.mjs +8 -0
  5. package/dist/_dts/ai/src/contracts/proposals.d.ts +36 -0
  6. package/dist/_dts/api/src/endpoints.d.ts +55 -0
  7. package/dist/_dts/api/src/index.d.ts +5 -3
  8. package/dist/_dts/api/src/media.d.ts +8 -1
  9. package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +1 -1
  10. package/dist/_dts/api/src/navigation/dashboardSiteNav.d.ts +8 -8
  11. package/dist/_dts/api/src/navigation/identity.d.ts +59 -0
  12. package/dist/_dts/api/src/navigation.d.ts +2 -0
  13. package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +4 -0
  14. package/dist/_dts/api/src/sdkContracts.d.ts +1 -0
  15. package/dist/_dts/api/src/siteIcons.d.ts +128 -0
  16. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +16 -0
  17. package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +7 -0
  18. package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +6 -1
  19. package/dist/_dts/api/src/types.d.ts +1 -1
  20. package/dist/_dts/api/src/webhooks.d.ts +239 -0
  21. package/dist/_dts/blocks/src/index.d.ts +4 -0
  22. package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +288 -288
  23. package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +288 -288
  24. package/dist/_dts/blocks/src/system/blocks/cart.d.ts +288 -288
  25. package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +288 -288
  26. package/dist/_dts/blocks/src/system/blocks/collection.d.ts +288 -288
  27. package/dist/_dts/blocks/src/system/blocks/faq.d.ts +294 -289
  28. package/dist/_dts/blocks/src/system/blocks/feature-card-icons.d.ts +57 -0
  29. package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +4 -0
  30. package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +288 -288
  31. package/dist/_dts/blocks/src/system/blocks/index.d.ts +1 -0
  32. package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +1 -1
  33. package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +22 -22
  34. package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +288 -288
  35. package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +288 -288
  36. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +288 -288
  37. package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +7 -1
  38. package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +170 -0
  39. package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +5 -0
  40. package/dist/_dts/blocks/src/system/helpers/resolveBackground.d.ts +3 -1
  41. package/dist/_dts/blocks/src/system/icons/ids.d.ts +13 -0
  42. package/dist/_dts/blocks/src/system/icons/index.d.ts +6 -0
  43. package/dist/_dts/blocks/src/system/icons/presets.d.ts +4 -0
  44. package/dist/_dts/blocks/src/system/icons/registry.d.ts +18 -0
  45. package/dist/_dts/blocks/src/system/icons/semantic.d.ts +239 -0
  46. package/dist/_dts/blocks/src/system/icons/value.d.ts +94 -0
  47. package/dist/_dts/blocks/src/system/index.d.ts +1 -0
  48. package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +4 -1
  49. package/dist/_dts/blocks/src/system/manifest/schema.d.ts +23 -0
  50. package/dist/_dts/blocks/src/system/runtime/nodes/feature-card-icon.d.ts +13 -0
  51. package/dist/_dts/content-model/src/contentManifest.d.ts +3 -1
  52. package/dist/_dts/core/src/branded.d.ts +6 -0
  53. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +191 -0
  54. package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +12 -1
  55. package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +12 -1
  56. package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +12 -2
  57. package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +21 -0
  58. package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +40 -0
  59. package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +11 -1
  60. package/dist/_dts/editor-blocks/src/block-editor/featureCardIconActions.d.ts +82 -0
  61. package/dist/_dts/editor-blocks/src/widgets/icon-picker/IconPickerField.d.ts +1 -1
  62. package/dist/_dts/media-core/src/fileDomain.d.ts +8 -1
  63. package/dist/_dts/media-editor/src/MediaEditor.d.ts +3 -2
  64. package/dist/_dts/media-react/src/components/MediaLibrary.d.ts +2 -1
  65. package/dist/_dts/media-react/src/components/MediaPickerMini.d.ts +2 -1
  66. package/dist/_dts/preview-next/src/client/blocks/previewCustomizeActions.d.ts +17 -0
  67. package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +4 -0
  68. package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +3 -2
  69. package/dist/_dts/preview-next/src/client/preview/previewCustomizeHistory.d.ts +6 -0
  70. package/dist/_dts/sdk/src/cli/navigationIdentity.d.ts +11 -0
  71. package/dist/_dts/sdk/src/cli/site-commands/navigationCommands.d.ts +4 -0
  72. package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +1 -0
  73. package/dist/_dts/sdk/src/cli/sync/diff.d.ts +9 -0
  74. package/dist/_dts/sdk/src/client/management/types.d.ts +2 -0
  75. package/dist/_dts/sdk/src/config/field-definitions.d.ts +3 -1
  76. package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
  77. package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +19 -2
  78. package/dist/_dts/sdk/src/next/index.d.ts +1 -1
  79. package/dist/_dts/sdk/src/next/revalidate.d.ts +26 -5
  80. package/dist/_dts/sdk/src/next/static-params.d.ts +28 -3
  81. package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -1
  82. package/dist/_dts/sdk/src/public-api/runtime.d.ts +1 -1
  83. package/dist/_dts/sdk/src/version.d.ts +1 -1
  84. package/dist/_dts/sdk/src/webhooks/index.d.ts +1 -1
  85. package/dist/_dts/sdk/src/webhooks/verify.d.ts +6 -102
  86. package/dist/_dts/site-commands/src/commands.d.ts +3 -0
  87. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  88. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +3 -3
  89. package/dist/_dts/theme-core/src/schema.d.ts +5 -5
  90. package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +25 -2
  91. package/dist/_dts/theme-core/src/site-styles/designState.d.ts +5 -5
  92. package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +4 -2
  93. package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +4 -4
  94. package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -0
  95. package/dist/_dts/ui/src/combobox.d.ts +1 -0
  96. package/dist/{chunk-RGTOD4AJ.mjs → chunk-4HCW7FHJ.mjs} +491 -56
  97. package/dist/{chunk-OKMBEAXY.mjs → chunk-A3HHFKVT.mjs} +1 -1
  98. package/dist/{chunk-6HYXHRAI.mjs → chunk-GP555I66.mjs} +177 -7
  99. package/dist/{chunk-CR5HKAGU.mjs → chunk-K2IIF34C.mjs} +55 -0
  100. package/dist/{chunk-4QEGTLK6.mjs → chunk-LCY32PXF.mjs} +1 -1
  101. package/dist/{chunk-MCRQMPET.mjs → chunk-V47ZU33I.mjs} +1745 -157
  102. package/dist/cli/index.mjs +1169 -171
  103. package/dist/cli/init-docs/content/workflow-editor-workflows.md +2 -0
  104. package/dist/cli/init-docs/content/workflow-isr-revalidation.md +138 -0
  105. package/dist/client/{accordion-PLYNJIIM.mjs → accordion-QLA7KBYO.mjs} +1 -1
  106. package/dist/client/{bookingForm-BXAP6AO7.mjs → bookingForm-PYZIPA5G.mjs} +3 -3
  107. package/dist/client/bookings.mjs +110 -2
  108. package/dist/client/{carousel-TRBXDHGF.mjs → carousel-5EIULWBI.mjs} +2 -2
  109. package/dist/client/{cart-Z7H3HJRS.mjs → cart-DOP3FNI4.mjs} +5 -5
  110. package/dist/client/{checkout-WAFCUBIX.mjs → checkout-BVMF6FBV.mjs} +5 -5
  111. package/dist/client/{chunk-JRDUHZCT.mjs → chunk-44K2U3QI.mjs} +4 -4
  112. package/dist/client/{chunk-UVQEJJTN.mjs → chunk-CCNTDRCF.mjs} +1 -1
  113. package/dist/client/{chunk-ZI3LLBPZ.mjs → chunk-GG4M2NP6.mjs} +1 -1
  114. package/dist/client/{chunk-JGXPTEI2.mjs → chunk-R5ESWNKX.mjs} +6 -3
  115. package/dist/client/{chunk-CWGTG37I.mjs → chunk-TYONZMST.mjs} +1 -1
  116. package/dist/client/{chunk-75OUS5MT.mjs → chunk-UDS3NTWA.mjs} +1 -1
  117. package/dist/client/{chunk-DNRGY432.mjs → chunk-V6M5FCR5.mjs} +1 -1
  118. package/dist/client/{chunk-FUXW6VW2.mjs → chunk-YLDYVRZL.mjs} +4 -4
  119. package/dist/client/client.mjs +21329 -19729
  120. package/dist/client/{courseRegistration-AHFQHWIJ.mjs → courseRegistration-E6EAA6NL.mjs} +3 -3
  121. package/dist/client/{eventCalendar-LDXTV5R7.mjs → eventCalendar-HBG3HAK6.mjs} +5 -5
  122. package/dist/client/{eventCombined-A4JGTNJO.mjs → eventCombined-6K5ZZWAK.mjs} +5 -5
  123. package/dist/client/{eventDetails-4YXTZ7EG.mjs → eventDetails-Q75ICXLT.mjs} +5 -5
  124. package/dist/client/{eventListing-P72TPFFM.mjs → eventListing-27P5F7DZ.mjs} +5 -5
  125. package/dist/client/{eventRegistration-LSYJHGMT.mjs → eventRegistration-IQ7AMASR.mjs} +5 -5
  126. package/dist/client/{form-AOPYOKOW.mjs → form-JRTD65FN.mjs} +1 -1
  127. package/dist/client/{headerSection-5TFYDFVQ.mjs → headerSection-7FPSSZHS.mjs} +2 -2
  128. package/dist/client/hooks.mjs +350 -35
  129. package/dist/client/{locationMap-QSZ3ZVAZ.mjs → locationMap-7NGFNYBH.mjs} +1 -1
  130. package/dist/client/{newsletterForm-KTRHZY52.mjs → newsletterForm-F3BADCI2.mjs} +1 -1
  131. package/dist/client/{productDetail-N4E775RG.mjs → productDetail-V3HP7ITJ.mjs} +5 -5
  132. package/dist/client/{productList-UGUQ2S45.mjs → productList-L3EGJUF2.mjs} +5 -5
  133. package/dist/client/rendering/client.mjs +2713 -1382
  134. package/dist/client/rendering/islands.mjs +18 -18
  135. package/dist/client/rendering.mjs +2014 -414
  136. package/dist/client/{shop-VHSZEEQ2.mjs → shop-DQUB5E2C.mjs} +5 -5
  137. package/dist/preview-next/before-render.mjs +55 -0
  138. package/dist/preview-next/client/runtime.mjs +5 -5
  139. package/dist/preview-next/middleware.mjs +55 -0
  140. package/dist/{sdk-runtime-WHPJEF5G.mjs → sdk-runtime-AF6KXJU4.mjs} +6 -6
  141. package/dist/server/components.mjs +2169 -781
  142. package/dist/server/config-validation.mjs +350 -35
  143. package/dist/server/config.mjs +350 -35
  144. package/dist/server/data.mjs +350 -35
  145. package/dist/server/index.mjs +64 -1
  146. package/dist/server/next/revalidate.mjs +229 -34
  147. package/dist/server/next.mjs +2307 -818
  148. package/dist/server/page-converter.mjs +275 -34
  149. package/dist/server/prebuild.mjs +1 -1
  150. package/dist/server/rendering/server.mjs +2174 -786
  151. package/dist/server/rendering.mjs +2187 -799
  152. package/dist/server/routing.mjs +767 -50
  153. package/dist/server/server.mjs +351 -36
  154. package/dist/server/theme-bridge.mjs +164 -2
  155. package/dist/server/theme.mjs +2 -2
  156. package/dist/server/webhooks.mjs +129 -25
  157. package/dist/styles/index.css +55 -0
  158. package/package.json +2 -1
  159. package/dist/SdkPreviewModeRuntime-IJDHTW4W.mjs +0 -8
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { assertNever2, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, useDebouncedLatestSave, applyPageDesignEditorAction, unsafeAsEditorBlockId, unsafeAsEditorBlockValues, resolvePreviewSidebarTab, systemCustomizeFacetDefinitionForBlock, systemCustomizeFacetRollbackContentPatch, systemCustomizeFacetApplyContentPatch, createHistoryState, redoHistory, undoHistory, pushHistoryEntry, canRedoHistory, canUndoHistory, planPageDesignLayoutLookCompatibility } from './chunk-MCRQMPET.mjs';
3
- import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-CR5HKAGU.mjs';
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';
4
4
  import { createContext, useState, useRef, useEffect, useMemo, useContext } from 'react';
5
5
  import { jsx } from 'react/jsx-runtime';
6
6
 
@@ -86,6 +86,21 @@ function previewCustomizeHistoryEntryFromAction(editorModel, action) {
86
86
  toValue: action.value
87
87
  };
88
88
  }
89
+ case "set-background": {
90
+ const block = editorModel.blocks.find(
91
+ (candidate) => candidate.blockId === action.blockId
92
+ ) ?? null;
93
+ if (!block) return null;
94
+ if (backgroundOverrideEquals(action.fromOverride, action.override)) {
95
+ return null;
96
+ }
97
+ return {
98
+ kind: "background",
99
+ blockId: action.blockId,
100
+ fromOverride: action.fromOverride,
101
+ toOverride: action.override
102
+ };
103
+ }
89
104
  case "set-boundary":
90
105
  case "reset-boundary": {
91
106
  const boundary = editorModel.boundaries.find(
@@ -146,6 +161,17 @@ function previewCustomizeActionForEntryValue(entry, valueKey, editorModel) {
146
161
  baseContentId: contentRevisionIdForBlock(editorModel, entry.blockId)
147
162
  };
148
163
  }
164
+ case "background": {
165
+ const override = valueKey === "from" ? entry.fromOverride : entry.toOverride;
166
+ const fromOverride = valueKey === "from" ? entry.toOverride : entry.fromOverride;
167
+ return {
168
+ kind: "set-background",
169
+ blockId: entry.blockId,
170
+ override,
171
+ fromOverride,
172
+ baseContentId: contentRevisionIdForBlock(editorModel, entry.blockId)
173
+ };
174
+ }
149
175
  case "boundary": {
150
176
  const boundaryOptionId = valueKey === "from" ? entry.fromBoundaryOptionId : entry.toBoundaryOptionId;
151
177
  return boundaryOptionId ? {
@@ -182,6 +208,7 @@ function previewCustomizeHistoryEntryStillApplies(entry, editorModel) {
182
208
  case "layout":
183
209
  case "look":
184
210
  case "block-facet":
211
+ case "background":
185
212
  return editorModel.blocks.some((block) => block.blockId === entry.blockId);
186
213
  case "boundary":
187
214
  return editorModel.boundaries.some(
@@ -201,6 +228,8 @@ function previewCustomizeHistoryEntryEquals(left, right) {
201
228
  return right.kind === "look" && left.blockId === right.blockId && left.fromAppearancePresetId === right.fromAppearancePresetId && left.toAppearancePresetId === right.toAppearancePresetId;
202
229
  case "block-facet":
203
230
  return right.kind === "block-facet" && left.blockId === right.blockId && left.facetId === right.facetId && left.fromValue === right.fromValue && left.toValue === right.toValue;
231
+ case "background":
232
+ return right.kind === "background" && left.blockId === right.blockId && backgroundOverrideEquals(left.fromOverride, right.fromOverride) && backgroundOverrideEquals(left.toOverride, right.toOverride);
204
233
  case "boundary":
205
234
  return right.kind === "boundary" && left.boundaryId === right.boundaryId && left.previousBlockId === right.previousBlockId && left.nextBlockId === right.nextBlockId && left.fromBoundaryOptionId === right.fromBoundaryOptionId && left.toBoundaryOptionId === right.toBoundaryOptionId;
206
235
  default:
@@ -558,6 +587,8 @@ function sameCustomizeTarget(left, right) {
558
587
  return right.kind === "set-look" && left.blockId === right.blockId;
559
588
  case "set-block-facet":
560
589
  return right.kind === "set-block-facet" && left.blockId === right.blockId && left.facetId === right.facetId;
590
+ case "set-background":
591
+ return right.kind === "set-background" && left.blockId === right.blockId;
561
592
  case "set-boundary":
562
593
  case "reset-boundary":
563
594
  return (right.kind === "set-boundary" || right.kind === "reset-boundary") && left.previousBlockId === right.previousBlockId && left.nextBlockId === right.nextBlockId;
@@ -615,6 +646,7 @@ function applyPreviewCustomizeActionToLoadedState(state, action) {
615
646
  }
616
647
  };
617
648
  case "set-block-facet":
649
+ case "set-background":
618
650
  return state;
619
651
  case "set-boundary":
620
652
  case "reset-boundary":
@@ -695,6 +727,7 @@ function classifyPreviewCustomizeActionDomain(action) {
695
727
  switch (action.kind) {
696
728
  case "set-layout":
697
729
  case "set-block-facet":
730
+ case "set-background":
698
731
  return { kind: "block-content-write" };
699
732
  case "set-look":
700
733
  case "set-boundary":
@@ -745,6 +778,16 @@ function derivePreviewCustomizeRuntimePatch(input) {
745
778
  )
746
779
  };
747
780
  }
781
+ case "set-background":
782
+ return {
783
+ blockId: action.blockId,
784
+ previousContent,
785
+ nextContent: applyBackgroundOverrideContentPatch(
786
+ previousContent,
787
+ action.override
788
+ ),
789
+ rollback: (currentContent) => contentWithPreviousBackground(currentContent, previousContent)
790
+ };
748
791
  case "set-look":
749
792
  return null;
750
793
  case "set-boundary":
@@ -767,11 +810,36 @@ function contentWithPreviousLayoutVariant(currentContent, previousContent) {
767
810
  }
768
811
  return nextContent;
769
812
  }
813
+ function contentWithPreviousBackground(currentContent, previousContent) {
814
+ const previousSectionStyles = isRecord(previousContent._sectionStyles) ? previousContent._sectionStyles : {};
815
+ const currentSectionStyles = isRecord(currentContent._sectionStyles) ? currentContent._sectionStyles : {};
816
+ const nextSectionStyles = { ...currentSectionStyles };
817
+ if (Object.prototype.hasOwnProperty.call(previousSectionStyles, "background")) {
818
+ nextSectionStyles.background = previousSectionStyles.background;
819
+ } else {
820
+ delete nextSectionStyles.background;
821
+ }
822
+ if (Object.keys(nextSectionStyles).length > 0) {
823
+ return {
824
+ ...currentContent,
825
+ _sectionStyles: nextSectionStyles
826
+ };
827
+ }
828
+ const nextContent = { ...currentContent };
829
+ delete nextContent._sectionStyles;
830
+ return nextContent;
831
+ }
832
+ function isRecord(value) {
833
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
834
+ }
770
835
  var PREVIEW_CUSTOMIZE_STALE_MESSAGE = "This page changed since that design choice. Refresh the preview, then try again.";
771
836
  var PageDesignEditorStateContext = createContext({
772
837
  state: { kind: "unsupported" },
773
838
  reload: () => {
774
839
  },
840
+ backgroundImagePool: [],
841
+ backgroundImagePoolStatus: "idle",
842
+ loadBackgroundImagePool: async () => [],
775
843
  applyAction: async () => skippedPreviewCustomizeOutcome("disabled"),
776
844
  undo: async () => skippedPreviewCustomizeOutcome("disabled"),
777
845
  redo: async () => skippedPreviewCustomizeOutcome("disabled"),
@@ -793,7 +861,10 @@ function PreviewPageDesignEditorStateProvider({
793
861
  const [workflowState, setWorkflowState] = useState(
794
862
  unsupportedPreviewCustomizeWorkflowState
795
863
  );
864
+ const [backgroundImagePool, setBackgroundImagePool] = useState([]);
865
+ const [backgroundImagePoolStatus, setBackgroundImagePoolStatus] = useState("idle");
796
866
  const workflowStateRef = useRef(workflowState);
867
+ const backgroundImagePoolRequestRef = useRef(null);
797
868
  const uiStore = useOptionalEditorUiStoreInstance();
798
869
  useEffect(() => {
799
870
  workflowStateRef.current = workflowState;
@@ -801,6 +872,9 @@ function PreviewPageDesignEditorStateProvider({
801
872
  useEffect(() => {
802
873
  if (!enabled || !pageId) {
803
874
  setWorkflowState(unsupportedPreviewCustomizeWorkflowState());
875
+ setBackgroundImagePool([]);
876
+ setBackgroundImagePoolStatus("idle");
877
+ backgroundImagePoolRequestRef.current = null;
804
878
  return;
805
879
  }
806
880
  let cancelled = false;
@@ -827,6 +901,52 @@ function PreviewPageDesignEditorStateProvider({
827
901
  cancelled = true;
828
902
  };
829
903
  }, [apiClient, enabled, pageId, reloadKey, siteId]);
904
+ const loadBackgroundImagePool = useMemo(
905
+ () => async () => {
906
+ if (!enabled || !pageId) return [];
907
+ if (backgroundImagePoolStatus === "loaded") return backgroundImagePool;
908
+ if (backgroundImagePoolRequestRef.current) {
909
+ return backgroundImagePoolRequestRef.current;
910
+ }
911
+ setBackgroundImagePoolStatus("loading");
912
+ const request = apiClient({
913
+ endpoint: "mediaList",
914
+ params: {
915
+ siteId,
916
+ fileFilter: "images",
917
+ limit: "48"
918
+ },
919
+ options: { cache: "no-store" }
920
+ }).then((response) => {
921
+ const result = unwrapResponse(response);
922
+ const nextPool = result.items.map(backgroundImagePoolItemForAsset);
923
+ setBackgroundImagePool(nextPool);
924
+ setBackgroundImagePoolStatus("loaded");
925
+ return nextPool;
926
+ }).catch((error) => {
927
+ setBackgroundImagePoolStatus("failed");
928
+ if (!(error instanceof ApiRequestError)) {
929
+ console.error(
930
+ "[preview-page-design-editor-state] Failed to load background images",
931
+ error
932
+ );
933
+ }
934
+ return [];
935
+ }).finally(() => {
936
+ backgroundImagePoolRequestRef.current = null;
937
+ });
938
+ backgroundImagePoolRequestRef.current = request;
939
+ return request;
940
+ },
941
+ [
942
+ apiClient,
943
+ backgroundImagePool,
944
+ backgroundImagePoolStatus,
945
+ enabled,
946
+ pageId,
947
+ siteId
948
+ ]
949
+ );
830
950
  const autosave = useDebouncedLatestSave({
831
951
  getSnapshot: () => previewCustomizePendingActions(workflowStateRef.current),
832
952
  buildPayload: (actions) => actions,
@@ -879,6 +999,9 @@ function PreviewPageDesignEditorStateProvider({
879
999
  () => ({
880
1000
  state: previewCustomizeWorkflowPageState(workflowState),
881
1001
  reload: () => setReloadKey((current) => current + 1),
1002
+ backgroundImagePool,
1003
+ backgroundImagePoolStatus,
1004
+ loadBackgroundImagePool,
882
1005
  applyAction: async (action) => {
883
1006
  if (!enabled) return skippedPreviewCustomizeOutcome("disabled");
884
1007
  if (!pageId) return skippedPreviewCustomizeOutcome("missing-page");
@@ -971,10 +1094,48 @@ function PreviewPageDesignEditorStateProvider({
971
1094
  isHistoryStale: previewCustomizeIsStale(workflowState),
972
1095
  historyFailure: previewCustomizeFailureMessage(workflowState)
973
1096
  }),
974
- [apiClient, autosave, enabled, pageId, siteId, uiStore, workflowState]
1097
+ [
1098
+ apiClient,
1099
+ autosave,
1100
+ backgroundImagePool,
1101
+ backgroundImagePoolStatus,
1102
+ enabled,
1103
+ loadBackgroundImagePool,
1104
+ pageId,
1105
+ siteId,
1106
+ uiStore,
1107
+ workflowState
1108
+ ]
975
1109
  );
976
1110
  return /* @__PURE__ */ jsx(PageDesignEditorStateContext.Provider, { value, children });
977
1111
  }
1112
+ function backgroundImagePoolItemForAsset(asset) {
1113
+ const backgroundUse = backgroundUseForAsset(asset.fileUses ?? []);
1114
+ return {
1115
+ mediaId: asset.id,
1116
+ source: backgroundUse === null ? "general-media" : backgroundUse === "selected-background" ? "previous-background" : "generated-ambient",
1117
+ label: asset.title || asset.filename,
1118
+ ...isAmbientBackgroundRole(backgroundUse) ? { rank: AMBIENT_BACKGROUND_ROLES.indexOf(backgroundUse) } : {}
1119
+ };
1120
+ }
1121
+ function isAmbientBackgroundRole(value) {
1122
+ return typeof value === "string" && AMBIENT_BACKGROUND_ROLES.includes(value);
1123
+ }
1124
+ function backgroundUseForAsset(fileUses) {
1125
+ const ambientUse = fileUses.find(isAmbientBackgroundFileUse);
1126
+ if (ambientUse) return ambientUse.backgroundUse;
1127
+ const selectedUse = fileUses.find(isSelectedBackgroundFileUse);
1128
+ return selectedUse?.backgroundUse ?? null;
1129
+ }
1130
+ function isAmbientBackgroundFileUse(value) {
1131
+ return isBackgroundFileUse(value) && isAmbientBackgroundRole(value.backgroundUse);
1132
+ }
1133
+ function isSelectedBackgroundFileUse(value) {
1134
+ return isBackgroundFileUse(value) && value.backgroundUse === "selected-background";
1135
+ }
1136
+ function isBackgroundFileUse(value) {
1137
+ return value.tag === "site-background-asset";
1138
+ }
978
1139
  function pageDesignEditorActionForPersistence(action) {
979
1140
  if (action.kind === "reset-boundary") {
980
1141
  return {
@@ -993,6 +1154,13 @@ function pageDesignEditorActionForPersistence(action) {
993
1154
  value: action.value,
994
1155
  baseContentId: action.baseContentId
995
1156
  };
1157
+ case "set-background":
1158
+ return {
1159
+ kind: "set-background",
1160
+ blockId: action.blockId,
1161
+ baseContentId: action.baseContentId,
1162
+ override: action.override
1163
+ };
996
1164
  case "set-layout":
997
1165
  case "set-look":
998
1166
  case "set-boundary":
@@ -1009,6 +1177,7 @@ function actionWithCurrentBaseContentId(action, editorModel) {
1009
1177
  baseContentId: editorModel ? contentRevisionIdForBlock(editorModel, action.blockId) : null
1010
1178
  };
1011
1179
  case "set-block-facet":
1180
+ case "set-background":
1012
1181
  return {
1013
1182
  ...action,
1014
1183
  baseContentId: editorModel ? contentRevisionIdForBlock(editorModel, action.blockId) : null
@@ -1071,6 +1240,7 @@ function blockIdForRuntimePatch(action) {
1071
1240
  case "set-layout":
1072
1241
  case "set-look":
1073
1242
  case "set-block-facet":
1243
+ case "set-background":
1074
1244
  return action.blockId;
1075
1245
  case "set-boundary":
1076
1246
  case "reset-boundary":
@@ -1081,7 +1251,7 @@ function blockIdForRuntimePatch(action) {
1081
1251
  }
1082
1252
  function currentLocalBlockContent(uiStore, targetBlockId) {
1083
1253
  const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
1084
- return isRecord(current) ? current : null;
1254
+ return isRecord2(current) ? current : null;
1085
1255
  }
1086
1256
  function replaceLocalBlockContentWithoutHistory(uiStore, targetBlockId, nextContent) {
1087
1257
  const editorBlockId = unsafeAsEditorBlockId(targetBlockId);
@@ -1100,7 +1270,7 @@ function replaceLocalBlockContentWithoutHistory(uiStore, targetBlockId, nextCont
1100
1270
  }
1101
1271
  });
1102
1272
  }
1103
- function isRecord(value) {
1273
+ function isRecord2(value) {
1104
1274
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1105
1275
  }
1106
1276
 
@@ -1145,7 +1315,7 @@ function applyPreviewChromeSurfaceToElement(element, surface, options) {
1145
1315
  var STORAGE_KEY = "preview-sidebar-tab";
1146
1316
  var REQUEST_EVENT = "riverbank:preview-sidebar:request-open";
1147
1317
  function parsePreviewSidebarOpenRequestDetail(detail) {
1148
- const request = isRecord2(detail) ? detail : {};
1318
+ const request = isRecord3(detail) ? detail : {};
1149
1319
  const tab = request.tab === "assistant" ? "assistant" : "editor";
1150
1320
  return {
1151
1321
  tab: resolvePreviewSidebarTab(tab),
@@ -1177,7 +1347,7 @@ function onPreviewSidebarOpenRequest(handler) {
1177
1347
  window.addEventListener(REQUEST_EVENT, listener);
1178
1348
  return () => window.removeEventListener(REQUEST_EVENT, listener);
1179
1349
  }
1180
- function isRecord2(value) {
1350
+ function isRecord3(value) {
1181
1351
  return typeof value === "object" && value !== null;
1182
1352
  }
1183
1353
  var PREVIEW_SURFACE_PARAM = "preview_surface";
@@ -2435,6 +2435,46 @@ var ENDPOINT_DEFINITIONS = {
2435
2435
  auth: "user",
2436
2436
  responseKind: "json"
2437
2437
  },
2438
+ getSiteIconStyleGuide: {
2439
+ path: "/sites/{siteId}/settings/icon-style-guide",
2440
+ method: "GET",
2441
+ revalidate: 120,
2442
+ tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteSettings],
2443
+ auth: "user",
2444
+ responseKind: "json",
2445
+ errors: []
2446
+ },
2447
+ updateSiteIconStyleGuide: {
2448
+ path: "/sites/{siteId}/settings/icon-style-guide",
2449
+ method: "POST",
2450
+ tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteSettings],
2451
+ auth: "user",
2452
+ responseKind: "json",
2453
+ errors: []
2454
+ },
2455
+ regenerateSiteIconStyleGuide: {
2456
+ path: "/sites/{siteId}/settings/icon-style-guide/regenerate",
2457
+ method: "POST",
2458
+ tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteSettings],
2459
+ auth: "user",
2460
+ responseKind: "json",
2461
+ errors: []
2462
+ },
2463
+ generateGeneratedIconSet: {
2464
+ path: "/sites/{siteId}/ai/generated-icons/generate",
2465
+ method: "POST",
2466
+ auth: "user",
2467
+ responseKind: "json",
2468
+ errors: []
2469
+ },
2470
+ applyGeneratedIconSet: {
2471
+ path: "/sites/{siteId}/ai/generated-icons/apply",
2472
+ method: "POST",
2473
+ tags: [TAG_TEMPLATES.site, TAG_TEMPLATES.siteSettings],
2474
+ auth: "user",
2475
+ responseKind: "json",
2476
+ errors: []
2477
+ },
2438
2478
  getSiteAiProfile: {
2439
2479
  path: "/sites/{siteId}/settings/ai-site-profile",
2440
2480
  method: "GET",
@@ -4210,6 +4250,14 @@ var ENDPOINT_DEFINITIONS = {
4210
4250
  auth: "public",
4211
4251
  responseKind: "json"
4212
4252
  },
4253
+ getGeneratedIconRenderAssets: {
4254
+ path: "/public/sites/{siteId}/generated-icon-assets",
4255
+ method: "POST",
4256
+ tags: [TAG_TEMPLATES.siteRoutableContent],
4257
+ auth: "public",
4258
+ responseKind: "json",
4259
+ errors: []
4260
+ },
4213
4261
  // Resolve entry subroute by kind and URL segment
4214
4262
  resolveEntrySubroute: {
4215
4263
  path: "/public/sites/{siteId}/routing/subroutes/resolve",
@@ -5914,6 +5962,13 @@ var ENDPOINT_DEFINITIONS = {
5914
5962
  auth: "service",
5915
5963
  responseKind: "json"
5916
5964
  },
5965
+ sdkDeleteNavigationMenu: {
5966
+ path: "/sdk/{siteId}/navigation/{menuId}",
5967
+ method: "DELETE",
5968
+ auth: "service",
5969
+ responseKind: "json",
5970
+ errors: ["resource:not_found", "server:internal_error"]
5971
+ },
5917
5972
  sdkUpsertTheme: {
5918
5973
  path: "/sdk/{siteId}/theme",
5919
5974
  method: "POST",
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { assertNever2, deriveNearestCompatibleHeaderStyle, findLegacyHeaderLookIdForSelection, compileSiteThemeFromSelections, footerLookCatalog, getOrderedHeaderStyleIdsForLayout, getOrderedHeaderLayoutIdsForCuration, footerLookRejectionReasonLabel, getHeaderStyle, getHeaderLayout, writePlanForLookCustomizationCommand, siteStyleIdFromTheme, getCuratedSiteStyle } from './chunk-MCRQMPET.mjs';
2
+ import { assertNever2, deriveNearestCompatibleHeaderStyle, findLegacyHeaderLookIdForSelection, compileSiteThemeFromSelections, footerLookCatalog, getOrderedHeaderStyleIdsForLayout, getOrderedHeaderLayoutIdsForCuration, footerLookRejectionReasonLabel, getHeaderStyle, getHeaderLayout, writePlanForLookCustomizationCommand, siteStyleIdFromTheme, getCuratedSiteStyle } from './chunk-V47ZU33I.mjs';
3
3
  import { createContext, useState, useCallback, useMemo, useContext, useRef, useEffect } from 'react';
4
4
  import { jsx } from 'react/jsx-runtime';
5
5