@riverbankcms/sdk 0.78.2 → 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.
- package/README.md +80 -0
- package/dist/PreviewEditorSidebar-QZG37QIF.mjs +2655 -0
- package/dist/{PreviewEditorUI-CS5P4N3P.mjs → PreviewEditorUI-AXIKSMZA.mjs} +27 -4
- package/dist/SdkPreviewModeRuntime-XE5M4UKM.mjs +8 -0
- package/dist/_dts/ai/src/contracts/proposals.d.ts +56 -0
- package/dist/_dts/api/src/endpoints.d.ts +79 -0
- package/dist/_dts/api/src/index.d.ts +6 -4
- package/dist/_dts/api/src/media.d.ts +8 -1
- package/dist/_dts/api/src/navigation/dashboardSettingsNav.d.ts +1 -1
- package/dist/_dts/api/src/navigation/dashboardSiteNav.d.ts +8 -8
- package/dist/_dts/api/src/navigation/identity.d.ts +59 -0
- package/dist/_dts/api/src/navigation.d.ts +2 -0
- package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +4 -0
- package/dist/_dts/api/src/sdkContracts.d.ts +1 -0
- package/dist/_dts/api/src/siteIcons.d.ts +128 -0
- package/dist/_dts/api/src/siteInfrastructure.d.ts +124 -0
- package/dist/_dts/api/src/siteManagementEndpoints.d.ts +16 -0
- package/dist/_dts/api/src/siteOnboarding.d.ts +13 -0
- package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +17 -1
- package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +6 -1
- package/dist/_dts/api/src/types.d.ts +1 -1
- package/dist/_dts/api/src/webhooks.d.ts +239 -0
- package/dist/_dts/block-form/src/client/index.d.ts +2 -0
- package/dist/_dts/block-form/src/index.d.ts +2 -0
- package/dist/_dts/block-form/src/utils/evaluateVisibility.d.ts +2 -1
- package/dist/_dts/blocks/src/client/header.d.ts +1 -1
- package/dist/_dts/blocks/src/client.d.ts +12 -12
- package/dist/_dts/blocks/src/index.d.ts +5 -1
- package/dist/_dts/blocks/src/system/blocks/appointment-booking.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/blog-listing.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/cart.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/checkout.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/collection.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/events/event-listing.d.ts +2 -2
- package/dist/_dts/blocks/src/system/blocks/events/event-spotlight.d.ts +2 -1
- package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +4 -1
- package/dist/_dts/blocks/src/system/blocks/faq.d.ts +294 -289
- package/dist/_dts/blocks/src/system/blocks/feature-card-icons.d.ts +57 -0
- package/dist/_dts/blocks/src/system/blocks/feature-cards.d.ts +4 -0
- package/dist/_dts/blocks/src/system/blocks/gifting.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +22 -22
- package/dist/_dts/blocks/src/system/blocks/product-detail.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/product-list.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/shop.d.ts +288 -288
- package/dist/_dts/blocks/src/system/blocks/testimonials.d.ts +13 -1
- package/dist/_dts/blocks/src/system/customize/backgrounds.d.ts +179 -0
- package/dist/_dts/blocks/src/system/fields/boxStyles.d.ts +4 -2
- package/dist/_dts/blocks/src/system/fragments/library/faqHeading.d.ts +1 -0
- package/dist/_dts/blocks/src/system/fragments/library/testimonialsCarousel.d.ts +10 -0
- package/dist/_dts/blocks/src/system/helpers/resolveBackground.d.ts +3 -1
- package/dist/_dts/blocks/src/system/icons/ids.d.ts +13 -0
- package/dist/_dts/blocks/src/system/icons/index.d.ts +6 -0
- package/dist/_dts/blocks/src/system/icons/presets.d.ts +4 -0
- package/dist/_dts/blocks/src/system/icons/registry.d.ts +18 -0
- package/dist/_dts/blocks/src/system/icons/semantic.d.ts +239 -0
- package/dist/_dts/blocks/src/system/icons/value.d.ts +94 -0
- package/dist/_dts/blocks/src/system/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +4 -1
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +23 -0
- package/dist/_dts/blocks/src/system/node/fragments/headingDecoration.d.ts +1 -4
- package/dist/_dts/blocks/src/system/node/validation-constants.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +7 -7
- package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +3 -3
- package/dist/_dts/blocks/src/system/runtime/header/enhanceHeaderSection.d.ts +10 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.interactive.d.ts +5 -5
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventListing.server.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventSpotlight.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventDetailModal.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventModals.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/feature-card-icon.d.ts +13 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/header-section.client.d.ts +2 -2
- package/dist/_dts/blocks/src/system/transforms/registry/boxStyles.d.ts +3 -0
- package/dist/_dts/blocks/src/system/transforms/registry/layout.d.ts +9 -0
- package/dist/_dts/blocks/src/system/transforms/typed.d.ts +14 -1
- package/dist/_dts/content-model/src/contentManifest.d.ts +3 -1
- package/dist/_dts/core/src/branded.d.ts +6 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +200 -3
- package/dist/_dts/editor-blocks/src/block-editor/BlockCard.d.ts +8 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCardBody.d.ts +8 -1
- package/dist/_dts/editor-blocks/src/block-editor/BlockCardHeader.d.ts +8 -2
- package/dist/_dts/editor-blocks/src/block-editor/FeatureCardIconsPanel.d.ts +17 -0
- package/dist/_dts/editor-blocks/src/block-editor/GeneratedIconSetDialog.d.ts +42 -0
- package/dist/_dts/editor-blocks/src/block-editor/SortableBlockItem.d.ts +7 -1
- package/dist/_dts/editor-blocks/src/block-editor/featureCardIconActions.d.ts +82 -0
- package/dist/_dts/editor-blocks/src/index.d.ts +2 -0
- package/dist/_dts/editor-blocks/src/widgets/icon-picker/IconPickerField.d.ts +1 -1
- package/dist/_dts/media-core/src/fileDomain.d.ts +8 -1
- package/dist/_dts/media-editor/src/MediaEditor.d.ts +3 -2
- package/dist/_dts/media-react/src/components/MediaLibrary.d.ts +2 -1
- package/dist/_dts/media-react/src/components/MediaPickerMini.d.ts +2 -1
- package/dist/_dts/preview-next/src/client/blocks/BlockToolbar.d.ts +5 -1
- package/dist/_dts/preview-next/src/client/blocks/previewCustomizeActions.d.ts +17 -0
- package/dist/_dts/preview-next/src/client/blocks/previewCustomizeControlPlan.d.ts +24 -0
- package/dist/_dts/preview-next/src/client/blocks/useBlockCustomizeControls.d.ts +34 -0
- package/dist/_dts/preview-next/src/client/preview/PageBlockEditorPanel.d.ts +2 -5
- package/dist/_dts/preview-next/src/client/preview/PageDesignEditorStateContext.d.ts +8 -1
- package/dist/_dts/preview-next/src/client/preview/PreviewBlockCustomizeSelectionContext.d.ts +20 -0
- package/dist/_dts/preview-next/src/client/preview/PreviewOpenEditorButton.d.ts +2 -0
- package/dist/_dts/preview-next/src/client/preview/SelectedBlockCustomizePanel.d.ts +13 -0
- package/dist/_dts/preview-next/src/client/preview/StyleConfigurator.state.d.ts +3 -2
- package/dist/_dts/preview-next/src/client/preview/previewCustomizeEditorDraftPatch.d.ts +13 -0
- package/dist/_dts/preview-next/src/client/preview/previewCustomizeHistory.d.ts +6 -0
- package/dist/_dts/preview-next/src/client/preview/previewCustomizeRuntimePatch.d.ts +2 -0
- package/dist/_dts/preview-next/src/client/preview/storeTypes.d.ts +4 -0
- package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +3 -1
- package/dist/_dts/sdk/src/cli/commands/webhooks.d.ts +44 -0
- package/dist/_dts/sdk/src/cli/navigationIdentity.d.ts +11 -0
- package/dist/_dts/sdk/src/cli/site-commands/navigationCommands.d.ts +4 -0
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +1 -0
- package/dist/_dts/sdk/src/cli/sync/diff.d.ts +9 -0
- package/dist/_dts/sdk/src/client/management/index.d.ts +1 -1
- package/dist/_dts/sdk/src/client/management/types.d.ts +58 -0
- package/dist/_dts/sdk/src/client/management/webhooks.d.ts +3 -0
- package/dist/_dts/sdk/src/config/field-definitions.d.ts +3 -1
- package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +24 -4
- package/dist/_dts/sdk/src/next/index.d.ts +1 -1
- package/dist/_dts/sdk/src/next/revalidate.d.ts +26 -5
- package/dist/_dts/sdk/src/next/static-params.d.ts +28 -3
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +5 -1
- package/dist/_dts/sdk/src/public-api/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/sdk/src/webhooks/index.d.ts +1 -1
- package/dist/_dts/sdk/src/webhooks/verify.d.ts +6 -102
- package/dist/_dts/site-commands/src/commands.d.ts +3 -0
- package/dist/_dts/theme-core/src/accordions/siteStyleDefaults.d.ts +220 -0
- package/dist/_dts/theme-core/src/accordions/types.d.ts +45 -2
- package/dist/_dts/theme-core/src/blockOverrides.d.ts +8 -0
- package/dist/_dts/theme-core/src/blocks/types.d.ts +1 -1
- package/dist/_dts/theme-core/src/blocks/vars/testimonials.d.ts +4 -1
- package/dist/_dts/theme-core/src/buttons/personalities/types.d.ts +1 -1
- package/dist/_dts/theme-core/src/cards/core.d.ts +20 -0
- package/dist/_dts/theme-core/src/cards/generateDefaultCardSystem.d.ts +6 -3
- package/dist/_dts/theme-core/src/cards/siteStyleDefaults.d.ts +105 -0
- package/dist/_dts/theme-core/src/cards/types.d.ts +177 -0
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +159 -21
- package/dist/_dts/theme-core/src/palette/variants/index.d.ts +15 -0
- package/dist/_dts/theme-core/src/palette/variants/soft-natural.d.ts +16 -0
- package/dist/_dts/theme-core/src/palette/variants/types.d.ts +1 -1
- package/dist/_dts/theme-core/src/schema.d.ts +451 -57
- package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +86 -17
- package/dist/_dts/theme-core/src/site-styles/appearancePresetTypes.d.ts +2 -3
- package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +86 -17
- package/dist/_dts/theme-core/src/site-styles/curatedSiteStyles.d.ts +135 -3
- package/dist/_dts/theme-core/src/site-styles/designState.d.ts +5 -5
- package/dist/_dts/theme-core/src/site-styles/footerLooks.d.ts +20 -1
- package/dist/_dts/theme-core/src/site-styles/generatedSchemas.d.ts +8 -2
- package/dist/_dts/theme-core/src/site-styles/headerLooks.d.ts +286 -6
- package/dist/_dts/theme-core/src/site-styles/index.d.ts +2 -0
- package/dist/_dts/theme-core/src/site-styles/logoBranding.d.ts +193 -0
- package/dist/_dts/theme-core/src/site-styles/previewCompiler.d.ts +6 -12
- package/dist/_dts/theme-core/src/site-styles/rawStyleFields.d.ts +2 -0
- package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +10 -7
- package/dist/_dts/theme-core/src/site-styles/siteStyleThemeCompiler.d.ts +11 -0
- package/dist/_dts/theme-core/src/site-styles/sourceCatalogs.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/styleTags.d.ts +1 -1
- package/dist/_dts/theme-core/src/site-styles/testimonialQuotePresets.d.ts +15 -0
- package/dist/_dts/theme-core/src/site-styles/tokenRecipes.d.ts +1 -1
- package/dist/_dts/theme-core/src/site-styles/types.d.ts +7 -29
- package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -0
- package/dist/_dts/ui/src/combobox.d.ts +1 -0
- package/dist/{PreviewEditorSidebar-4DXLYX2V.mjs → chunk-5NZGBSJF.mjs} +2215 -2566
- package/dist/{chunk-RGTOD4AJ.mjs → chunk-7PCYG6YV.mjs} +621 -108
- package/dist/{chunk-CR5HKAGU.mjs → chunk-BBLZSQEY.mjs} +79 -0
- package/dist/{chunk-MCRQMPET.mjs → chunk-GYXKAUFV.mjs} +4500 -912
- package/dist/{chunk-6HYXHRAI.mjs → chunk-HTB4BMKD.mjs} +267 -49
- package/dist/{chunk-OKMBEAXY.mjs → chunk-MPBNEVPB.mjs} +1 -1
- package/dist/cli/index.mjs +3255 -702
- package/dist/cli/init-docs/content/workflow-editor-workflows.md +2 -0
- package/dist/cli/init-docs/content/workflow-isr-revalidation.md +150 -0
- package/dist/client/{accordion-PLYNJIIM.mjs → accordion-QFZMNB7O.mjs} +1 -1
- package/dist/client/{bookingForm-BXAP6AO7.mjs → bookingForm-NCIXFWIG.mjs} +3 -3
- package/dist/client/bookings.mjs +1246 -323
- package/dist/client/{carousel-TRBXDHGF.mjs → carousel-EO4BJMWD.mjs} +2 -2
- package/dist/client/{cart-Z7H3HJRS.mjs → cart-FTYCLYUW.mjs} +5 -5
- package/dist/client/{checkout-WAFCUBIX.mjs → checkout-NFGLVCOX.mjs} +5 -5
- package/dist/client/{chunk-CWGTG37I.mjs → chunk-4W66ALYT.mjs} +1 -1
- package/dist/client/{chunk-JRDUHZCT.mjs → chunk-6GVVWSPU.mjs} +4 -4
- package/dist/client/{chunk-75OUS5MT.mjs → chunk-IWFZSQNZ.mjs} +1 -1
- package/dist/client/{chunk-JGXPTEI2.mjs → chunk-PUOELU4O.mjs} +95 -8
- package/dist/client/{chunk-FUXW6VW2.mjs → chunk-PYRBIURC.mjs} +4 -4
- package/dist/client/{chunk-ZI3LLBPZ.mjs → chunk-T6UIP6UZ.mjs} +1 -1
- package/dist/client/{chunk-DNRGY432.mjs → chunk-VDS5YFLX.mjs} +1 -1
- package/dist/client/{chunk-UVQEJJTN.mjs → chunk-Y37KDO7P.mjs} +1 -1
- package/dist/client/client.mjs +24277 -20796
- package/dist/client/{courseRegistration-AHFQHWIJ.mjs → courseRegistration-2EORROPS.mjs} +3 -3
- package/dist/client/{eventCalendar-LDXTV5R7.mjs → eventCalendar-WZI4VL6N.mjs} +5 -5
- package/dist/client/{eventCombined-A4JGTNJO.mjs → eventCombined-QCB2TCNL.mjs} +5 -5
- package/dist/client/{eventDetails-4YXTZ7EG.mjs → eventDetails-TFTATAPH.mjs} +5 -5
- package/dist/client/{eventListing-P72TPFFM.mjs → eventListing-A2CQEHEQ.mjs} +5 -5
- package/dist/client/{eventRegistration-LSYJHGMT.mjs → eventRegistration-OELPVLUY.mjs} +5 -5
- package/dist/client/{form-AOPYOKOW.mjs → form-NTIFD6WQ.mjs} +1 -1
- package/dist/client/{headerSection-5TFYDFVQ.mjs → headerSection-7TBNKCLA.mjs} +65 -24
- package/dist/client/hooks.mjs +3687 -2024
- package/dist/client/{locationMap-QSZ3ZVAZ.mjs → locationMap-LRLB5A3H.mjs} +1 -1
- package/dist/client/{newsletterForm-KTRHZY52.mjs → newsletterForm-XI52RZSN.mjs} +1 -1
- package/dist/client/{productDetail-N4E775RG.mjs → productDetail-GSNKBFLY.mjs} +5 -5
- package/dist/client/{productList-UGUQ2S45.mjs → productList-BGCGT4KZ.mjs} +5 -5
- package/dist/client/rendering/client.mjs +5274 -3030
- package/dist/client/rendering/islands.mjs +18 -18
- package/dist/client/rendering.mjs +6271 -2790
- package/dist/client/{shop-VHSZEEQ2.mjs → shop-RQHUCLNY.mjs} +5 -5
- package/dist/preview-next/before-render.mjs +79 -0
- package/dist/preview-next/client/runtime.mjs +5 -5
- package/dist/preview-next/middleware.mjs +79 -0
- package/dist/{sdk-runtime-WHPJEF5G.mjs → sdk-runtime-A4LHT2RS.mjs} +6 -6
- package/dist/server/components.mjs +6215 -3057
- package/dist/server/config-validation.mjs +3858 -2194
- package/dist/server/config.mjs +3858 -2194
- package/dist/server/data.mjs +3687 -2024
- package/dist/server/index.mjs +88 -1
- package/dist/server/next/revalidate.mjs +229 -34
- package/dist/server/next.mjs +6295 -3036
- package/dist/server/page-converter.mjs +3055 -1883
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +6220 -3062
- package/dist/server/rendering.mjs +6233 -3075
- package/dist/server/routing.mjs +4251 -2137
- package/dist/server/server.mjs +3705 -2042
- package/dist/server/theme-bridge.mjs +1617 -329
- package/dist/server/theme.mjs +411 -221
- package/dist/server/webhooks.mjs +129 -25
- package/dist/styles/index.css +355 -33
- package/package.json +2 -1
- package/dist/SdkPreviewModeRuntime-IJDHTW4W.mjs +0 -8
- package/dist/chunk-4QEGTLK6.mjs +0 -1175
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { assertNever2, useOptionalEditorUiStoreInstance, getPageDesignEditorState, PAGE_DESIGN_EDITOR_STATE_FETCH_ERROR_MESSAGE, useDebouncedLatestSave, applyPageDesignEditorAction,
|
|
3
|
-
import { ApiRequestError, resolveSurfaceDocumentAttributes, SURFACE_DOCUMENT_DATA_ATTRIBUTE, SURFACE_IDS } from './chunk-
|
|
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
|
|
|
@@ -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":
|
|
@@ -713,6 +746,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
|
|
|
713
746
|
case "set-layout":
|
|
714
747
|
return {
|
|
715
748
|
blockId: action.blockId,
|
|
749
|
+
ownedRuntimeFieldPaths: [],
|
|
716
750
|
previousContent,
|
|
717
751
|
nextContent: contentWithLayoutVariant(
|
|
718
752
|
previousContent,
|
|
@@ -732,6 +766,7 @@ function derivePreviewCustomizeRuntimePatch(input) {
|
|
|
732
766
|
if (!definition) return null;
|
|
733
767
|
return {
|
|
734
768
|
blockId: action.blockId,
|
|
769
|
+
ownedRuntimeFieldPaths: [],
|
|
735
770
|
previousContent,
|
|
736
771
|
nextContent: systemCustomizeFacetApplyContentPatch(
|
|
737
772
|
definition,
|
|
@@ -745,6 +780,17 @@ function derivePreviewCustomizeRuntimePatch(input) {
|
|
|
745
780
|
)
|
|
746
781
|
};
|
|
747
782
|
}
|
|
783
|
+
case "set-background":
|
|
784
|
+
return {
|
|
785
|
+
blockId: action.blockId,
|
|
786
|
+
ownedRuntimeFieldPaths: ["_sectionStyles.background"],
|
|
787
|
+
previousContent,
|
|
788
|
+
nextContent: applyBackgroundOverrideContentPatch(
|
|
789
|
+
previousContent,
|
|
790
|
+
action.override
|
|
791
|
+
),
|
|
792
|
+
rollback: (currentContent) => contentWithPreviousBackground(currentContent, previousContent)
|
|
793
|
+
};
|
|
748
794
|
case "set-look":
|
|
749
795
|
return null;
|
|
750
796
|
case "set-boundary":
|
|
@@ -767,11 +813,114 @@ function contentWithPreviousLayoutVariant(currentContent, previousContent) {
|
|
|
767
813
|
}
|
|
768
814
|
return nextContent;
|
|
769
815
|
}
|
|
816
|
+
function contentWithPreviousBackground(currentContent, previousContent) {
|
|
817
|
+
const previousSectionStyles = isRecord(previousContent._sectionStyles) ? previousContent._sectionStyles : {};
|
|
818
|
+
const currentSectionStyles = isRecord(currentContent._sectionStyles) ? currentContent._sectionStyles : {};
|
|
819
|
+
const nextSectionStyles = { ...currentSectionStyles };
|
|
820
|
+
if (Object.prototype.hasOwnProperty.call(previousSectionStyles, "background")) {
|
|
821
|
+
nextSectionStyles.background = previousSectionStyles.background;
|
|
822
|
+
} else {
|
|
823
|
+
delete nextSectionStyles.background;
|
|
824
|
+
}
|
|
825
|
+
if (Object.keys(nextSectionStyles).length > 0) {
|
|
826
|
+
return {
|
|
827
|
+
...currentContent,
|
|
828
|
+
_sectionStyles: nextSectionStyles
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
const nextContent = { ...currentContent };
|
|
832
|
+
delete nextContent._sectionStyles;
|
|
833
|
+
return nextContent;
|
|
834
|
+
}
|
|
835
|
+
function isRecord(value) {
|
|
836
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
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
|
+
}
|
|
770
916
|
var PREVIEW_CUSTOMIZE_STALE_MESSAGE = "This page changed since that design choice. Refresh the preview, then try again.";
|
|
771
917
|
var PageDesignEditorStateContext = createContext({
|
|
772
918
|
state: { kind: "unsupported" },
|
|
773
919
|
reload: () => {
|
|
774
920
|
},
|
|
921
|
+
backgroundImagePool: [],
|
|
922
|
+
backgroundImagePoolStatus: "idle",
|
|
923
|
+
loadBackgroundImagePool: async () => [],
|
|
775
924
|
applyAction: async () => skippedPreviewCustomizeOutcome("disabled"),
|
|
776
925
|
undo: async () => skippedPreviewCustomizeOutcome("disabled"),
|
|
777
926
|
redo: async () => skippedPreviewCustomizeOutcome("disabled"),
|
|
@@ -793,7 +942,10 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
793
942
|
const [workflowState, setWorkflowState] = useState(
|
|
794
943
|
unsupportedPreviewCustomizeWorkflowState
|
|
795
944
|
);
|
|
945
|
+
const [backgroundImagePool, setBackgroundImagePool] = useState([]);
|
|
946
|
+
const [backgroundImagePoolStatus, setBackgroundImagePoolStatus] = useState("idle");
|
|
796
947
|
const workflowStateRef = useRef(workflowState);
|
|
948
|
+
const backgroundImagePoolRequestRef = useRef(null);
|
|
797
949
|
const uiStore = useOptionalEditorUiStoreInstance();
|
|
798
950
|
useEffect(() => {
|
|
799
951
|
workflowStateRef.current = workflowState;
|
|
@@ -801,6 +953,9 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
801
953
|
useEffect(() => {
|
|
802
954
|
if (!enabled || !pageId) {
|
|
803
955
|
setWorkflowState(unsupportedPreviewCustomizeWorkflowState());
|
|
956
|
+
setBackgroundImagePool([]);
|
|
957
|
+
setBackgroundImagePoolStatus("idle");
|
|
958
|
+
backgroundImagePoolRequestRef.current = null;
|
|
804
959
|
return;
|
|
805
960
|
}
|
|
806
961
|
let cancelled = false;
|
|
@@ -827,6 +982,52 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
827
982
|
cancelled = true;
|
|
828
983
|
};
|
|
829
984
|
}, [apiClient, enabled, pageId, reloadKey, siteId]);
|
|
985
|
+
const loadBackgroundImagePool = useMemo(
|
|
986
|
+
() => async () => {
|
|
987
|
+
if (!enabled || !pageId) return [];
|
|
988
|
+
if (backgroundImagePoolStatus === "loaded") return backgroundImagePool;
|
|
989
|
+
if (backgroundImagePoolRequestRef.current) {
|
|
990
|
+
return backgroundImagePoolRequestRef.current;
|
|
991
|
+
}
|
|
992
|
+
setBackgroundImagePoolStatus("loading");
|
|
993
|
+
const request = apiClient({
|
|
994
|
+
endpoint: "mediaList",
|
|
995
|
+
params: {
|
|
996
|
+
siteId,
|
|
997
|
+
fileFilter: "images",
|
|
998
|
+
limit: "48"
|
|
999
|
+
},
|
|
1000
|
+
options: { cache: "no-store" }
|
|
1001
|
+
}).then((response) => {
|
|
1002
|
+
const result = unwrapResponse(response);
|
|
1003
|
+
const nextPool = result.items.map(backgroundImagePoolItemForAsset);
|
|
1004
|
+
setBackgroundImagePool(nextPool);
|
|
1005
|
+
setBackgroundImagePoolStatus("loaded");
|
|
1006
|
+
return nextPool;
|
|
1007
|
+
}).catch((error) => {
|
|
1008
|
+
setBackgroundImagePoolStatus("failed");
|
|
1009
|
+
if (!(error instanceof ApiRequestError)) {
|
|
1010
|
+
console.error(
|
|
1011
|
+
"[preview-page-design-editor-state] Failed to load background images",
|
|
1012
|
+
error
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
return [];
|
|
1016
|
+
}).finally(() => {
|
|
1017
|
+
backgroundImagePoolRequestRef.current = null;
|
|
1018
|
+
});
|
|
1019
|
+
backgroundImagePoolRequestRef.current = request;
|
|
1020
|
+
return request;
|
|
1021
|
+
},
|
|
1022
|
+
[
|
|
1023
|
+
apiClient,
|
|
1024
|
+
backgroundImagePool,
|
|
1025
|
+
backgroundImagePoolStatus,
|
|
1026
|
+
enabled,
|
|
1027
|
+
pageId,
|
|
1028
|
+
siteId
|
|
1029
|
+
]
|
|
1030
|
+
);
|
|
830
1031
|
const autosave = useDebouncedLatestSave({
|
|
831
1032
|
getSnapshot: () => previewCustomizePendingActions(workflowStateRef.current),
|
|
832
1033
|
buildPayload: (actions) => actions,
|
|
@@ -879,7 +1080,10 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
879
1080
|
() => ({
|
|
880
1081
|
state: previewCustomizeWorkflowPageState(workflowState),
|
|
881
1082
|
reload: () => setReloadKey((current) => current + 1),
|
|
882
|
-
|
|
1083
|
+
backgroundImagePool,
|
|
1084
|
+
backgroundImagePoolStatus,
|
|
1085
|
+
loadBackgroundImagePool,
|
|
1086
|
+
applyAction: async (action, options) => {
|
|
883
1087
|
if (!enabled) return skippedPreviewCustomizeOutcome("disabled");
|
|
884
1088
|
if (!pageId) return skippedPreviewCustomizeOutcome("missing-page");
|
|
885
1089
|
const previousWorkflow = workflowState;
|
|
@@ -887,7 +1091,12 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
887
1091
|
if (begin.kind === "skipped") return begin;
|
|
888
1092
|
const previousPageState = previewCustomizeWorkflowPageState(previousWorkflow);
|
|
889
1093
|
if (previousPageState.kind === "loaded" && uiStore) {
|
|
890
|
-
applyLocalRuntimePatch(
|
|
1094
|
+
applyLocalRuntimePatch(
|
|
1095
|
+
uiStore,
|
|
1096
|
+
action,
|
|
1097
|
+
previousPageState.editorModel,
|
|
1098
|
+
options?.runtimeContent ?? null
|
|
1099
|
+
);
|
|
891
1100
|
}
|
|
892
1101
|
setWorkflowState(begin.state);
|
|
893
1102
|
autosave.trigger();
|
|
@@ -971,10 +1180,48 @@ function PreviewPageDesignEditorStateProvider({
|
|
|
971
1180
|
isHistoryStale: previewCustomizeIsStale(workflowState),
|
|
972
1181
|
historyFailure: previewCustomizeFailureMessage(workflowState)
|
|
973
1182
|
}),
|
|
974
|
-
[
|
|
1183
|
+
[
|
|
1184
|
+
apiClient,
|
|
1185
|
+
autosave,
|
|
1186
|
+
backgroundImagePool,
|
|
1187
|
+
backgroundImagePoolStatus,
|
|
1188
|
+
enabled,
|
|
1189
|
+
loadBackgroundImagePool,
|
|
1190
|
+
pageId,
|
|
1191
|
+
siteId,
|
|
1192
|
+
uiStore,
|
|
1193
|
+
workflowState
|
|
1194
|
+
]
|
|
975
1195
|
);
|
|
976
1196
|
return /* @__PURE__ */ jsx(PageDesignEditorStateContext.Provider, { value, children });
|
|
977
1197
|
}
|
|
1198
|
+
function backgroundImagePoolItemForAsset(asset) {
|
|
1199
|
+
const backgroundUse = backgroundUseForAsset(asset.fileUses ?? []);
|
|
1200
|
+
return {
|
|
1201
|
+
mediaId: asset.id,
|
|
1202
|
+
source: backgroundUse === null ? "general-media" : backgroundUse === "selected-background" ? "previous-background" : "generated-ambient",
|
|
1203
|
+
label: asset.title || asset.filename,
|
|
1204
|
+
...isAmbientBackgroundRole(backgroundUse) ? { rank: AMBIENT_BACKGROUND_ROLES.indexOf(backgroundUse) } : {}
|
|
1205
|
+
};
|
|
1206
|
+
}
|
|
1207
|
+
function isAmbientBackgroundRole(value) {
|
|
1208
|
+
return typeof value === "string" && AMBIENT_BACKGROUND_ROLES.includes(value);
|
|
1209
|
+
}
|
|
1210
|
+
function backgroundUseForAsset(fileUses) {
|
|
1211
|
+
const ambientUse = fileUses.find(isAmbientBackgroundFileUse);
|
|
1212
|
+
if (ambientUse) return ambientUse.backgroundUse;
|
|
1213
|
+
const selectedUse = fileUses.find(isSelectedBackgroundFileUse);
|
|
1214
|
+
return selectedUse?.backgroundUse ?? null;
|
|
1215
|
+
}
|
|
1216
|
+
function isAmbientBackgroundFileUse(value) {
|
|
1217
|
+
return isBackgroundFileUse(value) && isAmbientBackgroundRole(value.backgroundUse);
|
|
1218
|
+
}
|
|
1219
|
+
function isSelectedBackgroundFileUse(value) {
|
|
1220
|
+
return isBackgroundFileUse(value) && value.backgroundUse === "selected-background";
|
|
1221
|
+
}
|
|
1222
|
+
function isBackgroundFileUse(value) {
|
|
1223
|
+
return value.tag === "site-background-asset";
|
|
1224
|
+
}
|
|
978
1225
|
function pageDesignEditorActionForPersistence(action) {
|
|
979
1226
|
if (action.kind === "reset-boundary") {
|
|
980
1227
|
return {
|
|
@@ -993,6 +1240,13 @@ function pageDesignEditorActionForPersistence(action) {
|
|
|
993
1240
|
value: action.value,
|
|
994
1241
|
baseContentId: action.baseContentId
|
|
995
1242
|
};
|
|
1243
|
+
case "set-background":
|
|
1244
|
+
return {
|
|
1245
|
+
kind: "set-background",
|
|
1246
|
+
blockId: action.blockId,
|
|
1247
|
+
baseContentId: action.baseContentId,
|
|
1248
|
+
override: action.override
|
|
1249
|
+
};
|
|
996
1250
|
case "set-layout":
|
|
997
1251
|
case "set-look":
|
|
998
1252
|
case "set-boundary":
|
|
@@ -1009,6 +1263,7 @@ function actionWithCurrentBaseContentId(action, editorModel) {
|
|
|
1009
1263
|
baseContentId: editorModel ? contentRevisionIdForBlock(editorModel, action.blockId) : null
|
|
1010
1264
|
};
|
|
1011
1265
|
case "set-block-facet":
|
|
1266
|
+
case "set-background":
|
|
1012
1267
|
return {
|
|
1013
1268
|
...action,
|
|
1014
1269
|
baseContentId: editorModel ? contentRevisionIdForBlock(editorModel, action.blockId) : null
|
|
@@ -1036,41 +1291,28 @@ function classifyApplyActionError(error) {
|
|
|
1036
1291
|
function usePreviewPageDesignEditorState() {
|
|
1037
1292
|
return useContext(PageDesignEditorStateContext);
|
|
1038
1293
|
}
|
|
1039
|
-
function applyLocalRuntimePatch(uiStore, action, editorModel) {
|
|
1294
|
+
function applyLocalRuntimePatch(uiStore, action, editorModel, fallbackContent = null) {
|
|
1040
1295
|
if (classifyPreviewCustomizeActionDomain(action).kind !== "block-content-write") {
|
|
1041
1296
|
return null;
|
|
1042
1297
|
}
|
|
1043
1298
|
const patch = derivePreviewCustomizeRuntimePatch({
|
|
1044
1299
|
action,
|
|
1045
1300
|
editorModel,
|
|
1046
|
-
currentContent: currentLocalBlockContent(
|
|
1047
|
-
uiStore,
|
|
1048
|
-
blockIdForRuntimePatch(action)
|
|
1049
|
-
)
|
|
1301
|
+
currentContent: currentLocalBlockContent(uiStore, blockIdForRuntimePatch(action)) ?? fallbackContent
|
|
1050
1302
|
});
|
|
1051
1303
|
if (!patch) return null;
|
|
1052
|
-
|
|
1053
|
-
uiStore,
|
|
1054
|
-
patch.blockId,
|
|
1055
|
-
patch.nextContent
|
|
1056
|
-
);
|
|
1304
|
+
applyPreviewCustomizeDraftPatch(uiStore, patch, editorModel);
|
|
1057
1305
|
return patch;
|
|
1058
1306
|
}
|
|
1059
1307
|
function rollbackLocalRuntimePatch(uiStore, patch) {
|
|
1060
|
-
|
|
1061
|
-
const currentContent = currentLocalBlockContent(uiStore, patch.blockId);
|
|
1062
|
-
if (!currentContent) return;
|
|
1063
|
-
replaceLocalBlockContentWithoutHistory(
|
|
1064
|
-
uiStore,
|
|
1065
|
-
patch.blockId,
|
|
1066
|
-
patch.rollback(currentContent)
|
|
1067
|
-
);
|
|
1308
|
+
rollbackPreviewCustomizeDraftPatch(uiStore, patch);
|
|
1068
1309
|
}
|
|
1069
1310
|
function blockIdForRuntimePatch(action) {
|
|
1070
1311
|
switch (action.kind) {
|
|
1071
1312
|
case "set-layout":
|
|
1072
1313
|
case "set-look":
|
|
1073
1314
|
case "set-block-facet":
|
|
1315
|
+
case "set-background":
|
|
1074
1316
|
return action.blockId;
|
|
1075
1317
|
case "set-boundary":
|
|
1076
1318
|
case "reset-boundary":
|
|
@@ -1079,30 +1321,6 @@ function blockIdForRuntimePatch(action) {
|
|
|
1079
1321
|
return assertNever2(action, "Unhandled runtime patch action");
|
|
1080
1322
|
}
|
|
1081
1323
|
}
|
|
1082
|
-
function currentLocalBlockContent(uiStore, targetBlockId) {
|
|
1083
|
-
const current = uiStore.getState().drafts.getCurrentValues(unsafeAsEditorBlockId(targetBlockId));
|
|
1084
|
-
return isRecord(current) ? current : null;
|
|
1085
|
-
}
|
|
1086
|
-
function replaceLocalBlockContentWithoutHistory(uiStore, targetBlockId, nextContent) {
|
|
1087
|
-
const editorBlockId = unsafeAsEditorBlockId(targetBlockId);
|
|
1088
|
-
const history = uiStore.getState().history;
|
|
1089
|
-
const snapshot = history.getState().present;
|
|
1090
|
-
const draft = snapshot.drafts[editorBlockId];
|
|
1091
|
-
if (!draft) return;
|
|
1092
|
-
history.restorePresent({
|
|
1093
|
-
...snapshot,
|
|
1094
|
-
drafts: {
|
|
1095
|
-
...snapshot.drafts,
|
|
1096
|
-
[editorBlockId]: {
|
|
1097
|
-
...draft,
|
|
1098
|
-
current: unsafeAsEditorBlockValues(nextContent)
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
});
|
|
1102
|
-
}
|
|
1103
|
-
function isRecord(value) {
|
|
1104
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1105
|
-
}
|
|
1106
1324
|
|
|
1107
1325
|
// ../preview-next/src/client/preview/previewChromeSurface.ts
|
|
1108
1326
|
var PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
|
|
@@ -1145,7 +1363,7 @@ function applyPreviewChromeSurfaceToElement(element, surface, options) {
|
|
|
1145
1363
|
var STORAGE_KEY = "preview-sidebar-tab";
|
|
1146
1364
|
var REQUEST_EVENT = "riverbank:preview-sidebar:request-open";
|
|
1147
1365
|
function parsePreviewSidebarOpenRequestDetail(detail) {
|
|
1148
|
-
const request =
|
|
1366
|
+
const request = isRecord3(detail) ? detail : {};
|
|
1149
1367
|
const tab = request.tab === "assistant" ? "assistant" : "editor";
|
|
1150
1368
|
return {
|
|
1151
1369
|
tab: resolvePreviewSidebarTab(tab),
|
|
@@ -1177,7 +1395,7 @@ function onPreviewSidebarOpenRequest(handler) {
|
|
|
1177
1395
|
window.addEventListener(REQUEST_EVENT, listener);
|
|
1178
1396
|
return () => window.removeEventListener(REQUEST_EVENT, listener);
|
|
1179
1397
|
}
|
|
1180
|
-
function
|
|
1398
|
+
function isRecord3(value) {
|
|
1181
1399
|
return typeof value === "object" && value !== null;
|
|
1182
1400
|
}
|
|
1183
1401
|
var PREVIEW_SURFACE_PARAM = "preview_surface";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ApiRequestError, markPreviewAuthExpired } from './chunk-
|
|
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';
|