@riverbankcms/sdk 0.138.0 → 0.139.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -15
- package/dist/{PreviewEditorSidebar-BVPur_CU.mjs → PreviewEditorSidebar-BDeenhi3.mjs} +4 -4
- package/dist/{PreviewEditorUI-DLhWX8oh.mjs → PreviewEditorUI-DSRhgjF5.mjs} +3 -3
- package/dist/{PreviewQueryProvider-BguJY1SW.mjs → PreviewQueryProvider-D2K8GLUG.mjs} +1 -1
- package/dist/{SdkPreviewModeRuntime-Tda6qw4z.mjs → SdkPreviewModeRuntime-CL7wSnYu.mjs} +47 -27
- package/dist/{SiteChromeCustomizeContext-BHFgMjde.mjs → SiteChromeCustomizeContext-BhDn-5ir.mjs} +7771 -5863
- package/dist/_dts/ai/src/contracts/proposals.d.ts +99 -330
- package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +9 -30
- package/dist/_dts/api/src/billing.d.ts +10 -3
- package/dist/_dts/api/src/contentRuntime.d.ts +8 -1
- package/dist/_dts/api/src/endpoints.d.ts +182 -103
- package/dist/_dts/api/src/footerSettings.d.ts +2 -5
- package/dist/_dts/api/src/index.d.ts +11 -9
- package/dist/_dts/api/src/mailchimpIntegration.d.ts +2 -59
- package/dist/_dts/api/src/mailingListIntegration.d.ts +117 -0
- package/dist/_dts/api/src/navigation/locations.d.ts +1 -0
- package/dist/_dts/api/src/navigation.d.ts +1 -26
- package/dist/_dts/api/src/newsletterEndpointDefinitions.d.ts +109 -2
- package/dist/_dts/api/src/onboarding/surfaceData.d.ts +185 -0
- package/dist/_dts/api/src/privacyPolicy.d.ts +74 -2
- package/dist/_dts/api/src/publicBookingAvailabilityEndpointDefinitions.d.ts +6 -6
- package/dist/_dts/api/src/publicEventEndpointDefinitions.d.ts +1 -1
- package/dist/_dts/api/src/publicExperience/newsletterEndpoints.d.ts +2 -4
- package/dist/_dts/api/src/publicExperience/sharedTypes.d.ts +10 -24
- package/dist/_dts/api/src/publicReadEndpointDefinitions.d.ts +73 -0
- package/dist/_dts/api/src/schemas/site-api-keys.d.ts +1 -1
- package/dist/_dts/api/src/sdkContracts.d.ts +2 -10
- package/dist/_dts/api/src/sdkThemeWire.d.ts +2 -2
- package/dist/_dts/api/src/siteManagementEndpoints.d.ts +0 -29
- package/dist/_dts/api/src/siteOnboarding.d.ts +91 -228
- package/dist/_dts/api/src/sitePlatformEndpoints.d.ts +1 -9
- package/dist/_dts/api/src/siteSettings.d.ts +20 -1
- package/dist/_dts/api/src/types.d.ts +5 -4
- package/dist/_dts/billing/src/membership/index.d.ts +14 -7
- package/dist/_dts/billing/src/plans/display.d.ts +15 -0
- package/dist/_dts/billing/src/plans/registry.d.ts +2 -0
- package/dist/_dts/billing/src/plans/standing.d.ts +19 -0
- package/dist/_dts/billing/src/plans/types.d.ts +1 -7
- package/dist/_dts/billing/src/subscriptions/evidence.d.ts +12 -0
- package/dist/_dts/billing/src/subscriptions/standingEvidence.d.ts +31 -0
- package/dist/_dts/billing/src/subscriptions/store.d.ts +23 -5
- package/dist/_dts/blocks/src/PageRenderer.d.ts +6 -15
- package/dist/_dts/blocks/src/client.d.ts +1 -1
- package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +32 -16
- package/dist/_dts/blocks/src/pageRendererContracts.d.ts +4 -0
- package/dist/_dts/blocks/src/pageRenderingMode.d.ts +12 -6
- package/dist/_dts/blocks/src/system/blocks/appointment-services.d.ts +11 -0
- package/dist/_dts/blocks/src/system/blocks/contact-newsletter.d.ts +39 -66
- package/dist/_dts/blocks/src/system/blocks/newsletter-signup.d.ts +39 -114
- package/dist/_dts/blocks/src/system/blocks/offerings-preview/catalogue.d.ts +18 -0
- package/dist/_dts/blocks/src/system/blocks/offerings-preview/fields.d.ts +2 -0
- package/dist/_dts/blocks/src/system/blocks/offerings-preview/index.d.ts +4 -0
- package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +7 -13
- package/dist/_dts/blocks/src/system/constants/blockKinds.d.ts +1 -1
- package/dist/_dts/blocks/src/system/data/index.d.ts +2 -2
- package/dist/_dts/blocks/src/system/data/loaderEndpoints.d.ts +1 -1
- package/dist/_dts/blocks/src/system/data/publicLoaderCachePolicy.d.ts +2 -74
- package/dist/_dts/blocks/src/system/fragments/library/newsletterForm.d.ts +33 -100
- package/dist/_dts/blocks/src/system/runtime/api/types/newsletter.d.ts +5 -15
- package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -24
- package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -12
- package/dist/_dts/blocks/src/system/runtime/hooks/useCalendarEvents.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useCalendarEvents.state.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/hooks/useCalendarToday.d.ts +22 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/appointment-services.d.ts +51 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +0 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/EventCombined.client.d.ts +28 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/bookability.d.ts +9 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/dates.d.ts +14 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/duration.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/index.d.ts +4 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/location.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/domain/quickDates.d.ts +16 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/AgendaEventCard.d.ts +9 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/CalendarDayCell.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/CalendarDayHeaders.d.ts +4 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/DayEventsModal.d.ts +2 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventCard.d.ts +5 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventModals.d.ts +2 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/EventQuickDates.d.ts +15 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/WeekAgendaView.d.ts +7 -3
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/WeekTimetableView.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/index.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/timetableModel.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/useHydrationReady.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.client.state.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.interactive.d.ts +56 -33
- package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.submission.d.ts +3 -3
- package/dist/_dts/blocks/src/system/runtime/nodes/newsletter-form.types.d.ts +13 -31
- package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview-catalogue.d.ts +14 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview-content.d.ts +23 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/offerings-preview.d.ts +4 -2
- package/dist/_dts/blocks/src/system/transforms/registry/formatting.d.ts +5 -0
- package/dist/_dts/commerce/src/purchase/index.d.ts +1 -0
- package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +5 -12
- package/dist/_dts/commerce/src/purchase/stripeCommissionMetadata.d.ts +34 -0
- package/dist/_dts/content-editor/src/footerEngagementDraft.d.ts +6 -24
- package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +1 -2
- package/dist/_dts/core/src/footer-engagement.d.ts +2 -6
- package/dist/_dts/core/src/index.d.ts +9 -1
- package/dist/_dts/core/src/mailing-list-identifiers.d.ts +21 -0
- package/dist/_dts/core/src/mailing-list-runtime.d.ts +42 -0
- package/dist/_dts/core/src/mailing-list-setup-parser.d.ts +14 -0
- package/dist/_dts/core/src/mailing-list-setup.d.ts +129 -0
- package/dist/_dts/core/src/mailing-list-submission.d.ts +244 -0
- package/dist/_dts/core/src/mailing-list-targeting-parser.d.ts +12 -0
- package/dist/_dts/core/src/mailing-list-targeting.d.ts +93 -0
- package/dist/_dts/core/src/navigation-locations.d.ts +28 -0
- package/dist/_dts/core/src/public-profile.d.ts +9 -1
- package/dist/_dts/core/src/public-read-cache-contract.d.ts +45 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +529 -373
- package/dist/_dts/editor-blocks/src/widgets/index.d.ts +1 -0
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/MailingListTargetingField.d.ts +11 -0
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/context.d.ts +13 -0
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/index.d.ts +3 -0
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/loaders.d.ts +6 -0
- package/dist/_dts/preview-next/src/client/widgets/widgetOverrides.d.ts +1 -0
- package/dist/_dts/sdk/src/client/publicAppointmentReadOperations.d.ts +12 -0
- package/dist/_dts/sdk/src/client/publicEventReadOperations.d.ts +2 -1
- package/dist/_dts/sdk/src/client/publicLoaderCacheAccess.d.ts +11 -4
- package/dist/_dts/sdk/src/config/content-types.d.ts +3 -13
- package/dist/_dts/sdk/src/config/content-validation.d.ts +5 -8
- package/dist/_dts/sdk/src/constants.d.ts +3 -3
- package/dist/_dts/sdk/src/contracts/index.d.ts +1 -1
- package/dist/_dts/sdk/src/contracts/system-block-content.d.ts +12 -31
- package/dist/_dts/sdk/src/navigation/index.d.ts +11 -29
- package/dist/_dts/sdk/src/next/index.d.ts +4 -4
- package/dist/_dts/sdk/src/prebuild/types.d.ts +1 -5
- package/dist/_dts/sdk/src/public-api/contracts.d.ts +33 -16
- package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +3 -0
- package/dist/_dts/sdk/src/rendering/client.d.ts +3 -20
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +3 -0
- package/dist/_dts/sdk/src/rendering/helpers/loadContent.d.ts +4 -0
- package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +1 -0
- package/dist/_dts/sdk/src/rendering/index.d.ts +1 -1
- package/dist/_dts/sdk/src/types/block-kinds.d.ts +1 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/_dts/theme-core/src/hosted-booking-appearance.d.ts +41 -0
- package/dist/_dts/theme-core/src/index.d.ts +1 -0
- package/dist/_dts/theme-core/src/runtime/buildThemeRuntime.d.ts +0 -1
- package/dist/_dts/theme-core/src/tokens/tokens.d.ts +7 -0
- package/dist/_dts/ui/src/badge.d.ts +1 -1
- package/dist/_dts/ui/src/callout.d.ts +1 -1
- package/dist/client/{BookingConsentAgreement-DQUik1Mx.mjs → BookingConsentAgreement-CZvTDtsK.mjs} +2 -2
- package/dist/client/{DiscountCodeDisclosure-CU67Q4vH.mjs → DiscountCodeDisclosure-D-DsLCMU.mjs} +1 -1
- package/dist/client/{EventCombined.client-a02TXUgg.mjs → EventCombined.client-dWqgd5ZO.mjs} +443 -199
- package/dist/client/{EventListing.client-99qx7jFl.mjs → EventListing.client-BMRa9IYp.mjs} +2 -2
- package/dist/client/{LeafletStaticMap-CWzcq73L.mjs → LeafletStaticMap-D21W9kBZ.mjs} +1 -1
- package/dist/client/{accordion-D1nb3-Oj.mjs → accordion-FxF_ta47.mjs} +1 -1
- package/dist/client/{bookingForm-BGrmLhaO.mjs → bookingForm-YnwW4TGw.mjs} +5 -5
- package/dist/client/bookings.mjs +43 -2
- package/dist/client/{carousel-DSmOx3ad.mjs → carousel-vng7fFT5.mjs} +1 -1
- package/dist/client/{cart-COWeOIUk.mjs → cart-DEPDsjNk.mjs} +3 -3
- package/dist/client/{checkout-CeysaIJK.mjs → checkout-CZRWu9rW.mjs} +3 -3
- package/dist/client/client.mjs +3331 -1407
- package/dist/client/{context-DBzX85Xc.mjs → context-DvU_WUmd.mjs} +4 -3
- package/dist/client/{dates-DCYhZBlW.mjs → dates-wnPMiRl5.mjs} +21 -3
- package/dist/client/{eventCalendar-BgsN73Ul.mjs → eventCalendar-BA3Q5L15.mjs} +80 -78
- package/dist/client/{eventCombined-DcZQAMQP.mjs → eventCombined-51wgR-1R.mjs} +3 -3
- package/dist/client/{eventDetails-BWwGJ54l.mjs → eventDetails-modaetpm.mjs} +4 -4
- package/dist/client/{eventListing-DqYqV8vp.mjs → eventListing-D8t2J3Kv.mjs} +3 -3
- package/dist/client/{eventRegistration-DQGDgu_e.mjs → eventRegistration-CYqtkCE_.mjs} +49 -9
- package/dist/client/{form-ClfpasVT.mjs → form-CBKXN5In.mjs} +2 -2
- package/dist/client/{headerSection-BuOMe98N.mjs → headerSection-DylDqNrs.mjs} +2 -2
- package/dist/client/hooks.mjs +1259 -555
- package/dist/client/{locationMap-CEqu_sfa.mjs → locationMap-CvWrG0vZ.mjs} +2 -2
- package/dist/client/{newsletterForm-IbrHjMxy.mjs → newsletterForm-Btwk70zw.mjs} +117 -38
- package/dist/client/{pricing-xj7MPZlK.mjs → pricing-Uzw-GQ6Y.mjs} +1 -1
- package/dist/client/{productDetail-vxqTt5Xj.mjs → productDetail-JLcUYKnd.mjs} +3 -3
- package/dist/client/{productList-OTdZu8sb.mjs → productList-FM0cbUzj.mjs} +3 -3
- package/dist/client/{propsDecoder-CY9gGEF7.mjs → propsDecoder-DYzafZb2.mjs} +592 -152
- package/dist/client/rendering/client.mjs +2259 -835
- package/dist/client/rendering/islands.mjs +17 -17
- package/dist/client/rendering.mjs +3308 -1236
- package/dist/client/{scrollToBlock--BFV6kl-.mjs → scrollToBlock-CvXszexS.mjs} +1 -1
- package/dist/client/{shop-CP4YbDL9.mjs → shop-BIcjvy5a.mjs} +6 -6
- package/dist/client/{shop-commerce-APs4XBXE.mjs → shop-commerce-BZQsy7xw.mjs} +5 -5
- package/dist/client/{shop-commerce-store-CAVLxLFr.mjs → shop-commerce-store-D5V7XAb5.mjs} +1 -1
- package/dist/client/{shopShared-BnSRrwXI.mjs → shopShared-DowkXevB.mjs} +3 -3
- package/dist/client/{useEventFilters-1a1by4c8.mjs → useEventFilters-oMoTw_JE.mjs} +56 -9
- package/dist/preview-next/before-render.mjs +238 -111
- package/dist/preview-next/client/runtime.mjs +4 -4
- package/dist/preview-next/keepAlive.mjs +238 -111
- package/dist/preview-next/middleware.mjs +238 -111
- package/dist/{previewAuthStore-BkEgnYPP.mjs → previewAuthStore-COUyAKaX.mjs} +238 -111
- package/dist/{sdk-runtime-DwGfsT0S.mjs → sdk-runtime-D4k2LSGF.mjs} +2 -2
- package/dist/{separator-BeqDLneQ.mjs → separator-UGtpag4Z.mjs} +1 -1
- package/dist/server/components.mjs +2697 -1023
- package/dist/server/config-validation.mjs +2424 -1720
- package/dist/server/config.mjs +2429 -1724
- package/dist/server/data.mjs +1164 -454
- package/dist/server/index.mjs +364 -280
- package/dist/server/navigation.mjs +16 -47
- package/dist/server/next.mjs +2915 -1380
- package/dist/server/page-converter.mjs +969 -522
- package/dist/server/prebuild.mjs +2 -3
- package/dist/server/rendering/server.mjs +2704 -1030
- package/dist/server/rendering.mjs +2742 -1063
- package/dist/server/routing.mjs +1386 -595
- package/dist/server/server.mjs +2878 -2324
- package/dist/server/theme-bridge.mjs +292 -24
- package/dist/styles/index.css +289 -25
- package/package.json +1 -1
- package/dist/_dts/api/src/navigation/identity.d.ts +0 -59
- package/dist/_dts/blocks/src/system/blocks/newsletter-signup-destination.d.ts +0 -291
- package/dist/_dts/core/src/newsletter-signup-destination.d.ts +0 -38
|
@@ -8,6 +8,11 @@ function assertNever$2(value, message = "Unexpected variant") {
|
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region ../core/src/currency-format.ts
|
|
11
|
+
const CURRENCY_CODE_INPUT_PATTERN = /^[A-Za-z]{3}$/;
|
|
12
|
+
/** Parse + normalize a currency code, or return null if it isn't a 3-letter code. */
|
|
13
|
+
function parseCurrencyCode(value) {
|
|
14
|
+
return CURRENCY_CODE_INPUT_PATTERN.test(value) ? value.toUpperCase() : null;
|
|
15
|
+
}
|
|
11
16
|
const CURRENCY_LOCALE_BY_CODE = {
|
|
12
17
|
USD: "en-US",
|
|
13
18
|
GBP: "en-GB",
|
|
@@ -277,7 +282,7 @@ function parseEventPageSurfaceDestinationMode(value) {
|
|
|
277
282
|
return value === "cms-managed" || value === "system-managed" ? value : void 0;
|
|
278
283
|
}
|
|
279
284
|
function parseEventPageSurfaceSubject(value) {
|
|
280
|
-
if (!isRecord$
|
|
285
|
+
if (!isRecord$8(value)) return err$1({ kind: "notObject" });
|
|
281
286
|
switch (value.kind) {
|
|
282
287
|
case "eventSeries": {
|
|
283
288
|
const eventSeriesId = parseEventSeriesId(value.eventSeriesId);
|
|
@@ -332,7 +337,7 @@ function parseEventSeriesIdList(values) {
|
|
|
332
337
|
}
|
|
333
338
|
return ok$1(parsed);
|
|
334
339
|
}
|
|
335
|
-
function isRecord$
|
|
340
|
+
function isRecord$8(value) {
|
|
336
341
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
337
342
|
}
|
|
338
343
|
//#endregion
|
|
@@ -681,9 +686,423 @@ function localScheduleDateTimeToUtcDate(localDate, localTime, timeZone) {
|
|
|
681
686
|
return new Date(guess);
|
|
682
687
|
}
|
|
683
688
|
//#endregion
|
|
684
|
-
//#region ../core/src/
|
|
685
|
-
|
|
686
|
-
|
|
689
|
+
//#region ../core/src/mailing-list-identifiers.ts
|
|
690
|
+
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;
|
|
691
|
+
const OPAQUE_ID_PATTERN = /^[A-Za-z0-9_-]{1,100}$/u;
|
|
692
|
+
function parseTrimmedMatchingString(value, pattern) {
|
|
693
|
+
if (typeof value !== "string") return null;
|
|
694
|
+
const trimmed = value.trim();
|
|
695
|
+
return pattern.test(trimmed) ? trimmed : null;
|
|
696
|
+
}
|
|
697
|
+
function parsePositiveInteger(value) {
|
|
698
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
699
|
+
}
|
|
700
|
+
function parseNewsletterListId(value) {
|
|
701
|
+
return parseTrimmedMatchingString(value, UUID_PATTERN);
|
|
702
|
+
}
|
|
703
|
+
function parseMailchimpAudienceId(value) {
|
|
704
|
+
return parseTrimmedMatchingString(value, OPAQUE_ID_PATTERN);
|
|
705
|
+
}
|
|
706
|
+
function parseMailchimpInterestId(value) {
|
|
707
|
+
return parseTrimmedMatchingString(value, OPAQUE_ID_PATTERN);
|
|
708
|
+
}
|
|
709
|
+
function parseBrevoListId(value) {
|
|
710
|
+
return parsePositiveInteger(value);
|
|
711
|
+
}
|
|
712
|
+
//#endregion
|
|
713
|
+
//#region ../core/src/mailing-list-setup-parser.ts
|
|
714
|
+
function parseMailingListGlobalForm(value) {
|
|
715
|
+
if (!isRecord$7(value)) return formError("shape");
|
|
716
|
+
const fields = parseGlobalFields(value.fields);
|
|
717
|
+
if (fields === null) return formError("fields");
|
|
718
|
+
if (typeof value.includeOptionalPhone !== "boolean") return formError("includeOptionalPhone");
|
|
719
|
+
const buttonLabel = parseRequiredString(value.buttonLabel);
|
|
720
|
+
if (buttonLabel === null) return formError("buttonLabel");
|
|
721
|
+
const privacyNote = parseOptionalString(value.privacyNote);
|
|
722
|
+
if (privacyNote === void 0) return formError("privacyNote");
|
|
723
|
+
return ok$1({
|
|
724
|
+
fields,
|
|
725
|
+
includeOptionalPhone: value.includeOptionalPhone,
|
|
726
|
+
buttonLabel,
|
|
727
|
+
privacyNote
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
function parseGlobalFields(value) {
|
|
731
|
+
if (!isRecord$7(value) || typeof value.preset !== "string") return null;
|
|
732
|
+
switch (value.preset) {
|
|
733
|
+
case "emailOnly": return { preset: "emailOnly" };
|
|
734
|
+
case "emailName": return isRequirement(value.name) ? {
|
|
735
|
+
preset: "emailName",
|
|
736
|
+
name: value.name
|
|
737
|
+
} : null;
|
|
738
|
+
case "emailFirstLast": return isRequirement(value.firstName) && isRequirement(value.lastName) ? {
|
|
739
|
+
preset: "emailFirstLast",
|
|
740
|
+
firstName: value.firstName,
|
|
741
|
+
lastName: value.lastName
|
|
742
|
+
} : null;
|
|
743
|
+
case "emailNameCompany": return isRequirement(value.name) && isRequirement(value.company) ? {
|
|
744
|
+
preset: "emailNameCompany",
|
|
745
|
+
name: value.name,
|
|
746
|
+
company: value.company
|
|
747
|
+
} : null;
|
|
748
|
+
default: return null;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function parseMailingListSetupRevision(value) {
|
|
752
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? value : null;
|
|
753
|
+
}
|
|
754
|
+
function parseRequiredString(value) {
|
|
755
|
+
if (typeof value !== "string") return null;
|
|
756
|
+
const trimmed = value.trim();
|
|
757
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
758
|
+
}
|
|
759
|
+
function parseOptionalString(value) {
|
|
760
|
+
if (value === null || value === void 0) return null;
|
|
761
|
+
if (typeof value !== "string") return void 0;
|
|
762
|
+
const trimmed = value.trim();
|
|
763
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
764
|
+
}
|
|
765
|
+
function isRequirement(value) {
|
|
766
|
+
return value === "required" || value === "optional";
|
|
767
|
+
}
|
|
768
|
+
function isRecord$7(value) {
|
|
769
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
770
|
+
}
|
|
771
|
+
function formError(field) {
|
|
772
|
+
return err$1({
|
|
773
|
+
tag: "invalid_mailing_list_global_form",
|
|
774
|
+
field
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
//#endregion
|
|
778
|
+
//#region ../core/src/mailing-list-targeting.ts
|
|
779
|
+
function planMailingListChoicePresentation(targeting) {
|
|
780
|
+
if (targeting.mode === "default" || targeting.selection.tag === "fixed") return { tag: "hidden" };
|
|
781
|
+
switch (targeting.provider) {
|
|
782
|
+
case "native": return targeting.selection.offeredTopicIds.length === 1 ? {
|
|
783
|
+
tag: "automatic",
|
|
784
|
+
selection: {
|
|
785
|
+
provider: "native",
|
|
786
|
+
topicIds: targeting.selection.offeredTopicIds
|
|
787
|
+
}
|
|
788
|
+
} : {
|
|
789
|
+
tag: "visitor_choice",
|
|
790
|
+
provider: "native",
|
|
791
|
+
optionCount: targeting.selection.offeredTopicIds.length
|
|
792
|
+
};
|
|
793
|
+
case "brevo": return targeting.selection.offeredListIds.length === 1 ? {
|
|
794
|
+
tag: "automatic",
|
|
795
|
+
selection: {
|
|
796
|
+
provider: "brevo",
|
|
797
|
+
listIds: targeting.selection.offeredListIds
|
|
798
|
+
}
|
|
799
|
+
} : {
|
|
800
|
+
tag: "visitor_choice",
|
|
801
|
+
provider: "brevo",
|
|
802
|
+
optionCount: targeting.selection.offeredListIds.length
|
|
803
|
+
};
|
|
804
|
+
case "mailchimp": return targeting.selection.offeredInterestIds.length === 1 ? {
|
|
805
|
+
tag: "automatic",
|
|
806
|
+
selection: {
|
|
807
|
+
provider: "mailchimp",
|
|
808
|
+
interestIds: targeting.selection.offeredInterestIds
|
|
809
|
+
}
|
|
810
|
+
} : {
|
|
811
|
+
tag: "visitor_choice",
|
|
812
|
+
provider: "mailchimp",
|
|
813
|
+
optionCount: targeting.selection.offeredInterestIds.length
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region ../core/src/mailing-list-runtime.ts
|
|
819
|
+
function parseMailingListRuntimeContext(value) {
|
|
820
|
+
if (!isRecord$6(value)) return invalidRuntimeContext();
|
|
821
|
+
if (value.tag === "not_configured") return ok$1({ tag: "not_configured" });
|
|
822
|
+
if (value.tag !== "configured") return invalidRuntimeContext();
|
|
823
|
+
const revision = parseMailingListSetupRevision(value.revision);
|
|
824
|
+
const form = parseMailingListGlobalForm(value.form);
|
|
825
|
+
const provider = parseRuntimeProvider(value.provider);
|
|
826
|
+
if (revision === null || !form.ok || provider === null) return invalidRuntimeContext();
|
|
827
|
+
return ok$1({
|
|
828
|
+
tag: "configured",
|
|
829
|
+
revision,
|
|
830
|
+
form: form.value,
|
|
831
|
+
provider
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
function parseRuntimeProvider(value) {
|
|
835
|
+
if (!isRecord$6(value)) return null;
|
|
836
|
+
switch (value.provider) {
|
|
837
|
+
case "native": return parseNativeRuntimeProvider(value);
|
|
838
|
+
case "brevo": return parseBrevoRuntimeProvider(value);
|
|
839
|
+
case "mailchimp": return parseMailchimpRuntimeProvider(value);
|
|
840
|
+
default: return null;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
function parseNativeRuntimeProvider(value) {
|
|
844
|
+
const defaultTopicId = parseNewsletterListId(value.defaultTopicId);
|
|
845
|
+
const topics = parseNamedItems(value.topics, parseNewsletterListId);
|
|
846
|
+
return defaultTopicId !== null && topics !== null ? {
|
|
847
|
+
provider: "native",
|
|
848
|
+
defaultTopicId,
|
|
849
|
+
topics
|
|
850
|
+
} : null;
|
|
851
|
+
}
|
|
852
|
+
function parseBrevoRuntimeProvider(value) {
|
|
853
|
+
const defaultListId = parseBrevoListId(value.defaultListId);
|
|
854
|
+
const lists = parseNamedItems(value.lists, parseBrevoListId);
|
|
855
|
+
return defaultListId !== null && lists !== null ? {
|
|
856
|
+
provider: "brevo",
|
|
857
|
+
defaultListId,
|
|
858
|
+
lists
|
|
859
|
+
} : null;
|
|
860
|
+
}
|
|
861
|
+
function parseMailchimpRuntimeProvider(value) {
|
|
862
|
+
if (!Array.isArray(value.audiences)) return null;
|
|
863
|
+
const defaultAudienceId = parseMailchimpAudienceId(value.defaultAudienceId);
|
|
864
|
+
if (defaultAudienceId === null) return null;
|
|
865
|
+
const audiences = [];
|
|
866
|
+
for (const audience of value.audiences) {
|
|
867
|
+
if (!isRecord$6(audience)) return null;
|
|
868
|
+
const id = parseMailchimpAudienceId(audience.id);
|
|
869
|
+
const name = parseName(audience.name);
|
|
870
|
+
if (id === null || name === null || !Array.isArray(audience.interests)) return null;
|
|
871
|
+
const interests = parseMailchimpInterests(audience.interests);
|
|
872
|
+
if (interests === null) return null;
|
|
873
|
+
audiences.push({
|
|
874
|
+
id,
|
|
875
|
+
name,
|
|
876
|
+
interests
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
return {
|
|
880
|
+
provider: "mailchimp",
|
|
881
|
+
defaultAudienceId,
|
|
882
|
+
audiences
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
function parseMailchimpInterests(value) {
|
|
886
|
+
const interests = [];
|
|
887
|
+
for (const interest of value) {
|
|
888
|
+
if (!isRecord$6(interest)) return null;
|
|
889
|
+
const id = parseMailchimpInterestId(interest.id);
|
|
890
|
+
const name = parseName(interest.name);
|
|
891
|
+
const categoryName = parseName(interest.categoryName);
|
|
892
|
+
if (id === null || name === null || categoryName === null) return null;
|
|
893
|
+
interests.push({
|
|
894
|
+
id,
|
|
895
|
+
name,
|
|
896
|
+
categoryName
|
|
897
|
+
});
|
|
898
|
+
}
|
|
899
|
+
return interests;
|
|
900
|
+
}
|
|
901
|
+
function parseNamedItems(value, parseId) {
|
|
902
|
+
if (!Array.isArray(value)) return null;
|
|
903
|
+
const items = [];
|
|
904
|
+
for (const item of value) {
|
|
905
|
+
if (!isRecord$6(item)) return null;
|
|
906
|
+
const id = parseId(item.id);
|
|
907
|
+
const name = parseName(item.name);
|
|
908
|
+
if (id === null || name === null) return null;
|
|
909
|
+
items.push({
|
|
910
|
+
id,
|
|
911
|
+
name
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
return items;
|
|
915
|
+
}
|
|
916
|
+
function parseName(value) {
|
|
917
|
+
if (typeof value !== "string") return null;
|
|
918
|
+
const name = value.trim();
|
|
919
|
+
return name.length > 0 ? name : null;
|
|
920
|
+
}
|
|
921
|
+
function isRecord$6(value) {
|
|
922
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
923
|
+
}
|
|
924
|
+
function invalidRuntimeContext() {
|
|
925
|
+
return err$1({ tag: "invalid_mailing_list_runtime_context" });
|
|
926
|
+
}
|
|
927
|
+
//#endregion
|
|
928
|
+
//#region ../core/src/mailing-list-targeting-parser.ts
|
|
929
|
+
function parseMailingListPlacementTargeting(value) {
|
|
930
|
+
if (!isRecord$5(value)) return targetingError("shape");
|
|
931
|
+
if (value.mode === "default") return ok$1({ mode: "default" });
|
|
932
|
+
if (value.mode !== "custom") return targetingError("mode");
|
|
933
|
+
if (!isRecord$5(value.selection)) return targetingError("selection");
|
|
934
|
+
switch (value.provider) {
|
|
935
|
+
case "native": return parseNativeTargeting(value.selection);
|
|
936
|
+
case "brevo": return parseBrevoTargeting(value.selection);
|
|
937
|
+
case "mailchimp": return parseMailchimpTargeting(value, value.selection);
|
|
938
|
+
default: return targetingError("provider");
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
function parseMailingListVisitorSelection(value) {
|
|
942
|
+
if (!isRecord$5(value)) return visitorSelectionError("shape");
|
|
943
|
+
switch (value.provider) {
|
|
944
|
+
case "native": {
|
|
945
|
+
const topicIds = parseVisitorIds(value.topicIds, parseNewsletterListId);
|
|
946
|
+
return topicIds === null ? visitorSelectionError("targets") : ok$1({
|
|
947
|
+
provider: "native",
|
|
948
|
+
topicIds
|
|
949
|
+
});
|
|
950
|
+
}
|
|
951
|
+
case "brevo": {
|
|
952
|
+
const listIds = parseVisitorIds(value.listIds, parseBrevoListId);
|
|
953
|
+
return listIds === null ? visitorSelectionError("targets") : ok$1({
|
|
954
|
+
provider: "brevo",
|
|
955
|
+
listIds
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
case "mailchimp": {
|
|
959
|
+
const interestIds = parseVisitorIds(value.interestIds, parseMailchimpInterestId);
|
|
960
|
+
return interestIds === null ? visitorSelectionError("targets") : ok$1({
|
|
961
|
+
provider: "mailchimp",
|
|
962
|
+
interestIds
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
default: return visitorSelectionError("provider");
|
|
966
|
+
}
|
|
967
|
+
}
|
|
968
|
+
function parseNativeTargeting(selection) {
|
|
969
|
+
if (selection.tag === "fixed") {
|
|
970
|
+
const topicIds = parseNonEmptyUniqueIds(selection.topicIds, parseNewsletterListId);
|
|
971
|
+
return topicIds.ok ? ok$1({
|
|
972
|
+
mode: "custom",
|
|
973
|
+
provider: "native",
|
|
974
|
+
selection: {
|
|
975
|
+
tag: "fixed",
|
|
976
|
+
topicIds: topicIds.value
|
|
977
|
+
}
|
|
978
|
+
}) : topicIds;
|
|
979
|
+
}
|
|
980
|
+
if (selection.tag === "visitor_choice") {
|
|
981
|
+
const offeredTopicIds = parseNonEmptyUniqueIds(selection.offeredTopicIds, parseNewsletterListId);
|
|
982
|
+
return offeredTopicIds.ok ? ok$1({
|
|
983
|
+
mode: "custom",
|
|
984
|
+
provider: "native",
|
|
985
|
+
selection: {
|
|
986
|
+
tag: "visitor_choice",
|
|
987
|
+
offeredTopicIds: offeredTopicIds.value
|
|
988
|
+
}
|
|
989
|
+
}) : offeredTopicIds;
|
|
990
|
+
}
|
|
991
|
+
return targetingError("selection");
|
|
992
|
+
}
|
|
993
|
+
function parseBrevoTargeting(selection) {
|
|
994
|
+
if (selection.tag === "fixed") {
|
|
995
|
+
const listIds = parseNonEmptyUniqueIds(selection.listIds, parseBrevoListId);
|
|
996
|
+
return listIds.ok ? ok$1({
|
|
997
|
+
mode: "custom",
|
|
998
|
+
provider: "brevo",
|
|
999
|
+
selection: {
|
|
1000
|
+
tag: "fixed",
|
|
1001
|
+
listIds: listIds.value
|
|
1002
|
+
}
|
|
1003
|
+
}) : listIds;
|
|
1004
|
+
}
|
|
1005
|
+
if (selection.tag === "visitor_choice") {
|
|
1006
|
+
const offeredListIds = parseNonEmptyUniqueIds(selection.offeredListIds, parseBrevoListId);
|
|
1007
|
+
return offeredListIds.ok ? ok$1({
|
|
1008
|
+
mode: "custom",
|
|
1009
|
+
provider: "brevo",
|
|
1010
|
+
selection: {
|
|
1011
|
+
tag: "visitor_choice",
|
|
1012
|
+
offeredListIds: offeredListIds.value
|
|
1013
|
+
}
|
|
1014
|
+
}) : offeredListIds;
|
|
1015
|
+
}
|
|
1016
|
+
return targetingError("selection");
|
|
1017
|
+
}
|
|
1018
|
+
function parseMailchimpTargeting(value, selection) {
|
|
1019
|
+
const audienceId = parseMailchimpAudienceId(value.audienceId);
|
|
1020
|
+
if (audienceId === null) return targetingError("audienceId");
|
|
1021
|
+
if (selection.tag === "fixed") {
|
|
1022
|
+
const interestIds = parseUniqueIds(selection.interestIds, parseMailchimpInterestId);
|
|
1023
|
+
return interestIds.ok ? ok$1({
|
|
1024
|
+
mode: "custom",
|
|
1025
|
+
provider: "mailchimp",
|
|
1026
|
+
audienceId,
|
|
1027
|
+
selection: {
|
|
1028
|
+
tag: "fixed",
|
|
1029
|
+
interestIds: interestIds.value
|
|
1030
|
+
}
|
|
1031
|
+
}) : interestIds;
|
|
1032
|
+
}
|
|
1033
|
+
if (selection.tag === "visitor_choice") {
|
|
1034
|
+
const offeredInterestIds = parseNonEmptyUniqueIds(selection.offeredInterestIds, parseMailchimpInterestId);
|
|
1035
|
+
return offeredInterestIds.ok ? ok$1({
|
|
1036
|
+
mode: "custom",
|
|
1037
|
+
provider: "mailchimp",
|
|
1038
|
+
audienceId,
|
|
1039
|
+
selection: {
|
|
1040
|
+
tag: "visitor_choice",
|
|
1041
|
+
offeredInterestIds: offeredInterestIds.value
|
|
1042
|
+
}
|
|
1043
|
+
}) : offeredInterestIds;
|
|
1044
|
+
}
|
|
1045
|
+
return targetingError("selection");
|
|
1046
|
+
}
|
|
1047
|
+
function parseNonEmptyUniqueIds(value, parseId) {
|
|
1048
|
+
const parsed = parseUniqueIds(value, parseId);
|
|
1049
|
+
if (!parsed.ok) return parsed;
|
|
1050
|
+
const [first, ...rest] = parsed.value;
|
|
1051
|
+
return first === void 0 ? targetingError("targets") : ok$1([first, ...rest]);
|
|
1052
|
+
}
|
|
1053
|
+
function parseUniqueIds(value, parseId) {
|
|
1054
|
+
if (!Array.isArray(value)) return targetingError("targets");
|
|
1055
|
+
const parsed = [];
|
|
1056
|
+
for (const item of value) {
|
|
1057
|
+
const id = parseId(item);
|
|
1058
|
+
if (id === null) return targetingError("targets");
|
|
1059
|
+
if (parsed.includes(id)) return targetingError("duplicate_target");
|
|
1060
|
+
parsed.push(id);
|
|
1061
|
+
}
|
|
1062
|
+
return ok$1(parsed);
|
|
1063
|
+
}
|
|
1064
|
+
function parseVisitorIds(value, parseId) {
|
|
1065
|
+
if (!Array.isArray(value) || value.length === 0) return null;
|
|
1066
|
+
const parsed = [];
|
|
1067
|
+
for (const item of value) {
|
|
1068
|
+
const id = parseId(item);
|
|
1069
|
+
if (id === null) return null;
|
|
1070
|
+
if (parsed.includes(id)) return null;
|
|
1071
|
+
parsed.push(id);
|
|
1072
|
+
}
|
|
1073
|
+
return parsed;
|
|
1074
|
+
}
|
|
1075
|
+
function isRecord$5(value) {
|
|
1076
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1077
|
+
}
|
|
1078
|
+
function targetingError(field) {
|
|
1079
|
+
return err$1({
|
|
1080
|
+
tag: "invalid_mailing_list_targeting",
|
|
1081
|
+
field
|
|
1082
|
+
});
|
|
1083
|
+
}
|
|
1084
|
+
function visitorSelectionError(field) {
|
|
1085
|
+
return err$1({
|
|
1086
|
+
tag: "invalid_mailing_list_visitor_selection",
|
|
1087
|
+
field
|
|
1088
|
+
});
|
|
1089
|
+
}
|
|
1090
|
+
//#endregion
|
|
1091
|
+
//#region ../core/src/mailing-list-submission.ts
|
|
1092
|
+
function parseMailingListBlockId(value) {
|
|
1093
|
+
const parsed = typeof value === "string" ? value.trim() : "";
|
|
1094
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu.test(parsed) ? parsed : null;
|
|
1095
|
+
}
|
|
1096
|
+
function parseMailingListSignedSourceToken(value) {
|
|
1097
|
+
const parsed = typeof value === "string" ? value.trim() : "";
|
|
1098
|
+
return /^[A-Za-z0-9._~-]{16,1000}$/u.test(parsed) ? parsed : null;
|
|
1099
|
+
}
|
|
1100
|
+
function buildMailingListSignupBlockSourceRef(blockId) {
|
|
1101
|
+
const parsed = parseMailingListBlockId(blockId);
|
|
1102
|
+
return parsed !== null ? {
|
|
1103
|
+
tag: "block_ref",
|
|
1104
|
+
blockId: parsed
|
|
1105
|
+
} : null;
|
|
687
1106
|
}
|
|
688
1107
|
//#endregion
|
|
689
1108
|
//#region ../core/src/whole-series-run-schedule.ts
|
|
@@ -10482,8 +10901,8 @@ const eventRegistrationIslandMetaCodec = createZodCodec(z.object({
|
|
|
10482
10901
|
stage: previewStageSchema.optional()
|
|
10483
10902
|
}));
|
|
10484
10903
|
const eventRegistrationIslandMetaKeys = defineInteractiveIslandMetaKeys("siteId", "apiBaseUrl", "portalToken", "previewToken", "stage");
|
|
10485
|
-
function
|
|
10486
|
-
const selectedRun = resolveSelectedWholeSeriesRun(
|
|
10904
|
+
function buildEventRegistrationDisplayFromScopedEvents(source, scopedSourceEvents) {
|
|
10905
|
+
const selectedRun = resolveSelectedWholeSeriesRun(scopedSourceEvents);
|
|
10487
10906
|
if (selectedRun && (!selectedRun.run.enrollmentOpen || toWholeSeriesRegistrationEvent(selectedRun) === null)) return {
|
|
10488
10907
|
kind: "event-registration",
|
|
10489
10908
|
state: "registration-closed",
|
|
@@ -10491,7 +10910,7 @@ function buildEventRegistrationDisplay(source) {
|
|
|
10491
10910
|
titleText: "Registration closed",
|
|
10492
10911
|
bodyText: "This run is no longer open for bookings."
|
|
10493
10912
|
};
|
|
10494
|
-
const stepLabels = buildEventRegistrationShellStepLabels(source);
|
|
10913
|
+
const stepLabels = buildEventRegistrationShellStepLabels(source, scopedSourceEvents);
|
|
10495
10914
|
return {
|
|
10496
10915
|
kind: "event-registration",
|
|
10497
10916
|
state: "generic-shell",
|
|
@@ -10502,8 +10921,8 @@ function buildEventRegistrationDisplay(source) {
|
|
|
10502
10921
|
summaryButtonText: source.buttonText?.trim() || "Register"
|
|
10503
10922
|
};
|
|
10504
10923
|
}
|
|
10505
|
-
function buildEventRegistrationShellStepLabels(source) {
|
|
10506
|
-
const selectedRun = resolveSelectedWholeSeriesRun(
|
|
10924
|
+
function buildEventRegistrationShellStepLabels(source, scopedSourceEvents) {
|
|
10925
|
+
const selectedRun = resolveSelectedWholeSeriesRun(scopedSourceEvents);
|
|
10507
10926
|
if (selectedRun) {
|
|
10508
10927
|
const selectedEvent = toWholeSeriesRegistrationEvent(selectedRun);
|
|
10509
10928
|
if (!selectedEvent) return EVENT_REGISTRATION_GENERIC_SHELL_STEP_LABELS;
|
|
@@ -10513,7 +10932,7 @@ function buildEventRegistrationShellStepLabels(source) {
|
|
|
10513
10932
|
event: selectedEvent
|
|
10514
10933
|
})).map((step) => shellLabelForRegistrationStep(step, [selectedEvent]));
|
|
10515
10934
|
}
|
|
10516
|
-
const scopedEvents =
|
|
10935
|
+
const scopedEvents = toScopedEventRegistrationEvents(scopedSourceEvents);
|
|
10517
10936
|
if (scopedEvents.length === 0) return EVENT_REGISTRATION_GENERIC_SHELL_STEP_LABELS;
|
|
10518
10937
|
const preSelectedEvent = findPreSelectedEvent({
|
|
10519
10938
|
scopedEvents,
|
|
@@ -10526,31 +10945,25 @@ function buildEventRegistrationShellStepLabels(source) {
|
|
|
10526
10945
|
event: preSelectedEvent
|
|
10527
10946
|
}) : false).map((step) => shellLabelForRegistrationStep(step, scopedEvents));
|
|
10528
10947
|
}
|
|
10529
|
-
function
|
|
10530
|
-
|
|
10531
|
-
return [...toRegistrationEvents(scoped), ...toWholeSeriesRegistrationEvents(scoped)];
|
|
10948
|
+
function toScopedEventRegistrationEvents(scopedSourceEvents) {
|
|
10949
|
+
return [...toRegistrationEvents(scopedSourceEvents), ...toWholeSeriesRegistrationEvents(scopedSourceEvents)];
|
|
10532
10950
|
}
|
|
10533
|
-
/**
|
|
10534
|
-
* Every event this surface may register for, from both of its loads.
|
|
10535
|
-
*
|
|
10536
|
-
* The date page and the run read answer different questions and can name the
|
|
10537
|
-
* same occurrence, so the two lists are joined and any occurrence that arrives
|
|
10538
|
-
* twice is kept once, in the order the date page gave it.
|
|
10539
|
-
*/
|
|
10540
10951
|
function scopeEventRegistrationSourceEvents(source) {
|
|
10541
|
-
|
|
10542
|
-
for (const event of [...source.events ?? [], ...source.wholeSeriesRunEvents ?? []]) if (!byOccurrenceId.has(event.occurrenceId)) byOccurrenceId.set(event.occurrenceId, event);
|
|
10543
|
-
return resolveEventRegistrationScopedEvents([...byOccurrenceId.values()], {
|
|
10952
|
+
return resolveEventRegistrationScopedEvents(source.wholeSeriesRunEvents ?? source.events ?? [], {
|
|
10544
10953
|
occurrenceContext: source.occurrenceContext,
|
|
10545
10954
|
subject: source.subject
|
|
10546
10955
|
});
|
|
10547
10956
|
}
|
|
10957
|
+
function resolveLoadedEventRegistrationSourceEvents(source, scopedSourceEvents) {
|
|
10958
|
+
if (source.events == null && source.wholeSeriesRunEvents == null) return null;
|
|
10959
|
+
return [...scopedSourceEvents];
|
|
10960
|
+
}
|
|
10548
10961
|
/**
|
|
10549
10962
|
* The one run this surface is registering for, when the scoped events describe
|
|
10550
10963
|
* exactly one. More than one run means the visitor still has to choose.
|
|
10551
10964
|
*/
|
|
10552
|
-
function resolveSelectedWholeSeriesRun(
|
|
10553
|
-
const runs = groupPublicEventsByRun(
|
|
10965
|
+
function resolveSelectedWholeSeriesRun(scopedSourceEvents) {
|
|
10966
|
+
const runs = groupPublicEventsByRun(scopedSourceEvents);
|
|
10554
10967
|
return runs.length === 1 ? runs[0] : null;
|
|
10555
10968
|
}
|
|
10556
10969
|
function shellLabelForRegistrationStep(step, events) {
|
|
@@ -10584,9 +10997,10 @@ const eventRegistrationBlockRuntime = defineClientOwnedBlockRuntime({
|
|
|
10584
10997
|
render: createZodCodec(eventRegistrationRenderSchema)
|
|
10585
10998
|
},
|
|
10586
10999
|
buildRender: (source) => {
|
|
10587
|
-
const
|
|
11000
|
+
const scopedSourceEvents = scopeEventRegistrationSourceEvents(source);
|
|
11001
|
+
const events = resolveLoadedEventRegistrationSourceEvents(source, scopedSourceEvents);
|
|
10588
11002
|
return {
|
|
10589
|
-
display:
|
|
11003
|
+
display: buildEventRegistrationDisplayFromScopedEvents(source, scopedSourceEvents),
|
|
10590
11004
|
hydration: {
|
|
10591
11005
|
occurrenceContext: source.occurrenceContext ?? null,
|
|
10592
11006
|
subject: source.subject ?? null,
|
|
@@ -10863,63 +11277,13 @@ const giftingInteractiveIslandPropsCodec = createInteractiveIslandCodec({
|
|
|
10863
11277
|
})
|
|
10864
11278
|
});
|
|
10865
11279
|
//#endregion
|
|
10866
|
-
//#region ../blocks/src/system/blocks/newsletter-signup-destination.ts
|
|
10867
|
-
function parseNewsletterSignupBlockId(value) {
|
|
10868
|
-
const trimmed = parseTrimmedString(value);
|
|
10869
|
-
return trimmed && BLOCK_ID_PATTERN.test(trimmed) ? trimmed : null;
|
|
10870
|
-
}
|
|
10871
|
-
function parseSignedNewsletterDestinationRef(value) {
|
|
10872
|
-
const trimmed = parseTrimmedString(value);
|
|
10873
|
-
return trimmed && SIGNED_DESTINATION_REF_PATTERN.test(trimmed) ? trimmed : null;
|
|
10874
|
-
}
|
|
10875
|
-
function buildNewsletterSignupBlockRef(blockId) {
|
|
10876
|
-
const parsed = parseNewsletterSignupBlockId(blockId);
|
|
10877
|
-
return parsed ? {
|
|
10878
|
-
tag: "block_ref",
|
|
10879
|
-
blockId: parsed
|
|
10880
|
-
} : null;
|
|
10881
|
-
}
|
|
10882
|
-
function normalizeNewsletterSignupEditorValuesForDestination(values) {
|
|
10883
|
-
const destinationProvider = parseNewsletterSignupDestinationProvider(values.destinationProvider) ?? "riverbank";
|
|
10884
|
-
if (destinationProvider === "mailchimp") return {
|
|
10885
|
-
destinationProvider,
|
|
10886
|
-
mailchimpAudienceId: values.mailchimpAudienceId,
|
|
10887
|
-
mailchimpTags: values.mailchimpTags
|
|
10888
|
-
};
|
|
10889
|
-
return {
|
|
10890
|
-
destinationProvider,
|
|
10891
|
-
listId: values.listId,
|
|
10892
|
-
tags: values.tags
|
|
10893
|
-
};
|
|
10894
|
-
}
|
|
10895
|
-
function deriveNewsletterSignupRuntimeSource(values) {
|
|
10896
|
-
const normalized = normalizeNewsletterSignupEditorValuesForDestination(values);
|
|
10897
|
-
if (normalized.destinationProvider === "mailchimp") return {
|
|
10898
|
-
destinationProvider: "mailchimp",
|
|
10899
|
-
listId: null,
|
|
10900
|
-
tags: null
|
|
10901
|
-
};
|
|
10902
|
-
return {
|
|
10903
|
-
destinationProvider: "riverbank",
|
|
10904
|
-
listId: parseTrimmedString(normalized.listId),
|
|
10905
|
-
tags: parseTrimmedString(normalized.tags)
|
|
10906
|
-
};
|
|
10907
|
-
}
|
|
10908
|
-
const BLOCK_ID_PATTERN = /^[A-Za-z0-9._:-]{1,200}$/;
|
|
10909
|
-
const SIGNED_DESTINATION_REF_PATTERN = /^[A-Za-z0-9._~-]{16,1000}$/;
|
|
10910
|
-
function parseTrimmedString(value) {
|
|
10911
|
-
if (typeof value !== "string") return null;
|
|
10912
|
-
const trimmed = value.trim();
|
|
10913
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
10914
|
-
}
|
|
10915
|
-
//#endregion
|
|
10916
11280
|
//#region ../blocks/src/system/runtime/nodes/newsletter-form.types.ts
|
|
10917
11281
|
/**
|
|
10918
11282
|
* Get form fields based on preset configuration.
|
|
10919
11283
|
*/
|
|
10920
|
-
function
|
|
10921
|
-
const includePhone =
|
|
10922
|
-
switch (preset) {
|
|
11284
|
+
function getGlobalFormFields(form) {
|
|
11285
|
+
const includePhone = form.includeOptionalPhone;
|
|
11286
|
+
switch (form.fields.preset) {
|
|
10923
11287
|
case "emailOnly": return withOptionalPhone([{
|
|
10924
11288
|
id: "email",
|
|
10925
11289
|
type: "email",
|
|
@@ -10937,7 +11301,7 @@ function getPresetFields(preset, options) {
|
|
|
10937
11301
|
id: "name",
|
|
10938
11302
|
type: "text",
|
|
10939
11303
|
label: "Name",
|
|
10940
|
-
required:
|
|
11304
|
+
required: form.fields.name === "required",
|
|
10941
11305
|
placeholder: "Your name"
|
|
10942
11306
|
}], includePhone);
|
|
10943
11307
|
case "emailFirstLast": return withOptionalPhone([
|
|
@@ -10952,14 +11316,14 @@ function getPresetFields(preset, options) {
|
|
|
10952
11316
|
id: "firstName",
|
|
10953
11317
|
type: "text",
|
|
10954
11318
|
label: "First Name",
|
|
10955
|
-
required:
|
|
11319
|
+
required: form.fields.firstName === "required",
|
|
10956
11320
|
placeholder: "First name"
|
|
10957
11321
|
},
|
|
10958
11322
|
{
|
|
10959
11323
|
id: "lastName",
|
|
10960
11324
|
type: "text",
|
|
10961
11325
|
label: "Last Name",
|
|
10962
|
-
required:
|
|
11326
|
+
required: form.fields.lastName === "required",
|
|
10963
11327
|
placeholder: "Last name"
|
|
10964
11328
|
}
|
|
10965
11329
|
], includePhone);
|
|
@@ -10975,14 +11339,14 @@ function getPresetFields(preset, options) {
|
|
|
10975
11339
|
id: "name",
|
|
10976
11340
|
type: "text",
|
|
10977
11341
|
label: "Name",
|
|
10978
|
-
required:
|
|
11342
|
+
required: form.fields.name === "required",
|
|
10979
11343
|
placeholder: "Your name"
|
|
10980
11344
|
},
|
|
10981
11345
|
{
|
|
10982
11346
|
id: "company",
|
|
10983
11347
|
type: "text",
|
|
10984
11348
|
label: "Company",
|
|
10985
|
-
required:
|
|
11349
|
+
required: form.fields.company === "required",
|
|
10986
11350
|
placeholder: "Company name"
|
|
10987
11351
|
}
|
|
10988
11352
|
], includePhone);
|
|
@@ -11001,14 +11365,29 @@ function withOptionalPhone(fields, includePhone) {
|
|
|
11001
11365
|
}
|
|
11002
11366
|
//#endregion
|
|
11003
11367
|
//#region ../blocks/src/system/runtime/nodes/newsletter-form.interactive.ts
|
|
11004
|
-
const newsletterPresetSchema = z.enum([
|
|
11005
|
-
"emailOnly",
|
|
11006
|
-
"emailName",
|
|
11007
|
-
"emailFirstLast",
|
|
11008
|
-
"emailNameCompany"
|
|
11009
|
-
]);
|
|
11010
|
-
const newsletterDestinationProviderSchema = z.enum(["riverbank", "mailchimp"]);
|
|
11011
11368
|
const newsletterButtonVariantSchema = blockButtonRoleSchema;
|
|
11369
|
+
const mailingListContextSchema = z.unknown().transform((value, ctx) => {
|
|
11370
|
+
const parsed = parseMailingListRuntimeContext(value);
|
|
11371
|
+
if (!parsed.ok) {
|
|
11372
|
+
ctx.addIssue({
|
|
11373
|
+
code: z.ZodIssueCode.custom,
|
|
11374
|
+
message: "Invalid mailing-list runtime context"
|
|
11375
|
+
});
|
|
11376
|
+
return z.NEVER;
|
|
11377
|
+
}
|
|
11378
|
+
return parsed.value;
|
|
11379
|
+
});
|
|
11380
|
+
const mailingListTargetingSchema = z.unknown().transform((value, ctx) => {
|
|
11381
|
+
const parsed = parseMailingListPlacementTargeting(value);
|
|
11382
|
+
if (!parsed.ok) {
|
|
11383
|
+
ctx.addIssue({
|
|
11384
|
+
code: z.ZodIssueCode.custom,
|
|
11385
|
+
message: "Invalid mailing-list targeting"
|
|
11386
|
+
});
|
|
11387
|
+
return z.NEVER;
|
|
11388
|
+
}
|
|
11389
|
+
return parsed.value;
|
|
11390
|
+
});
|
|
11012
11391
|
const newsletterFieldSchema = z.object({
|
|
11013
11392
|
id: z.string(),
|
|
11014
11393
|
type: z.enum(["email", "text"]),
|
|
@@ -11016,73 +11395,73 @@ const newsletterFieldSchema = z.object({
|
|
|
11016
11395
|
required: z.boolean(),
|
|
11017
11396
|
placeholder: z.string().optional()
|
|
11018
11397
|
});
|
|
11019
|
-
const
|
|
11020
|
-
const
|
|
11398
|
+
const mailingListSignupBlockIdSchema = z.string().trim().min(1).transform(parseRequiredMailingListSignupBlockId);
|
|
11399
|
+
const signedMailingListSourceTokenSchema = z.string().trim().min(1).transform(parseRequiredMailingListSignedSourceToken);
|
|
11021
11400
|
const newsletterSourceCommonSchema = z.object({
|
|
11022
11401
|
siteId: z.string().optional(),
|
|
11023
11402
|
apiBaseUrl: z.string().optional(),
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
buttonLabel: z.string().nullable().optional(),
|
|
11403
|
+
mailingList: mailingListContextSchema.optional(),
|
|
11404
|
+
targeting: mailingListTargetingSchema.optional(),
|
|
11027
11405
|
buttonVariant: newsletterButtonVariantSchema.nullable().optional(),
|
|
11028
|
-
successMessage: z.string().nullable().optional(),
|
|
11029
|
-
privacyNote: z.string().nullable().optional(),
|
|
11030
|
-
tags: z.string().nullable().optional(),
|
|
11031
11406
|
spamProtectionEnabled: z.boolean().optional(),
|
|
11032
11407
|
className: z.string().nullable().optional()
|
|
11033
11408
|
});
|
|
11034
11409
|
const newsletterSourceSchema = z.discriminatedUnion("source", [
|
|
11035
11410
|
newsletterSourceCommonSchema.extend({
|
|
11036
11411
|
source: z.literal("block"),
|
|
11037
|
-
blockId: z.string().nullable().optional()
|
|
11038
|
-
listId: z.string().nullable().optional(),
|
|
11039
|
-
destinationProvider: newsletterDestinationProviderSchema.nullable().optional()
|
|
11412
|
+
blockId: z.string().nullable().optional()
|
|
11040
11413
|
}),
|
|
11041
11414
|
newsletterSourceCommonSchema.extend({
|
|
11042
11415
|
source: z.literal("signed-footer"),
|
|
11043
|
-
|
|
11044
|
-
tag: z.literal("
|
|
11045
|
-
token:
|
|
11416
|
+
sourceRef: z.object({
|
|
11417
|
+
tag: z.literal("signed_source_ref"),
|
|
11418
|
+
token: signedMailingListSourceTokenSchema
|
|
11046
11419
|
})
|
|
11047
11420
|
}),
|
|
11048
|
-
newsletterSourceCommonSchema.extend({
|
|
11049
|
-
source: z.literal("legacy-direct-list"),
|
|
11050
|
-
listId: z.string().nullable()
|
|
11051
|
-
})
|
|
11421
|
+
newsletterSourceCommonSchema.extend({ source: z.literal("preview") })
|
|
11052
11422
|
]);
|
|
11053
11423
|
const newsletterDisplaySchema = z.object({
|
|
11054
11424
|
kind: z.literal("newsletter-form"),
|
|
11425
|
+
availability: z.enum(["ready", "unavailable"]),
|
|
11055
11426
|
className: z.string().nullable(),
|
|
11056
11427
|
buttonLabel: z.string(),
|
|
11057
11428
|
buttonVariant: newsletterButtonVariantSchema,
|
|
11058
|
-
successMessage: z.string().nullable(),
|
|
11059
11429
|
privacyNote: z.string().nullable(),
|
|
11060
|
-
fields: z.array(newsletterFieldSchema)
|
|
11430
|
+
fields: z.array(newsletterFieldSchema),
|
|
11431
|
+
choices: z.array(z.object({
|
|
11432
|
+
id: z.string(),
|
|
11433
|
+
label: z.string()
|
|
11434
|
+
}))
|
|
11061
11435
|
});
|
|
11062
11436
|
const newsletterHydrationSchema = z.object({
|
|
11063
11437
|
target: z.discriminatedUnion("tag", [
|
|
11064
11438
|
z.object({
|
|
11065
11439
|
tag: z.literal("block-source"),
|
|
11066
|
-
|
|
11440
|
+
sourceRef: z.object({
|
|
11067
11441
|
tag: z.literal("block_ref"),
|
|
11068
|
-
blockId:
|
|
11442
|
+
blockId: mailingListSignupBlockIdSchema
|
|
11069
11443
|
}).nullable()
|
|
11070
11444
|
}),
|
|
11071
11445
|
z.object({
|
|
11072
11446
|
tag: z.literal("signed-footer-source"),
|
|
11073
|
-
|
|
11074
|
-
tag: z.literal("
|
|
11075
|
-
token:
|
|
11447
|
+
sourceRef: z.object({
|
|
11448
|
+
tag: z.literal("signed_source_ref"),
|
|
11449
|
+
token: signedMailingListSourceTokenSchema
|
|
11076
11450
|
})
|
|
11077
11451
|
}),
|
|
11078
|
-
z.object({
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11452
|
+
z.object({ tag: z.literal("preview") })
|
|
11453
|
+
]),
|
|
11454
|
+
setupRevision: z.number().int().positive().nullable(),
|
|
11455
|
+
choiceProvider: z.enum([
|
|
11456
|
+
"native",
|
|
11457
|
+
"brevo",
|
|
11458
|
+
"mailchimp"
|
|
11459
|
+
]).nullable(),
|
|
11460
|
+
choicePresentation: z.enum([
|
|
11461
|
+
"hidden",
|
|
11462
|
+
"automatic",
|
|
11463
|
+
"visitor_choice"
|
|
11082
11464
|
]),
|
|
11083
|
-
preset: newsletterPresetSchema,
|
|
11084
|
-
includePhone: z.boolean(),
|
|
11085
|
-
tags: z.string().nullable().optional(),
|
|
11086
11465
|
spamProtectionEnabled: z.boolean().optional()
|
|
11087
11466
|
});
|
|
11088
11467
|
const newsletterRenderSchema = z.object({
|
|
@@ -11095,16 +11474,24 @@ const newsletterIslandMetaCodec = createZodCodec(z.object({
|
|
|
11095
11474
|
}));
|
|
11096
11475
|
const newsletterIslandMetaKeys = defineInteractiveIslandMetaKeys("siteId", "apiBaseUrl");
|
|
11097
11476
|
function buildNewsletterDisplay(source) {
|
|
11098
|
-
const
|
|
11099
|
-
const
|
|
11477
|
+
const context = source.mailingList;
|
|
11478
|
+
const form = context?.tag === "configured" ? context.form : {
|
|
11479
|
+
fields: { preset: "emailOnly" },
|
|
11480
|
+
includeOptionalPhone: false,
|
|
11481
|
+
buttonLabel: "Subscribe",
|
|
11482
|
+
privacyNote: null
|
|
11483
|
+
};
|
|
11484
|
+
const targeting = source.targeting ?? { mode: "default" };
|
|
11485
|
+
const choices = resolveRuntimeChoices(context, targeting);
|
|
11100
11486
|
return {
|
|
11101
11487
|
kind: "newsletter-form",
|
|
11488
|
+
availability: runtimeTargetingIsAvailable(context, targeting, choices) ? "ready" : "unavailable",
|
|
11102
11489
|
className: source.className ?? null,
|
|
11103
|
-
buttonLabel:
|
|
11490
|
+
buttonLabel: form.buttonLabel,
|
|
11104
11491
|
buttonVariant: source.buttonVariant ?? "primary",
|
|
11105
|
-
|
|
11106
|
-
|
|
11107
|
-
|
|
11492
|
+
privacyNote: form.privacyNote,
|
|
11493
|
+
fields: getGlobalFormFields(form),
|
|
11494
|
+
choices
|
|
11108
11495
|
};
|
|
11109
11496
|
}
|
|
11110
11497
|
const newsletterFormBlockRuntime = defineProgressiveBlockRuntime({
|
|
@@ -11114,14 +11501,15 @@ const newsletterFormBlockRuntime = defineProgressiveBlockRuntime({
|
|
|
11114
11501
|
render: createZodCodec(newsletterRenderSchema)
|
|
11115
11502
|
},
|
|
11116
11503
|
buildRender: (source) => {
|
|
11117
|
-
const
|
|
11504
|
+
const targeting = source.targeting ?? { mode: "default" };
|
|
11505
|
+
const presentation = planMailingListChoicePresentation(targeting);
|
|
11118
11506
|
return {
|
|
11119
11507
|
display: buildNewsletterDisplay(source),
|
|
11120
11508
|
hydration: {
|
|
11121
11509
|
target: projectNewsletterFormHydrationTarget(source),
|
|
11122
|
-
|
|
11123
|
-
|
|
11124
|
-
|
|
11510
|
+
setupRevision: source.mailingList?.tag === "configured" ? source.mailingList.revision : null,
|
|
11511
|
+
choiceProvider: targeting.mode === "custom" ? targeting.provider : null,
|
|
11512
|
+
choicePresentation: presentation.tag,
|
|
11125
11513
|
spamProtectionEnabled: source.spamProtectionEnabled
|
|
11126
11514
|
}
|
|
11127
11515
|
};
|
|
@@ -11130,27 +11518,79 @@ const newsletterFormBlockRuntime = defineProgressiveBlockRuntime({
|
|
|
11130
11518
|
function projectNewsletterFormHydrationTarget(source) {
|
|
11131
11519
|
switch (source.source) {
|
|
11132
11520
|
case "block": {
|
|
11133
|
-
const
|
|
11134
|
-
if (
|
|
11521
|
+
const sourceRef = buildMailingListSignupBlockSourceRef(source.blockId);
|
|
11522
|
+
if (sourceRef?.tag === "block_ref") return {
|
|
11135
11523
|
tag: "block-source",
|
|
11136
|
-
|
|
11524
|
+
sourceRef
|
|
11137
11525
|
};
|
|
11138
11526
|
return {
|
|
11139
|
-
tag: "
|
|
11140
|
-
|
|
11527
|
+
tag: "block-source",
|
|
11528
|
+
sourceRef: null
|
|
11141
11529
|
};
|
|
11142
11530
|
}
|
|
11143
11531
|
case "signed-footer": return {
|
|
11144
11532
|
tag: "signed-footer-source",
|
|
11145
|
-
|
|
11146
|
-
};
|
|
11147
|
-
case "legacy-direct-list": return {
|
|
11148
|
-
tag: "legacy-direct-list",
|
|
11149
|
-
listId: source.listId
|
|
11533
|
+
sourceRef: source.sourceRef
|
|
11150
11534
|
};
|
|
11535
|
+
case "preview": return { tag: "preview" };
|
|
11151
11536
|
default: return assertNever$2(source);
|
|
11152
11537
|
}
|
|
11153
11538
|
}
|
|
11539
|
+
function resolveRuntimeChoices(context, targeting) {
|
|
11540
|
+
if (context?.tag !== "configured" || targeting.mode !== "custom" || targeting.selection.tag !== "visitor_choice" || context.provider.provider !== targeting.provider) return [];
|
|
11541
|
+
switch (targeting.provider) {
|
|
11542
|
+
case "native": {
|
|
11543
|
+
const offered = new Set(targeting.selection.offeredTopicIds);
|
|
11544
|
+
return context.provider.provider === "native" ? context.provider.topics.filter((item) => offered.has(item.id)).map((item) => ({
|
|
11545
|
+
id: item.id,
|
|
11546
|
+
label: item.name
|
|
11547
|
+
})) : [];
|
|
11548
|
+
}
|
|
11549
|
+
case "brevo": {
|
|
11550
|
+
const offered = new Set(targeting.selection.offeredListIds);
|
|
11551
|
+
return context.provider.provider === "brevo" ? context.provider.lists.filter((item) => offered.has(item.id)).map((item) => ({
|
|
11552
|
+
id: String(item.id),
|
|
11553
|
+
label: item.name
|
|
11554
|
+
})) : [];
|
|
11555
|
+
}
|
|
11556
|
+
case "mailchimp": {
|
|
11557
|
+
const offered = new Set(targeting.selection.offeredInterestIds);
|
|
11558
|
+
return (context.provider.provider === "mailchimp" ? context.provider.audiences.find((item) => item.id === targeting.audienceId) : void 0)?.interests.filter((item) => offered.has(item.id)).map((item) => ({
|
|
11559
|
+
id: item.id,
|
|
11560
|
+
label: item.name
|
|
11561
|
+
})) ?? [];
|
|
11562
|
+
}
|
|
11563
|
+
}
|
|
11564
|
+
}
|
|
11565
|
+
function runtimeTargetingIsAvailable(context, targeting, choices) {
|
|
11566
|
+
if (context?.tag !== "configured") return false;
|
|
11567
|
+
const provider = context.provider;
|
|
11568
|
+
if (targeting.mode === "default") switch (provider.provider) {
|
|
11569
|
+
case "native": return provider.topics.some((item) => item.id === provider.defaultTopicId);
|
|
11570
|
+
case "brevo": return provider.lists.some((item) => item.id === provider.defaultListId);
|
|
11571
|
+
case "mailchimp": return provider.audiences.some((item) => item.id === provider.defaultAudienceId);
|
|
11572
|
+
}
|
|
11573
|
+
if (targeting.provider !== provider.provider) return false;
|
|
11574
|
+
switch (targeting.provider) {
|
|
11575
|
+
case "native": return provider.provider === "native" && nativeTargetIsAvailable(provider, targeting, choices);
|
|
11576
|
+
case "brevo": return provider.provider === "brevo" && brevoTargetIsAvailable(provider, targeting, choices);
|
|
11577
|
+
case "mailchimp": return provider.provider === "mailchimp" && mailchimpTargetIsAvailable(provider, targeting, choices);
|
|
11578
|
+
}
|
|
11579
|
+
}
|
|
11580
|
+
function nativeTargetIsAvailable(provider, targeting, choices) {
|
|
11581
|
+
const ids = targeting.selection.tag === "fixed" ? targeting.selection.topicIds : targeting.selection.offeredTopicIds;
|
|
11582
|
+
return ids.every((id) => provider.topics.some((item) => item.id === id)) && (targeting.selection.tag !== "visitor_choice" || choices.length === ids.length);
|
|
11583
|
+
}
|
|
11584
|
+
function brevoTargetIsAvailable(provider, targeting, choices) {
|
|
11585
|
+
const ids = targeting.selection.tag === "fixed" ? targeting.selection.listIds : targeting.selection.offeredListIds;
|
|
11586
|
+
return ids.every((id) => provider.lists.some((item) => item.id === id)) && (targeting.selection.tag !== "visitor_choice" || choices.length === ids.length);
|
|
11587
|
+
}
|
|
11588
|
+
function mailchimpTargetIsAvailable(provider, targeting, choices) {
|
|
11589
|
+
const audience = provider.audiences.find((item) => item.id === targeting.audienceId);
|
|
11590
|
+
if (!audience) return false;
|
|
11591
|
+
const ids = targeting.selection.tag === "fixed" ? targeting.selection.interestIds : targeting.selection.offeredInterestIds;
|
|
11592
|
+
return ids.every((id) => audience.interests.some((item) => item.id === id)) && (targeting.selection.tag !== "visitor_choice" || choices.length === ids.length);
|
|
11593
|
+
}
|
|
11154
11594
|
const newsletterFormInteractiveIslandPropsCodec = createInteractiveIslandCodec({
|
|
11155
11595
|
runtime: newsletterFormBlockRuntime,
|
|
11156
11596
|
mode: "newsletter-form",
|
|
@@ -11161,14 +11601,14 @@ const newsletterFormInteractiveIslandPropsCodec = createInteractiveIslandCodec({
|
|
|
11161
11601
|
apiBaseUrl: value.apiBaseUrl
|
|
11162
11602
|
})
|
|
11163
11603
|
});
|
|
11164
|
-
function
|
|
11165
|
-
const parsed =
|
|
11166
|
-
if (!parsed) throw new Error("
|
|
11604
|
+
function parseRequiredMailingListSignupBlockId(value) {
|
|
11605
|
+
const parsed = parseMailingListBlockId(value);
|
|
11606
|
+
if (!parsed) throw new Error("Mailing-list signup block source ref requires blockId");
|
|
11167
11607
|
return parsed;
|
|
11168
11608
|
}
|
|
11169
|
-
function
|
|
11170
|
-
const parsed =
|
|
11171
|
-
if (!parsed) throw new Error("
|
|
11609
|
+
function parseRequiredMailingListSignedSourceToken(value) {
|
|
11610
|
+
const parsed = parseMailingListSignedSourceToken(value);
|
|
11611
|
+
if (!parsed) throw new Error("Mailing-list signup signed source ref requires token");
|
|
11172
11612
|
return parsed;
|
|
11173
11613
|
}
|
|
11174
11614
|
//#endregion
|
|
@@ -12075,4 +12515,4 @@ function defineIslandPropsDecoder(kind) {
|
|
|
12075
12515
|
};
|
|
12076
12516
|
}
|
|
12077
12517
|
//#endregion
|
|
12078
|
-
export { getOrderedDayNames as $,
|
|
12518
|
+
export { getOrderedDayNames as $, resolveBookingTimeZoneId as $t, isSemanticSpacing as A, isBookingRequirementConsentFieldId as At, buildEventRuntimeFilters as B, CANCELLED_SESSION_STATUS as Bt, WIZARD_STEPS as C, resolveBookingPaymentStep as Ct, staticHeaderChromeRuntime as D, projectSelectedAppointmentConsentIntoForm as Dt, buildEventCalendarListingRender as E, toSelectedCollectionOptionKind as Et, calendarWindowBounds as F, err as Ft, getCardOrientation as G, formatBookingDateParts as Gt, normalizeCsvIds as H, parseMailingListVisitorSelection as Ht, calendarWindowMonths as I, ok as It, addDays as J, formatBookingTime as Jt, getContainerClass as K, formatBookingDateTime as Kt, calendarWindowPageSchema as L, okWith as Lt, calendarMonthDate as M, isRecord$4 as Mt, calendarPageResponseError as N, assertNever$1 as Nt, resolveEventRegistrationScopedEvents as O, resolveSelectedAppointmentConsent as Ot, calendarQueryKey as P, clearWorkflowFeedback as Pt, getDayOfWeek as Q, parseBookingLocalDate as Qt, planCalendarMonthRanges as R, reportWorkflowError as Rt, resolveRegistrationTarget as S, resolveAppointmentCheckoutVerificationState as St, getWizardStepsForContext as T, resolveDefaultBookingServiceId as Tt, normalizeCsvString as U, addLocalScheduleDays as Ut, getEventRuntimeFiltersKey as V, resolveWholeSeriesBookingPhase as Vt, normalizeOptionalId as W, formatBookingDate as Wt, buildCalendarViewport as X, getBookingLocalDateKey as Xt, addMonths as Y, formatLocalScheduleDate as Yt, formatDateKey as Z, getLocalScheduleDate as Zt, toWholeSeriesRegistrationEvents as _, getBookingServiceSlidingScale as _t, buildProductDetailDisplay as a, isPublicEventPricingOptionDisplayable as an, groupPublicEventsByRun as at, resolveDiscountContext as b, parseBookingCurrencyInputToCents as bt, EMPTY_COMMERCE_CART_STATE as c, publicEventPricingOptions as cn, resolveOnColorForThemeToken as ct, deriveCommerceCheckoutState as d, formatCurrencyAmount as dn, normalizeCardRole as dt, toBookingTimeZone as en, getWeekCalendarDays as et, parseStoredCommerceCartState as f, parseCurrencyCode as fn, logger as ft, toRegistrationEvents as g, getBookingRedirectStateFromLocation as gt, getRegistrationStartAt as h, formatBookingSubmissionPreparationError as ht, buildProductCardDisplay as i, formatEventPricing as in, resolveRuntimeEventDestination as it, resolveSpacing as j, RichTextDocSchema as jt, SEMANTIC_SPACING_VALUES as k, BOOKING_FORM_DATA_RESERVED_KEYS as kt, buildPassCartItem as l, publicEventPricingStrategy as ln, resolveTokenOrCssColorValue as lt, reduceCommerceCart as m, formatBookingCentsAsCurrencyInput as mt, getShopDisplayForItems as n, toScheduledBookingDateTime as nn, isToday as nt, formatCommercePrice as o, publicEventPricingCurrency as on, boxBackgroundSchema as ot, productItemKey as p, assertNever$2 as pn, deriveBookingFormViewState as pt, MONTH_NAMES as q, formatBookingInstant as qt, buildCartDisplay as r, formatBookingPriceDisplay as rn, shiftCalendarAnchorDate as rt, formatInterval as s, publicEventPricingDisplay as sn, isCssColorLiteral as st, defineIslandPropsDecoder as t, toScheduledBookingDateRange as tn, isSameCalendarDay as tt, buildProductCartItem as u, publicEventPricingType as un, themeButtonClassName as ut, findEventByOccurrenceId as v, getBookingSuccessMessage as vt, getStepNumber as w, resolveBookingSiteId as wt, resolveEventRequiresPayment as x, prepareBookingSubmission as xt, findPreSelectedEvent as y, isBookingServiceSlidingAmountInRange as yt, resolveCalendarReadProfile as z, reportWorkflowSuccess as zt };
|