@riverbankcms/sdk 0.165.0 → 0.167.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/CHANGELOG.md +7 -0
- package/README.md +5 -0
- package/dist/_dts/{BlocksIslandsHydrator-CdsSMQEv.d.ts → BlocksIslandsHydrator-Dgb-ptph.d.ts} +1 -1
- package/dist/_dts/{Page-D6gp2Ipb.d.ts → Page-Bs3WxFgr.d.ts} +20 -258
- package/dist/_dts/{SdkPreviewMode-DNXAvnet.d.ts → SdkPreviewMode-DtUCsaHY.d.ts} +26 -3
- package/dist/_dts/{client-BkkExozE.d.ts → client-CwsI23pj.d.ts} +13 -1
- package/dist/_dts/{content-types-CXNAD7ef.d.ts → content-types-CAeP_-cV.d.ts} +3 -3
- package/dist/_dts/{contracts-XRXhbLWP.d.ts → contracts-BXHCiF-b.d.ts} +8 -5
- package/dist/_dts/{footerPageOutline-BP2bJYdY.d.ts → footerPageOutline-Bb2gbppW.d.ts} +6 -6
- package/dist/_dts/{generatePageMetadata-DcMtbztV.d.ts → generatePageMetadata-DaBBDx7M.d.ts} +2 -2
- package/dist/_dts/{index-DKNEgSOS.d.ts → index-5_jf52sZ.d.ts} +2 -2
- package/dist/_dts/{index-CQfJhOEA.d.ts → index-C20yUyob.d.ts} +1 -1
- package/dist/_dts/{index-CRRiddNp.d.ts → index-CS6b1B-c.d.ts} +4 -4
- package/dist/_dts/{index-B4ozSzFP.d.ts → index-ChpjHK0U.d.ts} +9737 -8316
- package/dist/_dts/{index-BdkHhyf8.d.ts → index-D7EbliE3.d.ts} +1 -1
- package/dist/_dts/{index-RXkE3a7M.d.ts → index-DeHDwMfu.d.ts} +4 -3
- package/dist/_dts/{index-DAPTSmBM.d.ts → index-RugyUnqR.d.ts} +2499 -2218
- package/dist/_dts/{index-C_3kdrUb.d.ts → index-bDln38Hm.d.ts} +2 -2
- package/dist/_dts/{loadContent-B9vJMq3s.d.ts → loadContent-CTqcL7CS.d.ts} +9 -6
- package/dist/_dts/resolveBlockData-C3s9WMPs.d.ts +136 -0
- package/dist/_dts/{resolvePageContent-DIQyYUi-.d.ts → resolvePageContent-JPwgRxwh.d.ts} +3 -2
- package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
- package/dist/_dts/sdk/src/client/types.d.ts +2 -2
- package/dist/_dts/sdk/src/client.d.ts +9 -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/data/dataLoaderContext.d.ts +20 -0
- package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +2 -0
- package/dist/_dts/sdk/src/data/types.d.ts +54 -0
- package/dist/_dts/sdk/src/index.d.ts +8 -8
- package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
- package/dist/_dts/sdk/src/metadata/index.d.ts +6 -1
- package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
- package/dist/_dts/sdk/src/next/index.d.ts +9 -8
- package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
- package/dist/_dts/sdk/src/page-converter/index.d.ts +36 -48
- 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/components/pageShared.d.ts +2 -0
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +3 -0
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +260 -0
- package/dist/_dts/sdk/src/rendering/index.d.ts +8 -7
- package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
- package/dist/_dts/{themeAdmission-D_qtGYAT.d.ts → sdk/src/rendering/themeAdmission.d.ts} +3 -1
- package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
- package/dist/_dts/sdk/src/server.d.ts +7 -5
- package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
- package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
- package/dist/_dts/{types-BDF73NzM.d.ts → types-BlaCuPLr.d.ts} +2 -2
- package/dist/_dts/{types-Cl0nP6al.d.ts → types-CwtTcaQP.d.ts} +3 -3
- package/dist/_dts/{types-mstFvhK4.d.ts → types-D-WElMCy.d.ts} +8 -7
- package/dist/_dts/{validation-DVWqSvjK.d.ts → validation-Y5wD9fGK.d.ts} +4 -4
- package/dist/client/{BlocksIslandsHydrator-CzKpH9Pm.mjs → BlocksIslandsHydrator-DFqkx158.mjs} +31 -24
- package/dist/client/{BookingMailingListNote-rUqsBN7L.mjs → BookingMailingListNote-CCVXX1LN.mjs} +2 -2
- package/dist/client/{CalendarNavigationChevron-YGzw2IPB.mjs → CalendarNavigationChevron-DQwJ7BPx.mjs} +167 -18
- package/dist/client/{CheckboxChoice-DlTC4J2a.mjs → CheckboxChoice-CZ-anOqV.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-D2LyS_Bi.mjs → DemoBookingPortalAccess-DdkY86qI.mjs} +6 -6
- package/dist/client/{DemoPortalSignInLink-BaFg2Uit.mjs → DemoPortalSignInLink-B9YrzZt2.mjs} +1 -1
- package/dist/client/{EventCalendar.client-tRrhPscX.mjs → EventCalendar.client-DAeQPV76.mjs} +11 -30
- package/dist/client/{EventCombined.client-6cfAVtnZ.mjs → EventCombined.client-Bus9R0bj.mjs} +137 -61
- package/dist/client/{EventEmbeddedCheckoutStep-CDNUpI0S.mjs → EventEmbeddedCheckoutStep-D_14yqAU.mjs} +27 -2
- package/dist/client/{EventItem-dILw2PN_.mjs → EventItem-DPBLjGwj.mjs} +75 -13
- package/dist/client/{EventListWeekNavigation-ClgLtjNY.mjs → EventListWeekNavigation-D6cwU82_.mjs} +1 -1
- package/dist/client/{EventListing.client-BNueAHmU.mjs → EventListing.client-Bogi_SnJ.mjs} +3 -3
- package/dist/client/{EventListing.view-DtVbKVkt.mjs → EventListing.view-CEumpN7i.mjs} +35 -51
- package/dist/client/{EventRegistrationPayment-CzkG0NSJ.mjs → EventRegistrationPayment-CIQw6vNy.mjs} +113 -11
- package/dist/client/{LocationMapActions-zWQsJhE5.mjs → LocationMapActions-BVO-qx4q.mjs} +2 -2
- package/dist/client/{MapDrawingSvg-D1AO_o4h.mjs → MapDrawingSvg-CcGaFawl.mjs} +22 -2
- package/dist/client/{Page-DUr2YhFR.mjs → Page-D4_H_u9V.mjs} +23892 -32266
- package/dist/client/{ProtectedSubmitButton-2fJqT_NR.mjs → ProtectedSubmitButton-8DuDw2ag.mjs} +1 -1
- package/dist/client/{StepIndicator-udNHcpOT.mjs → StepIndicator-Dptantmg.mjs} +3 -3
- package/dist/client/{TabBarFragment-C_kt-PXh.mjs → TabBarFragment-BxEGsKUx.mjs} +19 -19
- package/dist/client/{ThemedButton-Cfbo1bfh.mjs → ThemedButton-8jUc02mZ.mjs} +64 -2
- package/dist/client/{accordion-3CYNWzTS.mjs → accordion--EUHmEGa.mjs} +1 -1
- package/dist/client/{booking-form.client-BSbWgLyx.mjs → booking-form.client-BCXwOnhc.mjs} +19 -14
- package/dist/client/{bookingForm-2MoFBWSt.mjs → bookingForm-sHHcdism.mjs} +4 -4
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/{carousel-Cu5mcpO-.mjs → carousel-Cp9xPBFZ.mjs} +2 -2
- package/dist/client/{carousel.client-CQLV8_Al.mjs → carousel.client-BO7sCEpH.mjs} +1 -1
- package/dist/client/{cart-CDc6x9cR.mjs → cart-CCZZC-Lq.mjs} +3 -3
- package/dist/client/{cart.client-BWS2r5Ef.mjs → cart.client-B7JfA19I.mjs} +1 -1
- package/dist/client/{checkout-CkxPqSwD.mjs → checkout-CipmYL4A.mjs} +3 -3
- package/dist/client/{checkout.client-DJfomKQc.mjs → checkout.client-DraalWdH.mjs} +1 -1
- package/dist/client/client.mjs +9550 -17
- package/dist/client/{context-CBV21-9L.mjs → context-Cv3QHjAF.mjs} +11 -6
- package/dist/client/{cta-Bw-al3cs.mjs → cta-P2vJVTEn.mjs} +45 -28
- package/dist/client/{dateFormatting-CFIUJ4Uf.mjs → dateFormatting-D8D47VT4.mjs} +1 -1
- package/dist/client/{demoPortalMagicLink-D0veHJyi.mjs → demoPortalMagicLink-CXWZoV-d.mjs} +1 -1
- package/dist/client/{enhanceHeaderSection-CEqqq92r.mjs → enhanceHeaderSection-BkAro1DJ.mjs} +4 -4
- package/dist/client/{event-details.client-Bk2kQ7ax.mjs → event-details.client-dLmyuPap.mjs} +2 -2
- package/dist/client/{event-registration.client-QMqtIywj.mjs → event-registration.client-BEhC2_-Y.mjs} +34 -20
- package/dist/client/{eventCalendar-BTDTMosr.mjs → eventCalendar-FBMS2Cpb.mjs} +4 -4
- package/dist/client/{eventCombined-BC7a709c.mjs → eventCombined-BrBhUvGe.mjs} +4 -4
- package/dist/client/{eventDetails-DL08GpUc.mjs → eventDetails-C7WUrbZ2.mjs} +2 -2
- package/dist/client/{eventListing-BfzuEQp_.mjs → eventListing-Bih-BgQM.mjs} +4 -4
- package/dist/client/{eventRegistration-Lfyzh1Ab.mjs → eventRegistration-DfTlqGbl.mjs} +4 -4
- package/dist/client/{form-L-xZOBUS.mjs → form-Bw1uuiUs.mjs} +3 -3
- package/dist/client/{form.client-BtpK3TZW.mjs → form.client-pZ-9gN33.mjs} +5 -5
- package/dist/client/{form.parts-Djos5Un4.mjs → form.parts-PXlu6XQO.mjs} +3 -3
- package/dist/client/{formatDate-DGmrm7YB.mjs → formatDate-DI3DP48e.mjs} +1 -1
- package/dist/client/gifting/client.mjs +3 -4
- package/dist/client/{headerSection-f16OGkz-.mjs → headerSection-BpJYUMd6.mjs} +2 -2
- package/dist/client/{mediaAssets-DHAmrVIi.mjs → mediaAssets-DpPauppt.mjs} +1 -1
- package/dist/client/{mediaContext-CwT6ZOm7.mjs → mediaContext-BLo4NtjP.mjs} +25 -19
- package/dist/client/{newsletter-form.client-DpHNZc7k.mjs → newsletter-form.client-CSoP0cGR.mjs} +6 -6
- package/dist/client/{newsletter-form.parts-CLGH20PL.mjs → newsletter-form.parts-DDbX_Sj0.mjs} +2 -2
- package/dist/client/{newsletterForm-BEU0Ocu9.mjs → newsletterForm-vCxYRar_.mjs} +3 -3
- package/dist/client/{noop-CQU7tiMg.mjs → noop-ByVtIWf4.mjs} +420 -170
- package/dist/client/portal/client.mjs +13 -14
- package/dist/client/{product-detail.client-Be-om1BT.mjs → product-detail.client-7Pi6avM-.mjs} +1 -1
- package/dist/client/{product-list.client-DR7hD5Vs.mjs → product-list.client-DEad-Pma.mjs} +1 -1
- package/dist/client/{productDetail-BD42UOmG.mjs → productDetail-G1SMXG13.mjs} +3 -3
- package/dist/client/{productList-CSk8sXCl.mjs → productList-B21TGdpT.mjs} +3 -3
- package/dist/client/{propsDecoder-C_Y6VYnF.mjs → propsDecoder-B3vIBkex.mjs} +4 -5
- package/dist/client/{registry.server-CIKtTsCl.mjs → registry.server-B8aQhJpO.mjs} +399 -473
- package/dist/client/rendering/client.mjs +29 -28
- package/dist/client/rendering/islands.mjs +1 -1
- package/dist/client/rendering.mjs +70 -8
- package/dist/client/{richText-coerce-spWtx86G.mjs → richText-coerce-DHkBtO0G.mjs} +1 -1
- package/dist/client/{routeIslandApiConfig-CROHPlYS.mjs → routeIslandApiConfig-DbHX4JOS.mjs} +1 -1
- package/dist/client/{shop-commerce-CDUohm_2.mjs → shop-commerce-B2UmrQg_.mjs} +12 -12
- package/dist/client/{shop-commerce-store-B9nw4lRP.mjs → shop-commerce-store-B7n-Z7nY.mjs} +1 -1
- package/dist/client/{shop-DscvMz86.mjs → shop-mqyoOvOK.mjs} +3 -3
- package/dist/client/{shop.client-M3kNsVPi.mjs → shop.client-BH-BBnA9.mjs} +13 -13
- package/dist/client/{shop.interactive-BGmkdIAZ.mjs → shop.interactive-mdM3UMWG.mjs} +74 -36
- package/dist/client/{shopShared-BdWp6LHa.mjs → shopShared-CXF5wxdg.mjs} +2 -2
- package/dist/client/site-styles-CMCUxsIM.mjs +3 -0
- package/dist/{preview-next/client/ThemedButton-Dc6aJ34Z.mjs → client/site-styles-D56hT2u1.mjs} +26000 -16565
- package/dist/client/spam-protection.mjs +1 -1
- package/dist/client/src-DjnxOjXG.mjs +217 -0
- package/dist/client/surfaceTransportMarker-BXepAVF6.mjs +152 -0
- package/dist/client/{timetableModel-Dynh5-j4.mjs → timetableModel-CrC80EOG.mjs} +13 -140
- package/dist/client/types-sF-IrGQr.mjs +633 -0
- package/dist/client/{useAvailableSlots-Cw9paRPY.mjs → useAvailableSlots-C4LOaI_Z.mjs} +8 -5
- package/dist/client/{useBookingNowIso-C9SF2rC6.mjs → useBookingNowIso-BDmWkYUW.mjs} +1 -1
- package/dist/client/{useDiscountApply-B-QJfBg0.mjs → useDiscountApply-6Q0nToVA.mjs} +3 -3
- package/dist/client/{useDiscountCodeUi-Uvum8q9d.mjs → useDiscountCodeUi-CM-DTX5X.mjs} +1 -1
- package/dist/client/{useEventPagination-BfM3xk6j.mjs → useEventPagination-Bcs89BR5.mjs} +9 -9
- package/dist/client/{view-DlkCDfuN.mjs → view-BN-fxyfq.mjs} +287 -232
- package/dist/client/{view-DXOuduIr.mjs → view-Dh2tGoS0.mjs} +4 -4
- package/dist/client/{wizardSteps-DManVJpc.mjs → wizardSteps-DtkhwKXK.mjs} +468 -149
- package/dist/preview-next/before-render.mjs +3 -140
- package/dist/preview-next/client/ArrangementLookControls-D4VjPs-r.mjs +31197 -0
- package/dist/preview-next/client/{EventEmbeddedCheckoutStep-Die6Y25O.mjs → EventEmbeddedCheckoutStep-C_h1cMYm.mjs} +33 -4
- package/dist/preview-next/client/{LocationPickerEnvironment-Bp4BHLCL.mjs → LocationPickerEnvironment-D56RD3e_.mjs} +1 -1
- package/dist/preview-next/client/{MapLibreEditMap-Cb0JhM9p.mjs → MapLibreEditMap-DFnyCckr.mjs} +2 -2
- package/dist/preview-next/client/PreviewEditorSidebar-Ckr2zk_L.mjs +37247 -0
- package/dist/preview-next/client/{PreviewEditorUI-CxwlLBGw.mjs → PreviewEditorUI-KOZgw_gS.mjs} +45 -17
- package/dist/preview-next/client/PreviewShell-CyO2V4kB.mjs +4757 -0
- package/dist/preview-next/client/SdkPreviewModeRuntime-DW3uKvNF.mjs +4258 -0
- package/dist/preview-next/client/SiteChromeCustomizeButton-CU9VD-7O.mjs +72202 -0
- package/dist/preview-next/client/ThemedButton-C0dgGJ5k.mjs +2006 -0
- package/dist/preview-next/client/{lucide-react-CqxuVAyz.mjs → lucide-react-CPBCf6QT.mjs} +15 -2
- package/dist/preview-next/client/previewAssistantSlot-DBi-WybM.mjs +112193 -0
- package/dist/preview-next/client/{previewChromeSurface-yuwnDP3B.mjs → previewChromeSurface-BhkUJst9.mjs} +90 -28
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/client/sdk-runtime-BjCb6lOn.mjs +5 -0
- package/dist/preview-next/client/{editorStatusDecision-DR4BBKhy.mjs → useAutosaveStatus-CKxTaC3j.mjs} +40 -3
- package/dist/preview-next/client/useBlockCustomizeControls-B7MLTjBX.mjs +2633 -0
- package/dist/preview-next/client/useOpenBlockForSetup-BTUc0g9X.mjs +28 -0
- package/dist/preview-next/keepAlive.mjs +25 -2
- package/dist/preview-next/middleware.mjs +1 -1
- package/dist/preview-next/{route-contract-BBAJjFIz.mjs → route-contract-Bv3nkdpV.mjs} +215 -118
- package/dist/server/{Block.shared-ClFI3qpX.mjs → Block.shared-4fMqzltx.mjs} +7 -4
- package/dist/server/{src-DsYPhTbs.mjs → ThemeScopeCore-C72VC_lR.mjs} +894 -2556
- package/dist/server/accessibleSurfaces-B_Y_dA20.mjs +2305 -0
- package/dist/server/{bindings-Bi8EoRZD.mjs → bindings-ConMYJ2U.mjs} +2 -3
- package/dist/server/{publicProducts-Bz8loTRn.mjs → client-Cot-H5fQ.mjs} +2558 -343
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.mjs +33 -2
- package/dist/server/data/dataLoaderContext.mjs +2 -0
- package/dist/server/data/resolveBlockData.mjs +2 -0
- package/dist/server/data/types.mjs +1 -0
- package/dist/server/dataLoaderContext-B3fXA54R.mjs +47 -0
- package/dist/server/identity-Bn9OQiT1.mjs +6 -0
- package/dist/server/index.mjs +3 -3
- package/dist/server/{loadContent-dEEhQxL7.mjs → loadContent-BkaWYEwt.mjs} +6 -5
- package/dist/server/{loadPage-DBFBad8A.mjs → loadPage-kviUdH8c.mjs} +4 -2
- package/dist/server/manifest.mjs +1 -1
- package/dist/server/media-DnlczCMA.mjs +231 -0
- package/dist/server/metadata.mjs +5 -1
- package/dist/server/mode-Cv_TG9gP.mjs +63 -0
- package/dist/server/next/revalidate.mjs +9 -4
- package/dist/server/next.mjs +11 -11
- package/dist/server/opaqueSurface-BTnS09GS.mjs +54 -0
- package/dist/server/{overrideResolution-BIJbiXYc.mjs → overrideResolution-itXZCXs7.mjs} +2 -1
- package/dist/server/overrides-CD4d-1w7.mjs +177 -0
- package/dist/server/page-converter.mjs +243 -91
- package/dist/server/pageRenderPlan-CDyn7iLy.mjs +4162 -0
- package/dist/server/{themeAdmission-CSknYpxk.mjs → pageRuntimeSupport-DZ6cLxrM.mjs} +13 -28
- package/dist/server/{overrides-DhF87Vsd.mjs → pageShared-Q_Vij87H.mjs} +3808 -1928
- package/dist/server/parseThemeForPersistence-CDrF51tJ.mjs +52 -0
- package/dist/server/{prebuild-DaemmWQL.mjs → prebuild-DOG4MkOy.mjs} +1 -1
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/prefetchBlockData-DlprLLsc.mjs +756 -0
- package/dist/server/{registry-Cdvz1OtL.mjs → registry-BPFcpn6k.mjs} +21838 -709
- package/dist/server/rendering/components/pageShared.mjs +2 -0
- package/dist/server/rendering/helpers/loadPage.mjs +2 -0
- package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +2 -0
- package/dist/server/rendering/server.mjs +5 -4
- package/dist/server/rendering/themeAdmission.mjs +2 -0
- package/dist/server/rendering.mjs +11 -10
- package/dist/server/repeaterFields-MIz7r1ez.mjs +9 -0
- package/dist/server/{resolveBlockData-CLpAJWWf.mjs → resolveBlockData-BHvfGD4y.mjs} +6 -48
- package/dist/server/resolveButtonColourStates-OXFRGn5M.mjs +2682 -0
- package/dist/server/responseMedia-D8J3VAFs.mjs +115 -0
- package/dist/server/{richTextSchema-YYc85FX4.mjs → richTextSchema-Euhuj-7V.mjs} +26 -1
- package/dist/server/routing.mjs +1 -1
- package/dist/server/schema-DEizlyi4.mjs +2524 -0
- package/dist/server/server.mjs +3 -3
- package/dist/server/theme-bridge.mjs +1031 -1
- package/dist/server/theme.mjs +2 -1
- package/dist/server/themeAdmission-DGSAlFUK.mjs +18 -0
- package/dist/server/{three-pass-converter-Chnb1XD-.mjs → three-pass-converter-_j2UE2tR.mjs} +1 -1
- package/dist/server/validation-CDd6m8Ry.mjs +140 -0
- package/dist/server/{validation-DYxhLzqQ.mjs → validation-bl6WcAi_.mjs} +419 -3
- package/dist/server/{version-Beu4q-Gv.mjs → version-BLXZ31S-.mjs} +1 -1
- package/dist/styles/index.css +710 -29
- package/package.json +39 -1
- package/dist/client/events-BmqPeeQm.mjs +0 -20
- package/dist/client/purchase-BV5xfaZH.mjs +0 -894
- package/dist/client/schema-BdSglH2X.mjs +0 -16084
- package/dist/client/site-styles-CWHmlVT5.mjs +0 -14503
- package/dist/client/src-VIsPY-kw.mjs +0 -62
- package/dist/preview-next/client/PreviewEditorSidebar-DEP3xD9K.mjs +0 -5810
- package/dist/preview-next/client/SdkPreviewModeRuntime-Cpe-XP8e.mjs +0 -3
- package/dist/preview-next/client/SdkPreviewModeRuntime-QDkMPASV.mjs +0 -8059
- package/dist/preview-next/client/SiteChromeCustomizeButton-1JaoGOKX.mjs +0 -9367
- package/dist/preview-next/client/previewSidebarNavigation-AXUj9-qQ.mjs +0 -224683
- package/dist/preview-next/client/result-BjJUoxUF.mjs +0 -16
- package/dist/preview-next/client/sdk-runtime-O-eA9-rV.mjs +0 -4
- package/dist/preview-next/refresh-contract-uQ6BXgLJ.mjs +0 -25
- package/dist/server/bindings-Dgt_0goJ.mjs +0 -17
- package/dist/server/client-DfMDbZ41.mjs +0 -2330
- package/dist/server/effectiveNavLinkStyle-BHIYPVG1.mjs +0 -13713
- package/dist/server/loadPage-CnVB-aeL.mjs +0 -2
- package/dist/server/prefetchBlockData-FwcsT5H2.mjs +0 -4359
- package/dist/server/schema-uSA_x1Zh.mjs +0 -16311
- package/dist/server/site-styles-CntHn2KI.mjs +0 -793
- package/dist/server/siteChromeOverlayClearance-DqP40Ka0.mjs +0 -802
|
@@ -1,4359 +0,0 @@
|
|
|
1
|
-
import { An as resolveSurface, Cn as err, Ct as mediaSchema, Dt as renderableMediaAssetSchema, Ht as asLayoutVariantKey, On as parseResolvedSurface, Ot as indexRenderableMediaAssets, Rt as asDesignBlockId, Tn as mapDrawingStyle, Tt as runtimeMediaSchema, Wt as asSiteStyleId, _n as parseSiteId, bt as stripStaleTransitionStyleGroup, fn as parseApiKeyId, fr as defaultThemeTokens, kn as parseSurfaceTree, kt as resolveManagedMediaReference, nn as makeBoundaryId, r as themeSchema, vn as parseSiteTermsVersionId, wn as ok, xt as themeV2CompilerOwnedFieldNames, yn as parseUserId } from "./schema-uSA_x1Zh.mjs";
|
|
2
|
-
import { $n as formattingTransforms, $r as lookSkinSlotTransform, Bn as contentTransforms, Br as parseBackgroundContent, Bt as buildEventListWeek, Ca as getLocalScheduleDate, Di as builtInBlockKindsSchema, Ei as blockSectionDeclarationShape, F as projectRecurringSchedule, Fi as NodeSchema, G as resolveCalendarReadProfile, Gn as resolveDateRuntimeContext, Gr as resolveBackgroundColorValue, Hr as parseRuntimeBackgroundContent, Ii as bindingSchema, Ir as boxStylesTransforms, Ji as augmentManifest, Jn as chromeLogoTransforms, Jr as BACKGROUND_POSITION_PRESET_VALUES, Kn as mediaTransforms, Li as RESOLVED_INTERNAL_LINK_ENTITY_TYPES, Mi as validateManifestLookField, Ni as sdkBlockPresentationShape, Oi as fieldSchema, Pi as validateSdkBlockDeclaration, Qn as uiTransforms, Qr as lookQuoteLimitTransform, Ti as blockCategoryEnum, Ur as resolveSectionSurfaceForeground, Vr as parseBackgroundOverlay, W as calendarWindowQuerySchema, Wn as readRuntimeNow, Wr as resolveSurfaceForegroundStyles, Xr as lookCarouselRegionTransform, Yn as layoutTransforms, Yr as getAnchorClasses, Zn as resolveHeroTitleLength, Zr as lookLeadSlotTransform, bt as eventCalendarListLayoutOptions, da as locationValueSchema, ei as asPartialObject, hr as standardAspectRatioOptions, ka as toUtcIsoDateTimeString, ni as runTransforms, nt as computeMediaTransformStyle, pt as resolveEventSelection, qn as headerRuntimeTransforms, qr as standardImageShapeOptions, qt as eventCalendarWeekStart, sa as parseMailingListProviderScope, t as getBlockDefinition, ti as createTransformRegistry, vt as eventCalendarListGroupingDecision, xt as resolveEventCalendarReadPlan, yt as eventCalendarListLayoutCompatibleDisplayModeValues } from "./registry-Cdvz1OtL.mjs";
|
|
3
|
-
import { t as assertNever } from "./assert-never-ku-PUn9U.mjs";
|
|
4
|
-
import { m as SUPPORTED_LOADER_ENDPOINTS$1, n as parsePublicProductCategorySelector } from "./publicProducts-Bz8loTRn.mjs";
|
|
5
|
-
import { B as sectionShapeForGround, D as gradientToCss, H as sectionShapeHook, O as getGradientPreset, S as deriveSiteStyleBlockPolicy, V as sectionShapeFromContent, X as cardListFamilyBlocks, Y as resolveEffectiveKnobs, Z as cardListKnobBlocks, _ as arrangementManifestFromVariants, b as resolveModeArrangement, f as arrangementAppearancePresets, g as resolveLookSlotSurfaces, h as resolveItemSurface, k as parseGradientPresetId, m as arrangementSlotNames, v as readStoredMode, x as resolvePublishedLook, y as resolveEffectiveArrangement } from "./effectiveNavLinkStyle-BHIYPVG1.mjs";
|
|
6
|
-
import { a as sectionFactsForContent, c as parseCanonicalRuntimeBackground, i as composeBoundary, l as resolveSectionBackground, n as storedSectionPhoto, o as applyLookPhotoTreatment, r as boundaryLayout, s as deriveSectionGround, t as heroPhotoPaintsGround } from "./site-styles-CntHn2KI.mjs";
|
|
7
|
-
import { i as isObjectRecord, t as RichTextDocSchema } from "./richTextSchema-YYc85FX4.mjs";
|
|
8
|
-
import { i as resolveRouteTargetForStage$1 } from "./dist-Xevqwf1U.mjs";
|
|
9
|
-
import { z } from "zod";
|
|
10
|
-
//#region ../core/src/rich-text.ts
|
|
11
|
-
function isRecord$3(value) {
|
|
12
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
13
|
-
}
|
|
14
|
-
function hasOnlyKeys(value, allowed) {
|
|
15
|
-
return Object.keys(value).every((key) => allowed.has(key));
|
|
16
|
-
}
|
|
17
|
-
const rootKeys = /* @__PURE__ */ new Set(["type", "content"]);
|
|
18
|
-
const nodeKeys = /* @__PURE__ */ new Set([
|
|
19
|
-
"type",
|
|
20
|
-
"content",
|
|
21
|
-
"text",
|
|
22
|
-
"attrs",
|
|
23
|
-
"marks"
|
|
24
|
-
]);
|
|
25
|
-
const markKeys = /* @__PURE__ */ new Set(["type", "attrs"]);
|
|
26
|
-
function isDenseArrayOf(value, predicate) {
|
|
27
|
-
for (let index = 0; index < value.length; index += 1) if (!(index in value) || !predicate(value[index])) return false;
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
function isTipTapMark(value) {
|
|
31
|
-
return isRecord$3(value) && hasOnlyKeys(value, markKeys) && typeof value.type === "string" && value.type.length > 0 && (value.attrs === void 0 || isRecord$3(value.attrs));
|
|
32
|
-
}
|
|
33
|
-
function isTipTapNode(value) {
|
|
34
|
-
if (!isRecord$3(value) || !hasOnlyKeys(value, nodeKeys) || typeof value.type !== "string" || value.type.length === 0 || value.type === "doc" || value.attrs !== void 0 && !isRecord$3(value.attrs) || value.marks !== void 0 && (!Array.isArray(value.marks) || !isDenseArrayOf(value.marks, isTipTapMark)) || value.content !== void 0 && (!Array.isArray(value.content) || !isDenseArrayOf(value.content, isTipTapNode))) return false;
|
|
35
|
-
if (value.type === "text") return typeof value.text === "string" && value.text.length > 0 && value.content === void 0;
|
|
36
|
-
return value.text === void 0;
|
|
37
|
-
}
|
|
38
|
-
function isCanonicalRichTextDoc(value) {
|
|
39
|
-
return isRecord$3(value) && hasOnlyKeys(value, rootKeys) && value.type === "doc" && Array.isArray(value.content) && isDenseArrayOf(value.content, isTipTapNode);
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region ../core/src/secret.ts
|
|
43
|
-
/**
|
|
44
|
-
* Credential values that must remain inert when they cross diagnostics,
|
|
45
|
-
* logging, or serialization boundaries.
|
|
46
|
-
*
|
|
47
|
-
* The value is deliberately held behind a non-enumerable capability rather
|
|
48
|
-
* than exposed as a property. The capability uses a global symbol so a Secret
|
|
49
|
-
* created by another bundled copy of core remains consumable at an approved
|
|
50
|
-
* `exposeSecret` boundary.
|
|
51
|
-
*/
|
|
52
|
-
const secretValueSymbol = Symbol.for("riverbank.secret.value");
|
|
53
|
-
const SECRET_INSPECT_SYMBOL = Symbol.for("nodejs.util.inspect.custom");
|
|
54
|
-
function placeholderFor(kind) {
|
|
55
|
-
return `[riverbank:redacted:${kind}]`;
|
|
56
|
-
}
|
|
57
|
-
/** Create an opaque secret after a caller has parsed/validated its boundary. */
|
|
58
|
-
function createSecret(kind, value) {
|
|
59
|
-
return createSecretInternal(kind, value);
|
|
60
|
-
}
|
|
61
|
-
/** Construct a Secret for an already validated kind/value pair. */
|
|
62
|
-
function createSecretInternal(kind, value) {
|
|
63
|
-
const placeholder = placeholderFor(kind);
|
|
64
|
-
const secret = {
|
|
65
|
-
kind: "secret",
|
|
66
|
-
secretType: kind,
|
|
67
|
-
toString: () => placeholder,
|
|
68
|
-
toJSON: () => placeholder,
|
|
69
|
-
[SECRET_INSPECT_SYMBOL]: () => placeholder
|
|
70
|
-
};
|
|
71
|
-
Object.defineProperty(secret, secretValueSymbol, {
|
|
72
|
-
configurable: false,
|
|
73
|
-
enumerable: false,
|
|
74
|
-
value: () => value,
|
|
75
|
-
writable: false
|
|
76
|
-
});
|
|
77
|
-
return Object.freeze(secret);
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Parse an untrusted management API key before constructing its Secret value.
|
|
81
|
-
*
|
|
82
|
-
* The Secret type protects an already validated value from accidental
|
|
83
|
-
* disclosure; this boundary is what validates the value's wire format.
|
|
84
|
-
*/
|
|
85
|
-
function parseManagementKey(raw) {
|
|
86
|
-
if (typeof raw !== "string" || !raw.startsWith("bld_mgmt_sk_") || raw.length === 12) return err({ kind: "invalid-management-key" });
|
|
87
|
-
return ok(createSecretInternal("management-key", raw));
|
|
88
|
-
}
|
|
89
|
-
//#endregion
|
|
90
|
-
//#region ../core/src/booking-vertical-preset.ts
|
|
91
|
-
const BOOKING_ENGINE_BY_BEHAVIOUR = {
|
|
92
|
-
class: "event_series",
|
|
93
|
-
workshop: "event_series",
|
|
94
|
-
course: "event_series",
|
|
95
|
-
retreat: "event_series",
|
|
96
|
-
performance: "event_series",
|
|
97
|
-
appointment: "appointment_service"
|
|
98
|
-
};
|
|
99
|
-
function verticalBookingPreset(id, verticalId, canonicalBehaviour, label, pluralLabel, description, availability = "onboarding") {
|
|
100
|
-
return {
|
|
101
|
-
id,
|
|
102
|
-
verticalId,
|
|
103
|
-
canonicalBehaviour,
|
|
104
|
-
engine: BOOKING_ENGINE_BY_BEHAVIOUR[canonicalBehaviour],
|
|
105
|
-
availability,
|
|
106
|
-
label,
|
|
107
|
-
pluralLabel,
|
|
108
|
-
description
|
|
109
|
-
};
|
|
110
|
-
}
|
|
111
|
-
//#endregion
|
|
112
|
-
//#region ../core/src/booking-vertical-definitions.ts
|
|
113
|
-
const VERTICAL_DEFINITIONS = [
|
|
114
|
-
{
|
|
115
|
-
id: "yoga_wellness",
|
|
116
|
-
label: "Yoga, meditation or mindfulness",
|
|
117
|
-
description: "Yoga studios, wellness teachers, and movement practitioners."
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
id: "fitness_pt",
|
|
121
|
-
label: "Fitness and personal training",
|
|
122
|
-
description: "Personal trainers, group training, and fitness programmes."
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
id: "dance_school",
|
|
126
|
-
label: "Dance school",
|
|
127
|
-
description: "Dance classes, courses or terms, workshops, private lessons, and shows."
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
id: "physiotherapy_physical_health",
|
|
131
|
-
label: "Physiotherapy & physical health",
|
|
132
|
-
description: "Physiotherapists, chiropractors, osteopaths, sports therapists, and rehabilitation practitioners."
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: "massage_bodywork",
|
|
136
|
-
label: "Massage & bodywork",
|
|
137
|
-
description: "Massage therapists, bodyworkers, and somatic practitioners."
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
id: "therapist_practitioner",
|
|
141
|
-
label: "Therapist or practitioner",
|
|
142
|
-
description: "Appointments, sessions, consultations, and occasional group work."
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
id: "beauty_spa",
|
|
146
|
-
label: "Beauty or spa",
|
|
147
|
-
description: "Treatment-led businesses with optional workshops."
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
id: "consultant_coach",
|
|
151
|
-
label: "Consultant or coach",
|
|
152
|
-
description: "One-to-one calls, workshops, courses, and retreats."
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
id: "training_provider",
|
|
156
|
-
label: "Training provider",
|
|
157
|
-
description: "Courses, workshops, classes, appointments, and residential training."
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
id: "retreat_centre",
|
|
161
|
-
label: "Retreat centre",
|
|
162
|
-
description: "Residential retreats, workshops, classes, courses, and private sessions."
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
id: "music_school",
|
|
166
|
-
label: "Music teacher or school",
|
|
167
|
-
description: "Lessons, classes, terms, workshops, and performances."
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
id: "voice_singing",
|
|
171
|
-
label: "Voice & Singing",
|
|
172
|
-
description: "Singing lessons, choirs, voice circles, workshops, and performances."
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
id: "performing_arts_school",
|
|
176
|
-
label: "Theatre or performing arts school",
|
|
177
|
-
description: "Classes, terms, workshops, performances, and lessons."
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
id: "community_wellbeing",
|
|
181
|
-
label: "Community or wellbeing centre",
|
|
182
|
-
description: "Groups, workshops, courses, appointments, and retreats."
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
id: "venue_event_space",
|
|
186
|
-
label: "Venue or event space",
|
|
187
|
-
description: "Room, resource, or access bookings. Depends on the future capacity-booking domain."
|
|
188
|
-
}
|
|
189
|
-
];
|
|
190
|
-
VERTICAL_DEFINITIONS.map(({ id }) => id);
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region ../core/src/booking-vertical-catalog.ts
|
|
193
|
-
const VERTICAL_BOOKING_PRESETS = [
|
|
194
|
-
verticalBookingPreset("yoga_wellness.classes", "yoga_wellness", "class", "Class", "Classes", "Regular scheduled classes and group sessions."),
|
|
195
|
-
verticalBookingPreset("yoga_wellness.workshops", "yoga_wellness", "workshop", "Workshop", "Workshops", "One-off workshops, day retreats, or special sessions."),
|
|
196
|
-
verticalBookingPreset("yoga_wellness.courses", "yoga_wellness", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups."),
|
|
197
|
-
verticalBookingPreset("yoga_wellness.retreats", "yoga_wellness", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats and immersive experiences."),
|
|
198
|
-
verticalBookingPreset("yoga_wellness.appointments", "yoga_wellness", "appointment", "Appointment", "Appointments", "Private sessions, consultations, or one-to-one support."),
|
|
199
|
-
verticalBookingPreset("fitness_pt.group_training", "fitness_pt", "class", "Group training", "Group training", "Regular scheduled classes and group sessions."),
|
|
200
|
-
verticalBookingPreset("fitness_pt.personal_training", "fitness_pt", "appointment", "Personal training", "Personal training", "One-to-one sessions booked from your availability."),
|
|
201
|
-
verticalBookingPreset("fitness_pt.programmes", "fitness_pt", "course", "Programme", "Programmes", "Multi-session programmes like bootcamps or courses."),
|
|
202
|
-
verticalBookingPreset("fitness_pt.workshops", "fitness_pt", "workshop", "Workshop", "Workshops", "One-off workshops, events, or special sessions."),
|
|
203
|
-
verticalBookingPreset("fitness_pt.retreats", "fitness_pt", "retreat", "Retreat", "Retreats", "Multi-day or residential fitness experiences."),
|
|
204
|
-
verticalBookingPreset("dance_school.classes", "dance_school", "class", "Class", "Classes", "Regular group classes and weekly sessions."),
|
|
205
|
-
{
|
|
206
|
-
...verticalBookingPreset("dance_school.terms", "dance_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
|
|
207
|
-
eventPresetOverride: "term"
|
|
208
|
-
},
|
|
209
|
-
verticalBookingPreset("dance_school.courses", "dance_school", "course", "Course", "Courses", "Fixed-schedule courses or multi-session groups.", "settings"),
|
|
210
|
-
verticalBookingPreset("dance_school.workshops", "dance_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
|
|
211
|
-
verticalBookingPreset("dance_school.private_lessons", "dance_school", "appointment", "Private lesson", "Private lessons", "One-to-one lessons or coaching sessions."),
|
|
212
|
-
verticalBookingPreset("dance_school.shows", "dance_school", "performance", "Show", "Shows", "Ticketed performances, showcases, and recitals."),
|
|
213
|
-
verticalBookingPreset("physiotherapy_physical_health.appointments", "physiotherapy_physical_health", "appointment", "Appointment", "Appointments", "Assessments, treatments, follow-ups, and rehabilitation sessions."),
|
|
214
|
-
verticalBookingPreset("physiotherapy_physical_health.rehab_classes", "physiotherapy_physical_health", "class", "Rehab class", "Rehab classes", "Regular rehabilitation, mobility, strength, or recovery classes."),
|
|
215
|
-
verticalBookingPreset("physiotherapy_physical_health.workshops", "physiotherapy_physical_health", "workshop", "Workshop", "Workshops", "One-off workshops, talks, or practical group sessions."),
|
|
216
|
-
verticalBookingPreset("massage_bodywork.treatments", "massage_bodywork", "appointment", "Treatment", "Treatments", "Massage treatments, bodywork sessions, and one-to-one appointments."),
|
|
217
|
-
verticalBookingPreset("massage_bodywork.group_sessions", "massage_bodywork", "class", "Group session", "Group sessions", "Regular bodywork, somatic movement, or self-massage sessions."),
|
|
218
|
-
verticalBookingPreset("massage_bodywork.workshops", "massage_bodywork", "workshop", "Workshop", "Workshops", "One-off bodywork, self-massage, or somatic practice workshops."),
|
|
219
|
-
verticalBookingPreset("therapist_practitioner.appointments", "therapist_practitioner", "appointment", "Appointment", "Appointments", "Sessions, consultations, treatments, or assessments."),
|
|
220
|
-
verticalBookingPreset("therapist_practitioner.workshops", "therapist_practitioner", "workshop", "Workshop", "Workshops", "One-off group workshops, talks, or wellbeing sessions."),
|
|
221
|
-
verticalBookingPreset("therapist_practitioner.retreats", "therapist_practitioner", "retreat", "Retreat", "Retreats", "Multi-day retreats or immersive group experiences."),
|
|
222
|
-
verticalBookingPreset("beauty_spa.appointments", "beauty_spa", "appointment", "Appointment", "Appointments", "Treatments, consultations, services, and sessions."),
|
|
223
|
-
verticalBookingPreset("beauty_spa.workshops", "beauty_spa", "workshop", "Workshop", "Workshops", "Skincare workshops, makeup lessons, demos, or group events."),
|
|
224
|
-
verticalBookingPreset("consultant_coach.appointments", "consultant_coach", "appointment", "Appointment", "Appointments", "One-to-one calls, consultations, reviews, or coaching sessions."),
|
|
225
|
-
verticalBookingPreset("consultant_coach.workshops", "consultant_coach", "workshop", "Workshop", "Workshops", "One-off group sessions, webinars, or strategy days."),
|
|
226
|
-
verticalBookingPreset("consultant_coach.courses", "consultant_coach", "course", "Course", "Courses", "Fixed-schedule cohorts or multi-session group programmes."),
|
|
227
|
-
verticalBookingPreset("consultant_coach.retreats", "consultant_coach", "retreat", "Retreat", "Retreats", "Multi-day coaching retreats or immersive experiences."),
|
|
228
|
-
verticalBookingPreset("training_provider.courses", "training_provider", "course", "Course", "Courses", "Fixed-schedule courses, cohorts, and multi-session training."),
|
|
229
|
-
verticalBookingPreset("training_provider.workshops", "training_provider", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, and short training sessions."),
|
|
230
|
-
verticalBookingPreset("training_provider.appointments", "training_provider", "appointment", "Appointment", "Appointments", "Consultations, assessments, mentoring, or office hours."),
|
|
231
|
-
verticalBookingPreset("training_provider.classes", "training_provider", "class", "Class", "Classes", "Regular classes, sessions, or groups.", "settings"),
|
|
232
|
-
verticalBookingPreset("training_provider.residentials", "training_provider", "retreat", "Residential", "Residentials", "Residential courses or multi-day training experiences.", "settings"),
|
|
233
|
-
verticalBookingPreset("retreat_centre.retreats", "retreat_centre", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats with richer booking needs."),
|
|
234
|
-
verticalBookingPreset("retreat_centre.workshops", "retreat_centre", "workshop", "Workshop", "Workshops", "One-day retreats, ceremonies, workshops, or special events."),
|
|
235
|
-
verticalBookingPreset("retreat_centre.classes", "retreat_centre", "class", "Class", "Classes", "Regular sessions like guided meditations or group practices."),
|
|
236
|
-
verticalBookingPreset("retreat_centre.courses", "retreat_centre", "course", "Course", "Courses", "Fixed-schedule programmes or multi-session experiences."),
|
|
237
|
-
verticalBookingPreset("retreat_centre.appointments", "retreat_centre", "appointment", "Appointment", "Appointments", "Private sessions, therapies, consultations, or add-ons."),
|
|
238
|
-
verticalBookingPreset("music_school.lessons", "music_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, consultations, or coaching sessions."),
|
|
239
|
-
verticalBookingPreset("music_school.classes", "music_school", "class", "Class", "Classes", "Regular group classes, ensembles, or recurring sessions."),
|
|
240
|
-
{
|
|
241
|
-
...verticalBookingPreset("music_school.terms", "music_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date group courses."),
|
|
242
|
-
eventPresetOverride: "term"
|
|
243
|
-
},
|
|
244
|
-
verticalBookingPreset("music_school.workshops", "music_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
|
|
245
|
-
verticalBookingPreset("music_school.performances", "music_school", "performance", "Performance", "Performances", "Concerts, recitals, showcases, or ticketed performances."),
|
|
246
|
-
verticalBookingPreset("voice_singing.lessons", "voice_singing", "appointment", "Voice session", "Voice sessions", "One-to-one singing lessons, voice coaching, or private practice sessions."),
|
|
247
|
-
verticalBookingPreset("voice_singing.classes", "voice_singing", "class", "Ongoing weekly session", "Ongoing weekly sessions", "Regular choirs, voice circles, community singing, or group practice."),
|
|
248
|
-
{
|
|
249
|
-
...verticalBookingPreset("voice_singing.terms", "voice_singing", "course", "Singing term", "Singing terms", "Multi-week choir terms, voice courses, or fixed-date group programmes."),
|
|
250
|
-
eventPresetOverride: "term"
|
|
251
|
-
},
|
|
252
|
-
verticalBookingPreset("voice_singing.workshops", "voice_singing", "workshop", "Workshop", "Workshops", "One-off singing workshops, voice journeys, or devotional singing sessions."),
|
|
253
|
-
verticalBookingPreset("voice_singing.performances", "voice_singing", "performance", "Performance", "Performances", "Choir concerts, sharing events, recitals, or community performances."),
|
|
254
|
-
verticalBookingPreset("performing_arts_school.classes", "performing_arts_school", "class", "Class", "Classes", "Regular group classes, rehearsals, or weekly sessions."),
|
|
255
|
-
{
|
|
256
|
-
...verticalBookingPreset("performing_arts_school.terms", "performing_arts_school", "course", "Term", "Terms", "Multi-week term blocks or fixed-date course groups."),
|
|
257
|
-
eventPresetOverride: "term"
|
|
258
|
-
},
|
|
259
|
-
verticalBookingPreset("performing_arts_school.workshops", "performing_arts_school", "workshop", "Workshop", "Workshops", "One-off workshops, masterclasses, or intensives."),
|
|
260
|
-
verticalBookingPreset("performing_arts_school.performances", "performing_arts_school", "performance", "Performance", "Performances", "Shows, showcases, productions, or ticketed performances."),
|
|
261
|
-
verticalBookingPreset("performing_arts_school.lessons", "performing_arts_school", "appointment", "Lesson", "Lessons", "One-to-one lessons, coaching, or audition prep."),
|
|
262
|
-
verticalBookingPreset("community_wellbeing.classes", "community_wellbeing", "class", "Class", "Classes", "Regular groups, sessions, practices, or weekly activities."),
|
|
263
|
-
verticalBookingPreset("community_wellbeing.workshops", "community_wellbeing", "workshop", "Workshop", "Workshops", "One-off workshops, talks, events, or gatherings."),
|
|
264
|
-
verticalBookingPreset("community_wellbeing.courses", "community_wellbeing", "course", "Course", "Courses", "Fixed-schedule courses, study groups, or multi-session programmes."),
|
|
265
|
-
verticalBookingPreset("community_wellbeing.appointments", "community_wellbeing", "appointment", "Appointment", "Appointments", "One-to-one appointments, consultations, or support sessions."),
|
|
266
|
-
verticalBookingPreset("community_wellbeing.retreats", "community_wellbeing", "retreat", "Retreat", "Retreats", "Multi-day or residential retreats."),
|
|
267
|
-
verticalBookingPreset("venue_event_space.resource_hire", "venue_event_space", "appointment", "Hire slot", "Hire slots", "Future room, venue, and resource hire bookings.", "future")
|
|
268
|
-
];
|
|
269
|
-
//#endregion
|
|
270
|
-
//#region ../core/src/booking-vertical-config.ts
|
|
271
|
-
const VERTICAL_ID_SET = new Set(VERTICAL_DEFINITIONS.map(({ id }) => id));
|
|
272
|
-
const VERTICAL_PRESET_ID_SET = new Set(VERTICAL_BOOKING_PRESETS.map((presetDefinition) => presetDefinition.id));
|
|
273
|
-
function parseVerticalId(value) {
|
|
274
|
-
return typeof value === "string" && VERTICAL_ID_SET.has(value) ? value : null;
|
|
275
|
-
}
|
|
276
|
-
function parseVerticalPresetId(value) {
|
|
277
|
-
return typeof value === "string" && VERTICAL_PRESET_ID_SET.has(value) ? value : null;
|
|
278
|
-
}
|
|
279
|
-
function getVerticalPresetDefinition(presetId) {
|
|
280
|
-
const definition = VERTICAL_BOOKING_PRESETS.find((presetDefinition) => presetDefinition.id === presetId);
|
|
281
|
-
if (definition === void 0) throw new Error(`Unhandled vertical preset id: ${presetId}`);
|
|
282
|
-
return definition;
|
|
283
|
-
}
|
|
284
|
-
function createConfiguredSiteVerticalBookingConfig(verticalId, selectedPresetIds) {
|
|
285
|
-
return {
|
|
286
|
-
verticalId,
|
|
287
|
-
selectedPresetIds
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
function toNonEmptyVerticalPresetIds(presetIds) {
|
|
291
|
-
const firstPresetId = presetIds[0];
|
|
292
|
-
return firstPresetId ? [firstPresetId, ...presetIds.slice(1)] : null;
|
|
293
|
-
}
|
|
294
|
-
const DEFAULT_SITE_VERTICAL_BOOKING_CONFIG = {
|
|
295
|
-
verticalId: null,
|
|
296
|
-
selectedPresetIds: []
|
|
297
|
-
};
|
|
298
|
-
function appendUniqueIssue(issues, issue) {
|
|
299
|
-
return issues.some((existing) => existing.code === issue.code) ? issues : [...issues, issue];
|
|
300
|
-
}
|
|
301
|
-
function collectRawConfigIssues(rawConfig, config) {
|
|
302
|
-
const rawPresetValue = rawConfig.selectedPresetIds;
|
|
303
|
-
const rawPresetIds = Array.isArray(rawPresetValue) ? rawPresetValue : [];
|
|
304
|
-
let issues = [];
|
|
305
|
-
if (rawConfig.verticalId != null && config.verticalId === null) issues = appendUniqueIssue(issues, {
|
|
306
|
-
code: "unknown_vertical",
|
|
307
|
-
rawValue: rawConfig.verticalId
|
|
308
|
-
});
|
|
309
|
-
if (config.verticalId === null && config.selectedPresetIds.length > 0) issues = appendUniqueIssue(issues, { code: "missing_vertical" });
|
|
310
|
-
if (rawPresetValue !== void 0 && !Array.isArray(rawPresetValue) || rawPresetIds.some((presetId) => parseVerticalPresetId(presetId) === null)) issues = appendUniqueIssue(issues, {
|
|
311
|
-
code: "unknown_preset",
|
|
312
|
-
rawValue: rawPresetValue
|
|
313
|
-
});
|
|
314
|
-
if (rawConfig.verticalId != null && config.selectedPresetIds.length === 0) issues = appendUniqueIssue(issues, { code: "empty_selected_presets" });
|
|
315
|
-
return issues;
|
|
316
|
-
}
|
|
317
|
-
function collectPresetConfigIssues(config) {
|
|
318
|
-
const seenPresetIds = /* @__PURE__ */ new Set();
|
|
319
|
-
const seenBehaviours = /* @__PURE__ */ new Set();
|
|
320
|
-
let issues = [];
|
|
321
|
-
for (const presetId of config.selectedPresetIds) {
|
|
322
|
-
const presetDefinition = getVerticalPresetDefinition(presetId);
|
|
323
|
-
if (seenPresetIds.has(presetId)) issues = appendUniqueIssue(issues, { code: "duplicate_preset_id" });
|
|
324
|
-
seenPresetIds.add(presetId);
|
|
325
|
-
if (config.verticalId !== null && presetDefinition.verticalId !== config.verticalId) issues = appendUniqueIssue(issues, { code: "preset_vertical_mismatch" });
|
|
326
|
-
if (presetDefinition.availability === "future") issues = appendUniqueIssue(issues, { code: "future_preset_selected" });
|
|
327
|
-
if (seenBehaviours.has(presetDefinition.canonicalBehaviour)) issues = appendUniqueIssue(issues, { code: "duplicate_canonical_behaviour" });
|
|
328
|
-
seenBehaviours.add(presetDefinition.canonicalBehaviour);
|
|
329
|
-
}
|
|
330
|
-
return issues;
|
|
331
|
-
}
|
|
332
|
-
function getSiteVerticalConfigIssues(rawConfig, config) {
|
|
333
|
-
let issues = collectRawConfigIssues(rawConfig, config);
|
|
334
|
-
for (const issue of collectPresetConfigIssues(config)) issues = appendUniqueIssue(issues, issue);
|
|
335
|
-
return issues;
|
|
336
|
-
}
|
|
337
|
-
function resolveSiteVerticalBookingConfig(rawConfig) {
|
|
338
|
-
if (rawConfig == null) return {
|
|
339
|
-
kind: "unconfigured",
|
|
340
|
-
config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
|
|
341
|
-
};
|
|
342
|
-
const verticalId = parseVerticalId(rawConfig.verticalId);
|
|
343
|
-
const selectedPresetIds = (Array.isArray(rawConfig.selectedPresetIds) ? rawConfig.selectedPresetIds : []).map(parseVerticalPresetId).filter((presetId) => Boolean(presetId));
|
|
344
|
-
const config = {
|
|
345
|
-
verticalId,
|
|
346
|
-
selectedPresetIds
|
|
347
|
-
};
|
|
348
|
-
if (rawConfig.verticalId == null && selectedPresetIds.length === 0) return {
|
|
349
|
-
kind: "unconfigured",
|
|
350
|
-
config: DEFAULT_SITE_VERTICAL_BOOKING_CONFIG
|
|
351
|
-
};
|
|
352
|
-
const issues = getSiteVerticalConfigIssues(rawConfig, config);
|
|
353
|
-
if (issues.length > 0) return {
|
|
354
|
-
kind: "invalid",
|
|
355
|
-
config,
|
|
356
|
-
issues
|
|
357
|
-
};
|
|
358
|
-
const nonEmptyPresetIds = toNonEmptyVerticalPresetIds(selectedPresetIds);
|
|
359
|
-
const configuredConfig = verticalId !== null && nonEmptyPresetIds !== null ? createConfiguredSiteVerticalBookingConfig(verticalId, nonEmptyPresetIds) : null;
|
|
360
|
-
if (configuredConfig === null) return {
|
|
361
|
-
kind: "invalid",
|
|
362
|
-
config,
|
|
363
|
-
issues: [{ code: "empty_selected_presets" }]
|
|
364
|
-
};
|
|
365
|
-
return {
|
|
366
|
-
kind: "configured",
|
|
367
|
-
config: configuredConfig,
|
|
368
|
-
selectedPresets: configuredConfig.selectedPresetIds.map(getVerticalPresetDefinition)
|
|
369
|
-
};
|
|
370
|
-
}
|
|
371
|
-
//#endregion
|
|
372
|
-
//#region ../blocks/src/system/data/selectBlockContent.ts
|
|
373
|
-
/** Canonical admitted content: legacy publishedContent never selects a version. */
|
|
374
|
-
function selectBlockContent(block, stage = "published") {
|
|
375
|
-
const source = stage === "preview" && block.draftContent ? block.draftContent : block.content;
|
|
376
|
-
return isObjectRecord(source) ? stripStaleTransitionStyleGroup(source) : {};
|
|
377
|
-
}
|
|
378
|
-
//#endregion
|
|
379
|
-
//#region ../blocks/src/system/manifest/variantKey.ts
|
|
380
|
-
/** Parse stored content only; defaults belong to resolveEffectiveArrangement. */
|
|
381
|
-
function parseStoredVariant(manifest, content) {
|
|
382
|
-
const variants = manifest.variants;
|
|
383
|
-
const key = [content.variant, content.layout].find((value) => typeof value === "string" && Boolean(variants && Object.prototype.hasOwnProperty.call(variants, value)));
|
|
384
|
-
return key ? {
|
|
385
|
-
kind: "explicit",
|
|
386
|
-
key: asLayoutVariantKey(key)
|
|
387
|
-
} : { kind: "absent" };
|
|
388
|
-
}
|
|
389
|
-
//#endregion
|
|
390
|
-
//#region ../blocks/src/pageRenderAdmission.ts
|
|
391
|
-
function presentPublicBlock(block) {
|
|
392
|
-
const metadata = {
|
|
393
|
-
id: block.id,
|
|
394
|
-
kind: block.kind,
|
|
395
|
-
purpose: block.purpose,
|
|
396
|
-
...block.contentVersionId ? { contentVersionId: block.contentVersionId } : {},
|
|
397
|
-
...block.draftContentId !== void 0 ? { draftContentId: block.draftContentId } : {},
|
|
398
|
-
publishedPlacement: block.publishedPlacement,
|
|
399
|
-
...block.bindings ? { bindings: block.bindings } : {}
|
|
400
|
-
};
|
|
401
|
-
return block.admission.kind === "renderable" ? {
|
|
402
|
-
...metadata,
|
|
403
|
-
content: block.admission.content,
|
|
404
|
-
presentationAdmission: { kind: "renderable" }
|
|
405
|
-
} : {
|
|
406
|
-
...metadata,
|
|
407
|
-
presentationAdmission: {
|
|
408
|
-
kind: "invalid",
|
|
409
|
-
error: block.admission.error
|
|
410
|
-
}
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
function presentEditorBlock(block) {
|
|
414
|
-
return {
|
|
415
|
-
...block,
|
|
416
|
-
presentationAdmission: { kind: "editor" }
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
function createPresentationPageReader() {
|
|
420
|
-
const readBlock = memoizePresentationBlock(presentPublicBlock);
|
|
421
|
-
return (page) => page ? {
|
|
422
|
-
...page,
|
|
423
|
-
blocks: page.blocks.map(readBlock)
|
|
424
|
-
} : null;
|
|
425
|
-
}
|
|
426
|
-
function createEditorPresentationPageReader() {
|
|
427
|
-
const readBlock = memoizePresentationBlock(presentEditorBlock);
|
|
428
|
-
return (page) => page ? {
|
|
429
|
-
...page,
|
|
430
|
-
blocks: page.blocks.map(readBlock)
|
|
431
|
-
} : null;
|
|
432
|
-
}
|
|
433
|
-
function memoizePresentationBlock(present) {
|
|
434
|
-
const blocks = /* @__PURE__ */ new WeakMap();
|
|
435
|
-
return (block) => {
|
|
436
|
-
const cached = blocks.get(block);
|
|
437
|
-
if (cached) return cached;
|
|
438
|
-
const presentation = present(block);
|
|
439
|
-
blocks.set(block, presentation);
|
|
440
|
-
return presentation;
|
|
441
|
-
};
|
|
442
|
-
}
|
|
443
|
-
//#endregion
|
|
444
|
-
//#region ../blocks/src/system/customize/arrangementKnobs.ts
|
|
445
|
-
/**
|
|
446
|
-
* Content stage for knobs, shared by the renderer and the editor so what the
|
|
447
|
-
* options show and what renders can't disagree. Knob buffets are the block's
|
|
448
|
-
* customise facets; the Look exposes, forces or narrows them and the style's
|
|
449
|
-
* offer can only remove or narrow further.
|
|
450
|
-
*/
|
|
451
|
-
function resolveArrangementKnobs(input) {
|
|
452
|
-
const length = input.blockKind === "block.hero" ? resolveHeroTitleLength({ ...input.content }, "look") : null;
|
|
453
|
-
const exposure = arrangementKnobExposure(input.blockKind, input.look, length, storedSplitPhotoSide(input.blockKind, input.content));
|
|
454
|
-
return {
|
|
455
|
-
length,
|
|
456
|
-
exposure,
|
|
457
|
-
knobs: resolveEffectiveKnobs({
|
|
458
|
-
exposure,
|
|
459
|
-
content: normalizedHeadlinePreference(input.content)
|
|
460
|
-
})
|
|
461
|
-
};
|
|
462
|
-
}
|
|
463
|
-
function arrangementKnobExposure(blockKind, look, length, splitPhotoSide) {
|
|
464
|
-
return systemCustomizeFacetDefinitionsForBlock(blockKind).flatMap((facet) => {
|
|
465
|
-
if (facet.knob === void 0 || facet.target.kind !== "content-field") return [];
|
|
466
|
-
const id = facet.target.field;
|
|
467
|
-
const defaults = look.look.structure.knobDefaults ?? {};
|
|
468
|
-
const storedDefault = id === "imagePosition" ? splitPhotoSide : null;
|
|
469
|
-
return [{
|
|
470
|
-
definition: {
|
|
471
|
-
id,
|
|
472
|
-
defaultValue: defaults[id] ?? storedDefault ?? facet.defaultValue,
|
|
473
|
-
values: facet.values.map((value) => value.value),
|
|
474
|
-
...knobKindMetadata(facet.knob)
|
|
475
|
-
},
|
|
476
|
-
exposed: exposedKnobIds(look).includes(id),
|
|
477
|
-
forced: look.look.structure.forcedKnobs?.[id],
|
|
478
|
-
lookValues: look.look.structure.knobValues?.[id],
|
|
479
|
-
styleValues: look.knobValues[id],
|
|
480
|
-
lengthValues: id === "titleSize" ? headlineAllowedValues(length) : void 0
|
|
481
|
-
}];
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
/**
|
|
485
|
-
* A hero stored as "Split, photo on the left" or "Split, photo on the right"
|
|
486
|
-
* already says which side its photo is on. Under a Look that side is the Photo
|
|
487
|
-
* side default, so the photo stays where it was until the owner picks a side.
|
|
488
|
-
*/
|
|
489
|
-
function storedSplitPhotoSide(blockKind, content) {
|
|
490
|
-
if (blockKind !== "block.hero") return null;
|
|
491
|
-
switch (content.variant) {
|
|
492
|
-
case "split": return "left";
|
|
493
|
-
case "splitReverse": return "right";
|
|
494
|
-
default: return null;
|
|
495
|
-
}
|
|
496
|
-
}
|
|
497
|
-
function knobKindMetadata(knob) {
|
|
498
|
-
return knob.kind === "fixed" ? { ordered: knob.ordered } : {
|
|
499
|
-
ordered: false,
|
|
500
|
-
textMaxLength: knob.maxLength
|
|
501
|
-
};
|
|
502
|
-
}
|
|
503
|
-
function headlineAllowedValues(length) {
|
|
504
|
-
switch (length) {
|
|
505
|
-
case "long": return ["quiet"];
|
|
506
|
-
case "medium": return ["quiet", "auto"];
|
|
507
|
-
case "short": return [
|
|
508
|
-
"quiet",
|
|
509
|
-
"auto",
|
|
510
|
-
"display"
|
|
511
|
-
];
|
|
512
|
-
case null: return;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
/** `titleSize` keeps its five stored values; under a Look they read as three steps. */
|
|
516
|
-
function normalizedHeadlinePreference(content) {
|
|
517
|
-
switch (content.titleSize) {
|
|
518
|
-
case "editorial": return {
|
|
519
|
-
...content,
|
|
520
|
-
titleSize: "auto"
|
|
521
|
-
};
|
|
522
|
-
case "poster": return {
|
|
523
|
-
...content,
|
|
524
|
-
titleSize: "display"
|
|
525
|
-
};
|
|
526
|
-
default: return content;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
function exposedKnobIds(look) {
|
|
530
|
-
return [...look.look.structure.knobs, ...look.addKnobs ?? []].filter((id) => !look.removeKnobs.some((removed) => removed === id));
|
|
531
|
-
}
|
|
532
|
-
//#endregion
|
|
533
|
-
//#region ../blocks/src/system/customize/facets.ts
|
|
534
|
-
function defineCustomizeFacet(definition) {
|
|
535
|
-
return definition;
|
|
536
|
-
}
|
|
537
|
-
const eventCalendarListLayoutFacet = defineCustomizeFacet({
|
|
538
|
-
blockKind: "block.event-calendar",
|
|
539
|
-
id: "eventCalendar.listLayout",
|
|
540
|
-
label: "List style",
|
|
541
|
-
legacyOnly: true,
|
|
542
|
-
values: eventCalendarListLayoutOptions.map((option) => ({
|
|
543
|
-
value: option.id,
|
|
544
|
-
label: option.label
|
|
545
|
-
})),
|
|
546
|
-
defaultValue: "stack",
|
|
547
|
-
target: { kind: "event-calendar-list-layout-content" },
|
|
548
|
-
appliesToLayoutVariants: eventCalendarListLayoutCompatibleDisplayModeValues
|
|
549
|
-
});
|
|
550
|
-
const fixedKnob = (blockKind, id, label, values, defaultValue, ordered = false, boolean = false) => ({
|
|
551
|
-
blockKind,
|
|
552
|
-
id,
|
|
553
|
-
label,
|
|
554
|
-
values,
|
|
555
|
-
defaultValue,
|
|
556
|
-
knob: {
|
|
557
|
-
kind: "fixed",
|
|
558
|
-
ordered
|
|
559
|
-
},
|
|
560
|
-
target: {
|
|
561
|
-
kind: "content-field",
|
|
562
|
-
field: id,
|
|
563
|
-
...boolean ? { boolean: true } : {}
|
|
564
|
-
}
|
|
565
|
-
});
|
|
566
|
-
const textKnob = (id, label, maxLength) => ({
|
|
567
|
-
blockKind: "block.hero",
|
|
568
|
-
id,
|
|
569
|
-
label,
|
|
570
|
-
values: [],
|
|
571
|
-
defaultValue: "",
|
|
572
|
-
knob: {
|
|
573
|
-
kind: "text",
|
|
574
|
-
maxLength
|
|
575
|
-
},
|
|
576
|
-
target: {
|
|
577
|
-
kind: "content-field",
|
|
578
|
-
field: id
|
|
579
|
-
}
|
|
580
|
-
});
|
|
581
|
-
const onOff = [{
|
|
582
|
-
value: "true",
|
|
583
|
-
label: "On"
|
|
584
|
-
}, {
|
|
585
|
-
value: "false",
|
|
586
|
-
label: "Off"
|
|
587
|
-
}];
|
|
588
|
-
const columnCounts = [
|
|
589
|
-
{
|
|
590
|
-
value: "2",
|
|
591
|
-
label: "2"
|
|
592
|
-
},
|
|
593
|
-
{
|
|
594
|
-
value: "3",
|
|
595
|
-
label: "3"
|
|
596
|
-
},
|
|
597
|
-
{
|
|
598
|
-
value: "4",
|
|
599
|
-
label: "4"
|
|
600
|
-
}
|
|
601
|
-
];
|
|
602
|
-
const systemCustomizeFacetDefinitions = [
|
|
603
|
-
eventCalendarListLayoutFacet,
|
|
604
|
-
fixedKnob("block.offerings-preview", "dates", "Dates", [{
|
|
605
|
-
value: "summary",
|
|
606
|
-
label: "Summary"
|
|
607
|
-
}, {
|
|
608
|
-
value: "next-dates",
|
|
609
|
-
label: "Next dates"
|
|
610
|
-
}], "summary"),
|
|
611
|
-
{
|
|
612
|
-
...fixedKnob("block.feature-cards", "actionStyle", "Item actions", [{
|
|
613
|
-
value: "button",
|
|
614
|
-
label: "Button"
|
|
615
|
-
}, {
|
|
616
|
-
value: "link",
|
|
617
|
-
label: "Link"
|
|
618
|
-
}], "button"),
|
|
619
|
-
blockKinds: cardListKnobBlocks
|
|
620
|
-
},
|
|
621
|
-
fixedKnob("block.testimonials", "quoteCount", "How many quotes", [
|
|
622
|
-
{
|
|
623
|
-
value: "1",
|
|
624
|
-
label: "1"
|
|
625
|
-
},
|
|
626
|
-
{
|
|
627
|
-
value: "2",
|
|
628
|
-
label: "2"
|
|
629
|
-
},
|
|
630
|
-
{
|
|
631
|
-
value: "3",
|
|
632
|
-
label: "3"
|
|
633
|
-
},
|
|
634
|
-
{
|
|
635
|
-
value: "all",
|
|
636
|
-
label: "All"
|
|
637
|
-
}
|
|
638
|
-
], "3", true),
|
|
639
|
-
fixedKnob("block.testimonials", "tilt", "Tilt the small cards", onOff, "true", false, true),
|
|
640
|
-
{
|
|
641
|
-
...fixedKnob("block.testimonials", "archFrame", "Arch frame", onOff, "true", false, true),
|
|
642
|
-
blockKinds: [
|
|
643
|
-
"block.testimonials",
|
|
644
|
-
"block.newsletter-signup",
|
|
645
|
-
"block.form"
|
|
646
|
-
]
|
|
647
|
-
},
|
|
648
|
-
fixedKnob("block.hero", "candleGlow", "Candle glow", onOff, "true", false, true),
|
|
649
|
-
fixedKnob("block.hero", "columnGuides", "Column guides", onOff, "true", false, true),
|
|
650
|
-
fixedKnob("block.hero", "titleSize", "Headline size", [
|
|
651
|
-
{
|
|
652
|
-
value: "quiet",
|
|
653
|
-
label: "Quieter"
|
|
654
|
-
},
|
|
655
|
-
{
|
|
656
|
-
value: "auto",
|
|
657
|
-
label: "Standard"
|
|
658
|
-
},
|
|
659
|
-
{
|
|
660
|
-
value: "display",
|
|
661
|
-
label: "Louder"
|
|
662
|
-
}
|
|
663
|
-
], "auto", true),
|
|
664
|
-
fixedKnob("block.hero", "imagePosition", "Photo side", [{
|
|
665
|
-
value: "left",
|
|
666
|
-
label: "Left"
|
|
667
|
-
}, {
|
|
668
|
-
value: "right",
|
|
669
|
-
label: "Right"
|
|
670
|
-
}], "right"),
|
|
671
|
-
fixedKnob("block.intro", "imageShape", "Media shape", standardImageShapeOptions, "default"),
|
|
672
|
-
fixedKnob("block.intro", "imagePosition", "Photo side", [{
|
|
673
|
-
value: "left",
|
|
674
|
-
label: "Left"
|
|
675
|
-
}, {
|
|
676
|
-
value: "right",
|
|
677
|
-
label: "Right"
|
|
678
|
-
}], "left"),
|
|
679
|
-
fixedKnob("block.media-text", "imagePosition", "Photo side", [{
|
|
680
|
-
value: "left",
|
|
681
|
-
label: "Left"
|
|
682
|
-
}, {
|
|
683
|
-
value: "right",
|
|
684
|
-
label: "Right"
|
|
685
|
-
}], "left"),
|
|
686
|
-
fixedKnob("block.media-text", "imageShape", "Media shape", standardImageShapeOptions, "default"),
|
|
687
|
-
fixedKnob("block.media-text", "aspectRatio", "Media aspect ratio", standardAspectRatioOptions, "auto"),
|
|
688
|
-
textKnob("stickerLine", "Sticker line", 32),
|
|
689
|
-
textKnob("smallCaption", "Small caption", 24),
|
|
690
|
-
{
|
|
691
|
-
...fixedKnob("block.feature-cards", "showPhotos", "Show photos", onOff, "true", false, true),
|
|
692
|
-
blockKinds: cardListFamilyBlocks
|
|
693
|
-
},
|
|
694
|
-
fixedKnob("block.feature-cards", "columns", "Columns", columnCounts, "3", true),
|
|
695
|
-
fixedKnob("block.image-gallery", "blackAndWhite", "Black and white", onOff, "false", false, true),
|
|
696
|
-
fixedKnob("block.event-calendar", "listColumns", "Columns", columnCounts, "3", true),
|
|
697
|
-
fixedKnob("block.event-calendar", "showPhotos", "Photos", [{
|
|
698
|
-
value: "true",
|
|
699
|
-
label: "Show"
|
|
700
|
-
}, {
|
|
701
|
-
value: "false",
|
|
702
|
-
label: "Hide"
|
|
703
|
-
}], "true", false, true),
|
|
704
|
-
{
|
|
705
|
-
...fixedKnob("block.feature-cards", "cardMarker", "Item markers", [
|
|
706
|
-
{
|
|
707
|
-
value: "icons",
|
|
708
|
-
label: "Icons"
|
|
709
|
-
},
|
|
710
|
-
{
|
|
711
|
-
value: "numbers",
|
|
712
|
-
label: "Numbers"
|
|
713
|
-
},
|
|
714
|
-
{
|
|
715
|
-
value: "none",
|
|
716
|
-
label: "None"
|
|
717
|
-
}
|
|
718
|
-
], "icons"),
|
|
719
|
-
blockKinds: cardListFamilyBlocks
|
|
720
|
-
},
|
|
721
|
-
{
|
|
722
|
-
...fixedKnob("block.event-calendar", "showCapacity", "Places left", onOff, "true", false, true),
|
|
723
|
-
description: "Show how many places are left on each event"
|
|
724
|
-
}
|
|
725
|
-
];
|
|
726
|
-
systemCustomizeFacetDefinitions.map((definition) => definition.id);
|
|
727
|
-
Array.from(new Set(systemCustomizeFacetDefinitions.flatMap((definition) => definition.values.map((option) => option.value))));
|
|
728
|
-
function systemCustomizeFacetDefinitionsForBlock(blockKind) {
|
|
729
|
-
return systemCustomizeFacetDefinitions.filter((definition) => definition.blockKind === blockKind || "blockKinds" in definition && definition.blockKinds?.some((kind) => kind === blockKind));
|
|
730
|
-
}
|
|
731
|
-
//#endregion
|
|
732
|
-
//#region ../blocks/src/system/customize/fieldOwnership.ts
|
|
733
|
-
/**
|
|
734
|
-
* Values with their own owner, whatever their fields are tagged: the Background
|
|
735
|
-
* row and Photo control edit `_sectionStyles`, and the style compiler writes the
|
|
736
|
-
* other style groups (card, container and text-card styles), which the editor
|
|
737
|
-
* already hides on styles with a page design.
|
|
738
|
-
*/
|
|
739
|
-
const dedicatedPaths = ["_sectionStyles", ...themeV2CompilerOwnedFieldNames];
|
|
740
|
-
/**
|
|
741
|
-
* One owner for "does this setting belong to the Look?". The editor form, the
|
|
742
|
-
* renderer's bindings, publish validation and the catalogue all ask here.
|
|
743
|
-
* With no arrangement Look resolved (older styles, recipes, blocks without
|
|
744
|
-
* Looks on a newer style), every field stays with the owner.
|
|
745
|
-
*/
|
|
746
|
-
function resolveFieldOwnership(input) {
|
|
747
|
-
if (!input.arrangementLook) return { kind: "no-look" };
|
|
748
|
-
const knobFields = new Set(systemCustomizeFacetDefinitionsForBlock(input.blockKind).flatMap((facet) => facet.knob && facet.target.kind === "content-field" ? [facet.target.field] : []));
|
|
749
|
-
const meaning = input.manifest.variantMeaning;
|
|
750
|
-
const arrangementField = meaning?.kind === "mode" ? meaning.arrangementField : meaning ? "variant" : null;
|
|
751
|
-
const modeField = meaning?.kind === "mode" ? "variant" : null;
|
|
752
|
-
const paths = /* @__PURE__ */ new Map();
|
|
753
|
-
const dataPaths = /* @__PURE__ */ new Map();
|
|
754
|
-
const visit = (fields, parent, inherited, inRepeaterItem = false) => {
|
|
755
|
-
fields.forEach((field) => {
|
|
756
|
-
const path = parent.schema ? `${parent.schema}.${field.id}` : field.id;
|
|
757
|
-
const flattened = inRepeaterItem && field.type === "group" && field.ui?.flattenInRepeater === true;
|
|
758
|
-
const dataPath = flattened ? parent.data : parent.data ? `${parent.data}.${field.id}` : field.id;
|
|
759
|
-
const owner = ownerOf(field, path, inherited, {
|
|
760
|
-
knobFields,
|
|
761
|
-
arrangementField,
|
|
762
|
-
modeField
|
|
763
|
-
});
|
|
764
|
-
paths.set(path, owner);
|
|
765
|
-
if (!flattened) dataPaths.set(dataPath, owner);
|
|
766
|
-
childFields(field).forEach((children) => visit(children, {
|
|
767
|
-
schema: path,
|
|
768
|
-
data: dataPath
|
|
769
|
-
}, owner, field.type === "repeater"));
|
|
770
|
-
});
|
|
771
|
-
};
|
|
772
|
-
visit(input.manifest.fields ?? [], {
|
|
773
|
-
schema: "",
|
|
774
|
-
data: ""
|
|
775
|
-
}, "owner");
|
|
776
|
-
knobFields.forEach((field) => {
|
|
777
|
-
if (!paths.has(field)) paths.set(field, "knob");
|
|
778
|
-
if (!dataPaths.has(field)) dataPaths.set(field, "knob");
|
|
779
|
-
});
|
|
780
|
-
return {
|
|
781
|
-
kind: "look",
|
|
782
|
-
paths,
|
|
783
|
-
dataPaths
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
new Set(arrangementAppearancePresets.flatMap((preset) => preset.blockKinds));
|
|
787
|
-
/** Content paths with a given owner, for the renderer, outermost first. */
|
|
788
|
-
function contentPathsOwnedBy(ownership, owners) {
|
|
789
|
-
return ownership.kind === "no-look" ? [] : outermost(ownership.dataPaths, owners);
|
|
790
|
-
}
|
|
791
|
-
function outermost(paths, owners) {
|
|
792
|
-
const matching = [...paths].filter(([, owner]) => owners.includes(owner)).map(([path]) => path);
|
|
793
|
-
return matching.filter((path) => !matching.some((other) => path.startsWith(`${other}.`)));
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* Content with the owner's values for Look-owned paths taken out, so nothing
|
|
797
|
-
* that renders the block (bindings, views, media delivery) can read them.
|
|
798
|
-
*/
|
|
799
|
-
function withoutLookOwnedContent(content, paths) {
|
|
800
|
-
return paths.reduce((current, path) => withoutPath(current, path.split(".")), { ...content });
|
|
801
|
-
}
|
|
802
|
-
function withoutPath(value, [key, ...rest]) {
|
|
803
|
-
if (key === void 0 || !(key in value)) return { ...value };
|
|
804
|
-
if (rest.length === 0) return Object.fromEntries(Object.entries(value).filter(([entry]) => entry !== key));
|
|
805
|
-
const child = value[key];
|
|
806
|
-
const stripped = Array.isArray(child) ? child.map((item) => isContentRecord(item) ? withoutPath(item, rest) : item) : isContentRecord(child) ? withoutPath(child, rest) : child;
|
|
807
|
-
return {
|
|
808
|
-
...value,
|
|
809
|
-
[key]: stripped
|
|
810
|
-
};
|
|
811
|
-
}
|
|
812
|
-
function isContentRecord(value) {
|
|
813
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
814
|
-
}
|
|
815
|
-
function ownerOf(field, path, inherited, facts) {
|
|
816
|
-
return inheritedOwner(path, inherited) ?? lookSectionOwner(field, path, facts) ?? keptByOwner(field, path, facts) ?? intentOwner(field, inherited);
|
|
817
|
-
}
|
|
818
|
-
/** Below a dedicated or Look-owned container, everything goes with it. */
|
|
819
|
-
function inheritedOwner(path, inherited) {
|
|
820
|
-
if (inherited === "dedicated" || dedicatedPaths.includes(path)) return "dedicated";
|
|
821
|
-
return inherited === "look" ? "look" : null;
|
|
822
|
-
}
|
|
823
|
-
function lookSectionOwner(field, path, facts) {
|
|
824
|
-
if (!path.includes(".") && facts.knobFields.has(path)) return "knob";
|
|
825
|
-
if (field.ui?.hidden === true || field.ui?.renderInHeader === true) return "dedicated";
|
|
826
|
-
return path === facts.arrangementField ? "arrangement" : null;
|
|
827
|
-
}
|
|
828
|
-
function keptByOwner(field, path, facts) {
|
|
829
|
-
return path === facts.modeField || field.ui?.underLooks === "owner" ? "owner" : null;
|
|
830
|
-
}
|
|
831
|
-
function intentOwner(field, inherited) {
|
|
832
|
-
switch (field.ui?.intent) {
|
|
833
|
-
case "display":
|
|
834
|
-
case "style": return "look";
|
|
835
|
-
case "content":
|
|
836
|
-
case "behavior": return "owner";
|
|
837
|
-
case void 0: return inherited;
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
function childFields(field) {
|
|
841
|
-
if (field.type === "group" || field.type === "modal") return [field.schema.fields];
|
|
842
|
-
if (field.type === "repeater") return [field.schema?.fields ?? [], ...Object.values(field.itemTypes ?? {}).map((item) => item.fields)];
|
|
843
|
-
if (field.type === "tabGroup") return field.tabs.map((tab) => tab.fields);
|
|
844
|
-
return [];
|
|
845
|
-
}
|
|
846
|
-
//#endregion
|
|
847
|
-
//#region ../blocks/src/system/transforms/registry/offeringsPreview.ts
|
|
848
|
-
/** Reuse the existing occurrence read for the date strip and card date rows. */
|
|
849
|
-
const offeringsPreviewDatesReadEnabled = {
|
|
850
|
-
id: "events.offeringsPreviewDatesReadEnabled",
|
|
851
|
-
kind: "formatter",
|
|
852
|
-
summary: "Load one occurrence batch for catalogue dates or next-date cards",
|
|
853
|
-
run(value) {
|
|
854
|
-
const content = asPartialObject(value);
|
|
855
|
-
const dates = asPartialObject(asPartialObject(content?._effectiveKnobs)?.dates);
|
|
856
|
-
return content?.displayMode === "catalogue" || dates?.value === "next-dates";
|
|
857
|
-
}
|
|
858
|
-
};
|
|
859
|
-
//#endregion
|
|
860
|
-
//#region ../blocks/src/system/helpers/backgroundMedia.ts
|
|
861
|
-
function resolveBackgroundMedia(input) {
|
|
862
|
-
const parsedMedia = runtimeMediaSchema.safeParse(input.image);
|
|
863
|
-
if (!parsedMedia.success) return null;
|
|
864
|
-
switch (parsedMedia.data.type) {
|
|
865
|
-
case "image":
|
|
866
|
-
case "video": return {
|
|
867
|
-
...parsedMedia.data,
|
|
868
|
-
type: parsedMedia.data.type
|
|
869
|
-
};
|
|
870
|
-
case "audio":
|
|
871
|
-
case "document":
|
|
872
|
-
case "spreadsheet":
|
|
873
|
-
case "archive": return null;
|
|
874
|
-
}
|
|
875
|
-
}
|
|
876
|
-
function backgroundVideoMobileClassNames(input) {
|
|
877
|
-
if (resolveBackgroundMedia(input)?.type !== "video") return "";
|
|
878
|
-
return input.showVideoOnMobile === true ? "" : "rb-hidden rb-md-block";
|
|
879
|
-
}
|
|
880
|
-
//#endregion
|
|
881
|
-
//#region ../blocks/src/system/transforms/registry/background.ts
|
|
882
|
-
const isString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
883
|
-
const isNumber = (value) => typeof value === "number" && !isNaN(value);
|
|
884
|
-
function backgroundMotionClassNames(input) {
|
|
885
|
-
return input.motion === "fixed-frame" ? "rb-bg-motion-fixed-frame" : "";
|
|
886
|
-
}
|
|
887
|
-
function appendBackgroundMediaClasses(baseClassName, input) {
|
|
888
|
-
return [
|
|
889
|
-
baseClassName,
|
|
890
|
-
backgroundMotionClassNames(input),
|
|
891
|
-
backgroundVideoMobileClassNames(input)
|
|
892
|
-
].filter(Boolean).join(" ");
|
|
893
|
-
}
|
|
894
|
-
function gradientPresetCss(value) {
|
|
895
|
-
const presetId = parseGradientPresetId(value);
|
|
896
|
-
if (!presetId) return null;
|
|
897
|
-
const preset = getGradientPreset(presetId);
|
|
898
|
-
return gradientToCss(preset, Object.fromEntries(preset.stops.map((stop) => [stop.color, `rgb(var(--tb-${stop.color}))`])));
|
|
899
|
-
}
|
|
900
|
-
const backgroundTransforms = [
|
|
901
|
-
{
|
|
902
|
-
id: "background.resolveMedia",
|
|
903
|
-
kind: "formatter",
|
|
904
|
-
summary: "Resolve media only from a canonical image or video background",
|
|
905
|
-
run: (value) => parseMediaBackground(value)?.image ?? null
|
|
906
|
-
},
|
|
907
|
-
{
|
|
908
|
-
id: "background.resolveStyle",
|
|
909
|
-
kind: "formatter",
|
|
910
|
-
summary: "Resolve inline styles for background color/gradient layers",
|
|
911
|
-
run: (value, options, context) => {
|
|
912
|
-
const fallbackToken = options?.fallbackToken;
|
|
913
|
-
return resolveBackgroundLayerStyle(value, fallbackToken, context);
|
|
914
|
-
}
|
|
915
|
-
},
|
|
916
|
-
{
|
|
917
|
-
id: "background.resolveColorsStyle",
|
|
918
|
-
kind: "formatter",
|
|
919
|
-
summary: "Resolve surface foreground colors from a background object into scoped CSS vars",
|
|
920
|
-
run: (value, options, context) => asPartialObject(options)?.arrangementInherits === true && context.data?._lookSlots !== void 0 ? {} : resolveSurfaceForegroundStyles(value, context)
|
|
921
|
-
},
|
|
922
|
-
{
|
|
923
|
-
id: "background.resolveFrameClassName",
|
|
924
|
-
kind: "formatter",
|
|
925
|
-
summary: "Resolve clipping on a decorative background frame without clipping foreground content",
|
|
926
|
-
run: (value, options) => {
|
|
927
|
-
const baseClass = options?.baseClass?.trim() ?? "";
|
|
928
|
-
const input = parseMediaBackground(value);
|
|
929
|
-
if (!input) return `${baseClass} rb-overflow-hidden`.trim();
|
|
930
|
-
if (input.overflow === true) return `${baseClass} rb-overflow-visible`.trim();
|
|
931
|
-
const objectFit = input.objectFit ?? null;
|
|
932
|
-
const scale = isString(input.scale) ? input.scale.trim() : isNumber(input.scale) ? String(input.scale) : null;
|
|
933
|
-
return `${baseClass} ${Boolean((objectFit === "custom" || objectFit === "original") && scale && scale.trim().length > 0) ? "rb-overflow-visible" : "rb-overflow-hidden"}`.trim();
|
|
934
|
-
}
|
|
935
|
-
},
|
|
936
|
-
{
|
|
937
|
-
id: "background.resolveImageStyle",
|
|
938
|
-
kind: "formatter",
|
|
939
|
-
summary: "Resolve inline styles for background image elements",
|
|
940
|
-
run: (value, _options, _context) => {
|
|
941
|
-
const input = parseMediaBackground(value);
|
|
942
|
-
if (!input) return {};
|
|
943
|
-
const objectFit = input.objectFit ?? null;
|
|
944
|
-
const opacity = input.opacity ?? null;
|
|
945
|
-
const position = isString(input.position) ? input.position.trim() : null;
|
|
946
|
-
let scaleValue = null;
|
|
947
|
-
if (objectFit === "custom" || objectFit === "original") {
|
|
948
|
-
if (isString(input.scale)) {
|
|
949
|
-
const scaleStr = input.scale.trim();
|
|
950
|
-
if (scaleStr) if (/\d+(%|px|vh|vw|rem|em)$/.test(scaleStr)) scaleValue = scaleStr;
|
|
951
|
-
else {
|
|
952
|
-
const num = parseFloat(scaleStr);
|
|
953
|
-
if (!isNaN(num)) scaleValue = `${num}%`;
|
|
954
|
-
}
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
const style = {};
|
|
958
|
-
switch (objectFit) {
|
|
959
|
-
case "fill":
|
|
960
|
-
case null:
|
|
961
|
-
style.objectFit = "cover";
|
|
962
|
-
break;
|
|
963
|
-
case "fit":
|
|
964
|
-
style.objectFit = "contain";
|
|
965
|
-
break;
|
|
966
|
-
case "original":
|
|
967
|
-
case "custom":
|
|
968
|
-
style.objectFit = "none";
|
|
969
|
-
break;
|
|
970
|
-
}
|
|
971
|
-
if (opacity !== null) style.opacity = String(opacity);
|
|
972
|
-
if (scaleValue) {
|
|
973
|
-
style.width = scaleValue;
|
|
974
|
-
style.height = scaleValue;
|
|
975
|
-
}
|
|
976
|
-
if (position && !BACKGROUND_POSITION_PRESET_VALUES.includes(position)) style.objectPosition = position;
|
|
977
|
-
const backgroundMedia = resolveBackgroundMedia(input);
|
|
978
|
-
if (backgroundMedia) {
|
|
979
|
-
const mergedStyle = computeMediaTransformStyle(backgroundMedia, style);
|
|
980
|
-
if (mergedStyle) Object.assign(style, mergedStyle);
|
|
981
|
-
}
|
|
982
|
-
return style;
|
|
983
|
-
}
|
|
984
|
-
},
|
|
985
|
-
{
|
|
986
|
-
id: "background.resolveImageClassName",
|
|
987
|
-
kind: "string",
|
|
988
|
-
summary: "Resolve className for background image based on objectFit, scale and position",
|
|
989
|
-
run: (value, options, _context) => {
|
|
990
|
-
const baseClass = options?.baseClass ?? "rb-absolute rb-z-neg-10";
|
|
991
|
-
const input = parseMediaBackground(value);
|
|
992
|
-
if (!input) return `${baseClass} rb-inset-0 rb-h-full rb-w-full`;
|
|
993
|
-
const objectFit = input.objectFit ?? null;
|
|
994
|
-
const position = isString(input.position) ? input.position.trim() : null;
|
|
995
|
-
if (objectFit === "fill" || objectFit === "fit" || objectFit === null) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full rb-object-${objectFit === "fit" ? "contain" : "cover"}`, input);
|
|
996
|
-
let needsAnchoring = false;
|
|
997
|
-
if (objectFit === "custom" || objectFit === "original") {
|
|
998
|
-
if (isString(input.scale)) {
|
|
999
|
-
if (input.scale.trim()) needsAnchoring = true;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
if (!needsAnchoring) return appendBackgroundMediaClasses(`${baseClass} rb-inset-0 rb-h-full rb-w-full`, input);
|
|
1003
|
-
const isPreset = position && BACKGROUND_POSITION_PRESET_VALUES.includes(position);
|
|
1004
|
-
if (position && !isPreset) return appendBackgroundMediaClasses(baseClass, input);
|
|
1005
|
-
return appendBackgroundMediaClasses(`${baseClass} ${getAnchorClasses(position)}`, input);
|
|
1006
|
-
}
|
|
1007
|
-
},
|
|
1008
|
-
{
|
|
1009
|
-
id: "background.resolveOverlayStyle",
|
|
1010
|
-
kind: "formatter",
|
|
1011
|
-
summary: "Resolve inline styles for background overlay",
|
|
1012
|
-
run: (value, _options, context) => {
|
|
1013
|
-
const input = parseBackgroundOverlay(value);
|
|
1014
|
-
if (!input || input.type === "none") return {};
|
|
1015
|
-
const color = input.type === "color" && isString(input.color) ? input.color.trim() : null;
|
|
1016
|
-
const gradient = input.type === "gradient" && isString(input.gradient) ? input.gradient.trim() : null;
|
|
1017
|
-
const opacity = input.opacity ?? null;
|
|
1018
|
-
const style = {};
|
|
1019
|
-
if (input.type === "color" && color) style.backgroundColor = context?.theme?.palette?.[color] ?? color;
|
|
1020
|
-
if (input.type === "gradient" && gradient) style.backgroundImage = gradient;
|
|
1021
|
-
if (opacity !== null) style.opacity = String(opacity);
|
|
1022
|
-
return style;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
];
|
|
1026
|
-
function parseMediaBackground(value) {
|
|
1027
|
-
const background = parseRuntimeBackgroundContent(value);
|
|
1028
|
-
return background?.type === "image" || background?.type === "video" ? background : null;
|
|
1029
|
-
}
|
|
1030
|
-
function resolveBackgroundLayerStyle(value, fallbackToken, context) {
|
|
1031
|
-
const background = parseRuntimeBackgroundContent(value);
|
|
1032
|
-
const style = {};
|
|
1033
|
-
const gradient = background?.type === "gradient" ? isString(background.gradient) ? background.gradient.trim() : gradientPresetCss(background.gradientPresetId) : null;
|
|
1034
|
-
const color = background?.type === "color" && isString(background.color) ? background.color.trim() : null;
|
|
1035
|
-
const resolvedColor = color ? resolveBackgroundColorValue(color, context) : !gradient && isString(fallbackToken) ? resolveBackgroundColorValue(fallbackToken.trim(), context) : null;
|
|
1036
|
-
if (resolvedColor) style.backgroundColor = resolvedColor;
|
|
1037
|
-
if (gradient) style.backgroundImage = gradient;
|
|
1038
|
-
const opacity = backgroundMediaOpacity(background);
|
|
1039
|
-
if (opacity !== null) style.opacity = String(opacity);
|
|
1040
|
-
return style;
|
|
1041
|
-
}
|
|
1042
|
-
function backgroundMediaOpacity(background) {
|
|
1043
|
-
return background?.type === "image" || background?.type === "video" ? background.opacity ?? null : null;
|
|
1044
|
-
}
|
|
1045
|
-
//#endregion
|
|
1046
|
-
//#region ../blocks/src/system/links/resolve.ts
|
|
1047
|
-
function resolveRouteTarget(routeIdValue, routes) {
|
|
1048
|
-
return resolveRouteTargetForStage(routeIdValue, routes, "published");
|
|
1049
|
-
}
|
|
1050
|
-
function resolveRouteTargetForStage(routeIdValue, routes, stageInput) {
|
|
1051
|
-
return resolveRouteTargetForStage$1(routeIdValue, routes, stageInput);
|
|
1052
|
-
}
|
|
1053
|
-
function resolvePageRouteTarget(link, context) {
|
|
1054
|
-
if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
|
|
1055
|
-
const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
|
|
1056
|
-
if (existing) return existing;
|
|
1057
|
-
}
|
|
1058
|
-
const identifier = typeof link.identifier === "string" ? link.identifier : null;
|
|
1059
|
-
if (!identifier || !context.pagesByIdentifier) return null;
|
|
1060
|
-
const routeId = context.pagesByIdentifier[identifier];
|
|
1061
|
-
if (!routeId) return null;
|
|
1062
|
-
return resolveRouteTargetForStage(routeId, context.routes, context.stage);
|
|
1063
|
-
}
|
|
1064
|
-
function resolveEntryRouteTarget(link, context) {
|
|
1065
|
-
if (typeof link.routeId === "string" && link.routeId.trim().length > 0) {
|
|
1066
|
-
const existing = resolveRouteTargetForStage(link.routeId, context.routes, context.stage);
|
|
1067
|
-
if (existing) return existing;
|
|
1068
|
-
}
|
|
1069
|
-
const contentType = typeof link.contentType === "string" ? link.contentType : null;
|
|
1070
|
-
const identifier = typeof link.identifier === "string" ? link.identifier : null;
|
|
1071
|
-
if (!contentType || !identifier || !context.entriesByIdentifier) return null;
|
|
1072
|
-
const entryMap = context.entriesByIdentifier[contentType];
|
|
1073
|
-
if (!entryMap) return null;
|
|
1074
|
-
const routeId = entryMap[identifier];
|
|
1075
|
-
if (!routeId) return null;
|
|
1076
|
-
return resolveRouteTargetForStage(routeId, context.routes, context.stage);
|
|
1077
|
-
}
|
|
1078
|
-
function resolveFallbackHref(link) {
|
|
1079
|
-
if (typeof link.href !== "string") return null;
|
|
1080
|
-
const href = link.href.trim();
|
|
1081
|
-
return href.length > 0 ? href : null;
|
|
1082
|
-
}
|
|
1083
|
-
//#endregion
|
|
1084
|
-
//#region ../blocks/src/system/transforms/registry/links.ts
|
|
1085
|
-
/** Resolve internal link via routeId lookup, falling back to href */
|
|
1086
|
-
function resolveInternalLink(link, context) {
|
|
1087
|
-
const resolved = resolveRouteFromMap(link.routeId, context);
|
|
1088
|
-
if (resolved) return resolved;
|
|
1089
|
-
return resolveFallbackHref(link);
|
|
1090
|
-
}
|
|
1091
|
-
function resolveRouteFromMap(routeIdValue, context) {
|
|
1092
|
-
return resolveRouteTargetForStage(routeIdValue, context.routes, context.stage)?.href ?? null;
|
|
1093
|
-
}
|
|
1094
|
-
/** Resolve page identifier link via pagesByIdentifier lookup */
|
|
1095
|
-
function resolvePageLink(link, context) {
|
|
1096
|
-
const resolved = resolvePageRouteTarget(link, context);
|
|
1097
|
-
if (resolved) return resolved.href;
|
|
1098
|
-
return resolveFallbackHref(link);
|
|
1099
|
-
}
|
|
1100
|
-
/** Resolve entry identifier link via entriesByIdentifier lookup */
|
|
1101
|
-
function resolveEntryLink(link, context) {
|
|
1102
|
-
const resolved = resolveEntryRouteTarget(link, context);
|
|
1103
|
-
if (resolved) return resolved.href;
|
|
1104
|
-
return resolveFallbackHref(link);
|
|
1105
|
-
}
|
|
1106
|
-
/** Resolve external or url link by returning trimmed href */
|
|
1107
|
-
function resolveExternalLink(link) {
|
|
1108
|
-
return resolveFallbackHref(link);
|
|
1109
|
-
}
|
|
1110
|
-
const linksTransforms = [{
|
|
1111
|
-
id: "links.resolve",
|
|
1112
|
-
kind: "formatter",
|
|
1113
|
-
summary: "Resolve LinkValue objects to href strings using the route map",
|
|
1114
|
-
run: (value, _options, context) => resolveAuthoredLinkHref(value, context)
|
|
1115
|
-
}, {
|
|
1116
|
-
id: "links.label",
|
|
1117
|
-
kind: "formatter",
|
|
1118
|
-
summary: "Extract a human-readable label from link objects",
|
|
1119
|
-
run: (value) => {
|
|
1120
|
-
if (!value || typeof value !== "object") return null;
|
|
1121
|
-
const link = value;
|
|
1122
|
-
if (typeof link.label === "string") {
|
|
1123
|
-
const label = link.label.trim();
|
|
1124
|
-
if (label.length > 0) return label;
|
|
1125
|
-
}
|
|
1126
|
-
if (typeof link.title === "string") {
|
|
1127
|
-
const title = link.title.trim();
|
|
1128
|
-
if (title.length > 0) return title;
|
|
1129
|
-
}
|
|
1130
|
-
if (typeof link.identifier === "string") {
|
|
1131
|
-
const identifier = link.identifier.trim();
|
|
1132
|
-
if (identifier.length > 0) return identifier;
|
|
1133
|
-
}
|
|
1134
|
-
if (typeof link.href === "string") {
|
|
1135
|
-
const href = link.href.trim();
|
|
1136
|
-
if (href.length > 0) return href;
|
|
1137
|
-
}
|
|
1138
|
-
return null;
|
|
1139
|
-
}
|
|
1140
|
-
}];
|
|
1141
|
-
function resolveAuthoredLinkHref(value, context = {}) {
|
|
1142
|
-
if (!value || typeof value !== "object") return null;
|
|
1143
|
-
const link = value;
|
|
1144
|
-
switch (link.kind) {
|
|
1145
|
-
case "internal": return resolveInternalLink(link, context);
|
|
1146
|
-
case "page": return resolvePageLink(link, context);
|
|
1147
|
-
case "entry": return resolveEntryLink(link, context);
|
|
1148
|
-
case "external":
|
|
1149
|
-
case "url": return resolveExternalLink(link);
|
|
1150
|
-
default: return resolvePreResolvedLink(link);
|
|
1151
|
-
}
|
|
1152
|
-
}
|
|
1153
|
-
function resolvePreResolvedLink(link) {
|
|
1154
|
-
return !(typeof link.kind === "string" ? link.kind : null) && typeof link.href === "string" ? resolveExternalLink(link) : null;
|
|
1155
|
-
}
|
|
1156
|
-
//#endregion
|
|
1157
|
-
//#region ../blocks/src/system/transforms/registry/mapDrawing.ts
|
|
1158
|
-
/**
|
|
1159
|
-
* Map tokens for the section ground a drawing sits on. The value is the
|
|
1160
|
-
* section's `_sectionStyles.background`, resolved by the same owner as the
|
|
1161
|
-
* section's own foreground; theme-core decides every map colour from it.
|
|
1162
|
-
*/
|
|
1163
|
-
const mapDrawingStyleTransform = {
|
|
1164
|
-
id: "mapDrawing.resolveStyle",
|
|
1165
|
-
kind: "formatter",
|
|
1166
|
-
summary: "Resolve map drawing tokens from the section ground and site style",
|
|
1167
|
-
run: (value, options, context) => mapDrawingStyle({
|
|
1168
|
-
foreground: resolveSectionSurfaceForeground(value ?? sectionFallbackBackground(options?.fallbackToken), context, { fallbackToken: options?.fallbackToken }),
|
|
1169
|
-
palette: context.theme.palette,
|
|
1170
|
-
skin: context.theme.skin
|
|
1171
|
-
})
|
|
1172
|
-
};
|
|
1173
|
-
function sectionFallbackBackground(token) {
|
|
1174
|
-
return token === void 0 ? void 0 : {
|
|
1175
|
-
type: "color",
|
|
1176
|
-
color: token
|
|
1177
|
-
};
|
|
1178
|
-
}
|
|
1179
|
-
const eventCalendarSelectionParam = {
|
|
1180
|
-
id: "events.calendarSelectionParam",
|
|
1181
|
-
kind: "formatter",
|
|
1182
|
-
summary: "Resolve selected events instead of discovery filters",
|
|
1183
|
-
schema: z.object({ key: z.enum([
|
|
1184
|
-
"seriesIds",
|
|
1185
|
-
"eventSurface",
|
|
1186
|
-
"filterEventPresets",
|
|
1187
|
-
"scheduleScope",
|
|
1188
|
-
"filterCategoryIds",
|
|
1189
|
-
"filterStaffMemberId",
|
|
1190
|
-
"filterVenueId"
|
|
1191
|
-
]) }),
|
|
1192
|
-
run(value, { key }) {
|
|
1193
|
-
const content = asPartialObject(value) ?? {};
|
|
1194
|
-
const selection = resolveEventSelection(content.eventSelection, content.selectedEventSeriesIds);
|
|
1195
|
-
if (selection.kind === "selected") return key === "seriesIds" ? selection.seriesIds : void 0;
|
|
1196
|
-
return key === "seriesIds" ? void 0 : content[key];
|
|
1197
|
-
}
|
|
1198
|
-
};
|
|
1199
|
-
const readJobSchema = z.object({ job: z.enum([
|
|
1200
|
-
"list",
|
|
1201
|
-
"calendar",
|
|
1202
|
-
"schedule"
|
|
1203
|
-
]) });
|
|
1204
|
-
const eventCalendarReadProfile = {
|
|
1205
|
-
id: "events.calendarReadProfile",
|
|
1206
|
-
kind: "formatter",
|
|
1207
|
-
summary: "Select media enrichment for the calendar display mode",
|
|
1208
|
-
run(value) {
|
|
1209
|
-
return resolveCalendarReadProfile(asPartialObject(value) ?? {});
|
|
1210
|
-
}
|
|
1211
|
-
};
|
|
1212
|
-
const eventCalendarReadEnabled = {
|
|
1213
|
-
id: "events.calendarReadEnabled",
|
|
1214
|
-
kind: "formatter",
|
|
1215
|
-
summary: "Choose the read projection required by the calendar display mode",
|
|
1216
|
-
schema: readJobSchema,
|
|
1217
|
-
run(value, options) {
|
|
1218
|
-
const plan = resolveEventCalendarReadPlan(asPartialObject(value) ?? {});
|
|
1219
|
-
return plan.jobs === options.job || plan.jobs === "both" && options.job !== "schedule";
|
|
1220
|
-
}
|
|
1221
|
-
};
|
|
1222
|
-
//#endregion
|
|
1223
|
-
//#region ../blocks/src/system/transforms/registry/index.ts
|
|
1224
|
-
const builtinTransformDefinitions = [
|
|
1225
|
-
offeringsPreviewDatesReadEnabled,
|
|
1226
|
-
lookLeadSlotTransform,
|
|
1227
|
-
lookQuoteLimitTransform,
|
|
1228
|
-
lookCarouselRegionTransform,
|
|
1229
|
-
lookSkinSlotTransform,
|
|
1230
|
-
{
|
|
1231
|
-
id: "events.calendarListWindow",
|
|
1232
|
-
kind: "formatter",
|
|
1233
|
-
schema: z.object({ key: z.enum(["from", "to"]) }),
|
|
1234
|
-
run(_value, { key }, context) {
|
|
1235
|
-
const content = context.data ?? {};
|
|
1236
|
-
if (eventCalendarListGroupingDecision({
|
|
1237
|
-
...content,
|
|
1238
|
-
arrangementLooks: content._lookSlots !== void 0
|
|
1239
|
-
}).grouping !== "week") return void 0;
|
|
1240
|
-
const timeZone = context.dateContext.timeZone;
|
|
1241
|
-
const startOfWeek = eventCalendarWeekStart(timeZone, content.startOfWeek === "sunday" || content.startOfWeek === "monday" ? content.startOfWeek : void 0);
|
|
1242
|
-
return buildEventListWeek(getLocalScheduleDate(new Date(readRuntimeNow(context.now)), timeZone), startOfWeek, timeZone)[key];
|
|
1243
|
-
}
|
|
1244
|
-
},
|
|
1245
|
-
eventCalendarSelectionParam,
|
|
1246
|
-
eventCalendarReadEnabled,
|
|
1247
|
-
eventCalendarReadProfile,
|
|
1248
|
-
{
|
|
1249
|
-
id: "events.calendarBanded",
|
|
1250
|
-
kind: "formatter",
|
|
1251
|
-
summary: "Paint the week-board band only on a section with no background of its own",
|
|
1252
|
-
run(value) {
|
|
1253
|
-
const content = asPartialObject(value) ?? {};
|
|
1254
|
-
const sectionStyles = asPartialObject(content._sectionStyles);
|
|
1255
|
-
return content.banded === true && parseBackgroundContent(sectionStyles?.background) === null;
|
|
1256
|
-
}
|
|
1257
|
-
},
|
|
1258
|
-
...formattingTransforms,
|
|
1259
|
-
...layoutTransforms,
|
|
1260
|
-
...chromeLogoTransforms,
|
|
1261
|
-
...uiTransforms,
|
|
1262
|
-
...mediaTransforms,
|
|
1263
|
-
...backgroundTransforms,
|
|
1264
|
-
...linksTransforms,
|
|
1265
|
-
...boxStylesTransforms,
|
|
1266
|
-
...contentTransforms,
|
|
1267
|
-
...headerRuntimeTransforms,
|
|
1268
|
-
mapDrawingStyleTransform
|
|
1269
|
-
];
|
|
1270
|
-
const defaultTransforms = createTransformRegistry(builtinTransformDefinitions);
|
|
1271
|
-
//#endregion
|
|
1272
|
-
//#region ../blocks/src/system/data/linkedContentEntries.ts
|
|
1273
|
-
const LINKED_CONTENT_ENTRY_META_KEY = "__rbLinkedContentEntry";
|
|
1274
|
-
function coerceLinkedContentEntriesPayload(payload) {
|
|
1275
|
-
if (!isRecord$2(payload)) return payload;
|
|
1276
|
-
const response = payload;
|
|
1277
|
-
if (!Array.isArray(response.entries)) return payload;
|
|
1278
|
-
const contentType = parsePublicContentTypeMeta(response.contentType);
|
|
1279
|
-
if (!contentType) return response.entries;
|
|
1280
|
-
return response.entries.map((entry) => enrichLinkedContentEntry(entry, contentType));
|
|
1281
|
-
}
|
|
1282
|
-
function getLinkedContentEntryMeta(value) {
|
|
1283
|
-
if (!isRecord$2(value)) return null;
|
|
1284
|
-
const candidate = value[LINKED_CONTENT_ENTRY_META_KEY];
|
|
1285
|
-
return isLinkedContentEntryMeta(candidate) ? {
|
|
1286
|
-
...candidate,
|
|
1287
|
-
editRevision: candidate.editRevision ?? null
|
|
1288
|
-
} : null;
|
|
1289
|
-
}
|
|
1290
|
-
function buildLinkedContentEditTarget(input) {
|
|
1291
|
-
const { entry, sourceBlockId, sourceBlockKind, itemIndex } = input;
|
|
1292
|
-
if (!isRecord$2(entry)) return null;
|
|
1293
|
-
const meta = getLinkedContentEntryMeta(entry);
|
|
1294
|
-
if (!meta || meta.support.kind !== "supported") return null;
|
|
1295
|
-
const content = isRecord$2(entry.content) ? entry.content : {};
|
|
1296
|
-
return {
|
|
1297
|
-
kind: "linked-content-entry",
|
|
1298
|
-
entryId: meta.entryId,
|
|
1299
|
-
contentTypeKey: meta.contentTypeKey,
|
|
1300
|
-
contentTypeLabel: meta.contentTypeLabel,
|
|
1301
|
-
title: meta.title,
|
|
1302
|
-
optimisticHash: meta.optimisticHash,
|
|
1303
|
-
editRevision: meta.editRevision,
|
|
1304
|
-
sourceBlockId: sourceBlockId ?? null,
|
|
1305
|
-
sourceBlockKind: sourceBlockKind ?? null,
|
|
1306
|
-
itemIndex,
|
|
1307
|
-
content: { ...content },
|
|
1308
|
-
contentType: meta.contentType
|
|
1309
|
-
};
|
|
1310
|
-
}
|
|
1311
|
-
function resolveLinkedEntryInlineFieldEligibility(input) {
|
|
1312
|
-
const meta = getLinkedContentEntryMeta(input.entry);
|
|
1313
|
-
if (!meta) return {
|
|
1314
|
-
kind: "read-only",
|
|
1315
|
-
reason: "missing-entry-meta"
|
|
1316
|
-
};
|
|
1317
|
-
if (meta.support.kind !== "supported") return {
|
|
1318
|
-
kind: "read-only",
|
|
1319
|
-
reason: "unsupported-content-type"
|
|
1320
|
-
};
|
|
1321
|
-
const source = resolveLinkedEntryFieldSource(meta, input.displayPath);
|
|
1322
|
-
if (!source) return {
|
|
1323
|
-
kind: "read-only",
|
|
1324
|
-
reason: "unmapped-display-path"
|
|
1325
|
-
};
|
|
1326
|
-
if (source.kind === "read-only") return {
|
|
1327
|
-
kind: "read-only",
|
|
1328
|
-
reason: source.reason
|
|
1329
|
-
};
|
|
1330
|
-
const field = meta.contentType.fields.find((candidate) => candidate.id === source.fieldPath);
|
|
1331
|
-
if (!field) return {
|
|
1332
|
-
kind: "read-only",
|
|
1333
|
-
reason: "missing-field-schema"
|
|
1334
|
-
};
|
|
1335
|
-
const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
|
|
1336
|
-
if (!fieldType || fieldType !== source.fieldType) return {
|
|
1337
|
-
kind: "read-only",
|
|
1338
|
-
reason: "unsupported-field-type"
|
|
1339
|
-
};
|
|
1340
|
-
if (input.renderedNodeType === "richText" && fieldType !== "richText") return {
|
|
1341
|
-
kind: "read-only",
|
|
1342
|
-
reason: "unsupported-field-type"
|
|
1343
|
-
};
|
|
1344
|
-
if (input.renderedNodeType === "text" && fieldType !== "text") return {
|
|
1345
|
-
kind: "read-only",
|
|
1346
|
-
reason: "unsupported-field-type"
|
|
1347
|
-
};
|
|
1348
|
-
return {
|
|
1349
|
-
kind: "editable",
|
|
1350
|
-
displayPath: input.displayPath,
|
|
1351
|
-
write: {
|
|
1352
|
-
kind: "linked-entry-write-field",
|
|
1353
|
-
entryId: meta.entryId,
|
|
1354
|
-
fieldPath: source.fieldPath,
|
|
1355
|
-
fieldType
|
|
1356
|
-
}
|
|
1357
|
-
};
|
|
1358
|
-
}
|
|
1359
|
-
function enrichLinkedContentEntry(entry, contentType) {
|
|
1360
|
-
if (!isRecord$2(entry)) return entry;
|
|
1361
|
-
const entryId = typeof entry.id === "string" ? entry.id : null;
|
|
1362
|
-
if (!entryId) return entry;
|
|
1363
|
-
const title = typeof entry.title === "string" && entry.title.trim().length > 0 ? entry.title : entryId;
|
|
1364
|
-
const optimisticHash = typeof entry.optimisticHash === "string" && entry.optimisticHash.length > 0 ? entry.optimisticHash : null;
|
|
1365
|
-
const content = isRecord$2(entry.content) ? entry.content : {};
|
|
1366
|
-
const editRevision = typeof entry.editRevision === "number" ? entry.editRevision : null;
|
|
1367
|
-
const meta = {
|
|
1368
|
-
kind: "linked-content-entry",
|
|
1369
|
-
entryId,
|
|
1370
|
-
contentTypeKey: contentType.key,
|
|
1371
|
-
contentTypeLabel: contentTypeKeyToLabel(contentType.key),
|
|
1372
|
-
title,
|
|
1373
|
-
optimisticHash,
|
|
1374
|
-
editRevision,
|
|
1375
|
-
support: resolveLinkedContentEditSupport(contentType),
|
|
1376
|
-
contentType,
|
|
1377
|
-
fieldSources: deriveLinkedEntryFieldSources(entry, contentType, content)
|
|
1378
|
-
};
|
|
1379
|
-
return {
|
|
1380
|
-
...entry,
|
|
1381
|
-
[LINKED_CONTENT_ENTRY_META_KEY]: meta
|
|
1382
|
-
};
|
|
1383
|
-
}
|
|
1384
|
-
function deriveLinkedEntryFieldSources(entry, contentType, content) {
|
|
1385
|
-
const sources = [];
|
|
1386
|
-
for (const field of contentType.fields) {
|
|
1387
|
-
const fieldType = resolvePreviewLinkedEntryInlineFieldType(field.type);
|
|
1388
|
-
if (!fieldType) {
|
|
1389
|
-
sources.push({
|
|
1390
|
-
kind: "read-only",
|
|
1391
|
-
displayPath: `content.${field.id}`,
|
|
1392
|
-
reason: "unsupported-field-type"
|
|
1393
|
-
});
|
|
1394
|
-
continue;
|
|
1395
|
-
}
|
|
1396
|
-
sources.push({
|
|
1397
|
-
kind: "content-field",
|
|
1398
|
-
displayPath: `content.${field.id}`,
|
|
1399
|
-
fieldPath: field.id,
|
|
1400
|
-
fieldType
|
|
1401
|
-
});
|
|
1402
|
-
if (field.id === "excerpt" && fieldType === "text" && typeof entry.excerpt === "string" && typeof content.excerpt === "string" && entry.excerpt === content.excerpt) sources.push({
|
|
1403
|
-
kind: "content-field",
|
|
1404
|
-
displayPath: "excerpt",
|
|
1405
|
-
fieldPath: "excerpt",
|
|
1406
|
-
fieldType
|
|
1407
|
-
});
|
|
1408
|
-
if (field.id === contentType.titleField && fieldType === "text" && typeof entry.title === "string" && typeof content[field.id] === "string" && entry.title === content[field.id]) sources.push({
|
|
1409
|
-
kind: "content-field",
|
|
1410
|
-
displayPath: "title",
|
|
1411
|
-
fieldPath: field.id,
|
|
1412
|
-
fieldType
|
|
1413
|
-
});
|
|
1414
|
-
}
|
|
1415
|
-
for (const displayPath of [
|
|
1416
|
-
"title",
|
|
1417
|
-
"slug",
|
|
1418
|
-
"path",
|
|
1419
|
-
"publishedAt",
|
|
1420
|
-
"status",
|
|
1421
|
-
"image"
|
|
1422
|
-
]) if (displayPath in entry && !sources.some((source) => source.displayPath === displayPath)) sources.push({
|
|
1423
|
-
kind: "read-only",
|
|
1424
|
-
displayPath,
|
|
1425
|
-
reason: displayPath === "image" ? "derived-field" : "route-field"
|
|
1426
|
-
});
|
|
1427
|
-
return sources;
|
|
1428
|
-
}
|
|
1429
|
-
function resolveLinkedEntryFieldSource(meta, displayPath) {
|
|
1430
|
-
return meta.fieldSources.find((candidate) => candidate.displayPath === displayPath) ?? null;
|
|
1431
|
-
}
|
|
1432
|
-
function resolvePreviewLinkedEntryInlineFieldType(fieldType) {
|
|
1433
|
-
if (fieldType === "richText") return "richText";
|
|
1434
|
-
if (fieldType === "text" || fieldType === "textarea") return "text";
|
|
1435
|
-
return null;
|
|
1436
|
-
}
|
|
1437
|
-
function resolveLinkedContentEditSupport(contentType) {
|
|
1438
|
-
if (contentType.fields.length === 0) return {
|
|
1439
|
-
kind: "unsupported-missing-schema",
|
|
1440
|
-
reason: "Content type has no public field metadata."
|
|
1441
|
-
};
|
|
1442
|
-
const metadata = contentType.previewLinkedEntryEditing;
|
|
1443
|
-
if (!metadata) return {
|
|
1444
|
-
kind: "unsupported-content-type",
|
|
1445
|
-
reason: "Content type has not enabled linked-entry preview editing."
|
|
1446
|
-
};
|
|
1447
|
-
switch (metadata.kind) {
|
|
1448
|
-
case "generic": return { kind: "supported" };
|
|
1449
|
-
case "unsupported-domain-backed": return {
|
|
1450
|
-
kind: "unsupported-domain-backed",
|
|
1451
|
-
reason: metadata.reason
|
|
1452
|
-
};
|
|
1453
|
-
default: return assertNever(metadata);
|
|
1454
|
-
}
|
|
1455
|
-
}
|
|
1456
|
-
function contentTypeKeyToLabel(key) {
|
|
1457
|
-
return (key.endsWith("ies") ? `${key.slice(0, -3)}y` : key.endsWith("s") ? key.slice(0, -1) : key).split(/[-_\s]+/).filter((part) => part.length > 0).map((part, index) => index === 0 ? capitalize(part) : part.toLowerCase()).join(" ");
|
|
1458
|
-
}
|
|
1459
|
-
function capitalize(value) {
|
|
1460
|
-
return value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
|
|
1461
|
-
}
|
|
1462
|
-
function parsePublicContentTypeMeta(value) {
|
|
1463
|
-
if (!isRecord$2(value)) return null;
|
|
1464
|
-
if (typeof value.key !== "string" || value.key.trim().length === 0) return null;
|
|
1465
|
-
return {
|
|
1466
|
-
key: value.key,
|
|
1467
|
-
titleField: typeof value.titleField === "string" ? value.titleField : null,
|
|
1468
|
-
fields: Array.isArray(value.fields) ? value.fields.flatMap(parsePublicContentTypeFieldMeta) : [],
|
|
1469
|
-
previewLinkedEntryEditing: parsePublicContentTypeLinkedEntryEditing(value.previewLinkedEntryEditing)
|
|
1470
|
-
};
|
|
1471
|
-
}
|
|
1472
|
-
function parsePublicContentTypeLinkedEntryEditing(value) {
|
|
1473
|
-
if (!isRecord$2(value) || typeof value.kind !== "string") return null;
|
|
1474
|
-
switch (value.kind) {
|
|
1475
|
-
case "generic": return { kind: "generic" };
|
|
1476
|
-
case "unsupported-domain-backed": return {
|
|
1477
|
-
kind: "unsupported-domain-backed",
|
|
1478
|
-
reason: typeof value.reason === "string" ? value.reason : "Domain-backed entries need a dedicated editor workflow."
|
|
1479
|
-
};
|
|
1480
|
-
default: return null;
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
function parsePublicContentTypeFieldMeta(value) {
|
|
1484
|
-
if (!isRecord$2(value)) return [];
|
|
1485
|
-
if (typeof value.id !== "string" || typeof value.type !== "string") return [];
|
|
1486
|
-
return [{
|
|
1487
|
-
id: value.id,
|
|
1488
|
-
type: value.type,
|
|
1489
|
-
mediaKinds: parseStringArray(value.mediaKinds),
|
|
1490
|
-
fileKinds: parseStringArray(value.fileKinds)
|
|
1491
|
-
}];
|
|
1492
|
-
}
|
|
1493
|
-
function parseStringArray(value) {
|
|
1494
|
-
if (value === null || typeof value === "undefined") return null;
|
|
1495
|
-
if (!Array.isArray(value)) return null;
|
|
1496
|
-
return value.filter((item) => typeof item === "string");
|
|
1497
|
-
}
|
|
1498
|
-
function isLinkedContentEntryMeta(value) {
|
|
1499
|
-
if (!isRecord$2(value) || value.kind !== "linked-content-entry") return false;
|
|
1500
|
-
return [
|
|
1501
|
-
[
|
|
1502
|
-
"entryId",
|
|
1503
|
-
"contentTypeKey",
|
|
1504
|
-
"contentTypeLabel",
|
|
1505
|
-
"title"
|
|
1506
|
-
].every((key) => typeof value[key] === "string"),
|
|
1507
|
-
isNullOrOfType(value.optimisticHash, "string"),
|
|
1508
|
-
value.editRevision === void 0 || isNullOrOfType(value.editRevision, "number"),
|
|
1509
|
-
isRecord$2(value.contentType),
|
|
1510
|
-
isLinkedEntryFieldSourceArray(value.fieldSources),
|
|
1511
|
-
isLinkedContentEditSupport(value.support)
|
|
1512
|
-
].every(Boolean);
|
|
1513
|
-
}
|
|
1514
|
-
function isNullOrOfType(value, type) {
|
|
1515
|
-
return value === null || typeof value === type;
|
|
1516
|
-
}
|
|
1517
|
-
function isLinkedEntryFieldSourceArray(value) {
|
|
1518
|
-
return Array.isArray(value) && value.every(isLinkedEntryFieldSource);
|
|
1519
|
-
}
|
|
1520
|
-
function isLinkedEntryFieldSource(value) {
|
|
1521
|
-
if (!isRecord$2(value)) return false;
|
|
1522
|
-
if (typeof value.displayPath !== "string") return false;
|
|
1523
|
-
switch (value.kind) {
|
|
1524
|
-
case "content-field": return typeof value.fieldPath === "string" && (value.fieldType === "text" || value.fieldType === "richText");
|
|
1525
|
-
case "read-only": return isLinkedEntryInlineFieldReadOnlyReason(value.reason);
|
|
1526
|
-
default: return false;
|
|
1527
|
-
}
|
|
1528
|
-
}
|
|
1529
|
-
function isLinkedEntryInlineFieldReadOnlyReason(value) {
|
|
1530
|
-
switch (value) {
|
|
1531
|
-
case "missing-entry-meta":
|
|
1532
|
-
case "unsupported-content-type":
|
|
1533
|
-
case "missing-field-schema":
|
|
1534
|
-
case "unsupported-field-type":
|
|
1535
|
-
case "unmapped-display-path":
|
|
1536
|
-
case "route-field":
|
|
1537
|
-
case "derived-field": return true;
|
|
1538
|
-
default: return false;
|
|
1539
|
-
}
|
|
1540
|
-
}
|
|
1541
|
-
function isLinkedContentEditSupport(value) {
|
|
1542
|
-
if (!isRecord$2(value) || typeof value.kind !== "string") return false;
|
|
1543
|
-
switch (value.kind) {
|
|
1544
|
-
case "supported": return true;
|
|
1545
|
-
case "unsupported-domain-backed":
|
|
1546
|
-
case "unsupported-content-type":
|
|
1547
|
-
case "unsupported-missing-schema": return typeof value.reason === "string";
|
|
1548
|
-
default: return false;
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
function isRecord$2(value) {
|
|
1552
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1553
|
-
}
|
|
1554
|
-
//#endregion
|
|
1555
|
-
//#region ../blocks/src/sdkBlockTransform.ts
|
|
1556
|
-
/**
|
|
1557
|
-
* Transforms an SDK custom block into a BlockManifest.
|
|
1558
|
-
*
|
|
1559
|
-
* If the block has a `layout`, it can be rendered declaratively without React code.
|
|
1560
|
-
* If no layout, the block MUST use blockOverrides for rendering.
|
|
1561
|
-
*/
|
|
1562
|
-
function transformSdkBlockToManifest(sdkBlock) {
|
|
1563
|
-
const hasLayout = Boolean(sdkBlock.layout) || Boolean(sdkBlock.variants && Object.keys(sdkBlock.variants).length > 0);
|
|
1564
|
-
return augmentManifest({
|
|
1565
|
-
variantMeaning: { kind: "arrangement" },
|
|
1566
|
-
name: sdkBlock.id,
|
|
1567
|
-
version: "1.0.0",
|
|
1568
|
-
title: sdkBlock.title,
|
|
1569
|
-
titleSource: sdkBlock.titleSource,
|
|
1570
|
-
description: sdkBlock.description,
|
|
1571
|
-
component: sdkBlock.id,
|
|
1572
|
-
fields: sdkBlock.fields,
|
|
1573
|
-
slots: [],
|
|
1574
|
-
category: sdkBlock.category,
|
|
1575
|
-
tags: sdkBlock.tags,
|
|
1576
|
-
icon: sdkBlock.icon,
|
|
1577
|
-
layout: sdkBlock.layout,
|
|
1578
|
-
variants: sdkBlock.variants,
|
|
1579
|
-
defaultVariant: sdkBlock.defaultVariant,
|
|
1580
|
-
variantOptions: sdkBlock.variantOptions,
|
|
1581
|
-
promotedFields: sdkBlock.promotedFields,
|
|
1582
|
-
lookField: sdkBlock.lookField,
|
|
1583
|
-
behaviours: {
|
|
1584
|
-
supportsThemeSwitching: true,
|
|
1585
|
-
inlineEditing: hasLayout,
|
|
1586
|
-
animation: hasLayout,
|
|
1587
|
-
paletteHidden: false
|
|
1588
|
-
}
|
|
1589
|
-
});
|
|
1590
|
-
}
|
|
1591
|
-
/**
|
|
1592
|
-
* Transforms an SDK custom block into a SystemBlockDefinition.
|
|
1593
|
-
*
|
|
1594
|
-
* This creates a minimal definition with just the manifest - no data loaders
|
|
1595
|
-
* or content normalizers since SDK blocks handle their own rendering.
|
|
1596
|
-
*/
|
|
1597
|
-
function transformSdkBlockToDefinition(sdkBlock) {
|
|
1598
|
-
return {
|
|
1599
|
-
manifest: transformSdkBlockToManifest(sdkBlock),
|
|
1600
|
-
dataLoaders: sdkBlock.dataLoaders
|
|
1601
|
-
};
|
|
1602
|
-
}
|
|
1603
|
-
//#endregion
|
|
1604
|
-
//#region ../blocks/src/customBlockRegistry.ts
|
|
1605
|
-
const defaultCustomBlockSourcePolicy = { kind: "canonical-db-fallback-sdk" };
|
|
1606
|
-
function isCustomBlockKind(blockKind) {
|
|
1607
|
-
return blockKind.startsWith("custom.");
|
|
1608
|
-
}
|
|
1609
|
-
function transformToBlockDescriptor(sdkBlock, source = "sdk") {
|
|
1610
|
-
return {
|
|
1611
|
-
name: sdkBlock.id,
|
|
1612
|
-
title: sdkBlock.title,
|
|
1613
|
-
description: sdkBlock.description,
|
|
1614
|
-
category: sdkBlock.category,
|
|
1615
|
-
tags: sdkBlock.tags,
|
|
1616
|
-
icon: sdkBlock.icon,
|
|
1617
|
-
definition: transformSdkBlockToDefinition(sdkBlock),
|
|
1618
|
-
source
|
|
1619
|
-
};
|
|
1620
|
-
}
|
|
1621
|
-
function toResolvedCustomBlock(manifest, source) {
|
|
1622
|
-
return {
|
|
1623
|
-
blockKind: manifest.id,
|
|
1624
|
-
manifest: transformSdkBlockToManifest(manifest),
|
|
1625
|
-
source,
|
|
1626
|
-
descriptor: transformToBlockDescriptor(manifest, source.kind === "managed-database" ? "database" : "sdk")
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
function planCustomBlockRegistryResolution({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy }) {
|
|
1630
|
-
switch (policy.kind) {
|
|
1631
|
-
case "canonical-db-fallback-sdk": {
|
|
1632
|
-
const entriesByKind = /* @__PURE__ */ new Map();
|
|
1633
|
-
const conflicts = [];
|
|
1634
|
-
for (const customBlock of customBlocks) entriesByKind.set(customBlock.manifest.id, toResolvedCustomBlock(customBlock.manifest, customBlock.source));
|
|
1635
|
-
for (const sdkBlock of sdkConfig?.customBlocks ?? []) {
|
|
1636
|
-
const existing = entriesByKind.get(sdkBlock.id);
|
|
1637
|
-
if (existing) {
|
|
1638
|
-
conflicts.push({
|
|
1639
|
-
kind: "conflict",
|
|
1640
|
-
blockKind: existing.blockKind,
|
|
1641
|
-
winner: existing.source,
|
|
1642
|
-
loser: { kind: "sdk-config" },
|
|
1643
|
-
reason: "db-canonical-sdk-fallback"
|
|
1644
|
-
});
|
|
1645
|
-
continue;
|
|
1646
|
-
}
|
|
1647
|
-
entriesByKind.set(sdkBlock.id, toResolvedCustomBlock(sdkBlock, { kind: "sdk-config" }));
|
|
1648
|
-
}
|
|
1649
|
-
return {
|
|
1650
|
-
policy,
|
|
1651
|
-
entries: Array.from(entriesByKind.values()),
|
|
1652
|
-
conflicts
|
|
1653
|
-
};
|
|
1654
|
-
}
|
|
1655
|
-
}
|
|
1656
|
-
}
|
|
1657
|
-
function createCustomBlockRegistry({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy, onConflict }) {
|
|
1658
|
-
const plan = planCustomBlockRegistryResolution({
|
|
1659
|
-
sdkConfig,
|
|
1660
|
-
customBlocks,
|
|
1661
|
-
policy
|
|
1662
|
-
});
|
|
1663
|
-
const entriesByKind = new Map(plan.entries.map((entry) => [entry.blockKind, entry]));
|
|
1664
|
-
for (const conflict of plan.conflicts) onConflict?.(`Using ${sourceLabel(conflict.winner)} custom block "${conflict.blockKind}" - ${sourceLabel(conflict.loser)} block is fallback only`);
|
|
1665
|
-
return {
|
|
1666
|
-
entries: plan.entries,
|
|
1667
|
-
conflicts: plan.conflicts,
|
|
1668
|
-
findManifest: (blockKind) => {
|
|
1669
|
-
if (!isCustomBlockKind(blockKind)) return void 0;
|
|
1670
|
-
return entriesByKind.get(blockKind);
|
|
1671
|
-
}
|
|
1672
|
-
};
|
|
1673
|
-
}
|
|
1674
|
-
function sourceLabel(source) {
|
|
1675
|
-
switch (source.kind) {
|
|
1676
|
-
case "managed-database": return "DB";
|
|
1677
|
-
case "sdk-synced": return "SDK-synced DB";
|
|
1678
|
-
case "sdk-config": return "SDK config";
|
|
1679
|
-
default: return assertNever(source);
|
|
1680
|
-
}
|
|
1681
|
-
}
|
|
1682
|
-
//#endregion
|
|
1683
|
-
//#region ../blocks/src/pageRenderJoins.ts
|
|
1684
|
-
/**
|
|
1685
|
-
* Re-points joins across omitted blocks. Pure over joins.
|
|
1686
|
-
*
|
|
1687
|
-
* Joins are keyed by adjacent block-id pairs, so dropping B from [A, B, C]
|
|
1688
|
-
* removes the A→C join as well as B's own, because no A→C join was ever
|
|
1689
|
-
* resolved. For each surviving pair the original join is kept when the pair
|
|
1690
|
-
* was already adjacent. Across a gap, the treatment comes from the join
|
|
1691
|
-
* entering the omitted run (A→first omitted), falling back to the one leaving
|
|
1692
|
-
* it (last omitted→C). Nothing visual is carried: the survivors are composed
|
|
1693
|
-
* from their own content afterwards.
|
|
1694
|
-
*
|
|
1695
|
-
* `survivors` are compared by identity against `originalBlocks`.
|
|
1696
|
-
*/
|
|
1697
|
-
function retargetJoinsAcrossOmissions(input) {
|
|
1698
|
-
const { joins, originalBlocks, survivingBlocks } = input;
|
|
1699
|
-
if (joins.length === 0) return joins;
|
|
1700
|
-
if (originalBlocks.every((block) => survivingBlocks.has(block))) return joins;
|
|
1701
|
-
const byPair = joinsByPair(joins);
|
|
1702
|
-
const retargeted = [];
|
|
1703
|
-
let previousSurvivor = null;
|
|
1704
|
-
let run = [];
|
|
1705
|
-
for (const block of originalBlocks) {
|
|
1706
|
-
if (!survivingBlocks.has(block)) {
|
|
1707
|
-
run.push(block);
|
|
1708
|
-
continue;
|
|
1709
|
-
}
|
|
1710
|
-
if (previousSurvivor?.id && block.id) {
|
|
1711
|
-
const join = run.length === 0 ? byPair.get(pairKey(previousSurvivor.id, block.id)) : joinAcrossRun(byPair, previousSurvivor.id, block.id, run);
|
|
1712
|
-
if (join) retargeted.push(join);
|
|
1713
|
-
}
|
|
1714
|
-
previousSurvivor = block;
|
|
1715
|
-
run = [];
|
|
1716
|
-
}
|
|
1717
|
-
return retargeted;
|
|
1718
|
-
}
|
|
1719
|
-
function joinAcrossRun(byPair, previousBlockId, nextBlockId, run) {
|
|
1720
|
-
const firstOmittedId = run[0]?.id;
|
|
1721
|
-
const lastOmittedId = run[run.length - 1]?.id;
|
|
1722
|
-
const entering = firstOmittedId ? byPair.get(pairKey(previousBlockId, firstOmittedId)) : void 0;
|
|
1723
|
-
const exiting = lastOmittedId ? byPair.get(pairKey(lastOmittedId, nextBlockId)) : void 0;
|
|
1724
|
-
const donor = entering ?? exiting;
|
|
1725
|
-
return donor ? {
|
|
1726
|
-
previousBlockId,
|
|
1727
|
-
nextBlockId,
|
|
1728
|
-
treatment: donor.treatment
|
|
1729
|
-
} : void 0;
|
|
1730
|
-
}
|
|
1731
|
-
/**
|
|
1732
|
-
* The single composition site. For every adjacent pair of survivors with ids,
|
|
1733
|
-
* finds its join and composes it from both survivors' final content: what
|
|
1734
|
-
* each paints with and the frame each draws.
|
|
1735
|
-
*/
|
|
1736
|
-
function composePageJoins(input) {
|
|
1737
|
-
const byPair = joinsByPair(input.joins);
|
|
1738
|
-
return input.survivors.flatMap((previous, index) => {
|
|
1739
|
-
const next = input.survivors[index + 1];
|
|
1740
|
-
if (!next || !previous.id || !next.id) return [];
|
|
1741
|
-
const join = byPair.get(pairKey(previous.id, next.id));
|
|
1742
|
-
return [{
|
|
1743
|
-
previousBlockId: previous.id,
|
|
1744
|
-
nextBlockId: next.id,
|
|
1745
|
-
join: join ? composeJoin(join, previous, next) : null,
|
|
1746
|
-
fieldsMeet: sectionShapeFromContent(previous.content) === "field" && sectionShapeFromContent(next.content) === "field"
|
|
1747
|
-
}];
|
|
1748
|
-
});
|
|
1749
|
-
}
|
|
1750
|
-
function composeJoin(join, previous, next) {
|
|
1751
|
-
return {
|
|
1752
|
-
boundaryId: pairKey(join.previousBlockId, join.nextBlockId),
|
|
1753
|
-
previousBlockId: join.previousBlockId,
|
|
1754
|
-
nextBlockId: join.nextBlockId,
|
|
1755
|
-
treatment: join.treatment,
|
|
1756
|
-
outcome: composeBoundary(sectionFactsForContent(previous.content), sectionFactsForContent(next.content))
|
|
1757
|
-
};
|
|
1758
|
-
}
|
|
1759
|
-
/** Placement, reserves and paint for a join that draws; null otherwise. */
|
|
1760
|
-
function renderedJoinLayout(join) {
|
|
1761
|
-
if (!join || join.outcome.kind !== "shown") return null;
|
|
1762
|
-
return boundaryLayout(join.treatment, join.outcome.composition);
|
|
1763
|
-
}
|
|
1764
|
-
/** Joins with a missing id on either side cannot sit between two blocks. */
|
|
1765
|
-
function joinsByPair(joins) {
|
|
1766
|
-
return new Map(joins.flatMap((join) => join.previousBlockId && join.nextBlockId ? [[pairKey(join.previousBlockId, join.nextBlockId), join]] : []));
|
|
1767
|
-
}
|
|
1768
|
-
/** Slot lookup key for an adjacent pair, in the one boundary-id scheme. */
|
|
1769
|
-
function joinSlotKey(previousBlockId, nextBlockId) {
|
|
1770
|
-
return pairKey(previousBlockId, nextBlockId);
|
|
1771
|
-
}
|
|
1772
|
-
function pairKey(previousBlockId, nextBlockId) {
|
|
1773
|
-
return makeBoundaryId(asDesignBlockId(previousBlockId), asDesignBlockId(nextBlockId));
|
|
1774
|
-
}
|
|
1775
|
-
//#endregion
|
|
1776
|
-
//#region ../blocks/src/pageRenderPlan.ts
|
|
1777
|
-
/** Owner-local derived reuse; shared settings and admitted rhythm position remain inputs. */
|
|
1778
|
-
function createPageRenderPlanReader() {
|
|
1779
|
-
const memo = { current: null };
|
|
1780
|
-
return (input) => {
|
|
1781
|
-
memo.current = planPageRender(input, memo.current);
|
|
1782
|
-
return memo.current.plan;
|
|
1783
|
-
};
|
|
1784
|
-
}
|
|
1785
|
-
function planPageRender(input, previous = null) {
|
|
1786
|
-
const resolveTarget = createRenderTargetResolver(input);
|
|
1787
|
-
const reusable = previous && samePlanSettings(previous.input, input) ? previous : null;
|
|
1788
|
-
const planned = input.page.blocks.map((block) => [block, reusable?.outcomes.get(block) ?? planPageBlock(block, input, resolveTarget)]);
|
|
1789
|
-
const outcomes = planned.map(([, outcome]) => outcome);
|
|
1790
|
-
const entries = outcomes.flatMap((outcome) => outcome.kind === "admitted" ? [outcome.entry] : []);
|
|
1791
|
-
const rhythmic = entries.map((entry, position) => {
|
|
1792
|
-
const cached = reusable?.rhythm.get(entry);
|
|
1793
|
-
return [entry, {
|
|
1794
|
-
position,
|
|
1795
|
-
entry: cached?.position === position ? cached.entry : applyArrangementRhythm(entry, position)
|
|
1796
|
-
}];
|
|
1797
|
-
});
|
|
1798
|
-
const plan = {
|
|
1799
|
-
entries: rhythmic.map(([, value]) => value.entry),
|
|
1800
|
-
omitted: outcomes.flatMap((outcome) => outcome.kind === "omitted" ? [outcome.omission] : []),
|
|
1801
|
-
runtimeJoins: retargetJoinsAcrossOmissions({
|
|
1802
|
-
joins: input.runtimeJoins ?? [],
|
|
1803
|
-
originalBlocks: input.page.blocks,
|
|
1804
|
-
survivingBlocks: new Set(entries.map((entry) => entry.block))
|
|
1805
|
-
})
|
|
1806
|
-
};
|
|
1807
|
-
return {
|
|
1808
|
-
input,
|
|
1809
|
-
outcomes: new Map(planned),
|
|
1810
|
-
rhythm: new Map(rhythmic),
|
|
1811
|
-
plan
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
|
-
function samePlanSettings(previous, current) {
|
|
1815
|
-
return previous.siteStyleId === current.siteStyleId && previous.audience === current.audience && previous.previewStage === current.previewStage && previous.sdkConfig === current.sdkConfig && previous.customBlocks === current.customBlocks && previous.blockOverrides === current.blockOverrides;
|
|
1816
|
-
}
|
|
1817
|
-
/**
|
|
1818
|
-
* Mirrors the order of the checks `MemoBlockSection` used to make inline, so no
|
|
1819
|
-
* case changes meaning: admission first, then definition/override resolution,
|
|
1820
|
-
* then the layout requirement.
|
|
1821
|
-
*/
|
|
1822
|
-
function planBlock(block, renderableContent, resolveTarget, audience, siteStyleId) {
|
|
1823
|
-
const common = {
|
|
1824
|
-
block,
|
|
1825
|
-
renderableContent
|
|
1826
|
-
};
|
|
1827
|
-
if (block.presentationAdmission.kind === "invalid") return {
|
|
1828
|
-
...common,
|
|
1829
|
-
kind: "diagnostic",
|
|
1830
|
-
reason: {
|
|
1831
|
-
kind: "invalid-admission",
|
|
1832
|
-
blockKind: block.kind,
|
|
1833
|
-
error: block.presentationAdmission.error
|
|
1834
|
-
}
|
|
1835
|
-
};
|
|
1836
|
-
const { definition, systemDefinition, override } = resolveTarget(block.kind);
|
|
1837
|
-
const isCustom = block.kind.startsWith("custom.");
|
|
1838
|
-
if (!definition) return override ? {
|
|
1839
|
-
...common,
|
|
1840
|
-
kind: "override-only",
|
|
1841
|
-
override
|
|
1842
|
-
} : {
|
|
1843
|
-
...common,
|
|
1844
|
-
kind: "diagnostic",
|
|
1845
|
-
reason: {
|
|
1846
|
-
kind: "missing-definition",
|
|
1847
|
-
blockKind: block.kind,
|
|
1848
|
-
isCustom
|
|
1849
|
-
}
|
|
1850
|
-
};
|
|
1851
|
-
const manifestHasLayout = Boolean(definition.manifest.layout) || Object.keys(definition.manifest.variants ?? {}).length > 0;
|
|
1852
|
-
if (!override && !manifestHasLayout) return {
|
|
1853
|
-
...common,
|
|
1854
|
-
kind: "diagnostic",
|
|
1855
|
-
reason: {
|
|
1856
|
-
kind: "missing-layout",
|
|
1857
|
-
blockKind: block.kind,
|
|
1858
|
-
isCustom
|
|
1859
|
-
}
|
|
1860
|
-
};
|
|
1861
|
-
return renderableBlockPlan(common, {
|
|
1862
|
-
definition,
|
|
1863
|
-
systemDefinition,
|
|
1864
|
-
override
|
|
1865
|
-
}, audience, siteStyleId);
|
|
1866
|
-
}
|
|
1867
|
-
function renderableBlockPlan(common, target, audience, siteStyleId) {
|
|
1868
|
-
const { definition, systemDefinition, override } = target;
|
|
1869
|
-
const renderableContent = planArrangementContent(common.block.kind, definition.manifest, common.renderableContent, audience);
|
|
1870
|
-
const effectiveArrangementKey = resolveEffectiveArrangement({
|
|
1871
|
-
manifest: arrangementManifestFromVariants(definition.manifest),
|
|
1872
|
-
...definition.manifest.variantMeaning.kind !== "mode" ? { look: effectiveLookFromContent(renderableContent)?.look } : {},
|
|
1873
|
-
storedVariant: parseStoredVariant(definition.manifest, renderableContent),
|
|
1874
|
-
policy: siteStyleId === null ? void 0 : deriveSiteStyleBlockPolicy({
|
|
1875
|
-
siteStyleId: asSiteStyleId(siteStyleId),
|
|
1876
|
-
blockKind: common.block.kind
|
|
1877
|
-
})
|
|
1878
|
-
}).key;
|
|
1879
|
-
return {
|
|
1880
|
-
...common,
|
|
1881
|
-
renderableContent,
|
|
1882
|
-
kind: "renderable",
|
|
1883
|
-
definition,
|
|
1884
|
-
override,
|
|
1885
|
-
effectiveArrangementKey,
|
|
1886
|
-
effectiveListArrangementKey: definition.manifest.variantMeaning.kind === "mode" && renderableContent._lookMonthArrangement === void 0 ? resolveModeArrangement({
|
|
1887
|
-
declaration: definition.manifest.variantMeaning,
|
|
1888
|
-
content: renderableContent,
|
|
1889
|
-
look: effectiveLookFromContent(renderableContent)?.look,
|
|
1890
|
-
mode: readStoredMode({
|
|
1891
|
-
...arrangementManifestFromVariants(definition.manifest),
|
|
1892
|
-
variantMeaning: definition.manifest.variantMeaning
|
|
1893
|
-
}, renderableContent)
|
|
1894
|
-
}).key : null,
|
|
1895
|
-
variantKey: systemDefinition ? effectiveArrangementKey : null,
|
|
1896
|
-
managesOwnWrapper: Boolean(systemDefinition?.manifest.behaviours?.managesOwnWrapper)
|
|
1897
|
-
};
|
|
1898
|
-
}
|
|
1899
|
-
/**
|
|
1900
|
-
* Resolves definition + override once per block kind, and builds the
|
|
1901
|
-
* custom-block registry at most once per plan rather than once per custom
|
|
1902
|
-
* block, which is what the previous inline path did.
|
|
1903
|
-
*/
|
|
1904
|
-
function createRenderTargetResolver(input) {
|
|
1905
|
-
const cache = /* @__PURE__ */ new Map();
|
|
1906
|
-
let customRegistry = null;
|
|
1907
|
-
const customRegistryOnce = () => {
|
|
1908
|
-
customRegistry ?? (customRegistry = createCustomBlockRegistry({
|
|
1909
|
-
sdkConfig: input.sdkConfig,
|
|
1910
|
-
customBlocks: (input.customBlocks ?? []).map((manifest) => ({
|
|
1911
|
-
manifest,
|
|
1912
|
-
source: { kind: "managed-database" }
|
|
1913
|
-
}))
|
|
1914
|
-
}));
|
|
1915
|
-
return customRegistry;
|
|
1916
|
-
};
|
|
1917
|
-
return (blockKind) => {
|
|
1918
|
-
const cached = cache.get(blockKind);
|
|
1919
|
-
if (cached) return cached;
|
|
1920
|
-
const systemDefinition = getBlockDefinition(blockKind);
|
|
1921
|
-
const resolved = {
|
|
1922
|
-
definition: systemDefinition ?? (blockKind.startsWith("custom.") ? customRegistryOnce().findManifest(blockKind)?.descriptor.definition : void 0),
|
|
1923
|
-
systemDefinition,
|
|
1924
|
-
override: getBlockOverride(blockKind, input.blockOverrides)
|
|
1925
|
-
};
|
|
1926
|
-
cache.set(blockKind, resolved);
|
|
1927
|
-
return resolved;
|
|
1928
|
-
};
|
|
1929
|
-
}
|
|
1930
|
-
/**
|
|
1931
|
-
* Look up a block override component by block kind.
|
|
1932
|
-
* Supports both full ("block.hero") and short ("hero") keys.
|
|
1933
|
-
*/
|
|
1934
|
-
function getBlockOverride(blockKind, overrides) {
|
|
1935
|
-
if (!overrides) return void 0;
|
|
1936
|
-
if (overrides[blockKind]) return overrides[blockKind];
|
|
1937
|
-
return overrides[blockKind.replace(/^block\./, "")];
|
|
1938
|
-
}
|
|
1939
|
-
/**
|
|
1940
|
-
* Resolves block content based on stage priority.
|
|
1941
|
-
* For draft/preview: draftContent takes priority over content.
|
|
1942
|
-
* For published: content is the source of truth.
|
|
1943
|
-
*/
|
|
1944
|
-
/**
|
|
1945
|
-
* The content a block renders with. Every render path (public, preview,
|
|
1946
|
-
* templates, SDK) chooses content here, so this is also where a stale
|
|
1947
|
-
* `site-style-transition-*` styleGroup is dropped; authored values survive.
|
|
1948
|
-
*/
|
|
1949
|
-
function getRenderableContent(block, previewStage = "published") {
|
|
1950
|
-
return selectBlockContent(block, previewStage);
|
|
1951
|
-
}
|
|
1952
|
-
function arrangementRuntime(content) {
|
|
1953
|
-
const value = parseSurfaceTree(content._arrangementLooks);
|
|
1954
|
-
return isObjectRecord(value) && isObjectRecord(value.byMode) && Array.isArray(value.available) && Array.isArray(value.rhythm) ? restoreArrangementRuntime(value) : null;
|
|
1955
|
-
}
|
|
1956
|
-
/**
|
|
1957
|
-
* JSON transports carry resolver inputs; rebuild every surface at this boundary.
|
|
1958
|
-
* A payload cached before compiled looks carried `slotRoles` gets the Look's own.
|
|
1959
|
-
*/
|
|
1960
|
-
function restoreCompiledLook(look) {
|
|
1961
|
-
const transported = look;
|
|
1962
|
-
return {
|
|
1963
|
-
...look,
|
|
1964
|
-
slotRoles: transported.slotRoles ?? look.look.structure.slotRoles ?? {},
|
|
1965
|
-
itemSurfaces: Object.fromEntries(Object.entries(look.itemSurfaces).map(([slot, surface]) => [slot, parseResolvedSurface(surface)])),
|
|
1966
|
-
...look.roleSurfaces ? { roleSurfaces: {
|
|
1967
|
-
card: parseResolvedSurface(look.roleSurfaces.card),
|
|
1968
|
-
statement: parseResolvedSurface(look.roleSurfaces.statement),
|
|
1969
|
-
highlight: parseResolvedSurface(look.roleSurfaces.highlight)
|
|
1970
|
-
} } : {}
|
|
1971
|
-
};
|
|
1972
|
-
}
|
|
1973
|
-
function restoreArrangementRuntime(runtime) {
|
|
1974
|
-
const transported = runtime;
|
|
1975
|
-
const fieldGrounds = Array.isArray(transported.fieldGrounds) ? transported.fieldGrounds.filter((token) => typeof token === "string") : [];
|
|
1976
|
-
return {
|
|
1977
|
-
...runtime,
|
|
1978
|
-
fieldGrounds,
|
|
1979
|
-
available: runtime.available.map(restoreCompiledLook),
|
|
1980
|
-
byMode: Object.fromEntries(Object.entries(runtime.byMode).map(([mode, look]) => [mode, restoreCompiledLook(look)]))
|
|
1981
|
-
};
|
|
1982
|
-
}
|
|
1983
|
-
function effectiveLookFromContent(content) {
|
|
1984
|
-
const value = content._effectiveLook;
|
|
1985
|
-
return isObjectRecord(value) && isObjectRecord(value.look) ? restoreCompiledLook(value) : null;
|
|
1986
|
-
}
|
|
1987
|
-
function planArrangementContent(blockKind, manifest, content, audience) {
|
|
1988
|
-
const runtime = arrangementRuntime(content);
|
|
1989
|
-
if (!runtime) return content;
|
|
1990
|
-
const mode = readStoredMode({
|
|
1991
|
-
...arrangementManifestFromVariants(manifest),
|
|
1992
|
-
variantMeaning: manifest.variantMeaning
|
|
1993
|
-
}, content);
|
|
1994
|
-
const selected = runtime.byMode[mode ?? "default"];
|
|
1995
|
-
if (!selected) return content;
|
|
1996
|
-
const { facts } = arrangementContentFacts(content);
|
|
1997
|
-
const published = resolvePublishedLook({
|
|
1998
|
-
look: selected.look,
|
|
1999
|
-
facts,
|
|
2000
|
-
audience,
|
|
2001
|
-
catalogue: runtime.available.map((entry) => entry.look)
|
|
2002
|
-
});
|
|
2003
|
-
const effective = runtime.available.find((entry) => entry.look.id === published.id) ?? selected;
|
|
2004
|
-
const { length, knobs } = resolveArrangementKnobs({
|
|
2005
|
-
blockKind,
|
|
2006
|
-
look: effective,
|
|
2007
|
-
content
|
|
2008
|
-
});
|
|
2009
|
-
const values = Object.fromEntries(Object.entries(knobs).flatMap(([key, knob]) => knob.kind === "kept" ? [] : [[key, knob.value]]));
|
|
2010
|
-
const effectiveContent = Object.fromEntries(Object.entries(values).map(([key, value]) => [key, effectiveContentKnobValue(blockKind, key, value)]));
|
|
2011
|
-
const lookOwnedPaths = contentPathsOwnedBy(resolveFieldOwnership({
|
|
2012
|
-
blockKind,
|
|
2013
|
-
manifest,
|
|
2014
|
-
arrangementLook: true
|
|
2015
|
-
}), ["look"]);
|
|
2016
|
-
const activeContent = withoutLookOwnedContent(Object.fromEntries(Object.entries(content).filter(([key]) => knobs[key]?.kind !== "kept")), lookOwnedPaths);
|
|
2017
|
-
const photoContent = arrangementPhotoContent(activeContent, effectiveContent);
|
|
2018
|
-
const visiblePhotos = arrangementContentFacts({
|
|
2019
|
-
...activeContent,
|
|
2020
|
-
...effectiveContent,
|
|
2021
|
-
...photoContent
|
|
2022
|
-
});
|
|
2023
|
-
return {
|
|
2024
|
-
...activeContent,
|
|
2025
|
-
...arrangementPhotoTreatmentContent(activeContent, effective.look),
|
|
2026
|
-
...mode !== null ? { variant: mode } : {},
|
|
2027
|
-
...effectiveContent,
|
|
2028
|
-
...photoContent,
|
|
2029
|
-
...arrangementShapeContent(knobs),
|
|
2030
|
-
...arrangementPanelContent(activeContent, effective, mode),
|
|
2031
|
-
...arrangementQuoteContent(blockKind, effective, values),
|
|
2032
|
-
_arrangementLooks: runtime,
|
|
2033
|
-
_effectiveLook: effective,
|
|
2034
|
-
_lookHooks: arrangementContentHooks(effective, mode, length, {
|
|
2035
|
-
...facts.content,
|
|
2036
|
-
photo: visiblePhotos.facts.content.photo
|
|
2037
|
-
}, values, visiblePhotos.photoCount),
|
|
2038
|
-
_effectiveKnobs: knobs,
|
|
2039
|
-
_lookOwnedPaths: lookOwnedPaths,
|
|
2040
|
-
_lookAudience: audience,
|
|
2041
|
-
_lookSlots: arrangementContentSlots(blockKind),
|
|
2042
|
-
blockLook: effective.look.id
|
|
2043
|
-
};
|
|
2044
|
-
}
|
|
2045
|
-
/** Typed Look composition owns contrast treatment; parsing preserves authored paint. */
|
|
2046
|
-
function arrangementPhotoTreatmentContent(content, look) {
|
|
2047
|
-
if (!look.structure.photoTreatment) return {};
|
|
2048
|
-
const authored = parseCanonicalRuntimeBackground(content);
|
|
2049
|
-
if (authored.kind === "none") return {};
|
|
2050
|
-
return { _sectionStyles: {
|
|
2051
|
-
...isObjectRecord(content._sectionStyles) ? content._sectionStyles : {},
|
|
2052
|
-
background: applyLookPhotoTreatment(authored.background, look.structure.photoTreatment)
|
|
2053
|
-
} };
|
|
2054
|
-
}
|
|
2055
|
-
/** Widget section hooks use the theme; hero background geometry never travels to list islands. */
|
|
2056
|
-
function arrangementContentSlots(blockKind) {
|
|
2057
|
-
return Object.fromEntries(arrangementSlotNames.filter((slot) => (!slot.startsWith("price-") || blockKind === "block.shop") && slot !== "schedule-section" && slot !== "shop-section" && (slot !== "background" || blockKind === "block.hero")).map((slot) => [slot, slot]));
|
|
2058
|
-
}
|
|
2059
|
-
/** Where a Look offers the photo shape, the shape sets the crop, without rewriting authored preferences. */
|
|
2060
|
-
function arrangementShapeContent(knobs) {
|
|
2061
|
-
const shape = knobs.imageShape;
|
|
2062
|
-
if (!shape || shape.kind === "kept") return {};
|
|
2063
|
-
return shape.value === "circle" ? { aspectRatio: "1/1" } : shape.value === "arch" ? { aspectRatio: "4/5" } : {};
|
|
2064
|
-
}
|
|
2065
|
-
function arrangementQuoteContent(blockKind, effective, values) {
|
|
2066
|
-
if (blockKind !== "block.testimonials") return {};
|
|
2067
|
-
const single = effective.look.structure.byMode.default === "single";
|
|
2068
|
-
return {
|
|
2069
|
-
_quoteCount: single ? 1 : values.quoteCount === "all" ? null : Number(values.quoteCount),
|
|
2070
|
-
_quoteLoaderLimit: values.quoteCount === "all" && !single ? "all" : "50"
|
|
2071
|
-
};
|
|
2072
|
-
}
|
|
2073
|
-
function arrangementPanelContent(content, effective, mode) {
|
|
2074
|
-
if (mode === "calendar") return {
|
|
2075
|
-
_lookMonthArrangement: effective.look.structure.byMode.calendar,
|
|
2076
|
-
defaultCalendarView: "month"
|
|
2077
|
-
};
|
|
2078
|
-
const arrangement = effective.look.structure.byMode[mode ?? "default"];
|
|
2079
|
-
if (arrangement === "event-header") return { heading: void 0 };
|
|
2080
|
-
if (arrangement !== "compact" && arrangement !== "details-panel") return {};
|
|
2081
|
-
return {
|
|
2082
|
-
heading: void 0,
|
|
2083
|
-
_lookPanelHeading: content.heading
|
|
2084
|
-
};
|
|
2085
|
-
}
|
|
2086
|
-
function arrangementPhotoContent(content, knobs) {
|
|
2087
|
-
if (knobs.showPhotos !== false || !Array.isArray(content.cards)) return {};
|
|
2088
|
-
return { cards: content.cards.map((card) => {
|
|
2089
|
-
if (!isObjectRecord(card)) return card;
|
|
2090
|
-
const { media: _hiddenMedia, ...copy } = card;
|
|
2091
|
-
return copy;
|
|
2092
|
-
}) };
|
|
2093
|
-
}
|
|
2094
|
-
/**
|
|
2095
|
-
* The one owner of the facts `whenMissing` rules read from block content.
|
|
2096
|
-
* Content facts also become `data-has-*` hooks; setting facts never do.
|
|
2097
|
-
*/
|
|
2098
|
-
function arrangementContentFacts(content) {
|
|
2099
|
-
const photoCount = arrangementPhotoCount(content);
|
|
2100
|
-
const featured = typeof content.featured === "string" ? content.featured.trim().length > 0 : content.featured !== void 0 && content.featured !== null;
|
|
2101
|
-
return {
|
|
2102
|
-
photoCount,
|
|
2103
|
-
facts: {
|
|
2104
|
-
content: {
|
|
2105
|
-
photo: photoCount > 0,
|
|
2106
|
-
facts: Array.isArray(content.facts) && content.facts.length > 0,
|
|
2107
|
-
featured,
|
|
2108
|
-
outcome: typeof content.outcome === "string" && content.outcome.length > 0,
|
|
2109
|
-
figure: typeof content.figure === "string" && content.figure.trim().length > 0,
|
|
2110
|
-
entrance: isObjectRecord(content.entrancePhoto)
|
|
2111
|
-
},
|
|
2112
|
-
settings: { "listed-by-week": content.listBy === "week" }
|
|
2113
|
-
}
|
|
2114
|
-
};
|
|
2115
|
-
}
|
|
2116
|
-
/** The content stage owns media presence for every arrangement consumer. */
|
|
2117
|
-
function arrangementPhotoCount(content) {
|
|
2118
|
-
if (Array.isArray(content.cards)) return content.cards.filter((card) => isObjectRecord(card) && isObjectRecord(card.media)).length;
|
|
2119
|
-
if (Array.isArray(content.members)) return content.members.filter((member) => isObjectRecord(member) && isObjectRecord(member.photo)).length;
|
|
2120
|
-
if (Array.isArray(content.images)) return content.images.filter((item) => isObjectRecord(item) && isObjectRecord(item.image)).length;
|
|
2121
|
-
if (isObjectRecord(content.media) || isObjectRecord(content.entrancePhoto)) return 1;
|
|
2122
|
-
return storedSectionPhoto(content) === null ? 0 : 1;
|
|
2123
|
-
}
|
|
2124
|
-
function effectiveContentKnobValue(blockKind, key, value) {
|
|
2125
|
-
const facet = systemCustomizeFacetDefinitionsForBlock(blockKind).find((entry) => entry.target.kind === "content-field" && entry.target.field === key);
|
|
2126
|
-
return facet?.target.kind === "content-field" && facet.target.boolean ? value === "true" : value;
|
|
2127
|
-
}
|
|
2128
|
-
function arrangementContentHooks(effective, mode, length, facts, values, photoCount) {
|
|
2129
|
-
return {
|
|
2130
|
-
"data-look": effective.look.id,
|
|
2131
|
-
"data-treat": effective.treatment,
|
|
2132
|
-
"data-arrangement": effective.look.structure.byMode[mode ?? "default"],
|
|
2133
|
-
...mode !== null ? { "data-mode": mode } : {},
|
|
2134
|
-
...length !== null ? { "data-length": length } : {},
|
|
2135
|
-
...Object.fromEntries(Object.entries(facts).map(([key, value]) => [`data-has-${key}`, String(value)])),
|
|
2136
|
-
"data-photo-count": String(photoCount),
|
|
2137
|
-
...Object.fromEntries(Object.entries(values).map(([key, value]) => [`data-knob-${key === "titleSize" ? "headline" : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`)}`, value]))
|
|
2138
|
-
};
|
|
2139
|
-
}
|
|
2140
|
-
function applyArrangementRhythm(entry, position) {
|
|
2141
|
-
const runtime = arrangementRuntime(entry.renderableContent);
|
|
2142
|
-
const look = effectiveLookFromContent(entry.renderableContent);
|
|
2143
|
-
if (!runtime || !look) return entry;
|
|
2144
|
-
const rhythm = runtime.rhythm.length === 0 ? null : runtime.rhythm[position % runtime.rhythm.length];
|
|
2145
|
-
const content = entry.renderableContent;
|
|
2146
|
-
const resolved = resolveSectionBackground(parseCanonicalRuntimeBackground(content), null, rhythm, heroPhotoGround(entry.block.kind, entry.kind === "renderable" ? entry.effectiveArrangementKey ?? void 0 : void 0));
|
|
2147
|
-
const updated = applyResolvedArrangementBackground(content, resolved);
|
|
2148
|
-
const surface = arrangementGroundToken(resolved);
|
|
2149
|
-
const grounded = resolveArrangementRoleSurfaces(look, runtime, resolved);
|
|
2150
|
-
const tinted = resolveArrangementTints(updated, grounded, runtime, surface) ?? grounded;
|
|
2151
|
-
const shape = sectionShapeHook(sectionShapeForGround(runtime.fieldGrounds, surface));
|
|
2152
|
-
return {
|
|
2153
|
-
...entry,
|
|
2154
|
-
styleBackground: arrangementGroundToken(resolveSectionBackground({ kind: "none" }, null, rhythm)),
|
|
2155
|
-
renderableContent: {
|
|
2156
|
-
...updated,
|
|
2157
|
-
_effectiveLook: tinted,
|
|
2158
|
-
_lookHooks: {
|
|
2159
|
-
...isObjectRecord(updated._lookHooks) ? updated._lookHooks : {},
|
|
2160
|
-
"data-surface": surface,
|
|
2161
|
-
...shape
|
|
2162
|
-
}
|
|
2163
|
-
}
|
|
2164
|
-
};
|
|
2165
|
-
}
|
|
2166
|
-
function arrangementGroundToken(resolved) {
|
|
2167
|
-
if (resolved.kind === "base") return "background";
|
|
2168
|
-
switch (resolved.background.type) {
|
|
2169
|
-
case "image":
|
|
2170
|
-
case "video": return "media";
|
|
2171
|
-
case "color": return resolved.background.color ?? "background";
|
|
2172
|
-
case "gradient": return "gradient";
|
|
2173
|
-
}
|
|
2174
|
-
}
|
|
2175
|
-
function applyResolvedArrangementBackground(content, resolved) {
|
|
2176
|
-
const section = isObjectRecord(content._sectionStyles) ? content._sectionStyles : {};
|
|
2177
|
-
const photo = isObjectRecord(section.background) ? section.background.image : void 0;
|
|
2178
|
-
const ground = resolved.kind === "base" ? void 0 : resolved.background;
|
|
2179
|
-
const background = photo !== void 0 ? {
|
|
2180
|
-
...ground ?? {
|
|
2181
|
-
type: "color",
|
|
2182
|
-
color: "background"
|
|
2183
|
-
},
|
|
2184
|
-
image: photo
|
|
2185
|
-
} : ground;
|
|
2186
|
-
return {
|
|
2187
|
-
...content,
|
|
2188
|
-
_sectionStyles: {
|
|
2189
|
-
...section,
|
|
2190
|
-
background
|
|
2191
|
-
}
|
|
2192
|
-
};
|
|
2193
|
-
}
|
|
2194
|
-
function planPageBlock(block, input, resolveTarget) {
|
|
2195
|
-
const outcome = planBlock(block, getRenderableContent(block, input.previewStage), resolveTarget, input.audience, input.siteStyleId ?? null);
|
|
2196
|
-
if (outcome.kind !== "diagnostic") return {
|
|
2197
|
-
kind: "admitted",
|
|
2198
|
-
entry: outcome
|
|
2199
|
-
};
|
|
2200
|
-
const resolved = resolveTarget(block.kind);
|
|
2201
|
-
const debug = blockDiagnosticContext(resolved, input);
|
|
2202
|
-
return input.audience === "public" ? {
|
|
2203
|
-
kind: "omitted",
|
|
2204
|
-
omission: {
|
|
2205
|
-
blockId: block.id ?? null,
|
|
2206
|
-
blockKind: block.kind,
|
|
2207
|
-
reason: outcome.reason,
|
|
2208
|
-
override: resolved.override,
|
|
2209
|
-
debug
|
|
2210
|
-
}
|
|
2211
|
-
} : {
|
|
2212
|
-
kind: "admitted",
|
|
2213
|
-
entry: {
|
|
2214
|
-
...outcome,
|
|
2215
|
-
debug
|
|
2216
|
-
}
|
|
2217
|
-
};
|
|
2218
|
-
}
|
|
2219
|
-
function blockDiagnosticContext(resolved, input) {
|
|
2220
|
-
return {
|
|
2221
|
-
hasOverride: Boolean(resolved.override),
|
|
2222
|
-
sdkCustomBlocksCount: input.sdkConfig?.customBlocks?.length ?? 0,
|
|
2223
|
-
dbCustomBlocksCount: input.customBlocks?.length ?? 0,
|
|
2224
|
-
manifestKeys: resolved.definition ? Object.keys(resolved.definition.manifest).sort() : null
|
|
2225
|
-
};
|
|
2226
|
-
}
|
|
2227
|
-
function resolveArrangementTints(content, look, runtime, ground) {
|
|
2228
|
-
if (!look.surfaceTints) return null;
|
|
2229
|
-
const context = runtime.surfaceContext;
|
|
2230
|
-
const surfaces = arrangementSlotNames.flatMap((slot) => {
|
|
2231
|
-
const tint = look.surfaceTints?.[slot];
|
|
2232
|
-
if (!tint || tint.knob && content[tint.knob] !== true) return [];
|
|
2233
|
-
const owned = look.itemSurfaces[slot];
|
|
2234
|
-
return [[slot, resolveSurface({
|
|
2235
|
-
kind: "tint",
|
|
2236
|
-
base: owned?.kind === "owned" && owned.paint.kind === "solid" ? owned.paint.token : ground,
|
|
2237
|
-
source: tint.source,
|
|
2238
|
-
opacity: tint.opacity,
|
|
2239
|
-
gradient: tint.gradient
|
|
2240
|
-
}, context)]];
|
|
2241
|
-
});
|
|
2242
|
-
return {
|
|
2243
|
-
...look,
|
|
2244
|
-
itemSurfaces: {
|
|
2245
|
-
...look.itemSurfaces,
|
|
2246
|
-
...Object.fromEntries(surfaces)
|
|
2247
|
-
}
|
|
2248
|
-
};
|
|
2249
|
-
}
|
|
2250
|
-
function resolveArrangementRoleSurfaces(look, runtime, background) {
|
|
2251
|
-
const ground = deriveSectionGround(background, runtime.surfaceContext.palette);
|
|
2252
|
-
const style = {
|
|
2253
|
-
roleMap: look.roleMap,
|
|
2254
|
-
surfaces: runtime.surfaces,
|
|
2255
|
-
context: runtime.surfaceContext
|
|
2256
|
-
};
|
|
2257
|
-
const roleSurfaces = {
|
|
2258
|
-
card: resolveItemSurface("card", ground, style),
|
|
2259
|
-
statement: resolveItemSurface("statement", ground, style),
|
|
2260
|
-
highlight: resolveItemSurface("highlight", ground, style)
|
|
2261
|
-
};
|
|
2262
|
-
return {
|
|
2263
|
-
...look,
|
|
2264
|
-
ground,
|
|
2265
|
-
roleSurfaces,
|
|
2266
|
-
itemSurfaces: resolveLookSlotSurfaces(look, look.itemRoles, roleSurfaces)
|
|
2267
|
-
};
|
|
2268
|
-
}
|
|
2269
|
-
function heroPhotoGround(blockKind, arrangementKey) {
|
|
2270
|
-
return blockKind === "block.hero" ? { paintsGround: heroPhotoPaintsGround(arrangementKey) } : void 0;
|
|
2271
|
-
}
|
|
2272
|
-
//#endregion
|
|
2273
|
-
//#region ../blocks/src/system/data/utils.ts
|
|
2274
|
-
/**
|
|
2275
|
-
* Normalize data loaders from block definition
|
|
2276
|
-
*/
|
|
2277
|
-
function normalizeDataLoaders(def) {
|
|
2278
|
-
if (!def?.dataLoaders) return [];
|
|
2279
|
-
return Object.entries(def.dataLoaders).map(([key, loader]) => ({
|
|
2280
|
-
key,
|
|
2281
|
-
loader
|
|
2282
|
-
}));
|
|
2283
|
-
}
|
|
2284
|
-
/**
|
|
2285
|
-
* Normalize params for API calls.
|
|
2286
|
-
* Converts supplied values to strings, preserving absent versus explicitly empty params.
|
|
2287
|
-
*/
|
|
2288
|
-
function normalizeParams(input) {
|
|
2289
|
-
if (!input || typeof input !== "object") return {};
|
|
2290
|
-
const output = {};
|
|
2291
|
-
for (const [key, value] of Object.entries(input)) if (value !== void 0 && value !== null) output[key] = coerceToString(value);
|
|
2292
|
-
return output;
|
|
2293
|
-
}
|
|
2294
|
-
function isNonArrayObject(value) {
|
|
2295
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2296
|
-
}
|
|
2297
|
-
function safeJsonStringify(value) {
|
|
2298
|
-
try {
|
|
2299
|
-
return JSON.stringify(value);
|
|
2300
|
-
} catch {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Coerce value to string for API params
|
|
2306
|
-
*/
|
|
2307
|
-
function coerceToString(value) {
|
|
2308
|
-
if (value === null || value === void 0) return "";
|
|
2309
|
-
if (Array.isArray(value)) {
|
|
2310
|
-
if (value.some(isNonArrayObject)) {
|
|
2311
|
-
const json = safeJsonStringify(value);
|
|
2312
|
-
if (typeof json === "string") return json;
|
|
2313
|
-
}
|
|
2314
|
-
return value.map(coerceToString).join(",");
|
|
2315
|
-
}
|
|
2316
|
-
if (isNonArrayObject(value)) {
|
|
2317
|
-
const json = safeJsonStringify(value);
|
|
2318
|
-
if (typeof json === "string") return json;
|
|
2319
|
-
}
|
|
2320
|
-
if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || typeof value === "bigint") return String(value);
|
|
2321
|
-
return "";
|
|
2322
|
-
}
|
|
2323
|
-
/**
|
|
2324
|
-
* The appointment-services catalogue (issue 1403) pairs the services with the
|
|
2325
|
-
* site's ordered categories. Both are needed to group them, so that response
|
|
2326
|
-
* is passed through whole; any other `{ services }` wrapper is unwrapped.
|
|
2327
|
-
*/
|
|
2328
|
-
function coerceServicesPayload(record) {
|
|
2329
|
-
return Array.isArray(record.services) && Array.isArray(record.categories) ? {
|
|
2330
|
-
services: record.services,
|
|
2331
|
-
categories: record.categories
|
|
2332
|
-
} : record.services;
|
|
2333
|
-
}
|
|
2334
|
-
/**
|
|
2335
|
-
* Extract data from API response.
|
|
2336
|
-
* Unwraps common response wrappers: { data }, { form }, { entries }, { services }, { teamMembers }
|
|
2337
|
-
*
|
|
2338
|
-
* Note: We check that properties are NOT functions to avoid returning
|
|
2339
|
-
* built-in methods like Array.prototype.entries
|
|
2340
|
-
*/
|
|
2341
|
-
function coercePayload(payload) {
|
|
2342
|
-
const linkedContentEntries = coerceLinkedContentEntriesPayload(payload);
|
|
2343
|
-
if (linkedContentEntries !== payload) return linkedContentEntries;
|
|
2344
|
-
if (payload && typeof payload === "object" && !Array.isArray(payload)) {
|
|
2345
|
-
const record = payload;
|
|
2346
|
-
if ("data" in record && typeof record.data !== "function") return record.data;
|
|
2347
|
-
if ("form" in record && typeof record.form !== "function") return record.form;
|
|
2348
|
-
if ("entries" in record && typeof record.entries !== "function") return record.entries;
|
|
2349
|
-
if ("services" in record && typeof record.services !== "function") return coerceServicesPayload(record);
|
|
2350
|
-
if ("teamMembers" in record && typeof record.teamMembers !== "function") return record.teamMembers;
|
|
2351
|
-
}
|
|
2352
|
-
return payload;
|
|
2353
|
-
}
|
|
2354
|
-
//#endregion
|
|
2355
|
-
//#region ../blocks/src/system/data/fetchLoaderData.ts
|
|
2356
|
-
const ALL_PAGE_SIZE = 50;
|
|
2357
|
-
/** The shared loader owns All pagination and rejects adapters that repeat a page. */
|
|
2358
|
-
async function fetchLoaderData(apiClient, endpoint, params) {
|
|
2359
|
-
if (params.limit === "all") return fetchAllPages(apiClient, endpoint, params, 0, /* @__PURE__ */ new Set());
|
|
2360
|
-
return coercePayload(await apiClient({
|
|
2361
|
-
endpoint,
|
|
2362
|
-
params
|
|
2363
|
-
}));
|
|
2364
|
-
}
|
|
2365
|
-
function planLoaderPage(data, offset, seenPages) {
|
|
2366
|
-
if (!isUnknownArray(data)) return {
|
|
2367
|
-
kind: "invalid",
|
|
2368
|
-
message: "Expected paged loader entries"
|
|
2369
|
-
};
|
|
2370
|
-
if (data.length < ALL_PAGE_SIZE) return {
|
|
2371
|
-
kind: "complete",
|
|
2372
|
-
entries: data
|
|
2373
|
-
};
|
|
2374
|
-
const ids = data.map((entry) => isObjectRecord(entry) && typeof entry.id === "string" ? entry.id : null);
|
|
2375
|
-
const key = JSON.stringify(ids.every((id) => id !== null) ? [...ids].sort() : data);
|
|
2376
|
-
if (seenPages.has(key)) return {
|
|
2377
|
-
kind: "invalid",
|
|
2378
|
-
message: "Paged loader made no progress"
|
|
2379
|
-
};
|
|
2380
|
-
return {
|
|
2381
|
-
kind: "continue",
|
|
2382
|
-
entries: data,
|
|
2383
|
-
offset: offset + data.length,
|
|
2384
|
-
seenPages: /* @__PURE__ */ new Set([...seenPages, key])
|
|
2385
|
-
};
|
|
2386
|
-
}
|
|
2387
|
-
async function fetchAllPages(apiClient, endpoint, params, offset, seenPages) {
|
|
2388
|
-
const page = planLoaderPage(coercePayload(await apiClient({
|
|
2389
|
-
endpoint,
|
|
2390
|
-
params: {
|
|
2391
|
-
...params,
|
|
2392
|
-
limit: String(ALL_PAGE_SIZE),
|
|
2393
|
-
offset: String(offset)
|
|
2394
|
-
}
|
|
2395
|
-
})), offset, seenPages);
|
|
2396
|
-
switch (page.kind) {
|
|
2397
|
-
case "invalid": throw new Error(page.message);
|
|
2398
|
-
case "complete": return page.entries;
|
|
2399
|
-
case "continue": return [...page.entries, ...await fetchAllPages(apiClient, endpoint, params, page.offset, page.seenPages)];
|
|
2400
|
-
default: return assertNever(page);
|
|
2401
|
-
}
|
|
2402
|
-
}
|
|
2403
|
-
function isUnknownArray(value) {
|
|
2404
|
-
return Array.isArray(value);
|
|
2405
|
-
}
|
|
2406
|
-
//#endregion
|
|
2407
|
-
//#region ../blocks/src/system/runtime/bindings.ts
|
|
2408
|
-
const shouldLogWarnings = isNonProductionEnv();
|
|
2409
|
-
function isPlainObject(value) {
|
|
2410
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2411
|
-
}
|
|
2412
|
-
function isRouteMapEntry(value) {
|
|
2413
|
-
if (typeof value === "string") return true;
|
|
2414
|
-
return isPlainObject(value);
|
|
2415
|
-
}
|
|
2416
|
-
function isRouteMap(value) {
|
|
2417
|
-
if (!isPlainObject(value)) return false;
|
|
2418
|
-
return Object.values(value).every(isRouteMapEntry);
|
|
2419
|
-
}
|
|
2420
|
-
function isPageIdentifierMap(value) {
|
|
2421
|
-
if (!isPlainObject(value)) return false;
|
|
2422
|
-
return Object.values(value).every((v) => typeof v === "string");
|
|
2423
|
-
}
|
|
2424
|
-
function isEntryIdentifierMap(value) {
|
|
2425
|
-
if (!isPlainObject(value)) return false;
|
|
2426
|
-
for (const v of Object.values(value)) {
|
|
2427
|
-
if (!isPlainObject(v)) return false;
|
|
2428
|
-
if (!Object.values(v).every((inner) => typeof inner === "string")) return false;
|
|
2429
|
-
}
|
|
2430
|
-
return true;
|
|
2431
|
-
}
|
|
2432
|
-
function buildTransformContext(vm, dateContext, now) {
|
|
2433
|
-
const root = vm.$root;
|
|
2434
|
-
const stage = root && isPlainObject(root) && root.previewStage === "preview" ? "preview" : "published";
|
|
2435
|
-
const routes = root && isPlainObject(root) && isRouteMap(root.routes) ? root.routes : void 0;
|
|
2436
|
-
const pagesByIdentifier = root && isPlainObject(root) && isPageIdentifierMap(root.pagesByIdentifier) ? root.pagesByIdentifier : void 0;
|
|
2437
|
-
const entriesByIdentifier = root && isPlainObject(root) && isEntryIdentifierMap(root.entriesByIdentifier) ? root.entriesByIdentifier : void 0;
|
|
2438
|
-
return {
|
|
2439
|
-
theme: defaultThemeTokens,
|
|
2440
|
-
dateContext,
|
|
2441
|
-
now,
|
|
2442
|
-
stage,
|
|
2443
|
-
data: vm.content,
|
|
2444
|
-
routes,
|
|
2445
|
-
pagesByIdentifier,
|
|
2446
|
-
entriesByIdentifier
|
|
2447
|
-
};
|
|
2448
|
-
}
|
|
2449
|
-
function resolveParamsBindings(input, vm, meta, dateContext = resolveDateRuntimeContext(typeof vm.$root?.bookingTimeZone === "string" ? vm.$root.bookingTimeZone : void 0), now = readRuntimeNow(vm.$root?.now)) {
|
|
2450
|
-
return resolveLoaderParam(input, {
|
|
2451
|
-
vm,
|
|
2452
|
-
meta,
|
|
2453
|
-
transforms: buildTransformContext(vm, dateContext, now)
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
function resolveLoaderParam(input, runtime) {
|
|
2457
|
-
if (input === null || typeof input !== "object") return input;
|
|
2458
|
-
if (Array.isArray(input)) return input.map((value) => resolveLoaderParam(value, runtime));
|
|
2459
|
-
const inputRecord = input;
|
|
2460
|
-
const binding = inputRecord.$bind;
|
|
2461
|
-
if (binding && typeof binding === "object") return resolveBoundLoaderParam(binding, runtime);
|
|
2462
|
-
return Object.fromEntries(Object.entries(inputRecord).map(([key, value]) => [key, resolveLoaderParam(value, runtime)]));
|
|
2463
|
-
}
|
|
2464
|
-
function resolveBoundLoaderParam(input, runtime) {
|
|
2465
|
-
try {
|
|
2466
|
-
const binding = bindingSchema.parse(input);
|
|
2467
|
-
const value = resolveBinding(binding.from, runtime.vm);
|
|
2468
|
-
const resolved = value === void 0 || value === null ? binding.fallback : runTransforms(value, binding.transforms, runtime.transforms, defaultTransforms);
|
|
2469
|
-
return resolved === void 0 || resolved === null || resolved === "" ? binding.fallback : resolved;
|
|
2470
|
-
} catch (err) {
|
|
2471
|
-
if (shouldLogWarnings) console.warn(`bindings: failed to parse loader param binding for block "${runtime.meta?.blockKind ?? "unknown"}"`, err);
|
|
2472
|
-
return;
|
|
2473
|
-
}
|
|
2474
|
-
}
|
|
2475
|
-
function resolveBinding(path, vm) {
|
|
2476
|
-
const segments = splitPath(path);
|
|
2477
|
-
if (!segments.length) return void 0;
|
|
2478
|
-
const [first, ...rest] = segments;
|
|
2479
|
-
let source = vm;
|
|
2480
|
-
if (first === "$root") {
|
|
2481
|
-
source = vm;
|
|
2482
|
-
return readFromSource(source, [first, ...rest]);
|
|
2483
|
-
}
|
|
2484
|
-
if (first === "content") {
|
|
2485
|
-
source = vm.content;
|
|
2486
|
-
return readFromSource(source, rest);
|
|
2487
|
-
}
|
|
2488
|
-
const contentResult = readFromSource(vm.content, segments);
|
|
2489
|
-
if (contentResult !== void 0) return contentResult;
|
|
2490
|
-
return readFromSource(vm, segments);
|
|
2491
|
-
}
|
|
2492
|
-
function splitPath(path) {
|
|
2493
|
-
const PATH_SEPARATOR_REGEX = /\./g;
|
|
2494
|
-
const BRACKET_ACCESS_REGEX = /\[(?<token>[^\]]+)\]/g;
|
|
2495
|
-
const segments = [];
|
|
2496
|
-
const parts = path.split(PATH_SEPARATOR_REGEX);
|
|
2497
|
-
for (const raw of parts) {
|
|
2498
|
-
if (!raw) continue;
|
|
2499
|
-
const baseMatch = raw.match(/^([^\[]+)/);
|
|
2500
|
-
if (baseMatch && baseMatch[1]) segments.push(baseMatch[1]);
|
|
2501
|
-
const bracketMatches = raw.matchAll(BRACKET_ACCESS_REGEX);
|
|
2502
|
-
for (const match of bracketMatches) {
|
|
2503
|
-
const token = match.groups?.token ?? "";
|
|
2504
|
-
if (token.startsWith("\"") || token.startsWith("'")) segments.push(token.slice(1, -1));
|
|
2505
|
-
else if (/^\d+$/.test(token)) segments.push(Number(token));
|
|
2506
|
-
else segments.push(token);
|
|
2507
|
-
}
|
|
2508
|
-
if (!baseMatch && !raw.includes("[")) segments.push(raw);
|
|
2509
|
-
}
|
|
2510
|
-
return segments;
|
|
2511
|
-
}
|
|
2512
|
-
function readFromSource(source, segments) {
|
|
2513
|
-
return segments.reduce((current, segment) => {
|
|
2514
|
-
if (current === void 0 || current === null) return void 0;
|
|
2515
|
-
if (typeof segment === "number") {
|
|
2516
|
-
if (Array.isArray(current)) return current[segment];
|
|
2517
|
-
return;
|
|
2518
|
-
}
|
|
2519
|
-
if (typeof current === "object" && current !== null && segment in current) return current[segment];
|
|
2520
|
-
}, source);
|
|
2521
|
-
}
|
|
2522
|
-
function isNonProductionEnv() {
|
|
2523
|
-
if (typeof globalThis === "undefined") return true;
|
|
2524
|
-
return globalThis.process?.env?.NODE_ENV !== "production";
|
|
2525
|
-
}
|
|
2526
|
-
//#endregion
|
|
2527
|
-
//#region ../blocks/src/system/data/prefetchBlockData.ts
|
|
2528
|
-
/**
|
|
2529
|
-
* Core block data prefetching logic (framework-agnostic).
|
|
2530
|
-
*
|
|
2531
|
-
* This module provides the shared implementation for prefetching block data loaders.
|
|
2532
|
-
* It works with any API client by accepting it as a parameter (dependency injection).
|
|
2533
|
-
*
|
|
2534
|
-
* Usage:
|
|
2535
|
-
* - Frontend: provide internal API client
|
|
2536
|
-
* - SDK: provide SDK client with endpoint mapping
|
|
2537
|
-
*/
|
|
2538
|
-
function projectDataLoaders(loaders, shouldLoad, blockId, blockKind) {
|
|
2539
|
-
if (!shouldLoad) return [...loaders];
|
|
2540
|
-
return loaders.filter(({ key }) => shouldLoad({
|
|
2541
|
-
blockId,
|
|
2542
|
-
blockKind,
|
|
2543
|
-
loaderKey: key
|
|
2544
|
-
}));
|
|
2545
|
-
}
|
|
2546
|
-
function shouldSkipResolvedLoader(input) {
|
|
2547
|
-
if (input.loader.requiredParams?.some((param) => !input.params[param]?.trim())) return true;
|
|
2548
|
-
return Boolean(input.isValidEndpoint && !input.isValidEndpoint(input.endpoint));
|
|
2549
|
-
}
|
|
2550
|
-
/** Resolve once through the shared bindings owner; request reuse never reuses content provenance. */
|
|
2551
|
-
function planBlockDataRequests(page, context, options = {}) {
|
|
2552
|
-
const runtime = admitLoaderDateRuntime(context);
|
|
2553
|
-
const blocks = page.blocks.flatMap((block) => block.id ? [planBlockRequests(block, block.id, context, options, runtime)] : []);
|
|
2554
|
-
return {
|
|
2555
|
-
blocks,
|
|
2556
|
-
loaderSnapshot: {
|
|
2557
|
-
stage: context.previewStage === "preview" ? "draft" : "published",
|
|
2558
|
-
blocks: Object.fromEntries(blocks.map((block) => [block.id, {
|
|
2559
|
-
kind: block.kind,
|
|
2560
|
-
content: block.content,
|
|
2561
|
-
requests: Object.fromEntries(block.requests.map(({ key, endpoint, params }) => [key, {
|
|
2562
|
-
endpoint,
|
|
2563
|
-
params
|
|
2564
|
-
}]))
|
|
2565
|
-
}]))
|
|
2566
|
-
}
|
|
2567
|
-
};
|
|
2568
|
-
}
|
|
2569
|
-
async function prefetchBlockDataWithFailures$1(page, context, options) {
|
|
2570
|
-
const plan = planBlockDataRequests(page, context, options);
|
|
2571
|
-
return projectBlockDataOutcomes(plan, await Promise.all(plan.blocks.flatMap((block) => block.requests.map((request) => executeBlockDataRequest(request, options)))));
|
|
2572
|
-
}
|
|
2573
|
-
function projectBlockDataOutcomes(plan, outcomes) {
|
|
2574
|
-
return {
|
|
2575
|
-
...projectLoaderOutcomes(plan.blocks, outcomes),
|
|
2576
|
-
loaderSnapshot: plan.loaderSnapshot
|
|
2577
|
-
};
|
|
2578
|
-
}
|
|
2579
|
-
function planBlockRequests(block, id, context, options, runtime) {
|
|
2580
|
-
const definition = (options.getBlockDefinition ?? getBlockDefinition)(block.kind);
|
|
2581
|
-
const loaders = definition ? normalizeDataLoaders(definition) : customLoaders(block.kind, options);
|
|
2582
|
-
const vm = {
|
|
2583
|
-
content: plannedLoaderContent(block, definition, context),
|
|
2584
|
-
$root: {
|
|
2585
|
-
...context.root,
|
|
2586
|
-
siteId: context.siteId,
|
|
2587
|
-
pageId: context.pageId,
|
|
2588
|
-
previewStage: context.previewStage
|
|
2589
|
-
}
|
|
2590
|
-
};
|
|
2591
|
-
const requests = projectDataLoaders(loaders, options.shouldLoad, id, block.kind).flatMap((entry) => {
|
|
2592
|
-
const request = planLoaderRequest(entry, block, id, vm, options, runtime);
|
|
2593
|
-
return request ? [request] : [];
|
|
2594
|
-
});
|
|
2595
|
-
return {
|
|
2596
|
-
id,
|
|
2597
|
-
kind: block.kind,
|
|
2598
|
-
content: selectBlockContent(block, context.previewStage),
|
|
2599
|
-
requests
|
|
2600
|
-
};
|
|
2601
|
-
}
|
|
2602
|
-
function customLoaders(kind, options) {
|
|
2603
|
-
return Object.entries(options.getCustomBlockLoaders?.(kind) ?? {}).map(([key, loader]) => ({
|
|
2604
|
-
key,
|
|
2605
|
-
loader
|
|
2606
|
-
}));
|
|
2607
|
-
}
|
|
2608
|
-
function planLoaderRequest({ key, loader }, block, blockId, vm, options, runtime) {
|
|
2609
|
-
if (loader.mode === "client") return null;
|
|
2610
|
-
const resolve = options.resolveParamsBindings ?? resolveParamsBindings;
|
|
2611
|
-
const coordinates = { blockKind: block.kind };
|
|
2612
|
-
if (loader.when !== void 0 && resolve(loader.when, vm, coordinates, runtime.dateContext, runtime.now) !== true) return null;
|
|
2613
|
-
const params = normalizeParams(resolve(loader.params, vm, coordinates, runtime.dateContext, runtime.now));
|
|
2614
|
-
if (shouldSkipResolvedLoader({
|
|
2615
|
-
loader,
|
|
2616
|
-
endpoint: loader.endpoint,
|
|
2617
|
-
params,
|
|
2618
|
-
isValidEndpoint: options.isValidEndpoint
|
|
2619
|
-
})) return null;
|
|
2620
|
-
return {
|
|
2621
|
-
blockId,
|
|
2622
|
-
blockKind: block.kind,
|
|
2623
|
-
key,
|
|
2624
|
-
endpoint: loader.endpoint,
|
|
2625
|
-
params
|
|
2626
|
-
};
|
|
2627
|
-
}
|
|
2628
|
-
async function executeBlockDataRequest(request, options) {
|
|
2629
|
-
try {
|
|
2630
|
-
return {
|
|
2631
|
-
kind: "loaded",
|
|
2632
|
-
request,
|
|
2633
|
-
data: await fetchLoaderData(options.apiClient, request.endpoint, request.params)
|
|
2634
|
-
};
|
|
2635
|
-
} catch (error) {
|
|
2636
|
-
options.onError?.(error, {
|
|
2637
|
-
block: request.blockKind,
|
|
2638
|
-
loader: request.key
|
|
2639
|
-
});
|
|
2640
|
-
return {
|
|
2641
|
-
kind: "failed",
|
|
2642
|
-
request
|
|
2643
|
-
};
|
|
2644
|
-
}
|
|
2645
|
-
}
|
|
2646
|
-
function projectLoaderOutcomes(blocks, outcomes) {
|
|
2647
|
-
return {
|
|
2648
|
-
resolvedData: Object.fromEntries(blocks.flatMap((block) => {
|
|
2649
|
-
const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "loaded" ? [[outcome.request.key, outcome.data]] : []);
|
|
2650
|
-
return values.length ? [[block.id, Object.fromEntries(values)]] : [];
|
|
2651
|
-
})),
|
|
2652
|
-
loaderFailures: Object.fromEntries(blocks.flatMap((block) => {
|
|
2653
|
-
const values = outcomes.flatMap((outcome) => outcome.request.blockId === block.id && outcome.kind === "failed" ? [[outcome.request.key, {
|
|
2654
|
-
endpoint: outcome.request.endpoint,
|
|
2655
|
-
params: outcome.request.params
|
|
2656
|
-
}]] : []);
|
|
2657
|
-
return values.length ? [[block.id, Object.fromEntries(values)]] : [];
|
|
2658
|
-
}))
|
|
2659
|
-
};
|
|
2660
|
-
}
|
|
2661
|
-
/** Prefetch executes the render-plan content stage before resolving loader bindings. */
|
|
2662
|
-
function plannedLoaderContent(block, definition, context) {
|
|
2663
|
-
const content = selectBlockContent(block, context.previewStage);
|
|
2664
|
-
if (!definition || content._arrangementLooks === void 0) return content;
|
|
2665
|
-
return planArrangementContent(block.kind, definition.manifest, content, context.previewStage === "preview" ? "authoring" : "public");
|
|
2666
|
-
}
|
|
2667
|
-
function admitLoaderDateRuntime(context) {
|
|
2668
|
-
const root = context.root;
|
|
2669
|
-
return {
|
|
2670
|
-
now: root?.now === void 0 ? toUtcIsoDateTimeString((/* @__PURE__ */ new Date()).toISOString()) : readRuntimeNow(root.now),
|
|
2671
|
-
dateContext: resolveDateRuntimeContext(typeof root?.bookingTimeZone === "string" ? root.bookingTimeZone : void 0)
|
|
2672
|
-
};
|
|
2673
|
-
}
|
|
2674
|
-
//#endregion
|
|
2675
|
-
//#region ../blocks/src/system/data/normalizeLoaderParams.ts
|
|
2676
|
-
function toStringParams(value) {
|
|
2677
|
-
if (!isObjectRecord(value)) return {};
|
|
2678
|
-
const out = {};
|
|
2679
|
-
for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
|
|
2680
|
-
return out;
|
|
2681
|
-
}
|
|
2682
|
-
function stripEmptyStringValues(params, endpoint) {
|
|
2683
|
-
for (const [key, value] of Object.entries(params)) if (value === "" && !(key === "seriesIds" && (endpoint === "listPublicEvents" || endpoint === "listPublicEventCalendarWindow"))) delete params[key];
|
|
2684
|
-
}
|
|
2685
|
-
function ensureSiteId(params, context) {
|
|
2686
|
-
if (!params.siteId && typeof context.siteId === "string" && context.siteId) params.siteId = context.siteId;
|
|
2687
|
-
}
|
|
2688
|
-
/**
|
|
2689
|
-
* Normalize loader params emitted by the block runtime into a consistent shape
|
|
2690
|
-
* (canonical keys + required context-derived fields).
|
|
2691
|
-
*
|
|
2692
|
-
* Note: params are already stringified by the core prefetch implementation.
|
|
2693
|
-
*/
|
|
2694
|
-
function normalizeLoaderParams(endpoint, params, context) {
|
|
2695
|
-
const out = toStringParams(params);
|
|
2696
|
-
stripEmptyStringValues(out, endpoint);
|
|
2697
|
-
if (endpoint === "getPublicFormById") {
|
|
2698
|
-
ensureSiteId(out, context);
|
|
2699
|
-
if (!out.formId && out.formSlug) {
|
|
2700
|
-
out.formId = out.formSlug;
|
|
2701
|
-
delete out.formSlug;
|
|
2702
|
-
}
|
|
2703
|
-
return out;
|
|
2704
|
-
}
|
|
2705
|
-
if (endpoint === "getPublicBookingServices") {
|
|
2706
|
-
ensureSiteId(out, context);
|
|
2707
|
-
return out;
|
|
2708
|
-
}
|
|
2709
|
-
if (endpoint === "getPublicWeeklySlotAvailability") {
|
|
2710
|
-
ensureSiteId(out, context);
|
|
2711
|
-
return out;
|
|
2712
|
-
}
|
|
2713
|
-
if (endpoint === "listPublicEvents" || endpoint === "listPublicRecurringSchedule" || endpoint === "listPublicEventCalendarWindow") {
|
|
2714
|
-
ensureSiteId(out, context);
|
|
2715
|
-
return out;
|
|
2716
|
-
}
|
|
2717
|
-
if (endpoint === "getPublicEventDetails") {
|
|
2718
|
-
ensureSiteId(out, context);
|
|
2719
|
-
return out;
|
|
2720
|
-
}
|
|
2721
|
-
if (endpoint === "listPublicProducts") {
|
|
2722
|
-
ensureSiteId(out, context);
|
|
2723
|
-
return out;
|
|
2724
|
-
}
|
|
2725
|
-
if (endpoint === "listPublicTeamMembers") {
|
|
2726
|
-
ensureSiteId(out, context);
|
|
2727
|
-
return out;
|
|
2728
|
-
}
|
|
2729
|
-
if (endpoint === "listPublicRouteCandidates") {
|
|
2730
|
-
ensureSiteId(out, context);
|
|
2731
|
-
return out;
|
|
2732
|
-
}
|
|
2733
|
-
if (endpoint === "getPublishedEntryPreview") {
|
|
2734
|
-
ensureSiteId(out, context);
|
|
2735
|
-
return out;
|
|
2736
|
-
}
|
|
2737
|
-
ensureSiteId(out, context);
|
|
2738
|
-
return out;
|
|
2739
|
-
}
|
|
2740
|
-
//#endregion
|
|
2741
|
-
//#region ../theme-core/src/footer/mode.ts
|
|
2742
|
-
const footerModeSchema = z.enum([
|
|
2743
|
-
"default",
|
|
2744
|
-
"blocks",
|
|
2745
|
-
"default+blocks",
|
|
2746
|
-
"none"
|
|
2747
|
-
]);
|
|
2748
|
-
/** Reads only SDK footer intent; unrelated config and theme fields are not authorities. */
|
|
2749
|
-
function resolveSdkFooterMode(config) {
|
|
2750
|
-
const parsed = z.object({ layout: z.object({ footerMode: footerModeSchema.optional() }).optional() }).safeParse(config);
|
|
2751
|
-
return parsed.success ? parsed.data.layout?.footerMode ?? "default" : "default";
|
|
2752
|
-
}
|
|
2753
|
-
z.object({
|
|
2754
|
-
variant: z.enum([
|
|
2755
|
-
"simple",
|
|
2756
|
-
"columns",
|
|
2757
|
-
"split",
|
|
2758
|
-
"centred"
|
|
2759
|
-
]),
|
|
2760
|
-
showLogoText: z.boolean().optional(),
|
|
2761
|
-
logo: z.object({
|
|
2762
|
-
showLogo: z.boolean().optional(),
|
|
2763
|
-
showLogoText: z.boolean().optional()
|
|
2764
|
-
}).optional()
|
|
2765
|
-
});
|
|
2766
|
-
/**
|
|
2767
|
-
* Resolve what to render for the footer given the current mode and whether the
|
|
2768
|
-
* site is SDK-managed.
|
|
2769
|
-
*
|
|
2770
|
-
* Backwards compatible: missing/undefined mode is treated as 'default'.
|
|
2771
|
-
*/
|
|
2772
|
-
function resolveFooterRenderPlan(params) {
|
|
2773
|
-
if (!params.isSdkSite) return {
|
|
2774
|
-
mode: "default",
|
|
2775
|
-
renderDefaultFooter: true,
|
|
2776
|
-
renderFooterBlocks: false
|
|
2777
|
-
};
|
|
2778
|
-
switch (params.mode ?? "default") {
|
|
2779
|
-
case "blocks": return {
|
|
2780
|
-
mode: "blocks",
|
|
2781
|
-
renderDefaultFooter: false,
|
|
2782
|
-
renderFooterBlocks: true
|
|
2783
|
-
};
|
|
2784
|
-
case "default+blocks": return {
|
|
2785
|
-
mode: "default+blocks",
|
|
2786
|
-
renderDefaultFooter: true,
|
|
2787
|
-
renderFooterBlocks: true
|
|
2788
|
-
};
|
|
2789
|
-
case "none": return {
|
|
2790
|
-
mode: "none",
|
|
2791
|
-
renderDefaultFooter: false,
|
|
2792
|
-
renderFooterBlocks: false
|
|
2793
|
-
};
|
|
2794
|
-
default: return {
|
|
2795
|
-
mode: "default",
|
|
2796
|
-
renderDefaultFooter: true,
|
|
2797
|
-
renderFooterBlocks: false
|
|
2798
|
-
};
|
|
2799
|
-
}
|
|
2800
|
-
}
|
|
2801
|
-
z.object({ refreshToken: z.string().min(1).max(4096) }).strict();
|
|
2802
|
-
z.object({
|
|
2803
|
-
accessToken: z.string().min(1).max(4096),
|
|
2804
|
-
refreshToken: z.string().min(1).max(4096)
|
|
2805
|
-
}).strict();
|
|
2806
|
-
z.object({ accessToken: z.string().min(1).max(8192) }).strict();
|
|
2807
|
-
z.object({
|
|
2808
|
-
type: z.literal("riverbank:preview-height"),
|
|
2809
|
-
height: z.number().finite().positive()
|
|
2810
|
-
}).strict();
|
|
2811
|
-
z.object({ type: z.literal("riverbank:preview-failed") }).strict();
|
|
2812
|
-
const ACCOUNT_SITE_CURSOR_MAX_LENGTH = 2048;
|
|
2813
|
-
const ACCOUNT_SITE_TIMESTAMP_PATTERN = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(?:\.(\d{1,6}))?(Z|[+-]\d{2}:\d{2})$/;
|
|
2814
|
-
/** Strict, injection-safe PostgreSQL/RFC3339 timestamp text used in cursors. */
|
|
2815
|
-
function isAccountSiteTimestamp(value) {
|
|
2816
|
-
if (typeof value !== "string") return false;
|
|
2817
|
-
const match = ACCOUNT_SITE_TIMESTAMP_PATTERN.exec(value);
|
|
2818
|
-
if (!match) return false;
|
|
2819
|
-
const [, year, month, day, hour, minute, second, , offset] = match;
|
|
2820
|
-
const date = new Date(Date.UTC(Number(year), Number(month) - 1, Number(day)));
|
|
2821
|
-
const offsetValue = offset ?? "";
|
|
2822
|
-
const offsetIsValid = offsetValue === "Z" || (() => {
|
|
2823
|
-
const offsetMatch = /^(?:[+-])(\d{2}):(\d{2})$/.exec(offsetValue);
|
|
2824
|
-
if (!offsetMatch) return false;
|
|
2825
|
-
return Number(offsetMatch[1]) <= 23 && Number(offsetMatch[2]) <= 59;
|
|
2826
|
-
})();
|
|
2827
|
-
return date.getUTCFullYear() === Number(year) && date.getUTCMonth() === Number(month) - 1 && date.getUTCDate() === Number(day) && Number(hour) <= 23 && Number(minute) <= 59 && Number(second) <= 59 && offsetIsValid;
|
|
2828
|
-
}
|
|
2829
|
-
const accountSiteTimestampSchema = z.string().refine(isAccountSiteTimestamp, { message: "Expected a strict account site timestamp" });
|
|
2830
|
-
z.enum([
|
|
2831
|
-
"managed",
|
|
2832
|
-
"headless_cms",
|
|
2833
|
-
"headless_full"
|
|
2834
|
-
]);
|
|
2835
|
-
z.object({ title: z.string().trim().min(1).max(120) });
|
|
2836
|
-
const abandonedStandardKeyIdsSchema = z.object({
|
|
2837
|
-
live: z.string().uuid().optional(),
|
|
2838
|
-
management: z.string().uuid().optional()
|
|
2839
|
-
}).strict();
|
|
2840
|
-
const abandonedPreviewKeyIdsSchema = z.object({
|
|
2841
|
-
live: z.string().uuid().optional(),
|
|
2842
|
-
management: z.string().uuid().optional(),
|
|
2843
|
-
preview: z.string().uuid().optional()
|
|
2844
|
-
}).strict();
|
|
2845
|
-
z.discriminatedUnion("operation", [
|
|
2846
|
-
z.object({
|
|
2847
|
-
operation: z.literal("issue_standard"),
|
|
2848
|
-
siteId: z.string().uuid(),
|
|
2849
|
-
operationId: z.string().uuid(),
|
|
2850
|
-
projectName: z.string().trim().min(1).max(120),
|
|
2851
|
-
abandonedKeyIds: abandonedStandardKeyIdsSchema.default({})
|
|
2852
|
-
}).strict(),
|
|
2853
|
-
z.object({
|
|
2854
|
-
operation: z.literal("issue_with_preview"),
|
|
2855
|
-
siteId: z.string().uuid(),
|
|
2856
|
-
operationId: z.string().uuid(),
|
|
2857
|
-
projectName: z.string().trim().min(1).max(120),
|
|
2858
|
-
abandonedKeyIds: abandonedPreviewKeyIdsSchema.default({})
|
|
2859
|
-
}).strict(),
|
|
2860
|
-
z.object({
|
|
2861
|
-
operation: z.literal("revalidate_standard"),
|
|
2862
|
-
siteId: z.string().uuid(),
|
|
2863
|
-
operationId: z.string().uuid(),
|
|
2864
|
-
projectName: z.string().trim().min(1).max(120),
|
|
2865
|
-
keyIds: z.object({
|
|
2866
|
-
live: z.string().uuid(),
|
|
2867
|
-
management: z.string().uuid()
|
|
2868
|
-
}).strict()
|
|
2869
|
-
}).strict(),
|
|
2870
|
-
z.object({
|
|
2871
|
-
operation: z.literal("revalidate_with_preview"),
|
|
2872
|
-
siteId: z.string().uuid(),
|
|
2873
|
-
operationId: z.string().uuid(),
|
|
2874
|
-
projectName: z.string().trim().min(1).max(120),
|
|
2875
|
-
keyIds: z.object({
|
|
2876
|
-
live: z.string().uuid(),
|
|
2877
|
-
management: z.string().uuid(),
|
|
2878
|
-
preview: z.string().uuid()
|
|
2879
|
-
}).strict()
|
|
2880
|
-
}).strict()
|
|
2881
|
-
]);
|
|
2882
|
-
z.object({
|
|
2883
|
-
cursor: z.string().min(1).max(ACCOUNT_SITE_CURSOR_MAX_LENGTH).optional(),
|
|
2884
|
-
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
2885
|
-
search: z.string().trim().min(1).max(120).optional()
|
|
2886
|
-
});
|
|
2887
|
-
//#endregion
|
|
2888
|
-
//#region ../api/src/utils/isRecord.ts
|
|
2889
|
-
function isRecord$1(value) {
|
|
2890
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2891
|
-
}
|
|
2892
|
-
z.object({
|
|
2893
|
-
formulaVersion: z.literal("managed-domain-overage-v1"),
|
|
2894
|
-
conversionRule: z.literal("usd-to-gbp-1-to-1-v1"),
|
|
2895
|
-
registrarAnnualCost: z.number().nonnegative(),
|
|
2896
|
-
registrarCurrency: z.literal("USD"),
|
|
2897
|
-
includedAnnualAllowance: z.number().nonnegative(),
|
|
2898
|
-
includedAnnualAllowanceCurrency: z.literal("USD"),
|
|
2899
|
-
monthlyAmountCents: z.number().int().nonnegative(),
|
|
2900
|
-
monthlyCurrency: z.literal("gbp")
|
|
2901
|
-
});
|
|
2902
|
-
//#endregion
|
|
2903
|
-
//#region ../api/src/navigation/contracts.ts
|
|
2904
|
-
/**
|
|
2905
|
-
* Canonical navigation/link Zod contracts.
|
|
2906
|
-
*
|
|
2907
|
-
* Goal: a single source-of-truth for link shapes used across dashboard + SDK.
|
|
2908
|
-
* - Types live in `packages/api/src/navigation/types.ts`
|
|
2909
|
-
* - Schemas live here and are tied to types via `satisfies z.ZodType<...>`
|
|
2910
|
-
*/
|
|
2911
|
-
const portalLinkPayloadSchema = z.object({
|
|
2912
|
-
kind: z.literal("portal"),
|
|
2913
|
-
path: z.string().trim().startsWith("/").optional(),
|
|
2914
|
-
labels: z.object({
|
|
2915
|
-
loggedOut: z.string().trim().min(1).optional(),
|
|
2916
|
-
loggedIn: z.string().trim().min(1).optional()
|
|
2917
|
-
}).optional()
|
|
2918
|
-
});
|
|
2919
|
-
const cartLinkLabelConfigSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("icon-only") }), z.object({
|
|
2920
|
-
kind: z.literal("icon-with-label"),
|
|
2921
|
-
label: z.string().trim().min(1)
|
|
2922
|
-
})]);
|
|
2923
|
-
const cartLinkPayloadSchema = z.object({
|
|
2924
|
-
kind: z.literal("cart"),
|
|
2925
|
-
badge: z.enum(["show-count", "hidden"]),
|
|
2926
|
-
label: cartLinkLabelConfigSchema
|
|
2927
|
-
});
|
|
2928
|
-
const internalLinkPayloadSchema = z.object({
|
|
2929
|
-
kind: z.literal("internal"),
|
|
2930
|
-
routeId: z.string().uuid(),
|
|
2931
|
-
entityId: z.string().uuid(),
|
|
2932
|
-
entityType: z.enum(RESOLVED_INTERNAL_LINK_ENTITY_TYPES),
|
|
2933
|
-
href: z.string().min(1),
|
|
2934
|
-
title: z.string().min(1),
|
|
2935
|
-
typeLabel: z.string().min(1),
|
|
2936
|
-
contentTypeKey: z.string().nullable().optional(),
|
|
2937
|
-
contentTypeName: z.string().nullable().optional(),
|
|
2938
|
-
updatedAt: z.string().nullable().optional()
|
|
2939
|
-
}).passthrough();
|
|
2940
|
-
const externalLinkSchema = z.object({
|
|
2941
|
-
kind: z.literal("external"),
|
|
2942
|
-
href: z.string().url()
|
|
2943
|
-
});
|
|
2944
|
-
const customLinkSchema = z.object({
|
|
2945
|
-
kind: z.literal("url"),
|
|
2946
|
-
href: z.string().min(1)
|
|
2947
|
-
});
|
|
2948
|
-
const pageLinkSchema = z.object({
|
|
2949
|
-
kind: z.literal("page"),
|
|
2950
|
-
identifier: z.string().min(1)
|
|
2951
|
-
});
|
|
2952
|
-
const entryLinkSchema = z.object({
|
|
2953
|
-
kind: z.literal("entry"),
|
|
2954
|
-
contentType: z.string().min(1),
|
|
2955
|
-
identifier: z.string().min(1)
|
|
2956
|
-
});
|
|
2957
|
-
const linkPayloadSchema = z.discriminatedUnion("kind", [
|
|
2958
|
-
internalLinkPayloadSchema,
|
|
2959
|
-
pageLinkSchema,
|
|
2960
|
-
entryLinkSchema,
|
|
2961
|
-
externalLinkSchema,
|
|
2962
|
-
customLinkSchema,
|
|
2963
|
-
portalLinkPayloadSchema,
|
|
2964
|
-
cartLinkPayloadSchema
|
|
2965
|
-
]);
|
|
2966
|
-
const navigationLinkInputSchemaOptions = [
|
|
2967
|
-
pageLinkSchema,
|
|
2968
|
-
entryLinkSchema,
|
|
2969
|
-
externalLinkSchema,
|
|
2970
|
-
customLinkSchema,
|
|
2971
|
-
portalLinkPayloadSchema,
|
|
2972
|
-
cartLinkPayloadSchema
|
|
2973
|
-
];
|
|
2974
|
-
z.discriminatedUnion("kind", navigationLinkInputSchemaOptions);
|
|
2975
|
-
//#endregion
|
|
2976
|
-
//#region ../api/src/sdkConfig/contracts.ts
|
|
2977
|
-
/**
|
|
2978
|
-
* Canonical SDK config Zod contracts.
|
|
2979
|
-
*
|
|
2980
|
-
* Goal: a single source-of-truth for request payload shapes used across dashboard + SDK.
|
|
2981
|
-
* - Endpoint request/response types live in `packages/api/src/types.ts`
|
|
2982
|
-
* - Schemas live here and are tied to those types via `satisfies z.ZodType<...>`
|
|
2983
|
-
*
|
|
2984
|
-
* NOTE: These schemas represent the *wire/input* shape for API requests.
|
|
2985
|
-
* Service-layer code should parse/normalize again (defaults/refinements) into domain types.
|
|
2986
|
-
*/
|
|
2987
|
-
/**
|
|
2988
|
-
* UNSAFE: Retype an existing Zod schema to a different (compile-time) output type.
|
|
2989
|
-
*
|
|
2990
|
-
* Use only for cases where:
|
|
2991
|
-
* - the runtime schema is known to accept the desired *input/wire* shape, but
|
|
2992
|
-
* - Zod's inferred output type doesn't match the desired TS type due to transforms/defaults.
|
|
2993
|
-
*
|
|
2994
|
-
* If used incorrectly, this can lie to TypeScript and cause drift.
|
|
2995
|
-
*
|
|
2996
|
-
* @internal
|
|
2997
|
-
*/
|
|
2998
|
-
function unsafeRetypeZodSchema(schema) {
|
|
2999
|
-
return schema;
|
|
3000
|
-
}
|
|
3001
|
-
const navIdListSchema = z.preprocess((value) => {
|
|
3002
|
-
if (!Array.isArray(value)) return void 0;
|
|
3003
|
-
const filtered = value.filter((v) => typeof v === "string" && v.trim().length > 0);
|
|
3004
|
-
return filtered.length > 0 ? filtered : void 0;
|
|
3005
|
-
}, z.array(z.string()).max(200).optional());
|
|
3006
|
-
const dashboardNavVisibilityBaseSchema = z.object({
|
|
3007
|
-
mode: z.enum(["augment", "restrict"]).optional(),
|
|
3008
|
-
allowIds: navIdListSchema,
|
|
3009
|
-
denyIds: navIdListSchema
|
|
3010
|
-
}).strip();
|
|
3011
|
-
const dashboardNavVisibilityRolesSchema = z.object({
|
|
3012
|
-
administrator: dashboardNavVisibilityBaseSchema.optional(),
|
|
3013
|
-
editor: dashboardNavVisibilityBaseSchema.optional(),
|
|
3014
|
-
team_member: dashboardNavVisibilityBaseSchema.optional()
|
|
3015
|
-
}).strip().optional();
|
|
3016
|
-
const dashboardNavVisibilitySchema = dashboardNavVisibilityBaseSchema.extend({ roles: dashboardNavVisibilityRolesSchema }).strip();
|
|
3017
|
-
const dashboardNavigationConfigSchema = z.object({
|
|
3018
|
-
siteNav: dashboardNavVisibilitySchema.optional(),
|
|
3019
|
-
settingsNav: dashboardNavVisibilitySchema.optional()
|
|
3020
|
-
}).strip();
|
|
3021
|
-
const dashboardConfigSchema = z.object({
|
|
3022
|
-
previewEditingEnabled: z.boolean().optional(),
|
|
3023
|
-
navigation: dashboardNavigationConfigSchema.optional()
|
|
3024
|
-
}).strip();
|
|
3025
|
-
/**
|
|
3026
|
-
* Canonical field schema comes from @riverbankcms/blocks.
|
|
3027
|
-
*
|
|
3028
|
-
* It accepts FieldDefinitionInput (pre-defaults) and outputs FieldDefinition (post-defaults).
|
|
3029
|
-
* This `satisfies` assertion prevents drift in the *accepted wire shape* without forcing
|
|
3030
|
-
* the schema output type to match the input type.
|
|
3031
|
-
*/
|
|
3032
|
-
const fieldDefinitionInputSchema = unsafeRetypeZodSchema(fieldSchema);
|
|
3033
|
-
const sdkLoaderEndpointSchema = z.enum(SUPPORTED_LOADER_ENDPOINTS$1);
|
|
3034
|
-
const loaderFallbackScalarSchema = z.union([
|
|
3035
|
-
z.string(),
|
|
3036
|
-
z.number(),
|
|
3037
|
-
z.boolean(),
|
|
3038
|
-
z.null()
|
|
3039
|
-
]);
|
|
3040
|
-
const loaderParamBindingSchema = z.object({ $bind: z.object({
|
|
3041
|
-
from: z.string().min(1, "Binding path is required"),
|
|
3042
|
-
fallback: loaderFallbackScalarSchema.optional()
|
|
3043
|
-
}) });
|
|
3044
|
-
const loaderParamValueSchema = z.union([
|
|
3045
|
-
z.string(),
|
|
3046
|
-
z.number(),
|
|
3047
|
-
z.boolean(),
|
|
3048
|
-
loaderParamBindingSchema
|
|
3049
|
-
]);
|
|
3050
|
-
const sdkConfigLoaderSchema = z.object({
|
|
3051
|
-
endpoint: sdkLoaderEndpointSchema,
|
|
3052
|
-
params: z.record(z.string(), loaderParamValueSchema),
|
|
3053
|
-
requiredParams: z.array(z.string().min(1)).optional(),
|
|
3054
|
-
mode: z.enum(["server", "client"]).default("server")
|
|
3055
|
-
});
|
|
3056
|
-
const sdkDataLoadersSchema = z.record(z.string(), sdkConfigLoaderSchema).refine((loaders) => Object.keys(loaders).length <= 5, { message: "Maximum 5 data loaders per block" }).optional();
|
|
3057
|
-
const sdkCustomBlockIdSchema = z.string().min(8).regex(/^custom\.[a-z][a-z0-9-]*$/, { message: "Block ID must start with 'custom.' followed by lowercase letters, numbers, or hyphens" }).transform((value) => value);
|
|
3058
|
-
const sdkCustomBlockInputSchema = z.object({
|
|
3059
|
-
id: sdkCustomBlockIdSchema,
|
|
3060
|
-
title: z.string().min(1),
|
|
3061
|
-
titleSource: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional(),
|
|
3062
|
-
description: z.string().optional(),
|
|
3063
|
-
category: blockCategoryEnum,
|
|
3064
|
-
icon: z.string().optional(),
|
|
3065
|
-
tags: z.array(z.string()).optional(),
|
|
3066
|
-
fields: fieldDefinitionInputSchema.array().min(1),
|
|
3067
|
-
dataLoaders: sdkDataLoadersSchema,
|
|
3068
|
-
layout: NodeSchema.optional(),
|
|
3069
|
-
...sdkBlockPresentationShape,
|
|
3070
|
-
...blockSectionDeclarationShape
|
|
3071
|
-
}).superRefine(validateManifestLookField).superRefine(validateSdkBlockDeclaration);
|
|
3072
|
-
const sdkBlockFieldExtensionInputSchema = z.object({
|
|
3073
|
-
fields: fieldDefinitionInputSchema.array().min(1),
|
|
3074
|
-
...blockSectionDeclarationShape
|
|
3075
|
-
}).superRefine(validateManifestLookField);
|
|
3076
|
-
const sdkBlockFieldExtensionsInputSchema = z.record(z.string().min(1), sdkBlockFieldExtensionInputSchema);
|
|
3077
|
-
const sdkThemePaletteSchema = z.record(z.string(), z.string());
|
|
3078
|
-
const sdkThemeConfigSchema = z.object({ palette: sdkThemePaletteSchema });
|
|
3079
|
-
const sdkSectionBackgroundSchema = z.object({
|
|
3080
|
-
id: z.string().min(1),
|
|
3081
|
-
label: z.string().min(1),
|
|
3082
|
-
token: z.string().min(1)
|
|
3083
|
-
});
|
|
3084
|
-
const sdkSectionOptionsConfigSchema = z.object({
|
|
3085
|
-
backgroundColor: z.boolean().optional(),
|
|
3086
|
-
backgroundImage: z.boolean().optional(),
|
|
3087
|
-
backgroundGradient: z.boolean().optional(),
|
|
3088
|
-
spacing: z.union([z.array(z.enum([
|
|
3089
|
-
"compact",
|
|
3090
|
-
"default",
|
|
3091
|
-
"spacious"
|
|
3092
|
-
])), z.boolean()]).optional(),
|
|
3093
|
-
textColor: z.boolean().optional()
|
|
3094
|
-
});
|
|
3095
|
-
const sdkContainerOptionsConfigSchema = z.object({
|
|
3096
|
-
maxWidth: z.union([z.array(z.enum([
|
|
3097
|
-
"narrow",
|
|
3098
|
-
"default",
|
|
3099
|
-
"wide",
|
|
3100
|
-
"full"
|
|
3101
|
-
])), z.boolean()]).optional(),
|
|
3102
|
-
alignment: z.union([z.array(z.enum([
|
|
3103
|
-
"left",
|
|
3104
|
-
"center",
|
|
3105
|
-
"right"
|
|
3106
|
-
])), z.boolean()]).optional()
|
|
3107
|
-
});
|
|
3108
|
-
const sdkSiteStyleConfigSchema = z.object({
|
|
3109
|
-
sectionBackgrounds: z.array(sdkSectionBackgroundSchema).optional(),
|
|
3110
|
-
sectionOptions: sdkSectionOptionsConfigSchema.optional(),
|
|
3111
|
-
containerOptions: sdkContainerOptionsConfigSchema.optional()
|
|
3112
|
-
});
|
|
3113
|
-
const sdkSiteLayoutConfigSchema = z.object({
|
|
3114
|
-
footerMode: footerModeSchema.optional(),
|
|
3115
|
-
footerBlocks: z.array(z.object({
|
|
3116
|
-
id: z.string().min(1).optional(),
|
|
3117
|
-
kind: z.string().min(1),
|
|
3118
|
-
content: z.record(z.string(), z.unknown()).optional()
|
|
3119
|
-
})).optional()
|
|
3120
|
-
});
|
|
3121
|
-
const sdkFieldSelectOptionSchema = z.object({
|
|
3122
|
-
value: z.string(),
|
|
3123
|
-
label: z.string()
|
|
3124
|
-
});
|
|
3125
|
-
const sdkBlockFieldConfigSchema = z.object({ options: z.array(sdkFieldSelectOptionSchema).optional() });
|
|
3126
|
-
const sdkBlockFieldOptionsMapSchema = z.record(z.string().regex(/^(block\.|custom\.)[a-z][a-z0-9-]*$/, { message: "Block ID must be 'block.*' or 'custom.*' format" }), z.record(z.string().min(1), sdkBlockFieldConfigSchema)).optional();
|
|
3127
|
-
const sdkContentTypeTemplateConfigSchema = z.object({ blocks: z.array(z.unknown()) }).passthrough();
|
|
3128
|
-
const sdkContentTypeOrderingConfigSchema = z.object({ mode: z.enum(["default", "manual"]).optional() }).optional();
|
|
3129
|
-
const sdkContentTypeConfigSchema = z.object({
|
|
3130
|
-
key: z.string().min(1),
|
|
3131
|
-
fields: z.array(z.unknown()),
|
|
3132
|
-
ordering: sdkContentTypeOrderingConfigSchema,
|
|
3133
|
-
template: sdkContentTypeTemplateConfigSchema.nullable().optional()
|
|
3134
|
-
}).passthrough();
|
|
3135
|
-
const sdkContentConfigSchema = z.object({
|
|
3136
|
-
contentTypes: z.array(sdkContentTypeConfigSchema).optional(),
|
|
3137
|
-
pages: z.array(z.unknown()).optional(),
|
|
3138
|
-
entries: z.array(z.unknown()).optional(),
|
|
3139
|
-
navigationMenus: z.array(z.unknown()).optional(),
|
|
3140
|
-
settings: z.unknown().optional()
|
|
3141
|
-
}).passthrough();
|
|
3142
|
-
const SDK_WORKFLOW_ID_PATTERN = /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/;
|
|
3143
|
-
const SDK_WORKFLOW_ENDPOINT_PATTERN = /^\//;
|
|
3144
|
-
const sdkWorkflowIdSchema = z.string().min(1).max(120).regex(SDK_WORKFLOW_ID_PATTERN, { message: "Workflow ID must start with a lowercase letter and use lowercase letters, numbers, dots, underscores, or hyphens" });
|
|
3145
|
-
const sdkWorkflowEndpointSchema = z.string().min(1).max(500).regex(SDK_WORKFLOW_ENDPOINT_PATTERN, { message: "Workflow endpoint must be a site-relative path starting with \"/\"" });
|
|
3146
|
-
const sdkWorkflowManualTriggerSchema = z.object({ type: z.literal("manual") }).strict();
|
|
3147
|
-
const sdkWorkflowTriggerFieldSchema = z.string().trim().min(1).max(120).refine((field) => !field.includes("."), { message: "Workflow trigger fields must be top-level content field IDs, not paths" });
|
|
3148
|
-
const sdkWorkflowFieldChangedConditionSchema = z.object({
|
|
3149
|
-
field: sdkWorkflowTriggerFieldSchema,
|
|
3150
|
-
changed: z.literal(true)
|
|
3151
|
-
}).strict();
|
|
3152
|
-
const sdkWorkflowFieldEmptyConditionSchema = z.object({
|
|
3153
|
-
field: sdkWorkflowTriggerFieldSchema,
|
|
3154
|
-
isEmpty: z.boolean()
|
|
3155
|
-
}).strict();
|
|
3156
|
-
const sdkWorkflowEntryDraftUpdatedTriggerSchema = z.object({
|
|
3157
|
-
type: z.literal("entry.draft.updated"),
|
|
3158
|
-
when: z.array(z.union([sdkWorkflowFieldChangedConditionSchema, sdkWorkflowFieldEmptyConditionSchema])).min(1).max(10)
|
|
3159
|
-
}).strict();
|
|
3160
|
-
const sdkWorkflowTriggerSchema = z.discriminatedUnion("type", [sdkWorkflowManualTriggerSchema, sdkWorkflowEntryDraftUpdatedTriggerSchema]);
|
|
3161
|
-
const sdkWorkflowConfirmationSchema = z.object({
|
|
3162
|
-
title: z.string().trim().min(1).max(120),
|
|
3163
|
-
body: z.string().trim().min(1).max(500).optional()
|
|
3164
|
-
}).strict();
|
|
3165
|
-
const sdkWorkflowConfigSchema = z.object({
|
|
3166
|
-
id: sdkWorkflowIdSchema,
|
|
3167
|
-
title: z.string().trim().min(1).max(120),
|
|
3168
|
-
description: z.string().trim().min(1).max(500).optional(),
|
|
3169
|
-
contentType: z.string().trim().min(1).max(120),
|
|
3170
|
-
endpoint: sdkWorkflowEndpointSchema,
|
|
3171
|
-
triggers: z.array(sdkWorkflowTriggerSchema).min(1).max(5),
|
|
3172
|
-
confirmation: sdkWorkflowConfirmationSchema.optional()
|
|
3173
|
-
}).strict();
|
|
3174
|
-
const sdkWorkflowsSchema = z.array(sdkWorkflowConfigSchema).max(50, "Maximum 50 workflows per site").refine((workflows) => {
|
|
3175
|
-
const ids = workflows.map((workflow) => workflow.id);
|
|
3176
|
-
return ids.length === new Set(ids).size;
|
|
3177
|
-
}, { message: "Workflow IDs must be unique" }).optional();
|
|
3178
|
-
const riverbankSiteConfigInputSchema = z.object({
|
|
3179
|
-
siteId: z.string().uuid(),
|
|
3180
|
-
builtInBlocks: builtInBlockKindsSchema.optional(),
|
|
3181
|
-
previewUrl: z.string().url().optional(),
|
|
3182
|
-
liveUrl: z.string().url().optional(),
|
|
3183
|
-
theme: sdkThemeConfigSchema.optional(),
|
|
3184
|
-
styles: sdkSiteStyleConfigSchema.optional(),
|
|
3185
|
-
layout: sdkSiteLayoutConfigSchema.optional(),
|
|
3186
|
-
customBlocks: z.array(sdkCustomBlockInputSchema).max(100, "Maximum 100 custom blocks per site").refine((blocks) => {
|
|
3187
|
-
const ids = blocks.map((b) => b.id);
|
|
3188
|
-
return ids.length === new Set(ids).size;
|
|
3189
|
-
}, { message: "Block IDs must be unique" }).optional(),
|
|
3190
|
-
blockFieldOptions: sdkBlockFieldOptionsMapSchema,
|
|
3191
|
-
blockFieldExtensions: sdkBlockFieldExtensionsInputSchema.optional(),
|
|
3192
|
-
workflows: sdkWorkflowsSchema,
|
|
3193
|
-
content: sdkContentConfigSchema.optional(),
|
|
3194
|
-
contentDir: z.string().optional(),
|
|
3195
|
-
sync: z.object({ existingEntries: z.enum(["skip", "update"]).optional() }).optional(),
|
|
3196
|
-
deploy: z.object({
|
|
3197
|
-
verifyCommand: z.string().optional(),
|
|
3198
|
-
prebuildOutput: z.string().optional()
|
|
3199
|
-
}).optional(),
|
|
3200
|
-
themeSource: z.enum(["local", "cms"]).optional(),
|
|
3201
|
-
activeTheme: z.string().optional(),
|
|
3202
|
-
enablePortal: z.boolean().optional(),
|
|
3203
|
-
dashboard: dashboardConfigSchema.optional()
|
|
3204
|
-
}).strict();
|
|
3205
|
-
z.object({
|
|
3206
|
-
config: riverbankSiteConfigInputSchema,
|
|
3207
|
-
forceContentTypes: z.boolean().optional(),
|
|
3208
|
-
mode: z.enum(["apply", "preview"]).optional(),
|
|
3209
|
-
expectedMailingListProviderScope: z.unknown().transform((value, ctx) => {
|
|
3210
|
-
if (value === void 0) return void 0;
|
|
3211
|
-
const parsed = parseMailingListProviderScope(value);
|
|
3212
|
-
if (parsed.ok) return parsed.value;
|
|
3213
|
-
ctx.addIssue({
|
|
3214
|
-
code: "custom",
|
|
3215
|
-
message: "Invalid mailing-list provider scope"
|
|
3216
|
-
});
|
|
3217
|
-
return z.NEVER;
|
|
3218
|
-
}).optional()
|
|
3219
|
-
}).strict();
|
|
3220
|
-
//#endregion
|
|
3221
|
-
//#region ../api/src/sdkThemeWire.ts
|
|
3222
|
-
/**
|
|
3223
|
-
* Validate a wire value without replacing it with the schema's parsed output.
|
|
3224
|
-
* The returned type is deliberately the schema input, not its canonical output.
|
|
3225
|
-
*/
|
|
3226
|
-
function losslessValidatedSchema(schema) {
|
|
3227
|
-
return z.unknown().superRefine((value, ctx) => {
|
|
3228
|
-
const parsed = schema.safeParse(value);
|
|
3229
|
-
if (parsed.success) return;
|
|
3230
|
-
for (const issue of parsed.error.issues) ctx.addIssue({
|
|
3231
|
-
code: "custom",
|
|
3232
|
-
path: issue.path,
|
|
3233
|
-
message: issue.message,
|
|
3234
|
-
params: { validationCode: issue.code }
|
|
3235
|
-
});
|
|
3236
|
-
}).transform((value) => value);
|
|
3237
|
-
}
|
|
3238
|
-
losslessValidatedSchema(themeSchema);
|
|
3239
|
-
//#endregion
|
|
3240
|
-
//#region ../api/src/siteOnboarding.ts
|
|
3241
|
-
const LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS = { configure_appointments: {
|
|
3242
|
-
requirementId: "configure_appointments",
|
|
3243
|
-
reason: "launch_anyway"
|
|
3244
|
-
} };
|
|
3245
|
-
z.discriminatedUnion("requirementId", [z.object({ requirementId: z.literal("review_generated_site") }), z.object({
|
|
3246
|
-
requirementId: z.literal(LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS.configure_appointments.requirementId),
|
|
3247
|
-
overrideReason: z.literal(LAUNCH_REQUIREMENT_OVERRIDE_DEFINITIONS.configure_appointments.reason)
|
|
3248
|
-
})]);
|
|
3249
|
-
z.object({ acceptExtraSiteCharge: z.boolean().optional() });
|
|
3250
|
-
//#endregion
|
|
3251
|
-
//#region ../api/src/accountApi.ts
|
|
3252
|
-
const siteRoleSchema = z.enum([
|
|
3253
|
-
"owner",
|
|
3254
|
-
"administrator",
|
|
3255
|
-
"editor",
|
|
3256
|
-
"team_member"
|
|
3257
|
-
]);
|
|
3258
|
-
const linkCapabilitySchema = z.discriminatedUnion("tag", [z.object({ tag: z.literal("linkable") }), z.object({
|
|
3259
|
-
tag: z.literal("insufficient_role"),
|
|
3260
|
-
requiredRole: siteRoleSchema
|
|
3261
|
-
})]);
|
|
3262
|
-
const accountSiteBaseSchema = z.object({
|
|
3263
|
-
id: brandedIdSchema(parseSiteId, "site id"),
|
|
3264
|
-
title: z.string(),
|
|
3265
|
-
slug: z.string().min(1),
|
|
3266
|
-
createdAt: accountSiteTimestampSchema.nullable(),
|
|
3267
|
-
role: siteRoleSchema
|
|
3268
|
-
});
|
|
3269
|
-
const managedSiteSchema = accountSiteBaseSchema.extend({
|
|
3270
|
-
deploymentMode: z.literal("managed"),
|
|
3271
|
-
linkCapability: z.object({
|
|
3272
|
-
tag: z.literal("ineligible_deployment_mode"),
|
|
3273
|
-
deploymentMode: z.literal("managed")
|
|
3274
|
-
})
|
|
3275
|
-
});
|
|
3276
|
-
const headlessSiteSchemas = [accountSiteBaseSchema.extend({
|
|
3277
|
-
deploymentMode: z.literal("headless_cms"),
|
|
3278
|
-
linkCapability: linkCapabilitySchema
|
|
3279
|
-
}), accountSiteBaseSchema.extend({
|
|
3280
|
-
deploymentMode: z.literal("headless_full"),
|
|
3281
|
-
linkCapability: linkCapabilitySchema
|
|
3282
|
-
})];
|
|
3283
|
-
function brandedIdSchema(parse, label) {
|
|
3284
|
-
return z.string().transform((value, context) => {
|
|
3285
|
-
const parsed = parse(value);
|
|
3286
|
-
if (parsed.ok) return parsed.value;
|
|
3287
|
-
context.addIssue({
|
|
3288
|
-
code: "custom",
|
|
3289
|
-
message: `Expected a valid ${label}`
|
|
3290
|
-
});
|
|
3291
|
-
return z.NEVER;
|
|
3292
|
-
});
|
|
3293
|
-
}
|
|
3294
|
-
z.object({
|
|
3295
|
-
userId: brandedIdSchema(parseUserId, "userId"),
|
|
3296
|
-
email: z.string().email().nullable(),
|
|
3297
|
-
displayName: z.string().min(1).nullable()
|
|
3298
|
-
});
|
|
3299
|
-
const siteSchema = z.discriminatedUnion("deploymentMode", [managedSiteSchema, ...headlessSiteSchemas]);
|
|
3300
|
-
z.object({
|
|
3301
|
-
sites: z.array(siteSchema),
|
|
3302
|
-
nextCursor: z.string().min(1).max(ACCOUNT_SITE_CURSOR_MAX_LENGTH).nullable()
|
|
3303
|
-
});
|
|
3304
|
-
z.object({
|
|
3305
|
-
id: brandedIdSchema(parseSiteId, "site id"),
|
|
3306
|
-
title: z.string(),
|
|
3307
|
-
slug: z.string().min(1)
|
|
3308
|
-
});
|
|
3309
|
-
z.object({
|
|
3310
|
-
signedUrl: z.string().url(),
|
|
3311
|
-
token: z.string().min(1),
|
|
3312
|
-
storagePath: z.string().min(1)
|
|
3313
|
-
}).strict();
|
|
3314
|
-
const backupManifestSchema = z.object({
|
|
3315
|
-
siteId: z.string().min(1),
|
|
3316
|
-
siteSlug: z.string().min(1),
|
|
3317
|
-
siteTitle: z.string(),
|
|
3318
|
-
exportedAt: z.string().min(1),
|
|
3319
|
-
tableCount: z.number().int().nonnegative(),
|
|
3320
|
-
totalRecords: z.number().int().nonnegative(),
|
|
3321
|
-
pageCount: z.number().int().nonnegative(),
|
|
3322
|
-
blockCount: z.number().int().nonnegative(),
|
|
3323
|
-
contentEntryCount: z.number().int().nonnegative(),
|
|
3324
|
-
formCount: z.number().int().nonnegative(),
|
|
3325
|
-
navigationMenuCount: z.number().int().nonnegative(),
|
|
3326
|
-
mediaCount: z.number().int().nonnegative(),
|
|
3327
|
-
mediaBytes: z.number().int().nonnegative()
|
|
3328
|
-
}).strict();
|
|
3329
|
-
z.object({
|
|
3330
|
-
ok: z.literal(true),
|
|
3331
|
-
manifest: backupManifestSchema,
|
|
3332
|
-
storagePath: z.string().min(1)
|
|
3333
|
-
}).strict();
|
|
3334
|
-
z.object({
|
|
3335
|
-
ok: z.literal(true),
|
|
3336
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3337
|
-
slug: z.string().min(1),
|
|
3338
|
-
title: z.string(),
|
|
3339
|
-
counts: z.record(z.string(), z.object({
|
|
3340
|
-
created: z.number().int().nonnegative(),
|
|
3341
|
-
updated: z.number().int().nonnegative(),
|
|
3342
|
-
skipped: z.number().int().nonnegative(),
|
|
3343
|
-
failed: z.number().int().nonnegative()
|
|
3344
|
-
}).strict()),
|
|
3345
|
-
warnings: z.array(z.string()),
|
|
3346
|
-
errors: z.array(z.object({
|
|
3347
|
-
table: z.string(),
|
|
3348
|
-
id: z.string(),
|
|
3349
|
-
error: z.string()
|
|
3350
|
-
}).strict())
|
|
3351
|
-
}).strict();
|
|
3352
|
-
z.object({ deleted: z.boolean() }).strict();
|
|
3353
|
-
const apiKeyIdSchema = brandedIdSchema(parseApiKeyId, "API key id");
|
|
3354
|
-
const standardKeyIdsSchema = z.object({
|
|
3355
|
-
live: apiKeyIdSchema.optional(),
|
|
3356
|
-
management: apiKeyIdSchema.optional()
|
|
3357
|
-
}).strict();
|
|
3358
|
-
const previewKeyIdsSchema = z.object({
|
|
3359
|
-
live: apiKeyIdSchema.optional(),
|
|
3360
|
-
management: apiKeyIdSchema.optional(),
|
|
3361
|
-
preview: apiKeyIdSchema.optional()
|
|
3362
|
-
}).strict();
|
|
3363
|
-
const liveCredentialSchema = z.object({
|
|
3364
|
-
key: z.string().regex(/^bld_live_sk_.+$/).transform((value) => createSecret("content-key", value)),
|
|
3365
|
-
keyId: apiKeyIdSchema
|
|
3366
|
-
}).strict();
|
|
3367
|
-
const managementCredentialSchema = z.object({
|
|
3368
|
-
key: z.string().transform((value, context) => {
|
|
3369
|
-
const parsed = parseManagementKey(value);
|
|
3370
|
-
if (!parsed.ok) {
|
|
3371
|
-
context.addIssue({
|
|
3372
|
-
code: "custom",
|
|
3373
|
-
message: "Expected a valid management key"
|
|
3374
|
-
});
|
|
3375
|
-
return z.NEVER;
|
|
3376
|
-
}
|
|
3377
|
-
return parsed.value;
|
|
3378
|
-
}),
|
|
3379
|
-
keyId: apiKeyIdSchema
|
|
3380
|
-
}).strict();
|
|
3381
|
-
const previewCredentialSchema = z.object({
|
|
3382
|
-
key: z.string().regex(/^bld_preview_sk_.+$/).transform((value) => createSecret("preview-key", value)),
|
|
3383
|
-
keyId: apiKeyIdSchema
|
|
3384
|
-
}).strict();
|
|
3385
|
-
z.discriminatedUnion("operation", [
|
|
3386
|
-
z.object({
|
|
3387
|
-
operation: z.literal("issue_standard"),
|
|
3388
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3389
|
-
operationId: z.string().uuid(),
|
|
3390
|
-
revokedAbandonedKeyIds: standardKeyIdsSchema,
|
|
3391
|
-
credentials: z.object({
|
|
3392
|
-
live: liveCredentialSchema,
|
|
3393
|
-
management: managementCredentialSchema
|
|
3394
|
-
}).strict()
|
|
3395
|
-
}).strict(),
|
|
3396
|
-
z.object({
|
|
3397
|
-
operation: z.literal("issue_with_preview"),
|
|
3398
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3399
|
-
operationId: z.string().uuid(),
|
|
3400
|
-
revokedAbandonedKeyIds: previewKeyIdsSchema,
|
|
3401
|
-
credentials: z.object({
|
|
3402
|
-
live: liveCredentialSchema,
|
|
3403
|
-
management: managementCredentialSchema,
|
|
3404
|
-
preview: previewCredentialSchema
|
|
3405
|
-
}).strict()
|
|
3406
|
-
}).strict(),
|
|
3407
|
-
z.object({
|
|
3408
|
-
operation: z.literal("recovery_standard"),
|
|
3409
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3410
|
-
operationId: z.string().uuid(),
|
|
3411
|
-
issuedKeyIds: standardKeyIdsSchema,
|
|
3412
|
-
revokedAbandonedKeyIds: standardKeyIdsSchema,
|
|
3413
|
-
remainingAbandonedKeyIds: standardKeyIdsSchema,
|
|
3414
|
-
failureTag: z.enum(["ACCOUNT_CREDENTIALS_ISSUANCE_FAILED", "ACCOUNT_CREDENTIALS_RECOVERY_REVOKE_FAILED"])
|
|
3415
|
-
}).strict(),
|
|
3416
|
-
z.object({
|
|
3417
|
-
operation: z.literal("recovery_with_preview"),
|
|
3418
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3419
|
-
operationId: z.string().uuid(),
|
|
3420
|
-
issuedKeyIds: previewKeyIdsSchema,
|
|
3421
|
-
revokedAbandonedKeyIds: previewKeyIdsSchema,
|
|
3422
|
-
remainingAbandonedKeyIds: previewKeyIdsSchema,
|
|
3423
|
-
failureTag: z.enum(["ACCOUNT_CREDENTIALS_ISSUANCE_FAILED", "ACCOUNT_CREDENTIALS_RECOVERY_REVOKE_FAILED"])
|
|
3424
|
-
}).strict(),
|
|
3425
|
-
z.object({
|
|
3426
|
-
operation: z.literal("revalidate_standard"),
|
|
3427
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3428
|
-
operationId: z.string().uuid(),
|
|
3429
|
-
checks: z.object({
|
|
3430
|
-
live: z.object({
|
|
3431
|
-
keyId: apiKeyIdSchema,
|
|
3432
|
-
status: z.literal("active")
|
|
3433
|
-
}).strict(),
|
|
3434
|
-
management: z.object({
|
|
3435
|
-
keyId: apiKeyIdSchema,
|
|
3436
|
-
status: z.literal("active")
|
|
3437
|
-
}).strict()
|
|
3438
|
-
}).strict()
|
|
3439
|
-
}).strict(),
|
|
3440
|
-
z.object({
|
|
3441
|
-
operation: z.literal("revalidate_with_preview"),
|
|
3442
|
-
siteId: brandedIdSchema(parseSiteId, "site id"),
|
|
3443
|
-
operationId: z.string().uuid(),
|
|
3444
|
-
checks: z.object({
|
|
3445
|
-
live: z.object({
|
|
3446
|
-
keyId: apiKeyIdSchema,
|
|
3447
|
-
status: z.literal("active")
|
|
3448
|
-
}).strict(),
|
|
3449
|
-
management: z.object({
|
|
3450
|
-
keyId: apiKeyIdSchema,
|
|
3451
|
-
status: z.literal("active")
|
|
3452
|
-
}).strict(),
|
|
3453
|
-
preview: z.object({
|
|
3454
|
-
keyId: apiKeyIdSchema,
|
|
3455
|
-
status: z.literal("active")
|
|
3456
|
-
}).strict()
|
|
3457
|
-
}).strict()
|
|
3458
|
-
}).strict()
|
|
3459
|
-
]);
|
|
3460
|
-
const CANONICAL_REFUND_PLANNER_ERROR_CODES = [
|
|
3461
|
-
...[
|
|
3462
|
-
"already_refunded",
|
|
3463
|
-
"idempotency_amount_mismatch",
|
|
3464
|
-
"idempotency_method_mismatch",
|
|
3465
|
-
"idempotency_receipt_mismatch",
|
|
3466
|
-
"idempotency_scope_mismatch",
|
|
3467
|
-
"refund_in_progress"
|
|
3468
|
-
],
|
|
3469
|
-
"invalid_amount",
|
|
3470
|
-
"amount_exceeds_remaining",
|
|
3471
|
-
"pass_revoke_requires_full_refund",
|
|
3472
|
-
"refund_failed"
|
|
3473
|
-
];
|
|
3474
|
-
const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
|
|
3475
|
-
"refund_blocked_by_live_payment_terms",
|
|
3476
|
-
...CANONICAL_REFUND_PLANNER_ERROR_CODES,
|
|
3477
|
-
"payment_intent_not_found",
|
|
3478
|
-
"stripe_error",
|
|
3479
|
-
"stale_pending_missing_context",
|
|
3480
|
-
"non_refundable_deposit_remaining",
|
|
3481
|
-
"deposit_refund_override_required",
|
|
3482
|
-
"refund_revoke_requires_full_line_refund",
|
|
3483
|
-
"payment_receipt_not_found",
|
|
3484
|
-
"payment_receipt_not_refundable",
|
|
3485
|
-
"payment_receipt_attribution_required"
|
|
3486
|
-
];
|
|
3487
|
-
[...CANONICAL_REFUND_PLANNER_ERROR_CODES];
|
|
3488
|
-
//#endregion
|
|
3489
|
-
//#region ../api/src/bookingRefundOutcomes.ts
|
|
3490
|
-
const STANDARD_LINE_ITEM_REFUND_INVALID_CODES = [
|
|
3491
|
-
"refund_blocked_by_live_payment_terms",
|
|
3492
|
-
"missing_amount",
|
|
3493
|
-
"invalid_amount",
|
|
3494
|
-
"amount_exceeds_remaining",
|
|
3495
|
-
"credit_refunds_disabled",
|
|
3496
|
-
"missing_credit_customer",
|
|
3497
|
-
"deposit_refund_override_required",
|
|
3498
|
-
"refund_revoke_requires_full_line_refund",
|
|
3499
|
-
"unified_order_link_required",
|
|
3500
|
-
"payment_receipt_not_found",
|
|
3501
|
-
"payment_receipt_not_refundable",
|
|
3502
|
-
"payment_receipt_attribution_required"
|
|
3503
|
-
];
|
|
3504
|
-
const EVENT_ATTENDEE_REFUND_INVALID_CODES = ["manual_booking_not_refundable", ...STANDARD_LINE_ITEM_REFUND_INVALID_CODES];
|
|
3505
|
-
[...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
|
|
3506
|
-
[...EVENT_ATTENDEE_REFUND_INVALID_CODES, ...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
|
|
3507
|
-
[...STANDARD_LINE_ITEM_REFUND_INVALID_CODES, ...CANONICAL_ADMIN_REFUND_FAILURE_CODES];
|
|
3508
|
-
//#endregion
|
|
3509
|
-
//#region ../api/src/bookingVerticals.ts
|
|
3510
|
-
/**
|
|
3511
|
-
* Transport adapters for the booking-vertical domain.
|
|
3512
|
-
*
|
|
3513
|
-
* The domain catalog and all pure resolution/selection rules live in core;
|
|
3514
|
-
* this module owns only the Zod boundary used by API payloads.
|
|
3515
|
-
*/
|
|
3516
|
-
function formatRawDiagnosticValue(value) {
|
|
3517
|
-
const serialized = JSON.stringify(value);
|
|
3518
|
-
return serialized === void 0 ? String(value) : serialized;
|
|
3519
|
-
}
|
|
3520
|
-
function describeSiteVerticalConfigIssue(issue) {
|
|
3521
|
-
switch (issue.code) {
|
|
3522
|
-
case "unknown_vertical": return `${issue.code}: ${formatRawDiagnosticValue(issue.rawValue)}`;
|
|
3523
|
-
case "unknown_preset": return `${issue.code}: ${formatRawDiagnosticValue(issue.rawValue)}`;
|
|
3524
|
-
case "missing_vertical":
|
|
3525
|
-
case "empty_selected_presets":
|
|
3526
|
-
case "preset_vertical_mismatch":
|
|
3527
|
-
case "duplicate_preset_id":
|
|
3528
|
-
case "duplicate_canonical_behaviour":
|
|
3529
|
-
case "future_preset_selected": return issue.code;
|
|
3530
|
-
default: return assertNever(issue);
|
|
3531
|
-
}
|
|
3532
|
-
}
|
|
3533
|
-
const VerticalIdSchema = z.string().trim().transform((value, ctx) => {
|
|
3534
|
-
const parsed = parseVerticalId(value);
|
|
3535
|
-
if (!parsed) {
|
|
3536
|
-
ctx.addIssue({
|
|
3537
|
-
code: z.ZodIssueCode.custom,
|
|
3538
|
-
message: "Unknown booking vertical"
|
|
3539
|
-
});
|
|
3540
|
-
return z.NEVER;
|
|
3541
|
-
}
|
|
3542
|
-
return parsed;
|
|
3543
|
-
});
|
|
3544
|
-
const VerticalPresetIdSchema = z.string().trim().transform((value, ctx) => {
|
|
3545
|
-
const parsed = parseVerticalPresetId(value);
|
|
3546
|
-
if (!parsed) {
|
|
3547
|
-
ctx.addIssue({
|
|
3548
|
-
code: z.ZodIssueCode.custom,
|
|
3549
|
-
message: "Unknown booking preset"
|
|
3550
|
-
});
|
|
3551
|
-
return z.NEVER;
|
|
3552
|
-
}
|
|
3553
|
-
return parsed;
|
|
3554
|
-
});
|
|
3555
|
-
z.object({
|
|
3556
|
-
verticalId: VerticalIdSchema.nullable(),
|
|
3557
|
-
selectedPresetIds: z.array(VerticalPresetIdSchema).max(20)
|
|
3558
|
-
}).transform((value, ctx) => {
|
|
3559
|
-
const resolved = resolveSiteVerticalBookingConfig(value);
|
|
3560
|
-
if (resolved.kind === "invalid") {
|
|
3561
|
-
ctx.addIssue({
|
|
3562
|
-
code: z.ZodIssueCode.custom,
|
|
3563
|
-
message: `Invalid booking vertical config: ${resolved.issues.map(describeSiteVerticalConfigIssue).join(", ")}`
|
|
3564
|
-
});
|
|
3565
|
-
return z.NEVER;
|
|
3566
|
-
}
|
|
3567
|
-
return resolved.config;
|
|
3568
|
-
});
|
|
3569
|
-
//#endregion
|
|
3570
|
-
//#region ../api/src/appointmentServiceVisibility.ts
|
|
3571
|
-
const APPOINTMENT_SERVICE_VISIBILITY_VALUES = ["public", "unlisted"];
|
|
3572
|
-
//#endregion
|
|
3573
|
-
//#region ../api/src/appointmentSetup.ts
|
|
3574
|
-
const APPOINTMENT_SETUP_MAX_MINUTES = 1440;
|
|
3575
|
-
const appointmentSetupRefSchema = z.discriminatedUnion("kind", [z.object({
|
|
3576
|
-
kind: z.literal("existing"),
|
|
3577
|
-
id: z.string().min(1)
|
|
3578
|
-
}), z.object({
|
|
3579
|
-
kind: z.literal("new"),
|
|
3580
|
-
draftId: z.string().min(1)
|
|
3581
|
-
})]);
|
|
3582
|
-
const appointmentSetupVenueChoiceSchema = z.discriminatedUnion("kind", [
|
|
3583
|
-
z.object({ kind: z.literal("none") }),
|
|
3584
|
-
z.object({
|
|
3585
|
-
kind: z.literal("existing"),
|
|
3586
|
-
venueId: z.string().min(1)
|
|
3587
|
-
}),
|
|
3588
|
-
z.object({
|
|
3589
|
-
kind: z.literal("create"),
|
|
3590
|
-
draftId: z.string().min(1),
|
|
3591
|
-
title: z.string().trim().min(1),
|
|
3592
|
-
description: z.string().nullable(),
|
|
3593
|
-
timezone: z.string().trim().min(1).nullable(),
|
|
3594
|
-
locationValue: locationValueSchema.nullable().optional(),
|
|
3595
|
-
addressJson: z.record(z.string(), z.unknown()).optional(),
|
|
3596
|
-
locationJson: z.object({
|
|
3597
|
-
lat: z.number(),
|
|
3598
|
-
lng: z.number()
|
|
3599
|
-
}).nullable().optional()
|
|
3600
|
-
})
|
|
3601
|
-
]);
|
|
3602
|
-
const appointmentSetupPaymentDraftSchema = z.discriminatedUnion("kind", [
|
|
3603
|
-
z.object({ kind: z.literal("free") }),
|
|
3604
|
-
z.object({ kind: z.literal("paid_online") }),
|
|
3605
|
-
z.object({ kind: z.literal("paid_offline") })
|
|
3606
|
-
]);
|
|
3607
|
-
const appointmentSetupServiceAssignmentDraftSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("all_practitioners") }), z.object({
|
|
3608
|
-
kind: z.literal("selected_practitioners"),
|
|
3609
|
-
resourceRefs: z.array(appointmentSetupRefSchema)
|
|
3610
|
-
})]);
|
|
3611
|
-
const appointmentSetupServiceDraftSchema = z.object({
|
|
3612
|
-
ref: appointmentSetupRefSchema,
|
|
3613
|
-
title: z.string().trim().min(1),
|
|
3614
|
-
description: z.string().nullable(),
|
|
3615
|
-
durationMinutes: z.number().int().positive().max(APPOINTMENT_SETUP_MAX_MINUTES),
|
|
3616
|
-
prepMinutes: z.number().int().nonnegative().max(APPOINTMENT_SETUP_MAX_MINUTES).default(0),
|
|
3617
|
-
cleanupMinutes: z.number().int().nonnegative().max(APPOINTMENT_SETUP_MAX_MINUTES).default(0),
|
|
3618
|
-
priceAmount: z.number().int().nonnegative().nullable(),
|
|
3619
|
-
isActive: z.boolean(),
|
|
3620
|
-
visibility: z.enum(APPOINTMENT_SERVICE_VISIBILITY_VALUES).default("public"),
|
|
3621
|
-
locationType: z.union([
|
|
3622
|
-
z.literal("virtual"),
|
|
3623
|
-
z.literal("in_person"),
|
|
3624
|
-
z.literal("hybrid")
|
|
3625
|
-
]),
|
|
3626
|
-
venue: appointmentSetupVenueChoiceSchema,
|
|
3627
|
-
timezone: z.string().trim().min(1).nullable(),
|
|
3628
|
-
payment: appointmentSetupPaymentDraftSchema,
|
|
3629
|
-
assignment: appointmentSetupServiceAssignmentDraftSchema,
|
|
3630
|
-
/**
|
|
3631
|
-
* The service's category, or null for "Other" (issue 1403). Omitted leaves
|
|
3632
|
-
* an existing service's category alone and puts a new one in "Other".
|
|
3633
|
-
*/
|
|
3634
|
-
categoryId: z.string().uuid().nullable().optional()
|
|
3635
|
-
}).superRefine((service, ctx) => {
|
|
3636
|
-
if (service.payment.kind !== "free" && (service.priceAmount === null || service.priceAmount <= 0)) ctx.addIssue({
|
|
3637
|
-
code: "custom",
|
|
3638
|
-
path: ["priceAmount"],
|
|
3639
|
-
message: "Paid appointment services need a positive price."
|
|
3640
|
-
});
|
|
3641
|
-
if (service.payment.kind === "free" && service.priceAmount !== null && service.priceAmount > 0) ctx.addIssue({
|
|
3642
|
-
code: "custom",
|
|
3643
|
-
path: ["priceAmount"],
|
|
3644
|
-
message: "Free appointment services cannot carry a positive price."
|
|
3645
|
-
});
|
|
3646
|
-
});
|
|
3647
|
-
const appointmentSetupPractitionerDraftSchema = z.object({
|
|
3648
|
-
ref: appointmentSetupRefSchema,
|
|
3649
|
-
displayName: z.string().trim().min(1),
|
|
3650
|
-
bio: z.string().nullable(),
|
|
3651
|
-
timezone: z.string().trim().min(1),
|
|
3652
|
-
colorHex: z.string().nullable()
|
|
3653
|
-
});
|
|
3654
|
-
const appointmentSetupWeeklyWindowDraftSchema = z.object({
|
|
3655
|
-
weekday: z.number().int().min(0).max(6),
|
|
3656
|
-
startTime: z.string(),
|
|
3657
|
-
endTime: z.string()
|
|
3658
|
-
});
|
|
3659
|
-
const appointmentSetupStartTimePolicyDraftSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("automatic_spacing") }), z.object({
|
|
3660
|
-
kind: z.literal("regular_interval"),
|
|
3661
|
-
intervalMinutes: z.union([
|
|
3662
|
-
z.literal(10),
|
|
3663
|
-
z.literal(15),
|
|
3664
|
-
z.literal(20),
|
|
3665
|
-
z.literal(30),
|
|
3666
|
-
z.literal(45),
|
|
3667
|
-
z.literal(60)
|
|
3668
|
-
])
|
|
3669
|
-
})]);
|
|
3670
|
-
const appointmentSetupAvailabilityDraftSchema = z.object({
|
|
3671
|
-
kind: z.literal("weekly_windows"),
|
|
3672
|
-
resourceRef: appointmentSetupRefSchema,
|
|
3673
|
-
serviceRef: appointmentSetupRefSchema.nullable(),
|
|
3674
|
-
windows: z.array(appointmentSetupWeeklyWindowDraftSchema),
|
|
3675
|
-
startTimePolicy: appointmentSetupStartTimePolicyDraftSchema.optional()
|
|
3676
|
-
});
|
|
3677
|
-
const appointmentSetupBookingNoticeSchema = z.object({
|
|
3678
|
-
minLeadMinutes: z.number().int().nonnegative().max(672 * 60),
|
|
3679
|
-
maxBookingNoticeMinutes: z.number().int().nonnegative().max(10 * 365 * 24 * 60)
|
|
3680
|
-
});
|
|
3681
|
-
z.object({
|
|
3682
|
-
services: z.array(appointmentSetupServiceDraftSchema),
|
|
3683
|
-
practitioners: z.array(appointmentSetupPractitionerDraftSchema),
|
|
3684
|
-
availability: z.array(appointmentSetupAvailabilityDraftSchema),
|
|
3685
|
-
bookingNotice: appointmentSetupBookingNoticeSchema
|
|
3686
|
-
});
|
|
3687
|
-
//#endregion
|
|
3688
|
-
//#region ../api/src/siteBanner.ts
|
|
3689
|
-
const SITE_BANNER_SCOPE_VALUES = ["homepage", "all-pages"];
|
|
3690
|
-
const SITE_BANNER_TONE_VALUES = [
|
|
3691
|
-
"announcement",
|
|
3692
|
-
"promotion",
|
|
3693
|
-
"notice",
|
|
3694
|
-
"warning"
|
|
3695
|
-
];
|
|
3696
|
-
const siteBannerScopeSchema = z.enum(SITE_BANNER_SCOPE_VALUES);
|
|
3697
|
-
const siteBannerToneSchema = z.enum(SITE_BANNER_TONE_VALUES);
|
|
3698
|
-
const siteBannerBodySchema = RichTextDocSchema;
|
|
3699
|
-
const siteBannerCtaSchema = z.object({
|
|
3700
|
-
label: z.string().trim().min(1),
|
|
3701
|
-
link: linkPayloadSchema
|
|
3702
|
-
});
|
|
3703
|
-
z.discriminatedUnion("enabled", [z.object({ enabled: z.literal(false) }), z.object({
|
|
3704
|
-
enabled: z.literal(true),
|
|
3705
|
-
scope: siteBannerScopeSchema,
|
|
3706
|
-
tone: siteBannerToneSchema,
|
|
3707
|
-
body: siteBannerBodySchema,
|
|
3708
|
-
cta: siteBannerCtaSchema.nullable()
|
|
3709
|
-
})]).superRefine((value, ctx) => {
|
|
3710
|
-
if (!value.enabled) return;
|
|
3711
|
-
const analysis = analyzeSiteBannerBody(value.body);
|
|
3712
|
-
for (const issue of analysis.issues) ctx.addIssue({
|
|
3713
|
-
code: z.ZodIssueCode.custom,
|
|
3714
|
-
path: ["body"],
|
|
3715
|
-
message: siteBannerBodyIssueMessage(issue)
|
|
3716
|
-
});
|
|
3717
|
-
});
|
|
3718
|
-
const EMPTY_SITE_BANNER_BODY = {
|
|
3719
|
-
type: "doc",
|
|
3720
|
-
content: [{
|
|
3721
|
-
type: "paragraph",
|
|
3722
|
-
content: []
|
|
3723
|
-
}]
|
|
3724
|
-
};
|
|
3725
|
-
function analyzeSiteBannerBody(body) {
|
|
3726
|
-
const parsed = RichTextDocSchema.safeParse(body);
|
|
3727
|
-
const sanitizedBody = parsed.success ? sanitizeSiteBannerBodyInternal(parsed.data, { limitParagraphs: false }) : EMPTY_SITE_BANNER_BODY;
|
|
3728
|
-
const paragraphs = collectParagraphs(sanitizedBody);
|
|
3729
|
-
const textLength = paragraphs.reduce((total, paragraph) => total + paragraphTextLength(paragraph), 0);
|
|
3730
|
-
const issues = [];
|
|
3731
|
-
if (textLength === 0) issues.push("empty");
|
|
3732
|
-
if (paragraphs.length > 2) issues.push("too-many-paragraphs");
|
|
3733
|
-
if (textLength > 320) issues.push("too-long");
|
|
3734
|
-
return {
|
|
3735
|
-
sanitizedBody,
|
|
3736
|
-
textLength,
|
|
3737
|
-
paragraphCount: paragraphs.length,
|
|
3738
|
-
issues
|
|
3739
|
-
};
|
|
3740
|
-
}
|
|
3741
|
-
function siteBannerBodyIssueMessage(issue) {
|
|
3742
|
-
switch (issue) {
|
|
3743
|
-
case "empty": return "Banner message is required when the banner is enabled.";
|
|
3744
|
-
case "too-many-paragraphs": return `Banner message must be 2 paragraphs or fewer.`;
|
|
3745
|
-
case "too-long": return `Banner message must be 320 characters or fewer.`;
|
|
3746
|
-
}
|
|
3747
|
-
}
|
|
3748
|
-
function sanitizeSiteBannerBodyInternal(input, options) {
|
|
3749
|
-
const content = normalizeTopLevelNodes(input.content, options);
|
|
3750
|
-
return {
|
|
3751
|
-
type: "doc",
|
|
3752
|
-
content: content.length > 0 ? content : EMPTY_SITE_BANNER_BODY.content
|
|
3753
|
-
};
|
|
3754
|
-
}
|
|
3755
|
-
function normalizeTopLevelNodes(nodes, options) {
|
|
3756
|
-
const out = [];
|
|
3757
|
-
let inlineBuffer = [];
|
|
3758
|
-
const flushInlineBuffer = () => {
|
|
3759
|
-
if (inlineBuffer.length === 0) return;
|
|
3760
|
-
out.push({
|
|
3761
|
-
type: "paragraph",
|
|
3762
|
-
content: inlineBuffer
|
|
3763
|
-
});
|
|
3764
|
-
inlineBuffer = [];
|
|
3765
|
-
};
|
|
3766
|
-
for (const node of nodes) {
|
|
3767
|
-
const normalized = sanitizeNode(node, options);
|
|
3768
|
-
for (const child of normalized) {
|
|
3769
|
-
if (child.type === "text") {
|
|
3770
|
-
inlineBuffer.push(child);
|
|
3771
|
-
continue;
|
|
3772
|
-
}
|
|
3773
|
-
flushInlineBuffer();
|
|
3774
|
-
out.push(child);
|
|
3775
|
-
}
|
|
3776
|
-
}
|
|
3777
|
-
flushInlineBuffer();
|
|
3778
|
-
return options.limitParagraphs ? out.slice(0, 2) : out;
|
|
3779
|
-
}
|
|
3780
|
-
function sanitizeNode(node, options) {
|
|
3781
|
-
if (node.type === "paragraph") return [{
|
|
3782
|
-
type: "paragraph",
|
|
3783
|
-
content: sanitizeInlineNodes(node.content ?? [])
|
|
3784
|
-
}];
|
|
3785
|
-
if (node.type === "text") {
|
|
3786
|
-
const text = typeof node.text === "string" ? node.text : "";
|
|
3787
|
-
const marks = sanitizeMarks(node.marks);
|
|
3788
|
-
return text.length > 0 ? [{
|
|
3789
|
-
type: "text",
|
|
3790
|
-
text,
|
|
3791
|
-
...marks ? { marks } : {}
|
|
3792
|
-
}] : [];
|
|
3793
|
-
}
|
|
3794
|
-
if (Array.isArray(node.content)) return normalizeTopLevelNodes(node.content, options);
|
|
3795
|
-
return [];
|
|
3796
|
-
}
|
|
3797
|
-
function sanitizeInlineNodes(nodes) {
|
|
3798
|
-
return nodes.flatMap((node) => {
|
|
3799
|
-
if (node.type === "text") {
|
|
3800
|
-
const text = typeof node.text === "string" ? node.text : "";
|
|
3801
|
-
if (text.length === 0) return [];
|
|
3802
|
-
const marks = sanitizeMarks(node.marks);
|
|
3803
|
-
return [{
|
|
3804
|
-
type: "text",
|
|
3805
|
-
text,
|
|
3806
|
-
...marks ? { marks } : {}
|
|
3807
|
-
}];
|
|
3808
|
-
}
|
|
3809
|
-
if (Array.isArray(node.content)) return sanitizeInlineNodes(node.content);
|
|
3810
|
-
return [];
|
|
3811
|
-
});
|
|
3812
|
-
}
|
|
3813
|
-
function sanitizeMarks(marks) {
|
|
3814
|
-
if (!Array.isArray(marks) || marks.length === 0) return;
|
|
3815
|
-
const sanitized = marks.flatMap((mark) => {
|
|
3816
|
-
if (mark.type === "bold" || mark.type === "strong" || mark.type === "italic" || mark.type === "em") return [{ type: mark.type }];
|
|
3817
|
-
if (mark.type === "link" && isRecord$1(mark.attrs) && typeof mark.attrs.href === "string") {
|
|
3818
|
-
const attrs = { href: mark.attrs.href };
|
|
3819
|
-
if (typeof mark.attrs.target === "string" && mark.attrs.target.trim().length > 0) attrs.target = mark.attrs.target;
|
|
3820
|
-
if (typeof mark.attrs.rel === "string" && mark.attrs.rel.trim().length > 0) attrs.rel = mark.attrs.rel;
|
|
3821
|
-
return [{
|
|
3822
|
-
type: "link",
|
|
3823
|
-
attrs
|
|
3824
|
-
}];
|
|
3825
|
-
}
|
|
3826
|
-
return [];
|
|
3827
|
-
});
|
|
3828
|
-
return sanitized.length > 0 ? sanitized : void 0;
|
|
3829
|
-
}
|
|
3830
|
-
function paragraphTextLength(paragraph) {
|
|
3831
|
-
return collectText(paragraph).length;
|
|
3832
|
-
}
|
|
3833
|
-
function collectParagraphs(doc) {
|
|
3834
|
-
return (doc.content ?? []).filter((node) => node.type === "paragraph");
|
|
3835
|
-
}
|
|
3836
|
-
function collectText(node) {
|
|
3837
|
-
if (node.type === "text") return node.text ?? "";
|
|
3838
|
-
return (node.content ?? []).map(collectText).join("");
|
|
3839
|
-
}
|
|
3840
|
-
z.object({ expectedRevision: z.number().int().nonnegative() }).strict();
|
|
3841
|
-
z.enum(["public", "unlisted"], { error: "visibility must be 'public' or 'unlisted'" });
|
|
3842
|
-
z.object({
|
|
3843
|
-
restoredOccurrenceIds: z.array(z.string().uuid()),
|
|
3844
|
-
excludedBookings: z.array(z.object({
|
|
3845
|
-
attendeeId: z.string().uuid(),
|
|
3846
|
-
occurrenceId: z.string().uuid(),
|
|
3847
|
-
customerId: z.string().uuid(),
|
|
3848
|
-
customerName: z.string().nullable(),
|
|
3849
|
-
customerEmail: z.string().nullable()
|
|
3850
|
-
}))
|
|
3851
|
-
});
|
|
3852
|
-
//#endregion
|
|
3853
|
-
//#region ../api/src/navigationMenuValidation.ts
|
|
3854
|
-
function hasChildren(item) {
|
|
3855
|
-
return Array.isArray(item.children) && item.children.length > 0;
|
|
3856
|
-
}
|
|
3857
|
-
function isCartLinkMissingVisibleLabel(link) {
|
|
3858
|
-
return link?.kind === "cart" && link.label?.kind === "icon-with-label" && (typeof link.label.label !== "string" || link.label.label.trim().length === 0);
|
|
3859
|
-
}
|
|
3860
|
-
/**
|
|
3861
|
-
* Recursively collects portal-link constraints for a single menu tree.
|
|
3862
|
-
* Rules:
|
|
3863
|
-
* - At most one portal link per menu.
|
|
3864
|
-
* - Portal links must be root-level.
|
|
3865
|
-
* - Portal links cannot have children.
|
|
3866
|
-
*/
|
|
3867
|
-
function collectPortalLinkStats(items, depth = 0) {
|
|
3868
|
-
const result = {
|
|
3869
|
-
count: 0,
|
|
3870
|
-
nestedLabels: [],
|
|
3871
|
-
withChildrenLabels: []
|
|
3872
|
-
};
|
|
3873
|
-
for (const item of items) {
|
|
3874
|
-
if (item.link?.kind === "portal") {
|
|
3875
|
-
result.count += 1;
|
|
3876
|
-
if (depth > 0) result.nestedLabels.push(item.label);
|
|
3877
|
-
if (hasChildren(item)) result.withChildrenLabels.push(item.label);
|
|
3878
|
-
}
|
|
3879
|
-
if (hasChildren(item)) {
|
|
3880
|
-
const child = collectPortalLinkStats((item.children ?? []).filter(isNavigationMenuValidationItem), depth + 1);
|
|
3881
|
-
result.count += child.count;
|
|
3882
|
-
result.nestedLabels.push(...child.nestedLabels);
|
|
3883
|
-
result.withChildrenLabels.push(...child.withChildrenLabels);
|
|
3884
|
-
}
|
|
3885
|
-
}
|
|
3886
|
-
return result;
|
|
3887
|
-
}
|
|
3888
|
-
/**
|
|
3889
|
-
* Recursively collects cart-link constraints for a single menu tree.
|
|
3890
|
-
* Rules:
|
|
3891
|
-
* - Cart links must be root-level.
|
|
3892
|
-
* - Cart links cannot have children.
|
|
3893
|
-
* - Cart links cannot be CTA items.
|
|
3894
|
-
* - Cart links using `icon-with-label` must provide visible text.
|
|
3895
|
-
*/
|
|
3896
|
-
function collectCartLinkStats(items, depth = 0) {
|
|
3897
|
-
const result = {
|
|
3898
|
-
count: 0,
|
|
3899
|
-
nestedLabels: [],
|
|
3900
|
-
withChildrenLabels: [],
|
|
3901
|
-
ctaLabels: [],
|
|
3902
|
-
missingVisibleTextLabels: []
|
|
3903
|
-
};
|
|
3904
|
-
for (const item of items) {
|
|
3905
|
-
if (item.link?.kind === "cart") {
|
|
3906
|
-
result.count += 1;
|
|
3907
|
-
if (depth > 0) result.nestedLabels.push(item.label);
|
|
3908
|
-
if (hasChildren(item)) result.withChildrenLabels.push(item.label);
|
|
3909
|
-
if (item.isCta === true) result.ctaLabels.push(item.label);
|
|
3910
|
-
if (isCartLinkMissingVisibleLabel(item.link ?? null)) result.missingVisibleTextLabels.push(item.label);
|
|
3911
|
-
}
|
|
3912
|
-
if (hasChildren(item)) {
|
|
3913
|
-
const child = collectCartLinkStats((item.children ?? []).filter(isNavigationMenuValidationItem), depth + 1);
|
|
3914
|
-
result.count += child.count;
|
|
3915
|
-
result.nestedLabels.push(...child.nestedLabels);
|
|
3916
|
-
result.withChildrenLabels.push(...child.withChildrenLabels);
|
|
3917
|
-
result.ctaLabels.push(...child.ctaLabels);
|
|
3918
|
-
result.missingVisibleTextLabels.push(...child.missingVisibleTextLabels);
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
return result;
|
|
3922
|
-
}
|
|
3923
|
-
function isNavigationMenuValidationItem(value) {
|
|
3924
|
-
if (!isRecord$1(value)) return false;
|
|
3925
|
-
return typeof value.label === "string";
|
|
3926
|
-
}
|
|
3927
|
-
//#endregion
|
|
3928
|
-
//#region ../api/src/aiPlayground.ts
|
|
3929
|
-
const PreparedPagePreconditionSchema = z.object({
|
|
3930
|
-
pageId: z.string().uuid(),
|
|
3931
|
-
revision: z.number().int().nonnegative()
|
|
3932
|
-
}).strict();
|
|
3933
|
-
/**
|
|
3934
|
-
* RFC-6902 JSON Patch Operations
|
|
3935
|
-
* Standard JSON Patch format for AI Playground content updates
|
|
3936
|
-
*/
|
|
3937
|
-
const Rfc6902PatchOp = z.discriminatedUnion("op", [
|
|
3938
|
-
z.object({
|
|
3939
|
-
op: z.literal("add"),
|
|
3940
|
-
path: z.string(),
|
|
3941
|
-
value: z.unknown()
|
|
3942
|
-
}),
|
|
3943
|
-
z.object({
|
|
3944
|
-
op: z.literal("remove"),
|
|
3945
|
-
path: z.string()
|
|
3946
|
-
}),
|
|
3947
|
-
z.object({
|
|
3948
|
-
op: z.literal("replace"),
|
|
3949
|
-
path: z.string(),
|
|
3950
|
-
value: z.unknown()
|
|
3951
|
-
}),
|
|
3952
|
-
z.object({
|
|
3953
|
-
op: z.literal("move"),
|
|
3954
|
-
from: z.string(),
|
|
3955
|
-
path: z.string()
|
|
3956
|
-
}),
|
|
3957
|
-
z.object({
|
|
3958
|
-
op: z.literal("copy"),
|
|
3959
|
-
from: z.string(),
|
|
3960
|
-
path: z.string()
|
|
3961
|
-
}),
|
|
3962
|
-
z.object({
|
|
3963
|
-
op: z.literal("add_block"),
|
|
3964
|
-
blockKind: z.string(),
|
|
3965
|
-
afterBlockId: z.string().nullable(),
|
|
3966
|
-
content: z.record(z.string(), z.unknown()),
|
|
3967
|
-
rationale: z.string()
|
|
3968
|
-
}),
|
|
3969
|
-
z.object({
|
|
3970
|
-
op: z.literal("delete_block"),
|
|
3971
|
-
blockId: z.string(),
|
|
3972
|
-
rationale: z.string()
|
|
3973
|
-
}),
|
|
3974
|
-
z.object({
|
|
3975
|
-
op: z.literal("reorder_block"),
|
|
3976
|
-
blockId: z.string(),
|
|
3977
|
-
afterBlockId: z.string().nullable(),
|
|
3978
|
-
rationale: z.string()
|
|
3979
|
-
})
|
|
3980
|
-
]);
|
|
3981
|
-
z.object({ request: z.string().min(1).max(2e3) });
|
|
3982
|
-
const ModelMultiPagePatchEnvelope = z.object({
|
|
3983
|
-
pageId: z.string(),
|
|
3984
|
-
blockId: z.string().optional(),
|
|
3985
|
-
blockKind: z.string().optional(),
|
|
3986
|
-
blockPurpose: z.string().optional().nullable(),
|
|
3987
|
-
ops: z.array(Rfc6902PatchOp),
|
|
3988
|
-
rationale: z.string(),
|
|
3989
|
-
currentContent: z.record(z.string(), z.unknown()).optional()
|
|
3990
|
-
});
|
|
3991
|
-
const ModelMultiPageUpdateResponse = z.object({
|
|
3992
|
-
patches: z.array(ModelMultiPagePatchEnvelope),
|
|
3993
|
-
assistantMessage: z.string(),
|
|
3994
|
-
pagesModified: z.number(),
|
|
3995
|
-
toolCallsUsed: z.number()
|
|
3996
|
-
});
|
|
3997
|
-
/** Server-stamped wire proposals always carry their original page evidence. */
|
|
3998
|
-
const MultiPagePatchEnvelope = ModelMultiPagePatchEnvelope.extend({ preparedAgainst: PreparedPagePreconditionSchema });
|
|
3999
|
-
ModelMultiPageUpdateResponse.extend({ patches: z.array(MultiPagePatchEnvelope) });
|
|
4000
|
-
//#endregion
|
|
4001
|
-
//#region ../api/src/siteTerms.ts
|
|
4002
|
-
const versionIdSchema = z.string().uuid().transform((value, ctx) => {
|
|
4003
|
-
const parsed = parseSiteTermsVersionId(value);
|
|
4004
|
-
if (parsed.ok) return parsed.value;
|
|
4005
|
-
ctx.addIssue({
|
|
4006
|
-
code: "custom",
|
|
4007
|
-
message: "Invalid site terms version"
|
|
4008
|
-
});
|
|
4009
|
-
return z.NEVER;
|
|
4010
|
-
});
|
|
4011
|
-
z.object({
|
|
4012
|
-
shown: z.discriminatedUnion("kind", [
|
|
4013
|
-
z.object({ kind: z.literal("nothing") }),
|
|
4014
|
-
z.object({
|
|
4015
|
-
kind: z.literal("checkbox"),
|
|
4016
|
-
versionId: versionIdSchema
|
|
4017
|
-
}),
|
|
4018
|
-
z.object({
|
|
4019
|
-
kind: z.literal("already_agreed_line"),
|
|
4020
|
-
versionId: versionIdSchema
|
|
4021
|
-
})
|
|
4022
|
-
]),
|
|
4023
|
-
agreed: z.boolean()
|
|
4024
|
-
});
|
|
4025
|
-
const siteTermsSourceSchema = z.discriminatedUnion("kind", [z.object({
|
|
4026
|
-
kind: z.literal("written"),
|
|
4027
|
-
body: z.custom(isCanonicalRichTextDoc)
|
|
4028
|
-
}), z.object({
|
|
4029
|
-
kind: z.literal("link"),
|
|
4030
|
-
destination: z.discriminatedUnion("kind", [z.object({
|
|
4031
|
-
kind: z.literal("page"),
|
|
4032
|
-
identifier: z.string().trim().min(1)
|
|
4033
|
-
}), z.object({
|
|
4034
|
-
kind: z.literal("url"),
|
|
4035
|
-
href: z.url({ protocol: /^https?$/ })
|
|
4036
|
-
})])
|
|
4037
|
-
})]);
|
|
4038
|
-
z.discriminatedUnion("kind", [z.object({
|
|
4039
|
-
kind: z.literal("publish"),
|
|
4040
|
-
expectedRevision: z.number().int().positive().nullable(),
|
|
4041
|
-
source: siteTermsSourceSchema,
|
|
4042
|
-
askAgain: z.boolean()
|
|
4043
|
-
}).strict(), z.object({
|
|
4044
|
-
kind: z.literal("stop"),
|
|
4045
|
-
expectedRevision: z.number().int().positive()
|
|
4046
|
-
}).strict()]);
|
|
4047
|
-
//#endregion
|
|
4048
|
-
//#region src/data/materializeLoaderMedia.ts
|
|
4049
|
-
function materializeMediaNode(value, index) {
|
|
4050
|
-
if (Array.isArray(value)) return value.map((item) => materializeMediaNode(item, index));
|
|
4051
|
-
if (!value || typeof value !== "object") return value;
|
|
4052
|
-
if ("identifier" in value) {
|
|
4053
|
-
const reference = mediaSchema.safeParse(value);
|
|
4054
|
-
if (reference.success) {
|
|
4055
|
-
const resolution = resolveManagedMediaReference(reference.data, index);
|
|
4056
|
-
if (resolution.kind === "resolved") {
|
|
4057
|
-
const { identifier: _identifier, ...usage } = reference.data;
|
|
4058
|
-
return {
|
|
4059
|
-
...usage,
|
|
4060
|
-
asset: resolution.asset
|
|
4061
|
-
};
|
|
4062
|
-
}
|
|
4063
|
-
}
|
|
4064
|
-
}
|
|
4065
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, materializeMediaNode(item, index)]));
|
|
4066
|
-
}
|
|
4067
|
-
/** Resolve render-only asset references before loader coercion removes response sidecars. */
|
|
4068
|
-
function materializeLoaderMedia(payload) {
|
|
4069
|
-
if (!payload || typeof payload !== "object" || !("mediaAssets" in payload) || !Array.isArray(payload.mediaAssets) || !payload.mediaAssets.length) return payload;
|
|
4070
|
-
const index = indexRenderableMediaAssets(payload.mediaAssets.flatMap((asset) => {
|
|
4071
|
-
const parsed = renderableMediaAssetSchema.safeParse(asset);
|
|
4072
|
-
return parsed.success ? [parsed.data] : [];
|
|
4073
|
-
}));
|
|
4074
|
-
return index ? materializeMediaNode(payload, index) : payload;
|
|
4075
|
-
}
|
|
4076
|
-
//#endregion
|
|
4077
|
-
//#region src/data/prefetchBlockData.ts
|
|
4078
|
-
const SUPPORTED_LOADER_ENDPOINTS = SUPPORTED_LOADER_ENDPOINTS$1;
|
|
4079
|
-
function isSupportedLoaderEndpoint(endpoint) {
|
|
4080
|
-
return SUPPORTED_LOADER_ENDPOINTS.includes(endpoint);
|
|
4081
|
-
}
|
|
4082
|
-
const ENTRY_REF_KEYS = [
|
|
4083
|
-
"identifier",
|
|
4084
|
-
"entryIdentifier",
|
|
4085
|
-
"meditationIdentifier",
|
|
4086
|
-
"entryId",
|
|
4087
|
-
"slug"
|
|
4088
|
-
];
|
|
4089
|
-
function isRecord(value) {
|
|
4090
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4091
|
-
}
|
|
4092
|
-
function extractManualEntryRef(item) {
|
|
4093
|
-
if (typeof item === "string") {
|
|
4094
|
-
const trimmed = item.trim();
|
|
4095
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
4096
|
-
}
|
|
4097
|
-
if (!isRecord(item)) return null;
|
|
4098
|
-
for (const key of ENTRY_REF_KEYS) {
|
|
4099
|
-
const raw = item[key];
|
|
4100
|
-
if (typeof raw === "string" && raw.trim().length > 0) return raw.trim();
|
|
4101
|
-
}
|
|
4102
|
-
const fallbackId = item.id;
|
|
4103
|
-
if (typeof fallbackId === "string" && fallbackId.trim().length > 0) return fallbackId.trim();
|
|
4104
|
-
return null;
|
|
4105
|
-
}
|
|
4106
|
-
function extractManualEntryRefsFromArray(items) {
|
|
4107
|
-
return items.map(extractManualEntryRef).filter((ref) => typeof ref === "string");
|
|
4108
|
-
}
|
|
4109
|
-
function parseManualEntryRefsValue(value) {
|
|
4110
|
-
if (Array.isArray(value)) {
|
|
4111
|
-
const refs = extractManualEntryRefsFromArray(value);
|
|
4112
|
-
return refs.length > 0 ? refs : void 0;
|
|
4113
|
-
}
|
|
4114
|
-
if (typeof value === "string" && value.trim()) try {
|
|
4115
|
-
const parsed = JSON.parse(value);
|
|
4116
|
-
if (!Array.isArray(parsed)) return void 0;
|
|
4117
|
-
const refs = extractManualEntryRefsFromArray(parsed);
|
|
4118
|
-
return refs.length > 0 ? refs : void 0;
|
|
4119
|
-
} catch (error) {
|
|
4120
|
-
if (typeof process !== "undefined" && process.env.NODE_ENV !== "production") console.warn("[prefetchBlockData] Failed to parse manual entry refs JSON", {
|
|
4121
|
-
value,
|
|
4122
|
-
error: error instanceof Error ? error.message : String(error)
|
|
4123
|
-
});
|
|
4124
|
-
return;
|
|
4125
|
-
}
|
|
4126
|
-
}
|
|
4127
|
-
function parseManualEntryRefs(...values) {
|
|
4128
|
-
for (const value of values) {
|
|
4129
|
-
const parsed = parseManualEntryRefsValue(value);
|
|
4130
|
-
if (parsed && parsed.length > 0) return parsed;
|
|
4131
|
-
}
|
|
4132
|
-
}
|
|
4133
|
-
const loaderAdapters = {
|
|
4134
|
-
listPublishedEntries,
|
|
4135
|
-
getPublishedEntryPreview,
|
|
4136
|
-
listPublicEvents,
|
|
4137
|
-
listPublicEventCalendarWindow: ({ client, params }) => client.listPublicEventCalendarWindow({
|
|
4138
|
-
...calendarWindowQuerySchema.parse(params),
|
|
4139
|
-
siteId: requireStringParam(params, "siteId", "listPublicEventCalendarWindow")
|
|
4140
|
-
}),
|
|
4141
|
-
listPublicRecurringSchedule,
|
|
4142
|
-
getPublicEventDetails,
|
|
4143
|
-
listPublicRouteCandidates,
|
|
4144
|
-
listPublicTeamMembers,
|
|
4145
|
-
listPublicProducts,
|
|
4146
|
-
listPublicPasses,
|
|
4147
|
-
listPublicMemberships,
|
|
4148
|
-
getPublicFormById,
|
|
4149
|
-
getPublicBookingServices,
|
|
4150
|
-
getPublicWeeklySlotAvailability
|
|
4151
|
-
};
|
|
4152
|
-
function readStringParam(params, key) {
|
|
4153
|
-
const value = params[key];
|
|
4154
|
-
return value && value.length > 0 ? value : void 0;
|
|
4155
|
-
}
|
|
4156
|
-
function requireStringParam(params, key, endpoint) {
|
|
4157
|
-
const value = readStringParam(params, key);
|
|
4158
|
-
if (!value) throw new Error(`${endpoint} requires ${key} param`);
|
|
4159
|
-
return value;
|
|
4160
|
-
}
|
|
4161
|
-
function parsePositiveIntegerParam(params, key) {
|
|
4162
|
-
const value = params[key];
|
|
4163
|
-
const parsed = value === void 0 ? void 0 : Number.parseInt(value, 10);
|
|
4164
|
-
return typeof parsed === "number" && Number.isInteger(parsed) && parsed > 0 ? parsed : void 0;
|
|
4165
|
-
}
|
|
4166
|
-
function parseEntryOrder(value) {
|
|
4167
|
-
if (value === void 0) return void 0;
|
|
4168
|
-
switch (value) {
|
|
4169
|
-
case "order": return "manual";
|
|
4170
|
-
case "newest":
|
|
4171
|
-
case "oldest":
|
|
4172
|
-
case "title": return value;
|
|
4173
|
-
default: return;
|
|
4174
|
-
}
|
|
4175
|
-
}
|
|
4176
|
-
function parsePublicEventKind(value) {
|
|
4177
|
-
if (value === void 0) return void 0;
|
|
4178
|
-
switch (value) {
|
|
4179
|
-
case "all":
|
|
4180
|
-
case "events": return value;
|
|
4181
|
-
default: return;
|
|
4182
|
-
}
|
|
4183
|
-
}
|
|
4184
|
-
async function listPublishedEntries({ client, params }) {
|
|
4185
|
-
const siteId = requireStringParam(params, "siteId", "listPublishedEntries");
|
|
4186
|
-
const type = requireStringParam(params, "type", "listPublishedEntries");
|
|
4187
|
-
const stage = readStringParam(params, "stage");
|
|
4188
|
-
const mode = readStringParam(params, "mode");
|
|
4189
|
-
const parsedEntryRefs = mode === "manual" ? parseManualEntryRefs(params.identifiers, params.entryRefs, params.entryIds) : void 0;
|
|
4190
|
-
if (mode === "manual" && (!parsedEntryRefs || parsedEntryRefs.length === 0)) return { entries: [] };
|
|
4191
|
-
if (mode === "manual" && parsedEntryRefs) return await client.getEntriesByIdentifiers({
|
|
4192
|
-
siteId,
|
|
4193
|
-
contentType: type,
|
|
4194
|
-
identifiers: parsedEntryRefs,
|
|
4195
|
-
preview: stage === "preview"
|
|
4196
|
-
});
|
|
4197
|
-
return await client.getEntries(mapEntriesLoaderQuery(params, siteId, type));
|
|
4198
|
-
}
|
|
4199
|
-
function mapEntriesLoaderQuery(params, siteId, contentType) {
|
|
4200
|
-
const rawOffset = readStringParam(params, "offset");
|
|
4201
|
-
const offset = rawOffset === void 0 ? void 0 : Number(rawOffset);
|
|
4202
|
-
return {
|
|
4203
|
-
siteId,
|
|
4204
|
-
contentType,
|
|
4205
|
-
limit: parsePositiveIntegerParam(params, "limit"),
|
|
4206
|
-
offset: offset !== void 0 && Number.isInteger(offset) && offset >= 0 ? offset : void 0,
|
|
4207
|
-
order: parseEntryOrder(readStringParam(params, "orderBy")),
|
|
4208
|
-
preview: readStringParam(params, "stage") === "preview"
|
|
4209
|
-
};
|
|
4210
|
-
}
|
|
4211
|
-
async function getPublishedEntryPreview({ client, params }) {
|
|
4212
|
-
return await client.getEntry({
|
|
4213
|
-
siteId: requireStringParam(params, "siteId", "getPublishedEntryPreview"),
|
|
4214
|
-
contentType: requireStringParam(params, "type", "getPublishedEntryPreview"),
|
|
4215
|
-
slug: requireStringParam(params, "slug", "getPublishedEntryPreview")
|
|
4216
|
-
});
|
|
4217
|
-
}
|
|
4218
|
-
async function listPublicEvents({ client, params }) {
|
|
4219
|
-
return await client.listPublicEvents({
|
|
4220
|
-
siteId: requireStringParam(params, "siteId", "listPublicEvents"),
|
|
4221
|
-
limit: parsePositiveIntegerParam(params, "limit"),
|
|
4222
|
-
from: readStringParam(params, "from"),
|
|
4223
|
-
to: readStringParam(params, "to"),
|
|
4224
|
-
afterStartsAt: readStringParam(params, "afterStartsAt"),
|
|
4225
|
-
afterId: readStringParam(params, "afterId"),
|
|
4226
|
-
stage: readStringParam(params, "stage"),
|
|
4227
|
-
categoryIds: readStringParam(params, "categoryIds"),
|
|
4228
|
-
venueId: readStringParam(params, "venueId"),
|
|
4229
|
-
staffMemberId: readStringParam(params, "staffMemberId"),
|
|
4230
|
-
kind: parsePublicEventKind(readStringParam(params, "kind")),
|
|
4231
|
-
eventSurface: readStringParam(params, "eventSurface"),
|
|
4232
|
-
eventPresets: readStringParam(params, "eventPresets"),
|
|
4233
|
-
scheduleScope: readStringParam(params, "scheduleScope"),
|
|
4234
|
-
detailLevel: readStringParam(params, "detailLevel") === "listing" ? "listing" : void 0,
|
|
4235
|
-
readProfile: readStringParam(params, "readProfile"),
|
|
4236
|
-
seriesId: readStringParam(params, "seriesId"),
|
|
4237
|
-
includeOccurrenceId: readStringParam(params, "includeOccurrenceId")
|
|
4238
|
-
});
|
|
4239
|
-
}
|
|
4240
|
-
async function listPublicRecurringSchedule(input) {
|
|
4241
|
-
return projectRecurringSchedule(await listPublicEvents(input));
|
|
4242
|
-
}
|
|
4243
|
-
async function getPublicEventDetails({ client, params }) {
|
|
4244
|
-
return await client.getPublicEventDetails({
|
|
4245
|
-
siteId: requireStringParam(params, "siteId", "getPublicEventDetails"),
|
|
4246
|
-
limit: parsePositiveIntegerParam(params, "limit"),
|
|
4247
|
-
from: readStringParam(params, "from"),
|
|
4248
|
-
to: readStringParam(params, "to"),
|
|
4249
|
-
afterStartsAt: readStringParam(params, "afterStartsAt"),
|
|
4250
|
-
afterId: readStringParam(params, "afterId"),
|
|
4251
|
-
stage: readStringParam(params, "stage"),
|
|
4252
|
-
categoryIds: readStringParam(params, "categoryIds"),
|
|
4253
|
-
venueId: readStringParam(params, "venueId"),
|
|
4254
|
-
staffMemberId: readStringParam(params, "staffMemberId"),
|
|
4255
|
-
kind: readStringParam(params, "kind"),
|
|
4256
|
-
eventSurface: readStringParam(params, "eventSurface"),
|
|
4257
|
-
eventPresets: readStringParam(params, "eventPresets"),
|
|
4258
|
-
scheduleScope: readStringParam(params, "scheduleScope"),
|
|
4259
|
-
seriesId: readStringParam(params, "seriesId"),
|
|
4260
|
-
includeOccurrenceId: readStringParam(params, "includeOccurrenceId")
|
|
4261
|
-
});
|
|
4262
|
-
}
|
|
4263
|
-
async function listPublicRouteCandidates({ client, params }) {
|
|
4264
|
-
const siteId = requireStringParam(params, "siteId", "listPublicRouteCandidates");
|
|
4265
|
-
return { routes: (await client.getAllPublishedRoutes({ siteId })).items.flatMap((item) => {
|
|
4266
|
-
if (!item.path) return [];
|
|
4267
|
-
return [{
|
|
4268
|
-
entityId: item.entityId,
|
|
4269
|
-
path: item.path,
|
|
4270
|
-
title: item.title,
|
|
4271
|
-
kind: item.entityType,
|
|
4272
|
-
contentTypeKey: item.contentTypeKey ?? null
|
|
4273
|
-
}];
|
|
4274
|
-
}) };
|
|
4275
|
-
}
|
|
4276
|
-
async function listPublicTeamMembers({ client, params }) {
|
|
4277
|
-
return await client.listPublicTeamMembers({
|
|
4278
|
-
siteId: requireStringParam(params, "siteId", "listPublicTeamMembers"),
|
|
4279
|
-
stage: readStringParam(params, "stage")
|
|
4280
|
-
});
|
|
4281
|
-
}
|
|
4282
|
-
async function listPublicProducts({ client, params }) {
|
|
4283
|
-
return await client.listPublicProducts({
|
|
4284
|
-
siteId: requireStringParam(params, "siteId", "listPublicProducts"),
|
|
4285
|
-
stage: readStringParam(params, "stage") === "preview" ? "preview" : "published",
|
|
4286
|
-
categorySelector: parsePublicProductCategorySelector(params.categorySelector)
|
|
4287
|
-
});
|
|
4288
|
-
}
|
|
4289
|
-
async function listPublicPasses({ client, params }) {
|
|
4290
|
-
return await client.listPublicPasses({
|
|
4291
|
-
siteId: requireStringParam(params, "siteId", "listPublicPasses"),
|
|
4292
|
-
categories: readStringParam(params, "categories")
|
|
4293
|
-
});
|
|
4294
|
-
}
|
|
4295
|
-
async function listPublicMemberships({ client, params }) {
|
|
4296
|
-
return await client.listPublicMemberships({
|
|
4297
|
-
siteId: requireStringParam(params, "siteId", "listPublicMemberships"),
|
|
4298
|
-
categories: readStringParam(params, "categories")
|
|
4299
|
-
});
|
|
4300
|
-
}
|
|
4301
|
-
async function getPublicFormById({ client, params }) {
|
|
4302
|
-
return await client.getPublicFormById({
|
|
4303
|
-
formId: requireStringParam(params, "formId", "getPublicFormById"),
|
|
4304
|
-
siteId: requireStringParam(params, "siteId", "getPublicFormById")
|
|
4305
|
-
});
|
|
4306
|
-
}
|
|
4307
|
-
async function getPublicBookingServices({ client, params }) {
|
|
4308
|
-
return await client.getPublicBookingServices({
|
|
4309
|
-
siteId: requireStringParam(params, "siteId", "getPublicBookingServices"),
|
|
4310
|
-
ids: readStringParam(params, "ids")
|
|
4311
|
-
});
|
|
4312
|
-
}
|
|
4313
|
-
async function getPublicWeeklySlotAvailability({ client, params }) {
|
|
4314
|
-
return await client.getPublicWeeklySlotAvailability({
|
|
4315
|
-
siteId: requireStringParam(params, "siteId", "getPublicWeeklySlotAvailability"),
|
|
4316
|
-
serviceId: requireStringParam(params, "serviceId", "getPublicWeeklySlotAvailability"),
|
|
4317
|
-
resourceId: readStringParam(params, "resourceId"),
|
|
4318
|
-
horizonWeeks: parsePositiveIntegerParam(params, "horizonWeeks"),
|
|
4319
|
-
timezone: readStringParam(params, "timezone")
|
|
4320
|
-
});
|
|
4321
|
-
}
|
|
4322
|
-
/** Rendering consumers retain the request identity with the loaded values. */
|
|
4323
|
-
async function prefetchBlockDataWithFailures(page, context, client, options) {
|
|
4324
|
-
return prefetchBlockDataWithFailures$1(page, context, sdkPrefetchOptions(normalizeLoaderParams, context, client, options));
|
|
4325
|
-
}
|
|
4326
|
-
function sdkPrefetchOptions(normalize, context, client, options) {
|
|
4327
|
-
const { customBlocks } = options ?? {};
|
|
4328
|
-
const customBlockMap = new Map((customBlocks ?? []).map((block) => [block.id, block]));
|
|
4329
|
-
return {
|
|
4330
|
-
apiClient: async ({ endpoint, params }) => {
|
|
4331
|
-
if (!isSupportedLoaderEndpoint(endpoint)) throw new Error(`Unsupported loader endpoint: ${endpoint}. SDK only supports: ${SUPPORTED_LOADER_ENDPOINTS.join(", ")}`);
|
|
4332
|
-
const resolvedParams = normalize(endpoint, params, context);
|
|
4333
|
-
return materializeLoaderMedia(await loaderAdapters[endpoint]({
|
|
4334
|
-
client,
|
|
4335
|
-
params: resolvedParams
|
|
4336
|
-
}));
|
|
4337
|
-
},
|
|
4338
|
-
isValidEndpoint: isSupportedLoaderEndpoint,
|
|
4339
|
-
onError: (error, { block, loader }) => {
|
|
4340
|
-
console.warn("[prefetchBlockData] failed to prefetch block data", {
|
|
4341
|
-
block,
|
|
4342
|
-
loader,
|
|
4343
|
-
error
|
|
4344
|
-
});
|
|
4345
|
-
},
|
|
4346
|
-
getCustomBlockLoaders: (kind) => sdkCustomLoaders(customBlockMap.get(kind))
|
|
4347
|
-
};
|
|
4348
|
-
}
|
|
4349
|
-
function sdkCustomLoaders(block) {
|
|
4350
|
-
return block?.dataLoaders ? Object.fromEntries(Object.entries(block.dataLoaders).map(([key, loader]) => [key, {
|
|
4351
|
-
endpoint: loader.endpoint,
|
|
4352
|
-
params: loader.params,
|
|
4353
|
-
requiredParams: loader.requiredParams,
|
|
4354
|
-
mode: loader.mode,
|
|
4355
|
-
when: loader.when
|
|
4356
|
-
}])) : void 0;
|
|
4357
|
-
}
|
|
4358
|
-
//#endregion
|
|
4359
|
-
export { resolvePageRouteTarget as C, parseStoredVariant as D, createPresentationPageReader as E, isCanonicalRichTextDoc as O, resolveEntryRouteTarget as S, createEditorPresentationPageReader as T, buildLinkedContentEditTarget as _, SDK_WORKFLOW_ENDPOINT_PATTERN as a, defaultTransforms as b, navigationLinkInputSchemaOptions as c, resolveSdkFooterMode as d, createPageRenderPlanReader as f, retargetJoinsAcrossOmissions as g, renderedJoinLayout as h, collectPortalLinkStats as i, footerModeSchema as l, joinSlotKey as m, prefetchBlockDataWithFailures as n, SDK_WORKFLOW_ID_PATTERN as o, composePageJoins as p, collectCartLinkStats as r, loaderFallbackScalarSchema as s, SUPPORTED_LOADER_ENDPOINTS as t, resolveFooterRenderPlan as u, resolveLinkedEntryInlineFieldEligibility as v, resolveRouteTarget as w, resolveAuthoredLinkHref as x, builtinTransformDefinitions as y };
|