@riverbankcms/sdk 0.90.1 → 0.92.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{PreviewEditorSidebar-FNFRVSIM.mjs → PreviewEditorSidebar-3CI5MKV3.mjs} +3 -3
- package/dist/{PreviewEditorUI-3WXJFQXG.mjs → PreviewEditorUI-DKEP636I.mjs} +3 -3
- package/dist/SdkPreviewModeRuntime-BRGRDQFH.mjs +8 -0
- package/dist/_dts/api/src/bookingConfig.d.ts +13 -1
- package/dist/_dts/api/src/bookingOperations.d.ts +1 -0
- package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +6 -6
- package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +4 -4
- package/dist/_dts/api/src/publicExperienceEndpoints.d.ts +6 -0
- package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +32 -0
- package/dist/_dts/blocks/src/system/blocks/courses/shared/pricing.d.ts +12 -1
- package/dist/_dts/blocks/src/system/blocks/courses/shared/schemas.d.ts +12 -0
- package/dist/_dts/blocks/src/system/blocks/courses/shared/types.d.ts +4 -1
- package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +44 -0
- package/dist/_dts/blocks/src/system/manifest/fieldValidation/index.d.ts +24 -0
- package/dist/_dts/blocks/src/system/runtime/api/types.d.ts +8 -1
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.d.ts +8 -1
- package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessBookingFlow.state.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.headless.state.d.ts +4 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.interactive.d.ts +40 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.reserved-fields.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +29 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/booking-runtime-sources.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/course-registration/components.d.ts +6 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/course-registration/useCourseRegistrationWizard.d.ts +8 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/TicketSelectionStep.d.ts +8 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/hooks.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +1 -1
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +1 -0
- package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +9 -0
- package/dist/_dts/content-model/src/entry-slots/types.d.ts +110 -2
- package/dist/_dts/core/src/branded.d.ts +3 -0
- package/dist/_dts/core/src/event-pricing.d.ts +18 -1
- package/dist/_dts/core/src/money-input.d.ts +34 -4
- package/dist/_dts/core/src/string.d.ts +12 -0
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +70 -0
- package/dist/_dts/media-core/src/fileAssetCompatibility.d.ts +1 -1
- package/dist/_dts/media-core/src/filePersistence.d.ts +5 -1
- package/dist/_dts/media-core/src/fileStorage.d.ts +1 -0
- package/dist/_dts/media-core/src/videoPrep.d.ts +15 -6
- package/dist/_dts/media-core/src/videoSlotPolicy.d.ts +5 -5
- package/dist/_dts/sdk/src/cli/commands/push/execute/diff.d.ts +2 -0
- package/dist/_dts/sdk/src/cli/commands/push/execute/localMediaReporting.d.ts +23 -0
- package/dist/_dts/sdk/src/cli/commands/push/scopes/commandBackedDatedOfferingScope.d.ts +54 -0
- package/dist/_dts/sdk/src/cli/commands/push/scopes/mediaPrep.d.ts +7 -2
- package/dist/_dts/sdk/src/cli/commands/push/scopes/types.d.ts +6 -0
- package/dist/_dts/sdk/src/cli/media/local-sync.d.ts +35 -0
- package/dist/_dts/sdk/src/cli/sync/validation.d.ts +2 -2
- package/dist/_dts/sdk/src/rendering/islands/types.d.ts +23 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/{chunk-SYYJZPKU.mjs → chunk-6D7PLF4M.mjs} +2 -2
- package/dist/{chunk-CR2VX432.mjs → chunk-I6EOKV6B.mjs} +568 -76
- package/dist/{chunk-FA6LVZ7C.mjs → chunk-LERKJM3E.mjs} +7 -7
- package/dist/{chunk-UG7I7S7W.mjs → chunk-U5YM4AWE.mjs} +1 -1
- package/dist/{chunk-H6TT5ZXI.mjs → chunk-UOMTCHZD.mjs} +1 -1
- package/dist/{chunk-BOQXMCSP.mjs → chunk-ZA2S7H34.mjs} +3 -3
- package/dist/cli/index.mjs +755 -414
- package/dist/cli/init-docs/content/workflow-add-block.md +48 -0
- package/dist/cli/init-docs/content/workflow-custom-block.md +10 -0
- package/dist/client/{accordion-4K7VGZ3I.mjs → accordion-BUDH2G3S.mjs} +2 -2
- package/dist/client/{bookingForm-3QXA3CIS.mjs → bookingForm-NQMCELVB.mjs} +90 -15
- package/dist/client/bookings.mjs +259 -32
- package/dist/client/{carousel-BEJKNGQ7.mjs → carousel-ONCEW6IJ.mjs} +3 -3
- package/dist/client/{cart-44BBM6XG.mjs → cart-V2TCK2GI.mjs} +7 -7
- package/dist/client/{checkout-THMHEYKF.mjs → checkout-ZI7SWNCS.mjs} +7 -7
- package/dist/client/{chunk-PEDNDLPB.mjs → chunk-AUMRQ242.mjs} +52 -5
- package/dist/client/{chunk-EJBHK74Y.mjs → chunk-B5UC2D6X.mjs} +7 -6
- package/dist/client/{chunk-DQIRKNZE.mjs → chunk-ERQDHUS2.mjs} +1 -1
- package/dist/client/{chunk-3H5CLFKT.mjs → chunk-GH6IIOOE.mjs} +39 -10
- package/dist/client/{chunk-ZIAF2DA4.mjs → chunk-HQWIJLYN.mjs} +1 -1
- package/dist/client/{chunk-4COPESPO.mjs → chunk-JXY6NHG6.mjs} +6 -6
- package/dist/client/{chunk-JV7ZNAOU.mjs → chunk-KXYEKEV6.mjs} +155 -17
- package/dist/client/{chunk-HIHOQGIP.mjs → chunk-LJCX6V7Q.mjs} +9 -9
- package/dist/client/{chunk-5AJIMWKS.mjs → chunk-N2WJPTF7.mjs} +3 -3
- package/dist/client/{chunk-KNTLBQ3N.mjs → chunk-QQNVQ62W.mjs} +1 -1
- package/dist/client/{chunk-B4H6QMPY.mjs → chunk-R3CZQLXF.mjs} +73 -8
- package/dist/client/{chunk-WHZQDPBZ.mjs → chunk-TNGL2WJF.mjs} +1 -0
- package/dist/client/{chunk-SLY6UDAS.mjs → chunk-ZJDBOLX7.mjs} +3 -3
- package/dist/client/client.mjs +548 -68
- package/dist/client/{courseRegistration-URX7RCCK.mjs → courseRegistration-JPWAQ6KM.mjs} +112 -12
- package/dist/client/{eventCalendar-GTENOQCE.mjs → eventCalendar-QDOCHBBV.mjs} +10 -10
- package/dist/client/{eventCombined-EZVB72MF.mjs → eventCombined-ZS2CXSIE.mjs} +10 -10
- package/dist/client/{eventDetails-CH4BJR5Z.mjs → eventDetails-5LOBMPLN.mjs} +10 -10
- package/dist/client/{eventListing-4BVOI5HS.mjs → eventListing-SBGY4I3L.mjs} +10 -10
- package/dist/client/{eventRegistration-37LPIKIE.mjs → eventRegistration-XGPIU3Z2.mjs} +10 -10
- package/dist/client/{form-FX3Y54YK.mjs → form-R7D4LZWW.mjs} +4 -4
- package/dist/client/{headerSection-UOZZGVYL.mjs → headerSection-RRLYUCGC.mjs} +3 -3
- package/dist/client/hooks.mjs +29 -9
- package/dist/client/{locationMap-VSIPKV35.mjs → locationMap-35ZJMRBZ.mjs} +3 -3
- package/dist/client/{newsletterForm-6FRJKNAF.mjs → newsletterForm-MJ2VCFUT.mjs} +4 -4
- package/dist/client/{productDetail-6AHMLXCO.mjs → productDetail-2O7YQNBX.mjs} +7 -7
- package/dist/client/{productList-M2CYIZVH.mjs → productList-FDP5BH7W.mjs} +7 -7
- package/dist/client/rendering/client.mjs +526 -64
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +547 -67
- package/dist/client/{shop-AUOT6GEX.mjs → shop-BGYJ3LDT.mjs} +7 -7
- package/dist/client/spam-protection.mjs +10 -10
- package/dist/preview-next/client/runtime.mjs +5 -5
- package/dist/{sdk-runtime-6GPJNLU6.mjs → sdk-runtime-B3TFXRXZ.mjs} +6 -6
- package/dist/server/components.mjs +179 -18
- package/dist/server/config-validation.mjs +30 -9
- package/dist/server/config.mjs +30 -9
- package/dist/server/data.mjs +29 -9
- package/dist/server/index.mjs +1 -1
- package/dist/server/navigation.mjs +2 -2
- package/dist/server/next.mjs +180 -19
- package/dist/server/page-converter.mjs +24 -7
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +179 -18
- package/dist/server/rendering.mjs +179 -18
- package/dist/server/routing.mjs +43 -19
- package/dist/server/server.mjs +30 -10
- package/package.json +1 -1
- package/dist/SdkPreviewModeRuntime-2UCIMKUB.mjs +0 -8
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { LeafletStaticMap } from './chunk-
|
|
3
|
-
import { resolveCoursePricingState, useWaitlistClaim, MagicLinkForm, formatCoursePriceAmount, formatCoursePriceDisplay } from './chunk-
|
|
2
|
+
import { LeafletStaticMap } from './chunk-HQWIJLYN.mjs';
|
|
3
|
+
import { resolveCoursePricingState, useWaitlistClaim, MagicLinkForm, formatCoursePriceAmount, formatCoursePriceDisplay } from './chunk-AUMRQ242.mjs';
|
|
4
4
|
import { CreditCard, Ticket, Star, Sparkles } from './chunk-6N7YRNYU.mjs';
|
|
5
|
-
import { usePolling, buildBookingPaymentSelectionViewModel } from './chunk-
|
|
6
|
-
import { SpinnerNode } from './chunk-
|
|
7
|
-
import { createBodyThemePortalRoot, TabBarFragment, useDiscountCodeUi, logoutPortal, consumeSearchParam, StepIndicator, DiscountCodeDisclosure, TerminalPanel, StateIcon, formatPrice, CrossIcon, ClockIcon, LoggedInAsUser, CheckIcon } from './chunk-
|
|
5
|
+
import { usePolling, buildBookingPaymentSelectionViewModel } from './chunk-N2WJPTF7.mjs';
|
|
6
|
+
import { SpinnerNode } from './chunk-QQNVQ62W.mjs';
|
|
7
|
+
import { createBodyThemePortalRoot, TabBarFragment, useDiscountCodeUi, logoutPortal, consumeSearchParam, StepIndicator, DiscountCodeDisclosure, TerminalPanel, StateIcon, formatPrice, CrossIcon, ClockIcon, LoggedInAsUser, CheckIcon } from './chunk-ZJDBOLX7.mjs';
|
|
8
8
|
import { getFieldValidationControlProps, FieldValidationMessage } from './chunk-3DCJ45Z2.mjs';
|
|
9
9
|
import { ModalShell } from './chunk-WBQG7VJA.mjs';
|
|
10
|
-
import { isSpamProtectionEnabled, AltchaWidget, getChallengeUrl } from './chunk-
|
|
11
|
-
import { useBlockApi, FeedbackMessage } from './chunk-
|
|
12
|
-
import { buildEventRuntimeFilters, buildEventCalendarListingRender, groupEventsByDate, getOrderedDayNames, formatDateKey, getEventRuntimeFiltersKey, themeButtonClassName, normalizeCsvIds, normalizeOptionalId, normalizeEventBlockKind, normalizeCsvString, EventCompactRow, EmptyState, getContainerClass, getCardOrientation, isToday, MAX_EVENTS_PER_DAY, formatTime, WIZARD_STEPS, getWizardStepsForContext, getStepNumber, formatEventPriceDisplay, resolveRuntimeEventPricing, formatEventPrice, formatEventDateParts, resolveEventLinkProps, DateTimeTile, assertNever, EventCard, buildCalendarViewport, shiftCalendarAnchorDate, addMonths, getThreeMonthRange, buildTimetableModel, formatDate, MONTH_NAMES, getEventAvailability, formatEventTeacherLine, toRegistrationEvents, isEventContentType, findPreSelectedEvent, resolveRegistrationTarget, findEventByOccurrenceId, resolveEventRequiresPayment, resolveDiscountContext } from './chunk-
|
|
13
|
-
import { publicEventPricingType, getBookingLocalDateKey, toScheduledBookingDateTime, toBookingTimeZone, publicEventPricingCurrency, formatBookingDateTime, publicEventPricingMode, publicEventScalarPrice, publicEventTicketTypes, formatCurrencyAmount, formatBookingDate, formatBookingTime } from './chunk-
|
|
10
|
+
import { isSpamProtectionEnabled, AltchaWidget, getChallengeUrl } from './chunk-LJCX6V7Q.mjs';
|
|
11
|
+
import { useBlockApi, FeedbackMessage } from './chunk-TNGL2WJF.mjs';
|
|
12
|
+
import { buildEventRuntimeFilters, buildEventCalendarListingRender, groupEventsByDate, getOrderedDayNames, formatDateKey, getEventRuntimeFiltersKey, themeButtonClassName, normalizeCsvIds, normalizeOptionalId, normalizeEventBlockKind, normalizeCsvString, EventCompactRow, EmptyState, getContainerClass, getCardOrientation, isToday, MAX_EVENTS_PER_DAY, formatTime, WIZARD_STEPS, getWizardStepsForContext, getStepNumber, formatEventPriceDisplay, resolveRuntimeEventPricing, formatEventPrice, formatEventDateParts, resolveEventLinkProps, DateTimeTile, assertNever, EventCard, buildCalendarViewport, shiftCalendarAnchorDate, addMonths, getThreeMonthRange, buildTimetableModel, formatDate, MONTH_NAMES, getEventAvailability, formatEventTeacherLine, toRegistrationEvents, isEventContentType, findPreSelectedEvent, resolveRegistrationTarget, findEventByOccurrenceId, resolveEventRequiresPayment, resolveDiscountContext } from './chunk-R3CZQLXF.mjs';
|
|
13
|
+
import { publicEventPricingType, getBookingLocalDateKey, toScheduledBookingDateTime, toBookingTimeZone, publicEventPricingCurrency, formatBookingDateTime, publicEventPricingMode, publicEventScalarPrice, publicEventTicketTypes, formatCurrencyAmount, formatBookingDate, formatBookingTime } from './chunk-GH6IIOOE.mjs';
|
|
14
14
|
import React9, { createContext, useId, useMemo, useReducer, useState, useRef, useEffect, useCallback, useContext } from 'react';
|
|
15
15
|
import { createPortal } from 'react-dom';
|
|
16
16
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -525,6 +525,7 @@ function useEligibility(params) {
|
|
|
525
525
|
occurrenceId: params.occurrenceId,
|
|
526
526
|
attendanceMode: params.attendanceMode ?? void 0,
|
|
527
527
|
ticketTypeId: params.ticketTypeId ?? void 0,
|
|
528
|
+
selectedSlidingAmount: params.selectedSlidingAmount ?? void 0,
|
|
528
529
|
email: params.email.trim().toLowerCase(),
|
|
529
530
|
ticketsCount: params.ticketsCount
|
|
530
531
|
});
|
|
@@ -545,7 +546,7 @@ function useEligibility(params) {
|
|
|
545
546
|
return () => {
|
|
546
547
|
cancelled = true;
|
|
547
548
|
};
|
|
548
|
-
}, [api, params.enabled, params.occurrenceId, params.attendanceMode, params.ticketTypeId, params.email, params.ticketsCount]);
|
|
549
|
+
}, [api, params.enabled, params.occurrenceId, params.attendanceMode, params.ticketTypeId, params.selectedSlidingAmount, params.email, params.ticketsCount]);
|
|
549
550
|
return {
|
|
550
551
|
state,
|
|
551
552
|
eligibility: state.eligibility,
|
|
@@ -868,6 +869,41 @@ function TicketCounterLimit(props) {
|
|
|
868
869
|
] }) : null
|
|
869
870
|
] });
|
|
870
871
|
}
|
|
872
|
+
function formatCurrencyInputAmount(amount) {
|
|
873
|
+
const major = amount / 100;
|
|
874
|
+
return Number.isInteger(major) ? String(major) : major.toFixed(2);
|
|
875
|
+
}
|
|
876
|
+
function SlidingScaleAmountField(props) {
|
|
877
|
+
const minLabel = formatPrice(props.slidingScale.minAmount, props.currency);
|
|
878
|
+
const maxLabel = formatPrice(props.slidingScale.maxAmount, props.currency);
|
|
879
|
+
const suggestedLabel = props.slidingScale.suggestedAmount !== null ? formatPrice(props.slidingScale.suggestedAmount, props.currency) : null;
|
|
880
|
+
return /* @__PURE__ */ jsxs("div", { className: "er-field", children: [
|
|
881
|
+
/* @__PURE__ */ jsx("label", { htmlFor: "er-sliding-amount", className: "er-label", children: "Amount" }),
|
|
882
|
+
/* @__PURE__ */ jsx(
|
|
883
|
+
"input",
|
|
884
|
+
{
|
|
885
|
+
id: "er-sliding-amount",
|
|
886
|
+
type: "number",
|
|
887
|
+
min: formatCurrencyInputAmount(props.slidingScale.minAmount),
|
|
888
|
+
max: formatCurrencyInputAmount(props.slidingScale.maxAmount),
|
|
889
|
+
step: "0.01",
|
|
890
|
+
inputMode: "decimal",
|
|
891
|
+
className: "er-input",
|
|
892
|
+
value: props.value,
|
|
893
|
+
onChange: (event) => props.onChange?.(event.target.value)
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
/* @__PURE__ */ jsxs("p", { className: "er-text er-text--muted", children: [
|
|
897
|
+
"Choose between ",
|
|
898
|
+
minLabel,
|
|
899
|
+
" and ",
|
|
900
|
+
maxLabel,
|
|
901
|
+
suggestedLabel ? `; suggested ${suggestedLabel}` : "",
|
|
902
|
+
"."
|
|
903
|
+
] }),
|
|
904
|
+
props.message ? /* @__PURE__ */ jsx("p", { className: "er-text er-text--muted", children: props.message }) : null
|
|
905
|
+
] });
|
|
906
|
+
}
|
|
871
907
|
function getTicketTypeCounterAvailabilityLabel(input) {
|
|
872
908
|
if (input.selectedRemainingCapacity !== null) {
|
|
873
909
|
return `${input.selectedRemainingCapacity} remaining for this ticket type`;
|
|
@@ -931,6 +967,10 @@ var TicketSelectionStep = ({
|
|
|
931
967
|
maxTickets,
|
|
932
968
|
selectedTicketTypeId = null,
|
|
933
969
|
onTicketTypeChange,
|
|
970
|
+
slidingScale = null,
|
|
971
|
+
selectedSlidingAmountInput = "",
|
|
972
|
+
slidingScaleSelectionMessage = null,
|
|
973
|
+
onSlidingAmountChange,
|
|
934
974
|
onTicketsChange
|
|
935
975
|
}) => {
|
|
936
976
|
const deliveryMode = event?.deliveryMode ?? "in_person";
|
|
@@ -1046,6 +1086,16 @@ var TicketSelectionStep = ({
|
|
|
1046
1086
|
] })
|
|
1047
1087
|
] })
|
|
1048
1088
|
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1089
|
+
slidingScale ? /* @__PURE__ */ jsx(
|
|
1090
|
+
SlidingScaleAmountField,
|
|
1091
|
+
{
|
|
1092
|
+
slidingScale,
|
|
1093
|
+
currency: eventPricingCurrency ?? DEFAULT_EVENT_CURRENCY,
|
|
1094
|
+
value: selectedSlidingAmountInput,
|
|
1095
|
+
message: slidingScaleSelectionMessage,
|
|
1096
|
+
onChange: onSlidingAmountChange
|
|
1097
|
+
}
|
|
1098
|
+
) : null,
|
|
1049
1099
|
/* @__PURE__ */ jsx("h3", { className: "er-title", children: canJoinWaitlist ? "How many waitlist spots?" : "How many tickets?" }),
|
|
1050
1100
|
/* @__PURE__ */ jsxs("div", { className: "er-ticket-counter-group", children: [
|
|
1051
1101
|
/* @__PURE__ */ jsx(
|
|
@@ -1898,6 +1948,10 @@ function EventRegistrationWizardContent(props) {
|
|
|
1898
1948
|
maxTickets: wizard.maxTicketsNum,
|
|
1899
1949
|
selectedTicketTypeId: wizard.selectedTicketTypeId,
|
|
1900
1950
|
onTicketTypeChange: wizard.setSelectedTicketTypeId,
|
|
1951
|
+
slidingScale: wizard.selectedEventSlidingScale,
|
|
1952
|
+
selectedSlidingAmountInput: wizard.selectedSlidingAmountInput,
|
|
1953
|
+
slidingScaleSelectionMessage: wizard.slidingScaleSelectionMessage,
|
|
1954
|
+
onSlidingAmountChange: wizard.setSelectedSlidingAmountInput,
|
|
1901
1955
|
onTicketsChange: wizard.setTicketsCount
|
|
1902
1956
|
}
|
|
1903
1957
|
)
|
|
@@ -2091,7 +2145,7 @@ function EventRegistrationSummaryBar(props) {
|
|
|
2091
2145
|
const summaryTimeZone = wizard.occurrenceContext?.timeZone ?? summaryEvent?.timeZone ?? null;
|
|
2092
2146
|
const occurrenceOverrideTitle = wizard.occurrenceContext?.overrides?.title;
|
|
2093
2147
|
const summaryTitle = occurrenceOverrideTitle ?? summaryEvent?.title ?? "";
|
|
2094
|
-
const summaryPrice = wizard.selectedTicketType?.priceAmount ?? wizard.eligibility?.price ?? (summaryEvent ? publicEventScalarPrice(summaryEvent.pricing) : null) ?? 0;
|
|
2148
|
+
const summaryPrice = wizard.selectedTicketType?.priceAmount ?? wizard.eligibility?.price ?? (wizard.selectedEventSlidingScale ? wizard.selectedSlidingAmount : null) ?? (summaryEvent ? publicEventScalarPrice(summaryEvent.pricing) : null) ?? 0;
|
|
2095
2149
|
const summaryCurrency = (summaryEvent ? publicEventPricingCurrency(summaryEvent.pricing) : null) ?? DEFAULT_EVENT_CURRENCY;
|
|
2096
2150
|
const teamMemberNames = (summaryEvent?.teamMembers ?? []).map((teamMember) => teamMember.name).filter(Boolean);
|
|
2097
2151
|
const subtotalCents = Math.max(0, summaryPrice * wizard.ticketsCount);
|
|
@@ -2347,6 +2401,7 @@ function useEventRegistrationSubmit(options) {
|
|
|
2347
2401
|
occurrenceId: submitOccurrenceId,
|
|
2348
2402
|
attendanceMode: options.selectedAttendanceMode ?? void 0,
|
|
2349
2403
|
ticketTypeId: options.selectedTicketTypeId ?? void 0,
|
|
2404
|
+
selectedSlidingAmount: options.selectedSlidingAmount ?? void 0,
|
|
2350
2405
|
email: options.formData.email.trim().toLowerCase(),
|
|
2351
2406
|
name: options.formData.name.trim(),
|
|
2352
2407
|
ticketsCount: options.ticketsCount,
|
|
@@ -2448,6 +2503,35 @@ function useEventRegistrationSubmit(options) {
|
|
|
2448
2503
|
}
|
|
2449
2504
|
|
|
2450
2505
|
// ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.ts
|
|
2506
|
+
function parseCurrencyInputToCents(value) {
|
|
2507
|
+
const trimmed = value.trim();
|
|
2508
|
+
if (!trimmed) return null;
|
|
2509
|
+
const amount = Number(trimmed);
|
|
2510
|
+
if (!Number.isFinite(amount) || amount < 0) return null;
|
|
2511
|
+
return Math.round(amount * 100);
|
|
2512
|
+
}
|
|
2513
|
+
function formatCentsAsCurrencyInput(amount) {
|
|
2514
|
+
const major = amount / 100;
|
|
2515
|
+
return Number.isInteger(major) ? String(major) : major.toFixed(2);
|
|
2516
|
+
}
|
|
2517
|
+
function getSlidingScaleForEvent(event) {
|
|
2518
|
+
const pricing = event ? resolveRuntimeEventPricing(event) : null;
|
|
2519
|
+
return pricing?.kind === "sliding_scale" ? {
|
|
2520
|
+
minAmount: pricing.minAmount,
|
|
2521
|
+
maxAmount: pricing.maxAmount,
|
|
2522
|
+
suggestedAmount: pricing.suggestedAmount
|
|
2523
|
+
} : null;
|
|
2524
|
+
}
|
|
2525
|
+
function getSlidingScaleSelectionMessage(input) {
|
|
2526
|
+
if (!input.slidingScale) return null;
|
|
2527
|
+
if (input.selectedAmount === null) {
|
|
2528
|
+
return "Choose an amount to continue.";
|
|
2529
|
+
}
|
|
2530
|
+
if (input.selectedAmount < input.slidingScale.minAmount || input.selectedAmount > input.slidingScale.maxAmount) {
|
|
2531
|
+
return "Choose an amount within the sliding scale.";
|
|
2532
|
+
}
|
|
2533
|
+
return null;
|
|
2534
|
+
}
|
|
2451
2535
|
function useEventRegistrationWizard(options) {
|
|
2452
2536
|
const api = useBlockApi();
|
|
2453
2537
|
const registrationEvents = useMemo(
|
|
@@ -2492,6 +2576,10 @@ function useEventRegistrationWizard(options) {
|
|
|
2492
2576
|
preSelectedEvent?.deliveryMode === "online" ? "online" : preSelectedEvent?.deliveryMode === "in_person" ? "in_person" : null
|
|
2493
2577
|
);
|
|
2494
2578
|
const [selectedTicketTypeId, setSelectedTicketTypeId] = useState(null);
|
|
2579
|
+
const [selectedSlidingAmountInput, setSelectedSlidingAmountInput] = useState(() => {
|
|
2580
|
+
const slidingScale = getSlidingScaleForEvent(preSelectedEvent ?? null);
|
|
2581
|
+
return slidingScale?.suggestedAmount !== null && slidingScale?.suggestedAmount !== void 0 ? formatCentsAsCurrencyInput(slidingScale.suggestedAmount) : "";
|
|
2582
|
+
});
|
|
2495
2583
|
const [registrationResult, setRegistrationResult] = useState(null);
|
|
2496
2584
|
const [errorMessage, setErrorMessage] = useState("");
|
|
2497
2585
|
const [altchaSolution, setAltchaSolution] = useState(null);
|
|
@@ -2528,6 +2616,7 @@ function useEventRegistrationWizard(options) {
|
|
|
2528
2616
|
occurrenceId,
|
|
2529
2617
|
attendanceMode: selectedAttendanceMode,
|
|
2530
2618
|
ticketTypeId: selectedTicketTypeId,
|
|
2619
|
+
selectedSlidingAmount: parseCurrencyInputToCents(selectedSlidingAmountInput),
|
|
2531
2620
|
email: formData.email,
|
|
2532
2621
|
ticketsCount
|
|
2533
2622
|
});
|
|
@@ -2663,6 +2752,18 @@ function useEventRegistrationWizard(options) {
|
|
|
2663
2752
|
}),
|
|
2664
2753
|
[selectedAttendanceMode, selectedEvent, preSelectedEvent, eligibility, selectedTicketTypeId]
|
|
2665
2754
|
);
|
|
2755
|
+
const selectedSlidingAmount = useMemo(
|
|
2756
|
+
() => parseCurrencyInputToCents(selectedSlidingAmountInput),
|
|
2757
|
+
[selectedSlidingAmountInput]
|
|
2758
|
+
);
|
|
2759
|
+
const selectedEventSlidingScale = useMemo(
|
|
2760
|
+
() => getSlidingScaleForEvent(selectedEvent ?? preSelectedEvent),
|
|
2761
|
+
[selectedEvent, preSelectedEvent]
|
|
2762
|
+
);
|
|
2763
|
+
const slidingScaleSelectionMessage = getSlidingScaleSelectionMessage({
|
|
2764
|
+
slidingScale: selectedEventSlidingScale,
|
|
2765
|
+
selectedAmount: selectedSlidingAmount
|
|
2766
|
+
});
|
|
2666
2767
|
const ticketTypeSelectionRequired = useMemo(() => {
|
|
2667
2768
|
const event = selectedEvent ?? preSelectedEvent;
|
|
2668
2769
|
if (!event || publicEventPricingMode(resolveRuntimeEventPricing(event)) !== "ticket_types") {
|
|
@@ -2731,12 +2832,24 @@ function useEventRegistrationWizard(options) {
|
|
|
2731
2832
|
setGuestSectionShake(false);
|
|
2732
2833
|
};
|
|
2733
2834
|
const eventRequiresPayment = useMemo(
|
|
2734
|
-
() =>
|
|
2835
|
+
() => {
|
|
2836
|
+
if (selectedEventSlidingScale) {
|
|
2837
|
+
return (selectedSlidingAmount ?? 0) > 0;
|
|
2838
|
+
}
|
|
2839
|
+
return resolveEventRequiresPayment({
|
|
2840
|
+
eligibility,
|
|
2841
|
+
selectedTicketType,
|
|
2842
|
+
event: selectedEvent ?? preSelectedEvent
|
|
2843
|
+
});
|
|
2844
|
+
},
|
|
2845
|
+
[
|
|
2735
2846
|
eligibility,
|
|
2736
2847
|
selectedTicketType,
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2848
|
+
selectedEvent,
|
|
2849
|
+
preSelectedEvent,
|
|
2850
|
+
selectedEventSlidingScale,
|
|
2851
|
+
selectedSlidingAmount
|
|
2852
|
+
]
|
|
2740
2853
|
);
|
|
2741
2854
|
const handleDetailsComplete = async () => {
|
|
2742
2855
|
if (ticketTypeSelectionRequired && !hasValidSelectedTicketType) {
|
|
@@ -2745,6 +2858,11 @@ function useEventRegistrationWizard(options) {
|
|
|
2745
2858
|
setStep("error");
|
|
2746
2859
|
return { ok: false, reason: "blocked", message };
|
|
2747
2860
|
}
|
|
2861
|
+
if (slidingScaleSelectionMessage) {
|
|
2862
|
+
setErrorMessage(slidingScaleSelectionMessage);
|
|
2863
|
+
setStep("error");
|
|
2864
|
+
return { ok: false, reason: "blocked", message: slidingScaleSelectionMessage };
|
|
2865
|
+
}
|
|
2748
2866
|
if (!validateForm()) {
|
|
2749
2867
|
setGuestSectionShake(true);
|
|
2750
2868
|
return {
|
|
@@ -2829,9 +2947,18 @@ function useEventRegistrationWizard(options) {
|
|
|
2829
2947
|
const discountSubtotalCents = useMemo(() => {
|
|
2830
2948
|
if (discountContext?.type !== "event") return void 0;
|
|
2831
2949
|
const event = selectedEvent ?? preSelectedEvent;
|
|
2832
|
-
const eventPriceCents = selectedTicketType?.priceAmount ?? eligibility?.price ?? (event ? publicEventScalarPrice(resolveRuntimeEventPricing(event)) : null) ?? 0;
|
|
2950
|
+
const eventPriceCents = selectedTicketType?.priceAmount ?? eligibility?.price ?? (selectedEventSlidingScale ? selectedSlidingAmount : null) ?? (event ? publicEventScalarPrice(resolveRuntimeEventPricing(event)) : null) ?? 0;
|
|
2833
2951
|
return Math.max(0, eventPriceCents * ticketsCount);
|
|
2834
|
-
}, [
|
|
2952
|
+
}, [
|
|
2953
|
+
discountContext,
|
|
2954
|
+
selectedTicketType,
|
|
2955
|
+
eligibility,
|
|
2956
|
+
selectedEvent,
|
|
2957
|
+
preSelectedEvent,
|
|
2958
|
+
selectedEventSlidingScale,
|
|
2959
|
+
selectedSlidingAmount,
|
|
2960
|
+
ticketsCount
|
|
2961
|
+
]);
|
|
2835
2962
|
const discountUi = useDiscountCodeUi({ api, discountContext, subtotalCents: discountSubtotalCents });
|
|
2836
2963
|
const selectionMethod = paymentSelection.method;
|
|
2837
2964
|
const shouldShowDiscountToggle = discountContext !== null && discountUi.manualCodeEntryAllowed && (selectionMethod === "stripe" || selectionMethod === "pass_bundle" || selectionMethod === "membership_bundle");
|
|
@@ -2840,6 +2967,7 @@ function useEventRegistrationWizard(options) {
|
|
|
2840
2967
|
registrationTarget,
|
|
2841
2968
|
selectedAttendanceMode,
|
|
2842
2969
|
selectedTicketTypeId,
|
|
2970
|
+
selectedSlidingAmount,
|
|
2843
2971
|
ticketsCount,
|
|
2844
2972
|
formData,
|
|
2845
2973
|
altchaSolution,
|
|
@@ -2854,6 +2982,10 @@ function useEventRegistrationWizard(options) {
|
|
|
2854
2982
|
});
|
|
2855
2983
|
const handleEventSelect = (event) => {
|
|
2856
2984
|
setSelectedEvent(event);
|
|
2985
|
+
const slidingScale = getSlidingScaleForEvent(event);
|
|
2986
|
+
setSelectedSlidingAmountInput(
|
|
2987
|
+
slidingScale?.suggestedAmount !== null && slidingScale?.suggestedAmount !== void 0 ? formatCentsAsCurrencyInput(slidingScale.suggestedAmount) : ""
|
|
2988
|
+
);
|
|
2857
2989
|
setSelectedAttendanceMode(
|
|
2858
2990
|
(event.deliveryMode ?? "in_person") === "hybrid" ? null : (event.deliveryMode ?? "in_person") === "online" ? "online" : "in_person"
|
|
2859
2991
|
);
|
|
@@ -2863,6 +2995,7 @@ function useEventRegistrationWizard(options) {
|
|
|
2863
2995
|
const handleRetry = () => {
|
|
2864
2996
|
dispatchFlow({ type: "reset", hasPreSelectedContext });
|
|
2865
2997
|
setSelectedTicketTypeId(null);
|
|
2998
|
+
setSelectedSlidingAmountInput("");
|
|
2866
2999
|
setSelectedAttendanceMode(
|
|
2867
3000
|
preSelectedEvent?.deliveryMode === "online" ? "online" : preSelectedEvent?.deliveryMode === "in_person" ? "in_person" : null
|
|
2868
3001
|
);
|
|
@@ -2899,6 +3032,11 @@ function useEventRegistrationWizard(options) {
|
|
|
2899
3032
|
setSelectedAttendanceMode,
|
|
2900
3033
|
selectedTicketTypeId,
|
|
2901
3034
|
setSelectedTicketTypeId,
|
|
3035
|
+
selectedSlidingAmountInput,
|
|
3036
|
+
setSelectedSlidingAmountInput,
|
|
3037
|
+
selectedSlidingAmount,
|
|
3038
|
+
selectedEventSlidingScale,
|
|
3039
|
+
slidingScaleSelectionMessage,
|
|
2902
3040
|
selectedTicketType,
|
|
2903
3041
|
visibleTicketTypes,
|
|
2904
3042
|
ticketTypeSelectionRequired,
|
|
@@ -14,22 +14,22 @@ function AltchaWidget({
|
|
|
14
14
|
if (typeof window === "undefined") return;
|
|
15
15
|
let widget = null;
|
|
16
16
|
import('./altcha-LIGLPZS5.mjs').then(() => {
|
|
17
|
-
if (
|
|
17
|
+
if (containerRef.current === null) return;
|
|
18
18
|
widget = document.createElement("altcha-widget");
|
|
19
19
|
widget.setAttribute("challengeurl", challengeUrl);
|
|
20
|
-
if (auto) {
|
|
20
|
+
if (auto === true) {
|
|
21
21
|
widget.setAttribute("auto", "onload");
|
|
22
22
|
}
|
|
23
|
-
if (hidelogo) {
|
|
23
|
+
if (hidelogo === true) {
|
|
24
24
|
widget.setAttribute("hidelogo", "true");
|
|
25
25
|
}
|
|
26
26
|
widget.setAttribute("hidefooter", "true");
|
|
27
|
-
if (className) {
|
|
27
|
+
if (className !== void 0 && className.length > 0) {
|
|
28
28
|
widget.className = className;
|
|
29
29
|
}
|
|
30
30
|
widget.addEventListener("statechange", ((event) => {
|
|
31
31
|
const { state, payload } = event.detail;
|
|
32
|
-
if (state === "verified" && payload) {
|
|
32
|
+
if (state === "verified" && payload !== void 0 && payload.length > 0) {
|
|
33
33
|
onSolutionChange?.(payload);
|
|
34
34
|
} else if (state === "error" || state === "expired") {
|
|
35
35
|
onSolutionChange?.(null);
|
|
@@ -40,7 +40,7 @@ function AltchaWidget({
|
|
|
40
40
|
console.error("Failed to load ALTCHA widget:", err);
|
|
41
41
|
});
|
|
42
42
|
return () => {
|
|
43
|
-
if (widget && containerRef.current) {
|
|
43
|
+
if (widget !== null && containerRef.current !== null) {
|
|
44
44
|
containerRef.current.removeChild(widget);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -59,15 +59,15 @@ new TextEncoder();
|
|
|
59
59
|
// ../altcha/src/index.ts
|
|
60
60
|
function getCmsApiUrl() {
|
|
61
61
|
const env = process.env.RIVERBANK_ENV;
|
|
62
|
-
if (env) {
|
|
62
|
+
if (env !== void 0 && env.length > 0) {
|
|
63
63
|
const envKey = `RIVERBANK_${env.toUpperCase()}_DASHBOARD_URL`;
|
|
64
64
|
const dashboardUrl2 = process.env[envKey];
|
|
65
|
-
if (dashboardUrl2) {
|
|
65
|
+
if (dashboardUrl2 !== void 0 && dashboardUrl2.length > 0) {
|
|
66
66
|
return `${dashboardUrl2.replace(/\/$/, "")}/api`;
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
const dashboardUrl = process.env.NEXT_PUBLIC_DASHBOARD_URL;
|
|
70
|
-
if (dashboardUrl) {
|
|
70
|
+
if (dashboardUrl !== void 0 && dashboardUrl.length > 0) {
|
|
71
71
|
return `${dashboardUrl.replace(/\/$/, "")}/api`;
|
|
72
72
|
}
|
|
73
73
|
throw new Error("Dashboard URL not configured. Set NEXT_PUBLIC_DASHBOARD_URL");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { formatPrice } from './chunk-
|
|
3
|
-
import { assertNever } from './chunk-
|
|
4
|
-
import { resolveFlexibleBalanceInitialPaymentCents, resolveFlexibleBalanceDueAt, getBookingInstalmentDepositRefundability, splitAmountWithRemainderInFirst, addIntervalPreservingMonthAnchor, clampConfiguredAmount, getBookingInstalmentPlanIntervalCount, omitZeroAmountFutureRows } from './chunk-
|
|
2
|
+
import { formatPrice } from './chunk-ZJDBOLX7.mjs';
|
|
3
|
+
import { assertNever } from './chunk-R3CZQLXF.mjs';
|
|
4
|
+
import { resolveFlexibleBalanceInitialPaymentCents, resolveFlexibleBalanceDueAt, getBookingInstalmentDepositRefundability, splitAmountWithRemainderInFirst, addIntervalPreservingMonthAnchor, clampConfiguredAmount, getBookingInstalmentPlanIntervalCount, omitZeroAmountFutureRows } from './chunk-GH6IIOOE.mjs';
|
|
5
5
|
import { useReducer, useRef, useCallback, useEffect } from 'react';
|
|
6
6
|
|
|
7
7
|
// ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { parseAspectRatioValue, parseColorTokenParts, toBookingTimeZone, formatBookingDate, toScheduledBookingDateTime, formatBookingTime, toScheduledBookingDateRange, formatBookingDateParts, formatEventPricing, ImagePresets, getBookingLocalDateKey, publicEventPricingType, formatCurrencyAmount, getCurrentResolveImageUrlContext, renderVideo, renderAudio, resolveMediaNodeResponsiveImage, MediaPlaceholder, computeMediaTransformStyle, rgbColorValue } from './chunk-
|
|
1
|
+
import { parseAspectRatioValue, parseColorTokenParts, toBookingTimeZone, formatBookingDate, toScheduledBookingDateTime, formatBookingTime, toScheduledBookingDateRange, formatBookingDateParts, formatEventPricing, ImagePresets, getBookingLocalDateKey, publicEventPricingType, formatCurrencyAmount, getCurrentResolveImageUrlContext, renderVideo, renderAudio, resolveMediaNodeResponsiveImage, MediaPlaceholder, computeMediaTransformStyle, rgbColorValue } from './chunk-GH6IIOOE.mjs';
|
|
2
2
|
import z2, { z } from 'zod';
|
|
3
3
|
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
4
4
|
|
|
@@ -323,9 +323,12 @@ var coursePricingOptionSchema = z.object({
|
|
|
323
323
|
});
|
|
324
324
|
var coursePricingSchema = z.object({
|
|
325
325
|
bookingRequirement: z.enum(["none", "required"]),
|
|
326
|
-
pricingStrategy: z.enum(["free", "single", "tiered"]),
|
|
326
|
+
pricingStrategy: z.enum(["free", "single", "tiered", "sliding_scale"]),
|
|
327
327
|
currency: z.string(),
|
|
328
328
|
singlePriceAmount: z.number().nullable(),
|
|
329
|
+
slidingMinAmount: z.number().nullable().optional(),
|
|
330
|
+
slidingMaxAmount: z.number().nullable().optional(),
|
|
331
|
+
slidingSuggestedAmount: z.number().nullable().optional(),
|
|
329
332
|
paymentTerms: blockBookingPaymentTermsSchema,
|
|
330
333
|
options: z.array(coursePricingOptionSchema)
|
|
331
334
|
});
|
|
@@ -479,6 +482,19 @@ var publicEventPricingSchema = z.discriminatedUnion("kind", [
|
|
|
479
482
|
ticketTypes: z.array(publicEventTicketTypeSchema),
|
|
480
483
|
display: publicEventTicketTypePriceDisplaySchema
|
|
481
484
|
}),
|
|
485
|
+
z.object({
|
|
486
|
+
kind: z.literal("sliding_scale"),
|
|
487
|
+
minAmount: z.number(),
|
|
488
|
+
maxAmount: z.number(),
|
|
489
|
+
suggestedAmount: z.number().nullable(),
|
|
490
|
+
currency: z.string(),
|
|
491
|
+
display: z.object({
|
|
492
|
+
kind: z.literal("range"),
|
|
493
|
+
minAmount: z.number(),
|
|
494
|
+
maxAmount: z.number(),
|
|
495
|
+
currency: z.string()
|
|
496
|
+
})
|
|
497
|
+
}),
|
|
482
498
|
z.object({
|
|
483
499
|
kind: z.literal("course"),
|
|
484
500
|
display: z.object({ kind: z.literal("course"), display: publicCoursePriceDisplaySchema })
|
|
@@ -4301,6 +4317,7 @@ var BOOKING_FORM_DATA_RESERVED_KEY_VALUES = [
|
|
|
4301
4317
|
"selectedDate",
|
|
4302
4318
|
"selectedSlot",
|
|
4303
4319
|
"discountCode",
|
|
4320
|
+
"selectedSlidingAmountInput",
|
|
4304
4321
|
"selectedCollectionOptionKind",
|
|
4305
4322
|
"selectedAppointmentPackageId"
|
|
4306
4323
|
];
|
|
@@ -4584,6 +4601,32 @@ function readOptionalString(value) {
|
|
|
4584
4601
|
function readOptionalNumber(value) {
|
|
4585
4602
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
4586
4603
|
}
|
|
4604
|
+
function getBookingServiceSlidingScale(service) {
|
|
4605
|
+
const pricing = service?.pricing;
|
|
4606
|
+
if (!pricing || pricing.pricingStrategy !== "sliding_scale" || pricing.slidingMinAmount === null || pricing.slidingMinAmount === void 0 || pricing.slidingMaxAmount === null || pricing.slidingMaxAmount === void 0) {
|
|
4607
|
+
return null;
|
|
4608
|
+
}
|
|
4609
|
+
return {
|
|
4610
|
+
minAmount: pricing.slidingMinAmount,
|
|
4611
|
+
maxAmount: pricing.slidingMaxAmount,
|
|
4612
|
+
suggestedAmount: pricing.slidingSuggestedAmount ?? null,
|
|
4613
|
+
currency: pricing.currency
|
|
4614
|
+
};
|
|
4615
|
+
}
|
|
4616
|
+
function parseBookingCurrencyInputToCents(value) {
|
|
4617
|
+
const trimmed = value?.trim() ?? "";
|
|
4618
|
+
if (!trimmed) return null;
|
|
4619
|
+
if (!/^(?:\d+(?:\.\d{0,2})?|\.\d{1,2})$/.test(trimmed)) return null;
|
|
4620
|
+
const parsed = Number(trimmed);
|
|
4621
|
+
if (!Number.isFinite(parsed) || parsed < 0) return null;
|
|
4622
|
+
return Math.round(parsed * 100);
|
|
4623
|
+
}
|
|
4624
|
+
function formatBookingCentsAsCurrencyInput(amount) {
|
|
4625
|
+
return amount % 100 === 0 ? String(amount / 100) : (amount / 100).toFixed(2);
|
|
4626
|
+
}
|
|
4627
|
+
function isBookingServiceSlidingAmountInRange(slidingScale, selectedAmount) {
|
|
4628
|
+
return selectedAmount !== null && selectedAmount >= slidingScale.minAmount && selectedAmount <= slidingScale.maxAmount;
|
|
4629
|
+
}
|
|
4587
4630
|
function readStringArray(value) {
|
|
4588
4631
|
if (!Array.isArray(value)) return void 0;
|
|
4589
4632
|
const strings = value.filter((item) => typeof item === "string");
|
|
@@ -4772,6 +4815,20 @@ function prepareBookingSubmission(input) {
|
|
|
4772
4815
|
};
|
|
4773
4816
|
}
|
|
4774
4817
|
const paymentSelectionMode = getBookingServicePaymentSelectionMode(selectedService);
|
|
4818
|
+
const slidingScale = getBookingServiceSlidingScale(selectedService);
|
|
4819
|
+
const selectedSlidingAmount = parseBookingCurrencyInputToCents(
|
|
4820
|
+
input.data.selectedSlidingAmountInput
|
|
4821
|
+
);
|
|
4822
|
+
if (slidingScale && !isBookingServiceSlidingAmountInRange(slidingScale, selectedSlidingAmount)) {
|
|
4823
|
+
return {
|
|
4824
|
+
ok: false,
|
|
4825
|
+
error: {
|
|
4826
|
+
tag: selectedSlidingAmount === null ? "sliding-amount-required" : "sliding-amount-out-of-range",
|
|
4827
|
+
serviceId,
|
|
4828
|
+
serviceTitle: selectedService.title || serviceId
|
|
4829
|
+
}
|
|
4830
|
+
};
|
|
4831
|
+
}
|
|
4775
4832
|
if (paymentSelectionMode === "choice_required" && !toSelectedCollectionOptionKind(input.data.selectedCollectionOptionKind)) {
|
|
4776
4833
|
return {
|
|
4777
4834
|
ok: false,
|
|
@@ -4799,6 +4856,7 @@ function prepareBookingSubmission(input) {
|
|
|
4799
4856
|
...common,
|
|
4800
4857
|
kind: "standard",
|
|
4801
4858
|
...discountCode ? { discountCode } : {},
|
|
4859
|
+
...slidingScale && selectedSlidingAmount !== null ? { selectedSlidingAmount } : {},
|
|
4802
4860
|
...selectedCollectionOptionKind ? { selectedCollectionOptionKind } : {},
|
|
4803
4861
|
altchaSolution: input.altchaSolution ?? null
|
|
4804
4862
|
}
|
|
@@ -4812,6 +4870,10 @@ function formatBookingSubmissionPreparationError(error) {
|
|
|
4812
4870
|
return `Service not found: ${error.serviceId}`;
|
|
4813
4871
|
case "payment-option-required":
|
|
4814
4872
|
return `Please choose how you want to pay for "${error.serviceTitle}".`;
|
|
4873
|
+
case "sliding-amount-required":
|
|
4874
|
+
return `Please choose an amount for "${error.serviceTitle}".`;
|
|
4875
|
+
case "sliding-amount-out-of-range":
|
|
4876
|
+
return `Please choose an amount within the sliding scale for "${error.serviceTitle}".`;
|
|
4815
4877
|
case "payment-option-unsupported":
|
|
4816
4878
|
return `Service "${error.serviceTitle}" has a payment option that is not supported yet.`;
|
|
4817
4879
|
case "service-missing-duration":
|
|
@@ -4908,6 +4970,7 @@ var bookingServiceSchema = z.object({
|
|
|
4908
4970
|
title: z.string(),
|
|
4909
4971
|
description: z.string().nullable().optional().transform((value) => value ?? void 0),
|
|
4910
4972
|
durationMinutes: z.number().optional(),
|
|
4973
|
+
pricing: z.custom().optional(),
|
|
4911
4974
|
priceAmount: z.number().nullable().optional(),
|
|
4912
4975
|
priceCurrency: z.string().nullable().optional(),
|
|
4913
4976
|
paymentTerms: blockBookingPaymentTermsSchema.optional(),
|
|
@@ -5309,7 +5372,7 @@ function formatCalendarTitle(viewDate, view, days, monthNames = MONTH_NAMES) {
|
|
|
5309
5372
|
if (view === "week") {
|
|
5310
5373
|
const weekStart = days[0];
|
|
5311
5374
|
const weekEnd = days[6];
|
|
5312
|
-
if (
|
|
5375
|
+
if (weekStart === void 0 || weekEnd === void 0) {
|
|
5313
5376
|
return `${monthNames[viewDate.getMonth()] ?? ""} ${viewDate.getFullYear()}`;
|
|
5314
5377
|
}
|
|
5315
5378
|
const startMonth = monthNames[weekStart.getMonth()] ?? "";
|
|
@@ -5415,7 +5478,9 @@ function getLocalDateKey(isoTimestamp, timeZone) {
|
|
|
5415
5478
|
const year = parts.find((part) => part.type === "year")?.value;
|
|
5416
5479
|
const month = parts.find((part) => part.type === "month")?.value;
|
|
5417
5480
|
const day = parts.find((part) => part.type === "day")?.value;
|
|
5418
|
-
if (
|
|
5481
|
+
if (year === void 0 || year.length === 0) return null;
|
|
5482
|
+
if (month === void 0 || month.length === 0) return null;
|
|
5483
|
+
if (day === void 0 || day.length === 0) return null;
|
|
5419
5484
|
return `${year}-${month}-${day}`;
|
|
5420
5485
|
}
|
|
5421
5486
|
var validTimeZoneCache = /* @__PURE__ */ new Map();
|
|
@@ -5672,7 +5737,7 @@ function enumerateDateKeys(startDateKey, endDateKey) {
|
|
|
5672
5737
|
}
|
|
5673
5738
|
function parseDateKey(dateKey) {
|
|
5674
5739
|
const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(dateKey);
|
|
5675
|
-
if (
|
|
5740
|
+
if (match === null) {
|
|
5676
5741
|
throw new Error(`Invalid timetable date key: ${dateKey}`);
|
|
5677
5742
|
}
|
|
5678
5743
|
const [, year, month, day] = match;
|
|
@@ -5692,7 +5757,7 @@ function groupItemsByDate(items, accessors) {
|
|
|
5692
5757
|
const dateKey = getLocalDateKey(startsAt, timeZone);
|
|
5693
5758
|
if (dateKey == null) continue;
|
|
5694
5759
|
const existing = grouped.get(dateKey);
|
|
5695
|
-
if (existing) {
|
|
5760
|
+
if (existing !== void 0) {
|
|
5696
5761
|
existing.push(item);
|
|
5697
5762
|
} else {
|
|
5698
5763
|
grouped.set(dateKey, [item]);
|
|
@@ -5789,7 +5854,7 @@ function isRecord4(value) {
|
|
|
5789
5854
|
}
|
|
5790
5855
|
function isPublicEventPricing(value) {
|
|
5791
5856
|
if (!isRecord4(value) || typeof value.kind !== "string") return false;
|
|
5792
|
-
return value.kind === "drop_in" || value.kind === "free_registration" || value.kind === "single_paid" || value.kind === "ticket_types" || value.kind === "course" || value.kind === "external";
|
|
5857
|
+
return value.kind === "drop_in" || value.kind === "free_registration" || value.kind === "single_paid" || value.kind === "sliding_scale" || value.kind === "ticket_types" || value.kind === "course" || value.kind === "external";
|
|
5793
5858
|
}
|
|
5794
5859
|
function isPublicEventTicketType(value) {
|
|
5795
5860
|
return isRecord4(value) && typeof value.id === "string";
|
|
@@ -8971,4 +9036,4 @@ function defineIslandPropsDecoder(kind) {
|
|
|
8971
9036
|
};
|
|
8972
9037
|
}
|
|
8973
9038
|
|
|
8974
|
-
export { BOOKING_FORM_DATA_RESERVED_KEYS, DateTimeTile, EMPTY_COMMERCE_CART_STATE, EmptyState, EventCard, EventCompactRow, MAX_EVENTS_PER_DAY, MONTH_NAMES, WIZARD_STEPS, addMonths, assertNever, buildCalendarViewport, buildCartDisplay, buildEventCalendarListingRender, buildEventRuntimeFilters, buildPassCartItem, buildProductCardDisplay, buildProductCartItem, buildProductDetailDisplay, buildTimetableModel, clearWorkflowFeedback, createRichTextDocFromMarkdown, defineIslandPropsDecoder, deriveBookingFormViewState, deriveCommerceCheckoutState, err, findEventByOccurrenceId, findPreSelectedEvent, formatBookingSubmissionPreparationError, formatCommercePrice, formatDate, formatDateKey, formatEventDateParts, formatEventPrice, formatEventPriceDisplay, formatEventTeacherLine, formatInterval, formatTime, getBookingRedirectStateFromLocation, getBookingSuccessMessage, getCardOrientation, getContainerClass, getEventAvailability, getEventRuntimeFiltersKey, getOrderedDayNames, getShopDisplayForItems, getStepNumber, getThreeMonthRange, getWizardStepsForContext, groupEventsByDate, isEventContentType, isRecord, isToday, logger, normalizeCsvIds, normalizeCsvString, normalizeEventBlockKind, normalizeOptionalId, ok, okWith, parseStoredCommerceCartState, prepareBookingSubmission, productItemKey, reduceCommerceCart, reportWorkflowError, reportWorkflowSuccess, resolveAppointmentCheckoutVerificationState, resolveBookingPaymentStep, resolveBookingSiteId, resolveDefaultBookingServiceId, resolveDiscountContext, resolveEventLinkProps, resolveEventRequiresPayment, resolveRegistrationTarget, resolveRuntimeEventPricing, shiftCalendarAnchorDate, themeButtonClassName, toRegistrationEvents, toSelectedCollectionOptionKind, unwrapRichTextRoot };
|
|
9039
|
+
export { BOOKING_FORM_DATA_RESERVED_KEYS, DateTimeTile, EMPTY_COMMERCE_CART_STATE, EmptyState, EventCard, EventCompactRow, MAX_EVENTS_PER_DAY, MONTH_NAMES, WIZARD_STEPS, addMonths, assertNever, buildCalendarViewport, buildCartDisplay, buildEventCalendarListingRender, buildEventRuntimeFilters, buildPassCartItem, buildProductCardDisplay, buildProductCartItem, buildProductDetailDisplay, buildTimetableModel, clearWorkflowFeedback, createRichTextDocFromMarkdown, defineIslandPropsDecoder, deriveBookingFormViewState, deriveCommerceCheckoutState, err, findEventByOccurrenceId, findPreSelectedEvent, formatBookingCentsAsCurrencyInput, formatBookingSubmissionPreparationError, formatCommercePrice, formatDate, formatDateKey, formatEventDateParts, formatEventPrice, formatEventPriceDisplay, formatEventTeacherLine, formatInterval, formatTime, getBookingRedirectStateFromLocation, getBookingServiceSlidingScale, getBookingSuccessMessage, getCardOrientation, getContainerClass, getEventAvailability, getEventRuntimeFiltersKey, getOrderedDayNames, getShopDisplayForItems, getStepNumber, getThreeMonthRange, getWizardStepsForContext, groupEventsByDate, isBookingServiceSlidingAmountInRange, isEventContentType, isRecord, isToday, logger, normalizeCsvIds, normalizeCsvString, normalizeEventBlockKind, normalizeOptionalId, ok, okWith, parseBookingCurrencyInputToCents, parseStoredCommerceCartState, prepareBookingSubmission, productItemKey, reduceCommerceCart, reportWorkflowError, reportWorkflowSuccess, resolveAppointmentCheckoutVerificationState, resolveBookingPaymentStep, resolveBookingSiteId, resolveDefaultBookingServiceId, resolveDiscountContext, resolveEventLinkProps, resolveEventRequiresPayment, resolveRegistrationTarget, resolveRuntimeEventPricing, shiftCalendarAnchorDate, themeButtonClassName, toRegistrationEvents, toSelectedCollectionOptionKind, unwrapRichTextRoot };
|
|
@@ -809,6 +809,7 @@ function createBlockApi(config) {
|
|
|
809
809
|
body: {
|
|
810
810
|
courseId: data.courseId,
|
|
811
811
|
...data.pricingOptionId ? { pricingOptionId: data.pricingOptionId } : {},
|
|
812
|
+
...data.selectedSlidingAmount !== void 0 ? { selectedSlidingAmount: data.selectedSlidingAmount } : {},
|
|
812
813
|
email: data.email,
|
|
813
814
|
name: data.name,
|
|
814
815
|
phone: data.phone,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { FeedbackMessage, discountAvailabilityHasDiscounts, getAutoAppliedDiscountPreview, discountAvailabilityAllowsManualEntry } from './chunk-
|
|
3
|
-
import { themeButtonClassName } from './chunk-
|
|
4
|
-
import { formatCurrencyAmount, clsx_default } from './chunk-
|
|
2
|
+
import { FeedbackMessage, discountAvailabilityHasDiscounts, getAutoAppliedDiscountPreview, discountAvailabilityAllowsManualEntry } from './chunk-TNGL2WJF.mjs';
|
|
3
|
+
import { themeButtonClassName } from './chunk-R3CZQLXF.mjs';
|
|
4
|
+
import { formatCurrencyAmount, clsx_default } from './chunk-GH6IIOOE.mjs';
|
|
5
5
|
import { useReducer, useEffect, useId, useRef } from 'react';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|