@riverbankcms/sdk 0.158.0 → 0.160.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -6
- package/dist/_dts/{BlocksIslandsHydrator-BgNBtEai.d.ts → BlocksIslandsHydrator-CoqeotCL.d.ts} +1 -1
- package/dist/_dts/{Page-DpCo8zXD.d.ts → Page-C0ENVLCF.d.ts} +13 -6
- package/dist/_dts/{SdkPreviewMode-Bv2TMscG.d.ts → SdkPreviewMode-jZK0A49V.d.ts} +54 -126
- package/dist/_dts/{client-B960v2gW.d.ts → client-uMMuPq9V.d.ts} +23 -1
- package/dist/_dts/{content-types-CN0Wy8V6.d.ts → content-types-D6nXGqdQ.d.ts} +18 -18
- package/dist/_dts/{contracts-BFUrby76.d.ts → contracts-Bnmj1nxu.d.ts} +6 -5
- package/dist/_dts/{footerPageOutline-CmoqleLS.d.ts → footerPageOutline-CeLjFX8b.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-Dkvivc3R.d.ts → generatePageMetadata-nyU8q02J.d.ts} +5 -2
- package/dist/_dts/{index-DPfI2t5A.d.ts → index-BaaGBY1v.d.ts} +2 -2
- package/dist/_dts/{index-DCNu_8it.d.ts → index-Bg64CkV-.d.ts} +4 -4
- package/dist/_dts/index-Blwl7yl6.d.ts +13 -0
- package/dist/_dts/{index-DaS_z6ir.d.ts → index-C5xslEBn.d.ts} +2 -2
- package/dist/_dts/{index-DpgkhY-a.d.ts → index-CEaKil7G.d.ts} +2 -2
- package/dist/_dts/{index-Ba6RmuxX.d.ts → index-DahMwisK.d.ts} +3 -3
- package/dist/_dts/index-lkpjIg5i.d.ts +66 -0
- package/dist/_dts/{index-DfkFWUxt.d.ts → index-nVoi_74l.d.ts} +2 -2
- package/dist/_dts/{loadContent-DvvKF4nB.d.ts → loadContent-CYLmzvLq.d.ts} +16 -7
- package/dist/_dts/{resolvePageContent-D0lGwVD6.d.ts → resolvePageContent-DqnxChOs.d.ts} +2 -2
- package/dist/_dts/{constants-DkcKHMX-.d.ts → runtime-BY8DQBbT.d.ts} +10 -16
- package/dist/_dts/{hosted-booking-appearance-BIbit60h.d.ts → schema-D0bNcPWK.d.ts} +6921 -6768
- 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 +12 -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 +6 -6
- package/dist/_dts/sdk/src/metadata/index.d.ts +8 -2
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +7 -7
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +10 -28
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
- 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 +6 -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-BJrRUaY7.d.ts → types-CFrYuXYP.d.ts} +2 -2
- package/dist/_dts/{navigation-n-eTVTIQ.d.ts → types-D8czmbQF.d.ts} +15430 -16836
- package/dist/_dts/{types-BY7PgnDi.d.ts → types-DSgmJ15W.d.ts} +7 -7
- package/dist/_dts/{types-maEnXL6Z.d.ts → types-Dm-KW7nj.d.ts} +10 -13
- package/dist/_dts/{validation-BjuVrMrs.d.ts → validation-Bmb4WnHg.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-WRLS96Ev.mjs → BlocksIslandsHydrator-DZRKi6tT.mjs} +17 -17
- package/dist/client/{BookingMailingListNote-eovghMPa.mjs → BookingMailingListNote-C00sLLdL.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-CIcMQRc1.mjs → CalendarNavigationChevron-CHSi9b3E.mjs} +6 -6
- package/dist/client/{CheckboxChoice-BF9eCNno.mjs → CheckboxChoice-Bhm6RAUL.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-CdnFgDyQ.mjs → DemoBookingPortalAccess-CaN-7ui7.mjs} +6 -6
- package/dist/client/{DemoPortalSignInLink-DHxYgkT6.mjs → DemoPortalSignInLink-ClxN5_xZ.mjs} +1 -1
- package/dist/client/{EventCalendar.client-Dc-ZLxKo.mjs → EventCalendar.client-BncvSa1n.mjs} +10 -9
- package/dist/client/{EventCombined.client-C93XqRIv.mjs → EventCombined.client-DluBxVVu.mjs} +8 -8
- package/dist/client/{EventEmbeddedCheckoutStep-B3XUyNY9.mjs → EventEmbeddedCheckoutStep-BiJrMtfp.mjs} +1 -1
- package/dist/client/{EventItem-DnCTygqk.mjs → EventItem-CXhnT9pF.mjs} +11 -6
- package/dist/client/{EventListWeekNavigation-9h97heuQ.mjs → EventListWeekNavigation-V-dtoDlD.mjs} +1 -1
- package/dist/client/{EventListing.client-DFKlQvvs.mjs → EventListing.client-DPO6SZbx.mjs} +3 -3
- package/dist/client/{EventListing.view-pAuTDyrP.mjs → EventListing.view-B-Yi5JZS.mjs} +7 -7
- package/dist/client/{EventRegistrationPayment-rgKlBvhP.mjs → EventRegistrationPayment-Dc3Fnlnw.mjs} +189 -176
- package/dist/client/{LeafletStaticMap-3XiWSgy0.mjs → LeafletStaticMap-ClZCCzAm.mjs} +1 -1
- package/dist/client/{Page-BmpeAwID.mjs → Page-7PkzO04N.mjs} +1949 -2074
- package/dist/client/{StepIndicator-qEq6X5zP.mjs → StepIndicator-DiD6euZ8.mjs} +3 -3
- package/dist/client/{TabBarFragment-DvzIV75f.mjs → TabBarFragment-BHd8GN8y.mjs} +1 -1
- package/dist/client/{ThemedButton-DVBC_pS9.mjs → ThemedButton-C22C9cCF.mjs} +174 -93
- package/dist/client/{accordion-DeObOasQ.mjs → accordion-2m27DsIk.mjs} +1 -1
- package/dist/client/{booking-form.client-DfWeF0lj.mjs → booking-form.client-BddWV5w1.mjs} +12 -12
- package/dist/client/{bookingForm-TnzIBHx2.mjs → bookingForm-bcdXQjmw.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/{carousel-kkFnbr5Z.mjs → carousel-D7nj9I0y.mjs} +2 -2
- package/dist/client/{carousel.client-BJGoJVtg.mjs → carousel.client-AffDJo_s.mjs} +1 -1
- package/dist/client/{cart-BAXNbFux.mjs → cart-PN6yCw1H.mjs} +3 -3
- package/dist/client/{cart.client-BczxUF70.mjs → cart.client-D4t1f0cJ.mjs} +1 -1
- package/dist/client/{checkout-C5NRhPeP.mjs → checkout-CsTwXVSb.mjs} +3 -3
- package/dist/client/{checkout.client-BuDk3Td9.mjs → checkout.client-BhQE3zY7.mjs} +1 -1
- package/dist/client/client.mjs +25 -13
- package/dist/client/{context-CVsgML69.mjs → context-BLAvalAa.mjs} +1 -1
- package/dist/client/{cta-BWnUuJce.mjs → cta-CUXhX_D7.mjs} +2 -1
- package/dist/client/dateFormatting-BHIHxNuo.mjs +61 -0
- package/dist/client/{demoPortalMagicLink-CUlwvmxf.mjs → demoPortalMagicLink-R-awbk_0.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-Cw8nnFj-.mjs → enhanceHeaderSection-9Q93uvTo.mjs} +3 -3
- package/dist/client/{event-details.client-Bl0E_6Vi.mjs → event-details.client-BS1WtG-a.mjs} +2 -2
- package/dist/client/{event-registration.client-DmfLg_LC.mjs → event-registration.client-BXndwsET.mjs} +35 -21
- package/dist/client/{eventCalendar-D1Dwb9VA.mjs → eventCalendar-HyoOt1Qz.mjs} +4 -4
- package/dist/client/{eventCombined-DfsqY1qR.mjs → eventCombined-sdG5oEaH.mjs} +4 -4
- package/dist/client/{eventDetails-BmugDVoa.mjs → eventDetails-FFAknE4w.mjs} +2 -2
- package/dist/client/{eventListing-BPAGJi3C.mjs → eventListing-CGK6urk3.mjs} +4 -4
- package/dist/client/{eventRegistration-DBlz_x6u.mjs → eventRegistration-VhrvCs4l.mjs} +4 -4
- package/dist/client/{form-DVu3ZMjx.mjs → form-C-B5O_ko.mjs} +3 -3
- package/dist/client/{form.client-QZUyABIY.mjs → form.client-DoZVcl8d.mjs} +5 -5
- package/dist/client/{form.parts-Bs0F3v08.mjs → form.parts-mttKpgif.mjs} +3 -3
- package/dist/client/{formatDate-BD9D3dgo.mjs → formatDate-xUSCknEO.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -3
- package/dist/client/{headerSection-BQwWW4Yy.mjs → headerSection-BHUEXsaI.mjs} +2 -2
- package/dist/client/{location-map.client-upKuwABk.mjs → location-map.client-Cylb_MHw.mjs} +2 -2
- package/dist/client/{location-map.view-RuBCD10O.mjs → location-map.view-Cx4Bl7ij.mjs} +69 -6
- package/dist/client/{locationMap-1sCbsk0V.mjs → locationMap-QnKJi-nZ.mjs} +2 -2
- package/dist/client/{newsletter-form.client-DBTU3oNv.mjs → newsletter-form.client-D_n0rftg.mjs} +8 -8
- package/dist/client/{newsletter-form.parts-C9I9JBhe.mjs → newsletter-form.parts-DKHye4IE.mjs} +2 -2
- package/dist/client/{newsletterForm-DTPtTxxG.mjs → newsletterForm-tEaYelzx.mjs} +3 -3
- package/dist/client/{noop-DMFt3KdC.mjs → noop-B610YKEx.mjs} +12 -5
- package/dist/client/portal/client.mjs +4562 -174
- package/dist/client/{product-detail.client-BX7M5o6p.mjs → product-detail.client-DUf5x5Jt.mjs} +1 -1
- package/dist/client/{product-list.client-i32QNY4c.mjs → product-list.client-Cqp1BPTV.mjs} +1 -1
- package/dist/client/{productDetail-DWjE9zm7.mjs → productDetail-B8bBiogP.mjs} +3 -3
- package/dist/client/{productList-DZH9_brv.mjs → productList-BKN4D-1z.mjs} +3 -3
- package/dist/client/{propsDecoder-CTzHkEkh.mjs → propsDecoder-2nNZh2Oe.mjs} +3 -3
- package/dist/client/{registry.server-vJ5FlscU.mjs → registry.server-BAm4RPNJ.mjs} +856 -872
- package/dist/client/rendering/client.mjs +27 -26
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +47 -28
- package/dist/client/{richText-coerce-DXAmC72p.mjs → richText-coerce-Cv-qomNB.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CmC7ygin.mjs → routeIslandApiConfig-C5u8MbAA.mjs} +1 -1
- package/dist/client/{shop-C7eL3B37.mjs → shop-DZNC0VKk.mjs} +3 -3
- package/dist/client/{shop-commerce-D8oRN0QJ.mjs → shop-commerce-DdX4LSa3.mjs} +12 -12
- package/dist/client/{shop-commerce-store-CRnQ4M18.mjs → shop-commerce-store-BJtrZov9.mjs} +1 -1
- package/dist/client/{shop.client-X6d6KVmA.mjs → shop.client-DmDd-igg.mjs} +16 -15
- package/dist/client/{shop.interactive-DBMeM8VD.mjs → shop.interactive-5SnnDHz3.mjs} +402 -35
- package/dist/client/{shopShared-Y182kN_s.mjs → shopShared-CPqUlAh9.mjs} +2 -2
- package/dist/client/{src-7cXhT0G_.mjs → src-VIsPY-kw.mjs} +6 -1
- package/dist/client/timetableModel-C19rcHEw.mjs +960 -0
- package/dist/client/{useAvailableSlots-BDV6MHgJ.mjs → useAvailableSlots-BjbJXotk.mjs} +3 -3
- package/dist/client/{useBookingNowIso-DgJEv3ZY.mjs → useBookingNowIso-CMgfL7YJ.mjs} +1 -1
- package/dist/client/{useDiscountApply-BTu9EeT7.mjs → useDiscountApply-KG8jB7WC.mjs} +2 -2
- package/dist/client/{useDiscountCodeUi-BfZxdxI-.mjs → useDiscountCodeUi-DK2w_i0a.mjs} +1 -1
- package/dist/client/{useEventPagination-pnvdHGeQ.mjs → useEventPagination-DW6MCirb.mjs} +11 -10
- package/dist/client/uuid-BETKW8rS.mjs +12 -0
- package/dist/client/{view-hJr_L4QC2.mjs → view-CkUn3Y0Y.mjs} +4 -4
- package/dist/client/{view-BPEa6Okm.mjs → view-CseyBW07.mjs} +15 -70
- package/dist/client/{wizardSteps-HdyGoIG3.mjs → wizardSteps-zgq10lN1.mjs} +262 -65
- package/dist/preview-next/before-render.mjs +1 -1
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-BFlBqSu4.mjs → EventEmbeddedCheckoutStep-lUHBrzHv.mjs} +1 -1
- package/dist/preview-next/client/{PreviewEditorSidebar-CXRUbqMp.mjs → PreviewEditorSidebar-DWyUGCAG.mjs} +1217 -107
- package/dist/preview-next/client/{PreviewEditorUI-CxjEV0Fm.mjs → PreviewEditorUI-Wq0b3Daw.mjs} +52 -79
- package/dist/preview-next/client/{SdkPreviewModeRuntime-XdQSGGj_.mjs → SdkPreviewModeRuntime-BtZPcwYV.mjs} +1 -1
- package/dist/preview-next/client/{SdkPreviewModeRuntime-BxI12BBS.mjs → SdkPreviewModeRuntime-wSI_R361.mjs} +720 -2035
- package/dist/preview-next/client/{SiteChromeCustomizeContext-CfRQRwpH.mjs → SiteChromeCustomizeContext-Hc4pYnNe.mjs} +14365 -8155
- package/dist/preview-next/client/{ThemedButton-BEOPss9H.mjs → ThemedButton-DzeycIlD.mjs} +204 -93
- package/dist/preview-next/client/{previewChromeSurface-CH7hd5n7.mjs → previewChromeSurface-Corq4AG7.mjs} +3 -8
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/{sdk-runtime-C6xEU1LI.mjs → sdk-runtime-CWymRWhK.mjs} +1 -1
- package/dist/preview-next/client/siteStyleAccess-QZkJRHl5.mjs +1359 -0
- package/dist/preview-next/client/{spinner-BTf1CZmy.mjs → spinner-C4If5Y-O.mjs} +1 -1
- package/dist/preview-next/editor-base.css +62 -0
- package/dist/preview-next/editor-chrome.css +85 -0
- package/dist/preview-next/keepAlive.mjs +1 -1
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-DM22uOXM.mjs → route-contract-8csADeIT.mjs} +149 -112
- package/dist/server/{Block.shared-DLoilC2J.mjs → Block.shared-D1_gonwM.mjs} +6 -6
- package/dist/server/{bindings-C7DKLVx_.mjs → bindings-CFmJg5lm.mjs} +2 -2
- package/dist/server/{client-CU4wlMLE.mjs → client-DPsi0Dai.mjs} +9 -7
- package/dist/server/config-template-validation.mjs +50 -10
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +2 -2
- package/dist/server/{generatePageMetadata-CPvssVOp.mjs → generatePageMetadata-DB_lbrZ7.mjs} +28 -2
- package/dist/server/index.mjs +2 -2
- package/dist/server/{loadContent-DmQ4BiiQ.mjs → loadContent-RMCcuVU_.mjs} +33 -20
- package/dist/server/loadPage-DUPP51C-.mjs +2 -0
- package/dist/server/{loadPage-BBkDQA57.mjs → loadPage-DhDGzj7t.mjs} +8 -5
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/metadata.mjs +2 -2
- package/dist/server/next.mjs +13 -12
- package/dist/server/{overrideResolution-ByeAbLSO.mjs → overrideResolution-OxY5FMuy.mjs} +1 -1
- package/dist/server/{overrides-BcA6ZPWf.mjs → overrides-Bz_A6sB9.mjs} +586 -518
- package/dist/server/page-converter.mjs +8 -10
- package/dist/server/{prebuild-8T-m7XjB.mjs → prebuild-B_1vrSru.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/{prefetchBlockData-Bjya-X9t.mjs → prefetchBlockData-B7ukYXXR.mjs} +841 -887
- package/dist/server/{publicProducts-C3meXS2o.mjs → publicProducts-Djbpc81A.mjs} +166 -129
- package/dist/server/{blocks-jlIm0PWc.mjs → registry-eFjKtEhF.mjs} +2349 -1716
- package/dist/server/rendering/server.mjs +4 -4
- package/dist/server/rendering.mjs +7 -7
- package/dist/server/{resolveBlockData-D0ow8PRJ.mjs → resolveBlockData-DYvEa9c5.mjs} +6 -3
- package/dist/server/routing.mjs +1 -1
- package/dist/server/{schema-Bs735S27.mjs → schema-C3dJ5UkL.mjs} +148 -88
- package/dist/server/server.mjs +3 -3
- package/dist/server/{siteChromeOverlayClearance-BangtD8A.mjs → siteChromeOverlayClearance-DALIAMwo.mjs} +108 -11
- package/dist/server/{src-B935_bzN.mjs → src-C5Mu-z0F.mjs} +268 -189
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{themeAdmission-D2-BnmDO.mjs → themeAdmission-ruoyXb_0.mjs} +9 -7
- package/dist/server/{three-pass-converter-CmmchOFC.mjs → three-pass-converter-Chnb1XD-.mjs} +2 -58
- package/dist/server/{validation-Cm41pDUB.mjs → validation-B-Xar8QS.mjs} +22 -63
- package/dist/server/{version-Bo9C3McI.mjs → version-Bg7VHK3i.mjs} +1 -1
- package/dist/styles/index.css +78 -0
- package/package.json +8 -3
- package/dist/_dts/index-CXsnaCGe.d.ts +0 -10
- package/dist/_dts/index-cnymEAZY.d.ts +0 -1
- package/dist/client/timetableModel-D7PwpaBY.mjs +0 -480
- package/dist/preview-next/client/siteStyleAccess-CRXaC2oL.mjs +0 -1326
- package/dist/server/loadPage-ZrcfjG3X.mjs +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual,
|
|
3
|
-
import { A as
|
|
4
|
-
import { n as Separator, t as Spinner } from "./spinner-
|
|
5
|
-
import { c as resolvePreviewSidebarChromeModel, d as useBlockCustomizeControls, h as
|
|
2
|
+
import { A as resolveButtonStyleSelection, D as buttonStyleSelectionParameterValue, E as buttonStyleHoverPreferenceValue, F as buttonStyleSelectionsEqual, Jr as getSiteFontsStorageUrl, Kr as buildFontPreviewUrl, M as updateButtonStyleSelectionChoice, N as buttonStyleSelectionKey, Yn as paletteColorEntries, Yr as VARIANT_ROLES, Zn as paletteColorsSchema, i as ThemedButtonSpecimen, j as updateButtonStyleHoverPreference, k as findButtonStyleRecipe, ki as parseSiteId, qr as generateFontFaceCss, yi as expectParsedBrandedId } from "./ThemedButton-DzeycIlD.mjs";
|
|
3
|
+
import { $t as RichTextWidgetProvider, A as cancelPreview, As as formatDate, B as planStyleSwitch, Bo as DropdownMenuSeparator, Bt as MailingListTargetingProvider, C as reportPreviewDesignError, Co as TabsContent, Cr as enabledBackgroundModes, D as selectionSnapshotFromApplySiteStyleSelectionResponse, Da as defaultFooterPreferences, Dr as planBackgroundTransition, Ds as syncStateOf, Dt as LinkedEntryLeaseBanner, E as buildApplySiteStyleSelectionBody, Ea as replaceSiteStyleCompilationPlan, Es as displayedValues, F as markApplyFailed, Fn as canWriteLinkedEntry, Fo as Surface, Fs as assertNever$1, Ft as SiteOptionWidgetProvider, G as previewHeaderStyle, Gn as civilPickerDisplay, Gt as ButtonVariantField, H as previewCuratedPalette, Ht as IconPickerField, I as markApplySaved, Io as DropdownMenu, It as OfferingsPreviewGroupOrderField, J as setPaletteColors, Jn as listPageSurfaceContentSlots, Jo as Smartphone, Jt as MediaField, K as resetTypographyToSaved, Kt as ButtonWidgetProvider, L as markApplySaving, Ln as PaletteProvider, Lo as DropdownMenuContent, Lt as OfferingsPreviewWidgetProvider, M as deriveStyleConfiguratorCapabilities, Mo as Collapsible, Ms as parseUtcIsoDateTimeString, Mt as createSiteOptionApiLoader, N as dismissWarnings, No as CollapsibleContent, Nr as resolveSdkFooterMode, Ns as resolveBookingBusinessTimeZone, Nt as createSiteOptionWidgetAdapters, O as applyResolvedSelections, Or as rankBackgroundImagePoolItems, Os as valueStatus, P as isPreviewingChange, Pn as isEdited, Po as CollapsibleTrigger, Pt as SiteOptionPickerField, Qt as RichTextField, R as openRow, Rn as usePalette, Ro as DropdownMenuItem, Rt as MailingListTargetingField, S as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, Sa as defaultHeaderLogoContext, Sn as useEditorUiStoreInstance, So as Tabs, St as useAutosaveStatus, T as usePreviewAuthoringAdmission, To as TabsTrigger, Tr as parseBackgroundOverrideFromContent, U as previewFooterLook, Un as FormRenderer, Uo as X$1, Ut as EntryPickerField, V as previewButtonStyle, Vn as createManifestValidation, Vo as DropdownMenuTrigger, Vt as InlineTextField, W as previewHeaderLayout, Wt as EntryPickerWidgetProvider, X as syncStyleConfiguratorState, Xt as ReferenceWidgetProvider, Y as styleConfiguratorHistoryEntryForPersistedSelection, Yn as blocksKeys, Yo as SlidersHorizontal, Yr as buildThemeRuntime, Yt as ReferenceField, Z as toggleRow, Zt as useRichTextImagePicker, _ as usePreviewPageDesignEditorState, _a as getGradientPreset, _n as parseReferenceKind, _o as SearchInput, _r as mapCurrentValueForSelect, _t as useEntryController, a as usePreviewDesignCoordinator, an as BlockSourceLine, ba as getHeaderLayout, bn as resolveContentTitle, bo as PopoverTrigger, c as buildSiteChromeSelectionModels, ct as resolveFooterLayoutHints, d as createOptimisticActionRunner, do as SelectContent, ds as ChevronDown, ea as compileReplacementSiteThemeFromSelections, f as resolveStyleConfiguratorInitialSnapshot, fa as offeredSiteStyles, fo as SelectItem, fs as Check, ga as GRADIENT_PRESETS, gn as isAdapterReferenceKind, go as CalloutDescription, gr as hasEmptyOption, gs as useField, ha as gradientToCss, hn as BUILT_IN_REFERENCE_KINDS, ho as Callout, hr as useSdkConfig, hs as cn, in as BlockEditor, j as createStyleConfiguratorState, jn as toEditorBlockItem, jr as ThemeScope, js as parseBookingLocalDate, k as applyTypographyDraftPatch, kr as resolveBackgroundCapability, l as cycleSiteChromeSelectionId, lr as unwrapResponse, ls as ChevronRight, mn as routeLifecycleContext, mo as SelectValue, mr as SdkConfigProvider, mt as useUISelector, n as useSiteChromeCustomizeOptional, nn as LinkField, ns as Maximize2, nt as usePreviewAuth, oo as FieldFrame, ot as FooterComposerPanel, pa as palettesForSiteStyle, po as SelectTrigger, pr as createStoreBackend, ps as Button, pt as ContentFieldsForm, q as restageSelectionChanges, qn as listEntryPageContentSlots, qo as Tablet, qt as FileField, r as StyleSwitchSummary, rn as LinkWidgetProvider, rr as getDashboardUrl, ta as compileUpdatedSiteThemeFromSelections, ts as Monitor, u as planSiteChromeSelection, ua as getCuratedSiteStyle, uo as Select, us as ChevronLeft, vn as deriveRouteMetadataPresentation, vo as Popover, vr as mapOptionValueForSelect, w as acceptStyleSelection, wo as TabsList, wr as imagePoolForOverride, xa as getHeaderStyle, xn as useEditorUiStore, xo as Input, xr as canCycleBackgroundOverrideValue, ya as findFooterLook, yn as resolvePageRouteSlug, yo as PopoverContent, yr as unmapValueFromSelect, yt as useOptionalSessionJournal, z as palettePreviewProjection, zn as ManifestForm, zo as DropdownMenuLabel, zt as loadMailingListAuthoringContext } from "./SiteChromeCustomizeContext-Hc4pYnNe.mjs";
|
|
4
|
+
import { n as Separator, t as Spinner } from "./spinner-C4If5Y-O.mjs";
|
|
5
|
+
import { C as pageDesignLookPosition, D as formatTokenLabel, E as BackgroundPreviewSwatch, M as usePreviewBlockCustomizeSelectionOptional, O as gradientLabel, T as BackgroundChooser, _ as lookIsAutomatic, b as useArrangementToolbar, c as resolvePreviewSidebarChromeModel, d as useBlockCustomizeControls, f as ArrangementLookNote, h as ArrangementOptionsBody, i as resolvePreviewDashboardSetupHandoff, k as readBackgroundColorPaletteSnapshot, o as resolvePreviewEditorGuidanceModel, r as buildPreviewDashboardSetupUrl, t as canInspectSiteStyle, u as usePreviewSiteFontStorageUrl, v as lookPosition, w as setPageDesignBlockBackground, x as CustomizeBackgroundControlRows } from "./siteStyleAccess-QZkJRHl5.mjs";
|
|
6
6
|
import React, { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
@@ -578,6 +578,366 @@ const SUBROUTE_KINDS = {
|
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
//#endregion
|
|
581
|
+
//#region ../block-form/src/widgets/SelectWidget.tsx
|
|
582
|
+
/**
|
|
583
|
+
* Standalone select widget with block-form styling parity. Supports custom option
|
|
584
|
+
* renderers while maintaining accessible labelling and message semantics.
|
|
585
|
+
*/
|
|
586
|
+
function SelectWidget(props) {
|
|
587
|
+
const { id, label, value, onChange, options, description, hint, error, placeholder, triggerClassName, size = "default", disabled, className, labelClassName, descriptionClassName, renderOption, renderValue, dataPath } = props;
|
|
588
|
+
const normalizedValue = value ?? "";
|
|
589
|
+
const allowEmptyOption = useMemo(() => hasEmptyOption(options), [options]);
|
|
590
|
+
const radixValue = useMemo(() => mapCurrentValueForSelect(value, allowEmptyOption), [value, allowEmptyOption]);
|
|
591
|
+
const selectedOption = useMemo(() => options.find((option) => option.value === normalizedValue), [options, normalizedValue]);
|
|
592
|
+
return /* @__PURE__ */ jsx("div", {
|
|
593
|
+
"data-theme-path": dataPath,
|
|
594
|
+
children: /* @__PURE__ */ jsx(FieldFrame, {
|
|
595
|
+
id,
|
|
596
|
+
label,
|
|
597
|
+
description,
|
|
598
|
+
hint,
|
|
599
|
+
error,
|
|
600
|
+
className,
|
|
601
|
+
labelClassName,
|
|
602
|
+
descriptionClassName,
|
|
603
|
+
children: ({ id: controlId, descriptionId, messageId }) => {
|
|
604
|
+
const describedBy = [descriptionId, messageId].filter(Boolean).join(" ") || void 0;
|
|
605
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
606
|
+
value: radixValue,
|
|
607
|
+
onValueChange: (nextValue) => onChange(unmapValueFromSelect(nextValue, allowEmptyOption)),
|
|
608
|
+
disabled,
|
|
609
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
610
|
+
id: controlId,
|
|
611
|
+
size,
|
|
612
|
+
className: cn("w-full justify-between", triggerClassName),
|
|
613
|
+
"aria-describedby": describedBy,
|
|
614
|
+
children: renderValue && value !== null && value !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
615
|
+
className: "truncate",
|
|
616
|
+
children: renderValue(selectedOption)
|
|
617
|
+
}) : /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? `Select ${label.toLowerCase()}` })
|
|
618
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => {
|
|
619
|
+
const optionValue = mapOptionValueForSelect(option.value, allowEmptyOption);
|
|
620
|
+
return /* @__PURE__ */ jsx(SelectItem, {
|
|
621
|
+
value: optionValue,
|
|
622
|
+
disabled: option.disabled,
|
|
623
|
+
children: renderOption ? renderOption(option, { selected: option.value === selectedOption?.value }) : renderDefaultOption(option)
|
|
624
|
+
}, optionValue);
|
|
625
|
+
}) })]
|
|
626
|
+
});
|
|
627
|
+
}
|
|
628
|
+
})
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
function renderDefaultOption(option) {
|
|
632
|
+
if (!option.description) return option.label;
|
|
633
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
634
|
+
className: "flex flex-col gap-0.5",
|
|
635
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
636
|
+
className: "text-sm font-medium text-foreground",
|
|
637
|
+
children: option.label
|
|
638
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
639
|
+
className: "text-xs text-muted-foreground",
|
|
640
|
+
children: option.description
|
|
641
|
+
})]
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
//#endregion
|
|
645
|
+
//#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorWidget.tsx
|
|
646
|
+
const ROLE_COLOR_NAMES = [
|
|
647
|
+
"primary",
|
|
648
|
+
"secondary",
|
|
649
|
+
"accent"
|
|
650
|
+
];
|
|
651
|
+
/**
|
|
652
|
+
* BackgroundColorWidget
|
|
653
|
+
*
|
|
654
|
+
* Select a background color from the site's theme palette or SDK config.
|
|
655
|
+
* Automatically uses SDK section backgrounds from context when available.
|
|
656
|
+
* Otherwise supports 'limited' mode (key shades only) or 'full' mode (all shades).
|
|
657
|
+
* Optionally filters to only show legible colors via filterTokens prop.
|
|
658
|
+
*/
|
|
659
|
+
function BackgroundColorWidget(props) {
|
|
660
|
+
const { label, value, onChange, mode = "limited", filterTokens = null, className, triggerClassName, description, error, dataPath } = props;
|
|
661
|
+
const { tokens } = usePalette();
|
|
662
|
+
const { sectionBackgrounds, themePalette, isSdkSite } = useSdkConfig();
|
|
663
|
+
const handleChange = useCallback((next) => {
|
|
664
|
+
onChange(next);
|
|
665
|
+
}, [onChange]);
|
|
666
|
+
const useSdkMode = isSdkSite && sectionBackgrounds && sectionBackgrounds.length > 0;
|
|
667
|
+
const sdkOptions = useMemo(() => {
|
|
668
|
+
if (!useSdkMode || !sectionBackgrounds) return [];
|
|
669
|
+
return sectionBackgrounds.map((bg) => ({
|
|
670
|
+
value: bg.id,
|
|
671
|
+
label: bg.label
|
|
672
|
+
}));
|
|
673
|
+
}, [useSdkMode, sectionBackgrounds]);
|
|
674
|
+
const sdkBackgroundsMap = useMemo(() => {
|
|
675
|
+
if (!useSdkMode || !sectionBackgrounds) return /* @__PURE__ */ new Map();
|
|
676
|
+
return new Map(sectionBackgrounds.map((bg) => {
|
|
677
|
+
const hexValue = themePalette?.[bg.token] ?? bg.token;
|
|
678
|
+
return [bg.id, hexValue];
|
|
679
|
+
}));
|
|
680
|
+
}, [
|
|
681
|
+
useSdkMode,
|
|
682
|
+
sectionBackgrounds,
|
|
683
|
+
themePalette
|
|
684
|
+
]);
|
|
685
|
+
const availableTokens = useMemo(() => {
|
|
686
|
+
if (useSdkMode) return [];
|
|
687
|
+
return Object.keys(tokens).filter((key) => {
|
|
688
|
+
return typeof tokens[key] === "string";
|
|
689
|
+
});
|
|
690
|
+
}, [tokens, useSdkMode]);
|
|
691
|
+
const modeFilteredTokens = useMemo(() => {
|
|
692
|
+
if (useSdkMode) return [];
|
|
693
|
+
if (mode === "full") return availableTokens;
|
|
694
|
+
const limitedPatterns = [
|
|
695
|
+
"surface",
|
|
696
|
+
"background",
|
|
697
|
+
"transparent",
|
|
698
|
+
"-50",
|
|
699
|
+
"-500",
|
|
700
|
+
"-900"
|
|
701
|
+
];
|
|
702
|
+
return [...availableTokens.filter((token) => {
|
|
703
|
+
if (limitedPatterns.some((pattern) => token.includes(pattern))) return true;
|
|
704
|
+
if (ROLE_COLOR_NAMES.includes(token)) return true;
|
|
705
|
+
return false;
|
|
706
|
+
})].sort((a, b) => {
|
|
707
|
+
const aIsBase = ROLE_COLOR_NAMES.includes(a);
|
|
708
|
+
const bIsBase = ROLE_COLOR_NAMES.includes(b);
|
|
709
|
+
if (aIsBase && !bIsBase) return -1;
|
|
710
|
+
if (!aIsBase && bIsBase) return 1;
|
|
711
|
+
return a.localeCompare(b);
|
|
712
|
+
});
|
|
713
|
+
}, [
|
|
714
|
+
mode,
|
|
715
|
+
availableTokens,
|
|
716
|
+
useSdkMode
|
|
717
|
+
]);
|
|
718
|
+
const filteredTokens = useMemo(() => {
|
|
719
|
+
if (useSdkMode) return [];
|
|
720
|
+
if (!filterTokens) return modeFilteredTokens;
|
|
721
|
+
return modeFilteredTokens.filter((token) => filterTokens.includes(token));
|
|
722
|
+
}, [
|
|
723
|
+
modeFilteredTokens,
|
|
724
|
+
filterTokens,
|
|
725
|
+
useSdkMode
|
|
726
|
+
]);
|
|
727
|
+
const paletteOptions = useMemo(() => {
|
|
728
|
+
return filteredTokens.map((token) => ({
|
|
729
|
+
value: token,
|
|
730
|
+
label: getColorTokenLabel(token)
|
|
731
|
+
}));
|
|
732
|
+
}, [filteredTokens]);
|
|
733
|
+
const options = useSdkMode ? sdkOptions : paletteOptions;
|
|
734
|
+
const getHex = useCallback((tokenOrId) => {
|
|
735
|
+
if (useSdkMode) return sdkBackgroundsMap.get(tokenOrId) ?? null;
|
|
736
|
+
const hex = tokens[tokenOrId];
|
|
737
|
+
return typeof hex === "string" ? hex : null;
|
|
738
|
+
}, [
|
|
739
|
+
useSdkMode,
|
|
740
|
+
sdkBackgroundsMap,
|
|
741
|
+
tokens
|
|
742
|
+
]);
|
|
743
|
+
return /* @__PURE__ */ jsx(SelectWidget, {
|
|
744
|
+
label,
|
|
745
|
+
value: value ?? null,
|
|
746
|
+
onChange: handleChange,
|
|
747
|
+
options,
|
|
748
|
+
className,
|
|
749
|
+
error,
|
|
750
|
+
dataPath,
|
|
751
|
+
description,
|
|
752
|
+
triggerClassName: cn("flex w-full items-center justify-between gap-2", triggerClassName),
|
|
753
|
+
renderOption: (option) => /* @__PURE__ */ jsxs("div", {
|
|
754
|
+
className: "flex items-center gap-3",
|
|
755
|
+
children: [
|
|
756
|
+
/* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }),
|
|
757
|
+
/* @__PURE__ */ jsx("span", {
|
|
758
|
+
className: "text-sm font-medium text-foreground",
|
|
759
|
+
children: option.label
|
|
760
|
+
}),
|
|
761
|
+
!useSdkMode && /* @__PURE__ */ jsx("span", {
|
|
762
|
+
className: "ml-auto text-xs text-muted-foreground",
|
|
763
|
+
children: option.value
|
|
764
|
+
})
|
|
765
|
+
]
|
|
766
|
+
}),
|
|
767
|
+
renderValue: (option) => option ? /* @__PURE__ */ jsxs("div", {
|
|
768
|
+
className: "flex items-center gap-2",
|
|
769
|
+
children: [/* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }), /* @__PURE__ */ jsx("span", {
|
|
770
|
+
className: "text-sm",
|
|
771
|
+
children: option.label
|
|
772
|
+
})]
|
|
773
|
+
}) : null
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Color swatch component
|
|
778
|
+
*/
|
|
779
|
+
function ColorSwatch({ hex }) {
|
|
780
|
+
return /* @__PURE__ */ jsx("span", {
|
|
781
|
+
"aria-hidden": "true",
|
|
782
|
+
className: cn("h-4 w-4 rounded-full border border-border/50 shadow-sm", !hex && "bg-gradient-to-br from-muted to-muted-foreground/30"),
|
|
783
|
+
style: hex ? { backgroundColor: hex } : void 0
|
|
784
|
+
});
|
|
785
|
+
}
|
|
786
|
+
/**
|
|
787
|
+
* Get display label for a color token
|
|
788
|
+
* Converts token names to readable labels (e.g., primary-500 becomes Primary 500)
|
|
789
|
+
*/
|
|
790
|
+
function getColorTokenLabel(token) {
|
|
791
|
+
const specialLabels = {
|
|
792
|
+
"surface": "Surface",
|
|
793
|
+
"background": "Background",
|
|
794
|
+
"text": "Text",
|
|
795
|
+
"transparent": "Transparent",
|
|
796
|
+
"body": "Body Text",
|
|
797
|
+
"mutedText": "Muted Text"
|
|
798
|
+
};
|
|
799
|
+
if (specialLabels[token]) return specialLabels[token];
|
|
800
|
+
return token.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
801
|
+
}
|
|
802
|
+
//#endregion
|
|
803
|
+
//#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorField.tsx
|
|
804
|
+
function BackgroundColorField({ path, backend, config }) {
|
|
805
|
+
const { value, error, setValue } = useField(path, backend);
|
|
806
|
+
return /* @__PURE__ */ jsx(BackgroundColorWidget, {
|
|
807
|
+
label: config.label || "Background Color",
|
|
808
|
+
value: value ?? null,
|
|
809
|
+
onChange: setValue,
|
|
810
|
+
mode: "full",
|
|
811
|
+
description: config.description,
|
|
812
|
+
error: error?.message,
|
|
813
|
+
dataPath: path
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
//#endregion
|
|
817
|
+
//#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientWidget.tsx
|
|
818
|
+
/**
|
|
819
|
+
* Select a curated gradient from the theme-based library.
|
|
820
|
+
* Gradients use theme color tokens, so they adapt to the site's palette.
|
|
821
|
+
*/
|
|
822
|
+
function BackgroundGradientWidget({ label, value, onChange, description, error, dataPath }) {
|
|
823
|
+
const { tokens } = usePalette();
|
|
824
|
+
const selectedPreset = useMemo(() => value ? GRADIENT_PRESETS.find((preset) => gradientConfigsMatch(preset, value)) ?? null : null, [value]);
|
|
825
|
+
const handleSelectPreset = (presetId) => {
|
|
826
|
+
onChange(gradientConfigFromPreset(getGradientPreset(presetId)));
|
|
827
|
+
};
|
|
828
|
+
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
829
|
+
fieldPath: dataPath,
|
|
830
|
+
label,
|
|
831
|
+
description,
|
|
832
|
+
error,
|
|
833
|
+
className: "space-y-3",
|
|
834
|
+
children: ({ id, descriptionId, messageId }) => /* @__PURE__ */ jsxs("div", {
|
|
835
|
+
className: "space-y-3",
|
|
836
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
837
|
+
role: "group",
|
|
838
|
+
"aria-label": `${label} presets`,
|
|
839
|
+
"aria-describedby": [descriptionId, messageId].filter(Boolean).join(" ") || void 0,
|
|
840
|
+
className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
|
|
841
|
+
children: GRADIENT_PRESETS.map((preset, index) => {
|
|
842
|
+
const isSelected = selectedPreset?.id === preset.id;
|
|
843
|
+
const cssGradient = gradientToCss(gradientConfigFromPreset(preset), tokens);
|
|
844
|
+
const kindLabel = gradientKindLabel(preset.type);
|
|
845
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
846
|
+
id: index === 0 ? id : void 0,
|
|
847
|
+
type: "button",
|
|
848
|
+
"aria-label": `${preset.name}, ${kindLabel} gradient`,
|
|
849
|
+
"aria-pressed": isSelected,
|
|
850
|
+
onClick: () => handleSelectPreset(preset.id),
|
|
851
|
+
className: cn("group flex flex-col gap-2 rounded-md border p-2 text-left transition", isSelected ? "border-foreground bg-accent/30" : "border-muted-foreground/30 bg-background hover:bg-muted/40"),
|
|
852
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
853
|
+
"aria-hidden": "true",
|
|
854
|
+
className: "h-16 w-full rounded-sm",
|
|
855
|
+
style: { background: cssGradient }
|
|
856
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
857
|
+
className: "space-y-0.5",
|
|
858
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
859
|
+
className: "block text-xs font-medium text-foreground",
|
|
860
|
+
children: preset.name
|
|
861
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
862
|
+
className: "block text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
863
|
+
children: kindLabel
|
|
864
|
+
})]
|
|
865
|
+
})]
|
|
866
|
+
}, preset.id);
|
|
867
|
+
})
|
|
868
|
+
}), value ? /* @__PURE__ */ jsxs("p", {
|
|
869
|
+
className: "text-xs text-muted-foreground",
|
|
870
|
+
"aria-live": "polite",
|
|
871
|
+
children: ["Selected gradient: ", selectedPreset ? `${selectedPreset.name} · ${gradientKindLabel(selectedPreset.type)}` : "Custom"]
|
|
872
|
+
}) : null]
|
|
873
|
+
})
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
function gradientConfigFromPreset(preset) {
|
|
877
|
+
return {
|
|
878
|
+
type: preset.type,
|
|
879
|
+
angle: preset.angle,
|
|
880
|
+
shape: preset.shape,
|
|
881
|
+
position: preset.position,
|
|
882
|
+
stops: preset.stops.map((stop) => ({ ...stop }))
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function gradientConfigsMatch(preset, value) {
|
|
886
|
+
return preset.type === value.type && preset.angle === value.angle && radialShape(preset) === radialShape(value) && preset.position === value.position && preset.stops.length === value.stops.length && preset.stops.every((stop, index) => stop.color === value.stops[index]?.color && stop.position === value.stops[index]?.position);
|
|
887
|
+
}
|
|
888
|
+
function radialShape(config) {
|
|
889
|
+
return config.type === "radial" ? config.shape ?? "circle" : config.shape;
|
|
890
|
+
}
|
|
891
|
+
function gradientKindLabel(type) {
|
|
892
|
+
switch (type) {
|
|
893
|
+
case "linear": return "Linear";
|
|
894
|
+
case "radial": return "Radial";
|
|
895
|
+
case "conic": return "Conic";
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
//#endregion
|
|
899
|
+
//#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientField.tsx
|
|
900
|
+
/**
|
|
901
|
+
* BackgroundGradientField
|
|
902
|
+
*
|
|
903
|
+
* Field wrapper for BackgroundGradientWidget that integrates with the form system.
|
|
904
|
+
* Converts between GradientConfig objects (used by the widget) and CSS strings
|
|
905
|
+
* (stored in the form data).
|
|
906
|
+
*
|
|
907
|
+
* This is registered as a widget override with key 'backgroundGradient'.
|
|
908
|
+
*/
|
|
909
|
+
function BackgroundGradientField({ path, backend, config }) {
|
|
910
|
+
const { value, error, setValue } = useField(path, backend);
|
|
911
|
+
const { tokens } = usePalette();
|
|
912
|
+
const currentConfig = findPresetFromCss(value ?? null, tokens);
|
|
913
|
+
const handleChange = (gradientConfig) => {
|
|
914
|
+
setValue(gradientToCss(gradientConfig, tokens));
|
|
915
|
+
};
|
|
916
|
+
return /* @__PURE__ */ jsx(BackgroundGradientWidget, {
|
|
917
|
+
label: config.label || "Gradient",
|
|
918
|
+
value: currentConfig,
|
|
919
|
+
onChange: handleChange,
|
|
920
|
+
description: config.description,
|
|
921
|
+
error: error?.message,
|
|
922
|
+
dataPath: path
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
/**
|
|
926
|
+
* Attempts to find a preset that matches the given CSS gradient string.
|
|
927
|
+
*
|
|
928
|
+
* This is a best-effort reverse lookup - if the CSS was generated from a preset,
|
|
929
|
+
* we can find and highlight that preset. If it's custom CSS, we return null
|
|
930
|
+
* and the widget shows no selection.
|
|
931
|
+
*/
|
|
932
|
+
function findPresetFromCss(css, tokens) {
|
|
933
|
+
if (!css) return null;
|
|
934
|
+
for (const preset of GRADIENT_PRESETS) {
|
|
935
|
+
const presetConfig = gradientConfigFromPreset(preset);
|
|
936
|
+
if (gradientToCss(presetConfig, tokens) === css) return presetConfig;
|
|
937
|
+
}
|
|
938
|
+
return null;
|
|
939
|
+
}
|
|
940
|
+
//#endregion
|
|
581
941
|
//#region ../content-model/src/content-types/entryValidation.ts
|
|
582
942
|
function hasRepeaterVariants(field) {
|
|
583
943
|
return field.itemTypes !== void 0;
|
|
@@ -880,6 +1240,529 @@ function footerComposerInspectionProps(inspection) {
|
|
|
880
1240
|
};
|
|
881
1241
|
}
|
|
882
1242
|
//#endregion
|
|
1243
|
+
//#region ../editor-blocks/src/widgets/entry-picker/loaders.ts
|
|
1244
|
+
function getStatusBadgeVariant(status) {
|
|
1245
|
+
switch (status) {
|
|
1246
|
+
case "published": return "default";
|
|
1247
|
+
case "draft": return "secondary";
|
|
1248
|
+
case "scheduled": return "outline";
|
|
1249
|
+
case "archived": return "destructive";
|
|
1250
|
+
default: return "secondary";
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
function mapEntryPickerItems(entries, valueFrom) {
|
|
1254
|
+
return entries.map((entry) => ({
|
|
1255
|
+
value: valueFrom === "identifier" ? entry.identifier ?? entry.id : valueFrom === "slug" ? entry.slug ?? entry.id : entry.id,
|
|
1256
|
+
label: entry.draftTitle || entry.title || entry.slug || entry.id,
|
|
1257
|
+
id: entry.id,
|
|
1258
|
+
identifier: entry.identifier ?? null,
|
|
1259
|
+
slug: entry.slug ?? null,
|
|
1260
|
+
badge: {
|
|
1261
|
+
label: entry.status,
|
|
1262
|
+
variant: getStatusBadgeVariant(entry.status)
|
|
1263
|
+
}
|
|
1264
|
+
}));
|
|
1265
|
+
}
|
|
1266
|
+
async function loadEntryPickerItems({ apiClient, siteId, contentType, valueFrom }) {
|
|
1267
|
+
const { entries } = unwrapResponse(await apiClient({
|
|
1268
|
+
endpoint: "listContentEntries",
|
|
1269
|
+
params: {
|
|
1270
|
+
siteId,
|
|
1271
|
+
type: contentType
|
|
1272
|
+
}
|
|
1273
|
+
}));
|
|
1274
|
+
return mapEntryPickerItems(entries, valueFrom);
|
|
1275
|
+
}
|
|
1276
|
+
//#endregion
|
|
1277
|
+
//#region ../editor-blocks/src/widgets/link/loaders.ts
|
|
1278
|
+
async function loadRoutableContentItems({ apiClient, siteId }) {
|
|
1279
|
+
const payload = unwrapResponse(await apiClient({
|
|
1280
|
+
endpoint: "getRoutableContent",
|
|
1281
|
+
params: { siteId }
|
|
1282
|
+
}));
|
|
1283
|
+
if (!Array.isArray(payload?.items)) throw new Error("Invalid routable content response");
|
|
1284
|
+
return payload.items;
|
|
1285
|
+
}
|
|
1286
|
+
//#endregion
|
|
1287
|
+
//#region ../editor-blocks/src/widgets/reference/dynamicAdapters.ts
|
|
1288
|
+
/**
|
|
1289
|
+
* Adds dynamic `content:${contentTypeKey}` adapter resolution to a static
|
|
1290
|
+
* reference adapter map while keeping symbol property lookups inert for
|
|
1291
|
+
* framework/devtool probes.
|
|
1292
|
+
*/
|
|
1293
|
+
function createDynamicReferenceAdapters(staticAdapters, createDynamicContentAdapter) {
|
|
1294
|
+
return new Proxy(staticAdapters, { get(target, prop) {
|
|
1295
|
+
if (typeof prop !== "string") return;
|
|
1296
|
+
if (prop in target) return target[prop];
|
|
1297
|
+
const parsed = parseReferenceKind(prop);
|
|
1298
|
+
if (parsed.kind === "dynamicContent") return createDynamicContentAdapter(parsed.contentTypeKey);
|
|
1299
|
+
} });
|
|
1300
|
+
}
|
|
1301
|
+
//#endregion
|
|
1302
|
+
//#region ../editor-blocks/src/widgets/reference/loaders.ts
|
|
1303
|
+
/**
|
|
1304
|
+
* Reference Widget Loaders
|
|
1305
|
+
*
|
|
1306
|
+
* Canonical, environment-agnostic data fetchers for each built-in reference kind.
|
|
1307
|
+
* Both the dashboard reference adapter map (`apps/dashboard/src/lib/block-form/referenceAdapters.tsx`)
|
|
1308
|
+
* and the preview-next reference adapter map (`packages/preview-next/src/client/widgets/widgetAdapters.ts`)
|
|
1309
|
+
* compose these loaders with their own labels, manage-links, caching, and error wrapping.
|
|
1310
|
+
*
|
|
1311
|
+
* Adding a new `BUILT_IN_REFERENCE_KIND` requires adding a loader here and an entry in
|
|
1312
|
+
* `referenceLoaders`. Both gates are enforced by TypeScript and a runtime parity test.
|
|
1313
|
+
*
|
|
1314
|
+
* Each loader takes the request shape `{ apiClient, siteId }` and returns a
|
|
1315
|
+
* `ReferenceWidgetItem[]` ready for the picker UI. Loaders throw raw errors —
|
|
1316
|
+
* environment-specific error wrapping (e.g. `toUserFacingError`) happens at the
|
|
1317
|
+
* composition layer.
|
|
1318
|
+
*/
|
|
1319
|
+
function defineReferenceLoader(referenceKind, loader) {
|
|
1320
|
+
return Object.assign(loader, { referenceKind });
|
|
1321
|
+
}
|
|
1322
|
+
function formatStatusBadge(status) {
|
|
1323
|
+
if (status === "published") return {
|
|
1324
|
+
label: "Published",
|
|
1325
|
+
variant: "default"
|
|
1326
|
+
};
|
|
1327
|
+
if (status === "scheduled") return {
|
|
1328
|
+
label: "Scheduled",
|
|
1329
|
+
variant: "secondary"
|
|
1330
|
+
};
|
|
1331
|
+
if (status === "archived") return {
|
|
1332
|
+
label: "Archived",
|
|
1333
|
+
variant: "outline"
|
|
1334
|
+
};
|
|
1335
|
+
return {
|
|
1336
|
+
label: "Draft",
|
|
1337
|
+
variant: "outline"
|
|
1338
|
+
};
|
|
1339
|
+
}
|
|
1340
|
+
function hasSlug(entry) {
|
|
1341
|
+
return entry.slug !== null;
|
|
1342
|
+
}
|
|
1343
|
+
const loadPostReferenceItems = defineReferenceLoader("post", async ({ apiClient, siteId }) => {
|
|
1344
|
+
const { entries } = unwrapResponse(await apiClient({
|
|
1345
|
+
endpoint: "listContentEntries",
|
|
1346
|
+
params: {
|
|
1347
|
+
siteId,
|
|
1348
|
+
type: "post"
|
|
1349
|
+
}
|
|
1350
|
+
}));
|
|
1351
|
+
return entries.filter(hasSlug).filter((entry) => entry.status === "published").map((entry) => ({
|
|
1352
|
+
value: entry.slug,
|
|
1353
|
+
label: entry.title || entry.slug || entry.id,
|
|
1354
|
+
badge: formatStatusBadge(entry.status)
|
|
1355
|
+
}));
|
|
1356
|
+
});
|
|
1357
|
+
const loadFormReferenceItems = defineReferenceLoader("form", async ({ apiClient, siteId }) => {
|
|
1358
|
+
const { forms } = unwrapResponse(await apiClient({
|
|
1359
|
+
endpoint: "listForms",
|
|
1360
|
+
params: { siteId }
|
|
1361
|
+
}));
|
|
1362
|
+
return forms.map((form) => ({
|
|
1363
|
+
value: form.slug,
|
|
1364
|
+
label: form.name
|
|
1365
|
+
}));
|
|
1366
|
+
});
|
|
1367
|
+
const loadBookingFormReferenceItems = defineReferenceLoader("bookingForm", async ({ apiClient, siteId }) => {
|
|
1368
|
+
const { forms } = unwrapResponse(await apiClient({
|
|
1369
|
+
endpoint: "listBookingForms",
|
|
1370
|
+
params: { siteId }
|
|
1371
|
+
}));
|
|
1372
|
+
return forms.map((form) => ({
|
|
1373
|
+
value: form.id,
|
|
1374
|
+
label: form.name
|
|
1375
|
+
}));
|
|
1376
|
+
});
|
|
1377
|
+
const loadAppointmentServiceReferenceItems = defineReferenceLoader("appointmentService", async ({ apiClient, siteId }) => {
|
|
1378
|
+
const { options } = unwrapResponse(await apiClient({
|
|
1379
|
+
endpoint: "getAppointmentServicesReference",
|
|
1380
|
+
params: { siteId }
|
|
1381
|
+
}));
|
|
1382
|
+
return options.map((option) => ({
|
|
1383
|
+
value: option.id,
|
|
1384
|
+
label: option.label
|
|
1385
|
+
}));
|
|
1386
|
+
});
|
|
1387
|
+
const loadAppointmentResourceReferenceItems = defineReferenceLoader("appointmentResource", async ({ apiClient, siteId }) => {
|
|
1388
|
+
const { options } = unwrapResponse(await apiClient({
|
|
1389
|
+
endpoint: "getAppointmentResourcesReference",
|
|
1390
|
+
params: { siteId }
|
|
1391
|
+
}));
|
|
1392
|
+
return options.map((option) => ({
|
|
1393
|
+
value: option.id,
|
|
1394
|
+
label: option.label
|
|
1395
|
+
}));
|
|
1396
|
+
});
|
|
1397
|
+
const loadPageReferenceItems = defineReferenceLoader("page", async ({ apiClient, siteId }) => {
|
|
1398
|
+
const { items } = unwrapResponse(await apiClient({
|
|
1399
|
+
endpoint: "getRoutableContent",
|
|
1400
|
+
params: { siteId }
|
|
1401
|
+
}));
|
|
1402
|
+
return items.filter((item) => item.entityType === "page").map((page) => ({
|
|
1403
|
+
value: page.entityId,
|
|
1404
|
+
label: page.title || "Untitled"
|
|
1405
|
+
}));
|
|
1406
|
+
});
|
|
1407
|
+
const loadNewsletterListReferenceItems = defineReferenceLoader("newsletterList", async ({ apiClient, siteId }) => {
|
|
1408
|
+
const { lists } = unwrapResponse(await apiClient({
|
|
1409
|
+
endpoint: "listNewsletterLists",
|
|
1410
|
+
params: { siteId }
|
|
1411
|
+
}));
|
|
1412
|
+
return lists.map((list) => ({
|
|
1413
|
+
value: list.id,
|
|
1414
|
+
label: list.name
|
|
1415
|
+
}));
|
|
1416
|
+
});
|
|
1417
|
+
const loadMailchimpAudienceReferenceItems = defineReferenceLoader("mailchimpAudience", async ({ apiClient, siteId }) => {
|
|
1418
|
+
const response = unwrapResponse(await apiClient({
|
|
1419
|
+
endpoint: "listMailchimpAudiences",
|
|
1420
|
+
params: { siteId }
|
|
1421
|
+
}));
|
|
1422
|
+
switch (response.tag) {
|
|
1423
|
+
case "not_connected":
|
|
1424
|
+
case "needs_reauth": return [];
|
|
1425
|
+
case "connected": return response.audiences.map((audience) => ({
|
|
1426
|
+
value: audience.id,
|
|
1427
|
+
label: audience.name,
|
|
1428
|
+
subtitle: audience.memberCount === null ? void 0 : `${audience.memberCount.toLocaleString()} contacts`,
|
|
1429
|
+
badge: audience.compatibilityIssues.length > 0 ? {
|
|
1430
|
+
label: "Needs review",
|
|
1431
|
+
variant: "outline"
|
|
1432
|
+
} : void 0
|
|
1433
|
+
}));
|
|
1434
|
+
default: return assertNever$1(response);
|
|
1435
|
+
}
|
|
1436
|
+
});
|
|
1437
|
+
async function loadDynamicContentReferenceItems({ apiClient, siteId, contentTypeKey }) {
|
|
1438
|
+
const { entries } = unwrapResponse(await apiClient({
|
|
1439
|
+
endpoint: "listContentEntries",
|
|
1440
|
+
params: {
|
|
1441
|
+
siteId,
|
|
1442
|
+
type: contentTypeKey
|
|
1443
|
+
}
|
|
1444
|
+
}));
|
|
1445
|
+
return entries.filter((entry) => entry.status === "published").map((entry) => ({
|
|
1446
|
+
value: entry.id,
|
|
1447
|
+
label: entry.title || entry.slug || entry.id,
|
|
1448
|
+
badge: {
|
|
1449
|
+
label: "Published",
|
|
1450
|
+
variant: "default"
|
|
1451
|
+
}
|
|
1452
|
+
}));
|
|
1453
|
+
}
|
|
1454
|
+
/**
|
|
1455
|
+
* Typed map keyed by `BuiltInReferenceKind`. Adding a new built-in kind fails to
|
|
1456
|
+
* compile here. The `satisfies` form preserves the literal's inferred shape while
|
|
1457
|
+
* still enforcing that every `BuiltInReferenceKind` has a loader and that no
|
|
1458
|
+
* extraneous keys are present. The parity test in `loaders.test.ts` is the
|
|
1459
|
+
* defense-in-depth against someone widening this annotation to `Record<string, …>`.
|
|
1460
|
+
*/
|
|
1461
|
+
const referenceLoaders = {
|
|
1462
|
+
post: loadPostReferenceItems,
|
|
1463
|
+
form: loadFormReferenceItems,
|
|
1464
|
+
bookingForm: loadBookingFormReferenceItems,
|
|
1465
|
+
appointmentService: loadAppointmentServiceReferenceItems,
|
|
1466
|
+
appointmentResource: loadAppointmentResourceReferenceItems,
|
|
1467
|
+
page: loadPageReferenceItems,
|
|
1468
|
+
newsletterList: loadNewsletterListReferenceItems,
|
|
1469
|
+
mailchimpAudience: loadMailchimpAudienceReferenceItems
|
|
1470
|
+
};
|
|
1471
|
+
//#endregion
|
|
1472
|
+
//#region ../preview-next/src/client/widgets/widgetAdapters.ts
|
|
1473
|
+
const entryPickerCache = /* @__PURE__ */ new Map();
|
|
1474
|
+
const siteOptionItemsCache = /* @__PURE__ */ new Map();
|
|
1475
|
+
/**
|
|
1476
|
+
* Single module-level cache for every built-in reference kind, keyed by
|
|
1477
|
+
* `${kind}:${siteId}`. Module-level (not factory-scoped) so repeated calls to
|
|
1478
|
+
* `createPreviewReferenceAdapters` (StrictMode double-invoke, site switching via
|
|
1479
|
+
* `useMemo`) don't leak per-call Map instances.
|
|
1480
|
+
*/
|
|
1481
|
+
const referenceItemsCache = /* @__PURE__ */ new Map();
|
|
1482
|
+
const dynamicReferenceItemsCache = /* @__PURE__ */ new Map();
|
|
1483
|
+
const MAX_CACHE_ENTRIES = 50;
|
|
1484
|
+
function setBoundedCache(map, key, value) {
|
|
1485
|
+
if (!map.has(key) && map.size >= MAX_CACHE_ENTRIES) {
|
|
1486
|
+
const firstKey = map.keys().next().value;
|
|
1487
|
+
if (firstKey !== void 0) map.delete(firstKey);
|
|
1488
|
+
}
|
|
1489
|
+
map.set(key, value);
|
|
1490
|
+
}
|
|
1491
|
+
function createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, fallbackSiteId) {
|
|
1492
|
+
return {
|
|
1493
|
+
labels: {
|
|
1494
|
+
loading: "Loading entries…",
|
|
1495
|
+
select: "Select an entry",
|
|
1496
|
+
empty: "No entries found",
|
|
1497
|
+
emptySelection: "Select an entry to continue."
|
|
1498
|
+
},
|
|
1499
|
+
loadItems: async ({ siteId }) => {
|
|
1500
|
+
const resolvedSiteId = siteId || fallbackSiteId;
|
|
1501
|
+
if (!resolvedSiteId) return [];
|
|
1502
|
+
const cacheKey = `${resolvedSiteId}:content:${contentTypeKey}`;
|
|
1503
|
+
const cached = dynamicReferenceItemsCache.get(cacheKey);
|
|
1504
|
+
if (cached) return cached;
|
|
1505
|
+
const promise = (async () => {
|
|
1506
|
+
try {
|
|
1507
|
+
return await loadDynamicContentReferenceItems({
|
|
1508
|
+
apiClient: previewClient,
|
|
1509
|
+
siteId: resolvedSiteId,
|
|
1510
|
+
contentTypeKey
|
|
1511
|
+
});
|
|
1512
|
+
} catch (error) {
|
|
1513
|
+
dynamicReferenceItemsCache.delete(cacheKey);
|
|
1514
|
+
throw error;
|
|
1515
|
+
}
|
|
1516
|
+
})();
|
|
1517
|
+
setBoundedCache(dynamicReferenceItemsCache, cacheKey, promise);
|
|
1518
|
+
return promise;
|
|
1519
|
+
}
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
/**
|
|
1523
|
+
* Wraps a shared reference loader in a module-level cache keyed by
|
|
1524
|
+
* `${kind}:${siteId}`. Rejected promises are evicted so a transient failure
|
|
1525
|
+
* doesn't poison subsequent calls.
|
|
1526
|
+
*/
|
|
1527
|
+
function createCachedReferenceAdapterLoader(kind, loader, previewClient, fallbackSiteId) {
|
|
1528
|
+
return async ({ siteId }) => {
|
|
1529
|
+
const resolvedSiteId = siteId || fallbackSiteId;
|
|
1530
|
+
if (!resolvedSiteId) return [];
|
|
1531
|
+
const cacheKey = `${kind}:${resolvedSiteId}`;
|
|
1532
|
+
const cached = referenceItemsCache.get(cacheKey);
|
|
1533
|
+
if (cached) return cached;
|
|
1534
|
+
const promise = (async () => {
|
|
1535
|
+
try {
|
|
1536
|
+
return await loader({
|
|
1537
|
+
apiClient: previewClient,
|
|
1538
|
+
siteId: resolvedSiteId
|
|
1539
|
+
});
|
|
1540
|
+
} catch (error) {
|
|
1541
|
+
referenceItemsCache.delete(cacheKey);
|
|
1542
|
+
throw error;
|
|
1543
|
+
}
|
|
1544
|
+
})();
|
|
1545
|
+
setBoundedCache(referenceItemsCache, cacheKey, promise);
|
|
1546
|
+
return promise;
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function createPreviewLinkAdapters(previewClient) {
|
|
1550
|
+
return { fetchRoutableContent: (siteId) => loadRoutableContentItems({
|
|
1551
|
+
apiClient: previewClient,
|
|
1552
|
+
siteId
|
|
1553
|
+
}) };
|
|
1554
|
+
}
|
|
1555
|
+
function createPreviewEntryPickerAdapter(previewClient) {
|
|
1556
|
+
return {
|
|
1557
|
+
loadItems: async ({ siteId, contentType, valueFrom }) => {
|
|
1558
|
+
if (!siteId || !contentType) return [];
|
|
1559
|
+
const cacheKey = `${siteId}:${contentType}:${valueFrom ?? "id"}`;
|
|
1560
|
+
const cached = entryPickerCache.get(cacheKey);
|
|
1561
|
+
if (cached) return cached;
|
|
1562
|
+
const request = (async () => {
|
|
1563
|
+
try {
|
|
1564
|
+
return await loadEntryPickerItems({
|
|
1565
|
+
apiClient: previewClient,
|
|
1566
|
+
siteId,
|
|
1567
|
+
contentType,
|
|
1568
|
+
valueFrom
|
|
1569
|
+
});
|
|
1570
|
+
} catch (error) {
|
|
1571
|
+
entryPickerCache.delete(cacheKey);
|
|
1572
|
+
throw error;
|
|
1573
|
+
}
|
|
1574
|
+
})();
|
|
1575
|
+
setBoundedCache(entryPickerCache, cacheKey, request);
|
|
1576
|
+
return request;
|
|
1577
|
+
},
|
|
1578
|
+
labels: {
|
|
1579
|
+
loading: "Loading entries...",
|
|
1580
|
+
select: "Select an entry",
|
|
1581
|
+
empty: "No entries found",
|
|
1582
|
+
emptySelection: "Select an entry to embed.",
|
|
1583
|
+
noContentType: "Select a content type first."
|
|
1584
|
+
}
|
|
1585
|
+
};
|
|
1586
|
+
}
|
|
1587
|
+
function createCachedSiteOptionLoader(loadItems) {
|
|
1588
|
+
return async ({ siteId, source }) => {
|
|
1589
|
+
const cacheKey = `${source}:${siteId}`;
|
|
1590
|
+
const cached = siteOptionItemsCache.get(cacheKey);
|
|
1591
|
+
if (cached) return cached;
|
|
1592
|
+
const promise = (async () => {
|
|
1593
|
+
try {
|
|
1594
|
+
return await loadItems({
|
|
1595
|
+
siteId,
|
|
1596
|
+
source
|
|
1597
|
+
});
|
|
1598
|
+
} catch (error) {
|
|
1599
|
+
siteOptionItemsCache.delete(cacheKey);
|
|
1600
|
+
throw error;
|
|
1601
|
+
}
|
|
1602
|
+
})();
|
|
1603
|
+
setBoundedCache(siteOptionItemsCache, cacheKey, promise);
|
|
1604
|
+
return promise;
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
function createPreviewSiteOptionAdapters(previewClient) {
|
|
1608
|
+
return createSiteOptionWidgetAdapters({ loadItems: createCachedSiteOptionLoader(createSiteOptionApiLoader(previewClient)) });
|
|
1609
|
+
}
|
|
1610
|
+
/**
|
|
1611
|
+
* Per-kind UI chrome for preview reference adapters. The `Record<BuiltInReferenceKind, …>`
|
|
1612
|
+
* type enforces parity with `BUILT_IN_REFERENCE_KINDS` at compile time — adding a new
|
|
1613
|
+
* kind fails to compile here until chrome is provided.
|
|
1614
|
+
*/
|
|
1615
|
+
const previewReferenceChrome = {
|
|
1616
|
+
post: { labels: {
|
|
1617
|
+
loading: "Loading posts…",
|
|
1618
|
+
select: "Select a post",
|
|
1619
|
+
empty: "No posts found",
|
|
1620
|
+
emptySelection: "Select a post to continue."
|
|
1621
|
+
} },
|
|
1622
|
+
form: { labels: {
|
|
1623
|
+
loading: "Loading forms…",
|
|
1624
|
+
select: "Select a form",
|
|
1625
|
+
empty: "No forms found",
|
|
1626
|
+
emptySelection: "Select a form to continue."
|
|
1627
|
+
} },
|
|
1628
|
+
bookingForm: { labels: {
|
|
1629
|
+
loading: "Loading booking forms…",
|
|
1630
|
+
select: "Select a booking form",
|
|
1631
|
+
empty: "No booking forms yet",
|
|
1632
|
+
emptySelection: "Select a booking form to enable appointment booking."
|
|
1633
|
+
} },
|
|
1634
|
+
appointmentService: { labels: {
|
|
1635
|
+
loading: "Loading appointment services…",
|
|
1636
|
+
select: "Select a service",
|
|
1637
|
+
empty: "No services available",
|
|
1638
|
+
emptySelection: "Select a service to enable booking."
|
|
1639
|
+
} },
|
|
1640
|
+
appointmentResource: { labels: {
|
|
1641
|
+
loading: "Loading resources…",
|
|
1642
|
+
select: "Select a resource",
|
|
1643
|
+
empty: "No resources available",
|
|
1644
|
+
emptySelection: "Select a resource (optional)."
|
|
1645
|
+
} },
|
|
1646
|
+
page: { labels: {
|
|
1647
|
+
loading: "Loading pages…",
|
|
1648
|
+
select: "Select a page",
|
|
1649
|
+
empty: "No pages available",
|
|
1650
|
+
emptySelection: "Select a page."
|
|
1651
|
+
} },
|
|
1652
|
+
newsletterList: { labels: {
|
|
1653
|
+
loading: "Loading lists…",
|
|
1654
|
+
select: "Select a list",
|
|
1655
|
+
empty: "No lists yet",
|
|
1656
|
+
emptySelection: "Select a newsletter list to subscribe users to."
|
|
1657
|
+
} },
|
|
1658
|
+
mailchimpAudience: { labels: {
|
|
1659
|
+
loading: "Loading Mailchimp audiences…",
|
|
1660
|
+
select: "Select an audience",
|
|
1661
|
+
empty: "Connect Mailchimp to choose an audience",
|
|
1662
|
+
emptySelection: "Choose a Mailchimp audience once the site is connected."
|
|
1663
|
+
} }
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* Builds the preview adapter record by iterating the canonical `referenceLoaders`
|
|
1667
|
+
* map. The kind ↔ loader pairing is structurally impossible to mis-couple — each
|
|
1668
|
+
* adapter is constructed by looking the loader up via the same `BuiltInReferenceKind`
|
|
1669
|
+
* key used to index into the chrome map.
|
|
1670
|
+
*/
|
|
1671
|
+
function createPreviewReferenceAdapters(previewClient, fallbackSiteId) {
|
|
1672
|
+
const brandedFallbackSiteId = fallbackSiteId ? expectParsedBrandedId(parseSiteId(fallbackSiteId)) : void 0;
|
|
1673
|
+
const adapters = {};
|
|
1674
|
+
for (const kind of BUILT_IN_REFERENCE_KINDS) adapters[kind] = {
|
|
1675
|
+
loadItems: createCachedReferenceAdapterLoader(kind, referenceLoaders[kind], previewClient, brandedFallbackSiteId),
|
|
1676
|
+
labels: previewReferenceChrome[kind].labels
|
|
1677
|
+
};
|
|
1678
|
+
return createDynamicReferenceAdapters(adapters, (contentTypeKey) => createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, brandedFallbackSiteId));
|
|
1679
|
+
}
|
|
1680
|
+
//#endregion
|
|
1681
|
+
//#region ../preview-next/src/client/widgets/widgetOverrides.tsx
|
|
1682
|
+
function PreviewFormProviderInner({ theme, children }) {
|
|
1683
|
+
const { onPickImage, picker } = useRichTextImagePicker();
|
|
1684
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RichTextWidgetProvider, {
|
|
1685
|
+
surface: "preview-sidebar",
|
|
1686
|
+
theme,
|
|
1687
|
+
onPickImage,
|
|
1688
|
+
children
|
|
1689
|
+
}), picker] });
|
|
1690
|
+
}
|
|
1691
|
+
/**
|
|
1692
|
+
* Composes preview form widget providers beneath PreviewShell's media authority.
|
|
1693
|
+
* Consumers rendering this directly must provide an ancestor MediaEditorProvider.
|
|
1694
|
+
*/
|
|
1695
|
+
function PreviewFormProvider({ siteId: rawSiteId, theme = null, previewClient, bookingOfferingPresets, sdkConfig, children }) {
|
|
1696
|
+
const siteId = useMemo(() => expectParsedBrandedId(parseSiteId(rawSiteId)), [rawSiteId]);
|
|
1697
|
+
const linkAdapters = useMemo(() => createPreviewLinkAdapters(previewClient), [previewClient]);
|
|
1698
|
+
const entryPickerAdapter = useMemo(() => createPreviewEntryPickerAdapter(previewClient), [previewClient]);
|
|
1699
|
+
const siteOptionAdapters = useMemo(() => createPreviewSiteOptionAdapters(previewClient), [previewClient]);
|
|
1700
|
+
const referenceAdapters = useMemo(() => createPreviewReferenceAdapters(previewClient), [previewClient]);
|
|
1701
|
+
const paletteTokens = useMemo(() => {
|
|
1702
|
+
if (!theme) return void 0;
|
|
1703
|
+
try {
|
|
1704
|
+
return buildThemeRuntime(theme).paletteTokens;
|
|
1705
|
+
} catch {
|
|
1706
|
+
return;
|
|
1707
|
+
}
|
|
1708
|
+
}, [theme]);
|
|
1709
|
+
return /* @__PURE__ */ jsx(SdkConfigProvider, {
|
|
1710
|
+
sdkConfig: sdkConfig ?? null,
|
|
1711
|
+
children: /* @__PURE__ */ jsx(PaletteProvider, {
|
|
1712
|
+
tokens: paletteTokens,
|
|
1713
|
+
children: /* @__PURE__ */ jsx(LinkWidgetProvider, {
|
|
1714
|
+
siteId,
|
|
1715
|
+
adapters: linkAdapters,
|
|
1716
|
+
children: /* @__PURE__ */ jsx(ReferenceWidgetProvider, {
|
|
1717
|
+
siteId,
|
|
1718
|
+
adapters: referenceAdapters,
|
|
1719
|
+
children: /* @__PURE__ */ jsx(EntryPickerWidgetProvider, {
|
|
1720
|
+
siteId,
|
|
1721
|
+
adapter: entryPickerAdapter,
|
|
1722
|
+
children: /* @__PURE__ */ jsx(SiteOptionWidgetProvider, {
|
|
1723
|
+
siteId,
|
|
1724
|
+
adapters: siteOptionAdapters,
|
|
1725
|
+
children: /* @__PURE__ */ jsx(MailingListTargetingProvider, {
|
|
1726
|
+
siteId,
|
|
1727
|
+
load: (targetSiteId) => loadMailingListAuthoringContext({
|
|
1728
|
+
apiClient: previewClient,
|
|
1729
|
+
siteId: targetSiteId
|
|
1730
|
+
}),
|
|
1731
|
+
children: /* @__PURE__ */ jsx(ButtonWidgetProvider, {
|
|
1732
|
+
buttonSystem: theme?.buttons ?? null,
|
|
1733
|
+
children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
|
|
1734
|
+
bookingOfferingPresets,
|
|
1735
|
+
children: /* @__PURE__ */ jsx(PreviewFormProviderInner, {
|
|
1736
|
+
theme,
|
|
1737
|
+
children
|
|
1738
|
+
})
|
|
1739
|
+
})
|
|
1740
|
+
})
|
|
1741
|
+
})
|
|
1742
|
+
})
|
|
1743
|
+
})
|
|
1744
|
+
})
|
|
1745
|
+
})
|
|
1746
|
+
})
|
|
1747
|
+
});
|
|
1748
|
+
}
|
|
1749
|
+
const previewWidgetOverrides = {
|
|
1750
|
+
link: LinkField,
|
|
1751
|
+
file: FileField,
|
|
1752
|
+
media: MediaField,
|
|
1753
|
+
richText: RichTextField,
|
|
1754
|
+
inlineText: InlineTextField,
|
|
1755
|
+
reference: ReferenceField,
|
|
1756
|
+
backgroundColor: BackgroundColorField,
|
|
1757
|
+
backgroundGradient: BackgroundGradientField,
|
|
1758
|
+
entryPicker: EntryPickerField,
|
|
1759
|
+
iconPicker: IconPickerField,
|
|
1760
|
+
buttonVariant: ButtonVariantField,
|
|
1761
|
+
offeringGroupOrder: OfferingsPreviewGroupOrderField,
|
|
1762
|
+
siteOptionPicker: SiteOptionPickerField,
|
|
1763
|
+
mailingListTargeting: MailingListTargetingField
|
|
1764
|
+
};
|
|
1765
|
+
//#endregion
|
|
883
1766
|
//#region ../preview-next/src/client/preview/PreviewZoomControls.tsx
|
|
884
1767
|
function PreviewZoomControls({ zoom, onZoomChange, disabled }) {
|
|
885
1768
|
return /* @__PURE__ */ jsxs(Select, {
|
|
@@ -1614,9 +2497,253 @@ function usePreviewDesignOpenRequest() {
|
|
|
1614
2497
|
return useContext(PreviewDesignOpenRequestContext);
|
|
1615
2498
|
}
|
|
1616
2499
|
//#endregion
|
|
2500
|
+
//#region ../preview-next/src/client/preview/SelectedBlockBackgroundControls.tsx
|
|
2501
|
+
function SelectedBlockBackgroundControls(props) {
|
|
2502
|
+
const controller = useBackgroundSection(props);
|
|
2503
|
+
if (!controller) return null;
|
|
2504
|
+
const { current, pool, capability, context, open, setOpen, choose, transition } = controller;
|
|
2505
|
+
return /* @__PURE__ */ jsx(CustomizeBackgroundControlRows, {
|
|
2506
|
+
modeLabel: backgroundModeLabel(current.kind),
|
|
2507
|
+
valueLabel: backgroundValueLabel(current, pool),
|
|
2508
|
+
valueAriaLabel: "Choose background",
|
|
2509
|
+
swatch: /* @__PURE__ */ jsx(BackgroundPreviewSwatch, {
|
|
2510
|
+
override: current,
|
|
2511
|
+
imagePool: pool
|
|
2512
|
+
}),
|
|
2513
|
+
chooserOpen: open,
|
|
2514
|
+
canCycleMode: enabledBackgroundModes(capability).length > 1,
|
|
2515
|
+
canCycleValue: canCycleBackgroundOverrideValue(current, capability),
|
|
2516
|
+
onCycleMode: (direction) => transition({
|
|
2517
|
+
kind: "cycle-mode",
|
|
2518
|
+
direction
|
|
2519
|
+
}),
|
|
2520
|
+
onCycleValue: (direction) => transition({
|
|
2521
|
+
kind: "cycle-value",
|
|
2522
|
+
direction
|
|
2523
|
+
}),
|
|
2524
|
+
onToggleChooser: () => setOpen((value) => !value),
|
|
2525
|
+
chooser: /* @__PURE__ */ jsx(BackgroundChooser, {
|
|
2526
|
+
editingSlot: `${props.block.blockId}:_sectionStyles.background.image`,
|
|
2527
|
+
capability,
|
|
2528
|
+
current,
|
|
2529
|
+
imagePoolStatus: context.backgroundImagePoolStatus ?? "idle",
|
|
2530
|
+
onChoose: choose
|
|
2531
|
+
})
|
|
2532
|
+
});
|
|
2533
|
+
}
|
|
2534
|
+
function useBackgroundSection({ block, content }) {
|
|
2535
|
+
const context = usePreviewPageDesignEditorState();
|
|
2536
|
+
const [open, setOpen] = useState(false);
|
|
2537
|
+
const current = parseBackgroundOverrideFromContent(content);
|
|
2538
|
+
const pool = mergedImagePool(current.kind === "supported" ? imagePoolForOverride(current.override) : [], context.backgroundImagePool ?? []);
|
|
2539
|
+
const capability = resolveBackgroundCapability({
|
|
2540
|
+
block,
|
|
2541
|
+
imagePool: pool,
|
|
2542
|
+
palette: readBackgroundColorPaletteSnapshot()
|
|
2543
|
+
});
|
|
2544
|
+
useLoadBackgroundImages(capability?.modes.includes("image") ?? false, context);
|
|
2545
|
+
if (current.kind !== "supported" || !capability || !enabledBackgroundModes(capability).length) return null;
|
|
2546
|
+
const choose = (override, options) => {
|
|
2547
|
+
const action = setPageDesignBlockBackground({
|
|
2548
|
+
block,
|
|
2549
|
+
override,
|
|
2550
|
+
currentContent: content,
|
|
2551
|
+
imagePool: pool,
|
|
2552
|
+
selectedImage: options?.selectedImage
|
|
2553
|
+
});
|
|
2554
|
+
if (action) context.applyAction(action, { runtimeContent: content });
|
|
2555
|
+
setOpen(false);
|
|
2556
|
+
};
|
|
2557
|
+
const transition = (action) => {
|
|
2558
|
+
const plan = planBackgroundTransition(current.override, capability, action);
|
|
2559
|
+
if (plan.kind === "apply") choose(plan.override);
|
|
2560
|
+
};
|
|
2561
|
+
return {
|
|
2562
|
+
current: current.override,
|
|
2563
|
+
pool,
|
|
2564
|
+
capability,
|
|
2565
|
+
context,
|
|
2566
|
+
open,
|
|
2567
|
+
setOpen,
|
|
2568
|
+
choose,
|
|
2569
|
+
transition
|
|
2570
|
+
};
|
|
2571
|
+
}
|
|
2572
|
+
function mergedImagePool(current, pool) {
|
|
2573
|
+
return rankBackgroundImagePoolItems([...new Map([...current, ...pool].map((item) => [item.reference.identifier, item])).values()]);
|
|
2574
|
+
}
|
|
2575
|
+
function backgroundModeLabel(mode) {
|
|
2576
|
+
return {
|
|
2577
|
+
default: "From the style",
|
|
2578
|
+
color: "Colour",
|
|
2579
|
+
gradient: "Gradient",
|
|
2580
|
+
image: "Photo"
|
|
2581
|
+
}[mode];
|
|
2582
|
+
}
|
|
2583
|
+
function backgroundValueLabel(override, pool) {
|
|
2584
|
+
switch (override.kind) {
|
|
2585
|
+
case "default": return "No colour chosen";
|
|
2586
|
+
case "color": return formatTokenLabel(override.token);
|
|
2587
|
+
case "gradient": return gradientLabel(override.gradientId);
|
|
2588
|
+
case "image": return pool.find((item) => item.reference.identifier === override.reference.identifier)?.label ?? "Image";
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
function useLoadBackgroundImages(supportsImages, context) {
|
|
2592
|
+
useEffect(() => {
|
|
2593
|
+
if (supportsImages && context.backgroundImagePoolStatus === "idle") context.loadBackgroundImagePool?.();
|
|
2594
|
+
}, [
|
|
2595
|
+
supportsImages,
|
|
2596
|
+
context.backgroundImagePoolStatus,
|
|
2597
|
+
context.loadBackgroundImagePool
|
|
2598
|
+
]);
|
|
2599
|
+
}
|
|
2600
|
+
//#endregion
|
|
2601
|
+
//#region ../preview-next/src/client/preview/SelectedBlockLookControls.tsx
|
|
2602
|
+
function SelectedBlockLookControls(props) {
|
|
2603
|
+
const { toolbar, chooseLook, historyFailure } = useLookSectionActions(props);
|
|
2604
|
+
if (!props.designBlock) return null;
|
|
2605
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2606
|
+
className: "space-y-4",
|
|
2607
|
+
children: [
|
|
2608
|
+
historyFailure ? /* @__PURE__ */ jsx("p", {
|
|
2609
|
+
role: "alert",
|
|
2610
|
+
className: "text-xs text-red-700",
|
|
2611
|
+
children: historyFailure
|
|
2612
|
+
}) : null,
|
|
2613
|
+
/* @__PURE__ */ jsx(BlockLookChoices, {
|
|
2614
|
+
block: props.designBlock,
|
|
2615
|
+
look: toolbar?.controls.look,
|
|
2616
|
+
onChoose: chooseLook
|
|
2617
|
+
}),
|
|
2618
|
+
toolbar ? /* @__PURE__ */ jsx(ArrangementLookNote, {
|
|
2619
|
+
look: toolbar.controls.look,
|
|
2620
|
+
styleName: toolbar.styleName
|
|
2621
|
+
}) : null,
|
|
2622
|
+
toolbar ? /* @__PURE__ */ jsx(ArrangementOptionsBody, {
|
|
2623
|
+
controls: toolbar.controls,
|
|
2624
|
+
styleName: toolbar.styleName,
|
|
2625
|
+
background: toolbar.background,
|
|
2626
|
+
onChooseKnob: toolbar.chooseKnob,
|
|
2627
|
+
onChooseSurface: toolbar.chooseSurface,
|
|
2628
|
+
onEditHeadline: toolbar.editHeadline
|
|
2629
|
+
}) : /* @__PURE__ */ jsx(SelectedBlockBackgroundControls, {
|
|
2630
|
+
block: props.designBlock,
|
|
2631
|
+
content: props.content
|
|
2632
|
+
})
|
|
2633
|
+
]
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
function useLookSectionActions({ blockId, content, designBlock }) {
|
|
2637
|
+
const { state, applyAction, historyFailure, backgroundImagePool = [] } = usePreviewPageDesignEditorState();
|
|
2638
|
+
const uiStore = useEditorUiStoreInstance();
|
|
2639
|
+
const save = (action) => {
|
|
2640
|
+
applyAction(action, { runtimeContent: content });
|
|
2641
|
+
};
|
|
2642
|
+
const toolbar = useArrangementToolbar({
|
|
2643
|
+
designBlock,
|
|
2644
|
+
content,
|
|
2645
|
+
pageDesignState: state,
|
|
2646
|
+
selected: true,
|
|
2647
|
+
save,
|
|
2648
|
+
chooseBackground: (override) => {
|
|
2649
|
+
if (!designBlock) return;
|
|
2650
|
+
const action = setPageDesignBlockBackground({
|
|
2651
|
+
block: designBlock,
|
|
2652
|
+
override,
|
|
2653
|
+
currentContent: content,
|
|
2654
|
+
imagePool: backgroundImagePool
|
|
2655
|
+
});
|
|
2656
|
+
if (action) save(action);
|
|
2657
|
+
},
|
|
2658
|
+
openField: (fieldPath) => uiStore.getState().requestFocus({
|
|
2659
|
+
kind: "main-field",
|
|
2660
|
+
blockId,
|
|
2661
|
+
fieldPath: `content.${fieldPath}`
|
|
2662
|
+
})
|
|
2663
|
+
});
|
|
2664
|
+
const chooseLook = (appearancePresetId) => {
|
|
2665
|
+
if (designBlock) save({
|
|
2666
|
+
kind: "set-look",
|
|
2667
|
+
blockId: designBlock.blockId,
|
|
2668
|
+
appearancePresetId
|
|
2669
|
+
});
|
|
2670
|
+
};
|
|
2671
|
+
return {
|
|
2672
|
+
toolbar,
|
|
2673
|
+
chooseLook,
|
|
2674
|
+
historyFailure
|
|
2675
|
+
};
|
|
2676
|
+
}
|
|
2677
|
+
function BlockLookChoices({ block, look, onChoose }) {
|
|
2678
|
+
const [changing, setChanging] = useState(false);
|
|
2679
|
+
if (!block.availableLooks.length) return null;
|
|
2680
|
+
const choose = (id) => {
|
|
2681
|
+
onChoose(id);
|
|
2682
|
+
setChanging(false);
|
|
2683
|
+
};
|
|
2684
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2685
|
+
className: "space-y-2",
|
|
2686
|
+
children: [/* @__PURE__ */ jsx(BlockLookCard, {
|
|
2687
|
+
block,
|
|
2688
|
+
look,
|
|
2689
|
+
changing,
|
|
2690
|
+
onChange: () => setChanging((value) => !value)
|
|
2691
|
+
}), changing ? /* @__PURE__ */ jsx(BlockLookTiles, {
|
|
2692
|
+
block,
|
|
2693
|
+
onChoose: choose
|
|
2694
|
+
}) : null]
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
function BlockLookCard({ block, look, changing, onChange }) {
|
|
2698
|
+
const preset = pageDesignLookPosition(block);
|
|
2699
|
+
const name = look?.lookName ?? preset.lookName;
|
|
2700
|
+
const position = look ? lookPosition(look) : preset.position;
|
|
2701
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2702
|
+
className: "flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2.5",
|
|
2703
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2704
|
+
className: "min-w-0 flex-1",
|
|
2705
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
2706
|
+
className: "truncate text-sm font-semibold leading-5 text-foreground",
|
|
2707
|
+
children: [look && lookIsAutomatic(look) ? "Automatic · " : "", name]
|
|
2708
|
+
}), position ? /* @__PURE__ */ jsxs("div", {
|
|
2709
|
+
className: "text-xs leading-4 text-muted-foreground",
|
|
2710
|
+
children: [position, " Looks"]
|
|
2711
|
+
}) : null]
|
|
2712
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
2713
|
+
type: "button",
|
|
2714
|
+
"aria-expanded": changing,
|
|
2715
|
+
className: lookChangeButtonClass,
|
|
2716
|
+
onClick: onChange,
|
|
2717
|
+
children: "Change"
|
|
2718
|
+
})]
|
|
2719
|
+
});
|
|
2720
|
+
}
|
|
2721
|
+
function BlockLookTiles({ block, onChoose }) {
|
|
2722
|
+
const current = block.look.effectiveValue;
|
|
2723
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2724
|
+
className: "grid grid-cols-2 gap-1.5",
|
|
2725
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
2726
|
+
type: "button",
|
|
2727
|
+
className: lookTileClass(false),
|
|
2728
|
+
onClick: () => onChoose(null),
|
|
2729
|
+
children: "Default"
|
|
2730
|
+
}), block.availableLooks.map((look) => /* @__PURE__ */ jsx("button", {
|
|
2731
|
+
type: "button",
|
|
2732
|
+
"aria-pressed": look.id === current,
|
|
2733
|
+
className: lookTileClass(look.id === current),
|
|
2734
|
+
onClick: () => onChoose(look.id),
|
|
2735
|
+
children: look.label
|
|
2736
|
+
}, look.id))]
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
const lookChangeButtonClass = "shrink-0 rounded-full border border-border bg-background px-3 py-1 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring";
|
|
2740
|
+
function lookTileClass(selected) {
|
|
2741
|
+
return ["min-h-10 rounded-md border px-2.5 py-2 text-left text-xs font-medium leading-4 text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring", selected ? "border-foreground ring-1 ring-foreground" : "border-border bg-background hover:bg-muted"].join(" ");
|
|
2742
|
+
}
|
|
2743
|
+
//#endregion
|
|
1617
2744
|
//#region ../preview-next/src/client/preview/SelectedBlockCustomizePanel.tsx
|
|
1618
2745
|
const EMPTY_BLOCK_VALUES = {};
|
|
1619
|
-
function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme, sdkConfig }) {
|
|
2746
|
+
function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme, sdkConfig, dashboardBaseUrl }) {
|
|
1620
2747
|
const customizeSelection = usePreviewBlockCustomizeSelectionOptional();
|
|
1621
2748
|
const selection = customizeSelection?.selection ?? { kind: "none" };
|
|
1622
2749
|
if (selection.kind === "none") return /* @__PURE__ */ jsx("div", {
|
|
@@ -1638,72 +2765,52 @@ function SelectedBlockCustomizePanel({ blockItems, uiStoreForBlockEditor, theme,
|
|
|
1638
2765
|
blockId: selection.blockId,
|
|
1639
2766
|
uiStoreForBlockEditor,
|
|
1640
2767
|
theme,
|
|
1641
|
-
sdkConfig
|
|
2768
|
+
sdkConfig,
|
|
2769
|
+
dashboardBaseUrl
|
|
1642
2770
|
});
|
|
1643
2771
|
}
|
|
1644
|
-
function SelectedBlockCustomizeFields({ block, blockId, uiStoreForBlockEditor, theme, sdkConfig }) {
|
|
2772
|
+
function SelectedBlockCustomizeFields({ block, blockId, uiStoreForBlockEditor, theme, sdkConfig, dashboardBaseUrl }) {
|
|
2773
|
+
const { siteId } = usePreviewAuth();
|
|
1645
2774
|
const blockContent = useBlockCurrentValues(uiStoreForBlockEditor, blockId, block.content ?? EMPTY_BLOCK_VALUES);
|
|
1646
|
-
const
|
|
2775
|
+
const customizeControls = useBlockCustomizeControls({
|
|
1647
2776
|
blockId,
|
|
1648
2777
|
blockKind: block.kind,
|
|
1649
2778
|
content: blockContent,
|
|
1650
2779
|
uiStore: uiStoreForBlockEditor,
|
|
1651
2780
|
theme,
|
|
1652
|
-
sdkConfig
|
|
1653
|
-
maxQuickFields: 3
|
|
2781
|
+
sdkConfig
|
|
1654
2782
|
});
|
|
2783
|
+
const { backend, manifest, fields, sectionPlan, designBlock } = customizeControls;
|
|
1655
2784
|
if (!manifest || !backend) return /* @__PURE__ */ jsx("div", {
|
|
1656
2785
|
className: "rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",
|
|
1657
2786
|
children: "No customize controls are available for this section."
|
|
1658
2787
|
});
|
|
1659
|
-
if (quickFields.length === 0 && panelFields.length === 0) return /* @__PURE__ */ jsxs("div", {
|
|
1660
|
-
className: "space-y-1 rounded-md border border-dashed px-3 py-4 text-sm text-muted-foreground",
|
|
1661
|
-
children: [/* @__PURE__ */ jsx("p", { children: "No safe customize controls are available for this section yet." }), /* @__PURE__ */ jsx("p", {
|
|
1662
|
-
className: "text-xs",
|
|
1663
|
-
children: "Content fields remain in Page Blocks."
|
|
1664
|
-
})]
|
|
1665
|
-
});
|
|
1666
2788
|
return /* @__PURE__ */ jsxs("div", {
|
|
1667
2789
|
className: "space-y-5",
|
|
1668
|
-
children: [
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
}) :
|
|
1691
|
-
|
|
1692
|
-
className: "space-y-3",
|
|
1693
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1694
|
-
className: "text-xs font-medium uppercase text-muted-foreground",
|
|
1695
|
-
children: "More controls"
|
|
1696
|
-
}), /* @__PURE__ */ jsx(FormRenderer, {
|
|
1697
|
-
dateContext: civilPickerDisplay.dateContext,
|
|
1698
|
-
fields: panelFields,
|
|
1699
|
-
backend,
|
|
1700
|
-
widgetOverrides: previewWidgetOverrides,
|
|
1701
|
-
showSettingsTrigger: false,
|
|
1702
|
-
blockKind: block.kind,
|
|
1703
|
-
className: "space-y-4"
|
|
1704
|
-
})]
|
|
1705
|
-
}) : null
|
|
1706
|
-
]
|
|
2790
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2791
|
+
className: "text-sm font-semibold",
|
|
2792
|
+
children: manifest.title
|
|
2793
|
+
}), /* @__PURE__ */ jsx(FormRenderer, {
|
|
2794
|
+
dateContext: civilPickerDisplay.dateContext,
|
|
2795
|
+
fields,
|
|
2796
|
+
backend,
|
|
2797
|
+
sectionPlan,
|
|
2798
|
+
sectionOptions: { lookField: manifest.lookField },
|
|
2799
|
+
widgetOverrides: previewWidgetOverrides,
|
|
2800
|
+
blockKind: block.kind,
|
|
2801
|
+
lookContent: customizeControls.lookSource.kind === "sdk" || !designBlock ? void 0 : /* @__PURE__ */ jsx(SelectedBlockLookControls, {
|
|
2802
|
+
blockId,
|
|
2803
|
+
blockKind: block.kind,
|
|
2804
|
+
content: blockContent,
|
|
2805
|
+
designBlock
|
|
2806
|
+
}),
|
|
2807
|
+
sourceLine: manifest.sourceLine ? /* @__PURE__ */ jsx(BlockSourceLine, {
|
|
2808
|
+
source: manifest.sourceLine,
|
|
2809
|
+
getValue: backend.getValue,
|
|
2810
|
+
siteId: siteId ?? "",
|
|
2811
|
+
dashboardBaseUrl: dashboardBaseUrl ?? ""
|
|
2812
|
+
}) : void 0
|
|
2813
|
+
})]
|
|
1707
2814
|
});
|
|
1708
2815
|
}
|
|
1709
2816
|
function useBlockCurrentValues(store, blockId, fallback) {
|
|
@@ -1712,9 +2819,6 @@ function useBlockCurrentValues(store, blockId, fallback) {
|
|
|
1712
2819
|
function readBlockCurrentValues(store, blockId, fallback) {
|
|
1713
2820
|
return store.getState().drafts.getCurrentValues(blockId) ?? fallback;
|
|
1714
2821
|
}
|
|
1715
|
-
function formatBlockKindLabel(blockKind) {
|
|
1716
|
-
return blockKind.replace(/^block\./, "").replace(/^custom\./, "").replace(/[-_]+/g, " ");
|
|
1717
|
-
}
|
|
1718
2822
|
//#endregion
|
|
1719
2823
|
//#region ../preview-next/src/client/preview/PageBlockEditorPanel.tsx
|
|
1720
2824
|
function usePageBlockEditorPanelControls(uiStoreForBlockEditor) {
|
|
@@ -1771,10 +2875,7 @@ function useBlockCustomizeNavigation() {
|
|
|
1771
2875
|
onSelect: handleCustomizeBlock,
|
|
1772
2876
|
onAfterMenuClose: handleCustomizeMenuClose
|
|
1773
2877
|
}
|
|
1774
|
-
} : {
|
|
1775
|
-
kind: "menu",
|
|
1776
|
-
customize: { kind: "modal" }
|
|
1777
|
-
}, [
|
|
2878
|
+
} : { kind: "menu" }, [
|
|
1778
2879
|
customizeSelection,
|
|
1779
2880
|
handleCustomizeBlock,
|
|
1780
2881
|
handleCustomizeMenuClose
|
|
@@ -1835,6 +2936,7 @@ function PageBlockEditorPanel(props) {
|
|
|
1835
2936
|
hidden: takeover,
|
|
1836
2937
|
sectionRef: controls.customizeSectionRef,
|
|
1837
2938
|
children: /* @__PURE__ */ jsx(SelectedBlockCustomizePanel, {
|
|
2939
|
+
dashboardBaseUrl: props.dashboardBaseUrl,
|
|
1838
2940
|
blockItems: props.blockItems,
|
|
1839
2941
|
uiStoreForBlockEditor: props.uiStoreForBlockEditor,
|
|
1840
2942
|
theme: props.theme ?? null,
|
|
@@ -3930,6 +5032,8 @@ const PALETTE_SURFACE_ROLES = [
|
|
|
3930
5032
|
}
|
|
3931
5033
|
];
|
|
3932
5034
|
function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVersion = null, selectionUpdatedAt, initialSelections, buttonStyleRepairs, headerLogoContext, onFocusedSurfaceChange }) {
|
|
5035
|
+
const journal = useOptionalSessionJournal();
|
|
5036
|
+
const authoringAllowed = usePreviewAuthoringAdmission();
|
|
3933
5037
|
const designOpenRequest = usePreviewDesignOpenRequest();
|
|
3934
5038
|
const router = useRouter();
|
|
3935
5039
|
const previewDesign = usePreviewDesignCoordinator();
|
|
@@ -4125,39 +5229,54 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
|
|
|
4125
5229
|
setState((current) => current ? dismissWarnings(current) : current);
|
|
4126
5230
|
}, []);
|
|
4127
5231
|
const applySelection = useCallback(async (live, restage) => {
|
|
4128
|
-
if (footerPreferences === null || !live || !isPreviewingChange(live)) return;
|
|
5232
|
+
if (!authoringAllowed() || footerPreferences === null || !live || !isPreviewingChange(live)) return;
|
|
4129
5233
|
if (!deriveStyleConfiguratorCapabilities(live).canApplyStaged) return;
|
|
4130
5234
|
const previewed = live.previewed;
|
|
4131
5235
|
if (!getCuratedSiteStyle(previewed.siteStyleId)) return;
|
|
5236
|
+
const reservation = acceptStyleSelection(journal, {
|
|
5237
|
+
siteId,
|
|
5238
|
+
selectionId: selectionId ?? null,
|
|
5239
|
+
before: live.base,
|
|
5240
|
+
after: previewed
|
|
5241
|
+
});
|
|
5242
|
+
if (reservation?.kind === "busy") return;
|
|
4132
5243
|
await runnerRef.current.run({
|
|
4133
5244
|
optimistic: () => {
|
|
4134
5245
|
applyStarted("style-configurator");
|
|
4135
5246
|
setState((current) => current ? markApplySaving(current) : current);
|
|
4136
5247
|
},
|
|
4137
5248
|
network: async () => {
|
|
4138
|
-
const
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
selectionId
|
|
5249
|
+
const saved = await persistStyleSelection(apiClient, siteId, selectionId, live, authoringAllowed).catch((error) => {
|
|
5250
|
+
reservation?.refuse("reconcile");
|
|
5251
|
+
throw error;
|
|
4142
5252
|
});
|
|
4143
|
-
if (
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
5253
|
+
if (saved.journal) reservation?.settle({
|
|
5254
|
+
revisionKind: "counter",
|
|
5255
|
+
expectedRevision: saved.journal.expectedRevision,
|
|
5256
|
+
revision: saved.journal.revision,
|
|
5257
|
+
change: {
|
|
5258
|
+
kind: "theme-selection",
|
|
5259
|
+
siteId,
|
|
5260
|
+
selectionId: saved.journal.selectionId,
|
|
5261
|
+
before: saved.journal.before,
|
|
5262
|
+
after: saved.journal.after
|
|
5263
|
+
}
|
|
5264
|
+
});
|
|
5265
|
+
else reservation?.refuse("reconcile");
|
|
5266
|
+
return saved;
|
|
4149
5267
|
},
|
|
4150
5268
|
onSuccess: (saved) => {
|
|
4151
5269
|
const persisted = selectionSnapshotFromApplySiteStyleSelectionResponse(saved, previewed);
|
|
4152
5270
|
const historyEntry = styleConfiguratorHistoryEntryForPersistedSelection(live, persisted);
|
|
4153
5271
|
setState((current) => current ? restageSelectionChanges(markApplySaved(current, persisted), restage?.staged ?? {}) : current);
|
|
4154
|
-
if (historyEntry) siteStyleHistory?.recordAppliedSelection(historyEntry);
|
|
5272
|
+
if (historyEntry && !journal) siteStyleHistory?.recordAppliedSelection(historyEntry);
|
|
4155
5273
|
applySucceeded("style-configurator");
|
|
4156
5274
|
startRefreshTransition(() => {
|
|
4157
5275
|
router.refresh();
|
|
4158
5276
|
});
|
|
4159
5277
|
},
|
|
4160
5278
|
onError: (error) => {
|
|
5279
|
+
reservation?.refuse("reconcile");
|
|
4161
5280
|
applyFailed("style-configurator");
|
|
4162
5281
|
const applyError = classifyStyleApplyError(error);
|
|
4163
5282
|
if (applyError.kind === "stale") startRefreshTransition(() => {
|
|
@@ -4168,6 +5287,8 @@ function StyleConfigurator({ siteId, apiClient, theme, selectionId, selectionVer
|
|
|
4168
5287
|
}
|
|
4169
5288
|
});
|
|
4170
5289
|
}, [
|
|
5290
|
+
authoringAllowed,
|
|
5291
|
+
journal,
|
|
4171
5292
|
footerPreferences,
|
|
4172
5293
|
apiClient,
|
|
4173
5294
|
applyFailed,
|
|
@@ -4712,12 +5833,23 @@ function withResolvedSiteStyleSelections(input) {
|
|
|
4712
5833
|
warnings: result.warnings
|
|
4713
5834
|
});
|
|
4714
5835
|
}
|
|
5836
|
+
async function persistStyleSelection(apiClient, siteId, selectionId, live, admitted) {
|
|
5837
|
+
if (!admitted()) throw new Error("Editor admission closed before the style save");
|
|
5838
|
+
const body = buildApplySiteStyleSelectionBody({
|
|
5839
|
+
base: live.base,
|
|
5840
|
+
previewed: live.previewed,
|
|
5841
|
+
selectionId
|
|
5842
|
+
});
|
|
5843
|
+
if (!body.ok) throw new StyleApplyPlanError(paletteApplyPlanErrorMessage(body.error));
|
|
5844
|
+
return unwrapResponse(await apiClient({
|
|
5845
|
+
endpoint: "applySiteStyleSelection",
|
|
5846
|
+
params: { siteId },
|
|
5847
|
+
body: body.body
|
|
5848
|
+
}));
|
|
5849
|
+
}
|
|
4715
5850
|
//#endregion
|
|
4716
5851
|
//#region ../preview-next/src/client/preview/PreviewEditorSidebar.tsx
|
|
4717
|
-
function
|
|
4718
|
-
return input.enabled && Boolean(input.pageId && input.bearerToken && input.canEdit);
|
|
4719
|
-
}
|
|
4720
|
-
function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, bearerToken, entrySubrouteContext, assistantPanel, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, activeTab, onTabChange, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
|
|
5852
|
+
function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, pageId, pageNodeType, entryData, contentTypeSchema, referenceContentTypeKeys = [], draftContent, currentTemplate, theme, themeId = null, themeSelectionId = null, themeSelectionVersion = null, themeSelectionUpdatedAt = null, themeSelectionButtonStyleSelection = null, themeSelectionButtonStyleRepairs, themeSelectionHeaderSelection = null, themeSelectionFooterLookId = null, themeSelectionHeaderLogo, apiClient, entrySubrouteContext, sdkConfig, bookingOfferingPresets, siteStyleAccess = { kind: "hidden" }, onClose, onFooterSaved, viewportMode, viewportWidth, zoom, onViewportModeChange, onViewportWidthChange, onZoomChange }) {
|
|
4721
5853
|
const controller = useEntryController();
|
|
4722
5854
|
const controllerBlocks = controller.blocks;
|
|
4723
5855
|
const uiStore = useEditorUiStoreInstance();
|
|
@@ -4742,14 +5874,6 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
|
|
|
4742
5874
|
dashboardSetupHandoff,
|
|
4743
5875
|
surfaceId
|
|
4744
5876
|
]);
|
|
4745
|
-
const showAssistantTab = Boolean(assistantPanel);
|
|
4746
|
-
const assistantAvailable = assistantTabAvailable({
|
|
4747
|
-
enabled: showAssistantTab,
|
|
4748
|
-
pageId,
|
|
4749
|
-
bearerToken,
|
|
4750
|
-
canEdit
|
|
4751
|
-
});
|
|
4752
|
-
const effectiveActiveTab = showAssistantTab ? resolvePreviewSidebarTab(activeTab) : "editor";
|
|
4753
5877
|
const blockItems = useMemo(() => controllerBlocks.list, [controllerBlocks.list]);
|
|
4754
5878
|
const blockEditorRef = useRef(null);
|
|
4755
5879
|
const contentFormWidgets = useMemo(() => previewWidgetOverrides, []);
|
|
@@ -4878,29 +6002,21 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
|
|
|
4878
6002
|
})
|
|
4879
6003
|
})
|
|
4880
6004
|
});
|
|
4881
|
-
const assistantPanelDisplay = assistantAvailable ? assistantPanel : /* @__PURE__ */ jsx("div", {
|
|
4882
|
-
className: "flex h-full flex-col items-center justify-center p-6 text-center text-sm text-muted-foreground",
|
|
4883
|
-
children: "AI Assistant is available for pages in preview mode."
|
|
4884
|
-
});
|
|
4885
6005
|
return /* @__PURE__ */ jsx("div", {
|
|
4886
6006
|
className: `flex h-full min-h-0 flex-col overflow-hidden pb-[calc(var(--builder-editor-chrome-offset,0px)+var(--builder-preview-banner-offset,0px))] ${sidebarChrome.rootClassName}`,
|
|
4887
6007
|
"data-preview-sidebar-tone": sidebarChrome.tone,
|
|
4888
6008
|
children: /* @__PURE__ */ jsxs(Tabs, {
|
|
4889
|
-
value:
|
|
4890
|
-
onValueChange: (value) => onTabChange(resolvePreviewSidebarTab(value)),
|
|
6009
|
+
value: "editor",
|
|
4891
6010
|
className: "flex h-full min-h-0 flex-col overflow-hidden",
|
|
4892
6011
|
children: [
|
|
4893
6012
|
/* @__PURE__ */ jsxs("div", {
|
|
4894
6013
|
className: `shrink-0 flex items-center justify-between px-4 py-3 ${sidebarChrome.headerClassName}`,
|
|
4895
|
-
children: [/* @__PURE__ */
|
|
6014
|
+
children: [/* @__PURE__ */ jsx(TabsList, {
|
|
4896
6015
|
className: "h-8",
|
|
4897
|
-
children:
|
|
6016
|
+
children: /* @__PURE__ */ jsx(TabsTrigger, {
|
|
4898
6017
|
value: "editor",
|
|
4899
6018
|
children: "Editor"
|
|
4900
|
-
})
|
|
4901
|
-
value: "assistant",
|
|
4902
|
-
children: "AI Assistant"
|
|
4903
|
-
}) : null]
|
|
6019
|
+
})
|
|
4904
6020
|
}), /* @__PURE__ */ jsx(Button, {
|
|
4905
6021
|
variant: "ghost",
|
|
4906
6022
|
size: "icon",
|
|
@@ -4923,15 +6039,9 @@ function PreviewEditorSidebar({ surfaceId, siteId, dashboardBaseUrl = null, page
|
|
|
4923
6039
|
/* @__PURE__ */ jsx(TabsContent, {
|
|
4924
6040
|
value: "editor",
|
|
4925
6041
|
forceMount: true,
|
|
4926
|
-
className: "mt-0 min-h-0 flex-1 overflow-hidden
|
|
6042
|
+
className: "mt-0 min-h-0 flex-1 overflow-hidden",
|
|
4927
6043
|
children: editorPanel
|
|
4928
|
-
})
|
|
4929
|
-
showAssistantTab ? /* @__PURE__ */ jsx(TabsContent, {
|
|
4930
|
-
value: "assistant",
|
|
4931
|
-
forceMount: true,
|
|
4932
|
-
className: "mt-0 min-h-0 flex-1 overflow-hidden data-[state=inactive]:hidden",
|
|
4933
|
-
children: assistantPanelDisplay
|
|
4934
|
-
}) : null
|
|
6044
|
+
})
|
|
4935
6045
|
]
|
|
4936
6046
|
})
|
|
4937
6047
|
});
|