@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
|
@@ -1,14 +1,30 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { D as clsx } from "./colorStyles-CrxJrPjJ.mjs";
|
|
3
|
-
import { $ as getOrderedDayNames, B as buildEventRuntimeFilters, F as calendarWindowBounds, G as getCardOrientation, I as calendarWindowMonths$1,
|
|
4
|
-
import { a as EventCardClient, i as EventPaginatedListView, n as useEventPagination, o as EventFilters, r as toError, s as formatEventTeacherLine, t as useEventFilters } from "./useEventFilters-
|
|
5
|
-
import { o as formatEventRemainingPlaces, p as isEventFull, t as formatEventPrice } from "./pricing-
|
|
6
|
-
import { a as
|
|
7
|
-
import { n as useBlockApi } from "./context-
|
|
3
|
+
import { $ as getOrderedDayNames, B as buildEventRuntimeFilters, F as calendarWindowBounds, G as getCardOrientation, I as calendarWindowMonths$1, K as getContainerClass, M as calendarMonthDate, N as calendarPageResponseError, P as calendarQueryKey, Q as getDayOfWeek, R as planCalendarMonthRanges, V as getEventRuntimeFiltersKey, X as buildCalendarViewport, Y as addMonths, Yt as formatLocalScheduleDate, Z as formatDateKey, Zt as getLocalScheduleDate, nt as isToday, q as MONTH_NAMES, rt as shiftCalendarAnchorDate, tt as isSameCalendarDay, ut as themeButtonClassName } from "./propsDecoder-DYzafZb2.mjs";
|
|
4
|
+
import { a as EventCardClient, i as EventPaginatedListView, n as useEventPagination, o as EventFilters, r as toError, s as formatEventTeacherLine, t as useEventFilters } from "./useEventFilters-oMoTw_JE.mjs";
|
|
5
|
+
import { o as formatEventRemainingPlaces, p as isEventFull, t as formatEventPrice } from "./pricing-Uzw-GQ6Y.mjs";
|
|
6
|
+
import { a as formatTime, d as resolveEventLinkProps, o as groupEventsByDate, s as resolveEventTimeZone, t as formatDate, u as resolveEventCta } from "./dates-wnPMiRl5.mjs";
|
|
7
|
+
import { n as useBlockApi } from "./context-DvU_WUmd.mjs";
|
|
8
8
|
import { t as createBodyThemePortalRoot } from "./themePortalRoot-AGs4cE7t.mjs";
|
|
9
9
|
import { t as ModalShell } from "./ModalShell-CqkBvBIC.mjs";
|
|
10
10
|
import React, { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/duration.ts
|
|
13
|
+
function formatEventDuration(event) {
|
|
14
|
+
const durationMinutes = Math.max(0, Math.round((Date.parse(event.endsAt) - Date.parse(event.startsAt)) / 6e4));
|
|
15
|
+
if (durationMinutes < 120 || durationMinutes % 60 !== 0) return `${durationMinutes} min`;
|
|
16
|
+
return `${durationMinutes / 60} hrs`;
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region ../blocks/src/system/runtime/nodes/events/domain/location.ts
|
|
20
|
+
function formatEventLocation(event) {
|
|
21
|
+
switch (event.deliveryMode) {
|
|
22
|
+
case "online": return "Online";
|
|
23
|
+
case "hybrid": return event.venue ? `${event.venue.name} + online` : "Hybrid";
|
|
24
|
+
case "in_person": return event.venue?.name ?? "In person";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
12
28
|
//#region ../blocks/src/system/runtime/shared/components/TabBarFragment.tsx
|
|
13
29
|
function clampIndex(idx, len) {
|
|
14
30
|
if (len <= 0) return 0;
|
|
@@ -201,6 +217,82 @@ function projectCalendarLoadState(state, months) {
|
|
|
201
217
|
return entries.some((entry) => !entry || entry.kind === "partial" || entry.kind === "loading") ? { kind: "loading" } : { kind: "idle" };
|
|
202
218
|
}
|
|
203
219
|
//#endregion
|
|
220
|
+
//#region ../blocks/src/system/runtime/hooks/useCalendarToday.ts
|
|
221
|
+
const SEARCH_STEP_MS = 3600 * 1e3;
|
|
222
|
+
const MAX_BOUNDARY_SEARCH_MS = 72 * SEARCH_STEP_MS;
|
|
223
|
+
const MAX_TIMER_DELAY_MS = 2147483647;
|
|
224
|
+
const systemCalendarTodayClock = { now: () => /* @__PURE__ */ new Date() };
|
|
225
|
+
/** Find the first instant after `now` whose site-local civil date differs. */
|
|
226
|
+
function findNextCalendarDateBoundary(now, timeZone, resolveDate = getLocalScheduleDate) {
|
|
227
|
+
const currentDate = resolveDate(now, timeZone);
|
|
228
|
+
const lowerBound = now.getTime();
|
|
229
|
+
let upperBound = lowerBound + SEARCH_STEP_MS;
|
|
230
|
+
const searchLimit = lowerBound + MAX_BOUNDARY_SEARCH_MS;
|
|
231
|
+
while (upperBound <= searchLimit && isSameCalendarDay(resolveDate(new Date(upperBound), timeZone), currentDate)) upperBound += SEARCH_STEP_MS;
|
|
232
|
+
if (upperBound > searchLimit) return {
|
|
233
|
+
kind: "retry",
|
|
234
|
+
delayMs: SEARCH_STEP_MS
|
|
235
|
+
};
|
|
236
|
+
let lower = lowerBound;
|
|
237
|
+
let upper = upperBound;
|
|
238
|
+
while (upper - lower > 1) {
|
|
239
|
+
const midpoint = lower + Math.floor((upper - lower) / 2);
|
|
240
|
+
if (isSameCalendarDay(resolveDate(new Date(midpoint), timeZone), currentDate)) lower = midpoint;
|
|
241
|
+
else upper = midpoint;
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
kind: "found",
|
|
245
|
+
instant: new Date(upper)
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
function useCalendarToday(context, clock = systemCalendarTodayClock) {
|
|
249
|
+
const [today, setToday] = useState(context.initialToday);
|
|
250
|
+
const now = clock.now;
|
|
251
|
+
const resolveDate = clock.resolveDate ?? getLocalScheduleDate;
|
|
252
|
+
const refreshToday = useCallback(() => {
|
|
253
|
+
const next = resolveDate(now(), context.timeZone);
|
|
254
|
+
setToday((current) => isSameCalendarDay(current, next) ? current : next);
|
|
255
|
+
}, [
|
|
256
|
+
context.timeZone,
|
|
257
|
+
now,
|
|
258
|
+
resolveDate
|
|
259
|
+
]);
|
|
260
|
+
useEffect(() => {
|
|
261
|
+
let timeoutId;
|
|
262
|
+
const scheduleBoundary = () => {
|
|
263
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
264
|
+
const currentInstant = now();
|
|
265
|
+
const boundary = findNextCalendarDateBoundary(currentInstant, context.timeZone, resolveDate);
|
|
266
|
+
const boundaryDelay = boundary.kind === "found" ? boundary.instant.getTime() - currentInstant.getTime() : boundary.delayMs;
|
|
267
|
+
timeoutId = setTimeout(() => {
|
|
268
|
+
refreshToday();
|
|
269
|
+
scheduleBoundary();
|
|
270
|
+
}, Math.min(Math.max(1, boundaryDelay), MAX_TIMER_DELAY_MS));
|
|
271
|
+
};
|
|
272
|
+
const reconcileAndReschedule = () => {
|
|
273
|
+
refreshToday();
|
|
274
|
+
scheduleBoundary();
|
|
275
|
+
};
|
|
276
|
+
const handleVisibilityChange = () => {
|
|
277
|
+
if (document.visibilityState === "visible") reconcileAndReschedule();
|
|
278
|
+
};
|
|
279
|
+
reconcileAndReschedule();
|
|
280
|
+
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
281
|
+
window.addEventListener("focus", reconcileAndReschedule);
|
|
282
|
+
return () => {
|
|
283
|
+
if (timeoutId !== void 0) clearTimeout(timeoutId);
|
|
284
|
+
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
285
|
+
window.removeEventListener("focus", reconcileAndReschedule);
|
|
286
|
+
};
|
|
287
|
+
}, [
|
|
288
|
+
context.timeZone,
|
|
289
|
+
now,
|
|
290
|
+
refreshToday,
|
|
291
|
+
resolveDate
|
|
292
|
+
]);
|
|
293
|
+
return today;
|
|
294
|
+
}
|
|
295
|
+
//#endregion
|
|
204
296
|
//#region ../blocks/src/system/runtime/hooks/useCalendarEvents.ts
|
|
205
297
|
/**
|
|
206
298
|
* Hook for calendar event management with month-based caching
|
|
@@ -208,7 +300,7 @@ function projectCalendarLoadState(state, months) {
|
|
|
208
300
|
* Uses the Block API Client for type-safe API calls.
|
|
209
301
|
* Must be used within a BlockApiProvider.
|
|
210
302
|
*/
|
|
211
|
-
function useCalendarViewport({ view = "month", startOfWeek = "monday", initialDate }) {
|
|
303
|
+
function useCalendarViewport({ view = "month", startOfWeek = "monday", initialDate, today }) {
|
|
212
304
|
const [viewDate, setViewDate] = useState(initialDate);
|
|
213
305
|
const viewport = useMemo(() => buildCalendarViewport({
|
|
214
306
|
view,
|
|
@@ -234,8 +326,8 @@ function useCalendarViewport({ view = "month", startOfWeek = "monday", initialDa
|
|
|
234
326
|
goToPrevious,
|
|
235
327
|
goToNext,
|
|
236
328
|
goToToday: useCallback(() => {
|
|
237
|
-
setViewDate(
|
|
238
|
-
}, [
|
|
329
|
+
setViewDate(today);
|
|
330
|
+
}, [today])
|
|
239
331
|
};
|
|
240
332
|
}
|
|
241
333
|
/**
|
|
@@ -357,10 +449,12 @@ function useCalendarEventCache({ readProfile = "listing-card", viewDate, calenda
|
|
|
357
449
|
};
|
|
358
450
|
}
|
|
359
451
|
function useCalendarEvents({ readProfile, siteId: _siteId, calendarWindow, view = "month", startOfWeek = "monday", preloadMonths = 1, filters, stage, calendarContext }) {
|
|
452
|
+
const today = useCalendarToday(calendarContext);
|
|
360
453
|
const { viewDate, viewport, goToDate, goToPrevious, goToNext, goToToday } = useCalendarViewport({
|
|
361
454
|
view,
|
|
362
455
|
startOfWeek,
|
|
363
|
-
initialDate: calendarContext.initialToday
|
|
456
|
+
initialDate: calendarContext.initialToday,
|
|
457
|
+
today
|
|
364
458
|
});
|
|
365
459
|
const { events, loadState, retryCurrentView } = useCalendarEventCache({
|
|
366
460
|
readProfile,
|
|
@@ -374,6 +468,7 @@ function useCalendarEvents({ readProfile, siteId: _siteId, calendarWindow, view
|
|
|
374
468
|
return {
|
|
375
469
|
events,
|
|
376
470
|
viewDate,
|
|
471
|
+
today,
|
|
377
472
|
viewport,
|
|
378
473
|
loadState,
|
|
379
474
|
setViewDate: useCallback((date) => {
|
|
@@ -449,7 +544,7 @@ function useEventModal() {
|
|
|
449
544
|
* Clicking an event opens the EventDetailModal.
|
|
450
545
|
* Clicking "+N more" opens the DayEventsModal.
|
|
451
546
|
*/
|
|
452
|
-
const CalendarDayCell = ({ date, events, isCurrentMonth, today: currentDate }) => {
|
|
547
|
+
const CalendarDayCell = ({ date, events, isCurrentMonth, calendarTimeZone, today: currentDate }) => {
|
|
453
548
|
const { openEventModal, openDayModal } = useEventModal();
|
|
454
549
|
const today = isToday(date, currentDate);
|
|
455
550
|
const dayClasses = [
|
|
@@ -471,7 +566,7 @@ const CalendarDayCell = ({ date, events, isCurrentMonth, today: currentDate }) =
|
|
|
471
566
|
}), /* @__PURE__ */ jsxs("div", {
|
|
472
567
|
className: "event-calendar-events",
|
|
473
568
|
children: [events.slice(0, 3).map((event) => {
|
|
474
|
-
const timeZone = event
|
|
569
|
+
const timeZone = resolveEventTimeZone(event, calendarTimeZone);
|
|
475
570
|
return /* @__PURE__ */ jsxs("button", {
|
|
476
571
|
type: "button",
|
|
477
572
|
className: "event-calendar-event",
|
|
@@ -503,85 +598,202 @@ const CalendarDayCell = ({ date, events, isCurrentMonth, today: currentDate }) =
|
|
|
503
598
|
});
|
|
504
599
|
};
|
|
505
600
|
//#endregion
|
|
601
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/CalendarDayHeaders.tsx
|
|
602
|
+
function CalendarDayHeaders({ dayNames }) {
|
|
603
|
+
return /* @__PURE__ */ jsx("div", {
|
|
604
|
+
className: "event-calendar-day-headers",
|
|
605
|
+
children: dayNames.map((day) => /* @__PURE__ */ jsx("div", {
|
|
606
|
+
className: "event-calendar-day-header",
|
|
607
|
+
children: day
|
|
608
|
+
}, day))
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
//#endregion
|
|
612
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/CalendarNavigationChevron.tsx
|
|
613
|
+
function CalendarNavigationChevron({ direction }) {
|
|
614
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
615
|
+
width: "20",
|
|
616
|
+
height: "20",
|
|
617
|
+
fill: "none",
|
|
618
|
+
stroke: "currentColor",
|
|
619
|
+
strokeWidth: 2,
|
|
620
|
+
viewBox: "0 0 24 24",
|
|
621
|
+
"aria-hidden": "true",
|
|
622
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
623
|
+
strokeLinecap: "round",
|
|
624
|
+
strokeLinejoin: "round",
|
|
625
|
+
d: direction === "previous" ? "M15 19l-7-7 7-7" : "M9 5l7 7-7 7"
|
|
626
|
+
})
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
//#endregion
|
|
506
630
|
//#region ../blocks/src/system/runtime/nodes/events/shared/AgendaEventCard.tsx
|
|
507
631
|
/**
|
|
508
632
|
* AgendaEventCard Component
|
|
509
633
|
*
|
|
510
634
|
* Rich event card for agenda/week view with category color, time, venue, pricing, and capacity.
|
|
511
635
|
*/
|
|
512
|
-
const AgendaEventCard = ({ event, showCapacity, onClick }) => {
|
|
513
|
-
|
|
636
|
+
const AgendaEventCard = ({ event, showCapacity, showVenue = true, buttonVariant = "primary", buttonText, calendarTimeZone, onClick }) => {
|
|
637
|
+
if (onClick) return /* @__PURE__ */ jsx(AgendaModalCard, {
|
|
638
|
+
event,
|
|
639
|
+
showCapacity,
|
|
640
|
+
calendarTimeZone,
|
|
641
|
+
onClick
|
|
642
|
+
});
|
|
643
|
+
return /* @__PURE__ */ jsx(AgendaLinkCard, {
|
|
644
|
+
event,
|
|
645
|
+
showCapacity,
|
|
646
|
+
showVenue,
|
|
647
|
+
buttonVariant,
|
|
648
|
+
buttonText,
|
|
649
|
+
calendarTimeZone
|
|
650
|
+
});
|
|
651
|
+
};
|
|
652
|
+
function AgendaModalCard({ event, showCapacity, calendarTimeZone, onClick }) {
|
|
514
653
|
const categoryColor = event.eventCategory?.color || "rgb(var(--tb-accent))";
|
|
515
654
|
const price = formatEventPrice(event);
|
|
516
655
|
const capacity = showCapacity ? formatEventRemainingPlaces(event) : null;
|
|
517
656
|
const isFull = isEventFull(event);
|
|
518
|
-
const title = event.title;
|
|
519
|
-
const timeZone = event.timeZone ?? null;
|
|
520
657
|
const teacherLine = formatEventTeacherLine(event);
|
|
521
|
-
const
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
658
|
+
const timeZone = resolveEventTimeZone(event, calendarTimeZone);
|
|
659
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
660
|
+
type: "button",
|
|
661
|
+
className: "event-agenda-card",
|
|
662
|
+
onClick: () => onClick(event),
|
|
663
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
664
|
+
className: "event-agenda-card-indicator",
|
|
665
|
+
style: { backgroundColor: categoryColor },
|
|
666
|
+
"aria-hidden": "true"
|
|
667
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
668
|
+
className: "event-agenda-card-content",
|
|
669
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
670
|
+
className: "event-agenda-card-header",
|
|
671
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
672
|
+
className: "event-agenda-card-time",
|
|
673
|
+
children: formatTime(event.startsAt, { timeZone })
|
|
674
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
675
|
+
className: "event-agenda-card-title",
|
|
676
|
+
children: event.title
|
|
677
|
+
})]
|
|
678
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
679
|
+
className: "event-agenda-card-details status-muted",
|
|
680
|
+
children: [
|
|
681
|
+
event.venue && /* @__PURE__ */ jsxs("span", {
|
|
682
|
+
className: "event-agenda-card-venue",
|
|
683
|
+
children: [/* @__PURE__ */ jsx(LocationIcon, {}), event.venue.name]
|
|
684
|
+
}),
|
|
685
|
+
teacherLine && /* @__PURE__ */ jsx("span", {
|
|
686
|
+
className: "event-agenda-card-teacher",
|
|
687
|
+
children: teacherLine
|
|
688
|
+
}),
|
|
689
|
+
/* @__PURE__ */ jsx("span", {
|
|
690
|
+
className: "event-agenda-card-price",
|
|
691
|
+
children: price
|
|
692
|
+
}),
|
|
693
|
+
capacity && /* @__PURE__ */ jsx("span", {
|
|
694
|
+
className: `event-agenda-card-capacity ${isFull ? "event-agenda-card-capacity--full status-error" : ""}`,
|
|
695
|
+
children: capacity
|
|
696
|
+
})
|
|
697
|
+
]
|
|
698
|
+
})]
|
|
699
|
+
})]
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
function AgendaLinkCard({ event, showCapacity, showVenue, buttonVariant, buttonText, calendarTimeZone }) {
|
|
703
|
+
const eventLinkProps = resolveEventLinkProps(event);
|
|
704
|
+
const categoryColor = event.eventCategory?.color || "rgb(var(--tb-accent))";
|
|
705
|
+
const timeZone = resolveEventTimeZone(event, calendarTimeZone);
|
|
706
|
+
const teacherLine = formatEventTeacherLine(event);
|
|
707
|
+
const location = formatEventLocation(event);
|
|
708
|
+
const duration = formatEventDuration(event);
|
|
709
|
+
const price = formatEventPrice(event);
|
|
710
|
+
const capacity = showCapacity ? formatEventRemainingPlaces(event) : null;
|
|
711
|
+
const cta = resolveEventCta(event, buttonText);
|
|
712
|
+
const buttonClass = themeButtonClassName({
|
|
713
|
+
variant: buttonVariant,
|
|
714
|
+
size: "sm"
|
|
715
|
+
});
|
|
716
|
+
return /* @__PURE__ */ jsxs("article", {
|
|
717
|
+
className: "event-agenda-card event-agenda-card--agenda",
|
|
718
|
+
children: [
|
|
719
|
+
/* @__PURE__ */ jsx("div", {
|
|
720
|
+
className: "event-agenda-card-indicator",
|
|
721
|
+
style: { backgroundColor: categoryColor },
|
|
722
|
+
"aria-hidden": "true"
|
|
723
|
+
}),
|
|
724
|
+
/* @__PURE__ */ jsx("time", {
|
|
530
725
|
className: "event-agenda-card-time",
|
|
726
|
+
dateTime: event.startsAt,
|
|
531
727
|
children: formatTime(event.startsAt, { timeZone })
|
|
532
|
-
}),
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
})
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
})
|
|
562
|
-
|
|
728
|
+
}),
|
|
729
|
+
/* @__PURE__ */ jsxs("div", {
|
|
730
|
+
className: "event-agenda-card-content",
|
|
731
|
+
children: [/* @__PURE__ */ jsx("h5", {
|
|
732
|
+
className: "event-agenda-card-title",
|
|
733
|
+
children: /* @__PURE__ */ jsx("a", {
|
|
734
|
+
...eventLinkProps,
|
|
735
|
+
children: event.title
|
|
736
|
+
})
|
|
737
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
738
|
+
className: "event-agenda-card-details status-muted",
|
|
739
|
+
children: [
|
|
740
|
+
showVenue ? /* @__PURE__ */ jsxs("span", {
|
|
741
|
+
className: "event-agenda-card-location",
|
|
742
|
+
children: [/* @__PURE__ */ jsx(LocationIcon, {}), location]
|
|
743
|
+
}) : null,
|
|
744
|
+
/* @__PURE__ */ jsx("span", {
|
|
745
|
+
className: "event-agenda-card-duration",
|
|
746
|
+
children: duration
|
|
747
|
+
}),
|
|
748
|
+
teacherLine && /* @__PURE__ */ jsx("span", {
|
|
749
|
+
className: "event-agenda-card-teacher",
|
|
750
|
+
children: teacherLine
|
|
751
|
+
}),
|
|
752
|
+
capacity && /* @__PURE__ */ jsx("span", {
|
|
753
|
+
className: `event-agenda-card-capacity ${isEventFull(event) ? "event-agenda-card-capacity--full status-error" : ""}`,
|
|
754
|
+
children: capacity
|
|
755
|
+
})
|
|
756
|
+
]
|
|
757
|
+
})]
|
|
758
|
+
}),
|
|
759
|
+
/* @__PURE__ */ jsxs("div", {
|
|
760
|
+
className: "event-agenda-card-action",
|
|
761
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
563
762
|
className: "event-agenda-card-price",
|
|
564
763
|
children: price
|
|
565
|
-
}),
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
children: cardContent
|
|
764
|
+
}), cta.hidden ? /* @__PURE__ */ jsx("span", {
|
|
765
|
+
className: "event-agenda-card-status status-muted",
|
|
766
|
+
children: cta.label
|
|
767
|
+
}) : /* @__PURE__ */ jsx("a", {
|
|
768
|
+
href: cta.href,
|
|
769
|
+
target: cta.external ? "_blank" : void 0,
|
|
770
|
+
rel: cta.external ? "noopener noreferrer" : void 0,
|
|
771
|
+
className: `${buttonClass} event-agenda-card-cta`,
|
|
772
|
+
children: cta.label
|
|
773
|
+
})]
|
|
774
|
+
})
|
|
775
|
+
]
|
|
578
776
|
});
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
777
|
+
}
|
|
778
|
+
function LocationIcon() {
|
|
779
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
780
|
+
className: "event-agenda-card-icon",
|
|
781
|
+
width: "14",
|
|
782
|
+
height: "14",
|
|
783
|
+
viewBox: "0 0 24 24",
|
|
784
|
+
fill: "none",
|
|
785
|
+
stroke: "currentColor",
|
|
786
|
+
strokeWidth: "2",
|
|
787
|
+
strokeLinecap: "round",
|
|
788
|
+
strokeLinejoin: "round",
|
|
789
|
+
"aria-hidden": "true",
|
|
790
|
+
children: [/* @__PURE__ */ jsx("path", { d: "M21 10c0 7-9 13-9 13s-9-6-9-13a9 9 0 0 1 18 0z" }), /* @__PURE__ */ jsx("circle", {
|
|
791
|
+
cx: "12",
|
|
792
|
+
cy: "10",
|
|
793
|
+
r: "3"
|
|
794
|
+
})]
|
|
583
795
|
});
|
|
584
|
-
}
|
|
796
|
+
}
|
|
585
797
|
//#endregion
|
|
586
798
|
//#region ../blocks/src/system/runtime/nodes/events/shared/WeekAgendaView.tsx
|
|
587
799
|
/** Full day names for agenda headers */
|
|
@@ -606,14 +818,16 @@ function formatAgendaDayHeader(date) {
|
|
|
606
818
|
/**
|
|
607
819
|
* WeekAgendaView Component
|
|
608
820
|
*
|
|
609
|
-
* Displays a week
|
|
610
|
-
*
|
|
821
|
+
* Displays populated days in a week as an agenda/list with rich event details.
|
|
822
|
+
* A week without events has one empty state instead of seven repeated messages.
|
|
611
823
|
*/
|
|
612
|
-
const WeekAgendaView = ({ days, events, showCapacity, emptyMessage = "No events scheduled", calendarTimeZone, today: currentDate }) => {
|
|
824
|
+
const WeekAgendaView = ({ days, events, showCapacity, showVenue = true, emptyMessage = "No events scheduled", showEmptyState, calendarTimeZone, today: currentDate, buttonVariant = "primary", buttonText }) => {
|
|
613
825
|
const eventsByDate = groupEventsByDate(events, calendarTimeZone);
|
|
614
|
-
|
|
826
|
+
const populatedDays = days.filter((date) => (eventsByDate.get(formatDateKey(date))?.length ?? 0) > 0);
|
|
827
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
615
828
|
className: "event-agenda-week",
|
|
616
|
-
|
|
829
|
+
"data-agenda-state": populatedDays.length > 0 ? "populated" : showEmptyState ? "empty" : "loading",
|
|
830
|
+
children: [populatedDays.map((date) => {
|
|
617
831
|
const dateKey = formatDateKey(date);
|
|
618
832
|
const dayEvents = eventsByDate.get(dateKey) || [];
|
|
619
833
|
const today = isToday(date, currentDate);
|
|
@@ -630,22 +844,40 @@ const WeekAgendaView = ({ days, events, showCapacity, emptyMessage = "No events
|
|
|
630
844
|
})
|
|
631
845
|
}), /* @__PURE__ */ jsx("div", {
|
|
632
846
|
className: "event-agenda-day-content",
|
|
633
|
-
children:
|
|
634
|
-
className: "event-agenda-day-empty",
|
|
635
|
-
children: emptyMessage
|
|
636
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
847
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
637
848
|
className: "event-agenda-day-events",
|
|
638
849
|
children: dayEvents.map((event) => /* @__PURE__ */ jsx(AgendaEventCard, {
|
|
639
850
|
event,
|
|
640
|
-
showCapacity
|
|
851
|
+
showCapacity,
|
|
852
|
+
showVenue,
|
|
853
|
+
buttonVariant,
|
|
854
|
+
buttonText,
|
|
855
|
+
calendarTimeZone
|
|
641
856
|
}, event.occurrenceId || event.id))
|
|
642
857
|
})
|
|
643
858
|
})]
|
|
644
859
|
}, dateKey);
|
|
645
|
-
})
|
|
860
|
+
}), populatedDays.length === 0 && showEmptyState ? /* @__PURE__ */ jsx("p", {
|
|
861
|
+
className: "event-agenda-empty",
|
|
862
|
+
children: emptyMessage
|
|
863
|
+
}) : null]
|
|
646
864
|
});
|
|
647
865
|
};
|
|
648
866
|
//#endregion
|
|
867
|
+
//#region ../blocks/src/system/runtime/nodes/events/shared/useHydrationReady.ts
|
|
868
|
+
/**
|
|
869
|
+
* The first client render must retain the server's data-dependent shell.
|
|
870
|
+
* State becomes ready after hydration so subsequent loading transitions can
|
|
871
|
+
* use the live calendar state without changing the server markup mid-hydrate.
|
|
872
|
+
*/
|
|
873
|
+
function useHydrationReady() {
|
|
874
|
+
const [ready, setReady] = useState(false);
|
|
875
|
+
useEffect(() => {
|
|
876
|
+
setReady(true);
|
|
877
|
+
}, []);
|
|
878
|
+
return ready;
|
|
879
|
+
}
|
|
880
|
+
//#endregion
|
|
649
881
|
//#region ../blocks/src/system/runtime/nodes/events/shared/EventModalCloseButton.tsx
|
|
650
882
|
function EventModalCloseButton({ closeButtonRef, onClose }) {
|
|
651
883
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -714,7 +946,7 @@ function EventDetailModal({ event, showCapacity, onClose, portalRoot, cardRole =
|
|
|
714
946
|
* Uses AgendaEventCard with onClick prop to display events.
|
|
715
947
|
* Clicking an event triggers onSelectEvent (typically opens EventDetailModal).
|
|
716
948
|
*/
|
|
717
|
-
function DayEventsModal({ date, events, showCapacity, onClose, onSelectEvent, portalRoot }) {
|
|
949
|
+
function DayEventsModal({ date, events, showCapacity, calendarTimeZone, onClose, onSelectEvent, portalRoot }) {
|
|
718
950
|
const formattedDate = formatDate(`${formatLocalScheduleDate(date)}T12:00:00Z`);
|
|
719
951
|
return /* @__PURE__ */ jsxs(ModalShell, {
|
|
720
952
|
title: formattedDate,
|
|
@@ -744,7 +976,8 @@ function DayEventsModal({ date, events, showCapacity, onClose, onSelectEvent, po
|
|
|
744
976
|
children: events.map((event) => /* @__PURE__ */ jsx(AgendaEventCard, {
|
|
745
977
|
event,
|
|
746
978
|
onClick: onSelectEvent,
|
|
747
|
-
showCapacity
|
|
979
|
+
showCapacity,
|
|
980
|
+
calendarTimeZone
|
|
748
981
|
}, event.occurrenceId || event.id))
|
|
749
982
|
})]
|
|
750
983
|
});
|
|
@@ -759,7 +992,7 @@ function DayEventsModal({ date, events, showCapacity, onClose, onSelectEvent, po
|
|
|
759
992
|
* - EventDetailModal for single event view
|
|
760
993
|
* - DayEventsModal for day events list (clicking an event switches to event modal)
|
|
761
994
|
*/
|
|
762
|
-
function EventModals({ showCapacity, cardRole, buttonVariant, buttonText }) {
|
|
995
|
+
function EventModals({ showCapacity, cardRole, buttonVariant, buttonText, calendarTimeZone }) {
|
|
763
996
|
const markerRef = React.useRef(null);
|
|
764
997
|
const [portalRoot, setPortalRoot] = React.useState(null);
|
|
765
998
|
const { modalState, openEventModal, closeModal } = useEventModal();
|
|
@@ -800,7 +1033,8 @@ function EventModals({ showCapacity, cardRole, buttonVariant, buttonText }) {
|
|
|
800
1033
|
openEventModal(event);
|
|
801
1034
|
},
|
|
802
1035
|
portalRoot,
|
|
803
|
-
showCapacity
|
|
1036
|
+
showCapacity,
|
|
1037
|
+
calendarTimeZone
|
|
804
1038
|
})] });
|
|
805
1039
|
return marker;
|
|
806
1040
|
}
|
|
@@ -860,6 +1094,103 @@ function toEventCombinedControllerProps(props) {
|
|
|
860
1094
|
calendarWindow: props.render.hydration.calendarWindow
|
|
861
1095
|
};
|
|
862
1096
|
}
|
|
1097
|
+
const EventCombinedCalendarHeader = ({ calendarView, title, loadState, onPrevious, onNext, onToday, buttonVariant }) => /* @__PURE__ */ jsxs("div", {
|
|
1098
|
+
className: "event-calendar-header",
|
|
1099
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1100
|
+
className: "event-calendar-nav",
|
|
1101
|
+
children: [
|
|
1102
|
+
/* @__PURE__ */ jsx("button", {
|
|
1103
|
+
type: "button",
|
|
1104
|
+
onClick: onPrevious,
|
|
1105
|
+
className: "event-calendar-nav-btn",
|
|
1106
|
+
"aria-label": calendarView === "week" ? "Previous week" : "Previous month",
|
|
1107
|
+
children: /* @__PURE__ */ jsx(CalendarNavigationChevron, { direction: "previous" })
|
|
1108
|
+
}),
|
|
1109
|
+
/* @__PURE__ */ jsxs("h3", {
|
|
1110
|
+
className: "event-calendar-title",
|
|
1111
|
+
children: [title, loadState.kind === "loading" && /* @__PURE__ */ jsx("span", {
|
|
1112
|
+
className: "rb-ml-2 rb-caption status-muted",
|
|
1113
|
+
children: "(loading...)"
|
|
1114
|
+
})]
|
|
1115
|
+
}),
|
|
1116
|
+
/* @__PURE__ */ jsx("button", {
|
|
1117
|
+
type: "button",
|
|
1118
|
+
onClick: onNext,
|
|
1119
|
+
className: "event-calendar-nav-btn",
|
|
1120
|
+
"aria-label": calendarView === "week" ? "Next week" : "Next month",
|
|
1121
|
+
children: /* @__PURE__ */ jsx(CalendarNavigationChevron, { direction: "next" })
|
|
1122
|
+
})
|
|
1123
|
+
]
|
|
1124
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1125
|
+
type: "button",
|
|
1126
|
+
onClick: onToday,
|
|
1127
|
+
className: themeButtonClassName({
|
|
1128
|
+
variant: buttonVariant,
|
|
1129
|
+
size: "sm"
|
|
1130
|
+
}),
|
|
1131
|
+
children: "Today"
|
|
1132
|
+
})]
|
|
1133
|
+
});
|
|
1134
|
+
const EventCombinedCalendarTab = ({ calendarTabViews, calendarView, calendarViewOptions, onCalendarViewChange, calendarEvents, eventsByDate, viewDate, viewport, calendarLoadState, dayNames, calendarContext, today, goToPrevious, goToNext, goToToday, emptyMessage, showCapacity, showVenue, cardRole, buttonVariant, buttonText, showEmptyState }) => /* @__PURE__ */ jsxs(EventModalProvider, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1135
|
+
className: "event-combined-content event-calendar",
|
|
1136
|
+
children: [
|
|
1137
|
+
calendarTabViews === "both" && /* @__PURE__ */ jsx("div", {
|
|
1138
|
+
className: "event-calendar-view-toggle",
|
|
1139
|
+
children: calendarViewOptions.map((option) => /* @__PURE__ */ jsx("button", {
|
|
1140
|
+
type: "button",
|
|
1141
|
+
className: `event-calendar-view-btn ${calendarView === option.id ? "event-calendar-view-btn--active" : ""}`,
|
|
1142
|
+
onClick: () => onCalendarViewChange(option.id),
|
|
1143
|
+
children: option.label
|
|
1144
|
+
}, option.id))
|
|
1145
|
+
}),
|
|
1146
|
+
/* @__PURE__ */ jsx(EventCombinedCalendarHeader, {
|
|
1147
|
+
calendarView,
|
|
1148
|
+
title: viewport.title,
|
|
1149
|
+
loadState: calendarLoadState,
|
|
1150
|
+
onPrevious: goToPrevious,
|
|
1151
|
+
onNext: goToNext,
|
|
1152
|
+
onToday: goToToday,
|
|
1153
|
+
buttonVariant
|
|
1154
|
+
}),
|
|
1155
|
+
viewport.kind === "week" ? /* @__PURE__ */ jsx(WeekAgendaView, {
|
|
1156
|
+
days: viewport.days,
|
|
1157
|
+
events: calendarEvents,
|
|
1158
|
+
emptyMessage,
|
|
1159
|
+
showCapacity,
|
|
1160
|
+
showVenue,
|
|
1161
|
+
showEmptyState,
|
|
1162
|
+
buttonVariant,
|
|
1163
|
+
buttonText,
|
|
1164
|
+
calendarTimeZone: calendarContext.timeZone,
|
|
1165
|
+
today
|
|
1166
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
1167
|
+
className: "event-calendar-container",
|
|
1168
|
+
children: [/* @__PURE__ */ jsx(CalendarDayHeaders, { dayNames }), /* @__PURE__ */ jsx("div", {
|
|
1169
|
+
className: "event-calendar-grid",
|
|
1170
|
+
children: viewport.days.map((date) => {
|
|
1171
|
+
const dateKey = formatDateKey(date);
|
|
1172
|
+
return /* @__PURE__ */ jsx(CalendarDayCell, {
|
|
1173
|
+
date,
|
|
1174
|
+
events: eventsByDate.get(dateKey) ?? [],
|
|
1175
|
+
isCurrentMonth: date.month === viewDate.month,
|
|
1176
|
+
calendarTimeZone: calendarContext.timeZone,
|
|
1177
|
+
today
|
|
1178
|
+
}, dateKey);
|
|
1179
|
+
})
|
|
1180
|
+
})]
|
|
1181
|
+
}),
|
|
1182
|
+
viewport.kind !== "week" && calendarEvents.length === 0 && showEmptyState && /* @__PURE__ */ jsx("p", {
|
|
1183
|
+
className: "event-calendar-empty",
|
|
1184
|
+
children: emptyMessage
|
|
1185
|
+
})
|
|
1186
|
+
]
|
|
1187
|
+
}), /* @__PURE__ */ jsx(EventModals, {
|
|
1188
|
+
cardRole,
|
|
1189
|
+
buttonVariant,
|
|
1190
|
+
buttonText,
|
|
1191
|
+
showCapacity,
|
|
1192
|
+
calendarTimeZone: calendarContext.timeZone
|
|
1193
|
+
})] });
|
|
863
1194
|
/**
|
|
864
1195
|
* EventCombined Component
|
|
865
1196
|
*
|
|
@@ -870,6 +1201,7 @@ const EventCombinedClient = ({ events: initialEvents, siteId, stage, listLayout
|
|
|
870
1201
|
kind: "loadMore",
|
|
871
1202
|
label: "Load more events"
|
|
872
1203
|
}, startOfWeek = "monday", calendarTabViews = "both", defaultCalendarView, showFilters, showCategoryFilter = "auto", showVenueFilter, showStaffFilter, eventSurface, filterEventPresets, scheduleScope, filterCategoryIds, filterStaffMemberId, filterVenueId, showVenue, showMap, showCapacity, cardRole, buttonVariant = "primary", buttonText = "Book", emptyMessage = "No upcoming events scheduled.", className, calendarContext, calendarWindow }) => {
|
|
1204
|
+
const hydrationReady = useHydrationReady();
|
|
873
1205
|
const fetchInitialEventsOnMount = initialEvents == null;
|
|
874
1206
|
const resolvedShowFilters = showFilters ?? true;
|
|
875
1207
|
const resolvedShowVenueFilter = showVenueFilter ?? false;
|
|
@@ -927,7 +1259,7 @@ const EventCombinedClient = ({ events: initialEvents, siteId, stage, listLayout
|
|
|
927
1259
|
pageSize,
|
|
928
1260
|
stage
|
|
929
1261
|
});
|
|
930
|
-
const { events: calendarEventsRaw, viewDate, viewport, loadState: calendarLoadState, goToPrevious, goToNext, goToToday } = useCalendarEvents({
|
|
1262
|
+
const { events: calendarEventsRaw, viewDate, today, viewport, loadState: calendarLoadState, goToPrevious, goToNext, goToToday } = useCalendarEvents({
|
|
931
1263
|
siteId,
|
|
932
1264
|
view: calendarView,
|
|
933
1265
|
startOfWeek,
|
|
@@ -1001,121 +1333,33 @@ const EventCombinedClient = ({ events: initialEvents, siteId, stage, listLayout
|
|
|
1001
1333
|
hasActiveFilters,
|
|
1002
1334
|
onResetFilters: resetFilters
|
|
1003
1335
|
}),
|
|
1004
|
-
activeTab === "calendar" && /* @__PURE__ */
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
onClick: goToPrevious,
|
|
1024
|
-
className: "event-calendar-nav-btn",
|
|
1025
|
-
"aria-label": calendarView === "week" ? "Previous week" : "Previous month",
|
|
1026
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
1027
|
-
width: "20",
|
|
1028
|
-
height: "20",
|
|
1029
|
-
fill: "none",
|
|
1030
|
-
stroke: "currentColor",
|
|
1031
|
-
strokeWidth: 2,
|
|
1032
|
-
viewBox: "0 0 24 24",
|
|
1033
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
1034
|
-
strokeLinecap: "round",
|
|
1035
|
-
strokeLinejoin: "round",
|
|
1036
|
-
d: "M15 19l-7-7 7-7"
|
|
1037
|
-
})
|
|
1038
|
-
})
|
|
1039
|
-
}),
|
|
1040
|
-
/* @__PURE__ */ jsxs("h3", {
|
|
1041
|
-
className: "event-calendar-title",
|
|
1042
|
-
children: [viewport.title, calendarLoadState.kind === "loading" && /* @__PURE__ */ jsx("span", {
|
|
1043
|
-
className: "rb-ml-2 rb-caption status-muted",
|
|
1044
|
-
children: "(loading...)"
|
|
1045
|
-
})]
|
|
1046
|
-
}),
|
|
1047
|
-
/* @__PURE__ */ jsx("button", {
|
|
1048
|
-
type: "button",
|
|
1049
|
-
onClick: goToNext,
|
|
1050
|
-
className: "event-calendar-nav-btn",
|
|
1051
|
-
"aria-label": calendarView === "week" ? "Next week" : "Next month",
|
|
1052
|
-
children: /* @__PURE__ */ jsx("svg", {
|
|
1053
|
-
width: "20",
|
|
1054
|
-
height: "20",
|
|
1055
|
-
fill: "none",
|
|
1056
|
-
stroke: "currentColor",
|
|
1057
|
-
strokeWidth: 2,
|
|
1058
|
-
viewBox: "0 0 24 24",
|
|
1059
|
-
children: /* @__PURE__ */ jsx("path", {
|
|
1060
|
-
strokeLinecap: "round",
|
|
1061
|
-
strokeLinejoin: "round",
|
|
1062
|
-
d: "M9 5l7 7-7 7"
|
|
1063
|
-
})
|
|
1064
|
-
})
|
|
1065
|
-
})
|
|
1066
|
-
]
|
|
1067
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1068
|
-
type: "button",
|
|
1069
|
-
onClick: goToToday,
|
|
1070
|
-
className: themeButtonClassName({
|
|
1071
|
-
variant: buttonVariant,
|
|
1072
|
-
size: "sm"
|
|
1073
|
-
}),
|
|
1074
|
-
children: "Today"
|
|
1075
|
-
})]
|
|
1076
|
-
}),
|
|
1077
|
-
viewport.kind === "week" ? /* @__PURE__ */ jsx(WeekAgendaView, {
|
|
1078
|
-
days: viewport.days,
|
|
1079
|
-
events: calendarEventsRaw,
|
|
1080
|
-
emptyMessage: "No events scheduled",
|
|
1081
|
-
showCapacity: resolvedShowCapacity,
|
|
1082
|
-
calendarTimeZone: calendarContext.timeZone,
|
|
1083
|
-
today: calendarContext.initialToday
|
|
1084
|
-
}) : /* @__PURE__ */ jsxs("div", {
|
|
1085
|
-
className: "event-calendar-container",
|
|
1086
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
1087
|
-
className: "event-calendar-day-headers",
|
|
1088
|
-
children: dayNames.map((day) => /* @__PURE__ */ jsx("div", {
|
|
1089
|
-
className: "event-calendar-day-header",
|
|
1090
|
-
children: day
|
|
1091
|
-
}, day))
|
|
1092
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1093
|
-
className: "event-calendar-grid",
|
|
1094
|
-
children: viewport.days.map((date) => {
|
|
1095
|
-
const dateKey = formatDateKey(date);
|
|
1096
|
-
return /* @__PURE__ */ jsx(CalendarDayCell, {
|
|
1097
|
-
date,
|
|
1098
|
-
events: eventsByDate.get(dateKey) || [],
|
|
1099
|
-
isCurrentMonth: date.month === viewDate.month,
|
|
1100
|
-
today: calendarContext.initialToday
|
|
1101
|
-
}, dateKey);
|
|
1102
|
-
})
|
|
1103
|
-
})]
|
|
1104
|
-
}),
|
|
1105
|
-
calendarEventsRaw.length === 0 && calendarLoadState.kind === "idle" && /* @__PURE__ */ jsx("p", {
|
|
1106
|
-
className: "event-calendar-empty",
|
|
1107
|
-
children: emptyMessage
|
|
1108
|
-
})
|
|
1109
|
-
]
|
|
1110
|
-
}), /* @__PURE__ */ jsx(EventModals, {
|
|
1336
|
+
activeTab === "calendar" && /* @__PURE__ */ jsx(EventCombinedCalendarTab, {
|
|
1337
|
+
calendarTabViews,
|
|
1338
|
+
calendarView,
|
|
1339
|
+
calendarViewOptions,
|
|
1340
|
+
onCalendarViewChange: setCalendarView,
|
|
1341
|
+
calendarEvents: calendarEventsRaw,
|
|
1342
|
+
eventsByDate,
|
|
1343
|
+
viewDate,
|
|
1344
|
+
viewport,
|
|
1345
|
+
calendarLoadState,
|
|
1346
|
+
dayNames,
|
|
1347
|
+
calendarContext,
|
|
1348
|
+
today,
|
|
1349
|
+
goToPrevious,
|
|
1350
|
+
goToNext,
|
|
1351
|
+
goToToday,
|
|
1352
|
+
emptyMessage,
|
|
1353
|
+
showCapacity: resolvedShowCapacity,
|
|
1354
|
+
showVenue: resolvedShowVenue,
|
|
1111
1355
|
cardRole,
|
|
1112
1356
|
buttonVariant,
|
|
1113
1357
|
buttonText,
|
|
1114
|
-
|
|
1115
|
-
})
|
|
1358
|
+
showEmptyState: hydrationReady && calendarLoadState.kind === "idle"
|
|
1359
|
+
})
|
|
1116
1360
|
]
|
|
1117
1361
|
});
|
|
1118
1362
|
};
|
|
1119
1363
|
const EventCombinedIslandClient = (props) => /* @__PURE__ */ jsx(EventCombinedClient, { ...toEventCombinedControllerProps(props) });
|
|
1120
1364
|
//#endregion
|
|
1121
|
-
export {
|
|
1365
|
+
export { WeekAgendaView as a, CalendarDayCell as c, useCalendarEvents as d, useHydrationReady as i, EventModalProvider as l, EventCombinedIslandClient as n, CalendarNavigationChevron as o, EventModals as r, CalendarDayHeaders as s, EventCombinedClient as t, useEventModal as u };
|