@riverbankcms/sdk 0.157.0 → 0.158.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/dist/_dts/{BlocksIslandsHydrator-B3AHhvIn.d.ts → BlocksIslandsHydrator-BgNBtEai.d.ts} +1 -1
- package/dist/_dts/{Page-BMaOSVCP.d.ts → Page-DpCo8zXD.d.ts} +9 -6
- package/dist/_dts/{SdkPreviewMode-CEwDDqfK.d.ts → SdkPreviewMode-Bv2TMscG.d.ts} +2 -2
- package/dist/_dts/{client-BRFVhGUB.d.ts → client-B960v2gW.d.ts} +1 -1
- package/dist/_dts/{content-types-tEy1rtQ5.d.ts → content-types-CN0Wy8V6.d.ts} +26 -3
- package/dist/_dts/{contracts-BwDSOVGj.d.ts → contracts-BFUrby76.d.ts} +5 -4
- package/dist/_dts/{footerPageOutline-BVp5EPJj.d.ts → footerPageOutline-CmoqleLS.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-BQb1mvpc.d.ts → generatePageMetadata-Dkvivc3R.d.ts} +2 -2
- package/dist/_dts/{hosted-booking-appearance-BN2Zu93B.d.ts → hosted-booking-appearance-BIbit60h.d.ts} +8976 -47
- package/dist/_dts/{index-Ca3oD2id.d.ts → index-Ba6RmuxX.d.ts} +3 -3
- package/dist/_dts/{index-Br1TNJlL.d.ts → index-DCNu_8it.d.ts} +4 -4
- package/dist/_dts/{index-CSLkIKs3.d.ts → index-DPfI2t5A.d.ts} +2 -2
- package/dist/_dts/{index-B0wsEbm3.d.ts → index-DaS_z6ir.d.ts} +1 -1
- package/dist/_dts/{index-B0DzVcrB.d.ts → index-DfkFWUxt.d.ts} +4 -1
- package/dist/_dts/{index-BF3hkKvt.d.ts → index-DpgkhY-a.d.ts} +2 -2
- package/dist/_dts/{loadContent-Dz9fOZMZ.d.ts → loadContent-DvvKF4nB.d.ts} +10 -7
- package/dist/_dts/{navigation-DOZwagCE.d.ts → navigation-n-eTVTIQ.d.ts} +75 -4
- package/dist/_dts/{resolvePageContent-oHZ8cfaF.d.ts → resolvePageContent-D0lGwVD6.d.ts} +2 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +6 -6
- package/dist/_dts/sdk/src/config/index.d.ts +6 -6
- package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
- package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +10 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +3 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +11 -4
- package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +45 -6
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +2 -2
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +5 -5
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-Dy1DNdIV.d.ts → types-BJrRUaY7.d.ts} +2 -2
- package/dist/_dts/{types-6q1MDqxg.d.ts → types-BY7PgnDi.d.ts} +7 -7
- package/dist/_dts/{types-BuWOkyqw.d.ts → types-maEnXL6Z.d.ts} +3 -3
- package/dist/_dts/{validation-BumblAOO.d.ts → validation-BjuVrMrs.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-Cid8be1G.mjs → BlocksIslandsHydrator-WRLS96Ev.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-BpzJTCZw.mjs → BookingMailingListNote-eovghMPa.mjs} +3 -56
- package/dist/client/{CalendarNavigationChevron-CBKHlGjE.mjs → CalendarNavigationChevron-CIcMQRc1.mjs} +5 -5
- package/dist/client/{DemoBookingPortalAccess-DpfgDMQ-.mjs → DemoBookingPortalAccess-CdnFgDyQ.mjs} +3 -3
- package/dist/client/{EventCalendar.client-DE5JHf4s.mjs → EventCalendar.client-Dc-ZLxKo.mjs} +8 -8
- package/dist/client/{EventCombined.client-DQLU3EAc.mjs → EventCombined.client-C93XqRIv.mjs} +6 -6
- package/dist/client/{EventItem-C9QTFafI.mjs → EventItem-DnCTygqk.mjs} +3 -3
- package/dist/client/{EventListWeekNavigation-6oYGdpNS.mjs → EventListWeekNavigation-9h97heuQ.mjs} +1 -1
- package/dist/client/{EventListing.client-D0N4Wj_4.mjs → EventListing.client-DFKlQvvs.mjs} +3 -3
- package/dist/client/{EventListing.view-Bish8-si.mjs → EventListing.view-pAuTDyrP.mjs} +4 -4
- package/dist/client/{EventRegistrationPayment-DLPYU2VU.mjs → EventRegistrationPayment-rgKlBvhP.mjs} +8 -7
- package/dist/client/{LeafletStaticMap-BmgEmEUS.mjs → LeafletStaticMap-3XiWSgy0.mjs} +1 -1
- package/dist/client/{Page-C-W_6VPx.mjs → Page-BmpeAwID.mjs} +750 -169
- package/dist/client/{StepIndicator-D8fvzhlS.mjs → StepIndicator-qEq6X5zP.mjs} +2 -2
- package/dist/client/{accordion-B5jBBoBC.mjs → accordion-DeObOasQ.mjs} +1 -1
- package/dist/client/{booking-form.client-xypjcfob.mjs → booking-form.client-DfWeF0lj.mjs} +36 -32
- package/dist/client/{bookingForm-CSE7NT54.mjs → bookingForm-TnzIBHx2.mjs} +4 -4
- package/dist/client/bookings.mjs +5 -5
- package/dist/client/{carousel-BrrLdGgn.mjs → carousel-kkFnbr5Z.mjs} +1 -1
- package/dist/client/{cart-QFgSKqia.mjs → cart-BAXNbFux.mjs} +3 -3
- package/dist/client/{cart.client-C6iA9v8X.mjs → cart.client-BczxUF70.mjs} +1 -1
- package/dist/client/{checkout-BAuLgA6Q.mjs → checkout-C5NRhPeP.mjs} +3 -3
- package/dist/client/{checkout.client-hbvBPpZR.mjs → checkout.client-BuDk3Td9.mjs} +1 -1
- package/dist/client/client.mjs +3 -2
- package/dist/client/{context-psG_Bwfs.mjs → context-CVsgML69.mjs} +1 -1
- package/dist/client/{cta-DrX2pzK9.mjs → cta-BWnUuJce.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-CClf0SHq.mjs → demoPortalMagicLink-CUlwvmxf.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-CqN7ig-2.mjs → enhanceHeaderSection-Cw8nnFj-.mjs} +2 -2
- package/dist/client/{event-details.client-CcYX4URD.mjs → event-details.client-Bl0E_6Vi.mjs} +2 -2
- package/dist/client/{event-registration.client-B8wVfnJ8.mjs → event-registration.client-DmfLg_LC.mjs} +15 -14
- package/dist/client/{eventCalendar-CRYN9-Vv.mjs → eventCalendar-D1Dwb9VA.mjs} +4 -4
- package/dist/client/{eventCombined-gGuj2_Vh.mjs → eventCombined-DfsqY1qR.mjs} +4 -4
- package/dist/client/{eventDetails-D1U7WEsJ.mjs → eventDetails-BmugDVoa.mjs} +2 -2
- package/dist/client/{eventListing-BY20rsvl.mjs → eventListing-BPAGJi3C.mjs} +4 -4
- package/dist/client/{eventRegistration-DnOZYpqh.mjs → eventRegistration-DBlz_x6u.mjs} +4 -4
- package/dist/client/{form-_q17Emh7.mjs → form-DVu3ZMjx.mjs} +3 -3
- package/dist/client/{form.client-BVaTf4FG.mjs → form.client-QZUyABIY.mjs} +3 -3
- package/dist/client/{form.parts-C9EmjE7U.mjs → form.parts-Bs0F3v08.mjs} +1 -1
- package/dist/client/formatDate-BD9D3dgo.mjs +26 -0
- package/dist/client/gifting/client.mjs +2 -2
- package/dist/client/{headerSection-CZ3unSkX.mjs → headerSection-BQwWW4Yy.mjs} +2 -2
- package/dist/client/{location-map.client-C_udm2_y.mjs → location-map.client-upKuwABk.mjs} +3 -10
- package/dist/client/{location-map.view-Bkd9gu_S.mjs → location-map.view-RuBCD10O.mjs} +87 -13
- package/dist/client/{locationMap-CunBAPoo.mjs → locationMap-1sCbsk0V.mjs} +2 -2
- package/dist/client/{newsletter-form.client-BkHhqPBi.mjs → newsletter-form.client-DBTU3oNv.mjs} +4 -4
- package/dist/client/{newsletter-form.parts-VGjM-NDG.mjs → newsletter-form.parts-C9I9JBhe.mjs} +1 -1
- package/dist/client/{newsletterForm-DGc1-NVR.mjs → newsletterForm-DTPtTxxG.mjs} +3 -3
- package/dist/client/{noop-D3wctocR.mjs → noop-DMFt3KdC.mjs} +19 -132
- package/dist/client/portal/client.mjs +589 -482
- package/dist/client/{product-detail.client-C_8N4OxU.mjs → product-detail.client-BX7M5o6p.mjs} +1 -1
- package/dist/client/{product-list.client-79qoSlLs.mjs → product-list.client-i32QNY4c.mjs} +1 -1
- package/dist/client/{productDetail-QGBXBpWb.mjs → productDetail-DWjE9zm7.mjs} +3 -3
- package/dist/client/{productList-Bdno11g6.mjs → productList-DZH9_brv.mjs} +3 -3
- package/dist/client/{propsDecoder-BpKsRqjG.mjs → propsDecoder-CTzHkEkh.mjs} +14 -3
- package/dist/client/{registry.server-D9GvC4EZ.mjs → registry.server-vJ5FlscU.mjs} +589 -246
- package/dist/client/rendering/client.mjs +23 -23
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +26 -4
- package/dist/client/{richText-coerce-Nln8Bw2P.mjs → richText-coerce-DXAmC72p.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-B4E30DaZ.mjs → routeIslandApiConfig-CmC7ygin.mjs} +1 -1
- package/dist/client/{shop-653-Nn74.mjs → shop-C7eL3B37.mjs} +3 -3
- package/dist/client/{shop-commerce-CfbvhT6h.mjs → shop-commerce-D8oRN0QJ.mjs} +9 -9
- package/dist/client/{shop-commerce-store-CfB26IXt.mjs → shop-commerce-store-CRnQ4M18.mjs} +1 -1
- package/dist/client/{shop.client-Bn7jUQOB.mjs → shop.client-X6d6KVmA.mjs} +9 -9
- package/dist/client/{shop.interactive-acMnyBZU.mjs → shop.interactive-DBMeM8VD.mjs} +155 -3
- package/dist/client/{shopShared-Du4efbgL.mjs → shopShared-Y182kN_s.mjs} +2 -2
- package/dist/client/{timetableModel-Duwk6gXe.mjs → timetableModel-D7PwpaBY.mjs} +5 -5
- package/dist/client/{useAvailableSlots-CbaAFr8M.mjs → useAvailableSlots-BDV6MHgJ.mjs} +2 -2
- package/dist/client/useBookingNowIso-DgJEv3ZY.mjs +58 -0
- package/dist/client/{useDiscountApply-DAl-GX21.mjs → useDiscountApply-BTu9EeT7.mjs} +1 -1
- package/dist/client/{useDiscountCodeUi-BUf9LuI6.mjs → useDiscountCodeUi-BfZxdxI-.mjs} +1 -1
- package/dist/client/{useEventPagination-hJDAEg-T.mjs → useEventPagination-pnvdHGeQ.mjs} +6 -6
- package/dist/client/{view-CFSMNvdC.mjs → view-BPEa6Okm.mjs} +8 -7
- package/dist/client/{view-4sSIJ6Ny.mjs → view-hJr_L4QC2.mjs} +3 -3
- package/dist/client/{wizardSteps-B3tRF3_2.mjs → wizardSteps-HdyGoIG3.mjs} +218 -47
- package/dist/preview-next/before-render.mjs +1 -1
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BX5F0a_h.mjs → EventEmbeddedCheckoutStep-BFlBqSu4.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-DLzGdmTw.mjs → PreviewEditorSidebar-CXRUbqMp.mjs} +42 -26
- package/dist/preview-next/client/{PreviewEditorUI-Dru5AxOd.mjs → PreviewEditorUI-CxjEV0Fm.mjs} +31 -22
- package/dist/preview-next/client/{SdkPreviewModeRuntime-QVfwY0HY.mjs → SdkPreviewModeRuntime-BxI12BBS.mjs} +1310 -1226
- package/dist/preview-next/client/{SdkPreviewModeRuntime-V3absa-c.mjs → SdkPreviewModeRuntime-XdQSGGj_.mjs} +1 -1
- package/dist/preview-next/client/{SiteChromeCustomizeContext-RSPyKO_K.mjs → SiteChromeCustomizeContext-CfRQRwpH.mjs} +133891 -131593
- package/dist/preview-next/client/{ThemedButton-ADHirm0A.mjs → ThemedButton-BEOPss9H.mjs} +30 -4
- package/dist/preview-next/client/{previewChromeSurface-Cc4b9nBZ.mjs → previewChromeSurface-CH7hd5n7.mjs} +1 -1
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-CTLm99t6.mjs → sdk-runtime-C6xEU1LI.mjs} +1 -1
- package/dist/preview-next/client/{siteStyleAccess-YpHSMBBC.mjs → siteStyleAccess-CRXaC2oL.mjs} +2 -2
- package/dist/preview-next/client/{spinner-CsiSmy1g.mjs → spinner-BTf1CZmy.mjs} +1 -1
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-dR_Jzpo5.mjs → route-contract-DM22uOXM.mjs} +41 -0
- package/dist/server/{Block.shared-BNrmEY1p.mjs → Block.shared-DLoilC2J.mjs} +4 -4
- package/dist/server/{bindings-C9zgT9uX.mjs → bindings-C7DKLVx_.mjs} +1 -1
- package/dist/server/{blocks-BLm-OxTv.mjs → blocks-jlIm0PWc.mjs} +953 -324
- package/dist/server/{client-CaQ1ElR3.mjs → client-CU4wlMLE.mjs} +2 -2
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-BFyU8YxS.mjs → loadContent-DmQ4BiiQ.mjs} +6 -4
- package/dist/server/{loadPage-DeQipVdO.mjs → loadPage-BBkDQA57.mjs} +3 -2
- package/dist/server/loadPage-ZrcfjG3X.mjs +2 -0
- package/dist/server/next.mjs +24 -12
- package/dist/server/{overrideResolution-D5nmZUYe.mjs → overrideResolution-ByeAbLSO.mjs} +1 -1
- package/dist/server/{overrides-BI13bIb7.mjs → overrides-BcA6ZPWf.mjs} +94 -30
- package/dist/server/page-converter.mjs +1 -1
- package/dist/server/{prebuild-UgDhSzy2.mjs → prebuild-8T-m7XjB.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-CLF-Y7h-.mjs → prefetchBlockData-Bjya-X9t.mjs} +6 -5
- package/dist/server/{publicProducts-vPbNQJsO.mjs → publicProducts-C3meXS2o.mjs} +41 -0
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +26 -8
- package/dist/server/{resolveBlockData-C7J-pixy.mjs → resolveBlockData-D0ow8PRJ.mjs} +1 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/server.mjs +3 -3
- package/dist/server/{siteChromeOverlayClearance-DLROm32h.mjs → siteChromeOverlayClearance-BangtD8A.mjs} +126 -1
- package/dist/server/{src-BZb5L4Fa.mjs → src-B935_bzN.mjs} +300 -2
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/{themeAdmission-x3uhdOWx.mjs → themeAdmission-D2-BnmDO.mjs} +314 -125
- package/dist/server/{validation-Ban_hxJG.mjs → validation-Cm41pDUB.mjs} +2 -2
- package/dist/server/{version-bkGVuskm.mjs → version-Bo9C3McI.mjs} +1 -1
- package/dist/styles/index.css +282 -0
- package/package.json +1 -1
- package/dist/server/loadPage-CvyKRtXK.mjs +0 -2
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
2
|
+
import { Cr as asSiteStyleId, Fr as makeBoundaryId, K as corners, On as defaultThemeTokens, U as parseThemeForPersistence, Xn as paletteColorsSchema, Zn as paletteModeSchema, Zt as resolveSurface, ar as buildRenderableMediaAssetIndex, bn as expandPalette, cr as resolveManagedMediaReference, gr as asDesignBlockId, lr as mediaIdentifierSchema$2, on as textColorStyle, or as renderableMediaAssetSchema$1, sr as indexRenderableMediaAssets, vt as stripStaleTransitionStyleGroup, wr as assertNever$1, xr as asLayoutVariantKey } from "./ThemedButton-BEOPss9H.mjs";
|
|
3
3
|
import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-BC0V7iAR.mjs";
|
|
4
|
-
import { $ as createGuardedPreviewApiClient, $i as
|
|
5
|
-
import { a as resolvePreviewChromeSurface, i as getPreviewChromeSurfaceDataProps, l as PREVIEW_CHROME_Z_INDEX, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as PREVIEW_KEEP_ALIVE_INTERVAL_MS, s as PREVIEW_KEEP_ALIVE_JITTER_RATIO, u as FixedBottomSurface } from "./previewChromeSurface-
|
|
6
|
-
import { a as sanitizeDashboardPath, d as useBlockCustomizeControls, f as PreviewBlockCustomizeSelectionProvider, h as previewWidgetOverrides, i as resolvePreviewDashboardSetupHandoff, l as PreviewSiteFontStorageProvider, n as resolveSiteStyleAccess, p as usePreviewBlockCustomizeSelectionOptional, r as buildPreviewDashboardSetupUrl, s as resolvePreviewSetupBannerModel, t as canInspectSiteStyle } from "./siteStyleAccess-
|
|
4
|
+
import { $ as createGuardedPreviewApiClient, $i as componentRuntimeRulesForTheme, $o as Image, $r as RichText$1, Aa as resolveCompiledSectionForegroundFromContent, Ai as ctaCopyFragment, Ar as planSiteOverlayHeaderClearance, B as arrangementBlockControlsFor, Bi as arrangementHooksFromContent, Br as systemCustomizeFacetNextValue, Ca as defaultSectionTransitionVariantForFamily, Ci as faqHeadingFragment, Cn as resolveRenderedValues, Co as DialogHeader, Cr as getBlockDefinition, Ct as VIEWING_PARTICIPATION, Da as deriveSectionGround, Di as formCopyFragment, Dn as isEdited, Dr as projectRecurringSchedule, Ds as toUtcIsoDateTimeString, Dt as EditorWriteSurface, Ea as sectionTransitionVariantForBoundaryOptionId, Ei as formEmbedFragment, En as baselineRevisionOf, Er as publicRouteCandidatesSchema, Et as EditLeaseModal, Fi as getResponsiveScopeSpec, Fn as FormRenderer, Fr as resolveArrangementKnobs, G as usePreviewPageDesignEditorState, Ga as parseBlockIconValue, Gi as compileEditorModelRuntime, Gn as MediaEditorContextProvider, Gr as buildLoadedOfferingsPreviewListing, Ha as isRichTextDoc, Hi as readBlockComposition, Hn as decodePublicProductCategorySelectorQuery, Hr as escapeStyleContent, Ii as ctaButton, Io as X, Ir as systemCustomizeFacetAppliesToLayoutVariant, Ja as coerceInlineTextWithFallback, Ji as arrangementManifestFromVariants, Jn as ApiRequestError, Jr as offeringsListingFor, K as PreviewDesignHistoryOrderProvider, Ka as parseGeneratedIconAssetId, Kn as useMediaEditorOptional, Kr as buildAppointmentServicesView, Li as bodyCopyFragment, Ln as civilPickerDisplay, Lo as Upload, Lr as systemCustomizeFacetCurrentValue, Ma as readRuntimeNow, Mi as ctaRowFragment, Mr as parseStoredVariant, Na as resolveDateRuntimeContext, Ni as heroCopyFragment, Nr as compileManifestContentContract, Nt as OfferingsPreviewWidgetProvider, Oa as heroPhotoPaintsGround, Oi as testimonialsCarouselFragment, Or as SITE_CHROME_VISIBLE_HEADER_SELECTOR, Os as assertNever$2, Pi as DEFAULT_THEME_RESPONSIVE_MODE, Pr as validateManifestDraft, Q as resolvePreviewSidebarTab, Qa as bindingSchema, Qi as resolvePublishedLook, Qo as Info, Qr as Text$1, Ri as runTransforms, Rn as MediaEditor, Rr as systemCustomizeFacetDefinitionsForBlock, Sa as sectionFactsForContent, Si as faqAccordionFragment, Sn as renderedFieldChanges, So as DialogFooter, Sr as resolveBlockVariantKey, Ss as unsafeAsEditorBlockId, St as useRetentionTicks, Ta as sectionTransitionFamilyForBoundaryOptionId, Ti as singleButtonFragment, Tn as unsafeAsLinkedContentEntryId, Tr as offeringsPreviewBlockDefinition, Tt as EditLeaseDiscardedNotice, U as nextArrangementLookPin, Ua as isObjectRecord, Ui as applyPageOpeningForegroundToTheme, Un as DEFAULT_LAUNCH_READINESS_INPUT, Uo as SlidersHorizontal, Ur as mergeContentWithBlockStyleOverrides, Vi as blockLookFromContent, Vn as blocksKeys, Vr as buildThemeRuntime, W as PreviewPageDesignEditorStateProvider, Wa as isRecord$8, Wi as applyCompiledRuntimeFieldsToContent, Wn as deriveLaunchReadiness, Wo as RotateCcw, Wr as getDefaultComponentRegistry, Xa as isInlineTextEmpty, Xi as resolveEffectiveArrangement, Xr as renderInlineText, Xt as EditorProvider, Ya as inlineTextToPlainText, Yi as readStoredMode, Yn as unwrapResponse, Za as plainTextToInlineText, Zi as resolveModeArrangement, Zr as logger, Zt as useEditor, _i as getCurrentResolveImageUrlContext, _o as TabsList, _r as ThemeScope, _s as selectedContentVersionId, _t as useEntryEditorController, aa as surfaceResolutionContextFromTheme, ai as bookingConsentCarrierSchema, an as createRoutingHelpers, ba as boundaryLayout, bi as headingFragment, bn as remoteDraftValues, bo as DialogContent, br as createCustomBlockRegistry, bt as createEditorApiClientFactory, c as PreviewThemeOverlayProvider, ca as getGradientPreset, ci as resolveRouteTarget, cr as defaultBackgroundOverrideForMode, ct as PreviewRichTextEditor, di as LINKED_CONTENT_ENTRY_META_KEY, dr as parseBackgroundOverrideFromContent, ds as buildMailingListSignupBlockSourceRef, dt as PREVIEW_EDITABLE_OUTLINE, ea as designRuntimeRulesForTheme, ei as getAtPath, es as GripVertical, et as initPreviewAuth, fi as coerceLinkedContentEntriesPayload, fr as planBackgroundOverride, fs as parseFooterModuleId, ga as resolveLookSlotSurfaces, gi as buildResolveImageUrlContext, gn as useOptionalEditorUiStoreInstance, go as TabsContent, gr as isSupportedLoaderEndpoint, gs as readEditorBlockVersionsFromPlacement, ha as resolveItemSurface, hi as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, hn as useEditorUiStoreInstance, ho as Tabs, hr as resolveBackgroundCapability, hs as NO_BLOCK_VERSIONS, ht as EntryControllerProvider, ii as publicEventsArraySchema, ir as BlockApiProvider, is as ChevronLeft, it as usePreviewToken, ja as resolveSectionBackground, ji as heroCtaRowFragment, jr as visibleHeaderClearancePx, ka as parseCanonicalRuntimeBackground, ki as testimonialsHeadingFragment, kn as canEditorWrite, kr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, l as usePreviewThemeOverlay, la as deriveSiteStyleBlockPolicy, li as planSiteChromePlacement, lr as enabledBackgroundModes, ls as cn, lt as PreviewInlineTextEditor, ma as arrangementSlotNames, mi as resolveImageUrlWithContext, mn as useEditorUiStore, mr as rankBackgroundImagePoolItems, ms as sameMailingListPlacementTargeting, mt as EditableBlockProvider, n as useSiteChromeCustomizeOptional, na as headerStyleRecipeForTheme, ni as defaultTransforms, nr as clientComponentRegistry, nt as renewPreviewSession, o as PreviewDesignCoordinatorProvider, oa as gradientToCss, oi as resolveEntryRouteTarget, on as createSnapshotFromPageRecord, or as backgroundColorTokens, ot as renderSiteChromeBlock, pi as getLinkedContentEntryMeta, pr as planBackgroundTransition, ps as parseMailingListPlacementTargeting, qa as parseGeneratedIconSetId, qn as useApiMediaUploader, qr as OFFERINGS_PREVIEW_EVENT_PRESET_DEFINITIONS, ri as calendarWindowQuerySchema, rr as ImageResolveContextProvider, rs as ChevronRight, rt as usePreviewAuth, si as resolvePageRouteTarget, sr as canCycleBackgroundOverrideValue, ss as Button, t as SiteChromeCustomizeProvider, ta as getCuratedSiteStyle, ti as siblingPath, tr as API_ENDPOINTS, tt as registerPreviewRenewalFetcher, ui as formatDate, ur as imagePoolForOverride, ut as PreviewTextEditor, vi as setContextResolveImageUrlContext, vn as activeLinkedSaveHandover, vo as TabsTrigger, vr as containerResponsiveThemeCss, vs as parseEditLeaseScope, wa as sectionTransitionFamilies, wi as blogFeaturedPostFragment, wo as DialogTitle, wr as normalizeBlockContent, xa as composeBoundary, xi as cardFragment, xn as renderSourceFor, xo as DialogDescription, xr as makeDefaultBlockComponent, xt as createPageSurfaceEditorServices, ya as formatSiteChromeBackgroundTokenLabel, yi as richTextFragment, yn as planLinkedSaveHandoverRetention, yo as Dialog, yr as resolveSdkFooterMode, z as arrangementBackgroundControlFor, zi as defineFragment, zr as systemCustomizeFacetLabelForValue } from "./SiteChromeCustomizeContext-CfRQRwpH.mjs";
|
|
5
|
+
import { a as resolvePreviewChromeSurface, i as getPreviewChromeSurfaceDataProps, l as PREVIEW_CHROME_Z_INDEX, n as PREVIEW_CHROME_THEME_CLASS_NAME, o as PREVIEW_KEEP_ALIVE_INTERVAL_MS, s as PREVIEW_KEEP_ALIVE_JITTER_RATIO, u as FixedBottomSurface } from "./previewChromeSurface-CH7hd5n7.mjs";
|
|
6
|
+
import { a as sanitizeDashboardPath, d as useBlockCustomizeControls, f as PreviewBlockCustomizeSelectionProvider, h as previewWidgetOverrides, i as resolvePreviewDashboardSetupHandoff, l as PreviewSiteFontStorageProvider, n as resolveSiteStyleAccess, p as usePreviewBlockCustomizeSelectionOptional, r as buildPreviewDashboardSetupUrl, s as resolvePreviewSetupBannerModel, t as canInspectSiteStyle } from "./siteStyleAccess-CRXaC2oL.mjs";
|
|
7
7
|
import * as React$1 from "react";
|
|
8
|
-
import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
|
|
8
|
+
import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState, useSyncExternalStore } from "react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { useQueryClient } from "@tanstack/react-query";
|
|
11
11
|
import { z } from "zod";
|
|
@@ -523,7 +523,7 @@ function pageBlockPosition(index, blockCount) {
|
|
|
523
523
|
//#endregion
|
|
524
524
|
//#region ../blocks/src/pageRendererContracts.ts
|
|
525
525
|
function buildPageRendererRootRuntime(dataContext) {
|
|
526
|
-
const { siteId = null, siteName, pageId = null, pathname = null, bookingTimeZone, previewStage = "published", apiBaseUrl = null, portalToken = null, readAuthority, bookingOfferingPresets = [], appointmentServicePathPrefix = null, siteTerms, mailingList = { tag: "not_configured" }, loaderFailures = {} } = dataContext ?? {};
|
|
526
|
+
const { siteId = null, siteName, pageId = null, pathname = null, bookingTimeZone, previewStage = "published", apiBaseUrl = null, portalToken = null, readAuthority, bookingOfferingPresets = [], appointmentServicePathPrefix = null, openingHours, siteTerms, mailingList = { tag: "not_configured" }, loaderFailures = {} } = dataContext ?? {};
|
|
527
527
|
return {
|
|
528
528
|
siteId,
|
|
529
529
|
demoEmailSuppressed: resolveDemoEmailSuppression(dataContext),
|
|
@@ -538,6 +538,7 @@ function buildPageRendererRootRuntime(dataContext) {
|
|
|
538
538
|
readAuthority,
|
|
539
539
|
bookingOfferingPresets,
|
|
540
540
|
appointmentServicePathPrefix,
|
|
541
|
+
openingHours,
|
|
541
542
|
siteTerms,
|
|
542
543
|
mailingList,
|
|
543
544
|
loaderFailures
|
|
@@ -965,7 +966,8 @@ function arrangementContentFacts(content) {
|
|
|
965
966
|
photo: photoCount > 0,
|
|
966
967
|
facts: Array.isArray(content.facts) && content.facts.length > 0,
|
|
967
968
|
featured,
|
|
968
|
-
outcome: typeof content.outcome === "string" && content.outcome.length > 0
|
|
969
|
+
outcome: typeof content.outcome === "string" && content.outcome.length > 0,
|
|
970
|
+
figure: typeof content.figure === "string" && content.figure.trim().length > 0
|
|
969
971
|
}
|
|
970
972
|
};
|
|
971
973
|
}
|
|
@@ -1122,7 +1124,7 @@ function resolveArrangementRoleSurfaces(look, runtime, background) {
|
|
|
1122
1124
|
}
|
|
1123
1125
|
/** The arrangement key is resolved once by planBlock, including pinned Looks. */
|
|
1124
1126
|
function heroPhotoGround(entry) {
|
|
1125
|
-
return entry.kind === "renderable" && entry.block.kind === "block.hero" ? { paintsGround: entry.effectiveArrangementKey
|
|
1127
|
+
return entry.kind === "renderable" && entry.block.kind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(entry.effectiveArrangementKey ?? void 0) } : void 0;
|
|
1126
1128
|
}
|
|
1127
1129
|
//#endregion
|
|
1128
1130
|
//#region ../blocks/src/system/blocks/offerings-preview/photoCount.ts
|
|
@@ -2854,14 +2856,23 @@ function normalizePublicApiLoaderParams(endpoint, params, context) {
|
|
|
2854
2856
|
const Text = Text$1;
|
|
2855
2857
|
const RichText = RichText$1;
|
|
2856
2858
|
//#endregion
|
|
2857
|
-
//#region ../
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2859
|
+
//#region ../blocks/src/system/helpers/blockSectionForeground.ts
|
|
2860
|
+
/** Renderer admission supplies the variant; theme-core alone owns paint and foreground. */
|
|
2861
|
+
function resolveBlockSectionForeground(block, theme, audience) {
|
|
2862
|
+
const opening = planOpeningForegroundContent(block, audience);
|
|
2863
|
+
return resolveCompiledSectionForegroundFromContent(opening.content, expandPalette(theme.palette), opening.photo);
|
|
2864
|
+
}
|
|
2865
|
+
/** Apply the render plan's policy/content stage before measuring the opening. */
|
|
2866
|
+
function planOpeningForegroundContent(block, audience) {
|
|
2867
|
+
if (!block?.content) return { content: null };
|
|
2868
|
+
const definition = getBlockDefinition(block.kind);
|
|
2869
|
+
if (!definition) return { content: block.content };
|
|
2870
|
+
const content = planArrangementContent(block.kind, definition.manifest, block.content, audience);
|
|
2871
|
+
return {
|
|
2872
|
+
content,
|
|
2873
|
+
photo: block.kind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(resolveBlockVariantKey(definition.manifest, content) ?? void 0) } : void 0
|
|
2874
|
+
};
|
|
2875
|
+
}
|
|
2865
2876
|
//#endregion
|
|
2866
2877
|
//#region ../db/src/schemas/forms.ts
|
|
2867
2878
|
/**
|
|
@@ -4395,6 +4406,15 @@ function MediaEditorProvider({ siteId, apiClient, children, bucket = DEFAULT_MED
|
|
|
4395
4406
|
});
|
|
4396
4407
|
}
|
|
4397
4408
|
//#endregion
|
|
4409
|
+
//#region ../field-primitives/src/bindings/index.ts
|
|
4410
|
+
const BINDING_TRANSFORMS = {
|
|
4411
|
+
RICHTEXT_FIRST_PARAGRAPH: "richtext.firstParagraph",
|
|
4412
|
+
DATE_FORMAT_SHORT: "date.formatShort",
|
|
4413
|
+
DATE_FORMAT_LONG: "date.formatLong",
|
|
4414
|
+
TEXT_INLINE_TEXT: "text.inlineText"
|
|
4415
|
+
};
|
|
4416
|
+
Object.values(BINDING_TRANSFORMS);
|
|
4417
|
+
//#endregion
|
|
4398
4418
|
//#region ../preview-next/src/client/preview/PreviewAuthInit.tsx
|
|
4399
4419
|
function PreviewAuthInit({ children, session, siteId, siteSlug, pageId, token }) {
|
|
4400
4420
|
const lastInitRef = useRef(null);
|
|
@@ -7098,1268 +7118,1359 @@ function joinClassNames(...values) {
|
|
|
7098
7118
|
return className.length > 0 ? className : void 0;
|
|
7099
7119
|
}
|
|
7100
7120
|
//#endregion
|
|
7101
|
-
//#region ../preview-next/src/client/
|
|
7102
|
-
const
|
|
7103
|
-
|
|
7104
|
-
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
|
|
7110
|
-
|
|
7121
|
+
//#region ../preview-next/src/client/utils/path.ts
|
|
7122
|
+
const PATH_SEPARATOR_REGEX = /\./g;
|
|
7123
|
+
const BRACKET_ACCESS_REGEX = /\[([^\]]+)\]/g;
|
|
7124
|
+
function isRecord$2(value) {
|
|
7125
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7126
|
+
}
|
|
7127
|
+
function isPathContainer(value) {
|
|
7128
|
+
return Array.isArray(value) || isRecord$2(value);
|
|
7129
|
+
}
|
|
7130
|
+
function createPathContainer(nextIsIndex) {
|
|
7131
|
+
return nextIsIndex ? [] : {};
|
|
7132
|
+
}
|
|
7133
|
+
function ensureContainerProperty(container, key, nextIsIndex) {
|
|
7134
|
+
const existing = Reflect.get(container, key);
|
|
7135
|
+
if (isPathContainer(existing)) return existing;
|
|
7136
|
+
const nextContainer = createPathContainer(nextIsIndex);
|
|
7137
|
+
Reflect.set(container, key, nextContainer);
|
|
7138
|
+
return nextContainer;
|
|
7139
|
+
}
|
|
7140
|
+
function parsePath(path) {
|
|
7141
|
+
if (Array.isArray(path)) return path;
|
|
7142
|
+
const segments = [];
|
|
7143
|
+
const parts = path.split(PATH_SEPARATOR_REGEX);
|
|
7144
|
+
for (const raw of parts) {
|
|
7145
|
+
if (!raw) continue;
|
|
7146
|
+
const baseMatch = raw.match(/^[^\[]+/);
|
|
7147
|
+
if (baseMatch) {
|
|
7148
|
+
const base = baseMatch[1] ?? baseMatch[0];
|
|
7149
|
+
if (/^\d+$/.test(base)) segments.push(Number(base));
|
|
7150
|
+
else segments.push(base);
|
|
7151
|
+
}
|
|
7152
|
+
const bracketMatches = raw.matchAll(BRACKET_ACCESS_REGEX);
|
|
7153
|
+
for (const match of bracketMatches) {
|
|
7154
|
+
const token = match[1] ?? "";
|
|
7155
|
+
if (token.startsWith("\"") || token.startsWith("'")) segments.push(token.slice(1, -1));
|
|
7156
|
+
else if (/^\d+$/.test(token)) segments.push(Number(token));
|
|
7157
|
+
else segments.push(token);
|
|
7158
|
+
}
|
|
7159
|
+
if (!baseMatch && !raw.includes("[")) segments.push(raw);
|
|
7160
|
+
}
|
|
7161
|
+
return segments;
|
|
7162
|
+
}
|
|
7163
|
+
function setAtPath(target, path, value) {
|
|
7164
|
+
const segments = parsePath(path);
|
|
7165
|
+
let current = target;
|
|
7166
|
+
for (let index = 0; index < segments.length; index += 1) {
|
|
7167
|
+
const segment = segments[index];
|
|
7168
|
+
if (segment === void 0) continue;
|
|
7169
|
+
const isLast = index === segments.length - 1;
|
|
7170
|
+
const nextIsIndex = typeof segments[index + 1] === "number";
|
|
7171
|
+
if (isLast) {
|
|
7172
|
+
if (typeof segment === "number") {
|
|
7173
|
+
if (Array.isArray(current)) current[segment] = value;
|
|
7174
|
+
} else Reflect.set(current, segment, value);
|
|
7175
|
+
return;
|
|
7176
|
+
}
|
|
7177
|
+
if (typeof segment === "number") {
|
|
7178
|
+
if (Array.isArray(current)) {
|
|
7179
|
+
const existing = current[segment];
|
|
7180
|
+
if (isPathContainer(existing)) current = existing;
|
|
7181
|
+
else {
|
|
7182
|
+
const nextContainer = createPathContainer(nextIsIndex);
|
|
7183
|
+
current[segment] = nextContainer;
|
|
7184
|
+
current = nextContainer;
|
|
7185
|
+
}
|
|
7186
|
+
continue;
|
|
7111
7187
|
}
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7188
|
+
current = ensureContainerProperty(current, String(segment), nextIsIndex);
|
|
7189
|
+
continue;
|
|
7190
|
+
}
|
|
7191
|
+
current = ensureContainerProperty(current, segment, nextIsIndex);
|
|
7115
7192
|
}
|
|
7116
7193
|
}
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
const
|
|
7122
|
-
const
|
|
7123
|
-
|
|
7124
|
-
|
|
7125
|
-
|
|
7126
|
-
|
|
7127
|
-
|
|
7128
|
-
|
|
7129
|
-
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7194
|
+
//#endregion
|
|
7195
|
+
//#region ../preview-next/src/client/blocks/previewProjection/aiProposalProjection.ts
|
|
7196
|
+
function previewProjectionsFromAiOverlays(overlays) {
|
|
7197
|
+
if (!overlays) return [];
|
|
7198
|
+
const overrides = overlays.overrides ?? /* @__PURE__ */ new Map();
|
|
7199
|
+
const projections = [];
|
|
7200
|
+
if (overlays.structure) projections.push({
|
|
7201
|
+
kind: "structure-overlay",
|
|
7202
|
+
source: "ai-proposal",
|
|
7203
|
+
viewMode: overlays.viewMode,
|
|
7204
|
+
proposalId: overlays.structure.proposalId,
|
|
7205
|
+
includeUnspecified: overlays.structure.includeUnspecified,
|
|
7206
|
+
before: overlays.structure.before,
|
|
7207
|
+
after: overlays.structure.after
|
|
7208
|
+
});
|
|
7209
|
+
if (overrides.size > 0) projections.push({
|
|
7210
|
+
kind: "content-field-overrides",
|
|
7211
|
+
source: "ai-proposal",
|
|
7212
|
+
viewMode: overlays.viewMode,
|
|
7213
|
+
overrides
|
|
7214
|
+
});
|
|
7215
|
+
return projections;
|
|
7216
|
+
}
|
|
7217
|
+
function toStringArray(value) {
|
|
7218
|
+
return Array.isArray(value) ? value.filter((item) => typeof item === "string") : [];
|
|
7219
|
+
}
|
|
7220
|
+
function applyStructureProjection(blockItems, projection) {
|
|
7221
|
+
const order = projection.viewMode === "before" ? toStringArray(projection.before.blockIds) : toStringArray(projection.after.blockIds);
|
|
7222
|
+
if (order.length === 0) return blockItems.slice();
|
|
7223
|
+
const itemsById = /* @__PURE__ */ new Map();
|
|
7224
|
+
const unknownIdItems = [];
|
|
7225
|
+
for (const item of blockItems) if (typeof item.id === "string") itemsById.set(item.id, item);
|
|
7226
|
+
else unknownIdItems.push(item);
|
|
7227
|
+
const next = [];
|
|
7228
|
+
const orderedSet = new Set(order);
|
|
7229
|
+
const addedBlocksById = /* @__PURE__ */ new Map();
|
|
7230
|
+
for (const added of projection.after.addedBlocks ?? []) {
|
|
7231
|
+
if (!added || typeof added !== "object") continue;
|
|
7232
|
+
if (typeof added.id !== "string") continue;
|
|
7233
|
+
if (typeof added.kind !== "string") continue;
|
|
7234
|
+
addedBlocksById.set(added.id, {
|
|
7235
|
+
id: added.id,
|
|
7236
|
+
kind: added.kind,
|
|
7237
|
+
content: added.content ?? null
|
|
7238
|
+
});
|
|
7239
|
+
}
|
|
7240
|
+
for (const id of order) {
|
|
7241
|
+
const item = itemsById.get(id);
|
|
7242
|
+
if (item) {
|
|
7243
|
+
next.push(item);
|
|
7244
|
+
continue;
|
|
7143
7245
|
}
|
|
7144
|
-
|
|
7246
|
+
const added = addedBlocksById.get(id);
|
|
7247
|
+
if (added) next.push(added);
|
|
7248
|
+
}
|
|
7249
|
+
if (projection.includeUnspecified !== false) {
|
|
7250
|
+
for (const item of blockItems) if (typeof item.id === "string" && !orderedSet.has(item.id)) next.push(item);
|
|
7251
|
+
}
|
|
7252
|
+
if (unknownIdItems.length > 0) next.push(...unknownIdItems);
|
|
7253
|
+
return next;
|
|
7145
7254
|
}
|
|
7146
|
-
function
|
|
7147
|
-
if (
|
|
7148
|
-
|
|
7255
|
+
function applyContentFieldOverrideProjection(blockId, content, projection) {
|
|
7256
|
+
if (projection.overrides.size === 0) return content;
|
|
7257
|
+
const prefix = `blocks.${blockId}.`;
|
|
7258
|
+
let next = null;
|
|
7259
|
+
for (const [editorPath, override] of projection.overrides.entries()) {
|
|
7260
|
+
if (!editorPath.startsWith(prefix)) continue;
|
|
7261
|
+
const fieldPath = editorPath.slice(prefix.length);
|
|
7262
|
+
if (!next) next = cloneRecord(content);
|
|
7263
|
+
const value = projection.viewMode === "after" ? override.after : override.before;
|
|
7264
|
+
setAtPath(next, parsePath(fieldPath), value);
|
|
7265
|
+
}
|
|
7266
|
+
return next ?? content;
|
|
7149
7267
|
}
|
|
7150
|
-
function
|
|
7151
|
-
|
|
7268
|
+
function blockHasContentFieldOverrideProjection(blockId, projection) {
|
|
7269
|
+
if (projection.overrides.size === 0) return false;
|
|
7270
|
+
const prefix = `blocks.${blockId}.`;
|
|
7271
|
+
for (const editorPath of projection.overrides.keys()) if (editorPath.startsWith(prefix)) return true;
|
|
7272
|
+
return false;
|
|
7273
|
+
}
|
|
7274
|
+
function cloneRecord(value) {
|
|
7275
|
+
if (!value) return {};
|
|
7276
|
+
return JSON.parse(JSON.stringify(value));
|
|
7152
7277
|
}
|
|
7153
7278
|
//#endregion
|
|
7154
|
-
//#region ../preview-next/src/client/
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
headerVariant: theme.header?.variant ?? null,
|
|
7162
|
-
hasVisibleBanner: Boolean(bannerNode),
|
|
7163
|
-
hasVisibleHeader: Boolean(headerNode)
|
|
7279
|
+
//#region ../preview-next/src/client/blocks/previewProjection/runtimeContentDecoration.ts
|
|
7280
|
+
function runtimeContentDecorationProjectionFromEditorModel(editorModel, surfaceResolutionContext, designRules, componentRules) {
|
|
7281
|
+
const compiled = compileEditorModelRuntime({
|
|
7282
|
+
editorModel,
|
|
7283
|
+
surfaceResolutionContext,
|
|
7284
|
+
designRules,
|
|
7285
|
+
componentRules
|
|
7164
7286
|
});
|
|
7287
|
+
return {
|
|
7288
|
+
kind: "runtime-content-decoration",
|
|
7289
|
+
source: "page-design",
|
|
7290
|
+
fieldsByBlockId: runtimeFieldsByBlockId(compiled.blocks),
|
|
7291
|
+
joins: compiled.joins
|
|
7292
|
+
};
|
|
7165
7293
|
}
|
|
7166
|
-
function
|
|
7167
|
-
return
|
|
7294
|
+
function runtimeFieldsByBlockId(blocks) {
|
|
7295
|
+
return new Map(blocks.map((block) => [block.blockId, block.fields]));
|
|
7168
7296
|
}
|
|
7169
|
-
function
|
|
7170
|
-
|
|
7171
|
-
|
|
7172
|
-
|
|
7173
|
-
children: renderSiteChromeBlock(model, "header", theme, { themeConfigOverrideMode: "ignore" })
|
|
7174
|
-
});
|
|
7297
|
+
function applyRuntimeContentDecorationProjection(block, content, projection) {
|
|
7298
|
+
const blockId = designBlockIdFromBlockItem(block);
|
|
7299
|
+
const fields = blockId ? projection.fieldsByBlockId.get(blockId) : void 0;
|
|
7300
|
+
return applyCompiledRuntimeFieldsToContent(isRecord$1(content) ? content : {}, fields);
|
|
7175
7301
|
}
|
|
7176
|
-
function
|
|
7177
|
-
|
|
7178
|
-
const headerNode = renderPreviewHeader(siteChromeRenderModel, effectiveTheme, staticHeaderNode);
|
|
7179
|
-
const documentNode = renderPreviewDocument({
|
|
7180
|
-
viewportMode,
|
|
7181
|
-
viewportWidth,
|
|
7182
|
-
scale,
|
|
7183
|
-
contentHeight,
|
|
7184
|
-
scaleContainerRef,
|
|
7185
|
-
contentRef,
|
|
7186
|
-
siteDocumentPlan: planPreviewSiteDocument(effectiveTheme, bannerNode, headerNode),
|
|
7187
|
-
headerNode,
|
|
7188
|
-
bannerNode,
|
|
7189
|
-
footerNode: Boolean(siteChromeRenderModel) && siteChromeRenderModel?.footer.canRenderReactively !== false && siteChromeRenderModel ? /* @__PURE__ */ jsx(SiteChromeEditableSurface, {
|
|
7190
|
-
surface: "footer",
|
|
7191
|
-
preserveSingleComponentRoot: true,
|
|
7192
|
-
children: renderSiteChromeBlock(siteChromeRenderModel, "footer", effectiveTheme, { themeConfigOverrideMode: "ignore" })
|
|
7193
|
-
}) : staticFooterNode,
|
|
7194
|
-
children
|
|
7195
|
-
});
|
|
7196
|
-
const responsiveMode = resolveDocumentResponsiveMode(themeRuntime, useContainerResponsiveMode);
|
|
7197
|
-
switch (themeRuntime.kind) {
|
|
7198
|
-
case "cms-theme": return /* @__PURE__ */ jsx(ThemeScope, {
|
|
7199
|
-
theme: effectiveTheme,
|
|
7200
|
-
responsiveMode,
|
|
7201
|
-
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7202
|
-
children: documentNode
|
|
7203
|
-
});
|
|
7204
|
-
case "responsive-only": return /* @__PURE__ */ jsx(ResponsiveScope, {
|
|
7205
|
-
responsiveMode,
|
|
7206
|
-
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7207
|
-
children: documentNode
|
|
7208
|
-
});
|
|
7209
|
-
case "none": return documentNode;
|
|
7210
|
-
default: return assertNever$2(themeRuntime);
|
|
7211
|
-
}
|
|
7302
|
+
function designBlockIdFromBlockItem(block) {
|
|
7303
|
+
return typeof block.id === "string" && block.id.length > 0 ? asDesignBlockId(block.id) : null;
|
|
7212
7304
|
}
|
|
7213
|
-
function
|
|
7214
|
-
|
|
7215
|
-
viewportMode,
|
|
7216
|
-
viewportWidth,
|
|
7217
|
-
scale,
|
|
7218
|
-
contentHeight,
|
|
7219
|
-
scaleContainerRef,
|
|
7220
|
-
contentRef,
|
|
7221
|
-
siteDocumentPlan: planSiteDocument({
|
|
7222
|
-
headerPositioning: "static",
|
|
7223
|
-
headerVariant: null,
|
|
7224
|
-
hasVisibleBanner: false,
|
|
7225
|
-
hasVisibleHeader: false
|
|
7226
|
-
}),
|
|
7227
|
-
headerNode: null,
|
|
7228
|
-
bannerNode: null,
|
|
7229
|
-
footerNode: null,
|
|
7230
|
-
children
|
|
7231
|
-
});
|
|
7232
|
-
if (runtime.kind === "none") return documentNode;
|
|
7233
|
-
return /* @__PURE__ */ jsx(ResponsiveScope, {
|
|
7234
|
-
responsiveMode: runtime.responsiveMode ?? (useContainerResponsiveMode ? "container" : "viewport"),
|
|
7235
|
-
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7236
|
-
children: documentNode
|
|
7237
|
-
});
|
|
7305
|
+
function isRecord$1(value) {
|
|
7306
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7238
7307
|
}
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7308
|
+
//#endregion
|
|
7309
|
+
//#region ../blocks/src/bindings/types.ts
|
|
7310
|
+
/**
|
|
7311
|
+
* Available transform function names.
|
|
7312
|
+
*/
|
|
7313
|
+
const TRANSFORMS = BINDING_TRANSFORMS;
|
|
7314
|
+
const BINDING_SOURCES = [
|
|
7315
|
+
"field",
|
|
7316
|
+
"meta",
|
|
7317
|
+
"literal",
|
|
7318
|
+
"transform",
|
|
7319
|
+
"fallback"
|
|
7320
|
+
];
|
|
7321
|
+
//#endregion
|
|
7322
|
+
//#region ../blocks/src/bindings/index.ts
|
|
7323
|
+
/**
|
|
7324
|
+
* Resolves a binding map to actual content values.
|
|
7325
|
+
*
|
|
7326
|
+
* Returns only keys whose binding resolved to a non-null, non-undefined value.
|
|
7327
|
+
* To merge resolved bindings over a base content object (the dashboard
|
|
7328
|
+
* template preview's use case), see {@link applyBindingsToContent}.
|
|
7329
|
+
*
|
|
7330
|
+
* @param bindings - Map of field keys to binding descriptors
|
|
7331
|
+
* @param context - Entry data context (fields and meta)
|
|
7332
|
+
* @returns Resolved content object with actual values
|
|
7333
|
+
*
|
|
7334
|
+
* @example
|
|
7335
|
+
* ```typescript
|
|
7336
|
+
* const content = applyBindings(
|
|
7337
|
+
* {
|
|
7338
|
+
* headline: { source: 'meta', path: 'title' },
|
|
7339
|
+
* body: { source: 'field', path: 'content' },
|
|
7340
|
+
* },
|
|
7341
|
+
* {
|
|
7342
|
+
* fields: { content: 'Hello world' },
|
|
7343
|
+
* meta: { title: 'My Post', slug: 'my-post' },
|
|
7344
|
+
* }
|
|
7345
|
+
* );
|
|
7346
|
+
* // Result: { headline: 'My Post', body: 'Hello world' }
|
|
7347
|
+
* ```
|
|
7348
|
+
*/
|
|
7349
|
+
function applyBindings(bindings, context) {
|
|
7350
|
+
const result = {};
|
|
7351
|
+
for (const [key, bindingSpec] of Object.entries(bindings)) {
|
|
7352
|
+
if (isBindingDescriptor(bindingSpec)) {
|
|
7353
|
+
const value = resolveBindingValue(bindingSpec, context);
|
|
7354
|
+
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
7355
|
+
continue;
|
|
7356
|
+
}
|
|
7357
|
+
if (typeof bindingSpec === "string") {
|
|
7358
|
+
const value = resolveBindingValue({
|
|
7359
|
+
source: "field",
|
|
7360
|
+
path: bindingSpec
|
|
7361
|
+
}, context);
|
|
7362
|
+
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
7363
|
+
continue;
|
|
7364
|
+
}
|
|
7365
|
+
if (isRecord$8(bindingSpec)) {
|
|
7366
|
+
const nested = applyBindings(bindingSpec, context);
|
|
7367
|
+
if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
|
|
7368
|
+
}
|
|
7287
7369
|
}
|
|
7288
|
-
return
|
|
7370
|
+
return result;
|
|
7289
7371
|
}
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7372
|
+
/**
|
|
7373
|
+
* Resolve a binding map and merge the result over a base content object.
|
|
7374
|
+
*
|
|
7375
|
+
* Use this when a block has *some* hard-coded content (from a template's
|
|
7376
|
+
* `block.content`) and *some* values driven by template bindings against
|
|
7377
|
+
* an entry. The base provides defaults; resolved bindings override them.
|
|
7378
|
+
*
|
|
7379
|
+
* Same null-handling as {@link applyBindings}: keys whose binding resolves
|
|
7380
|
+
* to `null`/`undefined` do NOT overwrite the base. This means "no resolved
|
|
7381
|
+
* value" leaves the base value (or absence) intact, which is the correct
|
|
7382
|
+
* semantic for both the SDK/frontend render paths and the dashboard preview.
|
|
7383
|
+
*
|
|
7384
|
+
* Replaces the dashboard's bespoke `applyBindings` that lived in
|
|
7385
|
+
* `apps/dashboard/src/lib/templates/applyBindings.ts` — its divergent
|
|
7386
|
+
* "always-set-null" behaviour produced the `subheadline: null` regression
|
|
7387
|
+
* documented in Phase 1.
|
|
7388
|
+
*
|
|
7389
|
+
* @example
|
|
7390
|
+
* ```typescript
|
|
7391
|
+
* const content = applyBindingsToContent(
|
|
7392
|
+
* { eyebrow: 'Default eyebrow', headline: 'Default headline' },
|
|
7393
|
+
* { headline: { source: 'meta', path: 'title' } },
|
|
7394
|
+
* { fields: {}, meta: { title: 'Entry title' } },
|
|
7395
|
+
* );
|
|
7396
|
+
* // Result: { eyebrow: 'Default eyebrow', headline: 'Entry title' }
|
|
7397
|
+
* ```
|
|
7398
|
+
*/
|
|
7399
|
+
function applyBindingsToContent(baseContent, bindings, context) {
|
|
7400
|
+
return mergeResolvedBindings(baseContent, applyBindings(bindings, context));
|
|
7297
7401
|
}
|
|
7298
|
-
function
|
|
7299
|
-
|
|
7402
|
+
function mergeResolvedBindings(base, resolved) {
|
|
7403
|
+
const merged = { ...base };
|
|
7404
|
+
for (const [key, resolvedValue] of Object.entries(resolved)) {
|
|
7405
|
+
const baseValue = merged[key];
|
|
7406
|
+
merged[key] = isRecord$8(baseValue) && isRecord$8(resolvedValue) ? mergeResolvedBindings(baseValue, resolvedValue) : resolvedValue;
|
|
7407
|
+
}
|
|
7408
|
+
return merged;
|
|
7300
7409
|
}
|
|
7301
|
-
function
|
|
7302
|
-
|
|
7410
|
+
function setBindingValue(target, path, value) {
|
|
7411
|
+
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
7412
|
+
if (segments.length === 0) return;
|
|
7413
|
+
const firstSegment = segments[0];
|
|
7414
|
+
if (!firstSegment) return;
|
|
7415
|
+
if (segments.length === 1) {
|
|
7416
|
+
target[firstSegment] = value;
|
|
7417
|
+
return;
|
|
7418
|
+
}
|
|
7419
|
+
const isIndex = (segment) => /^\d+$/.test(segment);
|
|
7420
|
+
let current = target;
|
|
7421
|
+
for (let i = 0; i < segments.length; i++) {
|
|
7422
|
+
const segment = segments[i];
|
|
7423
|
+
if (!segment) return;
|
|
7424
|
+
const last = i === segments.length - 1;
|
|
7425
|
+
const nextSegment = segments[i + 1];
|
|
7426
|
+
if (last) {
|
|
7427
|
+
if (Array.isArray(current) && isIndex(segment)) {
|
|
7428
|
+
current[Number(segment)] = value;
|
|
7429
|
+
return;
|
|
7430
|
+
}
|
|
7431
|
+
if (isRecord$8(current)) current[segment] = value;
|
|
7432
|
+
return;
|
|
7433
|
+
}
|
|
7434
|
+
const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
|
|
7435
|
+
if (Array.isArray(current) && isIndex(segment)) {
|
|
7436
|
+
const index = Number(segment);
|
|
7437
|
+
const existing = current[index];
|
|
7438
|
+
if (nextWantsArray) {
|
|
7439
|
+
if (!Array.isArray(existing)) current[index] = [];
|
|
7440
|
+
} else if (!isRecord$8(existing)) current[index] = {};
|
|
7441
|
+
current = current[index];
|
|
7442
|
+
continue;
|
|
7443
|
+
}
|
|
7444
|
+
if (isRecord$8(current)) {
|
|
7445
|
+
const existing = current[segment];
|
|
7446
|
+
if (nextWantsArray) {
|
|
7447
|
+
if (!Array.isArray(existing)) current[segment] = [];
|
|
7448
|
+
} else if (!isRecord$8(existing)) current[segment] = {};
|
|
7449
|
+
current = current[segment];
|
|
7450
|
+
continue;
|
|
7451
|
+
}
|
|
7452
|
+
return;
|
|
7453
|
+
}
|
|
7303
7454
|
}
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7455
|
+
/**
|
|
7456
|
+
* Resolves a single binding descriptor to its value.
|
|
7457
|
+
*/
|
|
7458
|
+
function resolveBindingValue(descriptor, context) {
|
|
7459
|
+
switch (descriptor.source) {
|
|
7460
|
+
case "field": return descriptor.path ? getPath(context.fields, descriptor.path) : void 0;
|
|
7461
|
+
case "meta": return descriptor.path ? getPath(context.meta, descriptor.path) : void 0;
|
|
7462
|
+
case "literal": return descriptor.value;
|
|
7463
|
+
case "transform": {
|
|
7464
|
+
const inputDescriptor = descriptor.input && isBindingDescriptorLike(descriptor.input) ? normalizeBindingInput(descriptor.input) : descriptor.path ? normalizeBindingInput(descriptor.path) : null;
|
|
7465
|
+
const inputValue = inputDescriptor ? resolveBindingValue(inputDescriptor, context) : void 0;
|
|
7466
|
+
return applyTransform(descriptor.transform, inputValue, context.dateContext);
|
|
7467
|
+
}
|
|
7468
|
+
case "fallback":
|
|
7469
|
+
for (const option of descriptor.options ?? []) {
|
|
7470
|
+
const normalized = normalizeBindingInput(option);
|
|
7471
|
+
if (!normalized) continue;
|
|
7472
|
+
const value = resolveBindingValue(normalized, context);
|
|
7473
|
+
if (value !== void 0 && value !== null && value !== "") return value;
|
|
7474
|
+
}
|
|
7475
|
+
return null;
|
|
7476
|
+
default: return null;
|
|
7477
|
+
}
|
|
7308
7478
|
}
|
|
7309
|
-
|
|
7310
|
-
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7479
|
+
/**
|
|
7480
|
+
* Gets a nested path from an object.
|
|
7481
|
+
*/
|
|
7482
|
+
function getPath(source, path) {
|
|
7483
|
+
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
7484
|
+
let current = source;
|
|
7485
|
+
for (const segment of segments) {
|
|
7486
|
+
if (!isRecord$8(current)) return void 0;
|
|
7487
|
+
current = current[segment];
|
|
7488
|
+
}
|
|
7489
|
+
return current;
|
|
7314
7490
|
}
|
|
7315
|
-
|
|
7316
|
-
|
|
7317
|
-
|
|
7318
|
-
|
|
7491
|
+
/**
|
|
7492
|
+
* Applies a transform function to a value.
|
|
7493
|
+
*/
|
|
7494
|
+
function applyTransform(name, value, dateContext) {
|
|
7495
|
+
if (!name) return value;
|
|
7496
|
+
switch (name) {
|
|
7497
|
+
case TRANSFORMS.RICHTEXT_FIRST_PARAGRAPH: return extractFirstParagraph(value);
|
|
7498
|
+
case TRANSFORMS.DATE_FORMAT_SHORT: return formatDate(value, dateContext, { date: "short" });
|
|
7499
|
+
case TRANSFORMS.DATE_FORMAT_LONG: return formatDate(value, dateContext, {
|
|
7500
|
+
date: "long",
|
|
7501
|
+
includeTime: true
|
|
7502
|
+
});
|
|
7503
|
+
case TRANSFORMS.TEXT_INLINE_TEXT: return textToInlineText(value);
|
|
7504
|
+
default: return value;
|
|
7505
|
+
}
|
|
7319
7506
|
}
|
|
7320
|
-
|
|
7321
|
-
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
|
|
7326
|
-
|
|
7327
|
-
|
|
7328
|
-
|
|
7329
|
-
|
|
7330
|
-
|
|
7331
|
-
|
|
7332
|
-
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
});
|
|
7338
|
-
};
|
|
7339
|
-
const handleBlockFieldFocus = (event) => {
|
|
7340
|
-
if (!isBlockFieldFocusEvent(event)) return;
|
|
7341
|
-
const state = uiStore.getState();
|
|
7342
|
-
const blockId = unsafeAsEditorBlockId(event.detail.blockId);
|
|
7343
|
-
state.setActivePreviewField({
|
|
7344
|
-
kind: "block",
|
|
7345
|
-
blockId,
|
|
7346
|
-
fieldPath: event.detail.fieldPath
|
|
7347
|
-
});
|
|
7348
|
-
};
|
|
7349
|
-
window.addEventListener(LINKED_ENTRY_EDIT_EVENT, handleLinkedEntryEdit);
|
|
7350
|
-
window.addEventListener(LINKED_ENTRY_FIELD_FOCUS_EVENT, handleLinkedEntryFieldFocus);
|
|
7351
|
-
window.addEventListener(BLOCK_FIELD_FOCUS_EVENT, handleBlockFieldFocus);
|
|
7352
|
-
return () => {
|
|
7353
|
-
window.removeEventListener(LINKED_ENTRY_EDIT_EVENT, handleLinkedEntryEdit);
|
|
7354
|
-
window.removeEventListener(LINKED_ENTRY_FIELD_FOCUS_EVENT, handleLinkedEntryFieldFocus);
|
|
7355
|
-
window.removeEventListener(BLOCK_FIELD_FOCUS_EVENT, handleBlockFieldFocus);
|
|
7356
|
-
};
|
|
7357
|
-
}, [uiStore]);
|
|
7507
|
+
function textToInlineText(value) {
|
|
7508
|
+
if (typeof value !== "string") return null;
|
|
7509
|
+
return plainTextToInlineText(value);
|
|
7510
|
+
}
|
|
7511
|
+
/**
|
|
7512
|
+
* Extracts the first paragraph text from a TipTap/ProseMirror document.
|
|
7513
|
+
*
|
|
7514
|
+
* Accepts the canonical unwrapped form (`{ type: 'doc', content: [...] }`).
|
|
7515
|
+
*/
|
|
7516
|
+
function extractFirstParagraph(value) {
|
|
7517
|
+
if (!isRichTextDoc(value)) return null;
|
|
7518
|
+
for (const node of value.content) {
|
|
7519
|
+
if (!isRecord$8(node)) continue;
|
|
7520
|
+
if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
|
|
7521
|
+
const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
|
|
7522
|
+
if (text.length > 0) return text;
|
|
7523
|
+
}
|
|
7358
7524
|
return null;
|
|
7359
7525
|
}
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
|
|
7526
|
+
/**
|
|
7527
|
+
* Type guard to check if a value is a valid binding descriptor.
|
|
7528
|
+
*/
|
|
7529
|
+
function isBindingDescriptor(value) {
|
|
7530
|
+
if (!isRecord$8(value) || typeof value.source !== "string") return false;
|
|
7531
|
+
if (!BINDING_SOURCES.includes(value.source)) return false;
|
|
7532
|
+
switch (value.source) {
|
|
7533
|
+
case "field":
|
|
7534
|
+
case "meta": return typeof value.path === "string";
|
|
7535
|
+
case "literal": return "value" in value;
|
|
7536
|
+
case "transform": return typeof value.transform === "string" && (value.input === void 0 || isBindingDescriptorLike(value.input)) && (value.path === void 0 || typeof value.path === "string");
|
|
7537
|
+
case "fallback": return Array.isArray(value.options);
|
|
7538
|
+
default: return false;
|
|
7539
|
+
}
|
|
7364
7540
|
}
|
|
7365
|
-
|
|
7366
|
-
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
});
|
|
7541
|
+
/**
|
|
7542
|
+
* Type guard to check if a value is binding-descriptor-like (can be normalized).
|
|
7543
|
+
*/
|
|
7544
|
+
function isBindingDescriptorLike(value) {
|
|
7545
|
+
return isBindingDescriptor(value) || typeof value === "string" || isRecord$8(value) && typeof value.source === "string" && typeof value.path === "string";
|
|
7371
7546
|
}
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
};
|
|
7384
|
-
|
|
7385
|
-
return /* @__PURE__ */ jsx("div", {
|
|
7386
|
-
className: "relative h-full min-h-0 overflow-hidden bg-muted/30",
|
|
7387
|
-
style: previewPaneContainmentStyle,
|
|
7388
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
7389
|
-
className: "relative flex h-full min-h-0 flex-col overflow-auto",
|
|
7390
|
-
children
|
|
7391
|
-
})
|
|
7392
|
-
});
|
|
7547
|
+
/**
|
|
7548
|
+
* Normalizes a binding input to a binding descriptor.
|
|
7549
|
+
*
|
|
7550
|
+
* Converts string shorthand to field descriptors and validates
|
|
7551
|
+
* that objects have valid binding source values.
|
|
7552
|
+
*/
|
|
7553
|
+
function normalizeBindingInput(value) {
|
|
7554
|
+
if (isBindingDescriptor(value)) return value;
|
|
7555
|
+
if (typeof value === "string") return {
|
|
7556
|
+
source: "field",
|
|
7557
|
+
path: value
|
|
7558
|
+
};
|
|
7559
|
+
return null;
|
|
7393
7560
|
}
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
selectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
7409
|
-
initialSelections: {
|
|
7410
|
-
selectionVersion: props.themeSelectionVersion ?? null,
|
|
7411
|
-
selectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
7412
|
-
buttonStyleSelection: props.themeSelectionButtonStyleSelection ?? null,
|
|
7413
|
-
headerSelection: props.themeSelectionHeaderSelection ?? null,
|
|
7414
|
-
footerLookId: props.themeSelectionFooterLookId ?? null
|
|
7415
|
-
},
|
|
7416
|
-
headerLogoContext: props.themeSelectionHeaderLogo,
|
|
7417
|
-
siteStyleAccess: input.siteStyleAccess,
|
|
7418
|
-
canOpenDesignEditor: props.entryData == null && props.pageId !== null && canInspectSiteStyle(input.siteStyleAccess),
|
|
7419
|
-
children: input.content
|
|
7420
|
-
}) })
|
|
7421
|
-
});
|
|
7561
|
+
//#endregion
|
|
7562
|
+
//#region ../preview-next/src/client/blocks/previewProjection/entryFieldRebinding.ts
|
|
7563
|
+
/**
|
|
7564
|
+
* Only the entry fields that changed are bound in again: unchanged fields keep
|
|
7565
|
+
* the server's materialised value, which may be richer than the stored one
|
|
7566
|
+
* (media the loaders have hydrated, for instance).
|
|
7567
|
+
*/
|
|
7568
|
+
function entryFieldRebindingProjection(changedFields, dateContext) {
|
|
7569
|
+
return Object.keys(changedFields).length === 0 ? null : {
|
|
7570
|
+
kind: "entry-field-rebinding",
|
|
7571
|
+
source: "entry-draft",
|
|
7572
|
+
changedFields,
|
|
7573
|
+
dateContext
|
|
7574
|
+
};
|
|
7422
7575
|
}
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
children: input.children
|
|
7576
|
+
/**
|
|
7577
|
+
* Binds the changed entry fields into a block with template bindings. A binding
|
|
7578
|
+
* whose source did not change resolves to nothing and leaves the content as it is.
|
|
7579
|
+
*/
|
|
7580
|
+
function applyEntryFieldRebindingProjection(block, content, projection) {
|
|
7581
|
+
if (!isRecord$8(block.bindings)) return content;
|
|
7582
|
+
return applyBindingsToContent(content ?? {}, block.bindings, {
|
|
7583
|
+
fields: { ...projection.changedFields },
|
|
7584
|
+
meta: {},
|
|
7585
|
+
dateContext: projection.dateContext
|
|
7434
7586
|
});
|
|
7435
|
-
return /* @__PURE__ */ jsx(PreviewChromeLayerProvider, { children: /* @__PURE__ */ jsx(PreviewThemedSiteDocument, {
|
|
7436
|
-
themeRuntime: input.themeRuntime,
|
|
7437
|
-
useContainerResponsiveMode: previewContainerResponsiveEnabled,
|
|
7438
|
-
viewportMode: input.viewportMode,
|
|
7439
|
-
viewportWidth: input.viewportWidth,
|
|
7440
|
-
scale: input.scale,
|
|
7441
|
-
contentHeight: input.contentHeight,
|
|
7442
|
-
scaleContainerRef: input.scaleContainerRef,
|
|
7443
|
-
contentRef: input.contentRef,
|
|
7444
|
-
staticHeaderNode: input.headerNode,
|
|
7445
|
-
bannerNode: input.bannerNode,
|
|
7446
|
-
staticFooterNode: input.footerNode,
|
|
7447
|
-
siteChromeRenderModel: input.siteChromeRenderModel,
|
|
7448
|
-
children: input.children
|
|
7449
|
-
}) });
|
|
7450
7587
|
}
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
|
|
7460
|
-
|
|
7461
|
-
|
|
7462
|
-
|
|
7463
|
-
|
|
7464
|
-
|
|
7465
|
-
|
|
7466
|
-
|
|
7467
|
-
|
|
7468
|
-
|
|
7469
|
-
|
|
7470
|
-
|
|
7471
|
-
|
|
7472
|
-
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7588
|
+
//#endregion
|
|
7589
|
+
//#region ../preview-next/src/client/blocks/previewProjection/applyPreviewProjections.ts
|
|
7590
|
+
function applyPreviewStructureProjections(blockItems, projections) {
|
|
7591
|
+
return projections.reduce((current, projection) => {
|
|
7592
|
+
if (projection.kind !== "structure-overlay") return current;
|
|
7593
|
+
return applyStructureProjection(current, projection);
|
|
7594
|
+
}, blockItems.slice());
|
|
7595
|
+
}
|
|
7596
|
+
function applyPreviewContentFieldProjections(blockId, content, projections) {
|
|
7597
|
+
return projections.reduce((current, projection) => {
|
|
7598
|
+
if (projection.kind !== "content-field-overrides") return current;
|
|
7599
|
+
return applyContentFieldOverrideProjection(blockId, current, projection);
|
|
7600
|
+
}, content);
|
|
7601
|
+
}
|
|
7602
|
+
function applyPreviewRuntimeContentProjections(block, content, projections) {
|
|
7603
|
+
return projections.reduce((current, projection) => {
|
|
7604
|
+
if (projection.kind === "entry-field-rebinding") return applyEntryFieldRebindingProjection(block, current, projection);
|
|
7605
|
+
if (projection.kind !== "runtime-content-decoration") return current;
|
|
7606
|
+
return applyRuntimeContentDecorationProjection(block, current, projection);
|
|
7607
|
+
}, content);
|
|
7608
|
+
}
|
|
7609
|
+
function blockHasPreviewContentFieldProjection(blockId, projections) {
|
|
7610
|
+
return projections.some((projection) => projection.kind === "content-field-overrides" && blockHasContentFieldOverrideProjection(blockId, projection));
|
|
7611
|
+
}
|
|
7612
|
+
//#endregion
|
|
7613
|
+
//#region ../preview-next/src/client/blocks/pageDesignRuntimePreview.ts
|
|
7614
|
+
function resolveRuntimePreviewSourceForTheme(pageDesignState, theme) {
|
|
7615
|
+
if (!theme?.palette) return resolveRuntimePreviewSource({
|
|
7616
|
+
pageDesignState,
|
|
7617
|
+
surfaceResolutionContext: null
|
|
7618
|
+
});
|
|
7619
|
+
return resolveRuntimePreviewSource({
|
|
7620
|
+
pageDesignState,
|
|
7621
|
+
surfaceResolutionContext: surfaceResolutionContextFromTheme(theme),
|
|
7622
|
+
designRules: designRuntimeRulesForTheme(theme),
|
|
7623
|
+
componentRules: componentRuntimeRulesForTheme(theme)
|
|
7624
|
+
});
|
|
7625
|
+
}
|
|
7626
|
+
function applyPageDesignRuntimeFieldsToBlockContent(block, content, source) {
|
|
7627
|
+
if (source.kind === "preserve-server-runtime") return content;
|
|
7628
|
+
return applyPreviewRuntimeContentProjections(block, content, [runtimeContentDecorationProjectionFromEditorModel(source.editorModel, source.surfaceResolutionContext, source.designRules, source.componentRules)]);
|
|
7629
|
+
}
|
|
7630
|
+
function pageDesignRuntimeProjectionFromSource(source) {
|
|
7631
|
+
if (source.kind === "preserve-server-runtime") return null;
|
|
7632
|
+
return runtimeContentDecorationProjectionFromEditorModel(source.editorModel, source.surfaceResolutionContext, source.designRules, source.componentRules);
|
|
7633
|
+
}
|
|
7634
|
+
function resolveRuntimePreviewSource(input) {
|
|
7635
|
+
if (input.pageDesignState.kind === "loaded" && input.surfaceResolutionContext) return {
|
|
7636
|
+
kind: "apply-editor-model",
|
|
7637
|
+
editorModel: input.pageDesignState.editorModel,
|
|
7638
|
+
surfaceResolutionContext: input.surfaceResolutionContext,
|
|
7639
|
+
designRules: input.designRules,
|
|
7640
|
+
componentRules: input.componentRules
|
|
7641
|
+
};
|
|
7642
|
+
return { kind: "preserve-server-runtime" };
|
|
7643
|
+
}
|
|
7644
|
+
//#endregion
|
|
7645
|
+
//#region ../preview-next/src/client/preview/usePreviewOpeningTheme.ts
|
|
7646
|
+
const noSubscription = () => () => {};
|
|
7647
|
+
const noSnapshot = () => null;
|
|
7648
|
+
/** Select opening inputs; project canonical theme once, and retain it while ink is unchanged. */
|
|
7649
|
+
function usePreviewOpeningTheme(documentTheme) {
|
|
7650
|
+
const store = useOptionalEditorUiStoreInstance();
|
|
7651
|
+
const { state } = usePreviewPageDesignEditorState();
|
|
7652
|
+
const chrome = useSiteChromeCustomizeOptional();
|
|
7653
|
+
const { persistenceOverlayTheme: theme } = usePreviewThemeOverlay();
|
|
7654
|
+
const opening = state.kind === "loaded" ? state.editorModel.blocks[0] : null;
|
|
7655
|
+
const blockId = opening ? unsafeAsEditorBlockId(opening.blockId) : null;
|
|
7656
|
+
const selectContent = useCallback(() => store && blockId ? renderedBlockContent(store, blockId) : null, [store, blockId]);
|
|
7657
|
+
const content = useSyncExternalStore(store?.subscribe ?? noSubscription, selectContent, noSnapshot);
|
|
7658
|
+
const selectOverlays = useCallback(() => store?.getState().aiOverlays ?? null, [store]);
|
|
7659
|
+
const overlays = useSyncExternalStore(store?.subscribe ?? noSubscription, selectOverlays, noSnapshot);
|
|
7660
|
+
const recipe = previewOpeningHeaderRecipe(theme, chrome);
|
|
7661
|
+
const foreground = useMemo(() => {
|
|
7662
|
+
if (!opening || !blockId || !content || state.kind !== "loaded") return null;
|
|
7663
|
+
const projected = applyPreviewContentFieldProjections(blockId, content, overlays ? previewProjectionsFromAiOverlays(overlays) : []);
|
|
7664
|
+
const finalContent = applyPageDesignRuntimeFieldsToBlockContent({
|
|
7665
|
+
id: blockId,
|
|
7666
|
+
kind: opening.blockKind,
|
|
7667
|
+
content
|
|
7668
|
+
}, projected, resolveRuntimePreviewSourceForTheme(state, theme));
|
|
7669
|
+
return resolveBlockSectionForeground({
|
|
7670
|
+
kind: opening.blockKind,
|
|
7671
|
+
content: finalContent
|
|
7672
|
+
}, theme, "authoring");
|
|
7494
7673
|
}, [
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7674
|
+
opening,
|
|
7675
|
+
blockId,
|
|
7676
|
+
content,
|
|
7677
|
+
overlays,
|
|
7678
|
+
state,
|
|
7679
|
+
theme
|
|
7499
7680
|
]);
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
7504
|
-
|
|
7505
|
-
}, [viewportWidth]);
|
|
7506
|
-
useEffect(() => {
|
|
7507
|
-
localStorage.setItem("preview-sidebar-width", String(sidebarWidth));
|
|
7508
|
-
}, [sidebarWidth]);
|
|
7509
|
-
useEffect(() => {
|
|
7510
|
-
localStorage.setItem("preview-zoom-level", String(zoom));
|
|
7511
|
-
}, [zoom]);
|
|
7512
|
-
const overlayScopeKey = entryData?.id ? `entry:${entryData.id}` : `page:${pageId ?? "none"}`;
|
|
7513
|
-
const lastOverlayScopeRef = useRef(null);
|
|
7514
|
-
useEffect(() => {
|
|
7515
|
-
if (lastOverlayScopeRef.current && lastOverlayScopeRef.current !== overlayScopeKey) clearAiOverlays();
|
|
7516
|
-
lastOverlayScopeRef.current = overlayScopeKey;
|
|
7517
|
-
}, [clearAiOverlays, overlayScopeKey]);
|
|
7518
|
-
useEffect(() => {
|
|
7519
|
-
return () => {
|
|
7520
|
-
clearAiOverlays();
|
|
7521
|
-
};
|
|
7522
|
-
}, [clearAiOverlays]);
|
|
7523
|
-
const handleModeChange = useCallback((mode) => {
|
|
7524
|
-
setViewportMode(mode);
|
|
7525
|
-
if (mode === "fixed" && viewportWidth === "full") setViewportWidth(1440);
|
|
7526
|
-
}, [
|
|
7527
|
-
setViewportMode,
|
|
7528
|
-
setViewportWidth,
|
|
7529
|
-
viewportWidth
|
|
7681
|
+
return useMemo(() => foreground && recipe ? applyPageOpeningForegroundToTheme(theme, recipe, { openingForeground: foreground }) : documentTheme, [
|
|
7682
|
+
theme,
|
|
7683
|
+
recipe,
|
|
7684
|
+
JSON.stringify(foreground),
|
|
7685
|
+
documentTheme
|
|
7530
7686
|
]);
|
|
7531
|
-
|
|
7532
|
-
|
|
7533
|
-
|
|
7534
|
-
|
|
7535
|
-
|
|
7536
|
-
|
|
7537
|
-
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7541
|
-
|
|
7542
|
-
|
|
7543
|
-
|
|
7544
|
-
|
|
7545
|
-
|
|
7546
|
-
|
|
7547
|
-
|
|
7548
|
-
|
|
7549
|
-
|
|
7550
|
-
}
|
|
7551
|
-
containerObserverRef.current = new ResizeObserver(updateWidth);
|
|
7552
|
-
containerObserverRef.current.observe(node);
|
|
7553
|
-
updateWidth();
|
|
7554
|
-
}
|
|
7555
|
-
}, []);
|
|
7556
|
-
useEffect(() => {
|
|
7557
|
-
const contentNode = contentRef.current;
|
|
7558
|
-
if (!contentNode) return;
|
|
7559
|
-
const updateHeight = () => {
|
|
7560
|
-
setContentHeight(contentNode.scrollHeight);
|
|
7561
|
-
};
|
|
7562
|
-
contentObserverRef.current = new ResizeObserver(updateHeight);
|
|
7563
|
-
contentObserverRef.current.observe(contentNode);
|
|
7564
|
-
updateHeight();
|
|
7565
|
-
return () => {
|
|
7566
|
-
contentObserverRef.current?.disconnect();
|
|
7687
|
+
}
|
|
7688
|
+
function previewOpeningHeaderRecipe(theme, chrome) {
|
|
7689
|
+
const header = chrome?.getSurfaceState("header");
|
|
7690
|
+
if (header?.kind !== "available" || header.surface !== "header") return null;
|
|
7691
|
+
const background = theme.header.background;
|
|
7692
|
+
if (background?.type === "color" && background.color !== "transparent") return null;
|
|
7693
|
+
return headerStyleRecipeForTheme(theme, header.currentId);
|
|
7694
|
+
}
|
|
7695
|
+
//#endregion
|
|
7696
|
+
//#region ../preview-next/src/client/preview/previewDocumentFrame.ts
|
|
7697
|
+
const PREVIEW_DOCUMENT_FRAME_CLASS_NAME = "builder-preview-document-frame";
|
|
7698
|
+
function planPreviewDocumentFrame(input) {
|
|
7699
|
+
switch (input.viewportMode) {
|
|
7700
|
+
case "squeeze": return {
|
|
7701
|
+
kind: "squeeze",
|
|
7702
|
+
frameClassName: PREVIEW_DOCUMENT_FRAME_CLASS_NAME,
|
|
7703
|
+
frameDataProps: {
|
|
7704
|
+
"data-builder-preview-document-frame": "squeeze",
|
|
7705
|
+
"data-builder-preview-document-scale": "none"
|
|
7706
|
+
}
|
|
7567
7707
|
};
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7708
|
+
case "fixed": return planFixedPreviewDocumentFrame(input);
|
|
7709
|
+
default: return assertNever(input.viewportMode);
|
|
7710
|
+
}
|
|
7711
|
+
}
|
|
7712
|
+
function planFixedPreviewDocumentFrame(input) {
|
|
7713
|
+
const scale = normalizePreviewScale(input.scale);
|
|
7714
|
+
const targetWidthPx = input.viewportWidth === "full" ? 1440 : input.viewportWidth;
|
|
7715
|
+
const scaledWidth = targetWidthPx * scale;
|
|
7716
|
+
const scaledHeight = input.contentHeight > 0 ? input.contentHeight * scale : null;
|
|
7717
|
+
const wrapperStyle = {
|
|
7718
|
+
width: `${scaledWidth}px`,
|
|
7719
|
+
margin: "0 auto"
|
|
7720
|
+
};
|
|
7721
|
+
if (scaledHeight !== null) wrapperStyle.height = `${scaledHeight}px`;
|
|
7722
|
+
else wrapperStyle.minHeight = "100%";
|
|
7723
|
+
return {
|
|
7724
|
+
kind: "fixed",
|
|
7725
|
+
targetWidthPx,
|
|
7726
|
+
wrapperStyle,
|
|
7727
|
+
contentStyle: {
|
|
7728
|
+
minHeight: "100%",
|
|
7729
|
+
width: `${targetWidthPx}px`,
|
|
7730
|
+
...scale === 1 ? {} : { zoom: scale }
|
|
7731
|
+
},
|
|
7732
|
+
siteDocumentStyle: { width: `${targetWidthPx}px` },
|
|
7733
|
+
frameClassName: PREVIEW_DOCUMENT_FRAME_CLASS_NAME,
|
|
7734
|
+
frameDataProps: {
|
|
7735
|
+
"data-builder-preview-document-frame": "fixed",
|
|
7736
|
+
"data-builder-preview-document-scale": scale === 1 ? "none" : "scaled",
|
|
7737
|
+
"data-builder-preview-fixed-header-behavior": "fixed-as-sticky"
|
|
7738
|
+
}
|
|
7739
|
+
};
|
|
7740
|
+
}
|
|
7741
|
+
function normalizePreviewScale(scale) {
|
|
7742
|
+
if (!Number.isFinite(scale) || scale <= 0) return 1;
|
|
7743
|
+
return scale;
|
|
7744
|
+
}
|
|
7745
|
+
function assertNever(value) {
|
|
7746
|
+
throw new Error(`Unhandled preview viewport mode: ${String(value)}`);
|
|
7747
|
+
}
|
|
7748
|
+
//#endregion
|
|
7749
|
+
//#region ../preview-next/src/client/preview/themeRuntime.ts
|
|
7750
|
+
const defaultPreviewThemeRuntime = { kind: "cms-theme" };
|
|
7751
|
+
//#endregion
|
|
7752
|
+
//#region ../preview-next/src/client/preview/PreviewThemedSiteDocument.tsx
|
|
7753
|
+
function planPreviewSiteDocument(theme, bannerNode, headerNode) {
|
|
7754
|
+
return planSiteDocument({
|
|
7755
|
+
headerPositioning: theme.header?.positioning ?? "static",
|
|
7756
|
+
headerVariant: theme.header?.variant ?? null,
|
|
7757
|
+
hasVisibleBanner: Boolean(bannerNode),
|
|
7758
|
+
hasVisibleHeader: Boolean(headerNode)
|
|
7759
|
+
});
|
|
7760
|
+
}
|
|
7761
|
+
function resolveDocumentResponsiveMode(runtime, useContainerResponsiveMode) {
|
|
7762
|
+
return runtime.kind === "none" ? void 0 : runtime.responsiveMode ?? (useContainerResponsiveMode ? "container" : "viewport");
|
|
7763
|
+
}
|
|
7764
|
+
function renderPreviewHeader(model, theme, fallback) {
|
|
7765
|
+
if (!model?.header) return fallback;
|
|
7766
|
+
return /* @__PURE__ */ jsx(SiteChromeEditableSurface, {
|
|
7767
|
+
surface: "header",
|
|
7768
|
+
children: renderSiteChromeBlock(model, "header", theme, { themeConfigOverrideMode: "ignore" })
|
|
7769
|
+
});
|
|
7770
|
+
}
|
|
7771
|
+
function PreviewThemedSiteDocument({ children, themeRuntime = defaultPreviewThemeRuntime, useContainerResponsiveMode, viewportMode, viewportWidth, scale, contentHeight, scaleContainerRef, contentRef, staticHeaderNode, bannerNode, staticFooterNode, siteChromeRenderModel }) {
|
|
7772
|
+
const { effectiveTheme: overlayTheme } = usePreviewThemeOverlay();
|
|
7773
|
+
const effectiveTheme = usePreviewOpeningTheme(overlayTheme);
|
|
7774
|
+
const headerNode = renderPreviewHeader(siteChromeRenderModel, effectiveTheme, staticHeaderNode);
|
|
7775
|
+
const documentNode = renderPreviewDocument({
|
|
7572
7776
|
viewportMode,
|
|
7573
7777
|
viewportWidth,
|
|
7574
|
-
scale
|
|
7575
|
-
const ZOOM_PERCENTAGES = {
|
|
7576
|
-
33: .33,
|
|
7577
|
-
50: .5,
|
|
7578
|
-
75: .75,
|
|
7579
|
-
100: 1
|
|
7580
|
-
};
|
|
7581
|
-
if (viewportMode === "squeeze") return 1;
|
|
7582
|
-
if (zoom === "fit") {
|
|
7583
|
-
if (!containerWidth || containerWidth === 0) return 1;
|
|
7584
|
-
const calculatedScale = containerWidth / (viewportWidth === "full" ? 1440 : viewportWidth);
|
|
7585
|
-
return Math.min(1, calculatedScale);
|
|
7586
|
-
}
|
|
7587
|
-
return ZOOM_PERCENTAGES[zoom];
|
|
7588
|
-
}, [
|
|
7589
|
-
viewportMode,
|
|
7590
|
-
viewportWidth,
|
|
7591
|
-
zoom,
|
|
7592
|
-
containerWidth
|
|
7593
|
-
]),
|
|
7778
|
+
scale,
|
|
7594
7779
|
contentHeight,
|
|
7595
7780
|
scaleContainerRef,
|
|
7596
7781
|
contentRef,
|
|
7782
|
+
siteDocumentPlan: planPreviewSiteDocument(effectiveTheme, bannerNode, headerNode),
|
|
7597
7783
|
headerNode,
|
|
7598
7784
|
bannerNode,
|
|
7599
|
-
footerNode,
|
|
7600
|
-
siteChromeRenderModel,
|
|
7785
|
+
footerNode: renderPreviewFooter(siteChromeRenderModel, effectiveTheme, staticFooterNode),
|
|
7601
7786
|
children
|
|
7602
|
-
}) });
|
|
7603
|
-
const rightPane = /* @__PURE__ */ jsx("div", {
|
|
7604
|
-
className: `${PREVIEW_CHROME_THEME_CLASS_NAME} flex h-full min-h-0 flex-col overflow-hidden ${surfaceDocument.surfaceClassName ?? ""}`,
|
|
7605
|
-
...getPreviewChromeSurfaceDataProps(surfaceDocument),
|
|
7606
|
-
children: /* @__PURE__ */ jsx(React.Suspense, {
|
|
7607
|
-
fallback: null,
|
|
7608
|
-
children: /* @__PURE__ */ jsx(PreviewEditorSidebar, {
|
|
7609
|
-
surfaceId,
|
|
7610
|
-
siteId,
|
|
7611
|
-
dashboardBaseUrl,
|
|
7612
|
-
pageId,
|
|
7613
|
-
pageNodeType: props.pageNodeType,
|
|
7614
|
-
entryData,
|
|
7615
|
-
contentTypeSchema,
|
|
7616
|
-
referenceContentTypeKeys,
|
|
7617
|
-
draftContent,
|
|
7618
|
-
currentTemplate,
|
|
7619
|
-
theme: themeRoles?.persistenceTheme,
|
|
7620
|
-
apiClient,
|
|
7621
|
-
bearerToken,
|
|
7622
|
-
themeId,
|
|
7623
|
-
themeSelectionId,
|
|
7624
|
-
themeSelectionVersion,
|
|
7625
|
-
themeSelectionUpdatedAt,
|
|
7626
|
-
themeSelectionButtonStyleSelection,
|
|
7627
|
-
themeSelectionButtonStyleRepairs,
|
|
7628
|
-
themeSelectionHeaderSelection,
|
|
7629
|
-
themeSelectionFooterLookId,
|
|
7630
|
-
themeSelectionHeaderLogo,
|
|
7631
|
-
sdkConfig: sdkConfig ?? null,
|
|
7632
|
-
activeTab: sidebarTab,
|
|
7633
|
-
onTabChange: (tab) => {
|
|
7634
|
-
setPreviewSidebarTab(tab);
|
|
7635
|
-
setPreviewSidebarActiveTab(tab);
|
|
7636
|
-
},
|
|
7637
|
-
onFooterSaved,
|
|
7638
|
-
onClose: () => setDrawerOpen(false),
|
|
7639
|
-
entrySubrouteContext: entrySubrouteContext ?? null,
|
|
7640
|
-
assistantPanel,
|
|
7641
|
-
bookingOfferingPresets,
|
|
7642
|
-
siteStyleAccess,
|
|
7643
|
-
viewportMode,
|
|
7644
|
-
viewportWidth,
|
|
7645
|
-
zoom,
|
|
7646
|
-
onViewportModeChange: handleModeChange,
|
|
7647
|
-
onViewportWidthChange: setViewportWidth,
|
|
7648
|
-
onZoomChange: setZoom
|
|
7649
|
-
}, overlayScopeKey)
|
|
7650
|
-
})
|
|
7651
|
-
});
|
|
7652
|
-
return renderShellProviders({
|
|
7653
|
-
props,
|
|
7654
|
-
apiClient,
|
|
7655
|
-
siteStyleAccess,
|
|
7656
|
-
themeRoles,
|
|
7657
|
-
content: /* @__PURE__ */ jsxs(PreviewBlockCustomizeSelectionProvider, { children: [
|
|
7658
|
-
/* @__PURE__ */ jsx(LinkedEntryEditEventBridge, {}),
|
|
7659
|
-
/* @__PURE__ */ jsx(React.Suspense, {
|
|
7660
|
-
fallback: null,
|
|
7661
|
-
children: /* @__PURE__ */ jsx(PreviewEditorUI, {
|
|
7662
|
-
dashboardBaseUrl,
|
|
7663
|
-
inMaintenanceMode: maintenanceModeEnabled,
|
|
7664
|
-
siteId,
|
|
7665
|
-
surfaceId,
|
|
7666
|
-
isSiteLaunched,
|
|
7667
|
-
apiClient
|
|
7668
|
-
})
|
|
7669
|
-
}),
|
|
7670
|
-
/* @__PURE__ */ jsx(PreviewAccessBanners, {
|
|
7671
|
-
dashboardBaseUrl,
|
|
7672
|
-
surfaceId,
|
|
7673
|
-
isEntry: Boolean(entryData),
|
|
7674
|
-
pageNodeType: props.pageNodeType
|
|
7675
|
-
}),
|
|
7676
|
-
/* @__PURE__ */ jsx("div", {
|
|
7677
|
-
className: "fixed inset-0 overflow-hidden bg-background",
|
|
7678
|
-
children: isOpen ? /* @__PURE__ */ jsx(ResizableSplitPane, {
|
|
7679
|
-
left: leftPane,
|
|
7680
|
-
right: /* @__PURE__ */ jsx(EditorWriteSurface, { children: rightPane }),
|
|
7681
|
-
defaultSplit: 100 - sidebarWidth,
|
|
7682
|
-
minLeftWidth: 400,
|
|
7683
|
-
minRightWidth: 320,
|
|
7684
|
-
leftLabel: "Preview",
|
|
7685
|
-
rightLabel: "Editor",
|
|
7686
|
-
defaultTab: "right",
|
|
7687
|
-
rightPaneClassName: "h-full min-h-0 overflow-hidden",
|
|
7688
|
-
onSplitChange: (split) => handleSidebarWidthChange(100 - split),
|
|
7689
|
-
splitPercent: 100 - sidebarWidth
|
|
7690
|
-
}) : leftPane
|
|
7691
|
-
})
|
|
7692
|
-
] })
|
|
7693
|
-
});
|
|
7694
|
-
}
|
|
7695
|
-
/** The sidebar belongs to edit mode; a stale open preference cannot expose it while viewing. */
|
|
7696
|
-
function usePreviewDrawerOpen() {
|
|
7697
|
-
const { requestedEditingMode } = useEditor();
|
|
7698
|
-
const drawerOpen = useEditorUiStore((s) => s.drawerOpen);
|
|
7699
|
-
return requestedEditingMode && drawerOpen;
|
|
7700
|
-
}
|
|
7701
|
-
//#endregion
|
|
7702
|
-
//#region ../preview-next/src/auth-contract.ts
|
|
7703
|
-
function isPreviewRuntimeSessionEditable(session) {
|
|
7704
|
-
return session?.kind === "userSession" && session.canEdit;
|
|
7705
|
-
}
|
|
7706
|
-
//#endregion
|
|
7707
|
-
//#region ../preview-next/src/client/preview/PreviewShell.tsx
|
|
7708
|
-
function isOverrideOnlyPreviewShell(props) {
|
|
7709
|
-
return props.rendering?.kind === "overrides-only";
|
|
7710
|
-
}
|
|
7711
|
-
function resolveShellLayoutProps(input) {
|
|
7712
|
-
const { props } = input;
|
|
7713
|
-
return {
|
|
7714
|
-
surfaceId: props.surfaceId,
|
|
7715
|
-
siteId: props.siteId,
|
|
7716
|
-
dashboardBaseUrl: props.dashboardBaseUrl ?? null,
|
|
7717
|
-
pageId: props.pageId,
|
|
7718
|
-
pageNodeType: props.pageNodeType,
|
|
7719
|
-
entryData: props.entryData ?? null,
|
|
7720
|
-
contentTypeSchema: props.contentTypeSchema,
|
|
7721
|
-
referenceContentTypeKeys: props.referenceContentTypeKeys ?? [],
|
|
7722
|
-
draftContent: props.draftContent,
|
|
7723
|
-
currentTemplate: props.currentTemplate,
|
|
7724
|
-
apiClient: input.apiClient,
|
|
7725
|
-
bearerToken: input.bearerToken,
|
|
7726
|
-
themeId: props.themeId ?? null,
|
|
7727
|
-
themeSelectionId: props.themeSelectionId ?? null,
|
|
7728
|
-
themeSelectionVersion: props.themeSelectionVersion ?? null,
|
|
7729
|
-
themeSelectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
7730
|
-
themeSelectionButtonStyleSelection: props.themeSelectionButtonStyleSelection ?? null,
|
|
7731
|
-
themeSelectionButtonStyleRepairs: props.themeSelectionButtonStyleRepairs ?? [],
|
|
7732
|
-
themeSelectionHeaderPreferences: props.themeSelectionHeaderPreferences ?? null,
|
|
7733
|
-
themeSelectionFooterPreferences: props.themeSelectionFooterPreferences,
|
|
7734
|
-
themeSelectionHeaderSelection: props.themeSelectionHeaderSelection ?? null,
|
|
7735
|
-
themeSelectionFooterLookId: props.themeSelectionFooterLookId ?? null,
|
|
7736
|
-
themeSelectionHeaderLogo: props.themeSelectionHeaderLogo,
|
|
7737
|
-
isSiteLaunched: props.isSiteLaunched,
|
|
7738
|
-
maintenanceModeEnabled: props.maintenanceModeEnabled,
|
|
7739
|
-
entrySubrouteContext: props.entrySubrouteContext,
|
|
7740
|
-
assistantPanel: props.assistantPanel,
|
|
7741
|
-
sdkConfig: props.sdkConfig ?? null,
|
|
7742
|
-
bookingOfferingPresets: props.bookingOfferingPresets,
|
|
7743
|
-
siteStyleAccess: input.siteStyleAccess,
|
|
7744
|
-
onFooterSaved: props.onFooterSaved
|
|
7745
|
-
};
|
|
7746
|
-
}
|
|
7747
|
-
function renderShellLayout(input) {
|
|
7748
|
-
const { props } = input;
|
|
7749
|
-
const layoutProps = resolveShellLayoutProps(input);
|
|
7750
|
-
return isOverrideOnlyPreviewShell(props) ? /* @__PURE__ */ jsx(PreviewShellLayout, {
|
|
7751
|
-
...layoutProps,
|
|
7752
|
-
rendering: props.rendering,
|
|
7753
|
-
children: props.children
|
|
7754
|
-
}) : /* @__PURE__ */ jsx(PreviewShellLayout, {
|
|
7755
|
-
...layoutProps,
|
|
7756
|
-
theme: props.theme,
|
|
7757
|
-
renderTheme: props.renderTheme,
|
|
7758
|
-
themeRuntime: props.themeRuntime ?? defaultPreviewThemeRuntime,
|
|
7759
|
-
children: props.children
|
|
7760
7787
|
});
|
|
7788
|
+
return renderThemedDocument(themeRuntime, effectiveTheme, resolveDocumentResponsiveMode(themeRuntime, useContainerResponsiveMode), documentNode);
|
|
7761
7789
|
}
|
|
7762
|
-
function
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7790
|
+
function renderPreviewFooter(model, theme, fallback) {
|
|
7791
|
+
if (!model || model.footer.canRenderReactively === false) return fallback;
|
|
7792
|
+
return /* @__PURE__ */ jsx(SiteChromeEditableSurface, {
|
|
7793
|
+
surface: "footer",
|
|
7794
|
+
preserveSingleComponentRoot: true,
|
|
7795
|
+
children: renderSiteChromeBlock(model, "footer", theme, { themeConfigOverrideMode: "ignore" })
|
|
7766
7796
|
});
|
|
7767
7797
|
}
|
|
7768
|
-
function
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
|
|
7773
|
-
|
|
7774
|
-
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
apiClient,
|
|
7785
|
-
siteStyleAccess,
|
|
7786
|
-
bearerToken
|
|
7787
|
-
}), props.siteFontStorageUrl)]
|
|
7788
|
-
})
|
|
7789
|
-
}) });
|
|
7798
|
+
function renderThemedDocument(runtime, effectiveTheme, responsiveMode, documentNode) {
|
|
7799
|
+
switch (runtime.kind) {
|
|
7800
|
+
case "cms-theme": return /* @__PURE__ */ jsx(ThemeScope, {
|
|
7801
|
+
theme: effectiveTheme,
|
|
7802
|
+
responsiveMode,
|
|
7803
|
+
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7804
|
+
children: documentNode
|
|
7805
|
+
});
|
|
7806
|
+
case "responsive-only": return /* @__PURE__ */ jsx(ResponsiveScope, {
|
|
7807
|
+
responsiveMode,
|
|
7808
|
+
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7809
|
+
children: documentNode
|
|
7810
|
+
});
|
|
7811
|
+
case "none": return documentNode;
|
|
7812
|
+
default: return assertNever$2(runtime);
|
|
7813
|
+
}
|
|
7790
7814
|
}
|
|
7791
|
-
function
|
|
7792
|
-
const
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7815
|
+
function PreviewOverrideOnlySiteDocument({ children, runtime, useContainerResponsiveMode, viewportMode, viewportWidth, scale, contentHeight, scaleContainerRef, contentRef }) {
|
|
7816
|
+
const documentNode = renderPreviewDocument({
|
|
7817
|
+
viewportMode,
|
|
7818
|
+
viewportWidth,
|
|
7819
|
+
scale,
|
|
7820
|
+
contentHeight,
|
|
7821
|
+
scaleContainerRef,
|
|
7822
|
+
contentRef,
|
|
7823
|
+
siteDocumentPlan: planSiteDocument({
|
|
7824
|
+
headerPositioning: "static",
|
|
7825
|
+
headerVariant: null,
|
|
7826
|
+
hasVisibleBanner: false,
|
|
7827
|
+
hasVisibleHeader: false
|
|
7828
|
+
}),
|
|
7829
|
+
headerNode: null,
|
|
7830
|
+
bannerNode: null,
|
|
7831
|
+
footerNode: null,
|
|
7808
7832
|
children
|
|
7809
7833
|
});
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
previewSession,
|
|
7816
|
-
designEditorEligibility,
|
|
7817
|
-
pageId,
|
|
7818
|
-
entryData,
|
|
7819
|
-
hideSiteStyleConfigurator
|
|
7834
|
+
if (runtime.kind === "none") return documentNode;
|
|
7835
|
+
return /* @__PURE__ */ jsx(ResponsiveScope, {
|
|
7836
|
+
responsiveMode: runtime.responsiveMode ?? (useContainerResponsiveMode ? "container" : "viewport"),
|
|
7837
|
+
className: "rb-flex rb-flex-1 rb-flex-col",
|
|
7838
|
+
children: documentNode
|
|
7820
7839
|
});
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7840
|
+
}
|
|
7841
|
+
function renderPreviewDocument({ viewportMode, viewportWidth, scale, contentHeight, scaleContainerRef, contentRef, siteDocumentPlan, headerNode, bannerNode, footerNode, children }) {
|
|
7842
|
+
const framePlan = planPreviewDocumentFrame({
|
|
7843
|
+
viewportMode,
|
|
7844
|
+
viewportWidth,
|
|
7845
|
+
scale,
|
|
7846
|
+
contentHeight
|
|
7847
|
+
});
|
|
7848
|
+
if (viewportMode === "squeeze") {
|
|
7849
|
+
if (framePlan.kind !== "squeeze") return null;
|
|
7850
|
+
return /* @__PURE__ */ jsx(SiteDocumentLayout, {
|
|
7851
|
+
as: "main",
|
|
7852
|
+
role: "main",
|
|
7853
|
+
plan: siteDocumentPlan,
|
|
7854
|
+
headerNode,
|
|
7855
|
+
bannerNode,
|
|
7856
|
+
footerNode,
|
|
7857
|
+
minHeightClassName: null,
|
|
7858
|
+
className: `${framePlan.frameClassName} rb-flex-1 rb-preview-editor-offset`,
|
|
7859
|
+
children
|
|
7860
|
+
});
|
|
7861
|
+
}
|
|
7862
|
+
if (viewportMode === "fixed") {
|
|
7863
|
+
if (framePlan.kind !== "fixed") return null;
|
|
7864
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7865
|
+
ref: scaleContainerRef,
|
|
7866
|
+
className: "h-full overflow-auto",
|
|
7867
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7868
|
+
style: framePlan.wrapperStyle,
|
|
7869
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7870
|
+
ref: contentRef,
|
|
7871
|
+
className: `${framePlan.frameClassName} border-x shadow-sm`,
|
|
7872
|
+
style: framePlan.contentStyle,
|
|
7873
|
+
...framePlan.frameDataProps,
|
|
7874
|
+
children: /* @__PURE__ */ jsx(SiteDocumentLayout, {
|
|
7875
|
+
as: "main",
|
|
7876
|
+
role: "main",
|
|
7877
|
+
plan: siteDocumentPlan,
|
|
7878
|
+
headerNode,
|
|
7879
|
+
bannerNode,
|
|
7880
|
+
footerNode,
|
|
7881
|
+
minHeightClassName: SITE_CHROME_CLASS_NAMES.fullMinHeight,
|
|
7882
|
+
className: "rb-preview-editor-offset",
|
|
7883
|
+
style: framePlan.siteDocumentStyle,
|
|
7884
|
+
children
|
|
7885
|
+
})
|
|
7852
7886
|
})
|
|
7853
7887
|
})
|
|
7854
|
-
})
|
|
7855
|
-
}
|
|
7888
|
+
});
|
|
7889
|
+
}
|
|
7890
|
+
return null;
|
|
7856
7891
|
}
|
|
7857
|
-
|
|
7858
|
-
|
|
7859
|
-
|
|
7860
|
-
|
|
7892
|
+
//#endregion
|
|
7893
|
+
//#region ../preview-next/src/client/preview/linkedEntryEditEvents.ts
|
|
7894
|
+
const LINKED_ENTRY_EDIT_EVENT = "riverbank:preview:linked-entry-edit";
|
|
7895
|
+
const LINKED_ENTRY_FIELD_FOCUS_EVENT = "riverbank:preview:linked-entry-field-focus";
|
|
7896
|
+
const BLOCK_FIELD_FOCUS_EVENT = "riverbank:preview:block-field-focus";
|
|
7897
|
+
function dispatchLinkedEntryEditEvent(target) {
|
|
7898
|
+
window.dispatchEvent(new CustomEvent(LINKED_ENTRY_EDIT_EVENT, { detail: target }));
|
|
7861
7899
|
}
|
|
7862
|
-
function
|
|
7863
|
-
|
|
7864
|
-
pageId: input.pageId,
|
|
7865
|
-
entryData: input.entryData
|
|
7866
|
-
});
|
|
7867
|
-
return {
|
|
7868
|
-
designEditorEnabled: isPreviewRuntimeSessionEditable(input.previewSession) && eligibility.kind === "managed-page" && Boolean(input.pageId),
|
|
7869
|
-
siteStyleAccess: input.hideSiteStyleConfigurator ? { kind: "hidden" } : resolveSiteStyleAccess(input.previewSession)
|
|
7870
|
-
};
|
|
7900
|
+
function dispatchLinkedEntryFieldFocusEvent(binding) {
|
|
7901
|
+
window.dispatchEvent(new CustomEvent(LINKED_ENTRY_FIELD_FOCUS_EVENT, { detail: binding }));
|
|
7871
7902
|
}
|
|
7872
|
-
|
|
7873
|
-
|
|
7874
|
-
/**
|
|
7875
|
-
* Available transform function names.
|
|
7876
|
-
*/
|
|
7877
|
-
const TRANSFORMS = BINDING_TRANSFORMS;
|
|
7878
|
-
const BINDING_SOURCES = [
|
|
7879
|
-
"field",
|
|
7880
|
-
"meta",
|
|
7881
|
-
"literal",
|
|
7882
|
-
"transform",
|
|
7883
|
-
"fallback"
|
|
7884
|
-
];
|
|
7885
|
-
//#endregion
|
|
7886
|
-
//#region ../blocks/src/bindings/index.ts
|
|
7887
|
-
/**
|
|
7888
|
-
* Resolves a binding map to actual content values.
|
|
7889
|
-
*
|
|
7890
|
-
* Returns only keys whose binding resolved to a non-null, non-undefined value.
|
|
7891
|
-
* To merge resolved bindings over a base content object (the dashboard
|
|
7892
|
-
* template preview's use case), see {@link applyBindingsToContent}.
|
|
7893
|
-
*
|
|
7894
|
-
* @param bindings - Map of field keys to binding descriptors
|
|
7895
|
-
* @param context - Entry data context (fields and meta)
|
|
7896
|
-
* @returns Resolved content object with actual values
|
|
7897
|
-
*
|
|
7898
|
-
* @example
|
|
7899
|
-
* ```typescript
|
|
7900
|
-
* const content = applyBindings(
|
|
7901
|
-
* {
|
|
7902
|
-
* headline: { source: 'meta', path: 'title' },
|
|
7903
|
-
* body: { source: 'field', path: 'content' },
|
|
7904
|
-
* },
|
|
7905
|
-
* {
|
|
7906
|
-
* fields: { content: 'Hello world' },
|
|
7907
|
-
* meta: { title: 'My Post', slug: 'my-post' },
|
|
7908
|
-
* }
|
|
7909
|
-
* );
|
|
7910
|
-
* // Result: { headline: 'My Post', body: 'Hello world' }
|
|
7911
|
-
* ```
|
|
7912
|
-
*/
|
|
7913
|
-
function applyBindings(bindings, context) {
|
|
7914
|
-
const result = {};
|
|
7915
|
-
for (const [key, bindingSpec] of Object.entries(bindings)) {
|
|
7916
|
-
if (isBindingDescriptor(bindingSpec)) {
|
|
7917
|
-
const value = resolveBindingValue(bindingSpec, context);
|
|
7918
|
-
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
7919
|
-
continue;
|
|
7920
|
-
}
|
|
7921
|
-
if (typeof bindingSpec === "string") {
|
|
7922
|
-
const value = resolveBindingValue({
|
|
7923
|
-
source: "field",
|
|
7924
|
-
path: bindingSpec
|
|
7925
|
-
}, context);
|
|
7926
|
-
if (value !== void 0 && value !== null) setBindingValue(result, key, value);
|
|
7927
|
-
continue;
|
|
7928
|
-
}
|
|
7929
|
-
if (isRecord$8(bindingSpec)) {
|
|
7930
|
-
const nested = applyBindings(bindingSpec, context);
|
|
7931
|
-
if (Object.keys(nested).length > 0) setBindingValue(result, key, nested);
|
|
7932
|
-
}
|
|
7933
|
-
}
|
|
7934
|
-
return result;
|
|
7903
|
+
function dispatchBlockFieldFocusEvent(target) {
|
|
7904
|
+
window.dispatchEvent(new CustomEvent(BLOCK_FIELD_FOCUS_EVENT, { detail: target }));
|
|
7935
7905
|
}
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
* `block.content`) and *some* values driven by template bindings against
|
|
7941
|
-
* an entry. The base provides defaults; resolved bindings override them.
|
|
7942
|
-
*
|
|
7943
|
-
* Same null-handling as {@link applyBindings}: keys whose binding resolves
|
|
7944
|
-
* to `null`/`undefined` do NOT overwrite the base. This means "no resolved
|
|
7945
|
-
* value" leaves the base value (or absence) intact, which is the correct
|
|
7946
|
-
* semantic for both the SDK/frontend render paths and the dashboard preview.
|
|
7947
|
-
*
|
|
7948
|
-
* Replaces the dashboard's bespoke `applyBindings` that lived in
|
|
7949
|
-
* `apps/dashboard/src/lib/templates/applyBindings.ts` — its divergent
|
|
7950
|
-
* "always-set-null" behaviour produced the `subheadline: null` regression
|
|
7951
|
-
* documented in Phase 1.
|
|
7952
|
-
*
|
|
7953
|
-
* @example
|
|
7954
|
-
* ```typescript
|
|
7955
|
-
* const content = applyBindingsToContent(
|
|
7956
|
-
* { eyebrow: 'Default eyebrow', headline: 'Default headline' },
|
|
7957
|
-
* { headline: { source: 'meta', path: 'title' } },
|
|
7958
|
-
* { fields: {}, meta: { title: 'Entry title' } },
|
|
7959
|
-
* );
|
|
7960
|
-
* // Result: { eyebrow: 'Default eyebrow', headline: 'Entry title' }
|
|
7961
|
-
* ```
|
|
7962
|
-
*/
|
|
7963
|
-
function applyBindingsToContent(baseContent, bindings, context) {
|
|
7964
|
-
return mergeResolvedBindings(baseContent, applyBindings(bindings, context));
|
|
7906
|
+
function isLinkedEntryEditEvent(event) {
|
|
7907
|
+
if (!(event instanceof CustomEvent)) return false;
|
|
7908
|
+
const detail = event.detail;
|
|
7909
|
+
return Boolean(detail) && typeof detail === "object" && detail.kind === "linked-content-entry";
|
|
7965
7910
|
}
|
|
7966
|
-
function
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
}
|
|
7972
|
-
return merged;
|
|
7911
|
+
function isLinkedEntryFieldFocusEvent(event) {
|
|
7912
|
+
if (!(event instanceof CustomEvent)) return false;
|
|
7913
|
+
const detail = event.detail;
|
|
7914
|
+
const write = detail?.write;
|
|
7915
|
+
return Boolean(detail) && typeof detail === "object" && detail.kind === "linked-entry-field" && Boolean(detail.target) && Boolean(write) && typeof write === "object" && typeof write.fieldPath === "string";
|
|
7973
7916
|
}
|
|
7974
|
-
function
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
if (!firstSegment) return;
|
|
7979
|
-
if (segments.length === 1) {
|
|
7980
|
-
target[firstSegment] = value;
|
|
7981
|
-
return;
|
|
7982
|
-
}
|
|
7983
|
-
const isIndex = (segment) => /^\d+$/.test(segment);
|
|
7984
|
-
let current = target;
|
|
7985
|
-
for (let i = 0; i < segments.length; i++) {
|
|
7986
|
-
const segment = segments[i];
|
|
7987
|
-
if (!segment) return;
|
|
7988
|
-
const last = i === segments.length - 1;
|
|
7989
|
-
const nextSegment = segments[i + 1];
|
|
7990
|
-
if (last) {
|
|
7991
|
-
if (Array.isArray(current) && isIndex(segment)) {
|
|
7992
|
-
current[Number(segment)] = value;
|
|
7993
|
-
return;
|
|
7994
|
-
}
|
|
7995
|
-
if (isRecord$8(current)) current[segment] = value;
|
|
7996
|
-
return;
|
|
7997
|
-
}
|
|
7998
|
-
const nextWantsArray = typeof nextSegment === "string" && isIndex(nextSegment);
|
|
7999
|
-
if (Array.isArray(current) && isIndex(segment)) {
|
|
8000
|
-
const index = Number(segment);
|
|
8001
|
-
const existing = current[index];
|
|
8002
|
-
if (nextWantsArray) {
|
|
8003
|
-
if (!Array.isArray(existing)) current[index] = [];
|
|
8004
|
-
} else if (!isRecord$8(existing)) current[index] = {};
|
|
8005
|
-
current = current[index];
|
|
8006
|
-
continue;
|
|
8007
|
-
}
|
|
8008
|
-
if (isRecord$8(current)) {
|
|
8009
|
-
const existing = current[segment];
|
|
8010
|
-
if (nextWantsArray) {
|
|
8011
|
-
if (!Array.isArray(existing)) current[segment] = [];
|
|
8012
|
-
} else if (!isRecord$8(existing)) current[segment] = {};
|
|
8013
|
-
current = current[segment];
|
|
8014
|
-
continue;
|
|
8015
|
-
}
|
|
8016
|
-
return;
|
|
8017
|
-
}
|
|
8018
|
-
}
|
|
8019
|
-
/**
|
|
8020
|
-
* Resolves a single binding descriptor to its value.
|
|
8021
|
-
*/
|
|
8022
|
-
function resolveBindingValue(descriptor, context) {
|
|
8023
|
-
switch (descriptor.source) {
|
|
8024
|
-
case "field": return descriptor.path ? getPath(context.fields, descriptor.path) : void 0;
|
|
8025
|
-
case "meta": return descriptor.path ? getPath(context.meta, descriptor.path) : void 0;
|
|
8026
|
-
case "literal": return descriptor.value;
|
|
8027
|
-
case "transform": {
|
|
8028
|
-
const inputDescriptor = descriptor.input && isBindingDescriptorLike(descriptor.input) ? normalizeBindingInput(descriptor.input) : descriptor.path ? normalizeBindingInput(descriptor.path) : null;
|
|
8029
|
-
const inputValue = inputDescriptor ? resolveBindingValue(inputDescriptor, context) : void 0;
|
|
8030
|
-
return applyTransform(descriptor.transform, inputValue, context.dateContext);
|
|
8031
|
-
}
|
|
8032
|
-
case "fallback":
|
|
8033
|
-
for (const option of descriptor.options ?? []) {
|
|
8034
|
-
const normalized = normalizeBindingInput(option);
|
|
8035
|
-
if (!normalized) continue;
|
|
8036
|
-
const value = resolveBindingValue(normalized, context);
|
|
8037
|
-
if (value !== void 0 && value !== null && value !== "") return value;
|
|
8038
|
-
}
|
|
8039
|
-
return null;
|
|
8040
|
-
default: return null;
|
|
8041
|
-
}
|
|
8042
|
-
}
|
|
8043
|
-
/**
|
|
8044
|
-
* Gets a nested path from an object.
|
|
8045
|
-
*/
|
|
8046
|
-
function getPath(source, path) {
|
|
8047
|
-
const segments = path.split(".").map((segment) => segment.trim()).filter(Boolean);
|
|
8048
|
-
let current = source;
|
|
8049
|
-
for (const segment of segments) {
|
|
8050
|
-
if (!isRecord$8(current)) return void 0;
|
|
8051
|
-
current = current[segment];
|
|
8052
|
-
}
|
|
8053
|
-
return current;
|
|
8054
|
-
}
|
|
8055
|
-
/**
|
|
8056
|
-
* Applies a transform function to a value.
|
|
8057
|
-
*/
|
|
8058
|
-
function applyTransform(name, value, dateContext) {
|
|
8059
|
-
if (!name) return value;
|
|
8060
|
-
switch (name) {
|
|
8061
|
-
case TRANSFORMS.RICHTEXT_FIRST_PARAGRAPH: return extractFirstParagraph(value);
|
|
8062
|
-
case TRANSFORMS.DATE_FORMAT_SHORT: return formatDate(value, dateContext, { date: "short" });
|
|
8063
|
-
case TRANSFORMS.DATE_FORMAT_LONG: return formatDate(value, dateContext, {
|
|
8064
|
-
date: "long",
|
|
8065
|
-
includeTime: true
|
|
8066
|
-
});
|
|
8067
|
-
case TRANSFORMS.TEXT_INLINE_TEXT: return textToInlineText(value);
|
|
8068
|
-
default: return value;
|
|
8069
|
-
}
|
|
8070
|
-
}
|
|
8071
|
-
function textToInlineText(value) {
|
|
8072
|
-
if (typeof value !== "string") return null;
|
|
8073
|
-
return plainTextToInlineText(value);
|
|
8074
|
-
}
|
|
8075
|
-
/**
|
|
8076
|
-
* Extracts the first paragraph text from a TipTap/ProseMirror document.
|
|
8077
|
-
*
|
|
8078
|
-
* Accepts the canonical unwrapped form (`{ type: 'doc', content: [...] }`).
|
|
8079
|
-
*/
|
|
8080
|
-
function extractFirstParagraph(value) {
|
|
8081
|
-
if (!isRichTextDoc(value)) return null;
|
|
8082
|
-
for (const node of value.content) {
|
|
8083
|
-
if (!isRecord$8(node)) continue;
|
|
8084
|
-
if (node.type !== "paragraph" || !Array.isArray(node.content)) continue;
|
|
8085
|
-
const text = node.content.filter((item) => item.type === "text").map((item) => typeof item.text === "string" ? item.text : "").join("").trim();
|
|
8086
|
-
if (text.length > 0) return text;
|
|
8087
|
-
}
|
|
8088
|
-
return null;
|
|
8089
|
-
}
|
|
8090
|
-
/**
|
|
8091
|
-
* Type guard to check if a value is a valid binding descriptor.
|
|
8092
|
-
*/
|
|
8093
|
-
function isBindingDescriptor(value) {
|
|
8094
|
-
if (!isRecord$8(value) || typeof value.source !== "string") return false;
|
|
8095
|
-
if (!BINDING_SOURCES.includes(value.source)) return false;
|
|
8096
|
-
switch (value.source) {
|
|
8097
|
-
case "field":
|
|
8098
|
-
case "meta": return typeof value.path === "string";
|
|
8099
|
-
case "literal": return "value" in value;
|
|
8100
|
-
case "transform": return typeof value.transform === "string" && (value.input === void 0 || isBindingDescriptorLike(value.input)) && (value.path === void 0 || typeof value.path === "string");
|
|
8101
|
-
case "fallback": return Array.isArray(value.options);
|
|
8102
|
-
default: return false;
|
|
8103
|
-
}
|
|
8104
|
-
}
|
|
8105
|
-
/**
|
|
8106
|
-
* Type guard to check if a value is binding-descriptor-like (can be normalized).
|
|
8107
|
-
*/
|
|
8108
|
-
function isBindingDescriptorLike(value) {
|
|
8109
|
-
return isBindingDescriptor(value) || typeof value === "string" || isRecord$8(value) && typeof value.source === "string" && typeof value.path === "string";
|
|
7917
|
+
function isBlockFieldFocusEvent(event) {
|
|
7918
|
+
if (!(event instanceof CustomEvent)) return false;
|
|
7919
|
+
const detail = event.detail;
|
|
7920
|
+
return Boolean(detail) && typeof detail === "object" && detail.kind === "block-field" && typeof detail.blockId === "string" && typeof detail.fieldPath === "string";
|
|
8110
7921
|
}
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
|
|
8119
|
-
|
|
8120
|
-
|
|
8121
|
-
|
|
8122
|
-
|
|
7922
|
+
//#endregion
|
|
7923
|
+
//#region ../preview-next/src/client/preview/LinkedEntryEditEventBridge.tsx
|
|
7924
|
+
function LinkedEntryEditEventBridge() {
|
|
7925
|
+
const uiStore = useEditorUiStoreInstance();
|
|
7926
|
+
useEffect(() => {
|
|
7927
|
+
const handleLinkedEntryEdit = (event) => {
|
|
7928
|
+
if (!isLinkedEntryEditEvent(event)) return;
|
|
7929
|
+
uiStore.getState().linkedEntries.open(event.detail);
|
|
7930
|
+
};
|
|
7931
|
+
const handleLinkedEntryFieldFocus = (event) => {
|
|
7932
|
+
if (!isLinkedEntryFieldFocusEvent(event)) return;
|
|
7933
|
+
const state = uiStore.getState();
|
|
7934
|
+
if (state.linkedEntries.getSelectedEntryId() !== event.detail.write.entryId) state.linkedEntries.open(event.detail.target);
|
|
7935
|
+
state.setActivePreviewField({
|
|
7936
|
+
kind: "linked-entry",
|
|
7937
|
+
entryId: unsafeAsLinkedContentEntryId(event.detail.write.entryId),
|
|
7938
|
+
fieldPath: event.detail.write.fieldPath
|
|
7939
|
+
});
|
|
7940
|
+
};
|
|
7941
|
+
const handleBlockFieldFocus = (event) => {
|
|
7942
|
+
if (!isBlockFieldFocusEvent(event)) return;
|
|
7943
|
+
const state = uiStore.getState();
|
|
7944
|
+
const blockId = unsafeAsEditorBlockId(event.detail.blockId);
|
|
7945
|
+
state.setActivePreviewField({
|
|
7946
|
+
kind: "block",
|
|
7947
|
+
blockId,
|
|
7948
|
+
fieldPath: event.detail.fieldPath
|
|
7949
|
+
});
|
|
7950
|
+
};
|
|
7951
|
+
window.addEventListener(LINKED_ENTRY_EDIT_EVENT, handleLinkedEntryEdit);
|
|
7952
|
+
window.addEventListener(LINKED_ENTRY_FIELD_FOCUS_EVENT, handleLinkedEntryFieldFocus);
|
|
7953
|
+
window.addEventListener(BLOCK_FIELD_FOCUS_EVENT, handleBlockFieldFocus);
|
|
7954
|
+
return () => {
|
|
7955
|
+
window.removeEventListener(LINKED_ENTRY_EDIT_EVENT, handleLinkedEntryEdit);
|
|
7956
|
+
window.removeEventListener(LINKED_ENTRY_FIELD_FOCUS_EVENT, handleLinkedEntryFieldFocus);
|
|
7957
|
+
window.removeEventListener(BLOCK_FIELD_FOCUS_EVENT, handleBlockFieldFocus);
|
|
7958
|
+
};
|
|
7959
|
+
}, [uiStore]);
|
|
8123
7960
|
return null;
|
|
8124
7961
|
}
|
|
8125
7962
|
//#endregion
|
|
8126
|
-
//#region ../preview-next/src/client/
|
|
8127
|
-
|
|
8128
|
-
|
|
8129
|
-
function isRecord$2(value) {
|
|
8130
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
8131
|
-
}
|
|
8132
|
-
function isPathContainer(value) {
|
|
8133
|
-
return Array.isArray(value) || isRecord$2(value);
|
|
7963
|
+
//#region ../preview-next/src/client/preview/PreviewShellLayout.tsx
|
|
7964
|
+
function isOverrideOnlyPreviewShellLayout(props) {
|
|
7965
|
+
return props.rendering?.kind === "overrides-only";
|
|
8134
7966
|
}
|
|
8135
|
-
function
|
|
8136
|
-
|
|
7967
|
+
function resolveShellThemeRoles(props) {
|
|
7968
|
+
if (isOverrideOnlyPreviewShellLayout(props)) return null;
|
|
7969
|
+
return resolvePreviewThemeRoles({
|
|
7970
|
+
theme: props.theme,
|
|
7971
|
+
renderTheme: props.renderTheme
|
|
7972
|
+
});
|
|
8137
7973
|
}
|
|
8138
|
-
|
|
8139
|
-
|
|
8140
|
-
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
return
|
|
7974
|
+
const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
|
|
7975
|
+
const PreviewEditorSidebar = React.lazy(async () => {
|
|
7976
|
+
return { default: (await import("./PreviewEditorSidebar-CXRUbqMp.mjs")).PreviewEditorSidebar };
|
|
7977
|
+
});
|
|
7978
|
+
const PreviewEditorUI = React.lazy(async () => {
|
|
7979
|
+
return { default: (await import("./PreviewEditorUI-CxjEV0Fm.mjs")).PreviewEditorUI };
|
|
7980
|
+
});
|
|
7981
|
+
const previewPaneContainmentStyle = {
|
|
7982
|
+
contain: "layout paint",
|
|
7983
|
+
isolation: "isolate",
|
|
7984
|
+
transform: "translateZ(0)"
|
|
7985
|
+
};
|
|
7986
|
+
function PreviewScrollViewport({ children }) {
|
|
7987
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7988
|
+
className: "relative h-full min-h-0 overflow-hidden bg-muted/30",
|
|
7989
|
+
style: previewPaneContainmentStyle,
|
|
7990
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7991
|
+
className: "relative flex h-full min-h-0 flex-col overflow-auto",
|
|
7992
|
+
children
|
|
7993
|
+
})
|
|
7994
|
+
});
|
|
8144
7995
|
}
|
|
8145
|
-
function
|
|
8146
|
-
if (
|
|
8147
|
-
const
|
|
8148
|
-
|
|
8149
|
-
|
|
8150
|
-
|
|
8151
|
-
|
|
8152
|
-
|
|
8153
|
-
|
|
8154
|
-
|
|
8155
|
-
|
|
8156
|
-
|
|
8157
|
-
|
|
8158
|
-
|
|
8159
|
-
|
|
8160
|
-
|
|
8161
|
-
|
|
8162
|
-
|
|
8163
|
-
|
|
8164
|
-
|
|
8165
|
-
|
|
8166
|
-
|
|
7996
|
+
function renderShellProviders(input) {
|
|
7997
|
+
if (!input.themeRoles) return input.content;
|
|
7998
|
+
const { props, themeRoles } = input;
|
|
7999
|
+
return /* @__PURE__ */ jsx(PreviewThemeOverlayProvider, {
|
|
8000
|
+
baseTheme: themeRoles.documentTheme,
|
|
8001
|
+
persistenceTheme: themeRoles.persistenceTheme,
|
|
8002
|
+
children: /* @__PURE__ */ jsx(PreviewDesignCoordinatorProvider, { children: /* @__PURE__ */ jsx(SiteChromeCustomizeProvider, {
|
|
8003
|
+
siteId: props.siteId,
|
|
8004
|
+
apiClient: input.apiClient,
|
|
8005
|
+
theme: themeRoles.persistenceTheme,
|
|
8006
|
+
headerPreferences: props.themeSelectionHeaderPreferences ?? null,
|
|
8007
|
+
footerPreferences: props.themeSelectionFooterPreferences,
|
|
8008
|
+
themeId: props.themeId ?? null,
|
|
8009
|
+
selectionId: props.themeSelectionId ?? null,
|
|
8010
|
+
selectionVersion: props.themeSelectionVersion ?? null,
|
|
8011
|
+
selectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
8012
|
+
initialSelections: {
|
|
8013
|
+
selectionVersion: props.themeSelectionVersion ?? null,
|
|
8014
|
+
selectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
8015
|
+
buttonStyleSelection: props.themeSelectionButtonStyleSelection ?? null,
|
|
8016
|
+
headerSelection: props.themeSelectionHeaderSelection ?? null,
|
|
8017
|
+
footerLookId: props.themeSelectionFooterLookId ?? null
|
|
8018
|
+
},
|
|
8019
|
+
headerLogoContext: props.themeSelectionHeaderLogo,
|
|
8020
|
+
siteStyleAccess: input.siteStyleAccess,
|
|
8021
|
+
canOpenDesignEditor: props.entryData == null && props.pageId !== null && canInspectSiteStyle(input.siteStyleAccess),
|
|
8022
|
+
children: input.content
|
|
8023
|
+
}) })
|
|
8024
|
+
});
|
|
8167
8025
|
}
|
|
8168
|
-
function
|
|
8169
|
-
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
} else Reflect.set(current, segment, value);
|
|
8180
|
-
return;
|
|
8181
|
-
}
|
|
8182
|
-
if (typeof segment === "number") {
|
|
8183
|
-
if (Array.isArray(current)) {
|
|
8184
|
-
const existing = current[segment];
|
|
8185
|
-
if (isPathContainer(existing)) current = existing;
|
|
8186
|
-
else {
|
|
8187
|
-
const nextContainer = createPathContainer(nextIsIndex);
|
|
8188
|
-
current[segment] = nextContainer;
|
|
8189
|
-
current = nextContainer;
|
|
8190
|
-
}
|
|
8191
|
-
continue;
|
|
8192
|
-
}
|
|
8193
|
-
current = ensureContainerProperty(current, String(segment), nextIsIndex);
|
|
8194
|
-
continue;
|
|
8195
|
-
}
|
|
8196
|
-
current = ensureContainerProperty(current, segment, nextIsIndex);
|
|
8197
|
-
}
|
|
8198
|
-
}
|
|
8199
|
-
//#endregion
|
|
8200
|
-
//#region ../preview-next/src/client/blocks/previewProjection/aiProposalProjection.ts
|
|
8201
|
-
function previewProjectionsFromAiOverlays(overlays) {
|
|
8202
|
-
if (!overlays) return [];
|
|
8203
|
-
const overrides = overlays.overrides ?? /* @__PURE__ */ new Map();
|
|
8204
|
-
const projections = [];
|
|
8205
|
-
if (overlays.structure) projections.push({
|
|
8206
|
-
kind: "structure-overlay",
|
|
8207
|
-
source: "ai-proposal",
|
|
8208
|
-
viewMode: overlays.viewMode,
|
|
8209
|
-
proposalId: overlays.structure.proposalId,
|
|
8210
|
-
includeUnspecified: overlays.structure.includeUnspecified,
|
|
8211
|
-
before: overlays.structure.before,
|
|
8212
|
-
after: overlays.structure.after
|
|
8213
|
-
});
|
|
8214
|
-
if (overrides.size > 0) projections.push({
|
|
8215
|
-
kind: "content-field-overrides",
|
|
8216
|
-
source: "ai-proposal",
|
|
8217
|
-
viewMode: overlays.viewMode,
|
|
8218
|
-
overrides
|
|
8026
|
+
function PreviewDocumentContent(input) {
|
|
8027
|
+
if (input.rendering?.kind === "overrides-only") return /* @__PURE__ */ jsx(PreviewOverrideOnlySiteDocument, {
|
|
8028
|
+
runtime: input.rendering.runtime,
|
|
8029
|
+
useContainerResponsiveMode: previewContainerResponsiveEnabled,
|
|
8030
|
+
viewportMode: input.viewportMode,
|
|
8031
|
+
viewportWidth: input.viewportWidth,
|
|
8032
|
+
scale: input.scale,
|
|
8033
|
+
contentHeight: input.contentHeight,
|
|
8034
|
+
scaleContainerRef: input.scaleContainerRef,
|
|
8035
|
+
contentRef: input.contentRef,
|
|
8036
|
+
children: input.children
|
|
8219
8037
|
});
|
|
8220
|
-
return
|
|
8221
|
-
|
|
8222
|
-
|
|
8223
|
-
|
|
8038
|
+
return /* @__PURE__ */ jsx(PreviewChromeLayerProvider, { children: /* @__PURE__ */ jsx(PreviewThemedSiteDocument, {
|
|
8039
|
+
themeRuntime: input.themeRuntime,
|
|
8040
|
+
useContainerResponsiveMode: previewContainerResponsiveEnabled,
|
|
8041
|
+
viewportMode: input.viewportMode,
|
|
8042
|
+
viewportWidth: input.viewportWidth,
|
|
8043
|
+
scale: input.scale,
|
|
8044
|
+
contentHeight: input.contentHeight,
|
|
8045
|
+
scaleContainerRef: input.scaleContainerRef,
|
|
8046
|
+
contentRef: input.contentRef,
|
|
8047
|
+
staticHeaderNode: input.headerNode,
|
|
8048
|
+
bannerNode: input.bannerNode,
|
|
8049
|
+
staticFooterNode: input.footerNode,
|
|
8050
|
+
siteChromeRenderModel: input.siteChromeRenderModel,
|
|
8051
|
+
children: input.children
|
|
8052
|
+
}) });
|
|
8224
8053
|
}
|
|
8225
|
-
function
|
|
8226
|
-
const
|
|
8227
|
-
|
|
8228
|
-
const
|
|
8229
|
-
const
|
|
8230
|
-
|
|
8231
|
-
|
|
8232
|
-
const
|
|
8233
|
-
const
|
|
8234
|
-
const
|
|
8235
|
-
|
|
8236
|
-
|
|
8237
|
-
|
|
8238
|
-
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
|
|
8248
|
-
|
|
8249
|
-
|
|
8054
|
+
function PreviewShellLayout(props) {
|
|
8055
|
+
const themeRoles = resolveShellThemeRoles(props);
|
|
8056
|
+
const { children, rendering, surfaceId, siteId, dashboardBaseUrl = null, pageId, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, apiClient, bearerToken, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, isSiteLaunched, maintenanceModeEnabled, entrySubrouteContext, assistantPanel, sdkConfig, bookingOfferingPresets, themeRuntime = defaultPreviewThemeRuntime, siteStyleAccess = { kind: "hidden" }, onFooterSaved } = props;
|
|
8057
|
+
const layout = useOptionalPreviewLayout();
|
|
8058
|
+
const headerNode = layout?.headerNode ?? null;
|
|
8059
|
+
const bannerNode = layout?.bannerNode ?? null;
|
|
8060
|
+
const footerNode = layout?.footerNode ?? null;
|
|
8061
|
+
const siteChromeRenderModel = layout?.siteChromeRenderModel ?? null;
|
|
8062
|
+
const surfaceDocument = useMemo(() => resolvePreviewChromeSurface(surfaceId), [surfaceId]);
|
|
8063
|
+
const isOpen = usePreviewDrawerOpen();
|
|
8064
|
+
usePreviewModeRootAttribute(useEditor().isEditingMode);
|
|
8065
|
+
const setDrawerOpen = useEditorUiStore((s) => s.setDrawerOpen);
|
|
8066
|
+
const sidebarTab = useEditorUiStore((s) => s.previewSidebarTab);
|
|
8067
|
+
const setPreviewSidebarActiveTab = useEditorUiStore((s) => s.setPreviewSidebarTab);
|
|
8068
|
+
const viewportMode = useEditorUiStore((s) => s.viewport.mode);
|
|
8069
|
+
const viewportWidth = useEditorUiStore((s) => s.viewport.width);
|
|
8070
|
+
const sidebarWidth = useEditorUiStore((s) => s.viewport.sidebarWidth);
|
|
8071
|
+
const zoom = useEditorUiStore((s) => s.viewport.zoom);
|
|
8072
|
+
const setViewportMode = useEditorUiStore((s) => s.viewport.setMode);
|
|
8073
|
+
const setViewportWidth = useEditorUiStore((s) => s.viewport.setWidth);
|
|
8074
|
+
const setSidebarWidth = useEditorUiStore((s) => s.viewport.setSidebarWidth);
|
|
8075
|
+
const setZoom = useEditorUiStore((s) => s.viewport.setZoom);
|
|
8076
|
+
const clearAiOverlays = useEditorUiStore((s) => s.aiOverlays.clearAll);
|
|
8077
|
+
useEffect(() => {
|
|
8078
|
+
const storedMode = localStorage.getItem("preview-viewport-mode");
|
|
8079
|
+
const storedWidth = localStorage.getItem("preview-viewport-width");
|
|
8080
|
+
const storedSidebarWidth = localStorage.getItem("preview-sidebar-width");
|
|
8081
|
+
const storedZoom = localStorage.getItem("preview-zoom-level");
|
|
8082
|
+
if (storedMode === "squeeze" || storedMode === "fixed") setViewportMode(storedMode);
|
|
8083
|
+
if (storedWidth) if (storedWidth === "full") setViewportWidth("full");
|
|
8084
|
+
else {
|
|
8085
|
+
const width = parseInt(storedWidth, 10);
|
|
8086
|
+
if (Number.isFinite(width)) setViewportWidth(width);
|
|
8250
8087
|
}
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
|
|
8258
|
-
|
|
8259
|
-
}
|
|
8260
|
-
|
|
8261
|
-
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
|
|
8273
|
-
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
|
|
8278
|
-
}
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8287
|
-
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8088
|
+
if (storedSidebarWidth) {
|
|
8089
|
+
const width = parseInt(storedSidebarWidth, 10);
|
|
8090
|
+
if (Number.isFinite(width)) setSidebarWidth(width);
|
|
8091
|
+
}
|
|
8092
|
+
if (storedZoom) if (storedZoom === "fit") setZoom("fit");
|
|
8093
|
+
else {
|
|
8094
|
+
const zoomValue = parseInt(storedZoom, 10);
|
|
8095
|
+
if (zoomValue === 33 || zoomValue === 50 || zoomValue === 75 || zoomValue === 100) setZoom(zoomValue);
|
|
8096
|
+
}
|
|
8097
|
+
}, [
|
|
8098
|
+
setViewportMode,
|
|
8099
|
+
setViewportWidth,
|
|
8100
|
+
setSidebarWidth,
|
|
8101
|
+
setZoom
|
|
8102
|
+
]);
|
|
8103
|
+
useEffect(() => {
|
|
8104
|
+
localStorage.setItem("preview-viewport-mode", viewportMode);
|
|
8105
|
+
}, [viewportMode]);
|
|
8106
|
+
useEffect(() => {
|
|
8107
|
+
localStorage.setItem("preview-viewport-width", String(viewportWidth));
|
|
8108
|
+
}, [viewportWidth]);
|
|
8109
|
+
useEffect(() => {
|
|
8110
|
+
localStorage.setItem("preview-sidebar-width", String(sidebarWidth));
|
|
8111
|
+
}, [sidebarWidth]);
|
|
8112
|
+
useEffect(() => {
|
|
8113
|
+
localStorage.setItem("preview-zoom-level", String(zoom));
|
|
8114
|
+
}, [zoom]);
|
|
8115
|
+
const overlayScopeKey = entryData?.id ? `entry:${entryData.id}` : `page:${pageId ?? "none"}`;
|
|
8116
|
+
const lastOverlayScopeRef = useRef(null);
|
|
8117
|
+
useEffect(() => {
|
|
8118
|
+
if (lastOverlayScopeRef.current && lastOverlayScopeRef.current !== overlayScopeKey) clearAiOverlays();
|
|
8119
|
+
lastOverlayScopeRef.current = overlayScopeKey;
|
|
8120
|
+
}, [clearAiOverlays, overlayScopeKey]);
|
|
8121
|
+
useEffect(() => {
|
|
8122
|
+
return () => {
|
|
8123
|
+
clearAiOverlays();
|
|
8124
|
+
};
|
|
8125
|
+
}, [clearAiOverlays]);
|
|
8126
|
+
const handleModeChange = useCallback((mode) => {
|
|
8127
|
+
setViewportMode(mode);
|
|
8128
|
+
if (mode === "fixed" && viewportWidth === "full") setViewportWidth(1440);
|
|
8129
|
+
}, [
|
|
8130
|
+
setViewportMode,
|
|
8131
|
+
setViewportWidth,
|
|
8132
|
+
viewportWidth
|
|
8133
|
+
]);
|
|
8134
|
+
const handleSidebarWidthChange = useCallback((width) => {
|
|
8135
|
+
setSidebarWidth(width);
|
|
8136
|
+
}, [setSidebarWidth]);
|
|
8137
|
+
useEffect(() => {
|
|
8138
|
+
setPreviewSidebarActiveTab(getPreviewSidebarTab());
|
|
8139
|
+
}, [setPreviewSidebarActiveTab]);
|
|
8140
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
8141
|
+
const [contentHeight, setContentHeight] = useState(0);
|
|
8142
|
+
const containerObserverRef = useRef(null);
|
|
8143
|
+
const contentObserverRef = useRef(null);
|
|
8144
|
+
const contentRef = useRef(null);
|
|
8145
|
+
const scaleContainerRef = useCallback((node) => {
|
|
8146
|
+
if (containerObserverRef.current) {
|
|
8147
|
+
containerObserverRef.current.disconnect();
|
|
8148
|
+
containerObserverRef.current = null;
|
|
8149
|
+
}
|
|
8150
|
+
if (node) {
|
|
8151
|
+
const updateWidth = () => {
|
|
8152
|
+
setContainerWidth(node.offsetWidth);
|
|
8153
|
+
};
|
|
8154
|
+
containerObserverRef.current = new ResizeObserver(updateWidth);
|
|
8155
|
+
containerObserverRef.current.observe(node);
|
|
8156
|
+
updateWidth();
|
|
8157
|
+
}
|
|
8158
|
+
}, []);
|
|
8159
|
+
useEffect(() => {
|
|
8160
|
+
const contentNode = contentRef.current;
|
|
8161
|
+
if (!contentNode) return;
|
|
8162
|
+
const updateHeight = () => {
|
|
8163
|
+
setContentHeight(contentNode.scrollHeight);
|
|
8164
|
+
};
|
|
8165
|
+
contentObserverRef.current = new ResizeObserver(updateHeight);
|
|
8166
|
+
contentObserverRef.current.observe(contentNode);
|
|
8167
|
+
updateHeight();
|
|
8168
|
+
return () => {
|
|
8169
|
+
contentObserverRef.current?.disconnect();
|
|
8170
|
+
};
|
|
8171
|
+
}, [viewportMode, viewportWidth]);
|
|
8172
|
+
const leftPane = /* @__PURE__ */ jsx(PreviewScrollViewport, { children: /* @__PURE__ */ jsx(PreviewDocumentContent, {
|
|
8173
|
+
rendering,
|
|
8174
|
+
themeRuntime,
|
|
8175
|
+
viewportMode,
|
|
8176
|
+
viewportWidth,
|
|
8177
|
+
scale: useMemo(() => {
|
|
8178
|
+
const ZOOM_PERCENTAGES = {
|
|
8179
|
+
33: .33,
|
|
8180
|
+
50: .5,
|
|
8181
|
+
75: .75,
|
|
8182
|
+
100: 1
|
|
8183
|
+
};
|
|
8184
|
+
if (viewportMode === "squeeze") return 1;
|
|
8185
|
+
if (zoom === "fit") {
|
|
8186
|
+
if (!containerWidth || containerWidth === 0) return 1;
|
|
8187
|
+
const calculatedScale = containerWidth / (viewportWidth === "full" ? 1440 : viewportWidth);
|
|
8188
|
+
return Math.min(1, calculatedScale);
|
|
8189
|
+
}
|
|
8190
|
+
return ZOOM_PERCENTAGES[zoom];
|
|
8191
|
+
}, [
|
|
8192
|
+
viewportMode,
|
|
8193
|
+
viewportWidth,
|
|
8194
|
+
zoom,
|
|
8195
|
+
containerWidth
|
|
8196
|
+
]),
|
|
8197
|
+
contentHeight,
|
|
8198
|
+
scaleContainerRef,
|
|
8199
|
+
contentRef,
|
|
8200
|
+
headerNode,
|
|
8201
|
+
bannerNode,
|
|
8202
|
+
footerNode,
|
|
8203
|
+
siteChromeRenderModel,
|
|
8204
|
+
children
|
|
8205
|
+
}) });
|
|
8206
|
+
const rightPane = /* @__PURE__ */ jsx("div", {
|
|
8207
|
+
className: `${PREVIEW_CHROME_THEME_CLASS_NAME} flex h-full min-h-0 flex-col overflow-hidden ${surfaceDocument.surfaceClassName ?? ""}`,
|
|
8208
|
+
...getPreviewChromeSurfaceDataProps(surfaceDocument),
|
|
8209
|
+
children: /* @__PURE__ */ jsx(React.Suspense, {
|
|
8210
|
+
fallback: null,
|
|
8211
|
+
children: /* @__PURE__ */ jsx(PreviewEditorSidebar, {
|
|
8212
|
+
surfaceId,
|
|
8213
|
+
siteId,
|
|
8214
|
+
dashboardBaseUrl,
|
|
8215
|
+
pageId,
|
|
8216
|
+
pageNodeType: props.pageNodeType,
|
|
8217
|
+
entryData,
|
|
8218
|
+
contentTypeSchema,
|
|
8219
|
+
referenceContentTypeKeys,
|
|
8220
|
+
draftContent,
|
|
8221
|
+
currentTemplate,
|
|
8222
|
+
theme: themeRoles?.persistenceTheme,
|
|
8223
|
+
apiClient,
|
|
8224
|
+
bearerToken,
|
|
8225
|
+
themeId,
|
|
8226
|
+
themeSelectionId,
|
|
8227
|
+
themeSelectionVersion,
|
|
8228
|
+
themeSelectionUpdatedAt,
|
|
8229
|
+
themeSelectionButtonStyleSelection,
|
|
8230
|
+
themeSelectionButtonStyleRepairs,
|
|
8231
|
+
themeSelectionHeaderSelection,
|
|
8232
|
+
themeSelectionFooterLookId,
|
|
8233
|
+
themeSelectionHeaderLogo,
|
|
8234
|
+
sdkConfig: sdkConfig ?? null,
|
|
8235
|
+
activeTab: sidebarTab,
|
|
8236
|
+
onTabChange: (tab) => {
|
|
8237
|
+
setPreviewSidebarTab(tab);
|
|
8238
|
+
setPreviewSidebarActiveTab(tab);
|
|
8239
|
+
},
|
|
8240
|
+
onFooterSaved,
|
|
8241
|
+
onClose: () => setDrawerOpen(false),
|
|
8242
|
+
entrySubrouteContext: entrySubrouteContext ?? null,
|
|
8243
|
+
assistantPanel,
|
|
8244
|
+
bookingOfferingPresets,
|
|
8245
|
+
siteStyleAccess,
|
|
8246
|
+
viewportMode,
|
|
8247
|
+
viewportWidth,
|
|
8248
|
+
zoom,
|
|
8249
|
+
onViewportModeChange: handleModeChange,
|
|
8250
|
+
onViewportWidthChange: setViewportWidth,
|
|
8251
|
+
onZoomChange: setZoom
|
|
8252
|
+
}, overlayScopeKey)
|
|
8253
|
+
})
|
|
8254
|
+
});
|
|
8255
|
+
return renderShellProviders({
|
|
8256
|
+
props,
|
|
8257
|
+
apiClient,
|
|
8258
|
+
siteStyleAccess,
|
|
8259
|
+
themeRoles,
|
|
8260
|
+
content: /* @__PURE__ */ jsxs(PreviewBlockCustomizeSelectionProvider, { children: [
|
|
8261
|
+
/* @__PURE__ */ jsx(LinkedEntryEditEventBridge, {}),
|
|
8262
|
+
/* @__PURE__ */ jsx(React.Suspense, {
|
|
8263
|
+
fallback: null,
|
|
8264
|
+
children: /* @__PURE__ */ jsx(PreviewEditorUI, {
|
|
8265
|
+
dashboardBaseUrl,
|
|
8266
|
+
inMaintenanceMode: maintenanceModeEnabled,
|
|
8267
|
+
siteId,
|
|
8268
|
+
surfaceId,
|
|
8269
|
+
isSiteLaunched,
|
|
8270
|
+
apiClient
|
|
8271
|
+
})
|
|
8272
|
+
}),
|
|
8273
|
+
/* @__PURE__ */ jsx(PreviewAccessBanners, {
|
|
8274
|
+
dashboardBaseUrl,
|
|
8275
|
+
surfaceId,
|
|
8276
|
+
isEntry: Boolean(entryData),
|
|
8277
|
+
pageNodeType: props.pageNodeType
|
|
8278
|
+
}),
|
|
8279
|
+
/* @__PURE__ */ jsx("div", {
|
|
8280
|
+
className: "fixed inset-0 overflow-hidden bg-background",
|
|
8281
|
+
children: isOpen ? /* @__PURE__ */ jsx(ResizableSplitPane, {
|
|
8282
|
+
left: leftPane,
|
|
8283
|
+
right: /* @__PURE__ */ jsx(EditorWriteSurface, { children: rightPane }),
|
|
8284
|
+
defaultSplit: 100 - sidebarWidth,
|
|
8285
|
+
minLeftWidth: 400,
|
|
8286
|
+
minRightWidth: 320,
|
|
8287
|
+
leftLabel: "Preview",
|
|
8288
|
+
rightLabel: "Editor",
|
|
8289
|
+
defaultTab: "right",
|
|
8290
|
+
rightPaneClassName: "h-full min-h-0 overflow-hidden",
|
|
8291
|
+
onSplitChange: (split) => handleSidebarWidthChange(100 - split),
|
|
8292
|
+
splitPercent: 100 - sidebarWidth
|
|
8293
|
+
}) : leftPane
|
|
8294
|
+
})
|
|
8295
|
+
] })
|
|
8291
8296
|
});
|
|
8292
|
-
return {
|
|
8293
|
-
kind: "runtime-content-decoration",
|
|
8294
|
-
source: "page-design",
|
|
8295
|
-
fieldsByBlockId: runtimeFieldsByBlockId(compiled.blocks),
|
|
8296
|
-
joins: compiled.joins
|
|
8297
|
-
};
|
|
8298
|
-
}
|
|
8299
|
-
function runtimeFieldsByBlockId(blocks) {
|
|
8300
|
-
return new Map(blocks.map((block) => [block.blockId, block.fields]));
|
|
8301
|
-
}
|
|
8302
|
-
function applyRuntimeContentDecorationProjection(block, content, projection) {
|
|
8303
|
-
const blockId = designBlockIdFromBlockItem(block);
|
|
8304
|
-
const fields = blockId ? projection.fieldsByBlockId.get(blockId) : void 0;
|
|
8305
|
-
return applyCompiledRuntimeFieldsToContent(isRecord$1(content) ? content : {}, fields);
|
|
8306
8297
|
}
|
|
8307
|
-
|
|
8308
|
-
|
|
8298
|
+
/** The sidebar belongs to edit mode; a stale open preference cannot expose it while viewing. */
|
|
8299
|
+
function usePreviewDrawerOpen() {
|
|
8300
|
+
const { requestedEditingMode } = useEditor();
|
|
8301
|
+
const drawerOpen = useEditorUiStore((s) => s.drawerOpen);
|
|
8302
|
+
return requestedEditingMode && drawerOpen;
|
|
8309
8303
|
}
|
|
8310
|
-
|
|
8311
|
-
|
|
8304
|
+
//#endregion
|
|
8305
|
+
//#region ../preview-next/src/auth-contract.ts
|
|
8306
|
+
function isPreviewRuntimeSessionEditable(session) {
|
|
8307
|
+
return session?.kind === "userSession" && session.canEdit;
|
|
8312
8308
|
}
|
|
8313
8309
|
//#endregion
|
|
8314
|
-
//#region ../preview-next/src/client/
|
|
8315
|
-
|
|
8316
|
-
|
|
8317
|
-
|
|
8318
|
-
|
|
8319
|
-
|
|
8320
|
-
|
|
8321
|
-
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8310
|
+
//#region ../preview-next/src/client/preview/PreviewShell.tsx
|
|
8311
|
+
function isOverrideOnlyPreviewShell(props) {
|
|
8312
|
+
return props.rendering?.kind === "overrides-only";
|
|
8313
|
+
}
|
|
8314
|
+
function resolveShellLayoutProps(input) {
|
|
8315
|
+
const { props } = input;
|
|
8316
|
+
return {
|
|
8317
|
+
surfaceId: props.surfaceId,
|
|
8318
|
+
siteId: props.siteId,
|
|
8319
|
+
dashboardBaseUrl: props.dashboardBaseUrl ?? null,
|
|
8320
|
+
pageId: props.pageId,
|
|
8321
|
+
pageNodeType: props.pageNodeType,
|
|
8322
|
+
entryData: props.entryData ?? null,
|
|
8323
|
+
contentTypeSchema: props.contentTypeSchema,
|
|
8324
|
+
referenceContentTypeKeys: props.referenceContentTypeKeys ?? [],
|
|
8325
|
+
draftContent: props.draftContent,
|
|
8326
|
+
currentTemplate: props.currentTemplate,
|
|
8327
|
+
apiClient: input.apiClient,
|
|
8328
|
+
bearerToken: input.bearerToken,
|
|
8329
|
+
themeId: props.themeId ?? null,
|
|
8330
|
+
themeSelectionId: props.themeSelectionId ?? null,
|
|
8331
|
+
themeSelectionVersion: props.themeSelectionVersion ?? null,
|
|
8332
|
+
themeSelectionUpdatedAt: props.themeSelectionUpdatedAt ?? null,
|
|
8333
|
+
themeSelectionButtonStyleSelection: props.themeSelectionButtonStyleSelection ?? null,
|
|
8334
|
+
themeSelectionButtonStyleRepairs: props.themeSelectionButtonStyleRepairs ?? [],
|
|
8335
|
+
themeSelectionHeaderPreferences: props.themeSelectionHeaderPreferences ?? null,
|
|
8336
|
+
themeSelectionFooterPreferences: props.themeSelectionFooterPreferences,
|
|
8337
|
+
themeSelectionHeaderSelection: props.themeSelectionHeaderSelection ?? null,
|
|
8338
|
+
themeSelectionFooterLookId: props.themeSelectionFooterLookId ?? null,
|
|
8339
|
+
themeSelectionHeaderLogo: props.themeSelectionHeaderLogo,
|
|
8340
|
+
isSiteLaunched: props.isSiteLaunched,
|
|
8341
|
+
maintenanceModeEnabled: props.maintenanceModeEnabled,
|
|
8342
|
+
entrySubrouteContext: props.entrySubrouteContext,
|
|
8343
|
+
assistantPanel: props.assistantPanel,
|
|
8344
|
+
sdkConfig: props.sdkConfig ?? null,
|
|
8345
|
+
bookingOfferingPresets: props.bookingOfferingPresets,
|
|
8346
|
+
siteStyleAccess: input.siteStyleAccess,
|
|
8347
|
+
onFooterSaved: props.onFooterSaved
|
|
8326
8348
|
};
|
|
8327
8349
|
}
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
*/
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8350
|
+
function renderShellLayout(input) {
|
|
8351
|
+
const { props } = input;
|
|
8352
|
+
const layoutProps = resolveShellLayoutProps(input);
|
|
8353
|
+
return isOverrideOnlyPreviewShell(props) ? /* @__PURE__ */ jsx(PreviewShellLayout, {
|
|
8354
|
+
...layoutProps,
|
|
8355
|
+
rendering: props.rendering,
|
|
8356
|
+
children: props.children
|
|
8357
|
+
}) : /* @__PURE__ */ jsx(PreviewShellLayout, {
|
|
8358
|
+
...layoutProps,
|
|
8359
|
+
theme: props.theme,
|
|
8360
|
+
renderTheme: props.renderTheme,
|
|
8361
|
+
themeRuntime: props.themeRuntime ?? defaultPreviewThemeRuntime,
|
|
8362
|
+
children: props.children
|
|
8338
8363
|
});
|
|
8339
8364
|
}
|
|
8340
|
-
|
|
8341
|
-
|
|
8342
|
-
|
|
8343
|
-
|
|
8344
|
-
|
|
8345
|
-
return applyStructureProjection(current, projection);
|
|
8346
|
-
}, blockItems.slice());
|
|
8365
|
+
function wrapPreviewSiteFontStorage(children, siteFontStorageUrl) {
|
|
8366
|
+
return /* @__PURE__ */ jsx(PreviewSiteFontStorageProvider, {
|
|
8367
|
+
siteFontStorageUrl,
|
|
8368
|
+
children
|
|
8369
|
+
});
|
|
8347
8370
|
}
|
|
8348
|
-
function
|
|
8349
|
-
|
|
8350
|
-
|
|
8351
|
-
|
|
8352
|
-
|
|
8371
|
+
function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
|
|
8372
|
+
const { apiClient } = useEntryEditorController();
|
|
8373
|
+
const bearerToken = usePreviewToken();
|
|
8374
|
+
return /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
|
|
8375
|
+
apiClient,
|
|
8376
|
+
siteId: props.siteId,
|
|
8377
|
+
pageId: props.pageId,
|
|
8378
|
+
enabled: designEditorEnabled,
|
|
8379
|
+
children: /* @__PURE__ */ jsxs(MediaEditorProvider, {
|
|
8380
|
+
siteId: props.siteId,
|
|
8381
|
+
apiClient,
|
|
8382
|
+
bearerToken,
|
|
8383
|
+
supabaseUrl: props.supabaseUrl,
|
|
8384
|
+
mediaAssets: props.mediaAssets,
|
|
8385
|
+
children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch: props.baseFetch }), wrapPreviewSiteFontStorage(renderShellLayout({
|
|
8386
|
+
props,
|
|
8387
|
+
apiClient,
|
|
8388
|
+
siteStyleAccess,
|
|
8389
|
+
bearerToken
|
|
8390
|
+
}), props.siteFontStorageUrl)]
|
|
8391
|
+
})
|
|
8392
|
+
}) });
|
|
8353
8393
|
}
|
|
8354
|
-
function
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8394
|
+
function PreviewBlockApiProvider({ config, children }) {
|
|
8395
|
+
const token = usePreviewToken();
|
|
8396
|
+
return /* @__PURE__ */ jsx(BlockApiProvider, {
|
|
8397
|
+
config: useMemo(() => {
|
|
8398
|
+
if (!config || !token) return config;
|
|
8399
|
+
return {
|
|
8400
|
+
...config,
|
|
8401
|
+
auth: config.auth.type === "bearer" ? {
|
|
8402
|
+
...config.auth,
|
|
8403
|
+
token
|
|
8404
|
+
} : config.auth,
|
|
8405
|
+
readAuthority: config.readAuthority?.kind === "preview" ? {
|
|
8406
|
+
...config.readAuthority,
|
|
8407
|
+
token
|
|
8408
|
+
} : config.readAuthority
|
|
8409
|
+
};
|
|
8410
|
+
}, [config, token]),
|
|
8411
|
+
children
|
|
8412
|
+
});
|
|
8360
8413
|
}
|
|
8361
|
-
function
|
|
8362
|
-
|
|
8414
|
+
function PreviewShell(props) {
|
|
8415
|
+
const { apiBaseUrl, blockApiConfig, siteId, siteSlug, editableId, previewSession, previewToken, pageId, routeId, entryData, contentTypeSchema, initialStatus, initialBlocks, pageMetadata, designEditorEligibility, hideSiteStyleConfigurator = false } = props;
|
|
8416
|
+
const apiClient = useMemo(() => createGuardedPreviewApiClient(apiBaseUrl), [apiBaseUrl]);
|
|
8417
|
+
const { designEditorEnabled, siteStyleAccess } = resolveShellAccess({
|
|
8418
|
+
previewSession,
|
|
8419
|
+
designEditorEligibility,
|
|
8420
|
+
pageId,
|
|
8421
|
+
entryData,
|
|
8422
|
+
hideSiteStyleConfigurator
|
|
8423
|
+
});
|
|
8424
|
+
return /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
|
|
8425
|
+
session: previewSession,
|
|
8426
|
+
token: previewToken,
|
|
8427
|
+
siteId,
|
|
8428
|
+
siteSlug,
|
|
8429
|
+
pageId: editableId,
|
|
8430
|
+
children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
|
|
8431
|
+
config: blockApiConfig,
|
|
8432
|
+
children: /* @__PURE__ */ jsx(PreviewEditingModeProvider, {
|
|
8433
|
+
siteId,
|
|
8434
|
+
children: /* @__PURE__ */ jsxs(PreviewEntryControllerProvider, {
|
|
8435
|
+
blockFieldExtensions: props.sdkConfig?.blockFieldExtensions ?? null,
|
|
8436
|
+
businessTimeZone: props.businessTimeZone,
|
|
8437
|
+
siteId,
|
|
8438
|
+
pageId,
|
|
8439
|
+
pageNodeType: props.pageNodeType,
|
|
8440
|
+
routeId,
|
|
8441
|
+
entryData,
|
|
8442
|
+
contentTypeSchema,
|
|
8443
|
+
initialStatus,
|
|
8444
|
+
initialBlocks,
|
|
8445
|
+
pageMetadata,
|
|
8446
|
+
apiClient,
|
|
8447
|
+
subscribeToLeaseChanges: props.subscribeToLeaseChanges,
|
|
8448
|
+
onLeaseGranted: props.onLeaseGranted,
|
|
8449
|
+
liveDrafts: props.liveDrafts ?? void 0,
|
|
8450
|
+
children: [/* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}), /* @__PURE__ */ jsx(PreviewEditorBody, {
|
|
8451
|
+
props,
|
|
8452
|
+
designEditorEnabled,
|
|
8453
|
+
siteStyleAccess
|
|
8454
|
+
})]
|
|
8455
|
+
})
|
|
8456
|
+
})
|
|
8457
|
+
})
|
|
8458
|
+
}) });
|
|
8459
|
+
}
|
|
8460
|
+
function defaultDesignEditorEligibility(input) {
|
|
8461
|
+
if (input.entryData) return { kind: "content-entry" };
|
|
8462
|
+
if (input.pageId) return { kind: "managed-page" };
|
|
8463
|
+
return { kind: "unsupported" };
|
|
8464
|
+
}
|
|
8465
|
+
function resolveShellAccess(input) {
|
|
8466
|
+
const eligibility = input.designEditorEligibility ?? defaultDesignEditorEligibility({
|
|
8467
|
+
pageId: input.pageId,
|
|
8468
|
+
entryData: input.entryData
|
|
8469
|
+
});
|
|
8470
|
+
return {
|
|
8471
|
+
designEditorEnabled: isPreviewRuntimeSessionEditable(input.previewSession) && eligibility.kind === "managed-page" && Boolean(input.pageId),
|
|
8472
|
+
siteStyleAccess: input.hideSiteStyleConfigurator ? { kind: "hidden" } : resolveSiteStyleAccess(input.previewSession)
|
|
8473
|
+
};
|
|
8363
8474
|
}
|
|
8364
8475
|
//#endregion
|
|
8365
8476
|
//#region ../preview-next/src/client/blocks/composer/mergeDrafts.ts
|
|
@@ -9969,6 +10080,7 @@ function QuickManifestFields({ fields, backend, blockKind, bookingOfferingPreset
|
|
|
9969
10080
|
children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
|
|
9970
10081
|
bookingOfferingPresets,
|
|
9971
10082
|
children: /* @__PURE__ */ jsx(FormRenderer, {
|
|
10083
|
+
dateContext: civilPickerDisplay.dateContext,
|
|
9972
10084
|
fields,
|
|
9973
10085
|
backend,
|
|
9974
10086
|
widgetOverrides: previewWidgetOverrides,
|
|
@@ -10261,7 +10373,7 @@ function BoundaryControl({ previousBlockId, nextBlockId, previousBlockKind, next
|
|
|
10261
10373
|
saveSequenceRef.current = sequence;
|
|
10262
10374
|
setFeedback({ kind: "saving" });
|
|
10263
10375
|
applyAction(action).then((outcome) => {
|
|
10264
|
-
if (saveSequenceRef.current !== sequence || outcome.kind === "skipped") return;
|
|
10376
|
+
if (saveSequenceRef.current !== sequence || outcome.kind === "skipped" || outcome.kind === "cancelled") return;
|
|
10265
10377
|
setFeedback(outcome.kind === "saved" || outcome.kind === "queued" ? { kind: "idle" } : {
|
|
10266
10378
|
kind: "error",
|
|
10267
10379
|
message: outcome.message
|
|
@@ -10534,34 +10646,6 @@ function formatBlockKindLabel(blockKind) {
|
|
|
10534
10646
|
return ((blockKind.includes(".") ? blockKindParts[blockKindParts.length - 1] : blockKind) ?? blockKind).split(/[-_]/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
10535
10647
|
}
|
|
10536
10648
|
//#endregion
|
|
10537
|
-
//#region ../preview-next/src/client/blocks/pageDesignRuntimePreview.ts
|
|
10538
|
-
function resolveRuntimePreviewSourceForTheme(pageDesignState, theme) {
|
|
10539
|
-
if (!theme?.palette) return resolveRuntimePreviewSource({
|
|
10540
|
-
pageDesignState,
|
|
10541
|
-
surfaceResolutionContext: null
|
|
10542
|
-
});
|
|
10543
|
-
return resolveRuntimePreviewSource({
|
|
10544
|
-
pageDesignState,
|
|
10545
|
-
surfaceResolutionContext: surfaceResolutionContextFromTheme(theme),
|
|
10546
|
-
designRules: designRuntimeRulesForTheme(theme),
|
|
10547
|
-
componentRules: componentRuntimeRulesForTheme(theme)
|
|
10548
|
-
});
|
|
10549
|
-
}
|
|
10550
|
-
function pageDesignRuntimeProjectionFromSource(source) {
|
|
10551
|
-
if (source.kind === "preserve-server-runtime") return null;
|
|
10552
|
-
return runtimeContentDecorationProjectionFromEditorModel(source.editorModel, source.surfaceResolutionContext, source.designRules, source.componentRules);
|
|
10553
|
-
}
|
|
10554
|
-
function resolveRuntimePreviewSource(input) {
|
|
10555
|
-
if (input.pageDesignState.kind === "loaded" && input.surfaceResolutionContext) return {
|
|
10556
|
-
kind: "apply-editor-model",
|
|
10557
|
-
editorModel: input.pageDesignState.editorModel,
|
|
10558
|
-
surfaceResolutionContext: input.surfaceResolutionContext,
|
|
10559
|
-
designRules: input.designRules,
|
|
10560
|
-
componentRules: input.componentRules
|
|
10561
|
-
};
|
|
10562
|
-
return { kind: "preserve-server-runtime" };
|
|
10563
|
-
}
|
|
10564
|
-
//#endregion
|
|
10565
10649
|
//#region ../preview-next/src/client/blocks/previewBatchLoaderParams.ts
|
|
10566
10650
|
function isBatchableEndpoint(endpoint) {
|
|
10567
10651
|
return endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow" || endpoint === "getPublicEventDetails" || endpoint === "listPublicRouteCandidates" || endpoint === "listPublicTeamMembers" || endpoint === "listPublicProducts" || endpoint === "getPublicBookingServices" || endpoint === "getPublicWeeklySlotAvailability" || endpoint === "getPublicFormById";
|