@riverbankcms/sdk 0.151.0 → 0.152.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +37 -0
- package/dist/{EventEmbeddedCheckoutStep-BBHbM22D.mjs → EventEmbeddedCheckoutStep-DVQXWFm6.mjs} +10 -9
- package/dist/{PreviewEditorSidebar-BHplI9HE.mjs → PreviewEditorSidebar-Dr4NJi3Q.mjs} +4 -3
- package/dist/{PreviewEditorUI-DuyN8nsD.mjs → PreviewEditorUI-DSZXQbyh.mjs} +5 -4
- package/dist/{SdkPreviewModeRuntime-CR5ypwxJ.mjs → SdkPreviewModeRuntime-Dl4GyMc3.mjs} +124 -53
- package/dist/{SiteChromeCustomizeContext-D5t6joF_.mjs → SiteChromeCustomizeContext-DgBe-FlM.mjs} +20418 -32298
- package/dist/ThemedButton-B8ViBnLK.mjs +16350 -0
- package/dist/_dts/api/src/bookingOperations.d.ts +5 -3
- package/dist/_dts/api/src/commercePortalEndpoints.d.ts +4 -0
- package/dist/_dts/api/src/endpoints.d.ts +7 -0
- package/dist/_dts/api/src/index.d.ts +1 -1
- package/dist/_dts/api/src/navigation/types.d.ts +7 -0
- package/dist/_dts/api/src/navigation.d.ts +1 -1
- package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +10 -1
- package/dist/_dts/api/src/siteAssets.d.ts +1 -0
- package/dist/_dts/blocks/src/definitions.d.ts +1 -1
- package/dist/_dts/blocks/src/index.d.ts +1 -0
- package/dist/_dts/blocks/src/pageRenderPreparation.d.ts +1 -0
- package/dist/_dts/blocks/src/pageRendererContracts.d.ts +1 -1
- package/dist/_dts/blocks/src/primitives/content/utils/sanitizeHref.d.ts +1 -1
- package/dist/_dts/blocks/src/system/blocks/event-registration.d.ts +4 -4
- package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +16 -0
- package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +5 -0
- package/dist/_dts/blocks/src/system/blocks/offerings-preview/model.d.ts +2 -0
- package/dist/_dts/blocks/src/system/helpers/normalizeMailingListBlockContent.d.ts +2 -0
- package/dist/_dts/blocks/src/system/registry.d.ts +14 -2
- package/dist/_dts/blocks/src/system/runtime/api/client.d.ts +0 -5
- package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/api/schemas/events.d.ts +971 -0
- package/dist/_dts/blocks/src/system/runtime/api/schemas/waitlist-claims.d.ts +42 -0
- package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +10 -2
- package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +10 -136
- package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -6
- package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -3
- package/dist/_dts/blocks/src/system/runtime/hooks/useBookingSubmission.state.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +3 -1
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.state.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +23 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +6 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/carousel.client.hooks.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/carousel.client.state.d.ts +7 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/BookingEntryViews.d.ts +42 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventEmbeddedCheckoutStep.d.ts +4 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationBookingLayer.d.ts +19 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.d.ts +4 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationSurface.d.ts +24 -9
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizardContent.d.ts +4 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventSelectionStep.d.ts +5 -4
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/GuestDetailsSection.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentStatusStep.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SingleTicketEntitlementNote.d.ts +11 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/SuccessStep.d.ts +4 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/TicketSelectionStep.d.ts +5 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/VerifyingTimeoutStep.d.ts +2 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingCardDisplay.d.ts +31 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingEntry.d.ts +154 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/bookingFocus.d.ts +12 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventSourceRecovery.d.ts +9 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/finishedBooking.d.ts +77 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/index.d.ts +0 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/offeringNoun.d.ts +12 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentResponse.d.ts +2 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationCompletion.d.ts +33 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDerivations.d.ts +11 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDisplay.d.ts +31 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationDraft.state.d.ts +60 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationEventAdapter.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +58 -10
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationSurface.d.ts +17 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +23 -7
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useBookingBarFacts.d.ts +12 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationRecoveryRequest.d.ts +3 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.d.ts +4 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +4 -11
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +1563 -31
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventSourceRecovery.d.ts +2 -12
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/usePaymentStatusRecovery.d.ts +147 -4
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/utils.d.ts +50 -2
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/waitlistClaimRestoration.d.ts +6 -5
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/wizardSteps.d.ts +85 -15
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +53 -8
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/MonthLookView.d.ts +10 -3
- package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +16 -0
- package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptionCopy.d.ts +5 -1
- package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +37 -1
- package/dist/_dts/blocks/src/system/runtime/shared/components/ModalShell.d.ts +9 -2
- package/dist/_dts/blocks/src/system/runtime/shared/components/PaymentChoiceRows.d.ts +28 -0
- package/dist/_dts/blocks/src/system/runtime/shared/components/StepIndicator.d.ts +6 -8
- package/dist/_dts/blocks/src/system/runtime/shared/components/index.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/shared/index.d.ts +2 -2
- package/dist/_dts/blocks/src/system/runtime/shared/useWaitlistClaim.d.ts +9 -12
- package/dist/_dts/blocks/src/system/runtime/shared/useWaitlistClaim.state.d.ts +15 -0
- package/dist/_dts/blocks/src/system/runtime/shared/utils/themePortalRoot.d.ts +10 -15
- package/dist/_dts/blocks/src/system/transforms/registry/index.d.ts +1 -0
- package/dist/_dts/blocks/src/system/transforms/registry/links.d.ts +3 -1
- package/dist/_dts/commerce/src/purchase/bookingInstalmentSchedule.d.ts +2 -0
- package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +6 -0
- package/dist/_dts/commerce/src/purchase/confirmationEmailPayment.d.ts +14 -14
- package/dist/_dts/commerce/src/purchase/confirmationPayment.d.ts +65 -0
- package/dist/_dts/commerce/src/purchase/confirmationPaymentSchema.d.ts +66 -0
- package/dist/_dts/commerce/src/purchase/index.d.ts +2 -0
- package/dist/_dts/commerce/src/purchase/orderPaymentState.d.ts +8 -0
- package/dist/_dts/content-model/src/templates/defaults.d.ts +2 -2
- package/dist/_dts/core/src/appointment-booking-terms.d.ts +20 -0
- package/dist/_dts/core/src/booking-payment-schemas.d.ts +70 -0
- package/dist/_dts/core/src/branded.d.ts +0 -2
- package/dist/_dts/core/src/demo-claim-access.d.ts +1 -1
- package/dist/_dts/core/src/demo-claim-readiness.d.ts +18 -0
- package/dist/_dts/core/src/demo-lifecycle-status.d.ts +1 -1
- package/dist/_dts/core/src/demo-warm-pool-target.d.ts +1 -1
- package/dist/_dts/core/src/index.d.ts +4 -0
- package/dist/_dts/core/src/mailing-list-targeting-availability.d.ts +68 -0
- package/dist/_dts/core/src/mailing-list-targeting.d.ts +2 -0
- package/dist/_dts/core/src/ticket-quantity.d.ts +13 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +51 -32
- package/dist/_dts/editor/src/chrome/chromeLayers.d.ts +7 -0
- package/dist/_dts/editor/src/index.d.ts +1 -0
- package/dist/_dts/editor-blocks/src/widgets/link/LinkAddressInput.d.ts +8 -0
- package/dist/_dts/editor-blocks/src/widgets/link/LinkContentList.d.ts +12 -0
- package/dist/_dts/editor-blocks/src/widgets/link/LinkPicker.d.ts +5 -1
- package/dist/_dts/editor-blocks/src/widgets/link/LinkPickerDialog.d.ts +3 -3
- package/dist/_dts/editor-blocks/src/widgets/link/LinkSummary.d.ts +8 -2
- package/dist/_dts/editor-blocks/src/widgets/link/LinkWidget.d.ts +4 -3
- package/dist/_dts/editor-blocks/src/widgets/link/LinkWidgetContext.d.ts +2 -1
- package/dist/_dts/editor-blocks/src/widgets/link/draft.d.ts +44 -0
- package/dist/_dts/editor-blocks/src/widgets/link/presentation.d.ts +13 -0
- package/dist/_dts/editor-blocks/src/widgets/link/types.d.ts +14 -0
- package/dist/_dts/editor-blocks/src/widgets/link/useRoutableContent.d.ts +2 -0
- package/dist/_dts/editor-blocks/src/widgets/link/utils.d.ts +5 -4
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/MailingListTargetingField.d.ts +1 -1
- package/dist/_dts/editor-blocks/src/widgets/mailing-list-targeting/targetingState.d.ts +13 -8
- package/dist/_dts/media-core/src/fileStorage.d.ts +4 -3
- package/dist/_dts/media-core/src/index.d.ts +1 -0
- package/dist/_dts/media-core/src/storageObjectKey.d.ts +12 -0
- package/dist/_dts/media-react/src/hooks/useSupabaseMediaUploader.d.ts +1 -1
- package/dist/_dts/media-react/src/internal/supabaseResumableUpload.d.ts +13 -0
- package/dist/_dts/preview-next/src/client/preview/previewModeRootAttribute.d.ts +11 -0
- package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +0 -1
- package/dist/_dts/sdk/src/rendering/image.d.ts +10 -0
- package/dist/_dts/sdk/src/rendering/index.d.ts +3 -1
- package/dist/_dts/sdk/src/rendering/link.d.ts +9 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +1 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/_dts/theme-core/src/blocks/opaquePanels.d.ts +3 -3
- package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
- package/dist/client/BookingMailingListNote-CBuMKN0w.mjs +386 -0
- package/dist/client/{CardListItem-ZDLYh6dL.mjs → CardListItem-Dc9XTXhB.mjs} +3 -4
- package/dist/client/CheckIcon-CpyXr-Kg.mjs +35 -0
- package/dist/client/{CheckboxChoice-M-3HycLw.mjs → CheckboxChoice-CIqx_o0E.mjs} +1 -1
- package/dist/client/{DemoBookingPortalAccess-BMtvPTWE.mjs → DemoBookingPortalAccess-D3VQ_kLj.mjs} +85 -85
- package/dist/client/{EventCombined.client-DUm_DOxW.mjs → EventCombined.client-BHGEKise.mjs} +8 -9
- package/dist/client/{EventEmbeddedCheckoutStep-DsNNzgRm.mjs → EventEmbeddedCheckoutStep-Bo1Cm23R.mjs} +11 -10
- package/dist/client/{EventListing.client-DjNYGUVm.mjs → EventListing.client-D5OQgVPr.mjs} +2 -2
- package/dist/client/{LeafletStaticMap-DuFiOHq_.mjs → LeafletStaticMap-CLL5cWrr.mjs} +1 -1
- package/dist/client/{ModalShell-CqkBvBIC.mjs → ModalShell-BXzucfR6.mjs} +83 -12
- package/dist/client/{RichText-LjPCUGGi.mjs → RichText-BoDmnopf.mjs} +6 -3
- package/dist/client/{ThemedButton-DZKjtaDD.mjs → ThemedButton-Ciltp0IK.mjs} +2 -2
- package/dist/client/{accordion-Qe--SILD.mjs → accordion-DOkRS64-.mjs} +1 -1
- package/dist/client/aspectTransforms-D-TnDdq4.mjs +93 -0
- package/dist/client/{bookingForm-3BCl4g_f.mjs → bookingForm-wlMVwo9h.mjs} +289 -149
- package/dist/client/bookings.mjs +12212 -10832
- package/dist/client/{carousel-h2YjKOS2.mjs → carousel-CGWk-Z0u.mjs} +2 -2
- package/dist/client/{carousel.client-BLrd4hmY.mjs → carousel.client-kX5mN1Eg.mjs} +46 -41
- package/dist/client/{cart-5NeiigVd.mjs → cart-OBBPlaH4.mjs} +3 -3
- package/dist/client/{checkout-G4UWjOEw.mjs → checkout-Bmw2WjQX.mjs} +3 -3
- package/dist/client/client.mjs +9541 -6039
- package/dist/client/{colorStyles-DTunOThj.mjs → colorStyles-ECDNPE_P.mjs} +23 -86
- package/dist/client/{context-GK4-AVAh.mjs → context-BI77UFAn.mjs} +275 -10
- package/dist/client/{eventCalendar-Prw3Yo_L.mjs → eventCalendar-qkej2Edn.mjs} +19 -17
- package/dist/client/{eventCombined-BUugi6__.mjs → eventCombined-DApKHvat.mjs} +4 -4
- package/dist/client/{eventDetails-CBHUda-R.mjs → eventDetails-BQyUDPH0.mjs} +3 -4
- package/dist/client/{eventListing-CQeG45Dg.mjs → eventListing-CeAnshlZ.mjs} +4 -4
- package/dist/client/{eventRegistration-Dif3p3oJ.mjs → eventRegistration-C3A3NyBO.mjs} +2209 -2144
- package/dist/client/{form-Cf0WMtfG.mjs → form-DW8rU7jO.mjs} +6 -6
- package/dist/client/{headerSection-Bqdr3JWp.mjs → headerSection-CkIhsoNm.mjs} +9 -9
- package/dist/client/hooks.mjs +1289 -380
- package/dist/client/{locationMap-BVvPou4O.mjs → locationMap-D4O8wbli.mjs} +4 -4
- package/dist/client/{media-47fcnhzD.mjs → media-C5K_0xPd.mjs} +2 -2
- package/dist/client/{newsletterForm-Cx-1dnic.mjs → newsletterForm-B7IxSPuz.mjs} +5 -5
- package/dist/client/{productDetail-DaUMaJYk.mjs → productDetail-Bqxpwy5N.mjs} +3 -3
- package/dist/client/{productList-BKQlWEKE.mjs → productList-u9Lz8V15.mjs} +3 -3
- package/dist/client/{propsDecoder-DO5iXphQ.mjs → propsDecoder-Bf1jucUp.mjs} +17333 -14489
- package/dist/client/rendering/client.mjs +58216 -55133
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +9099 -5636
- package/dist/client/{routeIslandApiConfig-BNm0Z3-g.mjs → routeIslandApiConfig-BgP-aPMl.mjs} +1 -1
- package/dist/client/{shop-D7ytcFBC.mjs → shop-B_eykR-_.mjs} +16 -14
- package/dist/client/{shop-commerce-D68-hHy2.mjs → shop-commerce-CT0APkFV.mjs} +9 -9
- package/dist/client/{shop-commerce-store-Cu7X2lyu.mjs → shop-commerce-store-DcvZxdEK.mjs} +1 -1
- package/dist/client/{shopShared-D12rxE69.mjs → shopShared-BVJOiUiJ.mjs} +5 -5
- package/dist/client/themePortalRoot-DS92SRVZ.mjs +47 -0
- package/dist/client/{TerminalPanel-DOTSUCO0.mjs → useDiscountCodeUi-DPmYDunz.mjs} +60 -77
- package/dist/client/{useEventPagination-jgKa67KV.mjs → useEventPagination-8-U55vH5.mjs} +7 -8
- package/dist/preview-next/before-render.mjs +7 -0
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/preview-next/keepAlive.mjs +7 -0
- package/dist/preview-next/middleware.mjs +7 -0
- package/dist/{sdk-runtime-4cCWO_3i.mjs → sdk-runtime-C5jPdSrk.mjs} +1 -1
- package/dist/server/components.mjs +3138 -1373
- package/dist/server/config-validation.mjs +1395 -486
- package/dist/server/config.mjs +1395 -486
- package/dist/server/data.mjs +1289 -380
- package/dist/server/index.mjs +8 -1
- package/dist/server/next.mjs +3362 -1538
- package/dist/server/page-converter.mjs +1357 -453
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +2335 -1044
- package/dist/server/rendering.mjs +3152 -1370
- package/dist/server/routing.mjs +1437 -490
- package/dist/server/server.mjs +1297 -381
- package/dist/server/theme-bridge.mjs +1135 -795
- package/dist/{spinner-tSdG9YvG.mjs → spinner-B-ab2rJp.mjs} +1 -1
- package/dist/styles/index.css +1088 -721
- package/package.json +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/OrderSummary.d.ts +0 -15
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useWaitlistClaimRestoration.d.ts +0 -22
- package/dist/_dts/blocks/src/system/runtime/shared/components/SelectableOptionCard.d.ts +0 -30
- package/dist/client/BookingMailingListNote-DlDSs5Vm.mjs +0 -567
- package/dist/client/pricing-CMD0kADd.mjs +0 -314
- package/dist/client/result-DRW7JWXz.mjs +0 -30
- package/dist/client/scrollToBlock-C86BYkyV.mjs +0 -17
- package/dist/client/themePortalRoot-AGs4cE7t.mjs +0 -30
- package/dist/spinner-BL3kW9Uh.mjs +0 -803
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { Ln as formatBookingPriceDisplay, Rn as formatEventPricing, Vn as publicEventPricingDisplay } from "./propsDecoder-DO5iXphQ.mjs";
|
|
2
|
-
//#region ../blocks/src/system/runtime/nodes/events/domain/capacity.ts
|
|
3
|
-
/**
|
|
4
|
-
* Compute remaining spots for an event from `availableSpots` with a fallback
|
|
5
|
-
* to `capacity - registeredCount`. Returns `{ available: null, isFull: false }`
|
|
6
|
-
* for uncapped events so call sites can render no capacity indicator at all.
|
|
7
|
-
*
|
|
8
|
-
* The single source of truth for capacity math across event cards, agenda
|
|
9
|
-
* rows, and timetable cells — keep wording variations in the call sites.
|
|
10
|
-
*/
|
|
11
|
-
function getEventAvailability(event) {
|
|
12
|
-
if (event.capacity == null) return {
|
|
13
|
-
available: null,
|
|
14
|
-
isFull: false
|
|
15
|
-
};
|
|
16
|
-
const available = event.availableSpots ?? event.capacity - event.registeredCount;
|
|
17
|
-
if (available <= 0) return {
|
|
18
|
-
available: 0,
|
|
19
|
-
isFull: true
|
|
20
|
-
};
|
|
21
|
-
return {
|
|
22
|
-
available,
|
|
23
|
-
isFull: false
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Pick the capacity row a booking decision should read: the selected
|
|
28
|
-
* attendance mode's availability when the visitor has chosen one and the
|
|
29
|
-
* event publishes it, otherwise the event-level aggregate.
|
|
30
|
-
*
|
|
31
|
-
* The mode row is used wholesale. A mode with `capacity: null` on a capped
|
|
32
|
-
* event is uncapped *by design*: the registration write path applies the
|
|
33
|
-
* same rule via `getEffectiveOccurrenceCapacityForAttendanceMode`, so falling
|
|
34
|
-
* back to the event's `availableSpots` here would block bookings the server
|
|
35
|
-
* accepts. (Waitlist claims are still occurrence-scoped; see issue 1377.)
|
|
36
|
-
*/
|
|
37
|
-
function selectEventCapacitySource(event, attendanceMode) {
|
|
38
|
-
if (!attendanceMode) return event;
|
|
39
|
-
return (event.attendanceModes ?? []).find((mode) => mode.mode === attendanceMode) ?? event;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Whether the visitor's next step is the waitlist: the source is full *and*
|
|
43
|
-
* a waitlist is open. The one place this is decided — cards, rows, the
|
|
44
|
-
* wizard's steps and its action bar all route through here so they agree,
|
|
45
|
-
* including for producers that omit `availableSpots` and rely on the
|
|
46
|
-
* `capacity - registeredCount` fallback.
|
|
47
|
-
*/
|
|
48
|
-
function canJoinEventWaitlist(event, options) {
|
|
49
|
-
const source = selectEventCapacitySource(event, options?.attendanceMode);
|
|
50
|
-
return getEventAvailability(source).isFull && source.waitlistEnabled === true;
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Remaining places at or below which an event reads as scarce and the exact
|
|
54
|
-
* count is worth showing. Above it, no number is shown at all: "147 places
|
|
55
|
-
* left" is not something a visitor acts on, and it is the figure most likely
|
|
56
|
-
* to be stale on a cached page.
|
|
57
|
-
*
|
|
58
|
-
* max( min(3, ceil(capacity * 0.25)), ceil(capacity * 0.05) )
|
|
59
|
-
*
|
|
60
|
-
* The 25% arm stops small groups shouting early (3 of 4 is not urgency); the
|
|
61
|
-
* 5% floor stops large events staying silent until three remain.
|
|
62
|
-
* capacity 4 -> 1, 12 -> 3, 40 -> 3, 100 -> 5, 200 -> 10.
|
|
63
|
-
*/
|
|
64
|
-
function lowCapacityThreshold(capacity) {
|
|
65
|
-
return Math.max(Math.min(3, Math.ceil(capacity * .25)), Math.ceil(capacity * .05));
|
|
66
|
-
}
|
|
67
|
-
function getRemainingPlaces(source) {
|
|
68
|
-
const { available, isFull } = getEventAvailability(source);
|
|
69
|
-
if (available === null || source.capacity === null) return { kind: "unlimited" };
|
|
70
|
-
if (isFull) return {
|
|
71
|
-
kind: "full",
|
|
72
|
-
waitlist: canJoinEventWaitlist(source)
|
|
73
|
-
};
|
|
74
|
-
if (available <= lowCapacityThreshold(source.capacity)) return {
|
|
75
|
-
kind: "low",
|
|
76
|
-
remaining: available
|
|
77
|
-
};
|
|
78
|
-
return { kind: "open" };
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* The one place a remaining-places count becomes text. Returns `null` when
|
|
82
|
-
* nothing should be shown: uncapped events, and capped events above the
|
|
83
|
-
* scarcity threshold. Surfaces that need their own full-state wording pass
|
|
84
|
-
* it in rather than re-deriving the count.
|
|
85
|
-
*/
|
|
86
|
-
function formatRemainingPlaces(source, wording = {}) {
|
|
87
|
-
const remaining = getRemainingPlaces(source);
|
|
88
|
-
switch (remaining.kind) {
|
|
89
|
-
case "unlimited":
|
|
90
|
-
case "open": return null;
|
|
91
|
-
case "low": return formatPlacesLeft(remaining.remaining, wording.compact === true);
|
|
92
|
-
case "full": return remaining.waitlist ? wording.waitlist ?? "Waitlist" : wording.full ?? "Full";
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
function formatPlacesLeft(count, compact) {
|
|
96
|
-
if (compact) return `${count} left`;
|
|
97
|
-
return count === 1 ? "1 place left" : `${count} places left`;
|
|
98
|
-
}
|
|
99
|
-
function formatTicketTypeRemaining(remainingCapacity) {
|
|
100
|
-
if (remainingCapacity === null || remainingCapacity > 3) return null;
|
|
101
|
-
if (remainingCapacity <= 0) return "None left for this ticket type";
|
|
102
|
-
return `${formatPlacesLeft(remainingCapacity, false)} for this ticket type`;
|
|
103
|
-
}
|
|
104
|
-
/** Total capacity as copy ("12 places"), for detail surfaces that state the size of an event. */
|
|
105
|
-
function formatTotalCapacity(capacity) {
|
|
106
|
-
if (capacity === null) return null;
|
|
107
|
-
return capacity === 1 ? "1 place" : `${capacity} places`;
|
|
108
|
-
}
|
|
109
|
-
function getEventAvailabilityStatus(event) {
|
|
110
|
-
const source = selectMostOpenCapacitySource(event);
|
|
111
|
-
const remaining = getRemainingPlaces(source);
|
|
112
|
-
const label = formatEventRemainingPlaces(event, { compact: true });
|
|
113
|
-
switch (remaining.kind) {
|
|
114
|
-
case "unlimited": return {
|
|
115
|
-
status: "available",
|
|
116
|
-
available: null,
|
|
117
|
-
isFull: false,
|
|
118
|
-
label
|
|
119
|
-
};
|
|
120
|
-
case "open": return {
|
|
121
|
-
status: "available",
|
|
122
|
-
available: getEventAvailability(source).available,
|
|
123
|
-
isFull: false,
|
|
124
|
-
label
|
|
125
|
-
};
|
|
126
|
-
case "low": return {
|
|
127
|
-
status: "filling",
|
|
128
|
-
available: remaining.remaining,
|
|
129
|
-
isFull: false,
|
|
130
|
-
label
|
|
131
|
-
};
|
|
132
|
-
case "full": return {
|
|
133
|
-
status: "waitlist",
|
|
134
|
-
available: 0,
|
|
135
|
-
isFull: true,
|
|
136
|
-
label
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Which capacity figure wins when they disagree.
|
|
142
|
-
*
|
|
143
|
-
* For a hybrid event that publishes both attendance-mode rows, **the mode
|
|
144
|
-
* rows are authoritative and the event-level aggregate is only a summary**.
|
|
145
|
-
* The registration write path admits or refuses per mode
|
|
146
|
-
* (`getEffectiveOccurrenceCapacityForAttendanceMode` on the server), so the
|
|
147
|
-
* aggregate can read full while a mode still has room, and can read open
|
|
148
|
-
* while the mode the visitor wants is full. Believing the aggregate on a
|
|
149
|
-
* card is how a "places available" event turns into a dead end at step two.
|
|
150
|
-
*
|
|
151
|
-
* Everything else — single-mode events, events that publish no rows, and the
|
|
152
|
-
* aggregate-only helpers {@link getEventAvailability} /
|
|
153
|
-
* {@link getRemainingPlaces} that existing callers rely on — keeps reading
|
|
154
|
-
* the aggregate, unchanged.
|
|
155
|
-
*/
|
|
156
|
-
function findHybridModeRows(event) {
|
|
157
|
-
if (event.deliveryMode !== "hybrid") return null;
|
|
158
|
-
const rows = event.attendanceModes ?? [];
|
|
159
|
-
const inPerson = rows.find((row) => row.mode === "in_person");
|
|
160
|
-
const online = rows.find((row) => row.mode === "online");
|
|
161
|
-
return inPerson && online ? {
|
|
162
|
-
inPerson,
|
|
163
|
-
online
|
|
164
|
-
} : null;
|
|
165
|
-
}
|
|
166
|
-
/** Openness rank; higher means more room. A full mode with a waitlist beats one without. */
|
|
167
|
-
function remainingPlacesRank(remaining) {
|
|
168
|
-
switch (remaining.kind) {
|
|
169
|
-
case "unlimited": return 4;
|
|
170
|
-
case "open": return 3;
|
|
171
|
-
case "low": return 2;
|
|
172
|
-
case "full": return remaining.waitlist ? 1 : 0;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
function isMoreOpen(candidate, than) {
|
|
176
|
-
const rank = remainingPlacesRank(candidate);
|
|
177
|
-
const otherRank = remainingPlacesRank(than);
|
|
178
|
-
if (rank !== otherRank) return rank > otherRank;
|
|
179
|
-
return candidate.kind === "low" && than.kind === "low" ? candidate.remaining > than.remaining : false;
|
|
180
|
-
}
|
|
181
|
-
/** True when `candidate` has less room left than `than`. */
|
|
182
|
-
function isScarcer(candidate, than) {
|
|
183
|
-
return isMoreOpen(than, candidate);
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* The capacity row a whole-event decision should read: the most open
|
|
187
|
-
* attendance mode of a hybrid event, otherwise the aggregate. A hybrid event
|
|
188
|
-
* is sold out only when both of its modes are, and its waitlist is reachable
|
|
189
|
-
* when either full mode has one open.
|
|
190
|
-
*/
|
|
191
|
-
function selectMostOpenCapacitySource(event) {
|
|
192
|
-
const rows = findHybridModeRows(event);
|
|
193
|
-
if (!rows) return event;
|
|
194
|
-
return isMoreOpen(getRemainingPlaces(rows.online), getRemainingPlaces(rows.inPerson)) ? rows.online : rows.inPerson;
|
|
195
|
-
}
|
|
196
|
-
/** True when no attendance mode has room. Hybrid-aware; use this for sold-out decisions. */
|
|
197
|
-
function isEventFull(event) {
|
|
198
|
-
return getEventAvailability(selectMostOpenCapacitySource(event)).isFull;
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* True when the event is full on every mode and at least one of those full
|
|
202
|
-
* modes has a waitlist open. An event with a mode still bookable is not a
|
|
203
|
-
* waitlist prospect: it should send the visitor to that mode instead.
|
|
204
|
-
*/
|
|
205
|
-
function canJoinEventWaitlistOnAnyMode(event) {
|
|
206
|
-
return canJoinEventWaitlist(selectMostOpenCapacitySource(event));
|
|
207
|
-
}
|
|
208
|
-
const ATTENDANCE_MODE_LABEL = {
|
|
209
|
-
in_person: "In person",
|
|
210
|
-
online: "Online"
|
|
211
|
-
};
|
|
212
|
-
/** Wording for a mode with room to spare, where the count is deliberately withheld. */
|
|
213
|
-
const PLACES_AVAILABLE = "Places available";
|
|
214
|
-
/**
|
|
215
|
-
* The browse-surface label for an event's remaining places. Single-mode
|
|
216
|
-
* events get exactly the aggregate label {@link formatRemainingPlaces}
|
|
217
|
-
* produces, and so does a hybrid event whose two modes tell the same story.
|
|
218
|
-
* When the modes differ, both sides are named: "available" on a card is a
|
|
219
|
-
* promise the registration wizard would otherwise have to break.
|
|
220
|
-
*
|
|
221
|
-
* Hybrid examples, in person full with 3 online places left:
|
|
222
|
-
* default -> "Online: 3 places left · In person: Full"
|
|
223
|
-
* { full: 'Sold out' } -> "Online: 3 places left · In person: Sold out"
|
|
224
|
-
* { compact: true } -> "Online: 3 left"
|
|
225
|
-
*/
|
|
226
|
-
function formatEventRemainingPlaces(event, wording = {}) {
|
|
227
|
-
const rows = findHybridModeRows(event);
|
|
228
|
-
if (!rows) return formatRemainingPlaces(event, wording);
|
|
229
|
-
const inPerson = formatRemainingPlaces(rows.inPerson, wording);
|
|
230
|
-
const online = formatRemainingPlaces(rows.online, wording);
|
|
231
|
-
if (inPerson === online) return inPerson;
|
|
232
|
-
if (wording.compact === true) return formatCompactHybridPlaces(rows, wording);
|
|
233
|
-
return formatBothHybridSides(rows, {
|
|
234
|
-
inPerson,
|
|
235
|
-
online
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Both sides, the one with room first: that is the half a visitor can act on,
|
|
240
|
-
* and it should not arrive after a full stop's worth of bad news.
|
|
241
|
-
*/
|
|
242
|
-
function formatBothHybridSides(rows, labels) {
|
|
243
|
-
return (isMoreOpen(getRemainingPlaces(rows.online), getRemainingPlaces(rows.inPerson)) ? [["online", labels.online], ["in_person", labels.inPerson]] : [["in_person", labels.inPerson], ["online", labels.online]]).map(([mode, label]) => namedModePlaces(mode, label)).join(" · ");
|
|
244
|
-
}
|
|
245
|
-
function namedModePlaces(mode, label) {
|
|
246
|
-
return `${ATTENDANCE_MODE_LABEL[mode]}: ${label ?? PLACES_AVAILABLE}`;
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Pills and timetable cells have room for one short phrase, so they name the
|
|
250
|
-
* single mode that carries news rather than listing both: the scarce side
|
|
251
|
-
* when there is a count to show, and otherwise the side that has closed —
|
|
252
|
-
* "In person: Full", never "Online only", which reads as a statement about
|
|
253
|
-
* how the event is delivered rather than about its remaining places.
|
|
254
|
-
*/
|
|
255
|
-
function formatCompactHybridPlaces(rows, wording) {
|
|
256
|
-
const inPerson = getRemainingPlaces(rows.inPerson);
|
|
257
|
-
const online = getRemainingPlaces(rows.online);
|
|
258
|
-
if (inPerson.kind === "full" && online.kind === "full") return formatRemainingPlaces(inPerson.waitlist ? rows.inPerson : rows.online, wording);
|
|
259
|
-
if (inPerson.kind === "full" || online.kind === "full") {
|
|
260
|
-
const fullSide = inPerson.kind === "full" ? "in_person" : "online";
|
|
261
|
-
const openSide = inPerson.kind === "full" ? "online" : "in_person";
|
|
262
|
-
const openLabel = formatRemainingPlaces(rowFor(rows, openSide), wording);
|
|
263
|
-
return openLabel !== null ? namedModePlaces(openSide, openLabel) : namedModePlaces(fullSide, formatRemainingPlaces(rowFor(rows, fullSide), wording));
|
|
264
|
-
}
|
|
265
|
-
const scarcerSide = isScarcer(online, inPerson) ? "online" : "in_person";
|
|
266
|
-
return namedModePlaces(scarcerSide, formatRemainingPlaces(rowFor(rows, scarcerSide), wording));
|
|
267
|
-
}
|
|
268
|
-
function rowFor(rows, mode) {
|
|
269
|
-
return mode === "online" ? rows.online : rows.inPerson;
|
|
270
|
-
}
|
|
271
|
-
//#endregion
|
|
272
|
-
//#region ../blocks/src/system/runtime/nodes/events/domain/pricing.ts
|
|
273
|
-
/**
|
|
274
|
-
* Format event price for display.
|
|
275
|
-
* @returns "Free", "£25", "£12 - £25", "Free / £12 - £25", "Course (From £40)", etc.
|
|
276
|
-
*
|
|
277
|
-
* Events render compact amounts (no trailing ".00"); the actual ADT→string
|
|
278
|
-
* mapping lives in `formatBookingPriceDisplay` in @riverbankcms/core so all
|
|
279
|
-
* surfaces stay consistent.
|
|
280
|
-
*/
|
|
281
|
-
function formatEventPrice(event) {
|
|
282
|
-
const label = formatEventPricing(event.pricing, { decimals: "auto" });
|
|
283
|
-
if (event.bookingScope !== "whole_series") return label;
|
|
284
|
-
return publicEventPricingDisplay(event.pricing).kind === "free" ? "Course" : `Course (${label})`;
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Format an event's price directly from its pricing value (without the full
|
|
288
|
-
* event). Same output as {@link formatEventPrice}.
|
|
289
|
-
*/
|
|
290
|
-
function formatEventPriceDisplay(pricing) {
|
|
291
|
-
return formatEventPricing(pricing, { decimals: "auto" });
|
|
292
|
-
}
|
|
293
|
-
/**
|
|
294
|
-
* Format one exact money amount from the canonical Event pricing projection.
|
|
295
|
-
*
|
|
296
|
-
* Used where a surface has an amount rather than a whole pricing model — a
|
|
297
|
-
* discount line, a single run price. Amounts render exactly (trailing minor
|
|
298
|
-
* units kept) because these sit next to other exact figures.
|
|
299
|
-
*/
|
|
300
|
-
function formatEventPriceAmount(amount, currency, locale) {
|
|
301
|
-
return formatBookingPriceDisplay(amount > 0 ? {
|
|
302
|
-
kind: "exact",
|
|
303
|
-
amount,
|
|
304
|
-
currency
|
|
305
|
-
} : {
|
|
306
|
-
kind: "free",
|
|
307
|
-
currency
|
|
308
|
-
}, {
|
|
309
|
-
decimals: "exact",
|
|
310
|
-
locale
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
//#endregion
|
|
314
|
-
export { canJoinEventWaitlistOnAnyMode as a, formatTicketTypeRemaining as c, getEventAvailabilityStatus as d, getRemainingPlaces as f, selectMostOpenCapacitySource as h, canJoinEventWaitlist as i, formatTotalCapacity as l, selectEventCapacitySource as m, formatEventPriceAmount as n, formatEventRemainingPlaces as o, isEventFull as p, formatEventPriceDisplay as r, formatRemainingPlaces as s, formatEventPrice as t, getEventAvailability as u };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region ../../node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
2
|
-
function r(e) {
|
|
3
|
-
var t, f, n = "";
|
|
4
|
-
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
5
|
-
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
6
|
-
var o = e.length;
|
|
7
|
-
for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
8
|
-
} else for (f in e) e[f] && (n && (n += " "), n += f);
|
|
9
|
-
return n;
|
|
10
|
-
}
|
|
11
|
-
function clsx() {
|
|
12
|
-
for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
13
|
-
return n;
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
//#region ../core/src/result.ts
|
|
17
|
-
function ok(value) {
|
|
18
|
-
return {
|
|
19
|
-
ok: true,
|
|
20
|
-
value
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function err(error) {
|
|
24
|
-
return {
|
|
25
|
-
ok: false,
|
|
26
|
-
error
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { ok as n, clsx as r, err as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//#region ../blocks/src/system/runtime/shared/utils/scrollToBlock.ts
|
|
2
|
-
/**
|
|
3
|
-
* Scroll to a block element by its anchor ID.
|
|
4
|
-
*
|
|
5
|
-
* Uses requestAnimationFrame to defer scrolling until after
|
|
6
|
-
* layout shifts (lazy images, fonts, etc.) have settled.
|
|
7
|
-
*/
|
|
8
|
-
function scrollToBlock(anchorId) {
|
|
9
|
-
requestAnimationFrame(() => {
|
|
10
|
-
document.getElementById(anchorId)?.scrollIntoView({
|
|
11
|
-
behavior: "smooth",
|
|
12
|
-
block: "start"
|
|
13
|
-
});
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
export { scrollToBlock as t };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
//#region ../blocks/src/system/runtime/shared/utils/themePortalRoot.ts
|
|
2
|
-
function copyDataAttributes(from, to) {
|
|
3
|
-
for (const name of from.getAttributeNames()) {
|
|
4
|
-
if (!name.startsWith("data-")) continue;
|
|
5
|
-
const value = from.getAttribute(name);
|
|
6
|
-
if (value === null) continue;
|
|
7
|
-
to.setAttribute(name, value);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
function createBodyThemePortalRoot(sourceEl) {
|
|
11
|
-
if (typeof document === "undefined") return null;
|
|
12
|
-
const scopeCandidate = sourceEl.closest(".theme-scope");
|
|
13
|
-
if (!(scopeCandidate instanceof HTMLElement)) return null;
|
|
14
|
-
const scope = scopeCandidate;
|
|
15
|
-
const root = document.createElement("div");
|
|
16
|
-
root.className = "theme-scope rb-theme-portal-root";
|
|
17
|
-
root.style.cssText = scope.style.cssText;
|
|
18
|
-
copyDataAttributes(scope, root);
|
|
19
|
-
const responsiveMode = scope.getAttribute("data-rb-responsive-mode");
|
|
20
|
-
if (responsiveMode) root.setAttribute("data-rb-responsive-mode", responsiveMode);
|
|
21
|
-
document.body.appendChild(root);
|
|
22
|
-
return {
|
|
23
|
-
root,
|
|
24
|
-
cleanup: () => {
|
|
25
|
-
root.remove();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//#endregion
|
|
30
|
-
export { createBodyThemePortalRoot as t };
|