@riverbankcms/sdk 0.155.0 → 0.156.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PreviewEditorSidebar-CbSbqmz3.mjs → PreviewEditorSidebar-B4ESNPzL.mjs} +3 -3
- package/dist/{PreviewEditorUI-CKKnAw11.mjs → PreviewEditorUI-BdUVaGOh.mjs} +3 -3
- package/dist/{SdkPreviewModeRuntime-wLkXrWy9.mjs → SdkPreviewModeRuntime-C4V3BvxK.mjs} +1122 -1079
- package/dist/{SiteChromeCustomizeContext-BQ8vvKb-.mjs → SiteChromeCustomizeContext-3gmd26Mn.mjs} +1019 -517
- package/dist/_dts/ai/src/contracts/proposals.d.ts +624 -624
- package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +856 -856
- package/dist/_dts/api/src/accountApi.d.ts +5 -5
- package/dist/_dts/api/src/aiPlayground.d.ts +2 -2
- package/dist/_dts/api/src/bookingRecords.d.ts +2 -22
- package/dist/_dts/api/src/commercePortalEndpoints.d.ts +1 -1
- package/dist/_dts/api/src/contentRuntime.d.ts +5 -2
- package/dist/_dts/api/src/footerCompositionContracts.d.ts +1 -1
- package/dist/_dts/api/src/navigation/linkValue.d.ts +1 -1
- package/dist/_dts/api/src/navigation/types.d.ts +1 -1
- package/dist/_dts/api/src/public/types.d.ts +2 -1
- package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +1 -1
- package/dist/_dts/api/src/publicExperience/eventEndpoints.d.ts +3 -3
- package/dist/_dts/api/src/publicExperience/siteEndpoints.d.ts +1 -1
- package/dist/_dts/api/src/sdkBlockContentAdmission.d.ts +1 -1
- package/dist/_dts/api/src/sdkConfig/contracts.d.ts +2 -1
- package/dist/_dts/api/src/sdkContracts.d.ts +2 -1
- package/dist/_dts/api/src/sdkPageDesign.d.ts +9 -9
- package/dist/_dts/api/src/sdkThemeWire.d.ts +182 -182
- package/dist/_dts/api/src/siteOnboarding.d.ts +1 -1
- package/dist/_dts/api/src/siteRuntimeEndpoints.d.ts +3 -1
- package/dist/_dts/api/src/siteSettings.d.ts +2 -2
- package/dist/_dts/api/src/teamMembers.d.ts +1 -1
- package/dist/_dts/block-form/src/widgets/RepeaterField/hooks/useLayoutGridMoveAnimation.d.ts +13 -0
- package/dist/_dts/blocks/src/client/portal.d.ts +5 -0
- package/dist/_dts/blocks/src/contracts/event-registration.d.ts +141 -0
- package/dist/_dts/blocks/src/contracts/events.d.ts +21 -0
- package/dist/_dts/blocks/src/contracts/footer.d.ts +130 -0
- package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +1 -1
- package/dist/_dts/blocks/src/contracts/site-chrome.d.ts +10 -0
- package/dist/_dts/blocks/src/customer-portal/client.d.ts +62 -0
- package/dist/_dts/blocks/src/customer-portal/components/PortalLoginForm.d.ts +16 -0
- package/dist/_dts/blocks/src/customer-portal/components/badge.d.ts +6 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/AppointmentBeforeYouComeTask.d.ts +29 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/BookingsSection.d.ts +22 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/BookingsTable.d.ts +9 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/EventRow.d.ts +9 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/EventSeriesRegistrationRow.d.ts +8 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/EventSeriesRegistrationTableRow.d.ts +22 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/PortalAppointmentRescheduleFlow.d.ts +7 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/ScalarQuestionInput.d.ts +11 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/WaitlistCard.d.ts +8 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/WaitlistsSection.d.ts +19 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/bookingsTypes.d.ts +11 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/eventGuestDrafts.d.ts +6 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/eventSeriesRegistrationPresentation.d.ts +8 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/usePortalCancelFlow.d.ts +36 -0
- package/dist/_dts/blocks/src/customer-portal/components/bookings/usePortalCancelFlow.state.d.ts +43 -0
- package/dist/_dts/blocks/src/customer-portal/components/orders/OrdersSection.d.ts +8 -0
- package/dist/_dts/blocks/src/customer-portal/components/orders/orderInteraction.d.ts +63 -0
- package/dist/_dts/blocks/src/customer-portal/components/portal-modal.d.ts +8 -0
- package/dist/_dts/blocks/src/customer-portal/components/portalDeepLink.d.ts +19 -0
- package/dist/_dts/blocks/src/customer-portal/components/useMembershipCancelFlow.d.ts +13 -0
- package/dist/_dts/blocks/src/customer-portal/components/useMembershipCancelFlow.state.d.ts +32 -0
- package/dist/_dts/blocks/src/customer-portal/pages/AccessState.d.ts +11 -0
- package/dist/_dts/blocks/src/customer-portal/pages/DigitalProductView.d.ts +4 -0
- package/dist/_dts/blocks/src/customer-portal/pages/PageChrome.d.ts +9 -0
- package/dist/_dts/blocks/src/customer-portal/pages/PrintButton.d.ts +1 -0
- package/dist/_dts/blocks/src/customer-portal/pages/TicketCode.d.ts +3 -0
- package/dist/_dts/blocks/src/customer-portal/pages/TicketView.d.ts +4 -0
- package/dist/_dts/blocks/src/customer-portal/route-client.d.ts +9 -0
- package/dist/_dts/blocks/src/customer-portal/shared/bookingRoute.d.ts +9 -0
- package/dist/_dts/blocks/src/customer-portal/shared/checkoutUrls.d.ts +4 -0
- package/dist/_dts/blocks/src/customer-portal/shared/signedUrlUpload.d.ts +1 -0
- package/dist/_dts/blocks/src/customer-portal/shared/urlParams.d.ts +30 -0
- package/dist/_dts/blocks/src/customer-portal/state.d.ts +196 -0
- package/dist/_dts/blocks/src/customer-portal/tabs.d.ts +17 -0
- package/dist/_dts/blocks/src/portal/dateFormatting.d.ts +13 -0
- package/dist/_dts/blocks/src/portal/types.d.ts +7 -14
- package/dist/_dts/blocks/src/system/blocks/event-details.d.ts +1 -25
- package/dist/_dts/blocks/src/system/blocks/event-registration.d.ts +1 -141
- package/dist/_dts/blocks/src/system/blocks/events/eventSelectionFields.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/location-map.d.ts +3 -3
- package/dist/_dts/blocks/src/system/blocks/media-text.d.ts +135 -135
- package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +3 -129
- package/dist/_dts/blocks/src/system/blocks/site-footer.d.ts +2 -5
- package/dist/_dts/blocks/src/system/blocks/site-header.d.ts +2 -5
- package/dist/_dts/blocks/src/system/constants/events.d.ts +1 -1
- package/dist/_dts/blocks/src/system/customize/facets.d.ts +2 -2
- package/dist/_dts/blocks/src/system/manifest/schema.d.ts +82 -82
- package/dist/_dts/blocks/src/system/node/fragments/lookSlot.d.ts +2 -2
- package/dist/_dts/blocks/src/system/node/schema.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +21 -2
- package/dist/_dts/blocks/src/system/runtime/api/endpoints.d.ts +87 -3
- package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/api/schemas/events.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/api/types/portal.d.ts +16 -27
- package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +6 -6
- package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +4 -4
- package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableDates.d.ts +2 -5
- package/dist/_dts/blocks/src/system/runtime/hooks/useAvailableSlots.d.ts +2 -5
- package/dist/_dts/blocks/src/system/runtime/lookSurfaces.d.ts +9 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-details/lookPresentation.d.ts +9 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +18 -18
- package/dist/_dts/blocks/src/system/runtime/nodes/form.interactive.d.ts +2 -10
- package/dist/_dts/blocks/src/system/runtime/nodes/form.types.d.ts +10 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/shared/contract-schemas.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/shared/AppointmentRescheduleSlotOptions.d.ts +11 -0
- package/dist/_dts/blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.d.ts +73 -0
- package/dist/_dts/blocks/src/system/runtime/shared/useAppointmentRescheduleFlow.state.d.ts +62 -0
- package/dist/_dts/blocks/src/system/runtime/shared/utils/demoPortalMagicLink.d.ts +1 -4
- package/dist/_dts/commerce/src/moneyDateUtils.d.ts +7 -0
- package/dist/_dts/core/src/booking-date-time.d.ts +5 -1
- package/dist/_dts/core/src/date-display.d.ts +4 -0
- package/dist/_dts/core/src/navigation-portal-labels.d.ts +1 -1
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +13 -0
- package/dist/_dts/db/src/schemas/forms.d.ts +4 -4
- package/dist/_dts/preview-next/src/client/preview/PreviewEditingModeProvider.d.ts +7 -0
- package/dist/_dts/sdk/src/bookings/types.d.ts +0 -1
- package/dist/_dts/sdk/src/next/index.d.ts +1 -0
- package/dist/_dts/sdk/src/next/portal.d.ts +41 -0
- package/dist/_dts/sdk/src/next/resolveTheme.d.ts +4 -9
- package/dist/_dts/sdk/src/next/types.d.ts +8 -3
- package/dist/_dts/sdk/src/portal/client.d.ts +1 -0
- package/dist/_dts/sdk/src/portal/index.d.ts +4 -36
- package/dist/_dts/sdk/src/portal/token.d.ts +4 -20
- package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +4 -1
- package/dist/_dts/sdk/src/rendering/islands/types.d.ts +1 -28
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/theme-core/src/accordions/types.d.ts +4 -4
- package/dist/_dts/theme-core/src/buttons/types.d.ts +41 -41
- package/dist/_dts/theme-core/src/buttons/typography.d.ts +2 -2
- package/dist/_dts/theme-core/src/cards/types.d.ts +34 -34
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/header/containerSchema.d.ts +2 -2
- package/dist/_dts/theme-core/src/hosted-booking-appearance.d.ts +1 -1
- package/dist/_dts/theme-core/src/inputs/types.d.ts +4 -4
- package/dist/_dts/theme-core/src/mock-themes/all.d.ts +255 -255
- package/dist/_dts/theme-core/src/navigation/types.d.ts +6 -6
- package/dist/_dts/theme-core/src/palette/colors.d.ts +1 -1
- package/dist/_dts/theme-core/src/palette/curated/types.d.ts +2 -2
- package/dist/_dts/theme-core/src/schema.d.ts +294 -294
- package/dist/_dts/theme-core/src/shared/componentStyles.d.ts +1 -1
- package/dist/_dts/theme-core/src/site-styles/backgroundAppearance.d.ts +2 -2
- package/dist/_dts/theme-core/src/site-styles/compileFooterAgainstRow.d.ts +7 -7
- package/dist/_dts/theme-core/src/site-styles/headerPreferencesPersistence.d.ts +1 -1
- package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +12 -12
- package/dist/_dts/theme-core/src/tokens/themeColorTokens.d.ts +2 -2
- package/dist/_dts/theme-core/src/typography/schema.d.ts +27 -27
- package/dist/_dts/ui/src/button.d.ts +1 -1
- package/dist/_dts/ui/src/surface.d.ts +2 -2
- package/dist/_dts/ui/src/toggle.d.ts +2 -2
- package/dist/client/{BookingMailingListNote-CiW1dsz7.mjs → BookingMailingListNote-B9mP3Io9.mjs} +2 -2
- package/dist/client/{CardListItem-DVYTlYpS.mjs → CardListItem-D5rL2wPv.mjs} +3 -3
- package/dist/client/{CheckboxChoice-CUnPrBlC.mjs → CheckboxChoice-Bz6wLaBl.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-DEsn5F2C.mjs → DemoBookingPortalAccess-7BPVzfLU.mjs} +6 -10
- package/dist/client/{EventCombined.client-BdctbwnV.mjs → EventCombined.client-DZH5qHJl.mjs} +5 -5
- package/dist/client/{EventEmbeddedCheckoutStep-DAhQs6Jb.mjs → EventEmbeddedCheckoutStep-CV31Qvn2.mjs} +2 -2
- package/dist/client/{EventListing.client-BviZXfAE.mjs → EventListing.client-C19sjRGF.mjs} +2 -2
- package/dist/client/{LeafletStaticMap-BLTECfjU.mjs → LeafletStaticMap-DjUjYdzQ.mjs} +1 -1
- package/dist/client/{RichText-D3oE1_pw.mjs → RichText-DkKcVZwr.mjs} +2 -2
- package/dist/client/{ThemedButton-Ckj0Rfr_.mjs → ThemedButton-CTgpAXfL.mjs} +1 -1
- package/dist/client/{accordion-yBx6d4O2.mjs → accordion-R2-q5wo-.mjs} +1 -1
- package/dist/client/{bookingForm-CPDEsQci.mjs → bookingForm-VSU8nIdO.mjs} +12 -16
- package/dist/client/bookings.mjs +352 -64
- package/dist/client/{carousel-DCqjwd2s.mjs → carousel-BjPlY4ee.mjs} +2 -2
- package/dist/client/{carousel.client-Bx7XMF8-.mjs → carousel.client-Tnwvm0l1.mjs} +1 -1
- package/dist/client/{cart-DWJXrQxs.mjs → cart-DAPYTOP7.mjs} +3 -3
- package/dist/client/{checkout-CH4ypSLS.mjs → checkout-DGJTx4vB.mjs} +3 -3
- package/dist/client/client.mjs +61275 -61217
- package/dist/client/{context-BOs0m_iw.mjs → context-ByZBoKdq.mjs} +92 -209
- package/dist/client/{eventCalendar-CRylMllc.mjs → eventCalendar-CP5Z7iME.mjs} +8 -8
- package/dist/client/{eventCombined-DohTS3kp.mjs → eventCombined-D8nbUyxu.mjs} +4 -4
- package/dist/client/{eventDetails-qf-u9zcF.mjs → eventDetails-Bknq8k7E.mjs} +46 -44
- package/dist/client/{eventListing-Cg__X2vy.mjs → eventListing-BwMnPteX.mjs} +4 -4
- package/dist/client/{eventRegistration-CybWxswy.mjs → eventRegistration-COFk1mjw.mjs} +11 -11
- package/dist/client/{form-C-SGk6nq.mjs → form-BiWLd_me.mjs} +5 -5
- package/dist/client/{headerSection-BdzPaHqo.mjs → headerSection-BptDP4xF.mjs} +3 -3
- package/dist/client/hooks.mjs +22850 -22861
- package/dist/client/{locationMap-CEwIKmMb.mjs → locationMap-B-kPoqcK.mjs} +3 -3
- package/dist/client/{media-V_ShXXru.mjs → media-FjqQK4qS.mjs} +68 -1
- package/dist/client/{newsletterForm-CmwTltoS.mjs → newsletterForm-s_B8fCtT.mjs} +4 -4
- package/dist/client/portal/client.mjs +17419 -0
- package/dist/client/{productDetail-DjIzUwg3.mjs → productDetail-CS3GZMPi.mjs} +3 -3
- package/dist/client/{productList-D6JGFnMF.mjs → productList-Csc3WJDs.mjs} +3 -3
- package/dist/client/{propsDecoder-BRKz13eg.mjs → propsDecoder-Dn68GoQZ.mjs} +502 -2705
- package/dist/client/rendering/client.mjs +3303 -3612
- package/dist/client/rendering/islands.mjs +17 -17
- package/dist/client/rendering.mjs +46273 -46220
- package/dist/client/{routeIslandApiConfig-slAAILQ5.mjs → routeIslandApiConfig-DeBuevOO.mjs} +1 -1
- package/dist/client/{shop-C45K96_0.mjs → shop-B5EQbeUX.mjs} +7 -7
- package/dist/client/{shop-commerce-oGBiKT5d.mjs → shop-commerce-DYs7PdNL.mjs} +8 -8
- package/dist/client/{shop-commerce-store-H_HFPFZ8.mjs → shop-commerce-store-B2-DIPbg.mjs} +1 -1
- package/dist/client/{shopShared-D54T_LAV.mjs → shopShared-CE302Pfy.mjs} +4 -4
- package/dist/client/{useDiscountCodeUi-Dm2EUa03.mjs → useDiscountCodeUi-BZ02FBrV.mjs} +1 -1
- package/dist/client/{useEventPagination-0l_A8CxG.mjs → useEventPagination-VudQWKtG.mjs} +116 -6
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/{sdk-runtime-CjTM32Ah.mjs → sdk-runtime-C8Qh6r51.mjs} +1 -1
- package/dist/server/components.mjs +927 -262
- package/dist/server/config-template-validation.mjs +5 -3
- package/dist/server/config-validation.mjs +35200 -35211
- package/dist/server/config.mjs +35200 -35211
- package/dist/server/data.mjs +32783 -32794
- package/dist/server/date-time.mjs +14 -7
- package/dist/server/index.mjs +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next.mjs +71470 -70677
- package/dist/server/page-converter.mjs +202 -213
- package/dist/server/portal.mjs +5 -51
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +1180 -722
- package/dist/server/rendering.mjs +922 -262
- package/dist/server/routing.mjs +39382 -41704
- package/dist/server/server.mjs +203 -214
- package/dist/server/theme-bridge.mjs +262 -2
- package/dist/{spinner-KVVZh8jd.mjs → spinner-Bi68Z_0o.mjs} +1 -1
- package/dist/styles/index.css +258 -2
- package/package.json +9 -1
- package/dist/_dts/sdk/src/portal/config.d.ts +0 -67
|
@@ -550,6 +550,13 @@ function getDateTimeFormatter(locale, timeZone, format) {
|
|
|
550
550
|
dateTimeFormatterCache.set(key, formatter);
|
|
551
551
|
return formatter;
|
|
552
552
|
}
|
|
553
|
+
function formatIntlRange(formatter, start, end) {
|
|
554
|
+
const nativeFormatRange = Reflect.get(formatter, "formatRange");
|
|
555
|
+
if (typeof nativeFormatRange !== "function") throw new Error("Intl.DateTimeFormat.formatRange is required");
|
|
556
|
+
const output = Reflect.apply(nativeFormatRange, formatter, [start, end]);
|
|
557
|
+
if (typeof output !== "string") throw new Error("Intl.DateTimeFormat.formatRange returned a non-string value");
|
|
558
|
+
return output;
|
|
559
|
+
}
|
|
553
560
|
//#endregion
|
|
554
561
|
//#region ../core/src/booking-time-zone.ts
|
|
555
562
|
const TIME_ZONE_VALIDITY_CACHE_LIMIT = 100;
|
|
@@ -638,6 +645,11 @@ function resolveBookingTimeZoneId(...candidates) {
|
|
|
638
645
|
}
|
|
639
646
|
return FALLBACK_TIMEZONE;
|
|
640
647
|
}
|
|
648
|
+
/** Canonical business-zone admission, shared by server and public wire boundaries. */
|
|
649
|
+
const DEFAULT_BOOKING_BUSINESS_TIME_ZONE = "Europe/London";
|
|
650
|
+
function resolveBookingBusinessTimeZone(value) {
|
|
651
|
+
return resolveBookingTimeZoneId(value, DEFAULT_BOOKING_BUSINESS_TIME_ZONE);
|
|
652
|
+
}
|
|
641
653
|
function parseUtcIsoDateTimeString(value) {
|
|
642
654
|
const normalized = value.trim();
|
|
643
655
|
const hasUtcSuffix = normalized.endsWith("Z");
|
|
@@ -745,6 +757,34 @@ function formatBookingTime(input, format = {
|
|
|
745
757
|
format
|
|
746
758
|
});
|
|
747
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* Formats the compact English event-time presentation used by public surfaces.
|
|
762
|
+
*
|
|
763
|
+
* This intentionally owns the lowercase day-period token and zero-minute
|
|
764
|
+
* omission instead of depending on locale-specific spacing or punctuation.
|
|
765
|
+
* Callers must only use it for an English presentation contract.
|
|
766
|
+
*/
|
|
767
|
+
function formatBookingCompactEnglishTime(input, options = {}) {
|
|
768
|
+
const date = new Date(input.startsAt);
|
|
769
|
+
if (Number.isNaN(date.getTime())) return input.startsAt;
|
|
770
|
+
return compactEnglishClock(formatToPartsLookup(date, input.locale ?? "en-GB", input.timeZone, {
|
|
771
|
+
hour: "numeric",
|
|
772
|
+
minute: "2-digit",
|
|
773
|
+
hourCycle: "h12",
|
|
774
|
+
...options.seconds === "include" ? { second: "2-digit" } : {}
|
|
775
|
+
}), options.seconds) ?? input.startsAt;
|
|
776
|
+
}
|
|
777
|
+
/** Precision and zero-minute omission are one decision for all compact clocks. */
|
|
778
|
+
function compactEnglishClock(parts, seconds) {
|
|
779
|
+
const hour = parts.get("hour");
|
|
780
|
+
const minute = parts.get("minute");
|
|
781
|
+
const dayPeriod = parts.get("dayPeriod");
|
|
782
|
+
const second = parts.get("second");
|
|
783
|
+
if (hour === void 0 || minute === void 0 || dayPeriod === void 0) return null;
|
|
784
|
+
const token = dayPeriod.toLowerCase();
|
|
785
|
+
if (seconds === "include") return second === void 0 ? null : `${hour}:${minute}:${second}${token}`;
|
|
786
|
+
return `${minute === "00" ? hour : `${hour}:${minute}`}${token}`;
|
|
787
|
+
}
|
|
748
788
|
function formatBookingDateParts(input, options) {
|
|
749
789
|
return {
|
|
750
790
|
date: formatBookingDate(input, options?.dateFormat ?? {
|
|
@@ -873,6 +913,173 @@ function inferSiteDateLocale(siteTimeZone) {
|
|
|
873
913
|
if (siteTimeZone === "Pacific/Auckland" || siteTimeZone === "Pacific/Chatham") return "en-NZ";
|
|
874
914
|
return "en-US";
|
|
875
915
|
}
|
|
916
|
+
function formatDate$2(value, context, options = {}) {
|
|
917
|
+
return presentDate(value, context, displayProfile(options, "omit"));
|
|
918
|
+
}
|
|
919
|
+
function formatDateRange(start, endInclusive, context, options = {}) {
|
|
920
|
+
const first = {
|
|
921
|
+
kind: "civil",
|
|
922
|
+
value: projectDate(start, context)
|
|
923
|
+
};
|
|
924
|
+
const last = {
|
|
925
|
+
kind: "civil",
|
|
926
|
+
value: projectDate(endInclusive, context)
|
|
927
|
+
};
|
|
928
|
+
const preserveOrder = options.order === "session" && compareLocalScheduleDates(first.value, last.value) > 0;
|
|
929
|
+
const profile = displayProfile(preserveOrder ? {
|
|
930
|
+
...options,
|
|
931
|
+
year: "numeric"
|
|
932
|
+
} : options, "omit");
|
|
933
|
+
return preserveOrder ? `${presentDate(first, context, profile)} – ${presentDate(last, context, profile)}` : presentDateRange(first, last, context, profile);
|
|
934
|
+
}
|
|
935
|
+
function formatDateTimeRange(span, context, options) {
|
|
936
|
+
return presentDateTimeRange(span, context, displayProfile(options, options.zone, options.seconds));
|
|
937
|
+
}
|
|
938
|
+
/** Sole date projection/typography owner, used by display and scheduled adapters. */
|
|
939
|
+
function presentDate(value, context, profile) {
|
|
940
|
+
const date = dateCarrier(value);
|
|
941
|
+
const zone = value.kind === "civil" ? "UTC" : context.timeZone;
|
|
942
|
+
const output = getDateTimeFormatter(context.locale, zone, profile.dateFormat).format(date);
|
|
943
|
+
if (profile.kind === "sdk") return output;
|
|
944
|
+
const normalized = normalizeDisplay(output);
|
|
945
|
+
return profile.dateFormat.weekday && new Intl.Locale(context.locale).language === "en" ? normalized.replace(/^([^,]+), /u, "$1 ") : normalized;
|
|
946
|
+
}
|
|
947
|
+
function presentDateRange(start, end, context, profile) {
|
|
948
|
+
if (dateCarrier(end).getTime() < dateCarrier(start).getTime()) throw new RangeError("Date range end must be on or after its start");
|
|
949
|
+
if (profile.kind === "display" && compareLocalScheduleDates(projectDate(start, context), projectDate(end, context)) === 0) return presentDate(start, context, profile);
|
|
950
|
+
const output = formatIntlRange(getDateTimeFormatter(context.locale, start.kind === "civil" ? "UTC" : context.timeZone, profile.dateFormat), dateCarrier(start), dateCarrier(end));
|
|
951
|
+
if (profile.kind === "sdk") return output;
|
|
952
|
+
const startDate = projectDate(start, context);
|
|
953
|
+
const endDate = projectDate(end, context);
|
|
954
|
+
const separator = startDate.month === endDate.month && startDate.year === endDate.year ? "–" : " – ";
|
|
955
|
+
return normalizeDisplay(output).replace(/\s*–\s*/gu, separator);
|
|
956
|
+
}
|
|
957
|
+
function presentTime(value, context, profile) {
|
|
958
|
+
const clock = presentClock(value, context, profile.clock);
|
|
959
|
+
return profile.zone === "always" ? `${clock} ${zoneLabel(value, context)}` : clock;
|
|
960
|
+
}
|
|
961
|
+
function presentTimeRange(span, context, profile) {
|
|
962
|
+
assertOrdered(span.start, span.end);
|
|
963
|
+
if (profile.clock.kind === "intl") return presentNativeRange(span, context, profile.clock.format);
|
|
964
|
+
const startClock = presentClock(span.start, context, profile.clock);
|
|
965
|
+
const endClock = presentClock(span.end, context, profile.clock);
|
|
966
|
+
const clocks = (profile.kind === "sdk" ? startClock === endClock : span.start === span.end) ? startClock : `${startClock}–${endClock}`;
|
|
967
|
+
const labels = decideRangeLabels(span, context, profile);
|
|
968
|
+
switch (labels.kind) {
|
|
969
|
+
case "omit": return clocks;
|
|
970
|
+
case "shared": return `${clocks} ${labels.label}`;
|
|
971
|
+
case "endpoints": return `${startClock} ${labels.start} – ${endClock} ${labels.end}`;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
function presentDateTimeRange(span, context, profile) {
|
|
975
|
+
assertOrdered(span.start, span.end);
|
|
976
|
+
if (profile.clock.kind === "intl") return presentNativeRange(span, context, combinedFormat(profile.dateFormat, profile.clock));
|
|
977
|
+
const startDate = getLocalScheduleDate(new Date(span.start), context.timeZone);
|
|
978
|
+
const endDate = getLocalScheduleDate(new Date(span.end), context.timeZone);
|
|
979
|
+
if (compareLocalScheduleDates(startDate, endDate) === 0) return `${presentDate({
|
|
980
|
+
kind: "instant",
|
|
981
|
+
value: span.start
|
|
982
|
+
}, context, profile)}, ${presentTimeRange(span, context, profile)}`;
|
|
983
|
+
const labels = decideRangeLabels(span, context, profile);
|
|
984
|
+
const startProfile = profile.kind === "display" && startDate.year === endDate.year ? {
|
|
985
|
+
...profile,
|
|
986
|
+
dateFormat: {
|
|
987
|
+
...profile.dateFormat,
|
|
988
|
+
year: void 0
|
|
989
|
+
}
|
|
990
|
+
} : profile;
|
|
991
|
+
const start = presentRangeEndpoint(span.start, context, startProfile, labels.kind === "endpoints" ? labels.start : void 0);
|
|
992
|
+
const end = presentRangeEndpoint(span.end, context, profile, labels.kind === "endpoints" ? labels.end : void 0);
|
|
993
|
+
const separator = profile.kind === "sdk" ? "–" : " – ";
|
|
994
|
+
return profile.kind === "sdk" && start === end ? start : `${start}${separator}${end}`;
|
|
995
|
+
}
|
|
996
|
+
/** Offset changes override ordinary venue omission for the approved display profile. */
|
|
997
|
+
function decideRangeLabels(span, context, profile) {
|
|
998
|
+
if (profile.kind === "sdk") return { kind: "omit" };
|
|
999
|
+
const offsetsDiffer = offsetToken(span.start, context) !== offsetToken(span.end, context);
|
|
1000
|
+
if (!offsetsDiffer && profile.zone === "omit") return { kind: "omit" };
|
|
1001
|
+
const start = zoneLabel(span.start, context);
|
|
1002
|
+
const end = zoneLabel(span.end, context);
|
|
1003
|
+
return offsetsDiffer || start !== end ? {
|
|
1004
|
+
kind: "endpoints",
|
|
1005
|
+
start,
|
|
1006
|
+
end
|
|
1007
|
+
} : {
|
|
1008
|
+
kind: "shared",
|
|
1009
|
+
label: start
|
|
1010
|
+
};
|
|
1011
|
+
}
|
|
1012
|
+
function presentRangeEndpoint(value, context, profile, label) {
|
|
1013
|
+
return `${presentDate({
|
|
1014
|
+
kind: "instant",
|
|
1015
|
+
value
|
|
1016
|
+
}, context, profile)}, ${label === void 0 ? presentTime(value, context, profile) : `${presentClock(value, context, profile.clock)} ${label}`}`;
|
|
1017
|
+
}
|
|
1018
|
+
function presentNativeRange(span, context, format) {
|
|
1019
|
+
return formatIntlRange(getDateTimeFormatter(context.locale, context.timeZone, format), new Date(span.start), new Date(span.end));
|
|
1020
|
+
}
|
|
1021
|
+
function combinedFormat(date, clock) {
|
|
1022
|
+
return {
|
|
1023
|
+
...date,
|
|
1024
|
+
...clock.format
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
function displayProfile(options, zone, seconds) {
|
|
1028
|
+
return {
|
|
1029
|
+
kind: "display",
|
|
1030
|
+
dateFormat: dateFormat(options),
|
|
1031
|
+
clock: {
|
|
1032
|
+
kind: "compact",
|
|
1033
|
+
localeSource: "product",
|
|
1034
|
+
seconds
|
|
1035
|
+
},
|
|
1036
|
+
zone
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function dateCarrier(value) {
|
|
1040
|
+
return value.kind === "civil" ? civilCarrier(value.value) : new Date(value.value);
|
|
1041
|
+
}
|
|
1042
|
+
function presentClock(value, context, clock) {
|
|
1043
|
+
return clock.kind === "compact" ? formatBookingCompactEnglishTime({
|
|
1044
|
+
startsAt: value,
|
|
1045
|
+
timeZone: context.timeZone,
|
|
1046
|
+
locale: clock.localeSource === "product" ? "en-GB" : context.locale
|
|
1047
|
+
}, { seconds: clock.seconds }) : getDateTimeFormatter(context.locale, context.timeZone, clock.format).format(new Date(value));
|
|
1048
|
+
}
|
|
1049
|
+
function offsetToken(value, context) {
|
|
1050
|
+
return getDateTimeFormatter("en-GB", context.timeZone, { timeZoneName: "longOffset" }).formatToParts(new Date(value)).find((part) => part.type === "timeZoneName")?.value ?? "";
|
|
1051
|
+
}
|
|
1052
|
+
function dateFormat(options) {
|
|
1053
|
+
const style = options.date ?? "long";
|
|
1054
|
+
return {
|
|
1055
|
+
day: style === "omit" || options.day === "omit" ? void 0 : style === "numeric" ? "2-digit" : "numeric",
|
|
1056
|
+
month: style === "omit" ? void 0 : style === "numeric" ? "2-digit" : style,
|
|
1057
|
+
...options.year === "omit" ? {} : { year: "numeric" },
|
|
1058
|
+
...options.weekday ? { weekday: options.weekday } : {}
|
|
1059
|
+
};
|
|
1060
|
+
}
|
|
1061
|
+
function civilCarrier(value) {
|
|
1062
|
+
return new Date(Date.UTC(value.year, value.month - 1, value.day, 12));
|
|
1063
|
+
}
|
|
1064
|
+
function projectDate(value, context) {
|
|
1065
|
+
return value.kind === "civil" ? value.value : getLocalScheduleDate(new Date(value.value), context.timeZone);
|
|
1066
|
+
}
|
|
1067
|
+
function normalizeDisplay(value) {
|
|
1068
|
+
return value.replace(/[\u00a0\u202f]/gu, " ");
|
|
1069
|
+
}
|
|
1070
|
+
function zoneToken(value, context, locale) {
|
|
1071
|
+
return getDateTimeFormatter(locale, context.timeZone, { timeZoneName: "short" }).formatToParts(new Date(value)).find((part) => part.type === "timeZoneName")?.value ?? "";
|
|
1072
|
+
}
|
|
1073
|
+
function zoneLabel(value, context) {
|
|
1074
|
+
return [zoneToken(value, context, "en-GB"), zoneToken(value, context, "en-US")].find((token) => /^[A-Z]{2,6}$/u.test(token)) ?? formatTimeZoneCityLabel(context.timeZone);
|
|
1075
|
+
}
|
|
1076
|
+
function assertOrdered(start, end) {
|
|
1077
|
+
if (new Date(end).getTime() < new Date(start).getTime()) throw new RangeError("Date/time range end must be on or after its start");
|
|
1078
|
+
}
|
|
1079
|
+
/** Same city vocabulary as clock-label fallback, for explanatory timezone copy. */
|
|
1080
|
+
function formatTimeZoneCityLabel(timeZone) {
|
|
1081
|
+
return timeZone.startsWith("Etc/") ? "local time" : `${timeZone.split("/").slice(-1)[0]?.replace(/_/gu, " ") ?? timeZone} time`;
|
|
1082
|
+
}
|
|
876
1083
|
//#endregion
|
|
877
1084
|
//#region ../core/src/mailing-list-identifiers.ts
|
|
878
1085
|
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu;
|
|
@@ -1678,73 +1885,6 @@ const runtimeMediaSchema = z.union([
|
|
|
1678
1885
|
assetMediaSchema
|
|
1679
1886
|
]);
|
|
1680
1887
|
//#endregion
|
|
1681
|
-
//#region ../media-core/src/transformRect.ts
|
|
1682
|
-
function isValidTransformRectStructure(rect) {
|
|
1683
|
-
if (!Array.isArray(rect) || rect.length !== 4) return false;
|
|
1684
|
-
const [left, top, width, height] = rect;
|
|
1685
|
-
return Number.isFinite(left) && Number.isFinite(top) && Number.isFinite(width) && Number.isFinite(height) && left >= 0 && top >= 0 && width > 0 && height > 0;
|
|
1686
|
-
}
|
|
1687
|
-
//#endregion
|
|
1688
|
-
//#region ../media-core/src/aspectTransforms.ts
|
|
1689
|
-
const DEFAULT_RECT_EPSILON = .5;
|
|
1690
|
-
function parseAspectRatioValue(value) {
|
|
1691
|
-
if (typeof value === "number") return Number.isFinite(value) && value > 0 ? value : void 0;
|
|
1692
|
-
if (typeof value !== "string") return void 0;
|
|
1693
|
-
const normalized = value.trim();
|
|
1694
|
-
if (!normalized) return void 0;
|
|
1695
|
-
if (normalized === "auto") return void 0;
|
|
1696
|
-
if (normalized.includes(":") || normalized.includes("/")) {
|
|
1697
|
-
const delimiter = normalized.includes(":") ? ":" : "/";
|
|
1698
|
-
const [wRaw, hRaw] = normalized.split(delimiter);
|
|
1699
|
-
const width = Number(wRaw?.trim());
|
|
1700
|
-
const height = Number(hRaw?.trim());
|
|
1701
|
-
if (!Number.isFinite(width) || !Number.isFinite(height) || width <= 0 || height <= 0) return;
|
|
1702
|
-
return width / height;
|
|
1703
|
-
}
|
|
1704
|
-
const numeric = Number(normalized);
|
|
1705
|
-
if (!Number.isFinite(numeric) || numeric <= 0) return void 0;
|
|
1706
|
-
return numeric;
|
|
1707
|
-
}
|
|
1708
|
-
const MAX_ASPECT_DISTANCE = .25;
|
|
1709
|
-
function resolveMediaTransformForAspect(transform, targetAspect) {
|
|
1710
|
-
if (!transform) return {};
|
|
1711
|
-
const base = {
|
|
1712
|
-
rect: transform.rect,
|
|
1713
|
-
hotspot: transform.hotspot,
|
|
1714
|
-
rotation: transform.rotation
|
|
1715
|
-
};
|
|
1716
|
-
const target = parseAspectRatioValue(targetAspect);
|
|
1717
|
-
const crops = transform.aspectCrops;
|
|
1718
|
-
if (!target || !crops || Object.keys(crops).length === 0) return base;
|
|
1719
|
-
let best = null;
|
|
1720
|
-
let bestDistance = Number.POSITIVE_INFINITY;
|
|
1721
|
-
for (const [key, candidate] of Object.entries(crops)) {
|
|
1722
|
-
const candidateAspect = parseAspectRatioValue(candidate.aspect ?? key);
|
|
1723
|
-
if (!candidateAspect) continue;
|
|
1724
|
-
const distance = Math.abs(Math.log(candidateAspect / target));
|
|
1725
|
-
if (distance < bestDistance) {
|
|
1726
|
-
best = candidate;
|
|
1727
|
-
bestDistance = distance;
|
|
1728
|
-
}
|
|
1729
|
-
}
|
|
1730
|
-
if (!best) return base;
|
|
1731
|
-
if (bestDistance > MAX_ASPECT_DISTANCE) return base;
|
|
1732
|
-
return {
|
|
1733
|
-
rect: best.rect ?? base.rect,
|
|
1734
|
-
hotspot: best.hotspot ?? base.hotspot,
|
|
1735
|
-
rotation: best.rotation ?? base.rotation
|
|
1736
|
-
};
|
|
1737
|
-
}
|
|
1738
|
-
function isValidTransformRect(rect) {
|
|
1739
|
-
return isValidTransformRectStructure(rect);
|
|
1740
|
-
}
|
|
1741
|
-
function isExplicitRectCrop(rect, sourceWidth, sourceHeight, epsilon = DEFAULT_RECT_EPSILON) {
|
|
1742
|
-
if (!isValidTransformRect(rect)) return false;
|
|
1743
|
-
if (!(typeof sourceWidth === "number" && Number.isFinite(sourceWidth) && sourceWidth > 0 && typeof sourceHeight === "number" && Number.isFinite(sourceHeight) && sourceHeight > 0)) return true;
|
|
1744
|
-
const [x, y, width, height] = rect;
|
|
1745
|
-
return !(Math.abs(x) <= epsilon && Math.abs(y) <= epsilon && Math.abs(width - sourceWidth) <= epsilon && Math.abs(height - sourceHeight) <= epsilon);
|
|
1746
|
-
}
|
|
1747
|
-
//#endregion
|
|
1748
1888
|
//#region ../commerce/src/utils/assertNever.ts
|
|
1749
1889
|
function assertNever$3(value, message) {
|
|
1750
1890
|
if (message) throw new Error(message);
|
|
@@ -10646,9 +10786,6 @@ function presetCategory(recipe) {
|
|
|
10646
10786
|
}
|
|
10647
10787
|
}
|
|
10648
10788
|
//#endregion
|
|
10649
|
-
//#region ../blocks/src/system/icons/presets.ts
|
|
10650
|
-
const ICON_PICKER_PRESETS = ["cta", "feature"];
|
|
10651
|
-
//#endregion
|
|
10652
10789
|
//#region ../calendar/src/grid.ts
|
|
10653
10790
|
const DAY_NAMES = [
|
|
10654
10791
|
"Sun",
|
|
@@ -22867,10 +23004,7 @@ const publicEventSchema = z.union([publicEventBaseSchema.extend({
|
|
|
22867
23004
|
bookingScope: z.literal("whole_series"),
|
|
22868
23005
|
run: publicWholeSeriesRunSchema
|
|
22869
23006
|
})]);
|
|
22870
|
-
|
|
22871
|
-
* Schema for an array of public events
|
|
22872
|
-
*/
|
|
22873
|
-
const publicEventsArraySchema = z.array(publicEventSchema);
|
|
23007
|
+
z.array(publicEventSchema);
|
|
22874
23008
|
//#endregion
|
|
22875
23009
|
//#region ../blocks/src/system/blocks/events/shared/runGrouping.ts
|
|
22876
23010
|
function isWholeSeriesPublicEvent(event) {
|
|
@@ -24313,2645 +24447,292 @@ const publicMembershipProductSchema = z.discriminatedUnion("purchaseAvailability
|
|
|
24313
24447
|
})]);
|
|
24314
24448
|
const publicMembershipProductCollectionSchema = z.object({ memberships: z.array(publicMembershipProductSchema) });
|
|
24315
24449
|
//#endregion
|
|
24316
|
-
//#region ../blocks/src/system/
|
|
24317
|
-
const
|
|
24318
|
-
|
|
24319
|
-
|
|
24320
|
-
|
|
24321
|
-
|
|
24322
|
-
|
|
24323
|
-
|
|
24324
|
-
|
|
24325
|
-
|
|
24326
|
-
|
|
24327
|
-
|
|
24328
|
-
|
|
24329
|
-
|
|
24330
|
-
|
|
24331
|
-
|
|
24332
|
-
|
|
24333
|
-
|
|
24334
|
-
|
|
24335
|
-
|
|
24450
|
+
//#region ../blocks/src/system/runtime/api/schemas/events.ts
|
|
24451
|
+
const uuid = z.string().uuid();
|
|
24452
|
+
const eventRegistrationStatusReferenceSchema = z.discriminatedUnion("scope", [z.object({
|
|
24453
|
+
scope: z.literal("occurrence"),
|
|
24454
|
+
attendeeId: uuid
|
|
24455
|
+
}).strict(), z.object({
|
|
24456
|
+
scope: z.literal("wholeSeries"),
|
|
24457
|
+
registrationId: uuid
|
|
24458
|
+
}).strict()]);
|
|
24459
|
+
const eventRegistrationPaymentSubjectSchema = z.discriminatedUnion("scope", [z.object({
|
|
24460
|
+
scope: z.literal("occurrence"),
|
|
24461
|
+
submissionId: uuid,
|
|
24462
|
+
attendeeId: uuid
|
|
24463
|
+
}).strict(), z.object({
|
|
24464
|
+
scope: z.literal("wholeSeries"),
|
|
24465
|
+
submissionId: uuid
|
|
24466
|
+
}).strict()]);
|
|
24467
|
+
const identityFields = {
|
|
24468
|
+
submissionId: uuid,
|
|
24469
|
+
seriesId: uuid,
|
|
24470
|
+
attendanceMode: z.enum(["in_person", "online"])
|
|
24471
|
+
};
|
|
24472
|
+
const confirmedBookingIdentitySchema = z.discriminatedUnion("scope", [z.object({
|
|
24473
|
+
scope: z.literal("occurrence"),
|
|
24474
|
+
attendeeId: uuid,
|
|
24475
|
+
occurrenceId: uuid,
|
|
24476
|
+
...identityFields
|
|
24477
|
+
}).strict(), z.object({
|
|
24478
|
+
scope: z.literal("wholeSeries"),
|
|
24479
|
+
registrationId: uuid,
|
|
24480
|
+
...identityFields
|
|
24481
|
+
}).strict()]);
|
|
24482
|
+
const bookedTicketLineSchema = z.object({
|
|
24483
|
+
label: z.string().min(1),
|
|
24484
|
+
quantity: z.number().int().positive()
|
|
24485
|
+
}).strict();
|
|
24486
|
+
const eventBookingOutcomeSchema = z.discriminatedUnion("kind", [z.object({
|
|
24487
|
+
kind: z.literal("detailsAvailable"),
|
|
24488
|
+
identity: confirmedBookingIdentitySchema,
|
|
24489
|
+
ticketLines: z.tuple([bookedTicketLineSchema]).rest(bookedTicketLineSchema).readonly(),
|
|
24490
|
+
payment: confirmationPaymentSchema
|
|
24491
|
+
}).strict(), z.object({
|
|
24492
|
+
kind: z.literal("detailsUnavailable"),
|
|
24493
|
+
identity: confirmedBookingIdentitySchema
|
|
24494
|
+
}).strict()]);
|
|
24495
|
+
const eventEmbeddedCheckoutSchema = z.object({
|
|
24496
|
+
kind: z.literal("embedded"),
|
|
24497
|
+
sessionId: z.string().min(1),
|
|
24498
|
+
clientSecret: z.string().min(1),
|
|
24499
|
+
livemode: z.boolean(),
|
|
24500
|
+
expiresAt: z.string().datetime({ offset: true }),
|
|
24501
|
+
browser: z.discriminatedUnion("kind", [z.object({
|
|
24502
|
+
kind: z.literal("connect"),
|
|
24503
|
+
publishableKey: z.string().min(1),
|
|
24504
|
+
accountId: z.string().min(1)
|
|
24505
|
+
}).strict(), z.object({
|
|
24506
|
+
kind: z.literal("direct"),
|
|
24507
|
+
publishableKey: z.string().min(1)
|
|
24508
|
+
}).strict()])
|
|
24509
|
+
}).strict();
|
|
24510
|
+
const decorations = {
|
|
24511
|
+
mailingListSignupNote: z.enum(["confirmation_required", "not_confirmed"]).optional(),
|
|
24512
|
+
demoBookingPass: z.string().optional()
|
|
24513
|
+
};
|
|
24514
|
+
const eventRegistrationSummarySchema = z.object({
|
|
24515
|
+
message: z.string(),
|
|
24516
|
+
passCreditsRemaining: z.number().int().nonnegative().optional()
|
|
24517
|
+
}).strict();
|
|
24518
|
+
const eventRegisterResponseSchema = z.discriminatedUnion("kind", [
|
|
24519
|
+
z.object({
|
|
24520
|
+
kind: z.literal("bookingComplete"),
|
|
24521
|
+
outcome: eventBookingOutcomeSchema,
|
|
24522
|
+
summary: eventRegistrationSummarySchema,
|
|
24523
|
+
...decorations
|
|
24524
|
+
}).strict(),
|
|
24525
|
+
z.object({
|
|
24526
|
+
kind: z.literal("checkoutRequired"),
|
|
24527
|
+
reference: eventRegistrationStatusReferenceSchema,
|
|
24528
|
+
checkout: eventEmbeddedCheckoutSchema,
|
|
24529
|
+
submissionId: uuid,
|
|
24530
|
+
...decorations
|
|
24531
|
+
}).strict(),
|
|
24532
|
+
z.object({
|
|
24533
|
+
kind: z.literal("paymentStatusRequired"),
|
|
24534
|
+
subject: eventRegistrationPaymentSubjectSchema,
|
|
24535
|
+
...decorations
|
|
24536
|
+
}).strict(),
|
|
24537
|
+
z.object({
|
|
24538
|
+
kind: z.literal("waitlisted"),
|
|
24539
|
+
waitlist: z.object({
|
|
24540
|
+
reference: z.union([z.object({
|
|
24541
|
+
scope: z.literal("occurrence"),
|
|
24542
|
+
attendeeId: uuid
|
|
24543
|
+
}).strict(), z.object({
|
|
24544
|
+
scope: z.enum(["occurrence", "wholeSeries"]),
|
|
24545
|
+
waitlistEntryId: uuid
|
|
24546
|
+
}).strict()]),
|
|
24547
|
+
position: z.number().int().nonnegative().nullable(),
|
|
24548
|
+
message: z.string(),
|
|
24549
|
+
emailFollowupMessage: z.string().optional()
|
|
24550
|
+
}).strict(),
|
|
24551
|
+
...decorations
|
|
24552
|
+
}).strict()
|
|
24553
|
+
]);
|
|
24554
|
+
const checkoutStatusArms = [
|
|
24555
|
+
z.object({
|
|
24556
|
+
kind: z.literal("resolved"),
|
|
24557
|
+
outcome: eventBookingOutcomeSchema
|
|
24558
|
+
}).strict(),
|
|
24559
|
+
z.object({ kind: z.literal("abandoned") }).strict(),
|
|
24560
|
+
z.object({ kind: z.literal("reconciliationRequired") }).strict(),
|
|
24561
|
+
z.object({
|
|
24562
|
+
kind: z.literal("paymentProcessing"),
|
|
24563
|
+
recoverableUntil: z.string().optional()
|
|
24564
|
+
}).strict(),
|
|
24565
|
+
z.object({
|
|
24566
|
+
kind: z.literal("paymentAvailable"),
|
|
24567
|
+
checkout: eventEmbeddedCheckoutSchema,
|
|
24568
|
+
recoverableUntil: z.string().optional()
|
|
24569
|
+
}).strict(),
|
|
24570
|
+
z.object({
|
|
24571
|
+
kind: z.literal("paymentRetryAvailable"),
|
|
24572
|
+
place: z.enum(["held", "released"])
|
|
24573
|
+
}).strict(),
|
|
24574
|
+
z.object({
|
|
24575
|
+
kind: z.literal("paymentCheckUnavailable"),
|
|
24576
|
+
recoverableUntil: z.string().optional()
|
|
24577
|
+
}).strict(),
|
|
24578
|
+
z.object({ kind: z.literal("paymentAssistanceRequired") }).strict()
|
|
24579
|
+
];
|
|
24580
|
+
z.discriminatedUnion("kind", [...checkoutStatusArms, z.object({ kind: z.literal("notFound") }).strict()]);
|
|
24581
|
+
const eventCheckoutReturnResponseSchema = z.discriminatedUnion("kind", [
|
|
24582
|
+
z.object({
|
|
24583
|
+
kind: z.literal("checkout"),
|
|
24584
|
+
subject: eventRegistrationPaymentSubjectSchema,
|
|
24585
|
+
outcome: z.discriminatedUnion("kind", checkoutStatusArms)
|
|
24586
|
+
}).strict(),
|
|
24587
|
+
z.object({ kind: z.literal("notFound") }).strict(),
|
|
24588
|
+
z.object({ kind: z.literal("reconciliationRequired") }).strict()
|
|
24589
|
+
]).superRefine((response, ctx) => {
|
|
24590
|
+
if (response.kind !== "checkout" || response.outcome.kind !== "resolved") return;
|
|
24591
|
+
const identity = response.outcome.outcome.identity;
|
|
24592
|
+
if (identity.scope !== response.subject.scope || identity.submissionId !== response.subject.submissionId || identity.scope === "occurrence" && response.subject.scope === "occurrence" && identity.attendeeId !== response.subject.attendeeId) ctx.addIssue({
|
|
24593
|
+
code: "custom",
|
|
24594
|
+
message: "Confirmed booking does not match checkout subject",
|
|
24595
|
+
path: ["outcome"]
|
|
24596
|
+
});
|
|
24336
24597
|
});
|
|
24337
|
-
const
|
|
24338
|
-
|
|
24339
|
-
|
|
24340
|
-
|
|
24341
|
-
|
|
24342
|
-
|
|
24343
|
-
|
|
24344
|
-
|
|
24345
|
-
|
|
24598
|
+
const checkoutDecorations = { mailingListSignupNote: decorations.mailingListSignupNote };
|
|
24599
|
+
const eventCheckoutResponseSchema = z.union([
|
|
24600
|
+
z.object({
|
|
24601
|
+
kind: z.literal("completed"),
|
|
24602
|
+
scope: z.literal("occurrence"),
|
|
24603
|
+
outcome: eventBookingOutcomeSchema,
|
|
24604
|
+
...checkoutDecorations
|
|
24605
|
+
}).strict(),
|
|
24606
|
+
z.object({
|
|
24607
|
+
kind: z.literal("completed"),
|
|
24608
|
+
scope: z.literal("wholeSeries"),
|
|
24609
|
+
outcome: eventBookingOutcomeSchema,
|
|
24610
|
+
...checkoutDecorations
|
|
24611
|
+
}).strict(),
|
|
24612
|
+
z.object({
|
|
24613
|
+
kind: z.literal("checkoutRequired"),
|
|
24614
|
+
scope: z.literal("occurrence"),
|
|
24615
|
+
attendeeId: uuid,
|
|
24616
|
+
checkout: eventEmbeddedCheckoutSchema,
|
|
24617
|
+
...checkoutDecorations
|
|
24618
|
+
}).strict(),
|
|
24619
|
+
z.object({
|
|
24620
|
+
kind: z.literal("checkoutRequired"),
|
|
24621
|
+
scope: z.literal("wholeSeries"),
|
|
24622
|
+
registrationId: uuid,
|
|
24623
|
+
checkoutAttemptId: uuid,
|
|
24624
|
+
checkout: eventEmbeddedCheckoutSchema,
|
|
24625
|
+
recoverableUntil: z.string().optional(),
|
|
24626
|
+
...checkoutDecorations
|
|
24627
|
+
}).strict(),
|
|
24628
|
+
z.object({
|
|
24629
|
+
scope: z.literal("wholeSeries"),
|
|
24630
|
+
status: z.literal("paymentStatusRequired"),
|
|
24631
|
+
checkoutAttemptId: uuid,
|
|
24632
|
+
recoverableUntil: z.string().optional(),
|
|
24633
|
+
...checkoutDecorations
|
|
24634
|
+
}).strict(),
|
|
24635
|
+
z.object({
|
|
24636
|
+
scope: z.literal("wholeSeries"),
|
|
24637
|
+
status: z.literal("waitlist"),
|
|
24638
|
+
waitlistEntryId: uuid,
|
|
24639
|
+
waitlistPosition: z.number().int().nonnegative().nullable(),
|
|
24640
|
+
alreadyRegistered: z.boolean().optional(),
|
|
24641
|
+
...checkoutDecorations
|
|
24642
|
+
}).strict()
|
|
24643
|
+
]).superRefine((response, ctx) => {
|
|
24644
|
+
if ("kind" in response && response.kind === "completed" && response.scope !== response.outcome.identity.scope) ctx.addIssue({
|
|
24645
|
+
code: "custom",
|
|
24646
|
+
message: "Confirmed booking scope mismatch",
|
|
24647
|
+
path: [
|
|
24648
|
+
"outcome",
|
|
24649
|
+
"identity",
|
|
24650
|
+
"scope"
|
|
24651
|
+
]
|
|
24652
|
+
});
|
|
24653
|
+
});
|
|
24654
|
+
//#endregion
|
|
24655
|
+
//#region ../blocks/src/contracts/events.ts
|
|
24656
|
+
const eventAutoApplyDiscountPreviewBaseSchema = z.object({
|
|
24657
|
+
id: z.string(),
|
|
24658
|
+
publicLabel: z.string(),
|
|
24659
|
+
description: z.string().nullable(),
|
|
24660
|
+
minTicketsRequired: z.number().nullable()
|
|
24346
24661
|
});
|
|
24347
|
-
const
|
|
24348
|
-
|
|
24349
|
-
|
|
24662
|
+
const eventAutoApplyDiscountPreviewSchema = z.discriminatedUnion("discountType", [eventAutoApplyDiscountPreviewBaseSchema.extend({
|
|
24663
|
+
discountType: z.literal("percent"),
|
|
24664
|
+
discountPercent: z.number(),
|
|
24665
|
+
discountAmountCents: z.null()
|
|
24666
|
+
}), eventAutoApplyDiscountPreviewBaseSchema.extend({
|
|
24667
|
+
discountType: z.literal("fixed"),
|
|
24668
|
+
discountPercent: z.null(),
|
|
24669
|
+
discountAmountCents: z.number()
|
|
24350
24670
|
})]);
|
|
24351
|
-
const
|
|
24352
|
-
|
|
24353
|
-
|
|
24354
|
-
|
|
24355
|
-
|
|
24671
|
+
const unsupportedEventRegistrationPageSurfaceSubjectSchema = z.object({
|
|
24672
|
+
kind: z.literal("unsupported"),
|
|
24673
|
+
reason: z.enum([
|
|
24674
|
+
"unsupportedSubject",
|
|
24675
|
+
"invalidEventSeriesId",
|
|
24676
|
+
"invalidEventSeriesBookingScope",
|
|
24677
|
+
"invalidEventOfferingId",
|
|
24678
|
+
"invalidEventOfferingBookingScope",
|
|
24679
|
+
"invalidEventOfferingCatalogue"
|
|
24680
|
+
])
|
|
24356
24681
|
});
|
|
24357
|
-
const
|
|
24358
|
-
|
|
24359
|
-
|
|
24360
|
-
|
|
24361
|
-
|
|
24362
|
-
|
|
24363
|
-
|
|
24364
|
-
|
|
24365
|
-
props: nodePropsSchema.optional(),
|
|
24366
|
-
children: z.lazy(() => nodeSchema.array().default([])).optional(),
|
|
24367
|
-
$bind: bindingSchema.optional(),
|
|
24368
|
-
$repeat: repeatSchema.optional(),
|
|
24369
|
-
$when: conditionSchema.optional(),
|
|
24370
|
-
$scopes: dataScopeSchema.array().optional()
|
|
24371
|
-
});
|
|
24372
|
-
const nodeTreeSchema = nodeSchema.array().or(nodeSchema);
|
|
24373
|
-
const NodeSchema = nodeSchema;
|
|
24374
|
-
const NodeTreeSchema = nodeTreeSchema;
|
|
24375
|
-
//#endregion
|
|
24376
|
-
//#region ../blocks/src/utils/env.ts
|
|
24377
|
-
/**
|
|
24378
|
-
* Environment detection utilities
|
|
24379
|
-
*
|
|
24380
|
-
* Provides type-safe environment detection without relying on `any`-typed globals.
|
|
24381
|
-
*/
|
|
24382
|
-
/**
|
|
24383
|
-
* Check if the current environment is development.
|
|
24384
|
-
*
|
|
24385
|
-
* Returns true if NODE_ENV is not 'production', or if NODE_ENV cannot be determined
|
|
24386
|
-
* (which is the safe default for validation and warnings).
|
|
24387
|
-
*
|
|
24388
|
-
* @returns true if in development mode, false if in production
|
|
24389
|
-
*/
|
|
24390
|
-
function isDevEnvironment() {
|
|
24391
|
-
try {
|
|
24392
|
-
if (typeof process !== "undefined" && true) return true;
|
|
24393
|
-
return true;
|
|
24394
|
-
} catch {
|
|
24395
|
-
return true;
|
|
24396
|
-
}
|
|
24397
|
-
}
|
|
24398
|
-
//#endregion
|
|
24399
|
-
//#region ../blocks/src/system/node/types.ts
|
|
24400
|
-
/**
|
|
24401
|
-
* List of reserved keys (for runtime validation).
|
|
24402
|
-
* Kept in sync with the ReservedNodeKeys type above.
|
|
24403
|
-
*/
|
|
24404
|
-
const RESERVED_KEYS = [
|
|
24405
|
-
"children",
|
|
24406
|
-
"key",
|
|
24407
|
-
"$bind",
|
|
24408
|
-
"$when",
|
|
24409
|
-
"$repeat",
|
|
24410
|
-
"$scopes"
|
|
24411
|
-
];
|
|
24412
|
-
/**
|
|
24413
|
-
* Type guard to check if props contain reserved keys at runtime.
|
|
24414
|
-
* Use this in development mode to catch bugs early.
|
|
24415
|
-
*
|
|
24416
|
-
* @param props - Props object to validate
|
|
24417
|
-
* @returns Array of reserved keys found in props, or empty array if none
|
|
24418
|
-
*/
|
|
24419
|
-
function findReservedKeysInProps(props) {
|
|
24420
|
-
if (!props) return [];
|
|
24421
|
-
return RESERVED_KEYS.filter((key) => key in props);
|
|
24422
|
-
}
|
|
24423
|
-
/**
|
|
24424
|
-
* Validates that props don't contain reserved keys.
|
|
24425
|
-
* Throws in development, warns in production.
|
|
24426
|
-
*
|
|
24427
|
-
* @param props - Props to validate
|
|
24428
|
-
* @param context - Context for error message (e.g., "el('grid', ...)")
|
|
24429
|
-
*/
|
|
24430
|
-
function validateProps(props, context = "node builder") {
|
|
24431
|
-
const reserved = findReservedKeysInProps(props);
|
|
24432
|
-
if (reserved.length === 0) return;
|
|
24433
|
-
const message = `[blocks:${context}] Reserved keys found in props: ${reserved.join(", ")}. These should be passed as separate parameters or modifiers, not in props. For example, 'children' should be the 3rd parameter to el(), not in the props object.`;
|
|
24434
|
-
if (isDevEnvironment()) throw new TypeError(message);
|
|
24435
|
-
else console.error(message);
|
|
24436
|
-
}
|
|
24437
|
-
//#endregion
|
|
24438
|
-
//#region ../blocks/src/system/node/builder.ts
|
|
24439
|
-
function normalizeChildren(children) {
|
|
24440
|
-
if (!children) return void 0;
|
|
24441
|
-
const flat = children.flat().filter(Boolean);
|
|
24442
|
-
return flat.length > 0 ? flat : void 0;
|
|
24443
|
-
}
|
|
24444
|
-
function el(type, props, children, ...mods) {
|
|
24445
|
-
validateProps(props, `el('${type}', ...)`);
|
|
24446
|
-
const node = {
|
|
24447
|
-
type,
|
|
24448
|
-
...props && Object.keys(props).length > 0 ? { props } : {},
|
|
24449
|
-
...children && children.length ? { children: normalizeChildren(children) } : {}
|
|
24450
|
-
};
|
|
24451
|
-
if (mods && mods.length > 0) {
|
|
24452
|
-
const validMods = mods.filter((mod) => typeof mod === "function");
|
|
24453
|
-
if (validMods.length > 0) return devValidate(validMods.reduce((acc, fn) => fn(acc), node));
|
|
24454
|
-
}
|
|
24455
|
-
return devValidate(node);
|
|
24456
|
-
}
|
|
24457
|
-
const section = (props, children, ...mods) => el("section", props, children, ...mods);
|
|
24458
|
-
const stack = (props, children, ...mods) => el("stack", props, children, ...mods);
|
|
24459
|
-
const text = (props, ...mods) => el("text", props, void 0, ...mods);
|
|
24460
|
-
const media = (props, ...mods) => el("media", props, void 0, ...mods);
|
|
24461
|
-
function bind(from, options) {
|
|
24462
|
-
return (node) => ({
|
|
24463
|
-
...node,
|
|
24464
|
-
$bind: {
|
|
24465
|
-
from,
|
|
24466
|
-
...options?.fallback !== void 0 ? { fallback: options.fallback } : {},
|
|
24467
|
-
...options?.transforms ? { transforms: options.transforms } : {},
|
|
24468
|
-
...options?.pick ? { pick: options.pick } : {},
|
|
24469
|
-
...options?.coerce ? { coerce: options.coerce } : {}
|
|
24470
|
-
}
|
|
24471
|
-
});
|
|
24472
|
-
}
|
|
24473
|
-
function when(path, options) {
|
|
24474
|
-
return (node) => ({
|
|
24475
|
-
...node,
|
|
24476
|
-
$when: {
|
|
24477
|
-
when: { from: path },
|
|
24478
|
-
...options?.equals !== void 0 ? { equals: options.equals } : {},
|
|
24479
|
-
...options?.not ? { not: true } : {},
|
|
24480
|
-
...options?.authoringPresence ? { authoringPresence: options.authoringPresence } : {}
|
|
24481
|
-
}
|
|
24682
|
+
const eventRegistrationPageSurfaceSubjectSchema = z.unknown().transform((value, ctx) => {
|
|
24683
|
+
const unsupported = unsupportedEventRegistrationPageSurfaceSubjectSchema.safeParse(value);
|
|
24684
|
+
if (unsupported.success) return unsupported.data;
|
|
24685
|
+
const parsed = parseEventPageSurfaceSubject(value);
|
|
24686
|
+
if (parsed.ok) return parsed.value;
|
|
24687
|
+
ctx.addIssue({
|
|
24688
|
+
code: z.ZodIssueCode.custom,
|
|
24689
|
+
message: `Invalid event page-surface subject (${parsed.error.kind})`
|
|
24482
24690
|
});
|
|
24691
|
+
return z.NEVER;
|
|
24692
|
+
});
|
|
24693
|
+
function resolveEventRegistrationScope(context) {
|
|
24694
|
+
const occurrenceSeriesId = context.occurrenceContext?.seriesId;
|
|
24695
|
+
if (occurrenceSeriesId) return {
|
|
24696
|
+
kind: "occurrenceSeries",
|
|
24697
|
+
seriesId: occurrenceSeriesId
|
|
24698
|
+
};
|
|
24699
|
+
if (context.subject?.kind === "eventSeries") return {
|
|
24700
|
+
kind: "pageSurfaceSeries",
|
|
24701
|
+
seriesId: context.subject.eventSeriesId
|
|
24702
|
+
};
|
|
24703
|
+
if (context.subject?.kind === "eventOffering") return {
|
|
24704
|
+
kind: "pageSurfaceOffering",
|
|
24705
|
+
offeringId: context.subject.eventOfferingId,
|
|
24706
|
+
seriesIds: context.subject.catalogueEventSeriesIds
|
|
24707
|
+
};
|
|
24708
|
+
if (context.subject?.kind === "unsupported") return {
|
|
24709
|
+
kind: "unsupportedPageSurfaceSubject",
|
|
24710
|
+
reason: context.subject.reason
|
|
24711
|
+
};
|
|
24712
|
+
return { kind: "unscoped" };
|
|
24483
24713
|
}
|
|
24484
|
-
function
|
|
24485
|
-
|
|
24486
|
-
|
|
24487
|
-
|
|
24488
|
-
|
|
24714
|
+
function resolveEventRegistrationScopedEvents(events, context) {
|
|
24715
|
+
const scope = resolveEventRegistrationScope(context);
|
|
24716
|
+
switch (scope.kind) {
|
|
24717
|
+
case "occurrenceSeries":
|
|
24718
|
+
case "pageSurfaceSeries": return events.filter((event) => event.seriesId === scope.seriesId);
|
|
24719
|
+
case "pageSurfaceOffering": {
|
|
24720
|
+
const seriesIds = new Set(scope.seriesIds);
|
|
24721
|
+
return events.filter((event) => seriesIds.has(event.seriesId));
|
|
24489
24722
|
}
|
|
24490
|
-
|
|
24491
|
-
|
|
24492
|
-
}
|
|
24493
|
-
//#endregion
|
|
24494
|
-
//#region ../blocks/src/system/transforms/registry/core.ts
|
|
24495
|
-
/**
|
|
24496
|
-
* Safely narrows unknown values to partial object shapes used by transforms.
|
|
24497
|
-
* Arrays are intentionally excluded.
|
|
24498
|
-
*/
|
|
24499
|
-
function asPartialObject(value) {
|
|
24500
|
-
if (typeof value !== "object" || value === null || Array.isArray(value)) return;
|
|
24501
|
-
return value;
|
|
24723
|
+
case "unsupportedPageSurfaceSubject": return [];
|
|
24724
|
+
case "unscoped": return [...events];
|
|
24725
|
+
}
|
|
24502
24726
|
}
|
|
24503
24727
|
//#endregion
|
|
24504
|
-
//#region ../blocks/src/system/
|
|
24505
|
-
|
|
24506
|
-
const
|
|
24507
|
-
|
|
24508
|
-
|
|
24509
|
-
|
|
24510
|
-
|
|
24511
|
-
|
|
24512
|
-
} } } : { "data-slot": { $bind: { from: `content._lookSlots.${name}` } } };
|
|
24513
|
-
z.object({ fallback: z.string().trim().min(1) });
|
|
24514
|
-
//#endregion
|
|
24515
|
-
//#region ../blocks/src/system/node/fragments/backgroundLayer.ts
|
|
24516
|
-
const BACKGROUND_FRAME_BASE_CLASS = "rb-background-frame rb-absolute rb-inset-0 rb-z-neg-10 rb-h-full rb-w-full rb-isolate rb-pointer-events-none";
|
|
24517
|
-
/**
|
|
24518
|
-
* Creates background layer nodes for rendering backgrounds from field data.
|
|
24519
|
-
*
|
|
24520
|
-
* This helper generates three nodes:
|
|
24521
|
-
* 1. A style layer (div) that renders solid colors and gradients
|
|
24522
|
-
* 2. A media layer that conditionally renders background images/videos
|
|
24523
|
-
* 3. An overlay layer (div) that renders color/gradient overlays on images
|
|
24524
|
-
*
|
|
24525
|
-
* The layers are designed to be placed behind content (z-index -10) and work
|
|
24526
|
-
* with data from `sectionStylesField`, `containerStylesField`, or `cardStylesField`.
|
|
24527
|
-
*
|
|
24528
|
-
* Layer stacking order (all use -z-10, stacking determined by DOM order):
|
|
24529
|
-
* - Content (default z-index, rendered last)
|
|
24530
|
-
* - Overlay layer (rendered third, above image due to DOM order)
|
|
24531
|
-
* - Image layer (rendered second)
|
|
24532
|
-
* - Style layer (rendered first, at bottom)
|
|
24533
|
-
*
|
|
24534
|
-
* @param path - The data path to the background field (e.g., '_sectionStyles.background')
|
|
24535
|
-
* @param options - Optional customization for layer appearance
|
|
24536
|
-
* @returns Array of NodeDefinition objects in paint order: style, optional image, overlay
|
|
24537
|
-
*
|
|
24538
|
-
* @example
|
|
24539
|
-
* // Basic usage in a block
|
|
24540
|
-
* const heroBackgroundNodes = backgroundLayer('_sectionStyles.background')
|
|
24541
|
-
*
|
|
24542
|
-
* @example
|
|
24543
|
-
* // Custom styling
|
|
24544
|
-
* const customBackgroundNodes = backgroundLayer('_sectionStyles.background', {
|
|
24545
|
-
* imageClassName: 'rb-absolute rb-inset-0 rb-z-neg-10 rb-h-full rb-w-full rb-object-cover rb-opacity-30'
|
|
24546
|
-
* })
|
|
24547
|
-
*
|
|
24548
|
-
* @example
|
|
24549
|
-
* // In a block layout
|
|
24550
|
-
* const layout = section(
|
|
24551
|
-
* { background: 'background' },
|
|
24552
|
-
* [
|
|
24553
|
-
* ...backgroundLayer('_sectionStyles.background'),
|
|
24554
|
-
* sectionContainer([])
|
|
24555
|
-
* ]
|
|
24556
|
-
* )
|
|
24557
|
-
*/
|
|
24558
|
-
function backgroundLayer(path, options = {}) {
|
|
24559
|
-
const { styleClassName = "background-style rb-absolute rb-inset-0 rb-z-neg-10 rb-h-full rb-w-full rb-pointer-events-none", imageClassName, overlayClassName = "background-overlay rb-absolute rb-inset-0 rb-z-neg-10 rb-h-full rb-w-full rb-pointer-events-none", fallbackToken, omitImageLayer = false, imageLoading, imageFetchPriority, imageSlot } = options;
|
|
24560
|
-
const styleLayer = el("div", {
|
|
24561
|
-
className: styleClassName,
|
|
24562
|
-
style: { $bind: {
|
|
24563
|
-
from: path,
|
|
24564
|
-
transforms: [{
|
|
24565
|
-
id: "background.resolveStyle",
|
|
24566
|
-
...typeof fallbackToken === "string" && fallbackToken.trim().length > 0 ? { options: { fallbackToken: fallbackToken.trim() } } : {}
|
|
24567
|
-
}]
|
|
24568
|
-
} }
|
|
24569
|
-
});
|
|
24570
|
-
const imageLayer = createBackgroundImageNode(path, imageClassName, {
|
|
24571
|
-
loading: imageLoading,
|
|
24572
|
-
fetchPriority: imageFetchPriority,
|
|
24573
|
-
slot: imageSlot
|
|
24574
|
-
});
|
|
24575
|
-
const overlayLayer = createBackgroundOverlayNode(path, overlayClassName);
|
|
24576
|
-
return omitImageLayer ? [styleLayer, overlayLayer] : [
|
|
24577
|
-
styleLayer,
|
|
24578
|
-
imageLayer,
|
|
24579
|
-
overlayLayer
|
|
24580
|
-
];
|
|
24581
|
-
}
|
|
24582
|
-
/**
|
|
24583
|
-
* Wrap decorative background layers in their own clipping frame.
|
|
24584
|
-
*
|
|
24585
|
-
* Foreground content remains outside this frame, so editor outlines, focus
|
|
24586
|
-
* rings, and floating controls are never clipped by a visual background.
|
|
24587
|
-
* Backgrounds that explicitly opt into overflow keep that behavior within
|
|
24588
|
-
* the decorative layer rather than changing the content root.
|
|
24589
|
-
*/
|
|
24590
|
-
function backgroundFrame(path, options = {}) {
|
|
24591
|
-
const { leadingNodes = [], frameSlot, ...layerOptions } = options;
|
|
24592
|
-
const framedLayerOptions = {
|
|
24593
|
-
...layerOptions,
|
|
24594
|
-
styleClassName: layerOptions.styleClassName ?? "background-style rb-absolute rb-inset-0 rb-z-0 rb-h-full rb-w-full rb-pointer-events-none",
|
|
24595
|
-
imageClassName: layerOptions.imageClassName ?? "rb-absolute rb-z-0",
|
|
24596
|
-
overlayClassName: layerOptions.overlayClassName ?? "background-overlay rb-absolute rb-inset-0 rb-z-0 rb-h-full rb-w-full rb-pointer-events-none"
|
|
24597
|
-
};
|
|
24598
|
-
return el("div", {
|
|
24599
|
-
...frameSlot ? lookSlot(frameSlot) : {},
|
|
24600
|
-
className: { $bind: {
|
|
24601
|
-
from: path,
|
|
24602
|
-
transforms: [{
|
|
24603
|
-
id: "background.resolveFrameClassName",
|
|
24604
|
-
options: { baseClass: BACKGROUND_FRAME_BASE_CLASS }
|
|
24605
|
-
}],
|
|
24606
|
-
fallback: `${BACKGROUND_FRAME_BASE_CLASS} rb-overflow-hidden`
|
|
24607
|
-
} },
|
|
24608
|
-
style: { borderRadius: "inherit" }
|
|
24609
|
-
}, [...leadingNodes, ...backgroundLayer(path, framedLayerOptions)]);
|
|
24610
|
-
}
|
|
24611
|
-
/**
|
|
24612
|
-
* Creates a media node for rendering background image/video media with conditional rendering.
|
|
24613
|
-
*
|
|
24614
|
-
* This helper creates a media element that:
|
|
24615
|
-
* - Only renders when the media path has a value (via `when` modifier)
|
|
24616
|
-
* - Binds to the media data at the specified path (via `bind` modifier)
|
|
24617
|
-
* - Applies the provided CSS class for positioning and styling
|
|
24618
|
-
* - Applies advanced image options (object-fit, object-position, opacity) via transform
|
|
24619
|
-
*
|
|
24620
|
-
* Used internally by `backgroundLayer()` but can be used independently for custom layouts.
|
|
24621
|
-
*
|
|
24622
|
-
* @param path - The data path to the background field (e.g., '_sectionStyles.background')
|
|
24623
|
-
* @param className - CSS class for the image element
|
|
24624
|
-
* @returns A media NodeDefinition with conditional rendering and data binding
|
|
24625
|
-
*
|
|
24626
|
-
* @example
|
|
24627
|
-
* // Standalone usage
|
|
24628
|
-
* const imageNode = createBackgroundImageNode('_sectionStyles.background')
|
|
24629
|
-
*
|
|
24630
|
-
* @example
|
|
24631
|
-
* // Custom styling
|
|
24632
|
-
* const imageNode = createBackgroundImageNode(
|
|
24633
|
-
* '_sectionStyles.background',
|
|
24634
|
-
* 'rb-absolute rb-inset-0 rb-h-full rb-w-full'
|
|
24635
|
-
* )
|
|
24636
|
-
*/
|
|
24637
|
-
function createBackgroundImageNode(path, baseClassName = "rb-absolute rb-z-neg-10", options = {}) {
|
|
24638
|
-
const imagePath = `${path}.image`;
|
|
24639
|
-
return media({
|
|
24640
|
-
...options.slot ? lookSlot(options.slot) : {},
|
|
24641
|
-
className: { $bind: {
|
|
24642
|
-
from: path,
|
|
24643
|
-
transforms: [{
|
|
24644
|
-
id: "background.resolveImageClassName",
|
|
24645
|
-
options: { baseClass: `background-image ${baseClassName}` }
|
|
24646
|
-
}]
|
|
24647
|
-
} },
|
|
24648
|
-
style: { $bind: {
|
|
24649
|
-
from: path,
|
|
24650
|
-
transforms: [{ id: "background.resolveImageStyle" }]
|
|
24651
|
-
} },
|
|
24652
|
-
videoPlayback: "background",
|
|
24653
|
-
...options.loading ? { loading: options.loading } : {},
|
|
24654
|
-
...options.fetchPriority ? { fetchPriority: options.fetchPriority } : {}
|
|
24655
|
-
}, when(imagePath), bind(path, { transforms: [{ id: "background.resolveMedia" }] }));
|
|
24656
|
-
}
|
|
24657
|
-
/**
|
|
24658
|
-
* Creates a div node for rendering color/gradient overlays on background images.
|
|
24659
|
-
*
|
|
24660
|
-
* This helper creates a div element that:
|
|
24661
|
-
* - Is always present in the DOM but invisible when no overlay is configured
|
|
24662
|
-
* - Binds to the overlay data at `${path}.overlay`
|
|
24663
|
-
* - Applies color/gradient via `background.resolveOverlayStyle` transform
|
|
24664
|
-
*
|
|
24665
|
-
* The overlay appears above the image due to DOM order (both use -z-10).
|
|
24666
|
-
* When no overlay is configured, the transform returns {} making the div invisible.
|
|
24667
|
-
*
|
|
24668
|
-
* Used internally by `backgroundLayer()` but can be used independently for custom layouts.
|
|
24669
|
-
*
|
|
24670
|
-
* @param path - The data path to the background field (e.g., '_sectionStyles.background')
|
|
24671
|
-
* @param className - CSS class for the overlay element
|
|
24672
|
-
* @returns A div NodeDefinition with style binding
|
|
24673
|
-
*
|
|
24674
|
-
* @example
|
|
24675
|
-
* // Standalone usage
|
|
24676
|
-
* const overlayNode = createBackgroundOverlayNode('_sectionStyles.background')
|
|
24677
|
-
*/
|
|
24678
|
-
function createBackgroundOverlayNode(path, className = "background-overlay rb-absolute rb-inset-0 rb-z-neg-10 rb-h-full rb-w-full rb-pointer-events-none") {
|
|
24679
|
-
return el("div", {
|
|
24680
|
-
className,
|
|
24681
|
-
style: { $bind: {
|
|
24682
|
-
from: `${path}.overlay`,
|
|
24683
|
-
transforms: [{ id: "background.resolveOverlayStyle" }]
|
|
24684
|
-
} }
|
|
24685
|
-
});
|
|
24686
|
-
}
|
|
24687
|
-
//#endregion
|
|
24688
|
-
//#region ../blocks/src/system/spacing.ts
|
|
24689
|
-
/**
|
|
24690
|
-
* Type-safe spacing system for sections and containers.
|
|
24691
|
-
*
|
|
24692
|
-
* This module provides:
|
|
24693
|
-
* - Semantic spacing values (none, compact, cozy, medium, comfortable, spacious)
|
|
24694
|
-
* - Type-safe mappings to CSS class tokens
|
|
24695
|
-
* - Runtime validation via type guards
|
|
24696
|
-
* - Separate handling for section (vertical) vs container (all-sides) spacing
|
|
24697
|
-
*
|
|
24698
|
-
* Type Safety Guarantees:
|
|
24699
|
-
* - Type is derived from data (single source of truth)
|
|
24700
|
-
* - Maps are validated for completeness at compile time
|
|
24701
|
-
* - Runtime validation available via isSemanticSpacing()
|
|
24702
|
-
*/
|
|
24703
|
-
/**
|
|
24704
|
-
* Single source of truth for semantic spacing values.
|
|
24705
|
-
* The SemanticSpacing type is derived from this array to ensure they stay in sync.
|
|
24706
|
-
*
|
|
24707
|
-
* Adding a new spacing value:
|
|
24708
|
-
* 1. Add it to this array
|
|
24709
|
-
* 2. TypeScript will error until you update both spacing maps
|
|
24710
|
-
* 3. No way to get out of sync
|
|
24711
|
-
*/
|
|
24712
|
-
const SEMANTIC_SPACING_VALUES = [
|
|
24713
|
-
"none",
|
|
24714
|
-
"compact",
|
|
24715
|
-
"cozy",
|
|
24716
|
-
"medium",
|
|
24717
|
-
"comfortable",
|
|
24718
|
-
"spacious"
|
|
24719
|
-
];
|
|
24720
|
-
/**
|
|
24721
|
-
* Runtime type guard for validating spacing values.
|
|
24722
|
-
* Use this at system boundaries where data enters from external sources.
|
|
24723
|
-
*
|
|
24724
|
-
* @param value - Unknown value to validate
|
|
24725
|
-
* @returns true if value is a valid SemanticSpacing, with type narrowing
|
|
24726
|
-
*
|
|
24727
|
-
* @example
|
|
24728
|
-
* const userInput = 'medium';
|
|
24729
|
-
* if (isSemanticSpacing(userInput)) {
|
|
24730
|
-
* // TypeScript knows userInput is SemanticSpacing here
|
|
24731
|
-
* const classes = resolveSpacing(userInput, 'y');
|
|
24732
|
-
* }
|
|
24733
|
-
*/
|
|
24734
|
-
function isSemanticSpacing(value) {
|
|
24735
|
-
return typeof value === "string" && SEMANTIC_SPACING_VALUES.includes(value);
|
|
24736
|
-
}
|
|
24737
|
-
/**
|
|
24738
|
-
* Type-safe mapping from semantic spacing to CSS classes for sections (y-axis).
|
|
24739
|
-
*
|
|
24740
|
-
* Sections use vertical padding only to control spacing between blocks.
|
|
24741
|
-
* Horizontal padding (px-6) is handled separately via baseClass.
|
|
24742
|
-
*
|
|
24743
|
-
* The `satisfies` operator ensures all SemanticSpacing values are present at compile time.
|
|
24744
|
-
* TypeScript will error if any spacing value is missing or if extra keys exist.
|
|
24745
|
-
*/
|
|
24746
|
-
const SECTION_SPACING_MAP = {
|
|
24747
|
-
none: "rb-section-pad-none",
|
|
24748
|
-
compact: "rb-section-pad-compact",
|
|
24749
|
-
cozy: "rb-section-pad-cozy",
|
|
24750
|
-
medium: "rb-section-pad-medium",
|
|
24751
|
-
comfortable: "rb-section-pad-comfortable",
|
|
24752
|
-
spacious: "rb-section-pad-spacious"
|
|
24753
|
-
};
|
|
24754
|
-
/**
|
|
24755
|
-
* Type-safe mapping from semantic spacing to CSS classes for containers (all sides).
|
|
24756
|
-
*
|
|
24757
|
-
* Containers use padding on all sides for internal content spacing.
|
|
24758
|
-
*
|
|
24759
|
-
* The `satisfies` operator ensures all SemanticSpacing values are present at compile time.
|
|
24760
|
-
*/
|
|
24761
|
-
const CONTAINER_SPACING_MAP = {
|
|
24762
|
-
none: "rb-container-pad-none",
|
|
24763
|
-
compact: "rb-container-pad-compact",
|
|
24764
|
-
cozy: "rb-container-pad-cozy",
|
|
24765
|
-
medium: "rb-container-pad-medium",
|
|
24766
|
-
comfortable: "rb-container-pad-comfortable",
|
|
24767
|
-
spacious: "rb-container-pad-spacious"
|
|
24768
|
-
};
|
|
24769
|
-
/**
|
|
24770
|
-
* Resolve semantic spacing to CSS classes based on axis.
|
|
24771
|
-
*
|
|
24772
|
-
* This function guarantees that valid SemanticSpacing values always return a result.
|
|
24773
|
-
* Since spacing is typed, there's no need for fallback logic.
|
|
24774
|
-
*
|
|
24775
|
-
* @param spacing - Semantic spacing value (validated at compile time)
|
|
24776
|
-
* @param axis - Which axis to apply padding ('y' for sections, 'all' for containers)
|
|
24777
|
-
* @returns CSS class token string
|
|
24778
|
-
*
|
|
24779
|
-
* @example
|
|
24780
|
-
* resolveSpacing('medium', 'y') // => 'rb-section-pad-medium'
|
|
24781
|
-
* resolveSpacing('medium', 'all') // => 'rb-container-pad-medium'
|
|
24782
|
-
* resolveSpacing('compact') // => 'rb-section-pad-compact' (defaults to 'y' axis)
|
|
24783
|
-
*/
|
|
24784
|
-
function resolveSpacing(spacing, axis = "y") {
|
|
24785
|
-
return (axis === "y" ? SECTION_SPACING_MAP : CONTAINER_SPACING_MAP)[spacing];
|
|
24786
|
-
}
|
|
24787
|
-
/**
|
|
24788
|
-
* Default spacing value for sections when not explicitly configured.
|
|
24789
|
-
*/
|
|
24790
|
-
const DEFAULT_SECTION_SPACING = "medium";
|
|
24791
|
-
//#endregion
|
|
24792
|
-
//#region ../blocks/src/system/node/fragments/styledSection.ts
|
|
24793
|
-
/**
|
|
24794
|
-
* Create a styled section with automatic background layer and spacing bindings.
|
|
24795
|
-
*
|
|
24796
|
-
* This helper encapsulates the common pattern of:
|
|
24797
|
-
* - Creating a section wrapper with background theme
|
|
24798
|
-
* - Adding background color/gradient/image layers
|
|
24799
|
-
* - Binding className to section styles with transform
|
|
24800
|
-
* - Keeping foreground overflow visible while decorative backgrounds clip independently
|
|
24801
|
-
* - Wrapping content children
|
|
24802
|
-
*
|
|
24803
|
-
* Use this helper to eliminate 25+ lines of boilerplate section setup code.
|
|
24804
|
-
*
|
|
24805
|
-
* @example
|
|
24806
|
-
* // Basic usage with default spacing
|
|
24807
|
-
* const layout = styledSection({
|
|
24808
|
-
* children: sectionContainer(contentNodes, { gap: 'md' }),
|
|
24809
|
-
* });
|
|
24810
|
-
*
|
|
24811
|
-
* @example
|
|
24812
|
-
* // Custom spacing and base padding
|
|
24813
|
-
* const compactLayout = styledSection({
|
|
24814
|
-
* children: sectionContainer(contentNodes, { gap: 'sm' }),
|
|
24815
|
-
* baseClass: 'rb-px-8',
|
|
24816
|
-
* spacing: 'compact',
|
|
24817
|
-
* });
|
|
24818
|
-
*
|
|
24819
|
-
* @example
|
|
24820
|
-
* // Multiple children
|
|
24821
|
-
* const layout = styledSection({
|
|
24822
|
-
* children: [
|
|
24823
|
-
* heading({ text: 'Title' }),
|
|
24824
|
-
* sectionContainer(contentNodes, { gap: 'md' }),
|
|
24825
|
-
* ],
|
|
24826
|
-
* });
|
|
24827
|
-
*
|
|
24828
|
-
* @example
|
|
24829
|
-
* // Custom binding path (for nested sections)
|
|
24830
|
-
* const nestedSection = styledSection({
|
|
24831
|
-
* children: content,
|
|
24832
|
-
* bindFrom: 'container.styles',
|
|
24833
|
-
* });
|
|
24834
|
-
*/
|
|
24835
|
-
function styledSection(config) {
|
|
24836
|
-
const { children, baseClass = "rb-px-6", spacing = DEFAULT_SECTION_SPACING, background = "background", bindFrom = "_sectionStyles", imageClassName = "rb-absolute rb-z-0", renderBackgroundImage = true, backgroundImageLoading, backgroundImageFetchPriority, fullWidthPath } = config;
|
|
24837
|
-
const renderedBackgroundNode = backgroundFrame(`${bindFrom}.background`, {
|
|
24838
|
-
...config.backgroundLookSlots ? {
|
|
24839
|
-
frameSlot: "background",
|
|
24840
|
-
imageSlot: "photo"
|
|
24841
|
-
} : {},
|
|
24842
|
-
imageClassName,
|
|
24843
|
-
fallbackToken: background,
|
|
24844
|
-
omitImageLayer: !renderBackgroundImage,
|
|
24845
|
-
imageLoading: backgroundImageLoading,
|
|
24846
|
-
imageFetchPriority: backgroundImageFetchPriority
|
|
24847
|
-
});
|
|
24848
|
-
const childrenArray = Array.isArray(children) ? children : [children];
|
|
24849
|
-
return section(sectionAppearanceProps({
|
|
24850
|
-
bindFrom,
|
|
24851
|
-
background,
|
|
24852
|
-
baseClass,
|
|
24853
|
-
spacing,
|
|
24854
|
-
fullWidthPath,
|
|
24855
|
-
skinSlot: config.skinSlot
|
|
24856
|
-
}), [renderedBackgroundNode, ...childrenArray]);
|
|
24857
|
-
}
|
|
24858
|
-
function sectionAppearanceProps(input) {
|
|
24859
|
-
return {
|
|
24860
|
-
...input.skinSlot ? lookSlot(input.skinSlot, "skin") : lookSlot("section"),
|
|
24861
|
-
"data-arrangement": { $bind: { from: "content._lookHooks.data-arrangement" } },
|
|
24862
|
-
style: { $bind: {
|
|
24863
|
-
from: `${input.bindFrom}.background`,
|
|
24864
|
-
transforms: [{
|
|
24865
|
-
id: "sectionStyles.resolveColorsStyle",
|
|
24866
|
-
options: { fallbackToken: input.background }
|
|
24867
|
-
}]
|
|
24868
|
-
} },
|
|
24869
|
-
className: { $bind: {
|
|
24870
|
-
from: input.bindFrom,
|
|
24871
|
-
transforms: [{
|
|
24872
|
-
id: "sectionStyles.resolveClassName",
|
|
24873
|
-
options: {
|
|
24874
|
-
baseClass: input.baseClass,
|
|
24875
|
-
defaultSpacing: input.spacing,
|
|
24876
|
-
fullWidthPath: input.fullWidthPath
|
|
24877
|
-
}
|
|
24878
|
-
}]
|
|
24879
|
-
} }
|
|
24880
|
-
};
|
|
24881
|
-
}
|
|
24882
|
-
//#endregion
|
|
24883
|
-
//#region ../blocks/src/system/node/fragments/sectionContainer.ts
|
|
24884
|
-
/**
|
|
24885
|
-
* Creates a centered container with responsive max-width.
|
|
24886
|
-
*
|
|
24887
|
-
* By default, uses Tailwind's responsive `container` class which provides:
|
|
24888
|
-
* - sm: max-w-640px
|
|
24889
|
-
* - md: max-w-768px
|
|
24890
|
-
* - lg: max-w-1024px
|
|
24891
|
-
* - xl: max-w-1280px
|
|
24892
|
-
* - 2xl: max-w-1536px
|
|
24893
|
-
*
|
|
24894
|
-
* When `bindFrom` points to _containerStyles with fullWidth=true, switches to `w-full`
|
|
24895
|
-
* for edge-to-edge content without horizontal constraints.
|
|
24896
|
-
*
|
|
24897
|
-
* @param children - Child nodes to render inside container
|
|
24898
|
-
* @param opts - Configuration options
|
|
24899
|
-
* @param opts.gap - Vertical spacing between children (default: 'md')
|
|
24900
|
-
* @param opts.align - Horizontal alignment (default: undefined)
|
|
24901
|
-
* @param opts.className - Additional static classes
|
|
24902
|
-
* @param opts.bindFrom - Data path for container styles (default: '_containerStyles')
|
|
24903
|
-
* @returns A stack NodeDefinition configured as a responsive container
|
|
24904
|
-
*/
|
|
24905
|
-
function sectionContainer(children, opts) {
|
|
24906
|
-
const gap = opts?.gap ?? "md";
|
|
24907
|
-
const align = opts?.align;
|
|
24908
|
-
const bindFrom = opts?.bindFrom ?? "_containerStyles";
|
|
24909
|
-
const additionalClasses = opts?.className ?? "";
|
|
24910
|
-
return stack({
|
|
24911
|
-
gap,
|
|
24912
|
-
className: { $bind: {
|
|
24913
|
-
from: bindFrom,
|
|
24914
|
-
transforms: [{
|
|
24915
|
-
id: "containerStyles.resolveClassName",
|
|
24916
|
-
options: { baseClass: additionalClasses }
|
|
24917
|
-
}],
|
|
24918
|
-
fallback: additionalClasses ? `container mx-auto ${additionalClasses}` : "container mx-auto"
|
|
24919
|
-
} },
|
|
24920
|
-
...align ? { align } : {}
|
|
24921
|
-
}, children);
|
|
24922
|
-
}
|
|
24923
|
-
//#endregion
|
|
24924
|
-
//#region ../blocks/src/system/layout/repeaterGrid.ts
|
|
24925
|
-
const DEFAULT_REPEATER_GRID_SPAN_FIELD_ID = "gridSpan";
|
|
24926
|
-
const DEFAULT_REPEATER_GRID_ROW_FIELD_ID = "gridRow";
|
|
24927
|
-
const DEFAULT_REPEATER_GRID_COLUMN_FIELD_ID = "gridColumn";
|
|
24928
|
-
function asNonEmptyString(value) {
|
|
24929
|
-
if (typeof value !== "string") return null;
|
|
24930
|
-
const trimmed = value.trim();
|
|
24931
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
24932
|
-
}
|
|
24933
|
-
function resolveRepeaterGridSpanFieldId(options) {
|
|
24934
|
-
return asNonEmptyString(options?.id) ?? "gridSpan";
|
|
24935
|
-
}
|
|
24936
|
-
function resolveRepeaterGridRowFieldId(options) {
|
|
24937
|
-
return asNonEmptyString(options?.id) ?? "gridRow";
|
|
24938
|
-
}
|
|
24939
|
-
function resolveRepeaterGridColumnFieldId(options) {
|
|
24940
|
-
return asNonEmptyString(options?.id) ?? "gridColumn";
|
|
24941
|
-
}
|
|
24942
|
-
//#endregion
|
|
24943
|
-
//#region ../blocks/src/system/manifest/schema.ts
|
|
24944
|
-
const visibilityLevels = [
|
|
24945
|
-
"admin",
|
|
24946
|
-
"designer",
|
|
24947
|
-
"author"
|
|
24948
|
-
];
|
|
24949
|
-
const MEDIA_KINDS = [
|
|
24950
|
-
"image",
|
|
24951
|
-
"video",
|
|
24952
|
-
"audio",
|
|
24953
|
-
"document",
|
|
24954
|
-
"spreadsheet",
|
|
24955
|
-
"archive"
|
|
24956
|
-
];
|
|
24957
|
-
const DISPLAY_MEDIA_KINDS = [
|
|
24958
|
-
"image",
|
|
24959
|
-
"video",
|
|
24960
|
-
"audio"
|
|
24961
|
-
];
|
|
24962
|
-
const DEFAULT_MEDIA_FIELD_KINDS = ["image"];
|
|
24963
|
-
const PUBLIC_FILE_FIELD_KINDS = [
|
|
24964
|
-
"document",
|
|
24965
|
-
"spreadsheet",
|
|
24966
|
-
"archive",
|
|
24967
|
-
"audio"
|
|
24968
|
-
];
|
|
24969
|
-
function isDisplayMediaKind(kind) {
|
|
24970
|
-
return DISPLAY_MEDIA_KINDS.includes(kind);
|
|
24971
|
-
}
|
|
24972
|
-
const siteOptionSources = [
|
|
24973
|
-
"eventCategories",
|
|
24974
|
-
"eventSeries",
|
|
24975
|
-
"venues",
|
|
24976
|
-
"staffMembers",
|
|
24977
|
-
"appointmentServiceCategories"
|
|
24978
|
-
];
|
|
24979
|
-
const mediaDeliverySchema = z.object({
|
|
24980
|
-
sizes: z.string().optional(),
|
|
24981
|
-
widthCandidates: z.array(z.number().int().positive()).optional(),
|
|
24982
|
-
maxCssWidth: z.number().positive().optional(),
|
|
24983
|
-
maxCssHeight: z.number().positive().optional(),
|
|
24984
|
-
strategy: z.enum([
|
|
24985
|
-
"default",
|
|
24986
|
-
"columnsAuto",
|
|
24987
|
-
"imageGalleryVariant"
|
|
24988
|
-
]).optional(),
|
|
24989
|
-
strategyOptions: z.record(z.string(), z.unknown()).optional()
|
|
24990
|
-
});
|
|
24991
|
-
const selectOptionSchema = z.object({
|
|
24992
|
-
value: z.string(),
|
|
24993
|
-
label: z.string(),
|
|
24994
|
-
description: z.string().optional(),
|
|
24995
|
-
icon: z.string().optional()
|
|
24996
|
-
});
|
|
24997
|
-
const selectSourceSchema = z.discriminatedUnion("kind", [
|
|
24998
|
-
z.object({ kind: z.literal("static") }),
|
|
24999
|
-
z.object({
|
|
25000
|
-
kind: z.literal("site"),
|
|
25001
|
-
optionSource: z.enum(siteOptionSources)
|
|
25002
|
-
}),
|
|
25003
|
-
z.object({ kind: z.literal("sdk") })
|
|
25004
|
-
]);
|
|
25005
|
-
function assertNeverSelectSource(value) {
|
|
25006
|
-
throw new Error(`Unhandled select source: ${JSON.stringify(value)}`);
|
|
25007
|
-
}
|
|
25008
|
-
const visibleWhenPredicateSchema = z.object({
|
|
25009
|
-
field: z.string().min(1),
|
|
25010
|
-
equals: z.any().optional(),
|
|
25011
|
-
notEquals: z.any().optional(),
|
|
25012
|
-
oneOf: z.array(z.any()).optional(),
|
|
25013
|
-
notIn: z.array(z.any()).optional(),
|
|
25014
|
-
minItems: z.number().int().nonnegative().optional(),
|
|
25015
|
-
maxItems: z.number().int().nonnegative().optional()
|
|
25016
|
-
});
|
|
25017
|
-
const visibleWhenSchema = z.lazy(() => z.union([
|
|
25018
|
-
visibleWhenPredicateSchema,
|
|
25019
|
-
z.object({ allOf: z.array(visibleWhenSchema).min(1) }),
|
|
25020
|
-
z.object({ anyOf: z.array(visibleWhenSchema).min(1) })
|
|
25021
|
-
]));
|
|
25022
|
-
const uiSchema = z.object({
|
|
25023
|
-
widget: z.string().optional(),
|
|
25024
|
-
preset: z.enum(["disclosure"]).optional(),
|
|
25025
|
-
flattenInRepeater: z.boolean().optional(),
|
|
25026
|
-
hidden: z.boolean().optional(),
|
|
25027
|
-
hideLabel: z.boolean().optional(),
|
|
25028
|
-
hideDescription: z.boolean().optional(),
|
|
25029
|
-
showCharCount: z.union([z.number().int().positive(), z.object({ max: z.number().int().positive() })]).optional(),
|
|
25030
|
-
showSlugPreview: z.boolean().optional(),
|
|
25031
|
-
variant: z.enum([
|
|
25032
|
-
"full",
|
|
25033
|
-
"inline",
|
|
25034
|
-
"limited",
|
|
25035
|
-
"media",
|
|
25036
|
-
"notes"
|
|
25037
|
-
]).optional(),
|
|
25038
|
-
richTextVariant: z.enum([
|
|
25039
|
-
"full",
|
|
25040
|
-
"inline",
|
|
25041
|
-
"limited",
|
|
25042
|
-
"media",
|
|
25043
|
-
"notes"
|
|
25044
|
-
]).optional(),
|
|
25045
|
-
cropEditorMode: z.enum(["dialog", "inline"]).optional(),
|
|
25046
|
-
cropEditorAutoOpen: z.boolean().optional(),
|
|
25047
|
-
mediaPickerAutoOpen: z.boolean().optional(),
|
|
25048
|
-
showMediaPreview: z.boolean().optional(),
|
|
25049
|
-
showMediaOverlayActions: z.boolean().optional(),
|
|
25050
|
-
mediaPreviewMaxWidth: z.enum([
|
|
25051
|
-
"xs",
|
|
25052
|
-
"sm",
|
|
25053
|
-
"md",
|
|
25054
|
-
"none"
|
|
25055
|
-
]).optional(),
|
|
25056
|
-
preventMediaPreviewUpscale: z.boolean().optional(),
|
|
25057
|
-
mediaDelivery: mediaDeliverySchema.optional(),
|
|
25058
|
-
mediaDeliveryByVariant: z.record(z.string(), mediaDeliverySchema).optional(),
|
|
25059
|
-
inputType: z.enum([
|
|
25060
|
-
"text",
|
|
25061
|
-
"email",
|
|
25062
|
-
"tel",
|
|
25063
|
-
"number"
|
|
25064
|
-
]).optional(),
|
|
25065
|
-
min: z.number().optional(),
|
|
25066
|
-
max: z.number().optional(),
|
|
25067
|
-
step: z.number().optional(),
|
|
25068
|
-
showValue: z.boolean().optional(),
|
|
25069
|
-
valueUnit: z.enum([
|
|
25070
|
-
"percent",
|
|
25071
|
-
"pixels",
|
|
25072
|
-
"unitless"
|
|
25073
|
-
]).optional(),
|
|
25074
|
-
unsetValue: z.enum(["max", "field-default"]).optional(),
|
|
25075
|
-
allowDirectInput: z.boolean().optional(),
|
|
25076
|
-
pattern: z.string().optional(),
|
|
25077
|
-
placeholder: z.string().optional(),
|
|
25078
|
-
visibleWhen: visibleWhenSchema.optional(),
|
|
25079
|
-
modalConfig: z.object({
|
|
25080
|
-
buttonLabel: z.string().optional(),
|
|
25081
|
-
description: z.string().optional(),
|
|
25082
|
-
buttonVariant: z.enum(["default", "outline"]).optional(),
|
|
25083
|
-
showCustomizedIndicator: z.boolean().optional(),
|
|
25084
|
-
maxWidth: z.string().optional()
|
|
25085
|
-
}).optional(),
|
|
25086
|
-
allowedTypes: z.array(z.enum([
|
|
25087
|
-
"color",
|
|
25088
|
-
"gradient",
|
|
25089
|
-
"image"
|
|
25090
|
-
])).optional(),
|
|
25091
|
-
fullWidth: z.boolean().optional(),
|
|
25092
|
-
row: z.string().optional(),
|
|
25093
|
-
colSpan: z.number().int().min(1).max(4).optional(),
|
|
25094
|
-
layout: z.enum(["stack", "grid"]).optional(),
|
|
25095
|
-
columns: z.number().int().min(2).max(4).optional(),
|
|
25096
|
-
gridColsPreset: z.enum([
|
|
25097
|
-
"simple2",
|
|
25098
|
-
"simple3",
|
|
25099
|
-
"simple4",
|
|
25100
|
-
"buttonCtaRow"
|
|
25101
|
-
]).optional(),
|
|
25102
|
-
gridColumns: z.object({
|
|
25103
|
-
base: z.number().int().min(1).max(4).optional(),
|
|
25104
|
-
sm: z.number().int().min(1).max(4).optional(),
|
|
25105
|
-
md: z.number().int().min(1).max(4).optional(),
|
|
25106
|
-
lg: z.number().int().min(1).max(4).optional(),
|
|
25107
|
-
xl: z.number().int().min(1).max(4).optional()
|
|
25108
|
-
}).optional(),
|
|
25109
|
-
gridColsClassName: z.string().optional(),
|
|
25110
|
-
repeaterPreset: z.enum(["thumbnailGrid", "layoutGrid"]).optional(),
|
|
25111
|
-
thumbnailField: z.string().optional(),
|
|
25112
|
-
thumbnailAltField: z.string().optional(),
|
|
25113
|
-
thumbnailLabelField: z.string().optional(),
|
|
25114
|
-
thumbnailAspectRatio: z.string().optional(),
|
|
25115
|
-
thumbnailCardDensity: z.enum(["compact", "comfortable"]).optional(),
|
|
25116
|
-
layoutGridColumnsFields: z.object({
|
|
25117
|
-
base: z.string().optional(),
|
|
25118
|
-
sm: z.string().optional(),
|
|
25119
|
-
md: z.string().optional(),
|
|
25120
|
-
lg: z.string().min(1),
|
|
25121
|
-
xl: z.string().optional()
|
|
25122
|
-
}).optional(),
|
|
25123
|
-
layoutGridSpanField: z.string().optional(),
|
|
25124
|
-
layoutGridRowField: z.string().optional(),
|
|
25125
|
-
layoutGridColumnField: z.string().optional(),
|
|
25126
|
-
layoutGridMaxRows: z.number().int().positive().optional(),
|
|
25127
|
-
iconPickerPreset: z.enum(ICON_PICKER_PRESETS).optional(),
|
|
25128
|
-
contentTypeField: z.string().optional(),
|
|
25129
|
-
fixedContentType: z.string().optional(),
|
|
25130
|
-
valueFrom: z.enum([
|
|
25131
|
-
"id",
|
|
25132
|
-
"identifier",
|
|
25133
|
-
"slug"
|
|
25134
|
-
]).optional(),
|
|
25135
|
-
siteOptionSource: z.enum(siteOptionSources).optional(),
|
|
25136
|
-
searchThreshold: z.number().int().positive().optional(),
|
|
25137
|
-
renderInHeader: z.boolean().optional(),
|
|
25138
|
-
intent: z.enum([
|
|
25139
|
-
"content",
|
|
25140
|
-
"display",
|
|
25141
|
-
"behavior",
|
|
25142
|
-
"style"
|
|
25143
|
-
]).optional(),
|
|
25144
|
-
valueContract: z.enum(["boxBackground"]).optional()
|
|
25145
|
-
}).partial();
|
|
25146
|
-
const baseFieldSchema = z.object({
|
|
25147
|
-
id: z.string().min(1, "Field id is required"),
|
|
25148
|
-
label: z.string().min(1, "Field label is required"),
|
|
25149
|
-
description: z.string().optional(),
|
|
25150
|
-
visibleRoles: z.array(z.enum(visibilityLevels)).optional(),
|
|
25151
|
-
defaultValue: z.any().optional(),
|
|
25152
|
-
required: z.boolean().default(false),
|
|
25153
|
-
ui: uiSchema.optional()
|
|
25154
|
-
});
|
|
25155
|
-
const textFieldSchema = baseFieldSchema.extend({
|
|
25156
|
-
type: z.literal("text"),
|
|
25157
|
-
multiline: z.boolean().default(false),
|
|
25158
|
-
maxLength: z.number().int().positive().optional()
|
|
25159
|
-
});
|
|
25160
|
-
const richTextFieldSchema = baseFieldSchema.extend({ type: z.literal("richText") });
|
|
25161
|
-
const inlineTextFieldSchema = baseFieldSchema.extend({
|
|
25162
|
-
type: z.literal("inlineText"),
|
|
25163
|
-
maxLength: z.number().int().positive().optional(),
|
|
25164
|
-
plainTextField: z.string().min(1).optional()
|
|
25165
|
-
});
|
|
25166
|
-
function hasMediaDefaultIdentifier(value) {
|
|
25167
|
-
return value !== null && typeof value === "object" && !Array.isArray(value) && typeof value.identifier === "string" && value.identifier.trim().length > 0;
|
|
25168
|
-
}
|
|
25169
|
-
function validateMediaFieldDefault(field, ctx) {
|
|
25170
|
-
if (field.defaultValue !== void 0 && field.defaultValue !== null && !hasMediaDefaultIdentifier(field.defaultValue)) ctx.addIssue({
|
|
25171
|
-
code: z.ZodIssueCode.custom,
|
|
25172
|
-
path: ["defaultValue"],
|
|
25173
|
-
message: `${field.type} defaultValue must be null or an object with a non-empty identifier`
|
|
25174
|
-
});
|
|
25175
|
-
}
|
|
25176
|
-
const mediaFieldSchema = baseFieldSchema.extend({
|
|
25177
|
-
type: z.literal("media"),
|
|
25178
|
-
mediaKinds: z.array(z.enum(MEDIA_KINDS)).default([...DEFAULT_MEDIA_FIELD_KINDS]).transform((kinds) => {
|
|
25179
|
-
const displayKinds = kinds.filter(isDisplayMediaKind);
|
|
25180
|
-
return displayKinds.length > 0 ? displayKinds : [...DEFAULT_MEDIA_FIELD_KINDS];
|
|
25181
|
-
}),
|
|
25182
|
-
aspectRatio: z.string().optional()
|
|
25183
|
-
}).superRefine(validateMediaFieldDefault);
|
|
25184
|
-
const fileFieldSchema = baseFieldSchema.extend({
|
|
25185
|
-
type: z.literal("file"),
|
|
25186
|
-
fileKinds: z.array(z.enum(PUBLIC_FILE_FIELD_KINDS)).default([...PUBLIC_FILE_FIELD_KINDS])
|
|
25187
|
-
}).superRefine(validateMediaFieldDefault);
|
|
25188
|
-
const booleanFieldSchema = baseFieldSchema.extend({ type: z.literal("boolean") });
|
|
25189
|
-
const dateFieldSchema = baseFieldSchema.extend({ type: z.literal("date") });
|
|
25190
|
-
const timeFieldSchema = baseFieldSchema.extend({ type: z.literal("time") });
|
|
25191
|
-
const dateTimeFieldSchema = baseFieldSchema.extend({ type: z.literal("datetime") });
|
|
25192
|
-
const slugFieldSchema = baseFieldSchema.extend({
|
|
25193
|
-
type: z.literal("slug"),
|
|
25194
|
-
sourceFieldId: z.string().min(1).optional(),
|
|
25195
|
-
statusFieldId: z.string().min(1).optional(),
|
|
25196
|
-
maxLength: z.number().int().positive().optional()
|
|
25197
|
-
});
|
|
25198
|
-
const urlFieldSchema = baseFieldSchema.extend({
|
|
25199
|
-
type: z.literal("url"),
|
|
25200
|
-
allowRelative: z.boolean().default(false)
|
|
25201
|
-
});
|
|
25202
|
-
const linkFieldSchema = baseFieldSchema.extend({ type: z.literal("link") });
|
|
25203
|
-
const selectFieldSchema = baseFieldSchema.extend({
|
|
25204
|
-
type: z.literal("select"),
|
|
25205
|
-
options: z.array(selectOptionSchema),
|
|
25206
|
-
multiple: z.boolean().default(false),
|
|
25207
|
-
source: selectSourceSchema.optional()
|
|
25208
|
-
}).superRefine((field, ctx) => {
|
|
25209
|
-
const widget = field.ui?.widget;
|
|
25210
|
-
const siteOptionSource = field.ui?.siteOptionSource;
|
|
25211
|
-
if (!field.source) {
|
|
25212
|
-
if (siteOptionSource || widget === "sdkSelect") {
|
|
25213
|
-
ctx.addIssue({
|
|
25214
|
-
code: z.ZodIssueCode.custom,
|
|
25215
|
-
message: "Runtime-backed select fields must declare source.kind explicitly",
|
|
25216
|
-
path: ["source"]
|
|
25217
|
-
});
|
|
25218
|
-
return;
|
|
25219
|
-
}
|
|
25220
|
-
if (field.options.length === 0) ctx.addIssue({
|
|
25221
|
-
code: z.ZodIssueCode.custom,
|
|
25222
|
-
message: "Select fields require at least one option unless a runtime source is configured",
|
|
25223
|
-
path: ["options"]
|
|
25224
|
-
});
|
|
25225
|
-
return;
|
|
25226
|
-
}
|
|
25227
|
-
switch (field.source.kind) {
|
|
25228
|
-
case "static":
|
|
25229
|
-
if (siteOptionSource || widget === "sdkSelect") ctx.addIssue({
|
|
25230
|
-
code: z.ZodIssueCode.custom,
|
|
25231
|
-
message: "Static select fields cannot declare runtime-backed UI metadata",
|
|
25232
|
-
path: ["ui"]
|
|
25233
|
-
});
|
|
25234
|
-
if (field.options.length === 0) ctx.addIssue({
|
|
25235
|
-
code: z.ZodIssueCode.custom,
|
|
25236
|
-
message: "Static select fields require at least one option",
|
|
25237
|
-
path: ["options"]
|
|
25238
|
-
});
|
|
25239
|
-
return;
|
|
25240
|
-
case "site":
|
|
25241
|
-
if (field.options.length > 0) ctx.addIssue({
|
|
25242
|
-
code: z.ZodIssueCode.custom,
|
|
25243
|
-
message: "Site-backed select fields must not define static options",
|
|
25244
|
-
path: ["options"]
|
|
25245
|
-
});
|
|
25246
|
-
if (widget !== "siteOptionPicker") ctx.addIssue({
|
|
25247
|
-
code: z.ZodIssueCode.custom,
|
|
25248
|
-
message: "Site-backed select fields must use the siteOptionPicker widget",
|
|
25249
|
-
path: ["ui", "widget"]
|
|
25250
|
-
});
|
|
25251
|
-
if (siteOptionSource !== field.source.optionSource) ctx.addIssue({
|
|
25252
|
-
code: z.ZodIssueCode.custom,
|
|
25253
|
-
message: "Site-backed select fields must keep ui.siteOptionSource in sync with source.optionSource",
|
|
25254
|
-
path: ["ui", "siteOptionSource"]
|
|
25255
|
-
});
|
|
25256
|
-
return;
|
|
25257
|
-
case "sdk":
|
|
25258
|
-
if (widget !== "sdkSelect") ctx.addIssue({
|
|
25259
|
-
code: z.ZodIssueCode.custom,
|
|
25260
|
-
message: "SDK-backed select fields must use the sdkSelect widget",
|
|
25261
|
-
path: ["ui", "widget"]
|
|
25262
|
-
});
|
|
25263
|
-
if (siteOptionSource) ctx.addIssue({
|
|
25264
|
-
code: z.ZodIssueCode.custom,
|
|
25265
|
-
message: "SDK-backed select fields cannot declare ui.siteOptionSource",
|
|
25266
|
-
path: ["ui", "siteOptionSource"]
|
|
25267
|
-
});
|
|
25268
|
-
return;
|
|
25269
|
-
default: return assertNeverSelectSource(field.source);
|
|
25270
|
-
}
|
|
25271
|
-
});
|
|
25272
|
-
const referenceFieldSchema = baseFieldSchema.extend({
|
|
25273
|
-
type: z.literal("reference"),
|
|
25274
|
-
referenceKind: z.string().min(1),
|
|
25275
|
-
allowManualEntry: z.boolean().default(false)
|
|
25276
|
-
});
|
|
25277
|
-
/**
|
|
25278
|
-
* Item type schema for polymorphic repeaters.
|
|
25279
|
-
* Each type has a label, optional icon, and its own field schema.
|
|
25280
|
-
*/
|
|
25281
|
-
const itemTypeSchema = z.object({
|
|
25282
|
-
label: z.string().min(1),
|
|
25283
|
-
icon: z.string().optional(),
|
|
25284
|
-
fields: z.lazy(() => getFieldSchemaInternal().array().min(1, "Item type requires at least one field"))
|
|
25285
|
-
});
|
|
25286
|
-
/**
|
|
25287
|
-
* Repeater fields allow nesting of other fields within them.
|
|
25288
|
-
* This enables complex layouts and structures by repeating a set of fields.
|
|
25289
|
-
*
|
|
25290
|
-
* Supports two modes:
|
|
25291
|
-
* 1. Monomorphic (default): All items have the same schema
|
|
25292
|
-
* 2. Polymorphic: Items can be different types (e.g., card, quote, stat)
|
|
25293
|
-
*
|
|
25294
|
-
* Uses z.lazy() to allow mutual recursion.
|
|
25295
|
-
*/
|
|
25296
|
-
const repeaterFieldSchema = baseFieldSchema.extend({
|
|
25297
|
-
type: z.literal("repeater"),
|
|
25298
|
-
itemLabel: z.string().default("Item"),
|
|
25299
|
-
itemLabelSource: z.string().optional(),
|
|
25300
|
-
showSummary: z.boolean().optional(),
|
|
25301
|
-
summaryFields: z.string().array().optional(),
|
|
25302
|
-
summaryMaxChars: z.number().int().positive().optional(),
|
|
25303
|
-
minItems: z.number().int().min(0).default(0),
|
|
25304
|
-
maxItems: z.number().int().positive().optional(),
|
|
25305
|
-
schema: z.object({ fields: z.lazy(() => getFieldSchemaInternal().array().min(1, "Repeater requires at least one field")) }).optional(),
|
|
25306
|
-
polymorphic: z.boolean().optional(),
|
|
25307
|
-
itemTypes: z.record(z.string(), itemTypeSchema).optional(),
|
|
25308
|
-
allowConversion: z.boolean().default(true)
|
|
25309
|
-
}).refine((data) => {
|
|
25310
|
-
return data.schema !== void 0 !== (data.polymorphic === true && data.itemTypes !== void 0);
|
|
25311
|
-
}, { message: "Repeater must have either 'schema' (monomorphic) or 'polymorphic: true' with 'itemTypes' (polymorphic)" }).refine((data) => {
|
|
25312
|
-
if (data.ui?.repeaterPreset !== "layoutGrid") return true;
|
|
25313
|
-
return !!data.ui.layoutGridColumnsFields?.lg;
|
|
25314
|
-
}, {
|
|
25315
|
-
message: "ui.layoutGridColumnsFields.lg is required when ui.repeaterPreset is 'layoutGrid'",
|
|
25316
|
-
path: [
|
|
25317
|
-
"ui",
|
|
25318
|
-
"layoutGridColumnsFields",
|
|
25319
|
-
"lg"
|
|
25320
|
-
]
|
|
25321
|
-
}).refine((data) => {
|
|
25322
|
-
if (data.ui?.repeaterPreset !== "layoutGrid") return true;
|
|
25323
|
-
const requiredFieldIds = [
|
|
25324
|
-
resolveRepeaterGridSpanFieldId({ id: typeof data.ui.layoutGridSpanField === "string" ? data.ui.layoutGridSpanField : void 0 }),
|
|
25325
|
-
resolveRepeaterGridRowFieldId({ id: typeof data.ui.layoutGridRowField === "string" ? data.ui.layoutGridRowField : void 0 }),
|
|
25326
|
-
resolveRepeaterGridColumnFieldId({ id: typeof data.ui.layoutGridColumnField === "string" ? data.ui.layoutGridColumnField : void 0 })
|
|
25327
|
-
];
|
|
25328
|
-
if (data.polymorphic && data.itemTypes) return Object.values(data.itemTypes).every((itemType) => Array.isArray(itemType.fields) && requiredFieldIds.every((requiredId) => itemType.fields?.some((field) => field.id === requiredId)));
|
|
25329
|
-
const schemaFields = data.schema?.fields;
|
|
25330
|
-
if (!schemaFields) return true;
|
|
25331
|
-
return requiredFieldIds.every((requiredId) => schemaFields.some((field) => field.id === requiredId));
|
|
25332
|
-
}, {
|
|
25333
|
-
message: `layoutGrid repeaters require span/row/column fields (defaults: '${DEFAULT_REPEATER_GRID_SPAN_FIELD_ID}', '${DEFAULT_REPEATER_GRID_ROW_FIELD_ID}', '${DEFAULT_REPEATER_GRID_COLUMN_FIELD_ID}') to exist in repeater item fields`,
|
|
25334
|
-
path: ["ui", "layoutGridRowField"]
|
|
25335
|
-
}).refine((data) => {
|
|
25336
|
-
const thumbnailAspectRatio = data.ui?.thumbnailAspectRatio;
|
|
25337
|
-
if (!thumbnailAspectRatio) return true;
|
|
25338
|
-
return parseAspectRatioValue(thumbnailAspectRatio) != null;
|
|
25339
|
-
}, {
|
|
25340
|
-
message: "ui.thumbnailAspectRatio must be a valid ratio (e.g. '16/9', '4:3', or '1.5')",
|
|
25341
|
-
path: ["ui", "thumbnailAspectRatio"]
|
|
25342
|
-
}).refine((data) => {
|
|
25343
|
-
const labelField = data.ui?.thumbnailLabelField;
|
|
25344
|
-
if (!labelField) return true;
|
|
25345
|
-
const schemaFields = data.schema?.fields;
|
|
25346
|
-
if (!schemaFields) return true;
|
|
25347
|
-
return schemaFields.find((candidate) => candidate.id === labelField)?.type === "text";
|
|
25348
|
-
}, {
|
|
25349
|
-
message: "ui.thumbnailLabelField must reference a text field in the repeater schema",
|
|
25350
|
-
path: ["ui", "thumbnailLabelField"]
|
|
25351
|
-
});
|
|
25352
|
-
const groupFieldSchema = baseFieldSchema.extend({
|
|
25353
|
-
type: z.literal("group"),
|
|
25354
|
-
schema: z.object({ fields: z.lazy(() => getFieldSchemaInternal().array().min(1, "Group requires at least one field")) })
|
|
25355
|
-
});
|
|
25356
|
-
const modalFieldSchema = baseFieldSchema.extend({
|
|
25357
|
-
type: z.literal("modal"),
|
|
25358
|
-
schema: z.object({ fields: z.lazy(() => getFieldSchemaInternal().array().min(1, "Modal requires at least one field")) })
|
|
25359
|
-
});
|
|
25360
|
-
const numberFieldSchema = baseFieldSchema.extend({
|
|
25361
|
-
type: z.literal("number"),
|
|
25362
|
-
min: z.number().optional(),
|
|
25363
|
-
max: z.number().optional(),
|
|
25364
|
-
step: z.number().optional()
|
|
25365
|
-
});
|
|
25366
|
-
const tabDefinitionSchema = z.object({
|
|
25367
|
-
id: z.string().min(1),
|
|
25368
|
-
label: z.string().min(1),
|
|
25369
|
-
icon: z.string().optional(),
|
|
25370
|
-
description: z.string().optional(),
|
|
25371
|
-
fields: z.lazy(() => getFieldSchemaInternal().array()),
|
|
25372
|
-
/** SDK section option that controls tab visibility based on site config */
|
|
25373
|
-
sdkSectionOption: z.enum([
|
|
25374
|
-
"backgroundColor",
|
|
25375
|
-
"backgroundGradient",
|
|
25376
|
-
"backgroundImage"
|
|
25377
|
-
]).optional()
|
|
25378
|
-
});
|
|
25379
|
-
const tabGroupFieldSchema = baseFieldSchema.extend({
|
|
25380
|
-
type: z.literal("tabGroup"),
|
|
25381
|
-
tabs: z.array(tabDefinitionSchema).min(1, "TabGroup requires at least one tab"),
|
|
25382
|
-
activeTabField: z.string().optional()
|
|
25383
|
-
});
|
|
25384
|
-
const presetOptionSchema = z.object({
|
|
25385
|
-
value: z.string(),
|
|
25386
|
-
label: z.string()
|
|
25387
|
-
});
|
|
25388
|
-
const presetOrCustomFieldSchema = baseFieldSchema.extend({
|
|
25389
|
-
type: z.literal("presetOrCustom"),
|
|
25390
|
-
presets: z.array(presetOptionSchema).min(1, "PresetOrCustom requires at least one preset"),
|
|
25391
|
-
customInput: z.object({
|
|
25392
|
-
placeholder: z.string().optional(),
|
|
25393
|
-
pattern: z.string().optional(),
|
|
25394
|
-
helpText: z.string().optional()
|
|
25395
|
-
}).optional()
|
|
25396
|
-
});
|
|
25397
|
-
const contentTypeSelectFieldSchema = baseFieldSchema.extend({
|
|
25398
|
-
type: z.literal("contentTypeSelect"),
|
|
25399
|
-
/** Filter: all, routable (hasPages=true), nonRoutable (hasPages=false) */
|
|
25400
|
-
filter: z.enum([
|
|
25401
|
-
"all",
|
|
25402
|
-
"routable",
|
|
25403
|
-
"nonRoutable"
|
|
25404
|
-
]).default("all")
|
|
25405
|
-
});
|
|
25406
|
-
const entryPickerFieldSchema = baseFieldSchema.extend({
|
|
25407
|
-
type: z.literal("entryPicker"),
|
|
25408
|
-
/** Fixed content type to filter entries by (no sibling contentType field required) */
|
|
25409
|
-
fixedContentType: z.string().optional(),
|
|
25410
|
-
/** Field ID that contains the content type to filter entries by */
|
|
25411
|
-
contentTypeField: z.string().optional(),
|
|
25412
|
-
/** What value should be stored when an entry is selected */
|
|
25413
|
-
valueFrom: z.enum([
|
|
25414
|
-
"id",
|
|
25415
|
-
"identifier",
|
|
25416
|
-
"slug"
|
|
25417
|
-
]).optional()
|
|
25418
|
-
});
|
|
25419
|
-
let _fieldSchemaInternal = null;
|
|
25420
|
-
function getFieldSchemaInternal() {
|
|
25421
|
-
if (_fieldSchemaInternal) return _fieldSchemaInternal;
|
|
25422
|
-
_fieldSchemaInternal = z.discriminatedUnion("type", [
|
|
25423
|
-
textFieldSchema,
|
|
25424
|
-
richTextFieldSchema,
|
|
25425
|
-
inlineTextFieldSchema,
|
|
25426
|
-
mediaFieldSchema,
|
|
25427
|
-
fileFieldSchema,
|
|
25428
|
-
booleanFieldSchema,
|
|
25429
|
-
numberFieldSchema,
|
|
25430
|
-
dateFieldSchema,
|
|
25431
|
-
timeFieldSchema,
|
|
25432
|
-
dateTimeFieldSchema,
|
|
25433
|
-
slugFieldSchema,
|
|
25434
|
-
urlFieldSchema,
|
|
25435
|
-
linkFieldSchema,
|
|
25436
|
-
selectFieldSchema,
|
|
25437
|
-
referenceFieldSchema,
|
|
25438
|
-
repeaterFieldSchema,
|
|
25439
|
-
groupFieldSchema,
|
|
25440
|
-
modalFieldSchema,
|
|
25441
|
-
tabGroupFieldSchema,
|
|
25442
|
-
presetOrCustomFieldSchema,
|
|
25443
|
-
contentTypeSelectFieldSchema,
|
|
25444
|
-
entryPickerFieldSchema
|
|
25445
|
-
]);
|
|
25446
|
-
return _fieldSchemaInternal;
|
|
25447
|
-
}
|
|
25448
|
-
const fieldSchema = new Proxy({}, {
|
|
25449
|
-
get(_, prop) {
|
|
25450
|
-
const schema = getFieldSchemaInternal();
|
|
25451
|
-
const value = schema[prop];
|
|
25452
|
-
return typeof value === "function" ? value.bind(schema) : value;
|
|
25453
|
-
},
|
|
25454
|
-
has(_, prop) {
|
|
25455
|
-
return prop in getFieldSchemaInternal();
|
|
25456
|
-
}
|
|
25457
|
-
});
|
|
25458
|
-
function parseFieldDefinitions(input) {
|
|
25459
|
-
return fieldSchema.array().parse(input);
|
|
25460
|
-
}
|
|
25461
|
-
const slotSchema = z.object({
|
|
25462
|
-
id: z.string().min(1),
|
|
25463
|
-
label: z.string().min(1),
|
|
25464
|
-
allowedKinds: z.array(z.string()).default([]),
|
|
25465
|
-
min: z.number().int().min(0).default(0),
|
|
25466
|
-
max: z.number().int().positive().optional(),
|
|
25467
|
-
help: z.string().optional(),
|
|
25468
|
-
visibleRoles: z.array(z.enum(visibilityLevels)).optional()
|
|
25469
|
-
});
|
|
25470
|
-
const typographyTokens = [
|
|
25471
|
-
"display",
|
|
25472
|
-
"heading",
|
|
25473
|
-
"subheading",
|
|
25474
|
-
"body",
|
|
25475
|
-
"caption"
|
|
25476
|
-
];
|
|
25477
|
-
const colorTokens = [
|
|
25478
|
-
"background",
|
|
25479
|
-
"surface",
|
|
25480
|
-
"foreground",
|
|
25481
|
-
"accent",
|
|
25482
|
-
"muted"
|
|
25483
|
-
];
|
|
25484
|
-
const styleTokenSchema = z.object({
|
|
25485
|
-
background: z.enum(colorTokens).optional(),
|
|
25486
|
-
foreground: z.enum(colorTokens).optional(),
|
|
25487
|
-
border: z.enum(colorTokens).optional(),
|
|
25488
|
-
typography: z.enum(typographyTokens).optional(),
|
|
25489
|
-
spacing: z.enum([
|
|
25490
|
-
"none",
|
|
25491
|
-
"xs",
|
|
25492
|
-
"sm",
|
|
25493
|
-
"md",
|
|
25494
|
-
"lg",
|
|
25495
|
-
"xl"
|
|
25496
|
-
]).optional(),
|
|
25497
|
-
radius: z.enum([
|
|
25498
|
-
"none",
|
|
25499
|
-
"sm",
|
|
25500
|
-
"md",
|
|
25501
|
-
"lg",
|
|
25502
|
-
"full"
|
|
25503
|
-
]).optional()
|
|
25504
|
-
});
|
|
25505
|
-
const behaviourSchema = z.object({
|
|
25506
|
-
supportsThemeSwitching: z.boolean().default(true),
|
|
25507
|
-
inlineEditing: z.boolean().default(false),
|
|
25508
|
-
animation: z.boolean().default(false),
|
|
25509
|
-
paletteHidden: z.boolean().default(false),
|
|
25510
|
-
managesOwnWrapper: z.boolean().optional()
|
|
25511
|
-
});
|
|
25512
|
-
const quickFieldPrioritySchema = z.array(z.string().min(1)).min(1).superRefine((fieldIds, ctx) => {
|
|
25513
|
-
const seenFieldIds = /* @__PURE__ */ new Set();
|
|
25514
|
-
for (const [index, fieldId] of fieldIds.entries()) {
|
|
25515
|
-
if (seenFieldIds.has(fieldId)) ctx.addIssue({
|
|
25516
|
-
code: z.ZodIssueCode.custom,
|
|
25517
|
-
path: [index],
|
|
25518
|
-
message: `Duplicate quick-field priority "${fieldId}"`
|
|
25519
|
-
});
|
|
25520
|
-
seenFieldIds.add(fieldId);
|
|
25521
|
-
}
|
|
25522
|
-
});
|
|
25523
|
-
const previewCustomizeManifestCurationSchema = z.object({ quickFieldPriority: quickFieldPrioritySchema });
|
|
25524
|
-
const blockCategoryEnum = z.enum([
|
|
25525
|
-
"marketing",
|
|
25526
|
-
"content",
|
|
25527
|
-
"blog",
|
|
25528
|
-
"media",
|
|
25529
|
-
"layout",
|
|
25530
|
-
"interactive"
|
|
25531
|
-
]);
|
|
25532
|
-
const blockContentSourceSchema = z.object({
|
|
25533
|
-
kind: z.enum([
|
|
25534
|
-
"inline",
|
|
25535
|
-
"entries",
|
|
25536
|
-
"mixed"
|
|
25537
|
-
]),
|
|
25538
|
-
contentType: z.string().min(1).optional()
|
|
25539
|
-
}).superRefine((value, ctx) => {
|
|
25540
|
-
if (value.kind === "inline" && value.contentType) ctx.addIssue({
|
|
25541
|
-
code: z.ZodIssueCode.custom,
|
|
25542
|
-
path: ["contentType"],
|
|
25543
|
-
message: "contentType is not allowed when contentSource.kind is \"inline\""
|
|
25544
|
-
});
|
|
25545
|
-
});
|
|
25546
|
-
z.object({
|
|
25547
|
-
name: z.string().min(1),
|
|
25548
|
-
version: z.string().min(1),
|
|
25549
|
-
title: z.string().min(1),
|
|
25550
|
-
titleSource: z.union([z.string().min(1), z.array(z.string().min(1)).min(1)]).optional(),
|
|
25551
|
-
description: z.string().optional(),
|
|
25552
|
-
component: z.string().min(1),
|
|
25553
|
-
fields: fieldSchema.array().default([]),
|
|
25554
|
-
slots: slotSchema.array().default([]),
|
|
25555
|
-
styleTokens: styleTokenSchema.optional(),
|
|
25556
|
-
behaviours: behaviourSchema.optional(),
|
|
25557
|
-
previewCustomize: previewCustomizeManifestCurationSchema.optional(),
|
|
25558
|
-
layout: NodeTreeSchema.optional(),
|
|
25559
|
-
/**
|
|
25560
|
-
* Optional list of nested field paths that should be surfaced in the main form body
|
|
25561
|
-
* as "shortcuts" (render-only). These paths should refer to existing data within the
|
|
25562
|
-
* block content object (e.g. `_sectionStyles.background.image`).
|
|
25563
|
-
*
|
|
25564
|
-
* The original fields remain available in settings for power users.
|
|
25565
|
-
*/
|
|
25566
|
-
promotedFields: z.array(z.string().min(1)).optional(),
|
|
25567
|
-
variantMeaning: z.discriminatedUnion("kind", [z.object({
|
|
25568
|
-
kind: z.literal("arrangement"),
|
|
25569
|
-
lookOnlyKeys: z.array(z.string().min(1)).readonly().optional()
|
|
25570
|
-
}), z.object({
|
|
25571
|
-
kind: z.literal("mode"),
|
|
25572
|
-
arrangementField: z.string().min(1),
|
|
25573
|
-
keys: z.array(z.string().min(1)).min(1).readonly(),
|
|
25574
|
-
defaultKey: z.string().min(1),
|
|
25575
|
-
lookOnlyKeys: z.array(z.string().min(1)).readonly().optional(),
|
|
25576
|
-
modeLabels: z.record(z.string(), z.string().min(1)).readonly().optional()
|
|
25577
|
-
})]),
|
|
25578
|
-
variants: z.record(z.string(), NodeTreeSchema).optional(),
|
|
25579
|
-
defaultVariant: z.string().optional(),
|
|
25580
|
-
variantOptions: z.record(z.string(), z.object({
|
|
25581
|
-
label: z.string().optional(),
|
|
25582
|
-
description: z.string().optional(),
|
|
25583
|
-
icon: z.string().optional()
|
|
25584
|
-
}).optional()).optional(),
|
|
25585
|
-
category: blockCategoryEnum.optional(),
|
|
25586
|
-
contentTypes: z.array(z.string()).optional(),
|
|
25587
|
-
/**
|
|
25588
|
-
* Explicit content-source classification (inline / entries / mixed). Optional at the
|
|
25589
|
-
* schema level for backward compatibility with SDK-defined custom blocks, but every
|
|
25590
|
-
* registered SYSTEM block must declare it (enforced by a registry-wide test).
|
|
25591
|
-
*/
|
|
25592
|
-
contentSource: blockContentSourceSchema.optional(),
|
|
25593
|
-
tags: z.array(z.string()).optional(),
|
|
25594
|
-
icon: z.string().optional()
|
|
25595
|
-
});
|
|
25596
|
-
//#endregion
|
|
25597
|
-
//#region ../blocks/src/system/fragments/types.ts
|
|
25598
|
-
const FRAGMENT_ID_PATTERN = /^[a-z0-9](?:[a-z0-9._-]*[a-z0-9])?$/i;
|
|
25599
|
-
const dataLoaderSchema = z.object({
|
|
25600
|
-
endpoint: z.string().min(1, "Fragment data loader requires an endpoint"),
|
|
25601
|
-
params: z.record(z.string(), z.unknown()).default({}),
|
|
25602
|
-
requiredParams: z.array(z.string().min(1)).optional(),
|
|
25603
|
-
mode: z.enum(["server", "client"]).default("server")
|
|
25604
|
-
});
|
|
25605
|
-
const fragmentDataSchema = z.object({
|
|
25606
|
-
key: z.string().min(1, "Fragment data key is required"),
|
|
25607
|
-
loader: dataLoaderSchema.optional()
|
|
25608
|
-
});
|
|
25609
|
-
z.object({
|
|
25610
|
-
id: z.string().min(1, "Fragment id is required").regex(FRAGMENT_ID_PATTERN, "Fragment id must be alphanumeric with optional . _ - separators"),
|
|
25611
|
-
title: z.string().optional(),
|
|
25612
|
-
description: z.string().optional(),
|
|
25613
|
-
category: z.enum([
|
|
25614
|
-
"content",
|
|
25615
|
-
"media",
|
|
25616
|
-
"interactive",
|
|
25617
|
-
"layout"
|
|
25618
|
-
]).optional(),
|
|
25619
|
-
icon: z.string().optional(),
|
|
25620
|
-
fields: fieldSchema.array().default([]),
|
|
25621
|
-
layout: z.union([NodeSchema, NodeSchema.array()]).transform((value) => Array.isArray(value) ? value : [value]),
|
|
25622
|
-
data: fragmentDataSchema.optional()
|
|
25623
|
-
});
|
|
25624
|
-
function scopeFragmentFields(fragment, scope) {
|
|
25625
|
-
const normalizedScope = scope.trim();
|
|
25626
|
-
if (!normalizedScope) return fragment.fields.map((field) => cloneFieldDefinition$1(field));
|
|
25627
|
-
return fragment.fields.map((field) => prefixFieldId(field, normalizedScope));
|
|
25628
|
-
}
|
|
25629
|
-
function scopeFragmentLayout(fragment, scope) {
|
|
25630
|
-
const normalizedScope = scope.trim();
|
|
25631
|
-
return fragment.layout.map((node) => cloneAndScopeNode(node, normalizedScope));
|
|
25632
|
-
}
|
|
25633
|
-
function prefixFieldId(field, scope) {
|
|
25634
|
-
const cloned = cloneFieldDefinition$1(field);
|
|
25635
|
-
cloned.id = `${scope}.${field.id}`;
|
|
25636
|
-
const defaultValue = cloned.defaultValue;
|
|
25637
|
-
cloned.defaultValue = cloneUnknown(defaultValue);
|
|
25638
|
-
cloned.visibleRoles = cloned.visibleRoles ? [...cloned.visibleRoles] : void 0;
|
|
25639
|
-
cloned.ui = cloneUnknown(cloned.ui);
|
|
25640
|
-
return cloned;
|
|
25641
|
-
}
|
|
25642
|
-
function cloneFieldDefinition$1(field) {
|
|
25643
|
-
if (field.type === "repeater") {
|
|
25644
|
-
if (field.polymorphic && field.itemTypes) return {
|
|
25645
|
-
...field,
|
|
25646
|
-
polymorphic: true,
|
|
25647
|
-
itemTypes: Object.fromEntries(Object.entries(field.itemTypes).map(([key, itemType]) => [key, {
|
|
25648
|
-
...itemType,
|
|
25649
|
-
fields: itemType.fields.map(cloneFieldDefinition$1)
|
|
25650
|
-
}]))
|
|
25651
|
-
};
|
|
25652
|
-
if (field.schema) return {
|
|
25653
|
-
...field,
|
|
25654
|
-
schema: { fields: field.schema.fields.map(cloneFieldDefinition$1) }
|
|
25655
|
-
};
|
|
25656
|
-
return { ...field };
|
|
25657
|
-
}
|
|
25658
|
-
if (field.type === "group") return {
|
|
25659
|
-
...field,
|
|
25660
|
-
schema: { fields: field.schema.fields.map(cloneFieldDefinition$1) }
|
|
25661
|
-
};
|
|
25662
|
-
return { ...field };
|
|
25663
|
-
}
|
|
25664
|
-
function cloneUnknown(value) {
|
|
25665
|
-
if (value == null || typeof value !== "object") return value;
|
|
25666
|
-
if (Array.isArray(value)) return value.map((entry) => cloneUnknown(entry));
|
|
25667
|
-
return { ...value };
|
|
25668
|
-
}
|
|
25669
|
-
function cloneAndScopeNode(node, scope) {
|
|
25670
|
-
const cloned = { ...node };
|
|
25671
|
-
if (node.children) cloned.children = node.children.map((child) => cloneAndScopeNode(child, scope));
|
|
25672
|
-
if (node.props) cloned.props = scopePropBindings(node.props, scope);
|
|
25673
|
-
if (node.$bind) cloned.$bind = scopeBinding(node.$bind, scope);
|
|
25674
|
-
if (node.$repeat) cloned.$repeat = scopeRepeat(node.$repeat, scope);
|
|
25675
|
-
if (node.$when) cloned.$when = scopeCondition(node.$when, scope);
|
|
25676
|
-
if (node.$scopes) cloned.$scopes = node.$scopes.map((entry) => ({
|
|
25677
|
-
name: entry.name,
|
|
25678
|
-
from: scopeBinding(entry.from, scope)
|
|
25679
|
-
}));
|
|
25680
|
-
return cloned;
|
|
25681
|
-
}
|
|
25682
|
-
function scopeBinding(binding, scope) {
|
|
25683
|
-
const cloned = {
|
|
25684
|
-
...binding,
|
|
25685
|
-
transforms: binding.transforms?.map((step) => ({ ...step })) ?? []
|
|
25686
|
-
};
|
|
25687
|
-
cloned.from = scopeContentPath(binding.from, scope);
|
|
25688
|
-
return cloned;
|
|
25689
|
-
}
|
|
25690
|
-
function scopeRepeat(repeat, scope) {
|
|
25691
|
-
const cloned = {
|
|
25692
|
-
...repeat,
|
|
25693
|
-
collection: scopeBinding(repeat.collection, scope)
|
|
25694
|
-
};
|
|
25695
|
-
if (repeat.sortBy) cloned.sortBy = {
|
|
25696
|
-
...repeat.sortBy,
|
|
25697
|
-
path: scopeContentPath(repeat.sortBy.path, scope)
|
|
25698
|
-
};
|
|
25699
|
-
return cloned;
|
|
25700
|
-
}
|
|
25701
|
-
function scopeCondition(condition, scope) {
|
|
25702
|
-
return {
|
|
25703
|
-
...condition,
|
|
25704
|
-
when: scopeBinding(condition.when, scope)
|
|
25705
|
-
};
|
|
25706
|
-
}
|
|
25707
|
-
function scopePropBindings(input, scope) {
|
|
25708
|
-
const result = {};
|
|
25709
|
-
for (const [key, value] of Object.entries(input)) result[key] = scopePropValue(value, scope);
|
|
25710
|
-
return result;
|
|
25711
|
-
}
|
|
25712
|
-
function scopePropValue(value, scope) {
|
|
25713
|
-
if (Array.isArray(value)) return value.map((entry) => scopePropValue(entry, scope));
|
|
25714
|
-
if (value && typeof value === "object") {
|
|
25715
|
-
if ("$bind" in value) {
|
|
25716
|
-
const bindingConfig = value.$bind;
|
|
25717
|
-
return { $bind: scopeBinding(bindingConfig, scope) };
|
|
25718
|
-
}
|
|
25719
|
-
const result = {};
|
|
25720
|
-
for (const [key, entry] of Object.entries(value)) result[key] = scopePropValue(entry, scope);
|
|
25721
|
-
return result;
|
|
25722
|
-
}
|
|
25723
|
-
return value;
|
|
25724
|
-
}
|
|
25725
|
-
function scopeContentPath(path, scope) {
|
|
25726
|
-
if (!scope || scope.length === 0) return path;
|
|
25727
|
-
if (path === "content") return `content.${scope}`;
|
|
25728
|
-
if (path.startsWith("content.")) {
|
|
25729
|
-
const remainder = path.slice(8);
|
|
25730
|
-
return remainder.length > 0 ? `content.${scope}.${remainder}` : `content.${scope}`;
|
|
25731
|
-
}
|
|
25732
|
-
if (path.startsWith("content[")) return path.replace(/^content/, `content.${scope}`);
|
|
25733
|
-
if (path.startsWith("$root.")) return path;
|
|
25734
|
-
if (path.includes(".")) return path;
|
|
25735
|
-
return `content.${scope}.${path}`;
|
|
25736
|
-
}
|
|
25737
|
-
//#endregion
|
|
25738
|
-
//#region ../blocks/src/system/fragments/builder.ts
|
|
25739
|
-
var FragmentCompositionError = class extends Error {
|
|
25740
|
-
constructor(message) {
|
|
25741
|
-
super(message);
|
|
25742
|
-
this.name = "FragmentCompositionError";
|
|
25743
|
-
}
|
|
25744
|
-
};
|
|
25745
|
-
const DOT_SCOPE_REGEX = /^[A-Za-z0-9_.-]*$/;
|
|
25746
|
-
function materializeFragment(config) {
|
|
25747
|
-
const scope = normalizeScope(config.scope);
|
|
25748
|
-
const fields = scopeFragmentFields(config.fragment, scope);
|
|
25749
|
-
const layout = scopeFragmentLayout(config.fragment, scope);
|
|
25750
|
-
const fieldPriority = config.fieldPriority ?? 0;
|
|
25751
|
-
let data;
|
|
25752
|
-
if (config.fragment.data) {
|
|
25753
|
-
const key = config.dataKey ?? config.fragment.data.key;
|
|
25754
|
-
if (!key || typeof key !== "string") throw new FragmentCompositionError(`Fragment "${config.fragment.id}" requires a data key to compose.`);
|
|
25755
|
-
data = {
|
|
25756
|
-
key,
|
|
25757
|
-
loader: config.fragment.data.loader ? { ...config.fragment.data.loader } : void 0
|
|
25758
|
-
};
|
|
25759
|
-
}
|
|
25760
|
-
return {
|
|
25761
|
-
fragment: config.fragment,
|
|
25762
|
-
scope,
|
|
25763
|
-
fields,
|
|
25764
|
-
layout,
|
|
25765
|
-
data,
|
|
25766
|
-
fieldPriority
|
|
25767
|
-
};
|
|
25768
|
-
}
|
|
25769
|
-
function composeFragments(instances) {
|
|
25770
|
-
const fieldEntries = [];
|
|
25771
|
-
const layouts = [];
|
|
25772
|
-
const dataEntries = [];
|
|
25773
|
-
const scopes = [];
|
|
25774
|
-
const seenFieldIds = /* @__PURE__ */ new Set();
|
|
25775
|
-
let fieldOrder = 0;
|
|
25776
|
-
for (const instance of instances) {
|
|
25777
|
-
const materialized = materializeFragment(instance);
|
|
25778
|
-
for (const field of materialized.fields) {
|
|
25779
|
-
if (seenFieldIds.has(field.id)) throw new FragmentCompositionError(`Duplicate field id "${field.id}" when composing fragments.`);
|
|
25780
|
-
seenFieldIds.add(field.id);
|
|
25781
|
-
fieldEntries.push({
|
|
25782
|
-
id: field.id,
|
|
25783
|
-
field,
|
|
25784
|
-
priority: materialized.fieldPriority,
|
|
25785
|
-
order: fieldOrder++
|
|
25786
|
-
});
|
|
25787
|
-
}
|
|
25788
|
-
scopes.push(materialized.scope);
|
|
25789
|
-
layouts.push(...materialized.layout);
|
|
25790
|
-
if (materialized.data) {
|
|
25791
|
-
if (dataEntries.find((entry) => entry.key === materialized.data?.key)) throw new FragmentCompositionError(`Duplicate fragment data key "${materialized.data.key}" detected.`);
|
|
25792
|
-
dataEntries.push(materialized.data);
|
|
25793
|
-
}
|
|
25794
|
-
}
|
|
25795
|
-
return {
|
|
25796
|
-
fields: fieldEntries.sort((a, b) => {
|
|
25797
|
-
if (a.priority !== b.priority) return a.priority - b.priority;
|
|
25798
|
-
return a.order - b.order;
|
|
25799
|
-
}).map((entry) => entry.field),
|
|
25800
|
-
layout: layouts,
|
|
25801
|
-
data: dataEntries,
|
|
25802
|
-
scopes
|
|
25803
|
-
};
|
|
25804
|
-
}
|
|
25805
|
-
function normalizeScope(scope) {
|
|
25806
|
-
if (!scope) return "";
|
|
25807
|
-
const trimmed = scope.trim();
|
|
25808
|
-
if (!DOT_SCOPE_REGEX.test(trimmed)) throw new FragmentCompositionError(`Fragment scope "${scope}" contains invalid characters. Use alphanumeric, ".", "-", or "_".`);
|
|
25809
|
-
return trimmed;
|
|
25810
|
-
}
|
|
25811
|
-
//#endregion
|
|
25812
|
-
//#region ../blocks/src/system/constants/background.ts
|
|
25813
|
-
/**
|
|
25814
|
-
* @file Defines constants for the background field, ensuring a single source of truth
|
|
25815
|
-
* for presets used in both the field definition and the style transforms.
|
|
25816
|
-
*/
|
|
25817
|
-
const BACKGROUND_POSITION_PRESETS = [
|
|
25818
|
-
{
|
|
25819
|
-
value: "center",
|
|
25820
|
-
label: "Center"
|
|
25821
|
-
},
|
|
25822
|
-
{
|
|
25823
|
-
value: "top",
|
|
25824
|
-
label: "Top"
|
|
25825
|
-
},
|
|
25826
|
-
{
|
|
25827
|
-
value: "top left",
|
|
25828
|
-
label: "Top Left"
|
|
25829
|
-
},
|
|
25830
|
-
{
|
|
25831
|
-
value: "top right",
|
|
25832
|
-
label: "Top Right"
|
|
25833
|
-
},
|
|
25834
|
-
{
|
|
25835
|
-
value: "bottom",
|
|
25836
|
-
label: "Bottom"
|
|
25837
|
-
},
|
|
25838
|
-
{
|
|
25839
|
-
value: "bottom left",
|
|
25840
|
-
label: "Bottom Left"
|
|
25841
|
-
},
|
|
25842
|
-
{
|
|
25843
|
-
value: "bottom right",
|
|
25844
|
-
label: "Bottom Right"
|
|
25845
|
-
},
|
|
25846
|
-
{
|
|
25847
|
-
value: "left",
|
|
25848
|
-
label: "Left"
|
|
25849
|
-
},
|
|
25850
|
-
{
|
|
25851
|
-
value: "right",
|
|
25852
|
-
label: "Right"
|
|
25853
|
-
},
|
|
25854
|
-
{
|
|
25855
|
-
value: "top center",
|
|
25856
|
-
label: "Top Center"
|
|
25857
|
-
},
|
|
25858
|
-
{
|
|
25859
|
-
value: "bottom center",
|
|
25860
|
-
label: "Bottom Center"
|
|
25861
|
-
},
|
|
25862
|
-
{
|
|
25863
|
-
value: "left center",
|
|
25864
|
-
label: "Left Center"
|
|
25865
|
-
},
|
|
25866
|
-
{
|
|
25867
|
-
value: "right center",
|
|
25868
|
-
label: "Right Center"
|
|
25869
|
-
},
|
|
25870
|
-
{
|
|
25871
|
-
value: "left top",
|
|
25872
|
-
label: "Left Top"
|
|
25873
|
-
},
|
|
25874
|
-
{
|
|
25875
|
-
value: "right top",
|
|
25876
|
-
label: "Right Top"
|
|
25877
|
-
},
|
|
25878
|
-
{
|
|
25879
|
-
value: "left bottom",
|
|
25880
|
-
label: "Left Bottom"
|
|
25881
|
-
},
|
|
25882
|
-
{
|
|
25883
|
-
value: "right bottom",
|
|
25884
|
-
label: "Right Bottom"
|
|
25885
|
-
}
|
|
25886
|
-
];
|
|
25887
|
-
BACKGROUND_POSITION_PRESETS.map((p) => p.value);
|
|
25888
|
-
//#endregion
|
|
25889
|
-
//#region ../blocks/src/system/fields/background.ts
|
|
25890
|
-
/**
|
|
25891
|
-
* Widget name constants for background fields.
|
|
25892
|
-
*
|
|
25893
|
-
* These match the keys expected in widgetOverrides.
|
|
25894
|
-
*
|
|
25895
|
-
* IMPORTANT: These values MUST match WIDGET_NAMES in:
|
|
25896
|
-
* `packages/block-form/src/widgets/constants.ts`
|
|
25897
|
-
*
|
|
25898
|
-
* Duplicated here to avoid circular dependency (blocks cannot import block-form).
|
|
25899
|
-
*/
|
|
25900
|
-
const BACKGROUND_WIDGETS = {
|
|
25901
|
-
COLOR: "backgroundColor",
|
|
25902
|
-
GRADIENT: "backgroundGradient"
|
|
25903
|
-
};
|
|
25904
|
-
const BACKGROUND_MEDIA_FIELD_ID = "image";
|
|
25905
|
-
function cloneFieldDefinition(field) {
|
|
25906
|
-
return {
|
|
25907
|
-
...field,
|
|
25908
|
-
...field.ui ? { ui: { ...field.ui } } : {}
|
|
25909
|
-
};
|
|
25910
|
-
}
|
|
25911
|
-
function mediaTabDescription(kind, includeAdvanced) {
|
|
25912
|
-
return includeAdvanced ? `Background ${kind} with advanced controls` : `Background ${kind}`;
|
|
25913
|
-
}
|
|
25914
|
-
/**
|
|
25915
|
-
* Creates a TabGroupField for background configuration
|
|
25916
|
-
* with Color/Gradient/Image tabs and advanced media options.
|
|
25917
|
-
*
|
|
25918
|
-
* ## Data Structure
|
|
25919
|
-
*
|
|
25920
|
-
* This factory sets `activeTabField: 'type'`. The 'type' field is NOT explicitly
|
|
25921
|
-
* declared but is managed implicitly by TabGroupField. When the user switches tabs,
|
|
25922
|
-
* the widget writes the tab ID to the path `{id}.type`.
|
|
25923
|
-
*
|
|
25924
|
-
* Persistence projects the selected tab into the canonical discriminated
|
|
25925
|
-
* `BackgroundContent` union. Fields owned by inactive tabs are not stored.
|
|
25926
|
-
*
|
|
25927
|
-
* ## SDK Filtering
|
|
25928
|
-
*
|
|
25929
|
-
* Each tab has an `sdkSectionOption` that allows SDK sites to control tab visibility:
|
|
25930
|
-
* - `backgroundColor` - Controls Color tab
|
|
25931
|
-
* - `backgroundGradient` - Controls Gradient tab
|
|
25932
|
-
* - `backgroundImage` - Controls Image tab
|
|
25933
|
-
*
|
|
25934
|
-
* @param options - Configuration options
|
|
25935
|
-
* @param options.id - Field ID (default: 'background')
|
|
25936
|
-
* @param options.label - Field label (default: 'Background')
|
|
25937
|
-
* @param options.allowColor - Include Color tab (default: true)
|
|
25938
|
-
* @param options.allowGradient - Include Gradient tab (default: true)
|
|
25939
|
-
* @param options.allowImage - Include Image tab (default: true)
|
|
25940
|
-
* @param options.includeAdvanced - Include advanced image/video options (default: false)
|
|
25941
|
-
*/
|
|
25942
|
-
function createBackgroundField(options = {}) {
|
|
25943
|
-
const { id = "background", label = "Background", allowColor = true, allowGradient = true, allowImage = true, includeAdvanced = false } = options;
|
|
25944
|
-
const tabs = [];
|
|
25945
|
-
const textColorField = {
|
|
25946
|
-
id: "textColor",
|
|
25947
|
-
type: "text",
|
|
25948
|
-
label: "Text color",
|
|
25949
|
-
description: "Optional text color token to use on top of this background.",
|
|
25950
|
-
required: false,
|
|
25951
|
-
multiline: false,
|
|
25952
|
-
ui: { widget: BACKGROUND_WIDGETS.COLOR }
|
|
25953
|
-
};
|
|
25954
|
-
const headingColorField = {
|
|
25955
|
-
id: "headingColor",
|
|
25956
|
-
type: "text",
|
|
25957
|
-
label: "Heading color",
|
|
25958
|
-
description: "Optional color token for headings. Falls back to text color if not set.",
|
|
25959
|
-
required: false,
|
|
25960
|
-
multiline: false,
|
|
25961
|
-
ui: { widget: BACKGROUND_WIDGETS.COLOR }
|
|
25962
|
-
};
|
|
25963
|
-
if (allowColor) tabs.push({
|
|
25964
|
-
id: "color",
|
|
25965
|
-
label: "Color",
|
|
25966
|
-
description: "Solid color background using theme tokens or custom colors",
|
|
25967
|
-
sdkSectionOption: "backgroundColor",
|
|
25968
|
-
fields: [
|
|
25969
|
-
{
|
|
25970
|
-
id: "color",
|
|
25971
|
-
type: "text",
|
|
25972
|
-
label: "Color",
|
|
25973
|
-
description: "Select a background color from the available options.",
|
|
25974
|
-
required: false,
|
|
25975
|
-
multiline: false,
|
|
25976
|
-
ui: { widget: BACKGROUND_WIDGETS.COLOR }
|
|
25977
|
-
},
|
|
25978
|
-
textColorField,
|
|
25979
|
-
headingColorField
|
|
25980
|
-
]
|
|
25981
|
-
});
|
|
25982
|
-
if (allowGradient) tabs.push({
|
|
25983
|
-
id: "gradient",
|
|
25984
|
-
label: "Gradient",
|
|
25985
|
-
description: "CSS gradient background",
|
|
25986
|
-
sdkSectionOption: "backgroundGradient",
|
|
25987
|
-
fields: [
|
|
25988
|
-
{
|
|
25989
|
-
id: "gradient",
|
|
25990
|
-
type: "text",
|
|
25991
|
-
label: "Gradient",
|
|
25992
|
-
description: "Select a gradient from theme presets.",
|
|
25993
|
-
required: false,
|
|
25994
|
-
multiline: false,
|
|
25995
|
-
ui: { widget: BACKGROUND_WIDGETS.GRADIENT }
|
|
25996
|
-
},
|
|
25997
|
-
textColorField,
|
|
25998
|
-
headingColorField
|
|
25999
|
-
]
|
|
26000
|
-
});
|
|
26001
|
-
if (allowImage) {
|
|
26002
|
-
const mediaFields = [
|
|
26003
|
-
{
|
|
26004
|
-
id: BACKGROUND_MEDIA_FIELD_ID,
|
|
26005
|
-
type: "media",
|
|
26006
|
-
label: "Image",
|
|
26007
|
-
mediaKinds: ["image"],
|
|
26008
|
-
required: false
|
|
26009
|
-
},
|
|
26010
|
-
textColorField,
|
|
26011
|
-
headingColorField
|
|
26012
|
-
];
|
|
26013
|
-
if (includeAdvanced) {
|
|
26014
|
-
const objectFitField = {
|
|
26015
|
-
id: "objectFit",
|
|
26016
|
-
type: "select",
|
|
26017
|
-
label: "Media sizing",
|
|
26018
|
-
description: "How the image or video should be sized and positioned.",
|
|
26019
|
-
required: false,
|
|
26020
|
-
multiple: false,
|
|
26021
|
-
options: [
|
|
26022
|
-
{
|
|
26023
|
-
value: "fill",
|
|
26024
|
-
label: "Fill (cover)"
|
|
26025
|
-
},
|
|
26026
|
-
{
|
|
26027
|
-
value: "fit",
|
|
26028
|
-
label: "Fit (contain)"
|
|
26029
|
-
},
|
|
26030
|
-
{
|
|
26031
|
-
value: "original",
|
|
26032
|
-
label: "Original size"
|
|
26033
|
-
},
|
|
26034
|
-
{
|
|
26035
|
-
value: "custom",
|
|
26036
|
-
label: "Scale up"
|
|
26037
|
-
}
|
|
26038
|
-
]
|
|
26039
|
-
};
|
|
26040
|
-
const scaleField = {
|
|
26041
|
-
id: "scale",
|
|
26042
|
-
type: "presetOrCustom",
|
|
26043
|
-
label: "Scale",
|
|
26044
|
-
description: "Media scale amount.",
|
|
26045
|
-
required: false,
|
|
26046
|
-
ui: { visibleWhen: {
|
|
26047
|
-
field: "objectFit",
|
|
26048
|
-
equals: "custom"
|
|
26049
|
-
} },
|
|
26050
|
-
presets: [
|
|
26051
|
-
{
|
|
26052
|
-
value: "125",
|
|
26053
|
-
label: "125%"
|
|
26054
|
-
},
|
|
26055
|
-
{
|
|
26056
|
-
value: "150",
|
|
26057
|
-
label: "150%"
|
|
26058
|
-
},
|
|
26059
|
-
{
|
|
26060
|
-
value: "175",
|
|
26061
|
-
label: "175%"
|
|
26062
|
-
},
|
|
26063
|
-
{
|
|
26064
|
-
value: "200",
|
|
26065
|
-
label: "200%"
|
|
26066
|
-
}
|
|
26067
|
-
],
|
|
26068
|
-
customInput: {
|
|
26069
|
-
placeholder: "e.g., 800px, 50vw, 175%",
|
|
26070
|
-
helpText: "Enter a custom size using %, px, vh, vw, rem, or em units"
|
|
26071
|
-
}
|
|
26072
|
-
};
|
|
26073
|
-
const positionField = {
|
|
26074
|
-
id: "position",
|
|
26075
|
-
type: "presetOrCustom",
|
|
26076
|
-
label: "Position",
|
|
26077
|
-
description: "Anchor point for scaled media. For \"Fill\" mode, the media focus point (if set) takes precedence.",
|
|
26078
|
-
required: false,
|
|
26079
|
-
presets: [...BACKGROUND_POSITION_PRESETS],
|
|
26080
|
-
customInput: {
|
|
26081
|
-
placeholder: "e.g., 25% 75%, top 20px left 50px",
|
|
26082
|
-
helpText: "Enter a custom CSS background-position value"
|
|
26083
|
-
}
|
|
26084
|
-
};
|
|
26085
|
-
const opacityField = {
|
|
26086
|
-
id: "opacity",
|
|
26087
|
-
type: "number",
|
|
26088
|
-
label: "Opacity",
|
|
26089
|
-
description: "Image or video opacity (0-100).",
|
|
26090
|
-
required: false,
|
|
26091
|
-
ui: {
|
|
26092
|
-
widget: "slider",
|
|
26093
|
-
min: 0,
|
|
26094
|
-
max: 100,
|
|
26095
|
-
step: 5
|
|
26096
|
-
}
|
|
26097
|
-
};
|
|
26098
|
-
const overlayTypeField = {
|
|
26099
|
-
id: "overlay.type",
|
|
26100
|
-
type: "select",
|
|
26101
|
-
label: "Overlay",
|
|
26102
|
-
description: "Add a color or gradient overlay on top of the image or video.",
|
|
26103
|
-
required: false,
|
|
26104
|
-
multiple: false,
|
|
26105
|
-
options: [
|
|
26106
|
-
{
|
|
26107
|
-
value: "none",
|
|
26108
|
-
label: "None"
|
|
26109
|
-
},
|
|
26110
|
-
{
|
|
26111
|
-
value: "color",
|
|
26112
|
-
label: "Color"
|
|
26113
|
-
},
|
|
26114
|
-
{
|
|
26115
|
-
value: "gradient",
|
|
26116
|
-
label: "Gradient"
|
|
26117
|
-
}
|
|
26118
|
-
]
|
|
26119
|
-
};
|
|
26120
|
-
const overlayColorField = {
|
|
26121
|
-
id: "overlay.color",
|
|
26122
|
-
type: "text",
|
|
26123
|
-
label: "Overlay color",
|
|
26124
|
-
required: false,
|
|
26125
|
-
multiline: false,
|
|
26126
|
-
ui: {
|
|
26127
|
-
widget: BACKGROUND_WIDGETS.COLOR,
|
|
26128
|
-
visibleWhen: {
|
|
26129
|
-
field: "type",
|
|
26130
|
-
equals: "color"
|
|
26131
|
-
}
|
|
26132
|
-
}
|
|
26133
|
-
};
|
|
26134
|
-
const overlayGradientField = {
|
|
26135
|
-
id: "overlay.gradient",
|
|
26136
|
-
type: "text",
|
|
26137
|
-
label: "Overlay gradient",
|
|
26138
|
-
required: false,
|
|
26139
|
-
multiline: false,
|
|
26140
|
-
ui: {
|
|
26141
|
-
widget: BACKGROUND_WIDGETS.GRADIENT,
|
|
26142
|
-
visibleWhen: {
|
|
26143
|
-
field: "type",
|
|
26144
|
-
equals: "gradient"
|
|
26145
|
-
}
|
|
26146
|
-
}
|
|
26147
|
-
};
|
|
26148
|
-
mediaFields.push(objectFitField, scaleField, positionField, opacityField, overlayTypeField, overlayColorField, overlayGradientField, {
|
|
26149
|
-
id: "overlay.opacity",
|
|
26150
|
-
type: "number",
|
|
26151
|
-
label: "Overlay opacity",
|
|
26152
|
-
description: "Overlay opacity (0-100).",
|
|
26153
|
-
required: false,
|
|
26154
|
-
ui: {
|
|
26155
|
-
widget: "slider",
|
|
26156
|
-
min: 0,
|
|
26157
|
-
max: 100,
|
|
26158
|
-
step: 5,
|
|
26159
|
-
visibleWhen: {
|
|
26160
|
-
field: "type",
|
|
26161
|
-
oneOf: ["color", "gradient"]
|
|
26162
|
-
}
|
|
26163
|
-
}
|
|
26164
|
-
});
|
|
26165
|
-
}
|
|
26166
|
-
tabs.push({
|
|
26167
|
-
id: "image",
|
|
26168
|
-
label: "Image",
|
|
26169
|
-
description: mediaTabDescription("image", includeAdvanced),
|
|
26170
|
-
sdkSectionOption: "backgroundImage",
|
|
26171
|
-
fields: mediaFields
|
|
26172
|
-
});
|
|
26173
|
-
const videoFields = mediaFields.map((field) => {
|
|
26174
|
-
const clonedField = cloneFieldDefinition(field);
|
|
26175
|
-
if (clonedField.id !== BACKGROUND_MEDIA_FIELD_ID) return clonedField;
|
|
26176
|
-
return {
|
|
26177
|
-
...clonedField,
|
|
26178
|
-
label: "Video",
|
|
26179
|
-
mediaKinds: ["video"]
|
|
26180
|
-
};
|
|
26181
|
-
});
|
|
26182
|
-
videoFields.splice(1, 0, {
|
|
26183
|
-
id: "showVideoOnMobile",
|
|
26184
|
-
type: "boolean",
|
|
26185
|
-
label: "Show video on mobile",
|
|
26186
|
-
description: "Off by default so mobile visitors see the fallback background instead of autoplay video.",
|
|
26187
|
-
required: false,
|
|
26188
|
-
defaultValue: false
|
|
26189
|
-
});
|
|
26190
|
-
tabs.push({
|
|
26191
|
-
id: "video",
|
|
26192
|
-
label: "Video",
|
|
26193
|
-
description: mediaTabDescription("video", includeAdvanced),
|
|
26194
|
-
sdkSectionOption: "backgroundImage",
|
|
26195
|
-
fields: videoFields
|
|
26196
|
-
});
|
|
26197
|
-
}
|
|
26198
|
-
return {
|
|
26199
|
-
id,
|
|
26200
|
-
type: "tabGroup",
|
|
26201
|
-
label,
|
|
26202
|
-
required: false,
|
|
26203
|
-
tabs,
|
|
26204
|
-
activeTabField: "type",
|
|
26205
|
-
ui: {
|
|
26206
|
-
hideLabel: false,
|
|
26207
|
-
valueContract: "boxBackground"
|
|
26208
|
-
}
|
|
26209
|
-
};
|
|
26210
|
-
}
|
|
26211
|
-
//#endregion
|
|
26212
|
-
//#region ../blocks/src/system/fields/boxStyles.ts
|
|
26213
|
-
/**
|
|
26214
|
-
* Internal helper to create box styles with depth (container or card).
|
|
26215
|
-
*
|
|
26216
|
-
* Both containers and cards support:
|
|
26217
|
-
* - Background (color/gradient/image with advanced options)
|
|
26218
|
-
* - Inner spacing (padding)
|
|
26219
|
-
* - Raised (elevation shadow)
|
|
26220
|
-
* - Rounded corners (border radius)
|
|
26221
|
-
*
|
|
26222
|
-
* This function is used internally by `containerStylesField()` and `cardStylesField()`
|
|
26223
|
-
* to avoid code duplication while maintaining separate public APIs.
|
|
26224
|
-
*
|
|
26225
|
-
* @internal
|
|
26226
|
-
* @param type - Box style type discriminator ('container' or 'card')
|
|
26227
|
-
* @param options - Customization options passed from public field helpers
|
|
26228
|
-
* @returns A modal FieldDefinition with depth-specific fields
|
|
26229
|
-
*/
|
|
26230
|
-
function createBoxStylesFieldWithDepth(type, options = {}) {
|
|
26231
|
-
const defaults = {
|
|
26232
|
-
container: {
|
|
26233
|
-
id: "_containerStyles",
|
|
26234
|
-
label: "Container styles",
|
|
26235
|
-
contextName: "container"
|
|
26236
|
-
},
|
|
26237
|
-
card: {
|
|
26238
|
-
id: "_cardStyles",
|
|
26239
|
-
label: "Card styles",
|
|
26240
|
-
contextName: "card"
|
|
26241
|
-
}
|
|
26242
|
-
};
|
|
26243
|
-
const { id = defaults[type].id, label = defaults[type].label, includeBackground = true, renderInHeader, intent } = options;
|
|
26244
|
-
const contextName = defaults[type].contextName;
|
|
26245
|
-
const fields = [];
|
|
26246
|
-
if (includeBackground) fields.push(createBackgroundField({
|
|
26247
|
-
id: "background",
|
|
26248
|
-
label: "Background",
|
|
26249
|
-
allowColor: true,
|
|
26250
|
-
allowGradient: true,
|
|
26251
|
-
allowImage: true,
|
|
26252
|
-
includeAdvanced: true
|
|
26253
|
-
}));
|
|
26254
|
-
fields.push({
|
|
26255
|
-
id: "spacing",
|
|
26256
|
-
type: "select",
|
|
26257
|
-
label: "Inner spacing",
|
|
26258
|
-
description: `Padding for the ${contextName}.`,
|
|
26259
|
-
required: false,
|
|
26260
|
-
multiple: false,
|
|
26261
|
-
options: [
|
|
26262
|
-
{
|
|
26263
|
-
value: "none",
|
|
26264
|
-
label: "None"
|
|
26265
|
-
},
|
|
26266
|
-
{
|
|
26267
|
-
value: "compact",
|
|
26268
|
-
label: "Compact"
|
|
26269
|
-
},
|
|
26270
|
-
{
|
|
26271
|
-
value: "cozy",
|
|
26272
|
-
label: "Cozy"
|
|
26273
|
-
},
|
|
26274
|
-
{
|
|
26275
|
-
value: "medium",
|
|
26276
|
-
label: "Medium"
|
|
26277
|
-
},
|
|
26278
|
-
{
|
|
26279
|
-
value: "comfortable",
|
|
26280
|
-
label: "Comfortable"
|
|
26281
|
-
},
|
|
26282
|
-
{
|
|
26283
|
-
value: "spacious",
|
|
26284
|
-
label: "Spacious"
|
|
26285
|
-
}
|
|
26286
|
-
]
|
|
26287
|
-
});
|
|
26288
|
-
if (type === "card") fields.push({
|
|
26289
|
-
id: "border",
|
|
26290
|
-
type: "group",
|
|
26291
|
-
label: "Border",
|
|
26292
|
-
required: false,
|
|
26293
|
-
schema: { fields: [
|
|
26294
|
-
{
|
|
26295
|
-
id: "enabled",
|
|
26296
|
-
type: "boolean",
|
|
26297
|
-
label: "Show border",
|
|
26298
|
-
description: "When unset, the card inherits its border from the block/theme defaults.",
|
|
26299
|
-
required: false
|
|
26300
|
-
},
|
|
26301
|
-
{
|
|
26302
|
-
id: "width",
|
|
26303
|
-
type: "select",
|
|
26304
|
-
label: "Border width",
|
|
26305
|
-
required: false,
|
|
26306
|
-
multiple: false,
|
|
26307
|
-
options: [
|
|
26308
|
-
{
|
|
26309
|
-
value: "none",
|
|
26310
|
-
label: "None"
|
|
26311
|
-
},
|
|
26312
|
-
{
|
|
26313
|
-
value: "1",
|
|
26314
|
-
label: "Thin (1px)"
|
|
26315
|
-
},
|
|
26316
|
-
{
|
|
26317
|
-
value: "2",
|
|
26318
|
-
label: "Medium (2px)"
|
|
26319
|
-
},
|
|
26320
|
-
{
|
|
26321
|
-
value: "3",
|
|
26322
|
-
label: "Thick (3px)"
|
|
26323
|
-
}
|
|
26324
|
-
],
|
|
26325
|
-
ui: { visibleWhen: {
|
|
26326
|
-
field: "enabled",
|
|
26327
|
-
equals: true
|
|
26328
|
-
} }
|
|
26329
|
-
},
|
|
26330
|
-
{
|
|
26331
|
-
id: "colorToken",
|
|
26332
|
-
type: "text",
|
|
26333
|
-
label: "Border color token",
|
|
26334
|
-
description: "Theme token for the border color (e.g. border, primary/30).",
|
|
26335
|
-
required: false,
|
|
26336
|
-
multiline: false,
|
|
26337
|
-
defaultValue: "border",
|
|
26338
|
-
ui: { visibleWhen: {
|
|
26339
|
-
field: "enabled",
|
|
26340
|
-
equals: true
|
|
26341
|
-
} }
|
|
26342
|
-
}
|
|
26343
|
-
] }
|
|
26344
|
-
});
|
|
26345
|
-
fields.push({
|
|
26346
|
-
id: "raised",
|
|
26347
|
-
type: "boolean",
|
|
26348
|
-
label: "Raised",
|
|
26349
|
-
description: `Add shadow depth to the ${contextName}.`,
|
|
26350
|
-
required: false
|
|
26351
|
-
});
|
|
26352
|
-
fields.push({
|
|
26353
|
-
id: "rounded",
|
|
26354
|
-
type: "select",
|
|
26355
|
-
label: "Rounded corners",
|
|
26356
|
-
description: "Border radius size.",
|
|
26357
|
-
required: false,
|
|
26358
|
-
multiple: false,
|
|
26359
|
-
options: [
|
|
26360
|
-
{
|
|
26361
|
-
value: "none",
|
|
26362
|
-
label: "None"
|
|
26363
|
-
},
|
|
26364
|
-
{
|
|
26365
|
-
value: "sm",
|
|
26366
|
-
label: "Small"
|
|
26367
|
-
},
|
|
26368
|
-
{
|
|
26369
|
-
value: "md",
|
|
26370
|
-
label: "Medium"
|
|
26371
|
-
},
|
|
26372
|
-
{
|
|
26373
|
-
value: "lg",
|
|
26374
|
-
label: "Large"
|
|
26375
|
-
},
|
|
26376
|
-
{
|
|
26377
|
-
value: "xl",
|
|
26378
|
-
label: "Extra Large"
|
|
26379
|
-
},
|
|
26380
|
-
{
|
|
26381
|
-
value: "2xl",
|
|
26382
|
-
label: "Extra Extra Large"
|
|
26383
|
-
},
|
|
26384
|
-
{
|
|
26385
|
-
value: "full",
|
|
26386
|
-
label: "Fully Rounded"
|
|
26387
|
-
}
|
|
26388
|
-
]
|
|
26389
|
-
});
|
|
26390
|
-
if (type === "container") fields.push({
|
|
26391
|
-
id: "fullWidth",
|
|
26392
|
-
type: "boolean",
|
|
26393
|
-
label: "Full width",
|
|
26394
|
-
description: "Extend content edge-to-edge (removes container max-width and all horizontal padding).",
|
|
26395
|
-
required: false,
|
|
26396
|
-
defaultValue: false
|
|
26397
|
-
});
|
|
26398
|
-
return {
|
|
26399
|
-
id,
|
|
26400
|
-
type: "modal",
|
|
26401
|
-
label,
|
|
26402
|
-
required: false,
|
|
26403
|
-
schema: { fields },
|
|
26404
|
-
ui: {
|
|
26405
|
-
...typeof renderInHeader === "boolean" ? { renderInHeader } : {},
|
|
26406
|
-
...intent ? { intent } : {},
|
|
26407
|
-
modalConfig: {
|
|
26408
|
-
buttonLabel: label,
|
|
26409
|
-
description: `Configure background, spacing, elevation, and rounded corners for the ${contextName}.`,
|
|
26410
|
-
buttonVariant: "outline",
|
|
26411
|
-
showCustomizedIndicator: true
|
|
26412
|
-
}
|
|
26413
|
-
}
|
|
26414
|
-
};
|
|
26415
|
-
}
|
|
26416
|
-
function sectionStylesField(options = {}) {
|
|
26417
|
-
const { id = "_sectionStyles", label = "Section styles", includeBackground = true, allowBackgroundColor = true, allowBackgroundGradient = true, allowBackgroundImage = true, includeAdvancedBackground = true, renderInHeader = true } = options;
|
|
26418
|
-
const fields = [];
|
|
26419
|
-
if (includeBackground) fields.push(createBackgroundField({
|
|
26420
|
-
id: "background",
|
|
26421
|
-
label: "Background",
|
|
26422
|
-
allowColor: allowBackgroundColor,
|
|
26423
|
-
allowGradient: allowBackgroundGradient,
|
|
26424
|
-
allowImage: allowBackgroundImage,
|
|
26425
|
-
includeAdvanced: includeAdvancedBackground
|
|
26426
|
-
}));
|
|
26427
|
-
fields.push({
|
|
26428
|
-
id: "spacing",
|
|
26429
|
-
type: "select",
|
|
26430
|
-
label: "Inner spacing",
|
|
26431
|
-
description: "Vertical padding for the section.",
|
|
26432
|
-
required: false,
|
|
26433
|
-
multiple: false,
|
|
26434
|
-
options: [
|
|
26435
|
-
{
|
|
26436
|
-
value: "none",
|
|
26437
|
-
label: "None"
|
|
26438
|
-
},
|
|
26439
|
-
{
|
|
26440
|
-
value: "compact",
|
|
26441
|
-
label: "Compact"
|
|
26442
|
-
},
|
|
26443
|
-
{
|
|
26444
|
-
value: "cozy",
|
|
26445
|
-
label: "Cozy"
|
|
26446
|
-
},
|
|
26447
|
-
{
|
|
26448
|
-
value: "medium",
|
|
26449
|
-
label: "Medium"
|
|
26450
|
-
},
|
|
26451
|
-
{
|
|
26452
|
-
value: "comfortable",
|
|
26453
|
-
label: "Comfortable"
|
|
26454
|
-
},
|
|
26455
|
-
{
|
|
26456
|
-
value: "spacious",
|
|
26457
|
-
label: "Spacious"
|
|
26458
|
-
}
|
|
26459
|
-
]
|
|
26460
|
-
});
|
|
26461
|
-
return {
|
|
26462
|
-
id,
|
|
26463
|
-
type: "modal",
|
|
26464
|
-
label,
|
|
26465
|
-
required: false,
|
|
26466
|
-
schema: { fields },
|
|
26467
|
-
ui: {
|
|
26468
|
-
renderInHeader,
|
|
26469
|
-
intent: "style",
|
|
26470
|
-
modalConfig: {
|
|
26471
|
-
buttonLabel: label,
|
|
26472
|
-
description: "Configure background and spacing for this section.",
|
|
26473
|
-
buttonVariant: "outline",
|
|
26474
|
-
showCustomizedIndicator: true
|
|
26475
|
-
}
|
|
26476
|
-
}
|
|
26477
|
-
};
|
|
26478
|
-
}
|
|
26479
|
-
function containerStylesField(options = {}) {
|
|
26480
|
-
return createBoxStylesFieldWithDepth("container", options);
|
|
26481
|
-
}
|
|
26482
|
-
//#endregion
|
|
26483
|
-
//#region ../blocks/src/system/manifest/augmentManifest.ts
|
|
26484
|
-
/**
|
|
26485
|
-
* Augments a block manifest with synthetic fields and other transformations.
|
|
26486
|
-
* This should be called at the block definition level, not at runtime.
|
|
26487
|
-
*
|
|
26488
|
-
* Current augmentations:
|
|
26489
|
-
* - Adds a variant select field if the manifest has multiple variants
|
|
26490
|
-
*
|
|
26491
|
-
* Future augmentations might include:
|
|
26492
|
-
* - Theme field injection
|
|
26493
|
-
* - Spacing/layout presets
|
|
26494
|
-
* - Animation controls
|
|
26495
|
-
*/
|
|
26496
|
-
function augmentManifest(manifest) {
|
|
26497
|
-
let augmentedFields = manifest.fields ?? [];
|
|
26498
|
-
const variantField = createVariantField(manifest);
|
|
26499
|
-
if (variantField) augmentedFields = [variantField, ...augmentedFields];
|
|
26500
|
-
return {
|
|
26501
|
-
...manifest,
|
|
26502
|
-
fields: augmentedFields
|
|
26503
|
-
};
|
|
26504
|
-
}
|
|
26505
|
-
/**
|
|
26506
|
-
* Creates a synthetic variant field definition when a manifest has variants.
|
|
26507
|
-
*/
|
|
26508
|
-
function createVariantField(manifest) {
|
|
26509
|
-
if (!manifest.variants || Object.keys(manifest.variants).length <= 1) return null;
|
|
26510
|
-
if (manifest.fields?.some((f) => f.id === "variant")) return null;
|
|
26511
|
-
const variantKeys = Object.keys(manifest.variants).filter((key) => !manifest.variantMeaning.lookOnlyKeys?.includes(key));
|
|
26512
|
-
return {
|
|
26513
|
-
id: "variant",
|
|
26514
|
-
type: "select",
|
|
26515
|
-
label: "Variant",
|
|
26516
|
-
description: "Choose a layout variant for this block",
|
|
26517
|
-
ui: { intent: "display" },
|
|
26518
|
-
required: false,
|
|
26519
|
-
defaultValue: manifest.defaultVariant ?? variantKeys[0],
|
|
26520
|
-
options: variantKeys.map((key) => {
|
|
26521
|
-
const meta = manifest.variantOptions?.[key];
|
|
26522
|
-
return {
|
|
26523
|
-
value: key,
|
|
26524
|
-
label: meta?.label ?? formatKeyAsLabel(key),
|
|
26525
|
-
...meta?.description ? { description: meta.description } : {},
|
|
26526
|
-
...meta?.icon ? { icon: meta.icon } : {}
|
|
26527
|
-
};
|
|
26528
|
-
}),
|
|
26529
|
-
multiple: false
|
|
26530
|
-
};
|
|
26531
|
-
}
|
|
26532
|
-
/**
|
|
26533
|
-
* Formats a key (variant name, style group, etc.) into a human-readable label.
|
|
26534
|
-
* Converts camelCase, snake_case, and kebab-case to Title Case.
|
|
26535
|
-
*
|
|
26536
|
-
* @example
|
|
26537
|
-
* formatKeyAsLabel('splitReverse') // → 'Split Reverse'
|
|
26538
|
-
* formatKeyAsLabel('bold_headline') // → 'Bold Headline'
|
|
26539
|
-
* formatKeyAsLabel('bold-headline') // → 'Bold Headline'
|
|
26540
|
-
* formatKeyAsLabel('classic') // → 'Classic'
|
|
26541
|
-
*/
|
|
26542
|
-
function formatKeyAsLabel(key) {
|
|
26543
|
-
return key.replace(/([A-Z])/g, " $1").replace(/[-_]/g, " ").trim().split(" ").map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
26544
|
-
}
|
|
26545
|
-
//#endregion
|
|
26546
|
-
//#region ../blocks/src/system/defineBlock.ts
|
|
26547
|
-
/**
|
|
26548
|
-
* Create a block manifest with smart defaults and automatic fragment composition.
|
|
26549
|
-
*
|
|
26550
|
-
* This helper reduces block definition boilerplate by:
|
|
26551
|
-
* - Composing fragments and managing field priorities automatically
|
|
26552
|
-
* - Adding section styles field by default
|
|
26553
|
-
* - Providing sensible defaults for manifest properties
|
|
26554
|
-
* - Auto-deriving component names from block IDs
|
|
26555
|
-
* - Handling manifest augmentation (variant selector, etc.)
|
|
26556
|
-
*
|
|
26557
|
-
* @example
|
|
26558
|
-
* ```typescript
|
|
26559
|
-
* export const heroManifest = createBlockManifest({
|
|
26560
|
-
* id: 'block.hero',
|
|
26561
|
-
* title: 'Hero',
|
|
26562
|
-
* category: 'layout',
|
|
26563
|
-
* fragments: [
|
|
26564
|
-
* { fragment: heroCopyFragment, priority: 0 },
|
|
26565
|
-
* { fragment: ctaRowFragment, priority: 2 },
|
|
26566
|
-
* ],
|
|
26567
|
-
* layout: styledSection({
|
|
26568
|
-
* children: sectionContainer(nodes, { gap: 'md' }),
|
|
26569
|
-
* }),
|
|
26570
|
-
* tags: ['header', 'banner', 'landing'],
|
|
26571
|
-
* icon: 'Sparkles',
|
|
26572
|
-
* });
|
|
26573
|
-
* ```
|
|
26574
|
-
*/
|
|
26575
|
-
function createBlockManifest(config) {
|
|
26576
|
-
const fields = parseFieldDefinitions(composeBlockFields(config));
|
|
26577
|
-
const layout = normalizeBlockLayout(config.layout);
|
|
26578
|
-
const variants = config.variants;
|
|
26579
|
-
const behaviours = blockBehaviours(config);
|
|
26580
|
-
return augmentManifest({
|
|
26581
|
-
name: config.id,
|
|
26582
|
-
version: config.version ?? "0.1.0",
|
|
26583
|
-
title: config.title,
|
|
26584
|
-
titleSource: config.titleSource,
|
|
26585
|
-
description: config.description ?? "",
|
|
26586
|
-
component: deriveComponentName(config.id),
|
|
26587
|
-
fields,
|
|
26588
|
-
slots: [],
|
|
26589
|
-
styleTokens: config.styleTokens,
|
|
26590
|
-
behaviours,
|
|
26591
|
-
previewCustomize: config.previewCustomize,
|
|
26592
|
-
category: config.category,
|
|
26593
|
-
contentTypes: config.contentTypes ? [...config.contentTypes] : void 0,
|
|
26594
|
-
contentSource: config.contentSource,
|
|
26595
|
-
tags: config.tags ? [...config.tags] : [],
|
|
26596
|
-
icon: config.icon ?? "Box",
|
|
26597
|
-
layout,
|
|
26598
|
-
variants,
|
|
26599
|
-
variantMeaning: config.variantMeaning,
|
|
26600
|
-
defaultVariant: config.defaultVariant,
|
|
26601
|
-
variantOptions: config.variantOptions,
|
|
26602
|
-
promotedFields: config.promotedFields ? [...config.promotedFields] : void 0
|
|
26603
|
-
});
|
|
26604
|
-
}
|
|
26605
|
-
function normalizeBlockLayout(layout) {
|
|
26606
|
-
const rawLayout = layout;
|
|
26607
|
-
return Array.isArray(rawLayout) ? rawLayout : rawLayout;
|
|
26608
|
-
}
|
|
26609
|
-
/**
|
|
26610
|
-
* Derive component name from block ID.
|
|
26611
|
-
*
|
|
26612
|
-
* Converts block IDs to component names by:
|
|
26613
|
-
* 1. Removing the 'block.' prefix
|
|
26614
|
-
* 2. Converting kebab-case and camelCase to dot.notation
|
|
26615
|
-
* 3. Adding '.default' suffix
|
|
26616
|
-
*
|
|
26617
|
-
* Examples:
|
|
26618
|
-
* - 'block.hero' → 'hero.default'
|
|
26619
|
-
* - 'block.cta-full' → 'cta.full.default'
|
|
26620
|
-
* - 'block.site-header' → 'site.header.default'
|
|
26621
|
-
*/
|
|
26622
|
-
function deriveComponentName(id) {
|
|
26623
|
-
return `${id.replace(/^block\./, "").replace(/-/g, ".").replace(/([a-z])([A-Z])/g, "$1.$2").toLowerCase()}.default`;
|
|
26624
|
-
}
|
|
26625
|
-
function composeBlockFields(config) {
|
|
26626
|
-
return [
|
|
26627
|
-
...config.fragments ? composeFragments([...config.fragments]).fields : [],
|
|
26628
|
-
...config.additionalFields ?? [],
|
|
26629
|
-
...config.includeContainerStyles ? [containerStylesField({
|
|
26630
|
-
id: "_containerStyles",
|
|
26631
|
-
label: "Container styles",
|
|
26632
|
-
renderInHeader: true,
|
|
26633
|
-
intent: "style"
|
|
26634
|
-
})] : [],
|
|
26635
|
-
...config.skipSectionStyles ? [] : [sectionStylesField({
|
|
26636
|
-
id: "_sectionStyles",
|
|
26637
|
-
label: "Section styles"
|
|
26638
|
-
})]
|
|
26639
|
-
];
|
|
26640
|
-
}
|
|
26641
|
-
function blockBehaviours(config) {
|
|
26642
|
-
if (config.behaviours) return config.behaviours;
|
|
26643
|
-
if (config.paletteHidden === void 0 && config.managesOwnWrapper === void 0) return void 0;
|
|
26644
|
-
return {
|
|
26645
|
-
supportsThemeSwitching: true,
|
|
26646
|
-
inlineEditing: true,
|
|
26647
|
-
animation: true,
|
|
26648
|
-
paletteHidden: config.paletteHidden ?? false,
|
|
26649
|
-
managesOwnWrapper: config.managesOwnWrapper ?? false
|
|
26650
|
-
};
|
|
26651
|
-
}
|
|
26652
|
-
//#endregion
|
|
26653
|
-
//#region ../blocks/src/system/blocks/event-registration.shared.ts
|
|
26654
|
-
/**
|
|
26655
|
-
* Flat occurrence context passed from `PageRenderer.$root.occurrenceContext`.
|
|
26656
|
-
* Kept in a shared module so the block definition and runtime contracts can
|
|
26657
|
-
* depend on the same schema without creating an initialization cycle.
|
|
26658
|
-
*/
|
|
26659
|
-
const occurrenceContextSchema = z.object({
|
|
26660
|
-
id: z.string(),
|
|
26661
|
-
seriesId: z.string(),
|
|
26662
|
-
startsAt: z.string(),
|
|
26663
|
-
endsAt: z.string(),
|
|
26664
|
-
timeZone: z.string(),
|
|
26665
|
-
capacityOverride: z.number().nullable().optional(),
|
|
26666
|
-
overrides: z.record(z.string(), z.unknown()).nullable().optional()
|
|
26667
|
-
}).nullable();
|
|
26668
|
-
createBlockManifest({
|
|
26669
|
-
variantMeaning: {
|
|
26670
|
-
kind: "arrangement",
|
|
26671
|
-
lookOnlyKeys: ["event-header", "details-panel"]
|
|
26672
|
-
},
|
|
26673
|
-
id: "block.event-details",
|
|
26674
|
-
version: "1.0.0",
|
|
26675
|
-
title: "Event Details",
|
|
26676
|
-
titleSource: "heading",
|
|
26677
|
-
description: "Date/time, venue, map, and other dates for an event",
|
|
26678
|
-
category: "content",
|
|
26679
|
-
contentSource: { kind: "entries" },
|
|
26680
|
-
tags: [
|
|
26681
|
-
"events",
|
|
26682
|
-
"venue",
|
|
26683
|
-
"map",
|
|
26684
|
-
"schedule",
|
|
26685
|
-
"dates"
|
|
26686
|
-
],
|
|
26687
|
-
icon: "MapPin",
|
|
26688
|
-
styleTokens: {
|
|
26689
|
-
background: "surface",
|
|
26690
|
-
typography: "body",
|
|
26691
|
-
spacing: "md"
|
|
26692
|
-
},
|
|
26693
|
-
behaviours: {
|
|
26694
|
-
supportsThemeSwitching: true,
|
|
26695
|
-
inlineEditing: false,
|
|
26696
|
-
animation: false,
|
|
26697
|
-
paletteHidden: false
|
|
26698
|
-
},
|
|
26699
|
-
additionalFields: [
|
|
26700
|
-
{
|
|
26701
|
-
id: "heading",
|
|
26702
|
-
type: "text",
|
|
26703
|
-
label: "Heading",
|
|
26704
|
-
description: "Optional heading shown above event details",
|
|
26705
|
-
required: false,
|
|
26706
|
-
multiline: false,
|
|
26707
|
-
defaultValue: "Event details"
|
|
26708
|
-
},
|
|
26709
|
-
{
|
|
26710
|
-
id: "showVenue",
|
|
26711
|
-
type: "boolean",
|
|
26712
|
-
label: "Show venue",
|
|
26713
|
-
required: false,
|
|
26714
|
-
defaultValue: true,
|
|
26715
|
-
ui: { intent: "display" }
|
|
26716
|
-
},
|
|
26717
|
-
{
|
|
26718
|
-
id: "showTitle",
|
|
26719
|
-
type: "boolean",
|
|
26720
|
-
label: "Show event title",
|
|
26721
|
-
required: false,
|
|
26722
|
-
defaultValue: false,
|
|
26723
|
-
ui: { intent: "display" }
|
|
26724
|
-
},
|
|
26725
|
-
{
|
|
26726
|
-
id: "showDescription",
|
|
26727
|
-
type: "boolean",
|
|
26728
|
-
label: "Show event description",
|
|
26729
|
-
required: false,
|
|
26730
|
-
defaultValue: false,
|
|
26731
|
-
ui: { intent: "display" }
|
|
26732
|
-
},
|
|
26733
|
-
{
|
|
26734
|
-
id: "showMap",
|
|
26735
|
-
type: "boolean",
|
|
26736
|
-
label: "Show map",
|
|
26737
|
-
description: "Embed a map when the venue has coordinates",
|
|
26738
|
-
required: false,
|
|
26739
|
-
defaultValue: true,
|
|
26740
|
-
ui: { intent: "display" }
|
|
26741
|
-
},
|
|
26742
|
-
{
|
|
26743
|
-
id: "showOtherDates",
|
|
26744
|
-
type: "boolean",
|
|
26745
|
-
label: "Show other dates",
|
|
26746
|
-
required: false,
|
|
26747
|
-
defaultValue: true,
|
|
26748
|
-
ui: { intent: "display" }
|
|
26749
|
-
},
|
|
26750
|
-
{
|
|
26751
|
-
id: "otherDatesLimit",
|
|
26752
|
-
type: "select",
|
|
26753
|
-
label: "Other dates limit",
|
|
26754
|
-
required: false,
|
|
26755
|
-
multiple: false,
|
|
26756
|
-
defaultValue: "5",
|
|
26757
|
-
options: [
|
|
26758
|
-
{
|
|
26759
|
-
value: "3",
|
|
26760
|
-
label: "3 dates"
|
|
26761
|
-
},
|
|
26762
|
-
{
|
|
26763
|
-
value: "5",
|
|
26764
|
-
label: "5 dates"
|
|
26765
|
-
},
|
|
26766
|
-
{
|
|
26767
|
-
value: "10",
|
|
26768
|
-
label: "10 dates"
|
|
26769
|
-
},
|
|
26770
|
-
{
|
|
26771
|
-
value: "all",
|
|
26772
|
-
label: "All dates"
|
|
26773
|
-
}
|
|
26774
|
-
],
|
|
26775
|
-
ui: { intent: "display" }
|
|
26776
|
-
},
|
|
26777
|
-
{
|
|
26778
|
-
id: "showCapacity",
|
|
26779
|
-
type: "boolean",
|
|
26780
|
-
label: "Show capacity",
|
|
26781
|
-
required: false,
|
|
26782
|
-
defaultValue: false,
|
|
26783
|
-
ui: { intent: "display" }
|
|
26784
|
-
},
|
|
26785
|
-
{
|
|
26786
|
-
id: "showCost",
|
|
26787
|
-
type: "boolean",
|
|
26788
|
-
label: "Show cost",
|
|
26789
|
-
description: "Display ticket price for paid events",
|
|
26790
|
-
required: false,
|
|
26791
|
-
defaultValue: true,
|
|
26792
|
-
ui: { intent: "display" }
|
|
26793
|
-
},
|
|
26794
|
-
{
|
|
26795
|
-
id: "showAcceptedPasses",
|
|
26796
|
-
type: "boolean",
|
|
26797
|
-
label: "Show accepted passes",
|
|
26798
|
-
description: "Display passes that can be used for this event",
|
|
26799
|
-
required: false,
|
|
26800
|
-
defaultValue: true,
|
|
26801
|
-
ui: { intent: "display" }
|
|
26802
|
-
},
|
|
26803
|
-
{
|
|
26804
|
-
id: "showAcceptedMemberships",
|
|
26805
|
-
type: "boolean",
|
|
26806
|
-
label: "Show accepted memberships",
|
|
26807
|
-
description: "Display memberships that grant access to this event",
|
|
26808
|
-
required: false,
|
|
26809
|
-
defaultValue: true,
|
|
26810
|
-
ui: { intent: "display" }
|
|
26811
|
-
}
|
|
26812
|
-
],
|
|
26813
|
-
layout: [styledSection({
|
|
26814
|
-
baseClass: "",
|
|
26815
|
-
spacing: "spacious",
|
|
26816
|
-
children: sectionContainer([text({ as: "h2" }, bind("content.heading"), when("content.heading")), el("event-details", {
|
|
26817
|
-
entryTitle: { $bind: {
|
|
26818
|
-
from: "$root.contentEntry.title",
|
|
26819
|
-
fallback: null
|
|
26820
|
-
} },
|
|
26821
|
-
arrangement: { $bind: { from: "content._effectiveLook.look.structure.byMode.default" } },
|
|
26822
|
-
actionSize: { $bind: { from: "content._effectiveLook.look.structure.actionSize" } },
|
|
26823
|
-
lookSlots: { $bind: { from: "content._lookSlots" } },
|
|
26824
|
-
itemSurfaces: { $bind: { from: "content._effectiveLook.itemSurfaces" } },
|
|
26825
|
-
panelHeading: { $bind: { from: "content._lookPanelHeading" } },
|
|
26826
|
-
occurrenceContext: { $bind: {
|
|
26827
|
-
from: "$root.occurrenceContext",
|
|
26828
|
-
fallback: null
|
|
26829
|
-
} },
|
|
26830
|
-
subject: { $bind: {
|
|
26831
|
-
from: "$root.subject",
|
|
26832
|
-
fallback: null
|
|
26833
|
-
} },
|
|
26834
|
-
events: { $bind: { from: "data.eventDetailsData.events" } },
|
|
26835
|
-
showVenue: { $bind: { from: "content.showVenue" } },
|
|
26836
|
-
showTitle: { $bind: { from: "content.showTitle" } },
|
|
26837
|
-
showDescription: { $bind: { from: "content.showDescription" } },
|
|
26838
|
-
showMap: { $bind: { from: "content.showMap" } },
|
|
26839
|
-
showOtherDates: { $bind: { from: "content.showOtherDates" } },
|
|
26840
|
-
otherDatesLimit: { $bind: {
|
|
26841
|
-
from: "content.otherDatesLimit",
|
|
26842
|
-
fallback: "5"
|
|
26843
|
-
} },
|
|
26844
|
-
showCost: { $bind: {
|
|
26845
|
-
from: "content.showCost",
|
|
26846
|
-
fallback: true
|
|
26847
|
-
} },
|
|
26848
|
-
showCapacity: { $bind: {
|
|
26849
|
-
from: "content.showCapacity",
|
|
26850
|
-
fallback: false
|
|
26851
|
-
} },
|
|
26852
|
-
showAcceptedPasses: { $bind: {
|
|
26853
|
-
from: "content.showAcceptedPasses",
|
|
26854
|
-
fallback: true
|
|
26855
|
-
} },
|
|
26856
|
-
showAcceptedMemberships: { $bind: {
|
|
26857
|
-
from: "content.showAcceptedMemberships",
|
|
26858
|
-
fallback: true
|
|
26859
|
-
} },
|
|
26860
|
-
sitePasses: { $bind: { from: "data.eventDetailsData.sitePasses" } },
|
|
26861
|
-
siteMemberships: { $bind: { from: "data.eventDetailsData.siteMemberships" } },
|
|
26862
|
-
autoApplyDiscount: { $bind: {
|
|
26863
|
-
from: "data.eventDetailsData.autoApplyDiscount",
|
|
26864
|
-
fallback: null
|
|
26865
|
-
} }
|
|
26866
|
-
})], { gap: "lg" })
|
|
26867
|
-
})]
|
|
26868
|
-
});
|
|
26869
|
-
const eventAutoApplyDiscountPreviewBaseSchema = z.object({
|
|
26870
|
-
id: z.string(),
|
|
26871
|
-
publicLabel: z.string(),
|
|
26872
|
-
description: z.string().nullable(),
|
|
26873
|
-
minTicketsRequired: z.number().nullable()
|
|
26874
|
-
});
|
|
26875
|
-
const eventAutoApplyDiscountPreviewSchema = z.discriminatedUnion("discountType", [eventAutoApplyDiscountPreviewBaseSchema.extend({
|
|
26876
|
-
discountType: z.literal("percent"),
|
|
26877
|
-
discountPercent: z.number(),
|
|
26878
|
-
discountAmountCents: z.null()
|
|
26879
|
-
}), eventAutoApplyDiscountPreviewBaseSchema.extend({
|
|
26880
|
-
discountType: z.literal("fixed"),
|
|
26881
|
-
discountPercent: z.null(),
|
|
26882
|
-
discountAmountCents: z.number()
|
|
26883
|
-
})]);
|
|
26884
|
-
z.object({
|
|
26885
|
-
events: publicEventsArraySchema,
|
|
26886
|
-
sitePasses: publicPassProductCollectionSchema,
|
|
26887
|
-
siteMemberships: publicMembershipProductCollectionSchema,
|
|
26888
|
-
autoApplyDiscount: eventAutoApplyDiscountPreviewSchema.nullable().optional().default(null)
|
|
26889
|
-
}).optional(), occurrenceContextSchema.optional();
|
|
26890
|
-
const unsupportedEventRegistrationPageSurfaceSubjectSchema = z.object({
|
|
26891
|
-
kind: z.literal("unsupported"),
|
|
26892
|
-
reason: z.enum([
|
|
26893
|
-
"unsupportedSubject",
|
|
26894
|
-
"invalidEventSeriesId",
|
|
26895
|
-
"invalidEventSeriesBookingScope",
|
|
26896
|
-
"invalidEventOfferingId",
|
|
26897
|
-
"invalidEventOfferingBookingScope",
|
|
26898
|
-
"invalidEventOfferingCatalogue"
|
|
26899
|
-
])
|
|
26900
|
-
});
|
|
26901
|
-
const eventRegistrationPageSurfaceSubjectSchema = z.unknown().transform((value, ctx) => {
|
|
26902
|
-
const unsupported = unsupportedEventRegistrationPageSurfaceSubjectSchema.safeParse(value);
|
|
26903
|
-
if (unsupported.success) return unsupported.data;
|
|
26904
|
-
const parsed = parseEventPageSurfaceSubject(value);
|
|
26905
|
-
if (parsed.ok) return parsed.value;
|
|
26906
|
-
ctx.addIssue({
|
|
26907
|
-
code: z.ZodIssueCode.custom,
|
|
26908
|
-
message: `Invalid event page-surface subject (${parsed.error.kind})`
|
|
26909
|
-
});
|
|
26910
|
-
return z.NEVER;
|
|
26911
|
-
});
|
|
26912
|
-
function resolveEventRegistrationScope(context) {
|
|
26913
|
-
const occurrenceSeriesId = context.occurrenceContext?.seriesId;
|
|
26914
|
-
if (occurrenceSeriesId) return {
|
|
26915
|
-
kind: "occurrenceSeries",
|
|
26916
|
-
seriesId: occurrenceSeriesId
|
|
26917
|
-
};
|
|
26918
|
-
if (context.subject?.kind === "eventSeries") return {
|
|
26919
|
-
kind: "pageSurfaceSeries",
|
|
26920
|
-
seriesId: context.subject.eventSeriesId
|
|
26921
|
-
};
|
|
26922
|
-
if (context.subject?.kind === "eventOffering") return {
|
|
26923
|
-
kind: "pageSurfaceOffering",
|
|
26924
|
-
offeringId: context.subject.eventOfferingId,
|
|
26925
|
-
seriesIds: context.subject.catalogueEventSeriesIds
|
|
26926
|
-
};
|
|
26927
|
-
if (context.subject?.kind === "unsupported") return {
|
|
26928
|
-
kind: "unsupportedPageSurfaceSubject",
|
|
26929
|
-
reason: context.subject.reason
|
|
26930
|
-
};
|
|
26931
|
-
return { kind: "unscoped" };
|
|
26932
|
-
}
|
|
26933
|
-
function resolveEventRegistrationScopedEvents(events, context) {
|
|
26934
|
-
const scope = resolveEventRegistrationScope(context);
|
|
26935
|
-
switch (scope.kind) {
|
|
26936
|
-
case "occurrenceSeries":
|
|
26937
|
-
case "pageSurfaceSeries": return events.filter((event) => event.seriesId === scope.seriesId);
|
|
26938
|
-
case "pageSurfaceOffering": {
|
|
26939
|
-
const seriesIds = new Set(scope.seriesIds);
|
|
26940
|
-
return events.filter((event) => seriesIds.has(event.seriesId));
|
|
26941
|
-
}
|
|
26942
|
-
case "unsupportedPageSurfaceSubject": return [];
|
|
26943
|
-
case "unscoped": return [...events];
|
|
26944
|
-
}
|
|
26945
|
-
}
|
|
26946
|
-
//#endregion
|
|
26947
|
-
//#region ../blocks/src/system/runtime/header/runtimeContract.ts
|
|
26948
|
-
const headerScrollRuntimeSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("none") }), z.object({ kind: z.literal("threshold") })]);
|
|
26949
|
-
const headerChromeRuntimeContractSchema = z.object({ scroll: headerScrollRuntimeSchema });
|
|
26950
|
-
const staticHeaderChromeRuntime = { scroll: { kind: "none" } };
|
|
26951
|
-
z.object({
|
|
26952
|
-
positioning: z.unknown().optional(),
|
|
26953
|
-
shrinkOnScroll: z.boolean().optional()
|
|
26954
|
-
});
|
|
24728
|
+
//#region ../blocks/src/system/runtime/header/runtimeContract.ts
|
|
24729
|
+
const headerScrollRuntimeSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("none") }), z.object({ kind: z.literal("threshold") })]);
|
|
24730
|
+
const headerChromeRuntimeContractSchema = z.object({ scroll: headerScrollRuntimeSchema });
|
|
24731
|
+
const staticHeaderChromeRuntime = { scroll: { kind: "none" } };
|
|
24732
|
+
z.object({
|
|
24733
|
+
positioning: z.unknown().optional(),
|
|
24734
|
+
shrinkOnScroll: z.boolean().optional()
|
|
24735
|
+
});
|
|
26955
24736
|
//#endregion
|
|
26956
24737
|
//#region ../blocks/src/contracts/non-block-islands.ts
|
|
26957
24738
|
const accordionIslandSchema = z.object({
|
|
@@ -27308,6 +25089,22 @@ function ticketPlacesLabel(remaining, display) {
|
|
|
27308
25089
|
return formatTicketTypeRemaining(remaining);
|
|
27309
25090
|
}
|
|
27310
25091
|
//#endregion
|
|
25092
|
+
//#region ../blocks/src/system/blocks/event-registration.shared.ts
|
|
25093
|
+
/**
|
|
25094
|
+
* Flat occurrence context passed from `PageRenderer.$root.occurrenceContext`.
|
|
25095
|
+
* Kept in a shared module so the block definition and runtime contracts can
|
|
25096
|
+
* depend on the same schema without creating an initialization cycle.
|
|
25097
|
+
*/
|
|
25098
|
+
const occurrenceContextSchema = z.object({
|
|
25099
|
+
id: z.string(),
|
|
25100
|
+
seriesId: z.string(),
|
|
25101
|
+
startsAt: z.string(),
|
|
25102
|
+
endsAt: z.string(),
|
|
25103
|
+
timeZone: z.string(),
|
|
25104
|
+
capacityOverride: z.number().nullable().optional(),
|
|
25105
|
+
overrides: z.record(z.string(), z.unknown()).nullable().optional()
|
|
25106
|
+
}).nullable();
|
|
25107
|
+
//#endregion
|
|
27311
25108
|
//#region ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
|
|
27312
25109
|
function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
|
|
27313
25110
|
return {
|
|
@@ -31798,4 +29595,4 @@ function defineIslandPropsDecoder(kind) {
|
|
|
31798
29595
|
};
|
|
31799
29596
|
}
|
|
31800
29597
|
//#endregion
|
|
31801
|
-
export { normalizeEventRegistrationMaxTickets as $,
|
|
29598
|
+
export { normalizeEventRegistrationMaxTickets as $, listLookSlot as $n, resolveTokenOrCssColorValue as $r, placesLeftLabel as $t, registrationRoute as A, publicEventPricingStrategy as Ai, eventLocalDateKey as An, reportWorkflowSuccess as Ar, formatEventDateTime as At, decideEventRegistrationPayment as B, canJoinEventWaitlist as Bn, getOrderedDayNames as Br, withOccurrenceTitle as Bt, bookingEntry as C, toBookingTimeZone as Ci, normalizeOptionalId as Cn, isRecord$4 as Cr, confirmationPaymentRows as Ct, panelShouldOpen as D, isPublicEventPricingOptionDisplayable as Di, formatEventPriceDisplay as Dn, ok as Dr, findSelectedTicketType as Dt, getEventSelectionMode as E, formatBookingPriceDisplay as Ei, formatEventPriceAmount as En, err as Er, areEntitlementsDisabledForTicketCount as Et, decideEventChoice as F, formatEventTimeRange as Fn, MONTH_NAMES as Fr, getPortalSubjectEmail as Ft, planRegistrationDetailsContinuation as G, getEventAvailabilityStatus as Gn, themeButtonSizeClassName as Gr, getTicketSelectionTotal as Gt, fullyBookedLabel as H, formatEventRemainingPlaces as Hn, isToday as Hr, canRequestTicketOption as Ht, getDeclinedPass as I, formatTime$1 as In, addMonths as Ir, getTicketTypeAvailabilityLabel as It, resolveRegistrationAvailabilityBlocker as J, selectEventCapacitySource as Jn, backgroundColorStyle as Jr, normalizeTicketSelectionLines as Jt, resolveGuestNextStepCheck as K, getRemainingPlaces as Kn, themeButtonVariantClassNames as Kr, getTicketTypeLineMax as Kt, isRegistrationLocked as L, groupEventsByDate as Ln, buildCalendarViewport as Lr, getVisibleTicketTypes as Lt, registrationStepLabelContext as M, formatCurrencyAmount as Mi, formatEventCompactDateRail as Mn, verifiedSiteTermsAcceptanceSchema as Mr, formatRegistrationSchedule as Mt, areEventRegistrationPaymentSelectionsEqual as N, assertNever$6 as Ni, formatEventDateParts as Nn, src_exports as Nr, formatTime as Nt, registrationPaymentRoute as O, publicEventPricingCurrency as Oi, eventDateLocale as On, okWith as Or, formatBookingWhen as Ot, createInitialRegistrationFlowState as P, __commonJSMin as Pi, formatEventNextDateFact as Pn, buildTimetableModel as Pr, getImplicitSingleTicketType as Pt, isEventRegistrationAvailable as Q, listLookControl as Qn, resolveOnColorForThemeToken as Qr, toWholeSeriesRegistrationEvents as Qt, registrationFlowReducer as R, resolveEventTimeZone as Rn, formatDateKey as Rr, occurrenceTitleOverride as Rt, bookingCardEntry as S, resolveBookingTimeZoneId as Si, normalizeCsvString as Sn, RichTextDocSchema as Sr, validateFormData as St, bookingPanelHeading as T, toUtcIsoDateTimeString as Ti, formatEventPrice as Tn, clearWorkflowFeedback as Tr, ENTITLEMENT_SINGLE_TICKET_TOOLTIP as Tt, placeCountCeiling as U, formatTotalCapacity as Un, shiftCalendarAnchorDate as Ur, getSingleSelectedPricingOptionId as Ut, shouldPromptForLogin as V, canJoinEventWaitlistOnAnyMode as Vn, isSameCalendarDay as Vr, formatPrice as Vt, planRegistrationDetailsCheck as W, getEventAvailability as Wn, themeButtonExtraClassesWithTrailingIcon as Wr, getTicketLineQuantity as Wt, settledRemainingPlaces as X, groupPublicEventsByRun as Xn, textColorStyle as Xr, getRegistrationStartAt as Xt, resolveRegistrationTicketContinuation as Y, selectMostOpenCapacitySource as Yn, mergeStyles as Yr, setTicketLineQuantity as Yt, visitorHoldsOwnPlace as Z, listItemPresentation as Zn, isCssColorLiteral as Zr, toRegistrationEvents as Zt, buildEventRegistrationDisplayFromScopedEvents as _, formatLocalScheduleDate as _i, createHostedBlockApiConfig as _n, toSelectedCollectionOptionKind as _r, getRegistrationOccurrenceId as _t, buildProductDetailDisplay as a, eventRegistrationErrors as ai, eventCheckoutReturnResponseSchema as an, getBookingServiceSlidingScale as ar, paymentChoicePrice as at, DEFAULT_BOOKING_BUTTON_TEXT as b, parseBookingLocalDate as bi, getEventRuntimeFiltersKey as bn, BOOKING_FORM_DATA_RESERVED_KEYS as br, parseCurrencyInputToCents as bt, EMPTY_COMMERCE_CART_STATE as c, orderedLiveRunSessions as ci, calendarMonthDate as cn, getShopSuccessCopy as cr, resolveEventRequiresPayment as ct, deriveCommerceCheckoutState as d, resolveBookingSignupOffer as di, calendarQueryKey as dn, prepareBookingSubmission as dr, toRegistrationRequestSubject as dt, relativeLuminance as ei, shownVenue as en, logger as er, resolveEventRegistrationSubmitPlan as et, parseStoredCommerceCartState as f, formatDate$2 as fi, calendarWindowBounds as fn, resolveAppointmentCheckoutVerificationState as fr, beginWaitlistInvitation as ft, newsletterBlockSubmissionMessage as g, formatBookingInstant as gi, resolveCalendarReadProfile as gn, selectedBookingCollectionOptionKind as gr, getEligibilityFlowFlags as gt, NEWSLETTER_SIGNUPS_PAUSED_MESSAGE as h, addLocalScheduleDays as hi, planCalendarMonthRanges as hn, resolveDefaultBookingServiceId as hr, formatCentsAsCurrencyInput as ht, buildProductCardDisplay as i, checkBrowserStripeKey as ii, eventCheckoutResponseSchema as in, getBookingRedirectStateFromLocation as ir, paymentChoiceDetails as it, registrationStepLabel as j, publicEventPricingType as ji, formatDate$1 as jn, blockSiteTermsSchema as jr, formatPassCreditUsageLabel as jt, registrationPresentation as k, publicEventPricingDisplay as ki, eventDateOptions as kn, reportWorkflowError as kr, formatDate as kt, buildPassCartItem as l, resolveWholeSeriesBookingPhase as li, calendarMonthKey as ln, isBookingServiceSlidingAmountInRange as lr, resolveRegistrationTarget as lt, reduceCommerceCart as m, formatDateTimeRange as mi, calendarWindowPageSchema as mn, resolveBookingSiteId as mr, invitationSubmission as mt, getShopDisplayForItems as n, normalizeCardRole as ni, staticHeaderChromeRuntime as nn, formatBookingCentsAsCurrencyInput as nr, buildBookingPaymentSelectionViewModel as nt, formatCommercePrice as o, parseEventRegistrationErrorReason as oi, eventRegisterResponseSchema as on, getBookingSuccessCopy as or, findPreSelectedEvent as ot, productItemKey as p, formatDateRange as pi, calendarWindowMonths as pn, resolveBookingPaymentStep as pr, createRegistrationDraftData as pt, resolveRegistrationAdmission as q, isEventFull as qn, boxBackgroundSchema as qr, hasValidPricingOptionSelection as qt, buildCartDisplay as r, clsx as ri, resolveEventRegistrationScopedEvents as rn, formatBookingSubmissionPreparationError as rr, buildReviewedBookingPaymentViewModel as rt, formatInterval as s, CANCELLED_SESSION_STATUS as si, eventListingBlockRuntime as sn, getRegistrationSuccessCopy as sr, resolveDiscountContext as st, defineIslandPropsDecoder as t, hexToRgb as ti, buildEventCalendarListingRender as tn, deriveBookingFormViewState as tr, calculateEventRegistrationPreviewTotal as tt, buildProductCartItem as u, parseMailingListVisitorSelection as ui, calendarPageResponseError as un, parseBookingCurrencyInputToCents as ur, resolveRouteRequiresPayment as ut, displayButtonText as v, getBookingLocalDateKey as vi, getBlockApiReadStage as vn, projectSelectedAppointmentConsentIntoForm as vr, getSlidingScaleForEvent as vt, bookingEntryProgress as w, toScheduledBookingDateTime as wi, buildEventListWeek as wn, assertNever$1 as wr, resolveFinishedPresentation as wt, bookingBarPlacement as x, resolveBookingBusinessTimeZone as xi, normalizeCsvIds as xn, isBookingRequirementConsentFieldId as xr, shouldLoadRegistrationOptions as xt, offeringNounForEvent as y, getLocalScheduleDate as yi, buildEventRuntimeFilters as yn, resolveSelectedAppointmentConsent as yr, getSlidingScaleSelectionMessage as yt, buildEventRegistrationPaymentOptionsViewModel as z, resolveRuntimeEventDestination as zn, getDayOfWeek as zr, transformRegistrationOptionsResponse as zt };
|