@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,1326 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { Oi as parseSiteId, mt as isThemeV2NormalEditorRawStyleFieldName, vi as expectParsedBrandedId } from "./ThemedButton-BEOPss9H.mjs";
|
|
3
|
-
import { $a as FieldFrame, $t as LinkWidgetProvider, An as PaletteProvider, At as SiteOptionPickerField, Ba as mapOptionValueForSelect, Bt as EntryPickerWidgetProvider, Cr as getBlockDefinition, Fa as isHeaderField, Ft as loadMailingListAuthoringContext, G as usePreviewPageDesignEditorState, Gt as ReferenceField, H as arrangementVisibilityValues, Ht as ButtonWidgetProvider, Ia as SdkConfigProvider, In as evaluateVisibility, It as MailingListTargetingProvider, Jt as RichTextField, Kt as ReferenceWidgetProvider, La as useSdkConfig, Lt as InlineTextField, Mt as OfferingsPreviewGroupOrderField, Nn as createManifestFormAdapter, Nt as OfferingsPreviewWidgetProvider, Os as assertNever, Ot as createSiteOptionApiLoader, Pa as getFieldIntent, Pt as MailingListTargetingField, Qt as LinkField, Ra as hasEmptyOption, Rt as IconPickerField, Ut as FileField, V as arrangementOwnedFieldIds, Va as unmapValueFromSelect, Vr as buildThemeRuntime, Vt as ButtonVariantField, Wt as MediaField, Yn as unwrapResponse, Yt as RichTextWidgetProvider, ao as SelectItem, ar as createStoreBackend, ca as getGradientPreset, cn as BUILT_IN_REFERENCE_KINDS, hn as useEditorUiStoreInstance, in as getBlockManifestFromSdkConfig, io as SelectContent, jn as usePalette, jt as SiteOptionWidgetProvider, kt as createSiteOptionWidgetAdapters, ls as cn, nn as prepareBlockEditorManifest, oa as gradientToCss, oo as SelectTrigger, pt as useUISelector, qt as useRichTextImagePicker, rn as stripTopLevelRoutingUi, ro as Select, sa as GRADIENT_PRESETS, so as SelectValue, tn as hideThemeV2RawStyleFields, un as parseReferenceKind, us as useField, za as mapCurrentValueForSelect, zt as EntryPickerField } from "./SiteChromeCustomizeContext-CfRQRwpH.mjs";
|
|
4
|
-
import { createContext, useCallback, useContext, useMemo, useState } from "react";
|
|
5
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
//#region ../block-form/src/widgets/SelectWidget.tsx
|
|
7
|
-
/**
|
|
8
|
-
* Standalone select widget with block-form styling parity. Supports custom option
|
|
9
|
-
* renderers while maintaining accessible labelling and message semantics.
|
|
10
|
-
*/
|
|
11
|
-
function SelectWidget(props) {
|
|
12
|
-
const { id, label, value, onChange, options, description, hint, error, placeholder, triggerClassName, size = "default", disabled, className, labelClassName, descriptionClassName, renderOption, renderValue, dataPath } = props;
|
|
13
|
-
const normalizedValue = value ?? "";
|
|
14
|
-
const allowEmptyOption = useMemo(() => hasEmptyOption(options), [options]);
|
|
15
|
-
const radixValue = useMemo(() => mapCurrentValueForSelect(value, allowEmptyOption), [value, allowEmptyOption]);
|
|
16
|
-
const selectedOption = useMemo(() => options.find((option) => option.value === normalizedValue), [options, normalizedValue]);
|
|
17
|
-
return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
"data-theme-path": dataPath,
|
|
19
|
-
children: /* @__PURE__ */ jsx(FieldFrame, {
|
|
20
|
-
id,
|
|
21
|
-
label,
|
|
22
|
-
description,
|
|
23
|
-
hint,
|
|
24
|
-
error,
|
|
25
|
-
className,
|
|
26
|
-
labelClassName,
|
|
27
|
-
descriptionClassName,
|
|
28
|
-
children: ({ id: controlId, descriptionId, messageId }) => {
|
|
29
|
-
const describedBy = [descriptionId, messageId].filter(Boolean).join(" ") || void 0;
|
|
30
|
-
return /* @__PURE__ */ jsxs(Select, {
|
|
31
|
-
value: radixValue,
|
|
32
|
-
onValueChange: (nextValue) => onChange(unmapValueFromSelect(nextValue, allowEmptyOption)),
|
|
33
|
-
disabled,
|
|
34
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
35
|
-
id: controlId,
|
|
36
|
-
size,
|
|
37
|
-
className: cn("w-full justify-between", triggerClassName),
|
|
38
|
-
"aria-describedby": describedBy,
|
|
39
|
-
children: renderValue && value !== null && value !== void 0 ? /* @__PURE__ */ jsx("span", {
|
|
40
|
-
className: "truncate",
|
|
41
|
-
children: renderValue(selectedOption)
|
|
42
|
-
}) : /* @__PURE__ */ jsx(SelectValue, { placeholder: placeholder ?? `Select ${label.toLowerCase()}` })
|
|
43
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: options.map((option) => {
|
|
44
|
-
const optionValue = mapOptionValueForSelect(option.value, allowEmptyOption);
|
|
45
|
-
return /* @__PURE__ */ jsx(SelectItem, {
|
|
46
|
-
value: optionValue,
|
|
47
|
-
disabled: option.disabled,
|
|
48
|
-
children: renderOption ? renderOption(option, { selected: option.value === selectedOption?.value }) : renderDefaultOption(option)
|
|
49
|
-
}, optionValue);
|
|
50
|
-
}) })]
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
})
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
function renderDefaultOption(option) {
|
|
57
|
-
if (!option.description) return option.label;
|
|
58
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
59
|
-
className: "flex flex-col gap-0.5",
|
|
60
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
61
|
-
className: "text-sm font-medium text-foreground",
|
|
62
|
-
children: option.label
|
|
63
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
64
|
-
className: "text-xs text-muted-foreground",
|
|
65
|
-
children: option.description
|
|
66
|
-
})]
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
//#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorWidget.tsx
|
|
71
|
-
const ROLE_COLOR_NAMES = [
|
|
72
|
-
"primary",
|
|
73
|
-
"secondary",
|
|
74
|
-
"accent"
|
|
75
|
-
];
|
|
76
|
-
/**
|
|
77
|
-
* BackgroundColorWidget
|
|
78
|
-
*
|
|
79
|
-
* Select a background color from the site's theme palette or SDK config.
|
|
80
|
-
* Automatically uses SDK section backgrounds from context when available.
|
|
81
|
-
* Otherwise supports 'limited' mode (key shades only) or 'full' mode (all shades).
|
|
82
|
-
* Optionally filters to only show legible colors via filterTokens prop.
|
|
83
|
-
*/
|
|
84
|
-
function BackgroundColorWidget(props) {
|
|
85
|
-
const { label, value, onChange, mode = "limited", filterTokens = null, className, triggerClassName, description, error, dataPath } = props;
|
|
86
|
-
const { tokens } = usePalette();
|
|
87
|
-
const { sectionBackgrounds, themePalette, isSdkSite } = useSdkConfig();
|
|
88
|
-
const handleChange = useCallback((next) => {
|
|
89
|
-
onChange(next);
|
|
90
|
-
}, [onChange]);
|
|
91
|
-
const useSdkMode = isSdkSite && sectionBackgrounds && sectionBackgrounds.length > 0;
|
|
92
|
-
const sdkOptions = useMemo(() => {
|
|
93
|
-
if (!useSdkMode || !sectionBackgrounds) return [];
|
|
94
|
-
return sectionBackgrounds.map((bg) => ({
|
|
95
|
-
value: bg.id,
|
|
96
|
-
label: bg.label
|
|
97
|
-
}));
|
|
98
|
-
}, [useSdkMode, sectionBackgrounds]);
|
|
99
|
-
const sdkBackgroundsMap = useMemo(() => {
|
|
100
|
-
if (!useSdkMode || !sectionBackgrounds) return /* @__PURE__ */ new Map();
|
|
101
|
-
return new Map(sectionBackgrounds.map((bg) => {
|
|
102
|
-
const hexValue = themePalette?.[bg.token] ?? bg.token;
|
|
103
|
-
return [bg.id, hexValue];
|
|
104
|
-
}));
|
|
105
|
-
}, [
|
|
106
|
-
useSdkMode,
|
|
107
|
-
sectionBackgrounds,
|
|
108
|
-
themePalette
|
|
109
|
-
]);
|
|
110
|
-
const availableTokens = useMemo(() => {
|
|
111
|
-
if (useSdkMode) return [];
|
|
112
|
-
return Object.keys(tokens).filter((key) => {
|
|
113
|
-
return typeof tokens[key] === "string";
|
|
114
|
-
});
|
|
115
|
-
}, [tokens, useSdkMode]);
|
|
116
|
-
const modeFilteredTokens = useMemo(() => {
|
|
117
|
-
if (useSdkMode) return [];
|
|
118
|
-
if (mode === "full") return availableTokens;
|
|
119
|
-
const limitedPatterns = [
|
|
120
|
-
"surface",
|
|
121
|
-
"background",
|
|
122
|
-
"transparent",
|
|
123
|
-
"-50",
|
|
124
|
-
"-500",
|
|
125
|
-
"-900"
|
|
126
|
-
];
|
|
127
|
-
return [...availableTokens.filter((token) => {
|
|
128
|
-
if (limitedPatterns.some((pattern) => token.includes(pattern))) return true;
|
|
129
|
-
if (ROLE_COLOR_NAMES.includes(token)) return true;
|
|
130
|
-
return false;
|
|
131
|
-
})].sort((a, b) => {
|
|
132
|
-
const aIsBase = ROLE_COLOR_NAMES.includes(a);
|
|
133
|
-
const bIsBase = ROLE_COLOR_NAMES.includes(b);
|
|
134
|
-
if (aIsBase && !bIsBase) return -1;
|
|
135
|
-
if (!aIsBase && bIsBase) return 1;
|
|
136
|
-
return a.localeCompare(b);
|
|
137
|
-
});
|
|
138
|
-
}, [
|
|
139
|
-
mode,
|
|
140
|
-
availableTokens,
|
|
141
|
-
useSdkMode
|
|
142
|
-
]);
|
|
143
|
-
const filteredTokens = useMemo(() => {
|
|
144
|
-
if (useSdkMode) return [];
|
|
145
|
-
if (!filterTokens) return modeFilteredTokens;
|
|
146
|
-
return modeFilteredTokens.filter((token) => filterTokens.includes(token));
|
|
147
|
-
}, [
|
|
148
|
-
modeFilteredTokens,
|
|
149
|
-
filterTokens,
|
|
150
|
-
useSdkMode
|
|
151
|
-
]);
|
|
152
|
-
const paletteOptions = useMemo(() => {
|
|
153
|
-
return filteredTokens.map((token) => ({
|
|
154
|
-
value: token,
|
|
155
|
-
label: getColorTokenLabel(token)
|
|
156
|
-
}));
|
|
157
|
-
}, [filteredTokens]);
|
|
158
|
-
const options = useSdkMode ? sdkOptions : paletteOptions;
|
|
159
|
-
const getHex = useCallback((tokenOrId) => {
|
|
160
|
-
if (useSdkMode) return sdkBackgroundsMap.get(tokenOrId) ?? null;
|
|
161
|
-
const hex = tokens[tokenOrId];
|
|
162
|
-
return typeof hex === "string" ? hex : null;
|
|
163
|
-
}, [
|
|
164
|
-
useSdkMode,
|
|
165
|
-
sdkBackgroundsMap,
|
|
166
|
-
tokens
|
|
167
|
-
]);
|
|
168
|
-
return /* @__PURE__ */ jsx(SelectWidget, {
|
|
169
|
-
label,
|
|
170
|
-
value: value ?? null,
|
|
171
|
-
onChange: handleChange,
|
|
172
|
-
options,
|
|
173
|
-
className,
|
|
174
|
-
error,
|
|
175
|
-
dataPath,
|
|
176
|
-
description,
|
|
177
|
-
triggerClassName: cn("flex w-full items-center justify-between gap-2", triggerClassName),
|
|
178
|
-
renderOption: (option) => /* @__PURE__ */ jsxs("div", {
|
|
179
|
-
className: "flex items-center gap-3",
|
|
180
|
-
children: [
|
|
181
|
-
/* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }),
|
|
182
|
-
/* @__PURE__ */ jsx("span", {
|
|
183
|
-
className: "text-sm font-medium text-foreground",
|
|
184
|
-
children: option.label
|
|
185
|
-
}),
|
|
186
|
-
!useSdkMode && /* @__PURE__ */ jsx("span", {
|
|
187
|
-
className: "ml-auto text-xs text-muted-foreground",
|
|
188
|
-
children: option.value
|
|
189
|
-
})
|
|
190
|
-
]
|
|
191
|
-
}),
|
|
192
|
-
renderValue: (option) => option ? /* @__PURE__ */ jsxs("div", {
|
|
193
|
-
className: "flex items-center gap-2",
|
|
194
|
-
children: [/* @__PURE__ */ jsx(ColorSwatch, { hex: getHex(option.value) }), /* @__PURE__ */ jsx("span", {
|
|
195
|
-
className: "text-sm",
|
|
196
|
-
children: option.label
|
|
197
|
-
})]
|
|
198
|
-
}) : null
|
|
199
|
-
});
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Color swatch component
|
|
203
|
-
*/
|
|
204
|
-
function ColorSwatch({ hex }) {
|
|
205
|
-
return /* @__PURE__ */ jsx("span", {
|
|
206
|
-
"aria-hidden": "true",
|
|
207
|
-
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"),
|
|
208
|
-
style: hex ? { backgroundColor: hex } : void 0
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Get display label for a color token
|
|
213
|
-
* Converts token names to readable labels (e.g., primary-500 becomes Primary 500)
|
|
214
|
-
*/
|
|
215
|
-
function getColorTokenLabel(token) {
|
|
216
|
-
const specialLabels = {
|
|
217
|
-
"surface": "Surface",
|
|
218
|
-
"background": "Background",
|
|
219
|
-
"text": "Text",
|
|
220
|
-
"transparent": "Transparent",
|
|
221
|
-
"body": "Body Text",
|
|
222
|
-
"mutedText": "Muted Text"
|
|
223
|
-
};
|
|
224
|
-
if (specialLabels[token]) return specialLabels[token];
|
|
225
|
-
return token.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join(" ");
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region ../block-form/src/widgets/BackgroundColorWidget/BackgroundColorField.tsx
|
|
229
|
-
function BackgroundColorField({ path, backend, config }) {
|
|
230
|
-
const { value, error, setValue } = useField(path, backend);
|
|
231
|
-
return /* @__PURE__ */ jsx(BackgroundColorWidget, {
|
|
232
|
-
label: config.label || "Background Color",
|
|
233
|
-
value: value ?? null,
|
|
234
|
-
onChange: setValue,
|
|
235
|
-
mode: "full",
|
|
236
|
-
description: config.description,
|
|
237
|
-
error: error?.message,
|
|
238
|
-
dataPath: path
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
//#endregion
|
|
242
|
-
//#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientWidget.tsx
|
|
243
|
-
/**
|
|
244
|
-
* Select a curated gradient from the theme-based library.
|
|
245
|
-
* Gradients use theme color tokens, so they adapt to the site's palette.
|
|
246
|
-
*/
|
|
247
|
-
function BackgroundGradientWidget({ label, value, onChange, description, error, dataPath }) {
|
|
248
|
-
const { tokens } = usePalette();
|
|
249
|
-
const selectedPreset = useMemo(() => value ? GRADIENT_PRESETS.find((preset) => gradientConfigsMatch(preset, value)) ?? null : null, [value]);
|
|
250
|
-
const handleSelectPreset = (presetId) => {
|
|
251
|
-
onChange(gradientConfigFromPreset(getGradientPreset(presetId)));
|
|
252
|
-
};
|
|
253
|
-
return /* @__PURE__ */ jsx(FieldFrame, {
|
|
254
|
-
fieldPath: dataPath,
|
|
255
|
-
label,
|
|
256
|
-
description,
|
|
257
|
-
error,
|
|
258
|
-
className: "space-y-3",
|
|
259
|
-
children: ({ id, descriptionId, messageId }) => /* @__PURE__ */ jsxs("div", {
|
|
260
|
-
className: "space-y-3",
|
|
261
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
262
|
-
role: "group",
|
|
263
|
-
"aria-label": `${label} presets`,
|
|
264
|
-
"aria-describedby": [descriptionId, messageId].filter(Boolean).join(" ") || void 0,
|
|
265
|
-
className: "grid grid-cols-2 gap-3 sm:grid-cols-3",
|
|
266
|
-
children: GRADIENT_PRESETS.map((preset, index) => {
|
|
267
|
-
const isSelected = selectedPreset?.id === preset.id;
|
|
268
|
-
const cssGradient = gradientToCss(gradientConfigFromPreset(preset), tokens);
|
|
269
|
-
const kindLabel = gradientKindLabel(preset.type);
|
|
270
|
-
return /* @__PURE__ */ jsxs("button", {
|
|
271
|
-
id: index === 0 ? id : void 0,
|
|
272
|
-
type: "button",
|
|
273
|
-
"aria-label": `${preset.name}, ${kindLabel} gradient`,
|
|
274
|
-
"aria-pressed": isSelected,
|
|
275
|
-
onClick: () => handleSelectPreset(preset.id),
|
|
276
|
-
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"),
|
|
277
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
278
|
-
"aria-hidden": "true",
|
|
279
|
-
className: "h-16 w-full rounded-sm",
|
|
280
|
-
style: { background: cssGradient }
|
|
281
|
-
}), /* @__PURE__ */ jsxs("span", {
|
|
282
|
-
className: "space-y-0.5",
|
|
283
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
284
|
-
className: "block text-xs font-medium text-foreground",
|
|
285
|
-
children: preset.name
|
|
286
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
287
|
-
className: "block text-[11px] font-medium uppercase tracking-wide text-muted-foreground",
|
|
288
|
-
children: kindLabel
|
|
289
|
-
})]
|
|
290
|
-
})]
|
|
291
|
-
}, preset.id);
|
|
292
|
-
})
|
|
293
|
-
}), value ? /* @__PURE__ */ jsxs("p", {
|
|
294
|
-
className: "text-xs text-muted-foreground",
|
|
295
|
-
"aria-live": "polite",
|
|
296
|
-
children: ["Selected gradient: ", selectedPreset ? `${selectedPreset.name} · ${gradientKindLabel(selectedPreset.type)}` : "Custom"]
|
|
297
|
-
}) : null]
|
|
298
|
-
})
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
|
-
function gradientConfigFromPreset(preset) {
|
|
302
|
-
return {
|
|
303
|
-
type: preset.type,
|
|
304
|
-
angle: preset.angle,
|
|
305
|
-
shape: preset.shape,
|
|
306
|
-
position: preset.position,
|
|
307
|
-
stops: preset.stops.map((stop) => ({ ...stop }))
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
function gradientConfigsMatch(preset, value) {
|
|
311
|
-
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);
|
|
312
|
-
}
|
|
313
|
-
function radialShape(config) {
|
|
314
|
-
return config.type === "radial" ? config.shape ?? "circle" : config.shape;
|
|
315
|
-
}
|
|
316
|
-
function gradientKindLabel(type) {
|
|
317
|
-
switch (type) {
|
|
318
|
-
case "linear": return "Linear";
|
|
319
|
-
case "radial": return "Radial";
|
|
320
|
-
case "conic": return "Conic";
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
//#endregion
|
|
324
|
-
//#region ../block-form/src/widgets/BackgroundGradientWidget/BackgroundGradientField.tsx
|
|
325
|
-
/**
|
|
326
|
-
* BackgroundGradientField
|
|
327
|
-
*
|
|
328
|
-
* Field wrapper for BackgroundGradientWidget that integrates with the form system.
|
|
329
|
-
* Converts between GradientConfig objects (used by the widget) and CSS strings
|
|
330
|
-
* (stored in the form data).
|
|
331
|
-
*
|
|
332
|
-
* This is registered as a widget override with key 'backgroundGradient'.
|
|
333
|
-
*/
|
|
334
|
-
function BackgroundGradientField({ path, backend, config }) {
|
|
335
|
-
const { value, error, setValue } = useField(path, backend);
|
|
336
|
-
const { tokens } = usePalette();
|
|
337
|
-
const currentConfig = findPresetFromCss(value ?? null, tokens);
|
|
338
|
-
const handleChange = (gradientConfig) => {
|
|
339
|
-
setValue(gradientToCss(gradientConfig, tokens));
|
|
340
|
-
};
|
|
341
|
-
return /* @__PURE__ */ jsx(BackgroundGradientWidget, {
|
|
342
|
-
label: config.label || "Gradient",
|
|
343
|
-
value: currentConfig,
|
|
344
|
-
onChange: handleChange,
|
|
345
|
-
description: config.description,
|
|
346
|
-
error: error?.message,
|
|
347
|
-
dataPath: path
|
|
348
|
-
});
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Attempts to find a preset that matches the given CSS gradient string.
|
|
352
|
-
*
|
|
353
|
-
* This is a best-effort reverse lookup - if the CSS was generated from a preset,
|
|
354
|
-
* we can find and highlight that preset. If it's custom CSS, we return null
|
|
355
|
-
* and the widget shows no selection.
|
|
356
|
-
*/
|
|
357
|
-
function findPresetFromCss(css, tokens) {
|
|
358
|
-
if (!css) return null;
|
|
359
|
-
for (const preset of GRADIENT_PRESETS) {
|
|
360
|
-
const presetConfig = gradientConfigFromPreset(preset);
|
|
361
|
-
if (gradientToCss(presetConfig, tokens) === css) return presetConfig;
|
|
362
|
-
}
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
//#endregion
|
|
366
|
-
//#region ../editor-blocks/src/widgets/entry-picker/loaders.ts
|
|
367
|
-
function getStatusBadgeVariant(status) {
|
|
368
|
-
switch (status) {
|
|
369
|
-
case "published": return "default";
|
|
370
|
-
case "draft": return "secondary";
|
|
371
|
-
case "scheduled": return "outline";
|
|
372
|
-
case "archived": return "destructive";
|
|
373
|
-
default: return "secondary";
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
function mapEntryPickerItems(entries, valueFrom) {
|
|
377
|
-
return entries.map((entry) => ({
|
|
378
|
-
value: valueFrom === "identifier" ? entry.identifier ?? entry.id : valueFrom === "slug" ? entry.slug ?? entry.id : entry.id,
|
|
379
|
-
label: entry.draftTitle || entry.title || entry.slug || entry.id,
|
|
380
|
-
id: entry.id,
|
|
381
|
-
identifier: entry.identifier ?? null,
|
|
382
|
-
slug: entry.slug ?? null,
|
|
383
|
-
badge: {
|
|
384
|
-
label: entry.status,
|
|
385
|
-
variant: getStatusBadgeVariant(entry.status)
|
|
386
|
-
}
|
|
387
|
-
}));
|
|
388
|
-
}
|
|
389
|
-
async function loadEntryPickerItems({ apiClient, siteId, contentType, valueFrom }) {
|
|
390
|
-
const { entries } = unwrapResponse(await apiClient({
|
|
391
|
-
endpoint: "listContentEntries",
|
|
392
|
-
params: {
|
|
393
|
-
siteId,
|
|
394
|
-
type: contentType
|
|
395
|
-
}
|
|
396
|
-
}));
|
|
397
|
-
return mapEntryPickerItems(entries, valueFrom);
|
|
398
|
-
}
|
|
399
|
-
//#endregion
|
|
400
|
-
//#region ../editor-blocks/src/widgets/link/loaders.ts
|
|
401
|
-
async function loadRoutableContentItems({ apiClient, siteId }) {
|
|
402
|
-
const payload = unwrapResponse(await apiClient({
|
|
403
|
-
endpoint: "getRoutableContent",
|
|
404
|
-
params: { siteId }
|
|
405
|
-
}));
|
|
406
|
-
if (!Array.isArray(payload?.items)) throw new Error("Invalid routable content response");
|
|
407
|
-
return payload.items;
|
|
408
|
-
}
|
|
409
|
-
//#endregion
|
|
410
|
-
//#region ../editor-blocks/src/widgets/reference/dynamicAdapters.ts
|
|
411
|
-
/**
|
|
412
|
-
* Adds dynamic `content:${contentTypeKey}` adapter resolution to a static
|
|
413
|
-
* reference adapter map while keeping symbol property lookups inert for
|
|
414
|
-
* framework/devtool probes.
|
|
415
|
-
*/
|
|
416
|
-
function createDynamicReferenceAdapters(staticAdapters, createDynamicContentAdapter) {
|
|
417
|
-
return new Proxy(staticAdapters, { get(target, prop) {
|
|
418
|
-
if (typeof prop !== "string") return;
|
|
419
|
-
if (prop in target) return target[prop];
|
|
420
|
-
const parsed = parseReferenceKind(prop);
|
|
421
|
-
if (parsed.kind === "dynamicContent") return createDynamicContentAdapter(parsed.contentTypeKey);
|
|
422
|
-
} });
|
|
423
|
-
}
|
|
424
|
-
//#endregion
|
|
425
|
-
//#region ../editor-blocks/src/widgets/reference/loaders.ts
|
|
426
|
-
/**
|
|
427
|
-
* Reference Widget Loaders
|
|
428
|
-
*
|
|
429
|
-
* Canonical, environment-agnostic data fetchers for each built-in reference kind.
|
|
430
|
-
* Both the dashboard reference adapter map (`apps/dashboard/src/lib/block-form/referenceAdapters.tsx`)
|
|
431
|
-
* and the preview-next reference adapter map (`packages/preview-next/src/client/widgets/widgetAdapters.ts`)
|
|
432
|
-
* compose these loaders with their own labels, manage-links, caching, and error wrapping.
|
|
433
|
-
*
|
|
434
|
-
* Adding a new `BUILT_IN_REFERENCE_KIND` requires adding a loader here and an entry in
|
|
435
|
-
* `referenceLoaders`. Both gates are enforced by TypeScript and a runtime parity test.
|
|
436
|
-
*
|
|
437
|
-
* Each loader takes the request shape `{ apiClient, siteId }` and returns a
|
|
438
|
-
* `ReferenceWidgetItem[]` ready for the picker UI. Loaders throw raw errors —
|
|
439
|
-
* environment-specific error wrapping (e.g. `toUserFacingError`) happens at the
|
|
440
|
-
* composition layer.
|
|
441
|
-
*/
|
|
442
|
-
function defineReferenceLoader(referenceKind, loader) {
|
|
443
|
-
return Object.assign(loader, { referenceKind });
|
|
444
|
-
}
|
|
445
|
-
function formatStatusBadge(status) {
|
|
446
|
-
if (status === "published") return {
|
|
447
|
-
label: "Published",
|
|
448
|
-
variant: "default"
|
|
449
|
-
};
|
|
450
|
-
if (status === "scheduled") return {
|
|
451
|
-
label: "Scheduled",
|
|
452
|
-
variant: "secondary"
|
|
453
|
-
};
|
|
454
|
-
if (status === "archived") return {
|
|
455
|
-
label: "Archived",
|
|
456
|
-
variant: "outline"
|
|
457
|
-
};
|
|
458
|
-
return {
|
|
459
|
-
label: "Draft",
|
|
460
|
-
variant: "outline"
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function hasSlug(entry) {
|
|
464
|
-
return entry.slug !== null;
|
|
465
|
-
}
|
|
466
|
-
const loadPostReferenceItems = defineReferenceLoader("post", async ({ apiClient, siteId }) => {
|
|
467
|
-
const { entries } = unwrapResponse(await apiClient({
|
|
468
|
-
endpoint: "listContentEntries",
|
|
469
|
-
params: {
|
|
470
|
-
siteId,
|
|
471
|
-
type: "post"
|
|
472
|
-
}
|
|
473
|
-
}));
|
|
474
|
-
return entries.filter(hasSlug).filter((entry) => entry.status === "published").map((entry) => ({
|
|
475
|
-
value: entry.slug,
|
|
476
|
-
label: entry.title || entry.slug || entry.id,
|
|
477
|
-
badge: formatStatusBadge(entry.status)
|
|
478
|
-
}));
|
|
479
|
-
});
|
|
480
|
-
const loadFormReferenceItems = defineReferenceLoader("form", async ({ apiClient, siteId }) => {
|
|
481
|
-
const { forms } = unwrapResponse(await apiClient({
|
|
482
|
-
endpoint: "listForms",
|
|
483
|
-
params: { siteId }
|
|
484
|
-
}));
|
|
485
|
-
return forms.map((form) => ({
|
|
486
|
-
value: form.slug,
|
|
487
|
-
label: form.name
|
|
488
|
-
}));
|
|
489
|
-
});
|
|
490
|
-
const loadBookingFormReferenceItems = defineReferenceLoader("bookingForm", async ({ apiClient, siteId }) => {
|
|
491
|
-
const { forms } = unwrapResponse(await apiClient({
|
|
492
|
-
endpoint: "listBookingForms",
|
|
493
|
-
params: { siteId }
|
|
494
|
-
}));
|
|
495
|
-
return forms.map((form) => ({
|
|
496
|
-
value: form.id,
|
|
497
|
-
label: form.name
|
|
498
|
-
}));
|
|
499
|
-
});
|
|
500
|
-
const loadAppointmentServiceReferenceItems = defineReferenceLoader("appointmentService", async ({ apiClient, siteId }) => {
|
|
501
|
-
const { options } = unwrapResponse(await apiClient({
|
|
502
|
-
endpoint: "getAppointmentServicesReference",
|
|
503
|
-
params: { siteId }
|
|
504
|
-
}));
|
|
505
|
-
return options.map((option) => ({
|
|
506
|
-
value: option.id,
|
|
507
|
-
label: option.label
|
|
508
|
-
}));
|
|
509
|
-
});
|
|
510
|
-
const loadAppointmentResourceReferenceItems = defineReferenceLoader("appointmentResource", async ({ apiClient, siteId }) => {
|
|
511
|
-
const { options } = unwrapResponse(await apiClient({
|
|
512
|
-
endpoint: "getAppointmentResourcesReference",
|
|
513
|
-
params: { siteId }
|
|
514
|
-
}));
|
|
515
|
-
return options.map((option) => ({
|
|
516
|
-
value: option.id,
|
|
517
|
-
label: option.label
|
|
518
|
-
}));
|
|
519
|
-
});
|
|
520
|
-
const loadPageReferenceItems = defineReferenceLoader("page", async ({ apiClient, siteId }) => {
|
|
521
|
-
const { items } = unwrapResponse(await apiClient({
|
|
522
|
-
endpoint: "getRoutableContent",
|
|
523
|
-
params: { siteId }
|
|
524
|
-
}));
|
|
525
|
-
return items.filter((item) => item.entityType === "page").map((page) => ({
|
|
526
|
-
value: page.entityId,
|
|
527
|
-
label: page.title || "Untitled"
|
|
528
|
-
}));
|
|
529
|
-
});
|
|
530
|
-
const loadNewsletterListReferenceItems = defineReferenceLoader("newsletterList", async ({ apiClient, siteId }) => {
|
|
531
|
-
const { lists } = unwrapResponse(await apiClient({
|
|
532
|
-
endpoint: "listNewsletterLists",
|
|
533
|
-
params: { siteId }
|
|
534
|
-
}));
|
|
535
|
-
return lists.map((list) => ({
|
|
536
|
-
value: list.id,
|
|
537
|
-
label: list.name
|
|
538
|
-
}));
|
|
539
|
-
});
|
|
540
|
-
const loadMailchimpAudienceReferenceItems = defineReferenceLoader("mailchimpAudience", async ({ apiClient, siteId }) => {
|
|
541
|
-
const response = unwrapResponse(await apiClient({
|
|
542
|
-
endpoint: "listMailchimpAudiences",
|
|
543
|
-
params: { siteId }
|
|
544
|
-
}));
|
|
545
|
-
switch (response.tag) {
|
|
546
|
-
case "not_connected":
|
|
547
|
-
case "needs_reauth": return [];
|
|
548
|
-
case "connected": return response.audiences.map((audience) => ({
|
|
549
|
-
value: audience.id,
|
|
550
|
-
label: audience.name,
|
|
551
|
-
subtitle: audience.memberCount === null ? void 0 : `${audience.memberCount.toLocaleString()} contacts`,
|
|
552
|
-
badge: audience.compatibilityIssues.length > 0 ? {
|
|
553
|
-
label: "Needs review",
|
|
554
|
-
variant: "outline"
|
|
555
|
-
} : void 0
|
|
556
|
-
}));
|
|
557
|
-
default: return assertNever(response);
|
|
558
|
-
}
|
|
559
|
-
});
|
|
560
|
-
async function loadDynamicContentReferenceItems({ apiClient, siteId, contentTypeKey }) {
|
|
561
|
-
const { entries } = unwrapResponse(await apiClient({
|
|
562
|
-
endpoint: "listContentEntries",
|
|
563
|
-
params: {
|
|
564
|
-
siteId,
|
|
565
|
-
type: contentTypeKey
|
|
566
|
-
}
|
|
567
|
-
}));
|
|
568
|
-
return entries.filter((entry) => entry.status === "published").map((entry) => ({
|
|
569
|
-
value: entry.id,
|
|
570
|
-
label: entry.title || entry.slug || entry.id,
|
|
571
|
-
badge: {
|
|
572
|
-
label: "Published",
|
|
573
|
-
variant: "default"
|
|
574
|
-
}
|
|
575
|
-
}));
|
|
576
|
-
}
|
|
577
|
-
/**
|
|
578
|
-
* Typed map keyed by `BuiltInReferenceKind`. Adding a new built-in kind fails to
|
|
579
|
-
* compile here. The `satisfies` form preserves the literal's inferred shape while
|
|
580
|
-
* still enforcing that every `BuiltInReferenceKind` has a loader and that no
|
|
581
|
-
* extraneous keys are present. The parity test in `loaders.test.ts` is the
|
|
582
|
-
* defense-in-depth against someone widening this annotation to `Record<string, …>`.
|
|
583
|
-
*/
|
|
584
|
-
const referenceLoaders = {
|
|
585
|
-
post: loadPostReferenceItems,
|
|
586
|
-
form: loadFormReferenceItems,
|
|
587
|
-
bookingForm: loadBookingFormReferenceItems,
|
|
588
|
-
appointmentService: loadAppointmentServiceReferenceItems,
|
|
589
|
-
appointmentResource: loadAppointmentResourceReferenceItems,
|
|
590
|
-
page: loadPageReferenceItems,
|
|
591
|
-
newsletterList: loadNewsletterListReferenceItems,
|
|
592
|
-
mailchimpAudience: loadMailchimpAudienceReferenceItems
|
|
593
|
-
};
|
|
594
|
-
//#endregion
|
|
595
|
-
//#region ../preview-next/src/client/widgets/widgetAdapters.ts
|
|
596
|
-
const entryPickerCache = /* @__PURE__ */ new Map();
|
|
597
|
-
const siteOptionItemsCache = /* @__PURE__ */ new Map();
|
|
598
|
-
/**
|
|
599
|
-
* Single module-level cache for every built-in reference kind, keyed by
|
|
600
|
-
* `${kind}:${siteId}`. Module-level (not factory-scoped) so repeated calls to
|
|
601
|
-
* `createPreviewReferenceAdapters` (StrictMode double-invoke, site switching via
|
|
602
|
-
* `useMemo`) don't leak per-call Map instances.
|
|
603
|
-
*/
|
|
604
|
-
const referenceItemsCache = /* @__PURE__ */ new Map();
|
|
605
|
-
const dynamicReferenceItemsCache = /* @__PURE__ */ new Map();
|
|
606
|
-
const MAX_CACHE_ENTRIES = 50;
|
|
607
|
-
function setBoundedCache(map, key, value) {
|
|
608
|
-
if (!map.has(key) && map.size >= MAX_CACHE_ENTRIES) {
|
|
609
|
-
const firstKey = map.keys().next().value;
|
|
610
|
-
if (firstKey !== void 0) map.delete(firstKey);
|
|
611
|
-
}
|
|
612
|
-
map.set(key, value);
|
|
613
|
-
}
|
|
614
|
-
function createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, fallbackSiteId) {
|
|
615
|
-
return {
|
|
616
|
-
labels: {
|
|
617
|
-
loading: "Loading entries…",
|
|
618
|
-
select: "Select an entry",
|
|
619
|
-
empty: "No entries found",
|
|
620
|
-
emptySelection: "Select an entry to continue."
|
|
621
|
-
},
|
|
622
|
-
loadItems: async ({ siteId }) => {
|
|
623
|
-
const resolvedSiteId = siteId || fallbackSiteId;
|
|
624
|
-
if (!resolvedSiteId) return [];
|
|
625
|
-
const cacheKey = `${resolvedSiteId}:content:${contentTypeKey}`;
|
|
626
|
-
const cached = dynamicReferenceItemsCache.get(cacheKey);
|
|
627
|
-
if (cached) return cached;
|
|
628
|
-
const promise = (async () => {
|
|
629
|
-
try {
|
|
630
|
-
return await loadDynamicContentReferenceItems({
|
|
631
|
-
apiClient: previewClient,
|
|
632
|
-
siteId: resolvedSiteId,
|
|
633
|
-
contentTypeKey
|
|
634
|
-
});
|
|
635
|
-
} catch (error) {
|
|
636
|
-
dynamicReferenceItemsCache.delete(cacheKey);
|
|
637
|
-
throw error;
|
|
638
|
-
}
|
|
639
|
-
})();
|
|
640
|
-
setBoundedCache(dynamicReferenceItemsCache, cacheKey, promise);
|
|
641
|
-
return promise;
|
|
642
|
-
}
|
|
643
|
-
};
|
|
644
|
-
}
|
|
645
|
-
/**
|
|
646
|
-
* Wraps a shared reference loader in a module-level cache keyed by
|
|
647
|
-
* `${kind}:${siteId}`. Rejected promises are evicted so a transient failure
|
|
648
|
-
* doesn't poison subsequent calls.
|
|
649
|
-
*/
|
|
650
|
-
function createCachedReferenceAdapterLoader(kind, loader, previewClient, fallbackSiteId) {
|
|
651
|
-
return async ({ siteId }) => {
|
|
652
|
-
const resolvedSiteId = siteId || fallbackSiteId;
|
|
653
|
-
if (!resolvedSiteId) return [];
|
|
654
|
-
const cacheKey = `${kind}:${resolvedSiteId}`;
|
|
655
|
-
const cached = referenceItemsCache.get(cacheKey);
|
|
656
|
-
if (cached) return cached;
|
|
657
|
-
const promise = (async () => {
|
|
658
|
-
try {
|
|
659
|
-
return await loader({
|
|
660
|
-
apiClient: previewClient,
|
|
661
|
-
siteId: resolvedSiteId
|
|
662
|
-
});
|
|
663
|
-
} catch (error) {
|
|
664
|
-
referenceItemsCache.delete(cacheKey);
|
|
665
|
-
throw error;
|
|
666
|
-
}
|
|
667
|
-
})();
|
|
668
|
-
setBoundedCache(referenceItemsCache, cacheKey, promise);
|
|
669
|
-
return promise;
|
|
670
|
-
};
|
|
671
|
-
}
|
|
672
|
-
function createPreviewLinkAdapters(previewClient) {
|
|
673
|
-
return { fetchRoutableContent: (siteId) => loadRoutableContentItems({
|
|
674
|
-
apiClient: previewClient,
|
|
675
|
-
siteId
|
|
676
|
-
}) };
|
|
677
|
-
}
|
|
678
|
-
function createPreviewEntryPickerAdapter(previewClient) {
|
|
679
|
-
return {
|
|
680
|
-
loadItems: async ({ siteId, contentType, valueFrom }) => {
|
|
681
|
-
if (!siteId || !contentType) return [];
|
|
682
|
-
const cacheKey = `${siteId}:${contentType}:${valueFrom ?? "id"}`;
|
|
683
|
-
const cached = entryPickerCache.get(cacheKey);
|
|
684
|
-
if (cached) return cached;
|
|
685
|
-
const request = (async () => {
|
|
686
|
-
try {
|
|
687
|
-
return await loadEntryPickerItems({
|
|
688
|
-
apiClient: previewClient,
|
|
689
|
-
siteId,
|
|
690
|
-
contentType,
|
|
691
|
-
valueFrom
|
|
692
|
-
});
|
|
693
|
-
} catch (error) {
|
|
694
|
-
entryPickerCache.delete(cacheKey);
|
|
695
|
-
throw error;
|
|
696
|
-
}
|
|
697
|
-
})();
|
|
698
|
-
setBoundedCache(entryPickerCache, cacheKey, request);
|
|
699
|
-
return request;
|
|
700
|
-
},
|
|
701
|
-
labels: {
|
|
702
|
-
loading: "Loading entries...",
|
|
703
|
-
select: "Select an entry",
|
|
704
|
-
empty: "No entries found",
|
|
705
|
-
emptySelection: "Select an entry to embed.",
|
|
706
|
-
noContentType: "Select a content type first."
|
|
707
|
-
}
|
|
708
|
-
};
|
|
709
|
-
}
|
|
710
|
-
function createCachedSiteOptionLoader(loadItems) {
|
|
711
|
-
return async ({ siteId, source }) => {
|
|
712
|
-
const cacheKey = `${source}:${siteId}`;
|
|
713
|
-
const cached = siteOptionItemsCache.get(cacheKey);
|
|
714
|
-
if (cached) return cached;
|
|
715
|
-
const promise = (async () => {
|
|
716
|
-
try {
|
|
717
|
-
return await loadItems({
|
|
718
|
-
siteId,
|
|
719
|
-
source
|
|
720
|
-
});
|
|
721
|
-
} catch (error) {
|
|
722
|
-
siteOptionItemsCache.delete(cacheKey);
|
|
723
|
-
throw error;
|
|
724
|
-
}
|
|
725
|
-
})();
|
|
726
|
-
setBoundedCache(siteOptionItemsCache, cacheKey, promise);
|
|
727
|
-
return promise;
|
|
728
|
-
};
|
|
729
|
-
}
|
|
730
|
-
function createPreviewSiteOptionAdapters(previewClient) {
|
|
731
|
-
return createSiteOptionWidgetAdapters({ loadItems: createCachedSiteOptionLoader(createSiteOptionApiLoader(previewClient)) });
|
|
732
|
-
}
|
|
733
|
-
/**
|
|
734
|
-
* Per-kind UI chrome for preview reference adapters. The `Record<BuiltInReferenceKind, …>`
|
|
735
|
-
* type enforces parity with `BUILT_IN_REFERENCE_KINDS` at compile time — adding a new
|
|
736
|
-
* kind fails to compile here until chrome is provided.
|
|
737
|
-
*/
|
|
738
|
-
const previewReferenceChrome = {
|
|
739
|
-
post: { labels: {
|
|
740
|
-
loading: "Loading posts…",
|
|
741
|
-
select: "Select a post",
|
|
742
|
-
empty: "No posts found",
|
|
743
|
-
emptySelection: "Select a post to continue."
|
|
744
|
-
} },
|
|
745
|
-
form: { labels: {
|
|
746
|
-
loading: "Loading forms…",
|
|
747
|
-
select: "Select a form",
|
|
748
|
-
empty: "No forms found",
|
|
749
|
-
emptySelection: "Select a form to continue."
|
|
750
|
-
} },
|
|
751
|
-
bookingForm: { labels: {
|
|
752
|
-
loading: "Loading booking forms…",
|
|
753
|
-
select: "Select a booking form",
|
|
754
|
-
empty: "No booking forms yet",
|
|
755
|
-
emptySelection: "Select a booking form to enable appointment booking."
|
|
756
|
-
} },
|
|
757
|
-
appointmentService: { labels: {
|
|
758
|
-
loading: "Loading appointment services…",
|
|
759
|
-
select: "Select a service",
|
|
760
|
-
empty: "No services available",
|
|
761
|
-
emptySelection: "Select a service to enable booking."
|
|
762
|
-
} },
|
|
763
|
-
appointmentResource: { labels: {
|
|
764
|
-
loading: "Loading resources…",
|
|
765
|
-
select: "Select a resource",
|
|
766
|
-
empty: "No resources available",
|
|
767
|
-
emptySelection: "Select a resource (optional)."
|
|
768
|
-
} },
|
|
769
|
-
page: { labels: {
|
|
770
|
-
loading: "Loading pages…",
|
|
771
|
-
select: "Select a page",
|
|
772
|
-
empty: "No pages available",
|
|
773
|
-
emptySelection: "Select a page."
|
|
774
|
-
} },
|
|
775
|
-
newsletterList: { labels: {
|
|
776
|
-
loading: "Loading lists…",
|
|
777
|
-
select: "Select a list",
|
|
778
|
-
empty: "No lists yet",
|
|
779
|
-
emptySelection: "Select a newsletter list to subscribe users to."
|
|
780
|
-
} },
|
|
781
|
-
mailchimpAudience: { labels: {
|
|
782
|
-
loading: "Loading Mailchimp audiences…",
|
|
783
|
-
select: "Select an audience",
|
|
784
|
-
empty: "Connect Mailchimp to choose an audience",
|
|
785
|
-
emptySelection: "Choose a Mailchimp audience once the site is connected."
|
|
786
|
-
} }
|
|
787
|
-
};
|
|
788
|
-
/**
|
|
789
|
-
* Builds the preview adapter record by iterating the canonical `referenceLoaders`
|
|
790
|
-
* map. The kind ↔ loader pairing is structurally impossible to mis-couple — each
|
|
791
|
-
* adapter is constructed by looking the loader up via the same `BuiltInReferenceKind`
|
|
792
|
-
* key used to index into the chrome map.
|
|
793
|
-
*/
|
|
794
|
-
function createPreviewReferenceAdapters(previewClient, fallbackSiteId) {
|
|
795
|
-
const brandedFallbackSiteId = fallbackSiteId ? expectParsedBrandedId(parseSiteId(fallbackSiteId)) : void 0;
|
|
796
|
-
const adapters = {};
|
|
797
|
-
for (const kind of BUILT_IN_REFERENCE_KINDS) adapters[kind] = {
|
|
798
|
-
loadItems: createCachedReferenceAdapterLoader(kind, referenceLoaders[kind], previewClient, brandedFallbackSiteId),
|
|
799
|
-
labels: previewReferenceChrome[kind].labels
|
|
800
|
-
};
|
|
801
|
-
return createDynamicReferenceAdapters(adapters, (contentTypeKey) => createCachedDynamicContentReferenceAdapter(contentTypeKey, previewClient, brandedFallbackSiteId));
|
|
802
|
-
}
|
|
803
|
-
//#endregion
|
|
804
|
-
//#region ../preview-next/src/client/widgets/widgetOverrides.tsx
|
|
805
|
-
function PreviewFormProviderInner({ theme, children }) {
|
|
806
|
-
const { onPickImage, picker } = useRichTextImagePicker();
|
|
807
|
-
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(RichTextWidgetProvider, {
|
|
808
|
-
theme,
|
|
809
|
-
onPickImage,
|
|
810
|
-
children
|
|
811
|
-
}), picker] });
|
|
812
|
-
}
|
|
813
|
-
/**
|
|
814
|
-
* Composes preview form widget providers beneath PreviewShell's media authority.
|
|
815
|
-
* Consumers rendering this directly must provide an ancestor MediaEditorProvider.
|
|
816
|
-
*/
|
|
817
|
-
function PreviewFormProvider({ siteId: rawSiteId, theme = null, previewClient, bookingOfferingPresets, sdkConfig, children }) {
|
|
818
|
-
const siteId = useMemo(() => expectParsedBrandedId(parseSiteId(rawSiteId)), [rawSiteId]);
|
|
819
|
-
const linkAdapters = useMemo(() => createPreviewLinkAdapters(previewClient), [previewClient]);
|
|
820
|
-
const entryPickerAdapter = useMemo(() => createPreviewEntryPickerAdapter(previewClient), [previewClient]);
|
|
821
|
-
const siteOptionAdapters = useMemo(() => createPreviewSiteOptionAdapters(previewClient), [previewClient]);
|
|
822
|
-
const referenceAdapters = useMemo(() => createPreviewReferenceAdapters(previewClient), [previewClient]);
|
|
823
|
-
const paletteTokens = useMemo(() => {
|
|
824
|
-
if (!theme) return void 0;
|
|
825
|
-
try {
|
|
826
|
-
return buildThemeRuntime(theme).paletteTokens;
|
|
827
|
-
} catch {
|
|
828
|
-
return;
|
|
829
|
-
}
|
|
830
|
-
}, [theme]);
|
|
831
|
-
return /* @__PURE__ */ jsx(SdkConfigProvider, {
|
|
832
|
-
sdkConfig: sdkConfig ?? null,
|
|
833
|
-
children: /* @__PURE__ */ jsx(PaletteProvider, {
|
|
834
|
-
tokens: paletteTokens,
|
|
835
|
-
children: /* @__PURE__ */ jsx(LinkWidgetProvider, {
|
|
836
|
-
siteId,
|
|
837
|
-
adapters: linkAdapters,
|
|
838
|
-
children: /* @__PURE__ */ jsx(ReferenceWidgetProvider, {
|
|
839
|
-
siteId,
|
|
840
|
-
adapters: referenceAdapters,
|
|
841
|
-
children: /* @__PURE__ */ jsx(EntryPickerWidgetProvider, {
|
|
842
|
-
siteId,
|
|
843
|
-
adapter: entryPickerAdapter,
|
|
844
|
-
children: /* @__PURE__ */ jsx(SiteOptionWidgetProvider, {
|
|
845
|
-
siteId,
|
|
846
|
-
adapters: siteOptionAdapters,
|
|
847
|
-
children: /* @__PURE__ */ jsx(MailingListTargetingProvider, {
|
|
848
|
-
siteId,
|
|
849
|
-
load: (targetSiteId) => loadMailingListAuthoringContext({
|
|
850
|
-
apiClient: previewClient,
|
|
851
|
-
siteId: targetSiteId
|
|
852
|
-
}),
|
|
853
|
-
children: /* @__PURE__ */ jsx(ButtonWidgetProvider, {
|
|
854
|
-
buttonSystem: theme?.buttons ?? null,
|
|
855
|
-
children: /* @__PURE__ */ jsx(OfferingsPreviewWidgetProvider, {
|
|
856
|
-
bookingOfferingPresets,
|
|
857
|
-
children: /* @__PURE__ */ jsx(PreviewFormProviderInner, {
|
|
858
|
-
theme,
|
|
859
|
-
children
|
|
860
|
-
})
|
|
861
|
-
})
|
|
862
|
-
})
|
|
863
|
-
})
|
|
864
|
-
})
|
|
865
|
-
})
|
|
866
|
-
})
|
|
867
|
-
})
|
|
868
|
-
})
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
const previewWidgetOverrides = {
|
|
872
|
-
link: LinkField,
|
|
873
|
-
file: FileField,
|
|
874
|
-
media: MediaField,
|
|
875
|
-
richText: RichTextField,
|
|
876
|
-
inlineText: InlineTextField,
|
|
877
|
-
reference: ReferenceField,
|
|
878
|
-
backgroundColor: BackgroundColorField,
|
|
879
|
-
backgroundGradient: BackgroundGradientField,
|
|
880
|
-
entryPicker: EntryPickerField,
|
|
881
|
-
iconPicker: IconPickerField,
|
|
882
|
-
buttonVariant: ButtonVariantField,
|
|
883
|
-
offeringGroupOrder: OfferingsPreviewGroupOrderField,
|
|
884
|
-
siteOptionPicker: SiteOptionPickerField,
|
|
885
|
-
mailingListTargeting: MailingListTargetingField
|
|
886
|
-
};
|
|
887
|
-
//#endregion
|
|
888
|
-
//#region ../preview-next/src/client/preview/PreviewBlockCustomizeSelectionContext.tsx
|
|
889
|
-
const PreviewBlockCustomizeSelectionContext = createContext(null);
|
|
890
|
-
function PreviewBlockCustomizeSelectionProvider({ children }) {
|
|
891
|
-
const uiStore = useEditorUiStoreInstance();
|
|
892
|
-
const previewInspection = useUISelector(uiStore, (state) => state.previewInspection);
|
|
893
|
-
const selection = useMemo(() => previewInspection.kind === "block-customize" ? {
|
|
894
|
-
kind: "selected",
|
|
895
|
-
blockId: previewInspection.blockId,
|
|
896
|
-
requestId: previewInspection.requestId
|
|
897
|
-
} : { kind: "none" }, [previewInspection]);
|
|
898
|
-
const inspectBlock = useCallback((blockId) => {
|
|
899
|
-
uiStore.getState().inspectBlock(blockId);
|
|
900
|
-
}, [uiStore]);
|
|
901
|
-
const clearInspection = useCallback(() => {
|
|
902
|
-
uiStore.getState().clearPreviewInspection();
|
|
903
|
-
}, [uiStore]);
|
|
904
|
-
const [selectedBlockId, setSelectedBlockId] = useState(null);
|
|
905
|
-
const value = useMemo(() => ({
|
|
906
|
-
selection,
|
|
907
|
-
inspectBlock,
|
|
908
|
-
clearInspection,
|
|
909
|
-
selectedBlockId,
|
|
910
|
-
selectBlock: setSelectedBlockId
|
|
911
|
-
}), [
|
|
912
|
-
clearInspection,
|
|
913
|
-
inspectBlock,
|
|
914
|
-
selectedBlockId,
|
|
915
|
-
selection
|
|
916
|
-
]);
|
|
917
|
-
return /* @__PURE__ */ jsx(PreviewBlockCustomizeSelectionContext.Provider, {
|
|
918
|
-
value,
|
|
919
|
-
children
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
function usePreviewBlockCustomizeSelectionOptional() {
|
|
923
|
-
return useContext(PreviewBlockCustomizeSelectionContext);
|
|
924
|
-
}
|
|
925
|
-
//#endregion
|
|
926
|
-
//#region ../preview-next/src/client/blocks/previewCustomizeControlPlan.ts
|
|
927
|
-
const ABSOLUTE_MAX_QUICK_FIELDS = 3;
|
|
928
|
-
function createPreviewCustomizeControlPlan({ fields, content, visibilityValues = null, quickFieldPriority = [], maxQuickFields = ABSOLUTE_MAX_QUICK_FIELDS }) {
|
|
929
|
-
const valueReader = createVisibilityValueReader(content, visibilityValues);
|
|
930
|
-
const quickPriorityIndex = new Map(quickFieldPriority.map((fieldId, index) => [fieldId, index]));
|
|
931
|
-
const maxQuick = Math.max(0, Math.min(ABSOLUTE_MAX_QUICK_FIELDS, maxQuickFields));
|
|
932
|
-
const visibleControls = [];
|
|
933
|
-
const hiddenControls = [];
|
|
934
|
-
for (const field of fields) {
|
|
935
|
-
if (isThemeV2NormalEditorRawStyleFieldName(field.id)) {
|
|
936
|
-
hiddenControls.push({
|
|
937
|
-
fieldId: field.id,
|
|
938
|
-
reason: "theme-v2-raw-style-field"
|
|
939
|
-
});
|
|
940
|
-
continue;
|
|
941
|
-
}
|
|
942
|
-
if (isHeaderField(field)) {
|
|
943
|
-
hiddenControls.push({
|
|
944
|
-
fieldId: field.id,
|
|
945
|
-
reason: "header-field"
|
|
946
|
-
});
|
|
947
|
-
continue;
|
|
948
|
-
}
|
|
949
|
-
const intent = getFieldIntent(field);
|
|
950
|
-
if (intent !== "display" && intent !== "behavior") {
|
|
951
|
-
hiddenControls.push({
|
|
952
|
-
fieldId: field.id,
|
|
953
|
-
reason: "unsupported-intent"
|
|
954
|
-
});
|
|
955
|
-
continue;
|
|
956
|
-
}
|
|
957
|
-
if (!evaluateVisibility(field, valueReader, field.id)) {
|
|
958
|
-
hiddenControls.push({
|
|
959
|
-
fieldId: field.id,
|
|
960
|
-
reason: "not-visible"
|
|
961
|
-
});
|
|
962
|
-
continue;
|
|
963
|
-
}
|
|
964
|
-
visibleControls.push({
|
|
965
|
-
kind: "manifest-field",
|
|
966
|
-
field: fieldWithDecidedVisibility(field),
|
|
967
|
-
placement: "panel",
|
|
968
|
-
intent
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
const quickFieldIds = new Set(visibleControls.filter((control) => quickPriorityIndex.has(control.field.id)).sort((left, right) => (quickPriorityIndex.get(left.field.id) ?? Number.MAX_SAFE_INTEGER) - (quickPriorityIndex.get(right.field.id) ?? Number.MAX_SAFE_INTEGER)).slice(0, maxQuick).map((control) => control.field.id));
|
|
972
|
-
return {
|
|
973
|
-
quickControls: visibleControls.filter((control) => quickFieldIds.has(control.field.id)).map((control) => ({
|
|
974
|
-
...control,
|
|
975
|
-
placement: "quick"
|
|
976
|
-
})),
|
|
977
|
-
panelControls: visibleControls.filter((control) => !quickFieldIds.has(control.field.id)),
|
|
978
|
-
hiddenControls
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
/** Top-level visibility is already decided; forms must not reread raw values. */
|
|
982
|
-
function fieldWithDecidedVisibility(field) {
|
|
983
|
-
if (!field.ui || !("visibleWhen" in field.ui)) return field;
|
|
984
|
-
const { visibleWhen: _visibleWhen, ...ui } = field.ui;
|
|
985
|
-
return {
|
|
986
|
-
...field,
|
|
987
|
-
ui
|
|
988
|
-
};
|
|
989
|
-
}
|
|
990
|
-
function createVisibilityValueReader(content, appearance) {
|
|
991
|
-
return { getValue: (path) => appearance && path === "blockLook" ? appearance.lookId : appearance && path === appearance.arrangementField ? appearance.arrangement : getValueAtPath(content, path) };
|
|
992
|
-
}
|
|
993
|
-
function getValueAtPath(source, path) {
|
|
994
|
-
if (!path) return source;
|
|
995
|
-
let current = source;
|
|
996
|
-
for (const segment of path.split(".")) {
|
|
997
|
-
if (!current || typeof current !== "object") return;
|
|
998
|
-
current = current[segment];
|
|
999
|
-
}
|
|
1000
|
-
return current;
|
|
1001
|
-
}
|
|
1002
|
-
function useBlockCustomizeControls({ blockId, blockKind, content, uiStore, theme, sdkConfig, maxQuickFields = 3, maxPopoverRows, builtInPopoverRows = 0 }) {
|
|
1003
|
-
const { blockFieldOptions, blockFieldExtensions, sdkConfig: contextSdkConfig } = useSdkConfig();
|
|
1004
|
-
const effectiveSdkConfig = sdkConfig ?? contextSdkConfig;
|
|
1005
|
-
const manifest = useMemo(() => resolveBlockManifest(blockKind, effectiveSdkConfig ?? null), [blockKind, effectiveSdkConfig]);
|
|
1006
|
-
const preparedManifest = useMemo(() => {
|
|
1007
|
-
if (!manifest) return null;
|
|
1008
|
-
return prepareBlockEditorManifest({
|
|
1009
|
-
manifest,
|
|
1010
|
-
blockKind,
|
|
1011
|
-
theme,
|
|
1012
|
-
blockFieldOptions,
|
|
1013
|
-
blockFieldExtensions,
|
|
1014
|
-
visibilityPolicy: hideThemeV2RawStyleFields
|
|
1015
|
-
});
|
|
1016
|
-
}, [
|
|
1017
|
-
blockFieldExtensions,
|
|
1018
|
-
blockFieldOptions,
|
|
1019
|
-
blockKind,
|
|
1020
|
-
manifest,
|
|
1021
|
-
theme
|
|
1022
|
-
]);
|
|
1023
|
-
const { state: pageDesignState } = usePreviewPageDesignEditorState();
|
|
1024
|
-
const designBlock = useMemo(() => pageDesignState.kind === "loaded" ? pageDesignState.editorModel.blocks.find((block) => String(block.blockId) === String(blockId)) ?? null : null, [blockId, pageDesignState]);
|
|
1025
|
-
const ownedFieldIds = useMemo(() => arrangementOwnedFieldIds(designBlock), [designBlock]);
|
|
1026
|
-
const visibilityValues = useMemo(() => arrangementVisibilityValues(designBlock), [designBlock]);
|
|
1027
|
-
const fields = useMemo(() => {
|
|
1028
|
-
if (!preparedManifest) return [];
|
|
1029
|
-
return createManifestFormAdapter(preparedManifest.renderManifest).fields.filter((field) => !ownedFieldIds.includes(field.id));
|
|
1030
|
-
}, [ownedFieldIds, preparedManifest]);
|
|
1031
|
-
const preliminaryPlan = useMemo(() => createPreviewCustomizeControlPlan({
|
|
1032
|
-
fields,
|
|
1033
|
-
content,
|
|
1034
|
-
visibilityValues,
|
|
1035
|
-
quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
|
|
1036
|
-
maxQuickFields
|
|
1037
|
-
}), [
|
|
1038
|
-
content,
|
|
1039
|
-
visibilityValues,
|
|
1040
|
-
fields,
|
|
1041
|
-
manifest?.previewCustomize?.quickFieldPriority,
|
|
1042
|
-
maxQuickFields
|
|
1043
|
-
]);
|
|
1044
|
-
const budgetedMaxQuickFields = resolveQuickFieldBudget({
|
|
1045
|
-
requestedMaxQuickFields: maxQuickFields,
|
|
1046
|
-
maxPopoverRows,
|
|
1047
|
-
builtInPopoverRows,
|
|
1048
|
-
hasOverflowControls: preliminaryPlan.panelControls.length > 0
|
|
1049
|
-
});
|
|
1050
|
-
const controlPlan = useMemo(() => {
|
|
1051
|
-
if (budgetedMaxQuickFields === maxQuickFields) return preliminaryPlan;
|
|
1052
|
-
return createPreviewCustomizeControlPlan({
|
|
1053
|
-
fields,
|
|
1054
|
-
content,
|
|
1055
|
-
visibilityValues,
|
|
1056
|
-
quickFieldPriority: manifest?.previewCustomize?.quickFieldPriority,
|
|
1057
|
-
maxQuickFields: budgetedMaxQuickFields
|
|
1058
|
-
});
|
|
1059
|
-
}, [
|
|
1060
|
-
budgetedMaxQuickFields,
|
|
1061
|
-
content,
|
|
1062
|
-
fields,
|
|
1063
|
-
manifest?.previewCustomize?.quickFieldPriority,
|
|
1064
|
-
maxQuickFields,
|
|
1065
|
-
preliminaryPlan,
|
|
1066
|
-
visibilityValues
|
|
1067
|
-
]);
|
|
1068
|
-
const quickFields = useMemo(() => controlPlan.quickControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.quickControls]);
|
|
1069
|
-
const panelFields = useMemo(() => controlPlan.panelControls.map((control) => stripTopLevelRoutingUi(control.field)), [controlPlan.panelControls]);
|
|
1070
|
-
return {
|
|
1071
|
-
manifest,
|
|
1072
|
-
controlPlan,
|
|
1073
|
-
quickFields,
|
|
1074
|
-
panelFields,
|
|
1075
|
-
backend: useMemo(() => {
|
|
1076
|
-
if (!preparedManifest) return null;
|
|
1077
|
-
return createStoreBackend({
|
|
1078
|
-
scope: "blocks",
|
|
1079
|
-
store: uiStore,
|
|
1080
|
-
blockId
|
|
1081
|
-
});
|
|
1082
|
-
}, [
|
|
1083
|
-
blockId,
|
|
1084
|
-
preparedManifest,
|
|
1085
|
-
uiStore
|
|
1086
|
-
]),
|
|
1087
|
-
hasControls: quickFields.length > 0 || panelFields.length > 0,
|
|
1088
|
-
hasOverflowControls: panelFields.length > 0
|
|
1089
|
-
};
|
|
1090
|
-
}
|
|
1091
|
-
function resolveQuickFieldBudget({ requestedMaxQuickFields, maxPopoverRows, builtInPopoverRows, hasOverflowControls }) {
|
|
1092
|
-
const cappedRequested = Math.max(0, Math.min(3, requestedMaxQuickFields));
|
|
1093
|
-
if (typeof maxPopoverRows !== "number") return cappedRequested;
|
|
1094
|
-
const customizeRowCount = hasOverflowControls ? 1 : 0;
|
|
1095
|
-
const availableRows = maxPopoverRows - builtInPopoverRows - customizeRowCount;
|
|
1096
|
-
return Math.max(0, Math.min(cappedRequested, availableRows));
|
|
1097
|
-
}
|
|
1098
|
-
function resolveBlockManifest(blockKind, sdkConfig) {
|
|
1099
|
-
return getBlockManifestFromSdkConfig(blockKind, sdkConfig) ?? getBlockDefinition(blockKind)?.manifest ?? null;
|
|
1100
|
-
}
|
|
1101
|
-
//#endregion
|
|
1102
|
-
//#region ../preview-next/src/client/preview/PreviewSiteFontStorageContext.tsx
|
|
1103
|
-
const PreviewSiteFontStorageContext = createContext(void 0);
|
|
1104
|
-
function PreviewSiteFontStorageProvider({ siteFontStorageUrl, children }) {
|
|
1105
|
-
return /* @__PURE__ */ jsx(PreviewSiteFontStorageContext.Provider, {
|
|
1106
|
-
value: siteFontStorageUrl,
|
|
1107
|
-
children
|
|
1108
|
-
});
|
|
1109
|
-
}
|
|
1110
|
-
function usePreviewSiteFontStorageUrl() {
|
|
1111
|
-
return useContext(PreviewSiteFontStorageContext);
|
|
1112
|
-
}
|
|
1113
|
-
//#endregion
|
|
1114
|
-
//#region ../preview-next/src/client/preview/previewChromeSurfacePolicy.ts
|
|
1115
|
-
const PREVIEW_CHROME_SURFACE_POLICIES = {
|
|
1116
|
-
core: {
|
|
1117
|
-
banner: {
|
|
1118
|
-
tone: "default",
|
|
1119
|
-
bannerClassName: "border border-emerald-200/70 bg-white/95 shadow-xl backdrop-blur supports-[backdrop-filter]:bg-white/92",
|
|
1120
|
-
summaryClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2 text-xs text-slate-600",
|
|
1121
|
-
dialogItemClassName: "rounded-md border border-slate-200 bg-slate-50 px-3 py-2",
|
|
1122
|
-
titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
|
|
1123
|
-
descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1124
|
-
detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
|
|
1125
|
-
summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
|
|
1126
|
-
summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
|
|
1127
|
-
secondaryButtonClassName: "",
|
|
1128
|
-
primaryButtonClassName: "",
|
|
1129
|
-
dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1130
|
-
dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
|
|
1131
|
-
dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
|
|
1132
|
-
dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1133
|
-
ctaLabel: "Complete setup in dashboard",
|
|
1134
|
-
copyByState: {
|
|
1135
|
-
awaiting_confirmation: {
|
|
1136
|
-
title: "Your draft preview is ready",
|
|
1137
|
-
description: "Explore your site here, then confirm your email to unlock the dashboard and finish launch setup.",
|
|
1138
|
-
detail: "Once your email is confirmed, Complete setup in dashboard will take you straight to the remaining checklist.",
|
|
1139
|
-
checklistNote: "Email confirmation is the only blocker before dashboard access. The rest of the launch checklist lives in the dashboard."
|
|
1140
|
-
},
|
|
1141
|
-
dashboard_ready: {
|
|
1142
|
-
title: "Your dashboard is unlocked",
|
|
1143
|
-
description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
|
|
1144
|
-
detail: "The dashboard is the place to complete the remaining checklist and get your site ready to launch.",
|
|
1145
|
-
checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
|
|
1146
|
-
},
|
|
1147
|
-
dashboard_resume: {
|
|
1148
|
-
title: "Your draft site is ready",
|
|
1149
|
-
description: "Keep exploring here, then use Complete setup in dashboard to review your pages, add offerings, connect payments, and finish launch setup.",
|
|
1150
|
-
detail: "The dashboard is the normal place to finish setup for this site.",
|
|
1151
|
-
checklistNote: "The remaining launch steps are tracked in the same checklist you will see in the dashboard."
|
|
1152
|
-
}
|
|
1153
|
-
},
|
|
1154
|
-
dialog: {
|
|
1155
|
-
title: "What still happens in the dashboard",
|
|
1156
|
-
description: "Your preview is ready, but launch steps still happen in the dashboard so you can finish setup safely.",
|
|
1157
|
-
pendingIntro: "Your preview is live now, but the launch checklist stays in the dashboard so the final setup steps happen in the right place.",
|
|
1158
|
-
unlockedIntro: "Your preview is live now, and the same checklist will follow you into the dashboard when you are ready to finish setup.",
|
|
1159
|
-
outro: "You can keep exploring this preview now, then jump back into the dashboard when you're ready to finish setup."
|
|
1160
|
-
}
|
|
1161
|
-
},
|
|
1162
|
-
sidebar: {
|
|
1163
|
-
tone: "default",
|
|
1164
|
-
rootClassName: "bg-background",
|
|
1165
|
-
headerClassName: "border-b",
|
|
1166
|
-
guidance: {
|
|
1167
|
-
title: "Make quick edits in preview",
|
|
1168
|
-
description: "Use preview for copy and layout tweaks. Complete setup in dashboard to add offerings, connect payments, and finish the rest of your launch checklist.",
|
|
1169
|
-
ctaLabel: "Complete setup in dashboard",
|
|
1170
|
-
cardClassName: "rounded-lg border border-emerald-200/70 bg-emerald-50/70 px-3 py-3"
|
|
1171
|
-
}
|
|
1172
|
-
}
|
|
1173
|
-
},
|
|
1174
|
-
macadamia: {
|
|
1175
|
-
banner: {
|
|
1176
|
-
tone: "studio",
|
|
1177
|
-
bannerClassName: "border border-border bg-background shadow-xl",
|
|
1178
|
-
summaryClassName: "rounded-xl border border-border bg-surface px-3 py-2 text-xs text-foreground",
|
|
1179
|
-
dialogItemClassName: "rounded-xl border border-border bg-surface px-3 py-2",
|
|
1180
|
-
titleClassName: "text-sm font-semibold tracking-tight text-foreground [font-family:var(--font-heading)]",
|
|
1181
|
-
descriptionClassName: "text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1182
|
-
detailClassName: "text-xs text-muted-foreground [font-family:var(--font-body)]",
|
|
1183
|
-
summaryTitleClassName: "font-medium text-foreground [font-family:var(--font-body)]",
|
|
1184
|
-
summaryBodyClassName: "mt-1 text-muted-foreground [font-family:var(--font-body)]",
|
|
1185
|
-
secondaryButtonClassName: "border border-border bg-surface text-foreground hover:bg-button-outline-hover",
|
|
1186
|
-
primaryButtonClassName: "border border-primary bg-primary text-primary-foreground hover:bg-primary-hover",
|
|
1187
|
-
dialogBodyClassName: "space-y-3 text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1188
|
-
dialogItemTitleClassName: "font-medium text-foreground [font-family:var(--font-heading)]",
|
|
1189
|
-
dialogItemMetaClassName: "ml-2 text-xs font-normal uppercase tracking-wide text-muted-foreground [font-family:var(--font-body)]",
|
|
1190
|
-
dialogItemDescriptionClassName: "mt-1 text-sm text-muted-foreground [font-family:var(--font-body)]",
|
|
1191
|
-
ctaLabel: "Complete setup in Macadamia",
|
|
1192
|
-
copyByState: {
|
|
1193
|
-
awaiting_confirmation: {
|
|
1194
|
-
title: "Confirm your email to carry on",
|
|
1195
|
-
description: "We've created the bones of your site. To carry on finishing setup, and to edit your site, you need to confirm your email to activate your account.",
|
|
1196
|
-
detail: "",
|
|
1197
|
-
checklistNote: ""
|
|
1198
|
-
},
|
|
1199
|
-
dashboard_ready: {
|
|
1200
|
-
title: "Here's your site preview",
|
|
1201
|
-
description: "We've created the bones of your site. Have a look around. If you like, you can add your site content here, or you can go straight to your dashboard to complete your setup. You'll be able to edit your site at any time, so don't worry if it's not perfect right now.",
|
|
1202
|
-
detail: "",
|
|
1203
|
-
checklistNote: ""
|
|
1204
|
-
},
|
|
1205
|
-
dashboard_resume: {
|
|
1206
|
-
title: "Your studio site is ready",
|
|
1207
|
-
description: "Keep exploring here, then use Complete setup in Macadamia to review your pages, add offerings, connect payments, and finish launch setup.",
|
|
1208
|
-
detail: "Macadamia is the normal place to finish setup for this studio site.",
|
|
1209
|
-
checklistNote: "The remaining launch steps are tracked in the same checklist you will see in Macadamia."
|
|
1210
|
-
}
|
|
1211
|
-
},
|
|
1212
|
-
dialog: {
|
|
1213
|
-
title: "What still happens in Macadamia",
|
|
1214
|
-
description: "Your preview is ready, but launch steps still happen in Macadamia so you can finish setup safely.",
|
|
1215
|
-
pendingIntro: "Your studio preview is live now, but the launch checklist stays in Macadamia so the final setup steps happen in the right place.",
|
|
1216
|
-
unlockedIntro: "Your studio preview is live now, and the same checklist will follow you into Macadamia when you are ready to finish setup.",
|
|
1217
|
-
outro: "You can keep exploring this preview now, then jump back into Macadamia when you're ready to finish setup."
|
|
1218
|
-
}
|
|
1219
|
-
},
|
|
1220
|
-
sidebar: {
|
|
1221
|
-
tone: "studio",
|
|
1222
|
-
rootClassName: "bg-stone-50/80",
|
|
1223
|
-
headerClassName: "border-b border-amber-200/70 bg-amber-50/70",
|
|
1224
|
-
guidance: {
|
|
1225
|
-
title: "Polish your studio preview",
|
|
1226
|
-
description: "Use preview for copy and layout tweaks. Complete setup in Macadamia to add offerings, connect payments, and finish the rest of your launch checklist.",
|
|
1227
|
-
ctaLabel: "Complete setup in Macadamia",
|
|
1228
|
-
cardClassName: "rounded-2xl border border-amber-200/80 bg-gradient-to-br from-amber-50 via-white to-orange-50 px-4 py-4 shadow-sm"
|
|
1229
|
-
}
|
|
1230
|
-
}
|
|
1231
|
-
}
|
|
1232
|
-
};
|
|
1233
|
-
function getPreviewChromeSurfacePolicy(surfaceId) {
|
|
1234
|
-
return PREVIEW_CHROME_SURFACE_POLICIES[surfaceId];
|
|
1235
|
-
}
|
|
1236
|
-
function resolvePreviewSetupBannerModel(input) {
|
|
1237
|
-
if (!input.bannerState) return null;
|
|
1238
|
-
const policy = getPreviewChromeSurfacePolicy(input.surfaceId).banner;
|
|
1239
|
-
return {
|
|
1240
|
-
tone: policy.tone,
|
|
1241
|
-
bannerClassName: policy.bannerClassName,
|
|
1242
|
-
summaryClassName: policy.summaryClassName,
|
|
1243
|
-
dialogItemClassName: policy.dialogItemClassName,
|
|
1244
|
-
titleClassName: policy.titleClassName,
|
|
1245
|
-
descriptionClassName: policy.descriptionClassName,
|
|
1246
|
-
detailClassName: policy.detailClassName,
|
|
1247
|
-
summaryTitleClassName: policy.summaryTitleClassName,
|
|
1248
|
-
summaryBodyClassName: policy.summaryBodyClassName,
|
|
1249
|
-
secondaryButtonClassName: policy.secondaryButtonClassName,
|
|
1250
|
-
primaryButtonClassName: policy.primaryButtonClassName,
|
|
1251
|
-
dialogBodyClassName: policy.dialogBodyClassName,
|
|
1252
|
-
dialogItemTitleClassName: policy.dialogItemTitleClassName,
|
|
1253
|
-
dialogItemMetaClassName: policy.dialogItemMetaClassName,
|
|
1254
|
-
dialogItemDescriptionClassName: policy.dialogItemDescriptionClassName,
|
|
1255
|
-
ctaLabel: policy.ctaLabel,
|
|
1256
|
-
copy: policy.copyByState[input.bannerState],
|
|
1257
|
-
dialogTitle: policy.dialog.title,
|
|
1258
|
-
dialogDescription: policy.dialog.description,
|
|
1259
|
-
dialogIntro: input.dashboardUnlocked ? policy.dialog.unlockedIntro : policy.dialog.pendingIntro,
|
|
1260
|
-
dialogOutro: policy.dialog.outro
|
|
1261
|
-
};
|
|
1262
|
-
}
|
|
1263
|
-
function resolvePreviewSidebarChromeModel(surfaceId) {
|
|
1264
|
-
const policy = getPreviewChromeSurfacePolicy(surfaceId).sidebar;
|
|
1265
|
-
return {
|
|
1266
|
-
tone: policy.tone,
|
|
1267
|
-
rootClassName: policy.rootClassName,
|
|
1268
|
-
headerClassName: policy.headerClassName
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
function resolvePreviewEditorGuidanceModel(input) {
|
|
1272
|
-
if (!input.canEdit || !input.hasDashboardSetupHandoff) return null;
|
|
1273
|
-
const policy = getPreviewChromeSurfacePolicy(input.surfaceId).sidebar;
|
|
1274
|
-
return {
|
|
1275
|
-
tone: policy.tone,
|
|
1276
|
-
title: policy.guidance.title,
|
|
1277
|
-
description: policy.guidance.description,
|
|
1278
|
-
ctaLabel: policy.guidance.ctaLabel,
|
|
1279
|
-
cardClassName: policy.guidance.cardClassName
|
|
1280
|
-
};
|
|
1281
|
-
}
|
|
1282
|
-
//#endregion
|
|
1283
|
-
//#region ../preview-next/src/client/preview/sanitizeDashboardPath.ts
|
|
1284
|
-
function sanitizeDashboardPath(value) {
|
|
1285
|
-
if (!value) return null;
|
|
1286
|
-
const trimmed = value.trim();
|
|
1287
|
-
if (!trimmed || /^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(trimmed)) return null;
|
|
1288
|
-
const normalized = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
1289
|
-
try {
|
|
1290
|
-
const parsed = new URL(normalized, "https://preview.local");
|
|
1291
|
-
return `${parsed.pathname}${parsed.search}${parsed.hash}`;
|
|
1292
|
-
} catch {
|
|
1293
|
-
return null;
|
|
1294
|
-
}
|
|
1295
|
-
}
|
|
1296
|
-
//#endregion
|
|
1297
|
-
//#region ../preview-next/src/client/preview/previewDashboardHandoff.ts
|
|
1298
|
-
function resolvePreviewDashboardSetupHandoffFromSearch(search) {
|
|
1299
|
-
const params = new URLSearchParams(search);
|
|
1300
|
-
if (params.get("preview_handoff") !== "dashboard_setup") return null;
|
|
1301
|
-
const dashboardPath = sanitizeDashboardPath(params.get("preview_dashboard"));
|
|
1302
|
-
if (!dashboardPath) return null;
|
|
1303
|
-
return {
|
|
1304
|
-
kind: "dashboard_setup",
|
|
1305
|
-
dashboardPath
|
|
1306
|
-
};
|
|
1307
|
-
}
|
|
1308
|
-
function resolvePreviewDashboardSetupHandoff() {
|
|
1309
|
-
if (typeof window === "undefined") return null;
|
|
1310
|
-
return resolvePreviewDashboardSetupHandoffFromSearch(window.location.search);
|
|
1311
|
-
}
|
|
1312
|
-
function buildPreviewDashboardSetupUrl(dashboardBaseUrl, handoff) {
|
|
1313
|
-
if (!dashboardBaseUrl || !handoff) return null;
|
|
1314
|
-
return new URL(handoff.dashboardPath, dashboardBaseUrl).toString();
|
|
1315
|
-
}
|
|
1316
|
-
//#endregion
|
|
1317
|
-
//#region ../preview-next/src/client/preview/siteStyleAccess.ts
|
|
1318
|
-
function resolveSiteStyleAccess(session) {
|
|
1319
|
-
if (session?.kind === "userSession" && session.canEdit) return { kind: "apply-allowed" };
|
|
1320
|
-
return { kind: "hidden" };
|
|
1321
|
-
}
|
|
1322
|
-
function canInspectSiteStyle(access) {
|
|
1323
|
-
return access.kind === "apply-allowed";
|
|
1324
|
-
}
|
|
1325
|
-
//#endregion
|
|
1326
|
-
export { sanitizeDashboardPath as a, resolvePreviewSidebarChromeModel as c, useBlockCustomizeControls as d, PreviewBlockCustomizeSelectionProvider as f, previewWidgetOverrides as h, resolvePreviewDashboardSetupHandoff as i, PreviewSiteFontStorageProvider as l, PreviewFormProvider as m, resolveSiteStyleAccess as n, resolvePreviewEditorGuidanceModel as o, usePreviewBlockCustomizeSelectionOptional as p, buildPreviewDashboardSetupUrl as r, resolvePreviewSetupBannerModel as s, canInspectSiteStyle as t, usePreviewSiteFontStorageUrl as u };
|