@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
package/dist/client/bookings.mjs
CHANGED
|
@@ -3576,6 +3576,7 @@ function createBlockApi(config) {
|
|
|
3576
3576
|
body: {
|
|
3577
3577
|
courseId: data.courseId,
|
|
3578
3578
|
...data.pricingOptionId ? { pricingOptionId: data.pricingOptionId } : {},
|
|
3579
|
+
...data.selectedSlidingAmount !== void 0 ? { selectedSlidingAmount: data.selectedSlidingAmount } : {},
|
|
3579
3580
|
email: data.email,
|
|
3580
3581
|
name: data.name,
|
|
3581
3582
|
phone: data.phone,
|
|
@@ -5287,6 +5288,7 @@ function publicEventPricingType(pricing) {
|
|
|
5287
5288
|
return "free";
|
|
5288
5289
|
case "single_paid":
|
|
5289
5290
|
case "ticket_types":
|
|
5291
|
+
case "sliding_scale":
|
|
5290
5292
|
case "course":
|
|
5291
5293
|
return isFreePublicEventPriceDisplay(pricing.display) ? "free" : "paid";
|
|
5292
5294
|
case "external":
|
|
@@ -5303,6 +5305,8 @@ function publicEventPricingMode(pricing) {
|
|
|
5303
5305
|
return "single";
|
|
5304
5306
|
case "ticket_types":
|
|
5305
5307
|
return "ticket_types";
|
|
5308
|
+
case "sliding_scale":
|
|
5309
|
+
return "sliding_scale";
|
|
5306
5310
|
case "drop_in":
|
|
5307
5311
|
case "course":
|
|
5308
5312
|
case "external":
|
|
@@ -5414,10 +5418,11 @@ function omitZeroAmountFutureRows(rows) {
|
|
|
5414
5418
|
if (rows.length <= 1) {
|
|
5415
5419
|
return rows;
|
|
5416
5420
|
}
|
|
5417
|
-
const
|
|
5418
|
-
if (
|
|
5421
|
+
const firstRow = rows[0];
|
|
5422
|
+
if (firstRow === void 0) {
|
|
5419
5423
|
return [];
|
|
5420
5424
|
}
|
|
5425
|
+
const futureRows = rows.slice(1);
|
|
5421
5426
|
return [
|
|
5422
5427
|
firstRow,
|
|
5423
5428
|
...futureRows.filter((row) => row.amountCents > 0)
|
|
@@ -5460,11 +5465,11 @@ function isValidTimeZone(timeZone) {
|
|
|
5460
5465
|
}
|
|
5461
5466
|
function getSafeTimeZone(timeZone) {
|
|
5462
5467
|
const normalized = typeof timeZone === "string" ? timeZone.trim() : "";
|
|
5463
|
-
return normalized && isValidTimeZone(normalized) ? normalized : FALLBACK_TIMEZONE;
|
|
5468
|
+
return normalized.length > 0 && isValidTimeZone(normalized) ? normalized : FALLBACK_TIMEZONE;
|
|
5464
5469
|
}
|
|
5465
5470
|
function parseStrictBookingTimeZone(timeZone) {
|
|
5466
5471
|
const normalized = timeZone.trim();
|
|
5467
|
-
if (
|
|
5472
|
+
if (normalized.length === 0 || !isValidTimeZone(normalized)) {
|
|
5468
5473
|
return null;
|
|
5469
5474
|
}
|
|
5470
5475
|
return normalized;
|
|
@@ -5551,7 +5556,7 @@ function parseScheduledBookingDateTime(input) {
|
|
|
5551
5556
|
try {
|
|
5552
5557
|
const startsAt = toUtcIsoDateTimeString(input.startsAt);
|
|
5553
5558
|
const timeZone = parseStrictBookingTimeZone(input.timeZone);
|
|
5554
|
-
if (
|
|
5559
|
+
if (timeZone === null) {
|
|
5555
5560
|
return {
|
|
5556
5561
|
ok: false,
|
|
5557
5562
|
field: "timeZone",
|
|
@@ -5598,7 +5603,7 @@ function getBookingLocalDateKey(input) {
|
|
|
5598
5603
|
}
|
|
5599
5604
|
function parseBookingLocalDate(value) {
|
|
5600
5605
|
const match = LOCAL_DATE_PATTERN.exec(value.trim());
|
|
5601
|
-
if (
|
|
5606
|
+
if (match === null || match.groups === void 0) {
|
|
5602
5607
|
throw new Error(`Invalid booking date format: "${value}" (expected YYYY-MM-DD)`);
|
|
5603
5608
|
}
|
|
5604
5609
|
const year = Number(match.groups.year);
|
|
@@ -6041,6 +6046,7 @@ var BOOKING_FORM_DATA_RESERVED_KEY_VALUES = [
|
|
|
6041
6046
|
"selectedDate",
|
|
6042
6047
|
"selectedSlot",
|
|
6043
6048
|
"discountCode",
|
|
6049
|
+
"selectedSlidingAmountInput",
|
|
6044
6050
|
"selectedCollectionOptionKind",
|
|
6045
6051
|
"selectedAppointmentPackageId"
|
|
6046
6052
|
];
|
|
@@ -6324,6 +6330,32 @@ function readOptionalString(value) {
|
|
|
6324
6330
|
function readOptionalNumber(value) {
|
|
6325
6331
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
6326
6332
|
}
|
|
6333
|
+
function getBookingServiceSlidingScale(service) {
|
|
6334
|
+
const pricing = service?.pricing;
|
|
6335
|
+
if (!pricing || pricing.pricingStrategy !== "sliding_scale" || pricing.slidingMinAmount === null || pricing.slidingMinAmount === void 0 || pricing.slidingMaxAmount === null || pricing.slidingMaxAmount === void 0) {
|
|
6336
|
+
return null;
|
|
6337
|
+
}
|
|
6338
|
+
return {
|
|
6339
|
+
minAmount: pricing.slidingMinAmount,
|
|
6340
|
+
maxAmount: pricing.slidingMaxAmount,
|
|
6341
|
+
suggestedAmount: pricing.slidingSuggestedAmount ?? null,
|
|
6342
|
+
currency: pricing.currency
|
|
6343
|
+
};
|
|
6344
|
+
}
|
|
6345
|
+
function parseBookingCurrencyInputToCents(value) {
|
|
6346
|
+
const trimmed = value?.trim() ?? "";
|
|
6347
|
+
if (!trimmed) return null;
|
|
6348
|
+
if (!/^(?:\d+(?:\.\d{0,2})?|\.\d{1,2})$/.test(trimmed)) return null;
|
|
6349
|
+
const parsed = Number(trimmed);
|
|
6350
|
+
if (!Number.isFinite(parsed) || parsed < 0) return null;
|
|
6351
|
+
return Math.round(parsed * 100);
|
|
6352
|
+
}
|
|
6353
|
+
function formatBookingCentsAsCurrencyInput(amount) {
|
|
6354
|
+
return amount % 100 === 0 ? String(amount / 100) : (amount / 100).toFixed(2);
|
|
6355
|
+
}
|
|
6356
|
+
function isBookingServiceSlidingAmountInRange(slidingScale, selectedAmount) {
|
|
6357
|
+
return selectedAmount !== null && selectedAmount >= slidingScale.minAmount && selectedAmount <= slidingScale.maxAmount;
|
|
6358
|
+
}
|
|
6327
6359
|
function readStringArray(value) {
|
|
6328
6360
|
if (!Array.isArray(value)) return void 0;
|
|
6329
6361
|
const strings = value.filter((item) => typeof item === "string");
|
|
@@ -6512,6 +6544,20 @@ function prepareBookingSubmission(input) {
|
|
|
6512
6544
|
};
|
|
6513
6545
|
}
|
|
6514
6546
|
const paymentSelectionMode = getBookingServicePaymentSelectionMode(selectedService);
|
|
6547
|
+
const slidingScale = getBookingServiceSlidingScale(selectedService);
|
|
6548
|
+
const selectedSlidingAmount = parseBookingCurrencyInputToCents(
|
|
6549
|
+
input.data.selectedSlidingAmountInput
|
|
6550
|
+
);
|
|
6551
|
+
if (slidingScale && !isBookingServiceSlidingAmountInRange(slidingScale, selectedSlidingAmount)) {
|
|
6552
|
+
return {
|
|
6553
|
+
ok: false,
|
|
6554
|
+
error: {
|
|
6555
|
+
tag: selectedSlidingAmount === null ? "sliding-amount-required" : "sliding-amount-out-of-range",
|
|
6556
|
+
serviceId,
|
|
6557
|
+
serviceTitle: selectedService.title || serviceId
|
|
6558
|
+
}
|
|
6559
|
+
};
|
|
6560
|
+
}
|
|
6515
6561
|
if (paymentSelectionMode === "choice_required" && !toSelectedCollectionOptionKind(input.data.selectedCollectionOptionKind)) {
|
|
6516
6562
|
return {
|
|
6517
6563
|
ok: false,
|
|
@@ -6539,6 +6585,7 @@ function prepareBookingSubmission(input) {
|
|
|
6539
6585
|
...common,
|
|
6540
6586
|
kind: "standard",
|
|
6541
6587
|
...discountCode ? { discountCode } : {},
|
|
6588
|
+
...slidingScale && selectedSlidingAmount !== null ? { selectedSlidingAmount } : {},
|
|
6542
6589
|
...selectedCollectionOptionKind ? { selectedCollectionOptionKind } : {},
|
|
6543
6590
|
altchaSolution: input.altchaSolution ?? null
|
|
6544
6591
|
}
|
|
@@ -6552,6 +6599,10 @@ function formatBookingSubmissionPreparationError(error) {
|
|
|
6552
6599
|
return `Service not found: ${error.serviceId}`;
|
|
6553
6600
|
case "payment-option-required":
|
|
6554
6601
|
return `Please choose how you want to pay for "${error.serviceTitle}".`;
|
|
6602
|
+
case "sliding-amount-required":
|
|
6603
|
+
return `Please choose an amount for "${error.serviceTitle}".`;
|
|
6604
|
+
case "sliding-amount-out-of-range":
|
|
6605
|
+
return `Please choose an amount within the sliding scale for "${error.serviceTitle}".`;
|
|
6555
6606
|
case "payment-option-unsupported":
|
|
6556
6607
|
return `Service "${error.serviceTitle}" has a payment option that is not supported yet.`;
|
|
6557
6608
|
case "service-missing-duration":
|
|
@@ -6675,9 +6726,12 @@ var coursePricingOptionSchema = z9.object({
|
|
|
6675
6726
|
});
|
|
6676
6727
|
var coursePricingSchema = z9.object({
|
|
6677
6728
|
bookingRequirement: z9.enum(["none", "required"]),
|
|
6678
|
-
pricingStrategy: z9.enum(["free", "single", "tiered"]),
|
|
6729
|
+
pricingStrategy: z9.enum(["free", "single", "tiered", "sliding_scale"]),
|
|
6679
6730
|
currency: z9.string(),
|
|
6680
6731
|
singlePriceAmount: z9.number().nullable(),
|
|
6732
|
+
slidingMinAmount: z9.number().nullable().optional(),
|
|
6733
|
+
slidingMaxAmount: z9.number().nullable().optional(),
|
|
6734
|
+
slidingSuggestedAmount: z9.number().nullable().optional(),
|
|
6681
6735
|
paymentTerms: blockBookingPaymentTermsSchema,
|
|
6682
6736
|
options: z9.array(coursePricingOptionSchema)
|
|
6683
6737
|
});
|
|
@@ -6780,7 +6834,7 @@ function isRecord4(value) {
|
|
|
6780
6834
|
}
|
|
6781
6835
|
function isPublicEventPricing(value) {
|
|
6782
6836
|
if (!isRecord4(value) || typeof value.kind !== "string") return false;
|
|
6783
|
-
return value.kind === "drop_in" || value.kind === "free_registration" || value.kind === "single_paid" || value.kind === "ticket_types" || value.kind === "course" || value.kind === "external";
|
|
6837
|
+
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";
|
|
6784
6838
|
}
|
|
6785
6839
|
function isPublicEventTicketType(value) {
|
|
6786
6840
|
return isRecord4(value) && typeof value.id === "string";
|
|
@@ -7067,6 +7121,19 @@ var publicEventPricingSchema = z12.discriminatedUnion("kind", [
|
|
|
7067
7121
|
ticketTypes: z12.array(publicEventTicketTypeSchema),
|
|
7068
7122
|
display: publicEventTicketTypePriceDisplaySchema
|
|
7069
7123
|
}),
|
|
7124
|
+
z12.object({
|
|
7125
|
+
kind: z12.literal("sliding_scale"),
|
|
7126
|
+
minAmount: z12.number(),
|
|
7127
|
+
maxAmount: z12.number(),
|
|
7128
|
+
suggestedAmount: z12.number().nullable(),
|
|
7129
|
+
currency: z12.string(),
|
|
7130
|
+
display: z12.object({
|
|
7131
|
+
kind: z12.literal("range"),
|
|
7132
|
+
minAmount: z12.number(),
|
|
7133
|
+
maxAmount: z12.number(),
|
|
7134
|
+
currency: z12.string()
|
|
7135
|
+
})
|
|
7136
|
+
}),
|
|
7070
7137
|
z12.object({
|
|
7071
7138
|
kind: z12.literal("course"),
|
|
7072
7139
|
display: z12.object({ kind: z12.literal("course"), display: publicCoursePriceDisplaySchema })
|
|
@@ -12452,22 +12519,22 @@ function AltchaWidget({
|
|
|
12452
12519
|
if (typeof window === "undefined") return;
|
|
12453
12520
|
let widget = null;
|
|
12454
12521
|
Promise.resolve().then(() => (init_altcha(), altcha_exports)).then(() => {
|
|
12455
|
-
if (
|
|
12522
|
+
if (containerRef.current === null) return;
|
|
12456
12523
|
widget = document.createElement("altcha-widget");
|
|
12457
12524
|
widget.setAttribute("challengeurl", challengeUrl);
|
|
12458
|
-
if (auto) {
|
|
12525
|
+
if (auto === true) {
|
|
12459
12526
|
widget.setAttribute("auto", "onload");
|
|
12460
12527
|
}
|
|
12461
|
-
if (hidelogo) {
|
|
12528
|
+
if (hidelogo === true) {
|
|
12462
12529
|
widget.setAttribute("hidelogo", "true");
|
|
12463
12530
|
}
|
|
12464
12531
|
widget.setAttribute("hidefooter", "true");
|
|
12465
|
-
if (className) {
|
|
12532
|
+
if (className !== void 0 && className.length > 0) {
|
|
12466
12533
|
widget.className = className;
|
|
12467
12534
|
}
|
|
12468
12535
|
widget.addEventListener("statechange", ((event) => {
|
|
12469
12536
|
const { state, payload } = event.detail;
|
|
12470
|
-
if (state === "verified" && payload) {
|
|
12537
|
+
if (state === "verified" && payload !== void 0 && payload.length > 0) {
|
|
12471
12538
|
onSolutionChange?.(payload);
|
|
12472
12539
|
} else if (state === "error" || state === "expired") {
|
|
12473
12540
|
onSolutionChange?.(null);
|
|
@@ -12478,7 +12545,7 @@ function AltchaWidget({
|
|
|
12478
12545
|
console.error("Failed to load ALTCHA widget:", err3);
|
|
12479
12546
|
});
|
|
12480
12547
|
return () => {
|
|
12481
|
-
if (widget && containerRef.current) {
|
|
12548
|
+
if (widget !== null && containerRef.current !== null) {
|
|
12482
12549
|
containerRef.current.removeChild(widget);
|
|
12483
12550
|
}
|
|
12484
12551
|
};
|
|
@@ -12533,15 +12600,15 @@ var encoder = new TextEncoder();
|
|
|
12533
12600
|
// ../altcha/src/index.ts
|
|
12534
12601
|
function getCmsApiUrl() {
|
|
12535
12602
|
const env = process.env.RIVERBANK_ENV;
|
|
12536
|
-
if (env) {
|
|
12603
|
+
if (env !== void 0 && env.length > 0) {
|
|
12537
12604
|
const envKey = `RIVERBANK_${env.toUpperCase()}_DASHBOARD_URL`;
|
|
12538
12605
|
const dashboardUrl2 = process.env[envKey];
|
|
12539
|
-
if (dashboardUrl2) {
|
|
12606
|
+
if (dashboardUrl2 !== void 0 && dashboardUrl2.length > 0) {
|
|
12540
12607
|
return `${dashboardUrl2.replace(/\/$/, "")}/api`;
|
|
12541
12608
|
}
|
|
12542
12609
|
}
|
|
12543
12610
|
const dashboardUrl = process.env.NEXT_PUBLIC_DASHBOARD_URL;
|
|
12544
|
-
if (dashboardUrl) {
|
|
12611
|
+
if (dashboardUrl !== void 0 && dashboardUrl.length > 0) {
|
|
12545
12612
|
return `${dashboardUrl.replace(/\/$/, "")}/api`;
|
|
12546
12613
|
}
|
|
12547
12614
|
throw new Error("Dashboard URL not configured. Set NEXT_PUBLIC_DASHBOARD_URL");
|
|
@@ -13041,6 +13108,7 @@ function useBookingSubmission(_siteId) {
|
|
|
13041
13108
|
customFields: data.customFields,
|
|
13042
13109
|
timezone: data.timezone,
|
|
13043
13110
|
discountCode: data.discountCode,
|
|
13111
|
+
selectedSlidingAmount: data.selectedSlidingAmount,
|
|
13044
13112
|
selectedCollectionOptionKind: data.selectedCollectionOptionKind,
|
|
13045
13113
|
altchaSolution: data.altchaSolution ?? null,
|
|
13046
13114
|
successUrl: data.successUrl,
|
|
@@ -13523,6 +13591,9 @@ function createInitialBookingFlowReducerState(input) {
|
|
|
13523
13591
|
fieldValues: collectInitialFieldValues(initialData),
|
|
13524
13592
|
touchedFields: {},
|
|
13525
13593
|
discountCode: toOptionalString(initialData.discountCode) ?? "",
|
|
13594
|
+
selectedSlidingAmountInput: toOptionalString(
|
|
13595
|
+
initialData.selectedSlidingAmountInput
|
|
13596
|
+
) ?? "",
|
|
13526
13597
|
selectedCollectionOptionKind: toSelectedCollectionOptionKind(
|
|
13527
13598
|
initialData.selectedCollectionOptionKind
|
|
13528
13599
|
),
|
|
@@ -13578,6 +13649,7 @@ function bookingFlowReducer(state, event) {
|
|
|
13578
13649
|
selectedDate: void 0,
|
|
13579
13650
|
selectedSlot: null,
|
|
13580
13651
|
selectedAppointmentPackageId: void 0,
|
|
13652
|
+
selectedSlidingAmountInput: "",
|
|
13581
13653
|
selectedCollectionOptionKind: void 0,
|
|
13582
13654
|
validationErrors: clearBookingFormError(state.validationErrors)
|
|
13583
13655
|
};
|
|
@@ -13631,6 +13703,13 @@ function bookingFlowReducer(state, event) {
|
|
|
13631
13703
|
selectedAppointmentPackageId: void 0,
|
|
13632
13704
|
validationErrors: clearBookingFormError(state.validationErrors)
|
|
13633
13705
|
};
|
|
13706
|
+
case "sliding-amount-changed":
|
|
13707
|
+
return {
|
|
13708
|
+
...state,
|
|
13709
|
+
selectedSlidingAmountInput: event.value,
|
|
13710
|
+
selectedAppointmentPackageId: void 0,
|
|
13711
|
+
validationErrors: clearBookingFormError(state.validationErrors)
|
|
13712
|
+
};
|
|
13634
13713
|
case "appointment-package-selected":
|
|
13635
13714
|
return {
|
|
13636
13715
|
...state,
|
|
@@ -13733,6 +13812,7 @@ function toBookingFormData(state) {
|
|
|
13733
13812
|
selectedDate: state.selectedDate,
|
|
13734
13813
|
selectedSlot: state.selectedSlot?.startAt,
|
|
13735
13814
|
discountCode: state.discountCode || void 0,
|
|
13815
|
+
selectedSlidingAmountInput: state.selectedSlidingAmountInput || void 0,
|
|
13736
13816
|
selectedCollectionOptionKind: state.selectedCollectionOptionKind,
|
|
13737
13817
|
selectedAppointmentPackageId: state.selectedAppointmentPackageId
|
|
13738
13818
|
};
|
|
@@ -13750,7 +13830,8 @@ function buildBookingStepResolution(input) {
|
|
|
13750
13830
|
input.form.settings?.serviceIds && input.form.settings.serviceIds.length > 1
|
|
13751
13831
|
);
|
|
13752
13832
|
const selectedService = paymentResolution.service;
|
|
13753
|
-
const
|
|
13833
|
+
const selectedServiceSlidingScale = getBookingServiceSlidingScale(selectedService);
|
|
13834
|
+
const needsPayment = Boolean(selectedServiceSlidingScale) || paymentResolution.mode !== "hidden" || Boolean(
|
|
13754
13835
|
input.enableAppointmentPackages && selectedService && (selectedService.priceAmount ?? 0) > 0
|
|
13755
13836
|
);
|
|
13756
13837
|
const hasFields = Boolean(input.form.schema?.fields.length);
|
|
@@ -13794,6 +13875,18 @@ function validateBookingStep(input) {
|
|
|
13794
13875
|
services: input.services,
|
|
13795
13876
|
defaultServiceId: input.defaultServiceId
|
|
13796
13877
|
});
|
|
13878
|
+
const slidingScale = getBookingServiceSlidingScale(resolution.service);
|
|
13879
|
+
if (slidingScale && !isBookingServiceSlidingAmountInRange(
|
|
13880
|
+
slidingScale,
|
|
13881
|
+
parseBookingCurrencyInputToCents(input.data.selectedSlidingAmountInput)
|
|
13882
|
+
)) {
|
|
13883
|
+
return {
|
|
13884
|
+
ok: false,
|
|
13885
|
+
errors: createFormBookingValidationError(
|
|
13886
|
+
"Please choose an amount within the sliding scale"
|
|
13887
|
+
)
|
|
13888
|
+
};
|
|
13889
|
+
}
|
|
13797
13890
|
if (resolution.mode === "hidden" || resolution.mode === "disclosure_only") {
|
|
13798
13891
|
return { ok: true };
|
|
13799
13892
|
}
|
|
@@ -14295,11 +14388,27 @@ function useHeadlessBookingFlow(options) {
|
|
|
14295
14388
|
const selectedServiceId = state.selectedServiceId ?? defaultServiceId;
|
|
14296
14389
|
const selectedResourceId = state.selectedResourceId ?? defaultResourceId;
|
|
14297
14390
|
const selectedService = options.services.find((service) => service.id === selectedServiceId) ?? null;
|
|
14391
|
+
const lastSlidingServiceIdRef = useRef6(null);
|
|
14392
|
+
useEffect6(() => {
|
|
14393
|
+
const selectedId = selectedService?.id ?? null;
|
|
14394
|
+
if (lastSlidingServiceIdRef.current === selectedId) return;
|
|
14395
|
+
lastSlidingServiceIdRef.current = selectedId;
|
|
14396
|
+
const slidingScale = getBookingServiceSlidingScale(selectedService);
|
|
14397
|
+
dispatch({
|
|
14398
|
+
type: "sliding-amount-changed",
|
|
14399
|
+
value: slidingScale?.suggestedAmount !== null && slidingScale?.suggestedAmount !== void 0 ? formatBookingCentsAsCurrencyInput(slidingScale.suggestedAmount) : ""
|
|
14400
|
+
});
|
|
14401
|
+
}, [selectedService]);
|
|
14298
14402
|
const hasPortalBearerAuth = (api.config.authOverrides?.portal ?? api.config.auth).type === "bearer";
|
|
14403
|
+
const selectedServiceSlidingScale = getBookingServiceSlidingScale(selectedService);
|
|
14404
|
+
const selectedSlidingAmount = parseBookingCurrencyInputToCents(
|
|
14405
|
+
state.selectedSlidingAmountInput
|
|
14406
|
+
);
|
|
14407
|
+
const selectedAppointmentPriceAmount = selectedServiceSlidingScale && selectedSlidingAmount !== null ? selectedSlidingAmount : selectedService?.priceAmount ?? 0;
|
|
14299
14408
|
const canLoadAppointmentPackages = Boolean(
|
|
14300
|
-
options.enableAppointmentPackages && hasPortalBearerAuth && selectedService && (selectedService.priceAmount ?? 0) > 0
|
|
14409
|
+
options.enableAppointmentPackages && hasPortalBearerAuth && selectedService && !selectedServiceSlidingScale && (selectedService.priceAmount ?? 0) > 0
|
|
14301
14410
|
);
|
|
14302
|
-
const appointmentPackagesUnavailableReason = !options.enableAppointmentPackages ? "disabled" : !selectedService || (selectedService.priceAmount ?? 0) <= 0 ? "missing-priced-service" : !hasPortalBearerAuth ? "missing-portal-auth" : null;
|
|
14411
|
+
const appointmentPackagesUnavailableReason = !options.enableAppointmentPackages ? "disabled" : !selectedService || selectedServiceSlidingScale || (selectedService.priceAmount ?? 0) <= 0 ? "missing-priced-service" : !hasPortalBearerAuth ? "missing-portal-auth" : null;
|
|
14303
14412
|
const data = useMemo2(() => toBookingFormData(state), [state]);
|
|
14304
14413
|
const availabilityDatesQuery = useMemo2(
|
|
14305
14414
|
() => buildBookingAvailabilityQuery({
|
|
@@ -14529,13 +14638,13 @@ function useHeadlessBookingFlow(options) {
|
|
|
14529
14638
|
state.selectedSlot
|
|
14530
14639
|
]);
|
|
14531
14640
|
const appointmentDiscountContext = useMemo2(
|
|
14532
|
-
() => selectedService &&
|
|
14533
|
-
[
|
|
14641
|
+
() => selectedService && selectedAppointmentPriceAmount > 0 ? { type: "appointment", serviceId: selectedService.id } : null,
|
|
14642
|
+
[selectedAppointmentPriceAmount, selectedService?.id]
|
|
14534
14643
|
);
|
|
14535
14644
|
const discountUi = useDiscountCodeUi({
|
|
14536
14645
|
api,
|
|
14537
14646
|
discountContext: appointmentDiscountContext,
|
|
14538
|
-
subtotalCents:
|
|
14647
|
+
subtotalCents: selectedAppointmentPriceAmount
|
|
14539
14648
|
});
|
|
14540
14649
|
const { submit, clearFeedback } = useBookingSubmission(options.siteId);
|
|
14541
14650
|
const submittingRef = useRef6(false);
|
|
@@ -14678,6 +14787,7 @@ function useHeadlessBookingFlow(options) {
|
|
|
14678
14787
|
type: "appointment-package-selected",
|
|
14679
14788
|
packageId: packageId ? unsafeAsCustomerPassId(packageId) : null
|
|
14680
14789
|
}),
|
|
14790
|
+
setSlidingAmountInput: (value) => dispatch({ type: "sliding-amount-changed", value }),
|
|
14681
14791
|
setDiscountCode: (code) => {
|
|
14682
14792
|
dispatch({ type: "discount-code-changed", code });
|
|
14683
14793
|
latestRef.current.setDiscountCode(code);
|
|
@@ -14748,11 +14858,11 @@ function useHeadlessBookingFlow(options) {
|
|
|
14748
14858
|
() => selectedService && paymentResolution.mode !== "unsupported" ? buildBookingPaymentSelectionViewModel({
|
|
14749
14859
|
serviceTitle: selectedService.title,
|
|
14750
14860
|
paymentTerms: selectedService.paymentTerms,
|
|
14751
|
-
priceAmount:
|
|
14861
|
+
priceAmount: selectedAppointmentPriceAmount,
|
|
14752
14862
|
priceCurrency: selectedService.priceCurrency,
|
|
14753
14863
|
bookingStartAt: state.selectedSlot?.startAt
|
|
14754
14864
|
}) : null,
|
|
14755
|
-
[paymentResolution.mode, selectedService, state.selectedSlot?.startAt]
|
|
14865
|
+
[paymentResolution.mode, selectedAppointmentPriceAmount, selectedService, state.selectedSlot?.startAt]
|
|
14756
14866
|
);
|
|
14757
14867
|
const appointmentPackageItems = appointmentPackages.tag === "loaded" ? appointmentPackages.value : [];
|
|
14758
14868
|
const selectedAppointmentPackage = appointmentPackageItems.find(
|
|
@@ -14781,6 +14891,9 @@ function useHeadlessBookingFlow(options) {
|
|
|
14781
14891
|
selection: null,
|
|
14782
14892
|
selectedCollectionOptionKind: state.selectedCollectionOptionKind,
|
|
14783
14893
|
selectedAppointmentPackageId: state.selectedAppointmentPackageId,
|
|
14894
|
+
selectedSlidingAmountInput: state.selectedSlidingAmountInput,
|
|
14895
|
+
selectedSlidingAmount,
|
|
14896
|
+
slidingScale: selectedServiceSlidingScale,
|
|
14784
14897
|
appointmentPackages: appointmentPackagesModel,
|
|
14785
14898
|
errorMessage: paymentResolution.errorMessage ?? "This service cannot be booked right now."
|
|
14786
14899
|
} : {
|
|
@@ -14789,6 +14902,9 @@ function useHeadlessBookingFlow(options) {
|
|
|
14789
14902
|
selection: paymentSelection,
|
|
14790
14903
|
selectedCollectionOptionKind: state.selectedCollectionOptionKind,
|
|
14791
14904
|
selectedAppointmentPackageId: state.selectedAppointmentPackageId,
|
|
14905
|
+
selectedSlidingAmountInput: state.selectedSlidingAmountInput,
|
|
14906
|
+
selectedSlidingAmount,
|
|
14907
|
+
slidingScale: selectedServiceSlidingScale,
|
|
14792
14908
|
appointmentPackages: appointmentPackagesModel
|
|
14793
14909
|
};
|
|
14794
14910
|
return {
|
|
@@ -15351,6 +15467,9 @@ var paymentOptionLayoutStyle = {
|
|
|
15351
15467
|
var summaryStackStyle = {
|
|
15352
15468
|
gap: "0.125rem"
|
|
15353
15469
|
};
|
|
15470
|
+
function formatBookingAmount(amount, currency) {
|
|
15471
|
+
return formatCurrencyAmount(amount, currency, { decimals: "auto" });
|
|
15472
|
+
}
|
|
15354
15473
|
function HeadlessBookingDefaultForm({
|
|
15355
15474
|
booking,
|
|
15356
15475
|
onSubmit
|
|
@@ -15627,6 +15746,7 @@ function HeadlessBookingPaymentSelectionStep({
|
|
|
15627
15746
|
}
|
|
15628
15747
|
const packageOptions = booking.payment.appointmentPackages.items;
|
|
15629
15748
|
const hasPackageOptions = packageOptions.length > 0;
|
|
15749
|
+
const slidingScale = booking.payment.slidingScale;
|
|
15630
15750
|
return /* @__PURE__ */ jsxs7("div", { className: "ab-stack", children: [
|
|
15631
15751
|
/* @__PURE__ */ jsxs7("div", { className: "ab-info-box", children: [
|
|
15632
15752
|
/* @__PURE__ */ jsx9("h3", { className: "ab-subtitle", children: viewModel.sectionTitle }),
|
|
@@ -15637,6 +15757,28 @@ function HeadlessBookingPaymentSelectionStep({
|
|
|
15637
15757
|
booking.payment.appointmentPackages.state.message,
|
|
15638
15758
|
" You can continue with the normal payment option."
|
|
15639
15759
|
] }) : null,
|
|
15760
|
+
slidingScale ? /* @__PURE__ */ jsxs7("div", { className: "rb-space-y-2", children: [
|
|
15761
|
+
/* @__PURE__ */ jsx9("label", { htmlFor: "appointment-sliding-amount", className: "form-label", children: "Choose your price" }),
|
|
15762
|
+
/* @__PURE__ */ jsxs7("p", { className: "rb-caption status-muted", children: [
|
|
15763
|
+
formatBookingAmount(slidingScale.minAmount, slidingScale.currency),
|
|
15764
|
+
" to ",
|
|
15765
|
+
formatBookingAmount(slidingScale.maxAmount, slidingScale.currency),
|
|
15766
|
+
slidingScale.suggestedAmount !== null ? `, suggested ${formatBookingAmount(slidingScale.suggestedAmount, slidingScale.currency)}` : ""
|
|
15767
|
+
] }),
|
|
15768
|
+
/* @__PURE__ */ jsx9(
|
|
15769
|
+
"input",
|
|
15770
|
+
{
|
|
15771
|
+
id: "appointment-sliding-amount",
|
|
15772
|
+
type: "number",
|
|
15773
|
+
className: "form-input",
|
|
15774
|
+
min: slidingScale.minAmount / 100,
|
|
15775
|
+
max: slidingScale.maxAmount / 100,
|
|
15776
|
+
step: "0.01",
|
|
15777
|
+
value: booking.payment.selectedSlidingAmountInput,
|
|
15778
|
+
onChange: (event) => booking.actions.setSlidingAmountInput(event.target.value)
|
|
15779
|
+
}
|
|
15780
|
+
)
|
|
15781
|
+
] }) : null,
|
|
15640
15782
|
/* @__PURE__ */ jsxs7("div", { className: "ab-stack", role: "list", "aria-label": "Payment options", children: [
|
|
15641
15783
|
packageOptions.map((appointmentPackage) => {
|
|
15642
15784
|
const isSelected = booking.payment.selectedAppointmentPackageId === appointmentPackage.customerPassId;
|
|
@@ -16992,6 +17134,7 @@ function useEligibility(params) {
|
|
|
16992
17134
|
occurrenceId: params.occurrenceId,
|
|
16993
17135
|
attendanceMode: params.attendanceMode ?? void 0,
|
|
16994
17136
|
ticketTypeId: params.ticketTypeId ?? void 0,
|
|
17137
|
+
selectedSlidingAmount: params.selectedSlidingAmount ?? void 0,
|
|
16995
17138
|
email: params.email.trim().toLowerCase(),
|
|
16996
17139
|
ticketsCount: params.ticketsCount
|
|
16997
17140
|
});
|
|
@@ -17012,7 +17155,7 @@ function useEligibility(params) {
|
|
|
17012
17155
|
return () => {
|
|
17013
17156
|
cancelled = true;
|
|
17014
17157
|
};
|
|
17015
|
-
}, [api, params.enabled, params.occurrenceId, params.attendanceMode, params.ticketTypeId, params.email, params.ticketsCount]);
|
|
17158
|
+
}, [api, params.enabled, params.occurrenceId, params.attendanceMode, params.ticketTypeId, params.selectedSlidingAmount, params.email, params.ticketsCount]);
|
|
17016
17159
|
return {
|
|
17017
17160
|
state,
|
|
17018
17161
|
eligibility: state.eligibility,
|
|
@@ -17644,6 +17787,7 @@ function useEventRegistrationSubmit(options) {
|
|
|
17644
17787
|
occurrenceId: submitOccurrenceId,
|
|
17645
17788
|
attendanceMode: options.selectedAttendanceMode ?? void 0,
|
|
17646
17789
|
ticketTypeId: options.selectedTicketTypeId ?? void 0,
|
|
17790
|
+
selectedSlidingAmount: options.selectedSlidingAmount ?? void 0,
|
|
17647
17791
|
email: options.formData.email.trim().toLowerCase(),
|
|
17648
17792
|
name: options.formData.name.trim(),
|
|
17649
17793
|
ticketsCount: options.ticketsCount,
|
|
@@ -17745,6 +17889,35 @@ function useEventRegistrationSubmit(options) {
|
|
|
17745
17889
|
}
|
|
17746
17890
|
|
|
17747
17891
|
// ../blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.ts
|
|
17892
|
+
function parseCurrencyInputToCents(value) {
|
|
17893
|
+
const trimmed = value.trim();
|
|
17894
|
+
if (!trimmed) return null;
|
|
17895
|
+
const amount = Number(trimmed);
|
|
17896
|
+
if (!Number.isFinite(amount) || amount < 0) return null;
|
|
17897
|
+
return Math.round(amount * 100);
|
|
17898
|
+
}
|
|
17899
|
+
function formatCentsAsCurrencyInput(amount) {
|
|
17900
|
+
const major = amount / 100;
|
|
17901
|
+
return Number.isInteger(major) ? String(major) : major.toFixed(2);
|
|
17902
|
+
}
|
|
17903
|
+
function getSlidingScaleForEvent(event) {
|
|
17904
|
+
const pricing = event ? resolveRuntimeEventPricing(event) : null;
|
|
17905
|
+
return pricing?.kind === "sliding_scale" ? {
|
|
17906
|
+
minAmount: pricing.minAmount,
|
|
17907
|
+
maxAmount: pricing.maxAmount,
|
|
17908
|
+
suggestedAmount: pricing.suggestedAmount
|
|
17909
|
+
} : null;
|
|
17910
|
+
}
|
|
17911
|
+
function getSlidingScaleSelectionMessage(input) {
|
|
17912
|
+
if (!input.slidingScale) return null;
|
|
17913
|
+
if (input.selectedAmount === null) {
|
|
17914
|
+
return "Choose an amount to continue.";
|
|
17915
|
+
}
|
|
17916
|
+
if (input.selectedAmount < input.slidingScale.minAmount || input.selectedAmount > input.slidingScale.maxAmount) {
|
|
17917
|
+
return "Choose an amount within the sliding scale.";
|
|
17918
|
+
}
|
|
17919
|
+
return null;
|
|
17920
|
+
}
|
|
17748
17921
|
function useEventRegistrationWizard(options) {
|
|
17749
17922
|
const api = useBlockApi();
|
|
17750
17923
|
const registrationEvents = useMemo6(
|
|
@@ -17789,6 +17962,10 @@ function useEventRegistrationWizard(options) {
|
|
|
17789
17962
|
preSelectedEvent?.deliveryMode === "online" ? "online" : preSelectedEvent?.deliveryMode === "in_person" ? "in_person" : null
|
|
17790
17963
|
);
|
|
17791
17964
|
const [selectedTicketTypeId, setSelectedTicketTypeId] = useState4(null);
|
|
17965
|
+
const [selectedSlidingAmountInput, setSelectedSlidingAmountInput] = useState4(() => {
|
|
17966
|
+
const slidingScale = getSlidingScaleForEvent(preSelectedEvent ?? null);
|
|
17967
|
+
return slidingScale?.suggestedAmount !== null && slidingScale?.suggestedAmount !== void 0 ? formatCentsAsCurrencyInput(slidingScale.suggestedAmount) : "";
|
|
17968
|
+
});
|
|
17792
17969
|
const [registrationResult, setRegistrationResult] = useState4(null);
|
|
17793
17970
|
const [errorMessage, setErrorMessage] = useState4("");
|
|
17794
17971
|
const [altchaSolution, setAltchaSolution] = useState4(null);
|
|
@@ -17825,6 +18002,7 @@ function useEventRegistrationWizard(options) {
|
|
|
17825
18002
|
occurrenceId,
|
|
17826
18003
|
attendanceMode: selectedAttendanceMode,
|
|
17827
18004
|
ticketTypeId: selectedTicketTypeId,
|
|
18005
|
+
selectedSlidingAmount: parseCurrencyInputToCents(selectedSlidingAmountInput),
|
|
17828
18006
|
email: formData.email,
|
|
17829
18007
|
ticketsCount
|
|
17830
18008
|
});
|
|
@@ -17960,6 +18138,18 @@ function useEventRegistrationWizard(options) {
|
|
|
17960
18138
|
}),
|
|
17961
18139
|
[selectedAttendanceMode, selectedEvent, preSelectedEvent, eligibility, selectedTicketTypeId]
|
|
17962
18140
|
);
|
|
18141
|
+
const selectedSlidingAmount = useMemo6(
|
|
18142
|
+
() => parseCurrencyInputToCents(selectedSlidingAmountInput),
|
|
18143
|
+
[selectedSlidingAmountInput]
|
|
18144
|
+
);
|
|
18145
|
+
const selectedEventSlidingScale = useMemo6(
|
|
18146
|
+
() => getSlidingScaleForEvent(selectedEvent ?? preSelectedEvent),
|
|
18147
|
+
[selectedEvent, preSelectedEvent]
|
|
18148
|
+
);
|
|
18149
|
+
const slidingScaleSelectionMessage = getSlidingScaleSelectionMessage({
|
|
18150
|
+
slidingScale: selectedEventSlidingScale,
|
|
18151
|
+
selectedAmount: selectedSlidingAmount
|
|
18152
|
+
});
|
|
17963
18153
|
const ticketTypeSelectionRequired = useMemo6(() => {
|
|
17964
18154
|
const event = selectedEvent ?? preSelectedEvent;
|
|
17965
18155
|
if (!event || publicEventPricingMode(resolveRuntimeEventPricing(event)) !== "ticket_types") {
|
|
@@ -18028,12 +18218,24 @@ function useEventRegistrationWizard(options) {
|
|
|
18028
18218
|
setGuestSectionShake(false);
|
|
18029
18219
|
};
|
|
18030
18220
|
const eventRequiresPayment = useMemo6(
|
|
18031
|
-
() =>
|
|
18221
|
+
() => {
|
|
18222
|
+
if (selectedEventSlidingScale) {
|
|
18223
|
+
return (selectedSlidingAmount ?? 0) > 0;
|
|
18224
|
+
}
|
|
18225
|
+
return resolveEventRequiresPayment({
|
|
18226
|
+
eligibility,
|
|
18227
|
+
selectedTicketType,
|
|
18228
|
+
event: selectedEvent ?? preSelectedEvent
|
|
18229
|
+
});
|
|
18230
|
+
},
|
|
18231
|
+
[
|
|
18032
18232
|
eligibility,
|
|
18033
18233
|
selectedTicketType,
|
|
18034
|
-
|
|
18035
|
-
|
|
18036
|
-
|
|
18234
|
+
selectedEvent,
|
|
18235
|
+
preSelectedEvent,
|
|
18236
|
+
selectedEventSlidingScale,
|
|
18237
|
+
selectedSlidingAmount
|
|
18238
|
+
]
|
|
18037
18239
|
);
|
|
18038
18240
|
const handleDetailsComplete = async () => {
|
|
18039
18241
|
if (ticketTypeSelectionRequired && !hasValidSelectedTicketType) {
|
|
@@ -18042,6 +18244,11 @@ function useEventRegistrationWizard(options) {
|
|
|
18042
18244
|
setStep("error");
|
|
18043
18245
|
return { ok: false, reason: "blocked", message };
|
|
18044
18246
|
}
|
|
18247
|
+
if (slidingScaleSelectionMessage) {
|
|
18248
|
+
setErrorMessage(slidingScaleSelectionMessage);
|
|
18249
|
+
setStep("error");
|
|
18250
|
+
return { ok: false, reason: "blocked", message: slidingScaleSelectionMessage };
|
|
18251
|
+
}
|
|
18045
18252
|
if (!validateForm()) {
|
|
18046
18253
|
setGuestSectionShake(true);
|
|
18047
18254
|
return {
|
|
@@ -18126,9 +18333,18 @@ function useEventRegistrationWizard(options) {
|
|
|
18126
18333
|
const discountSubtotalCents = useMemo6(() => {
|
|
18127
18334
|
if (discountContext?.type !== "event") return void 0;
|
|
18128
18335
|
const event = selectedEvent ?? preSelectedEvent;
|
|
18129
|
-
const eventPriceCents = selectedTicketType?.priceAmount ?? eligibility?.price ?? (event ? publicEventScalarPrice(resolveRuntimeEventPricing(event)) : null) ?? 0;
|
|
18336
|
+
const eventPriceCents = selectedTicketType?.priceAmount ?? eligibility?.price ?? (selectedEventSlidingScale ? selectedSlidingAmount : null) ?? (event ? publicEventScalarPrice(resolveRuntimeEventPricing(event)) : null) ?? 0;
|
|
18130
18337
|
return Math.max(0, eventPriceCents * ticketsCount);
|
|
18131
|
-
}, [
|
|
18338
|
+
}, [
|
|
18339
|
+
discountContext,
|
|
18340
|
+
selectedTicketType,
|
|
18341
|
+
eligibility,
|
|
18342
|
+
selectedEvent,
|
|
18343
|
+
preSelectedEvent,
|
|
18344
|
+
selectedEventSlidingScale,
|
|
18345
|
+
selectedSlidingAmount,
|
|
18346
|
+
ticketsCount
|
|
18347
|
+
]);
|
|
18132
18348
|
const discountUi = useDiscountCodeUi({ api, discountContext, subtotalCents: discountSubtotalCents });
|
|
18133
18349
|
const selectionMethod = paymentSelection.method;
|
|
18134
18350
|
const shouldShowDiscountToggle = discountContext !== null && discountUi.manualCodeEntryAllowed && (selectionMethod === "stripe" || selectionMethod === "pass_bundle" || selectionMethod === "membership_bundle");
|
|
@@ -18137,6 +18353,7 @@ function useEventRegistrationWizard(options) {
|
|
|
18137
18353
|
registrationTarget,
|
|
18138
18354
|
selectedAttendanceMode,
|
|
18139
18355
|
selectedTicketTypeId,
|
|
18356
|
+
selectedSlidingAmount,
|
|
18140
18357
|
ticketsCount,
|
|
18141
18358
|
formData,
|
|
18142
18359
|
altchaSolution,
|
|
@@ -18151,6 +18368,10 @@ function useEventRegistrationWizard(options) {
|
|
|
18151
18368
|
});
|
|
18152
18369
|
const handleEventSelect = (event) => {
|
|
18153
18370
|
setSelectedEvent(event);
|
|
18371
|
+
const slidingScale = getSlidingScaleForEvent(event);
|
|
18372
|
+
setSelectedSlidingAmountInput(
|
|
18373
|
+
slidingScale?.suggestedAmount !== null && slidingScale?.suggestedAmount !== void 0 ? formatCentsAsCurrencyInput(slidingScale.suggestedAmount) : ""
|
|
18374
|
+
);
|
|
18154
18375
|
setSelectedAttendanceMode(
|
|
18155
18376
|
(event.deliveryMode ?? "in_person") === "hybrid" ? null : (event.deliveryMode ?? "in_person") === "online" ? "online" : "in_person"
|
|
18156
18377
|
);
|
|
@@ -18160,6 +18381,7 @@ function useEventRegistrationWizard(options) {
|
|
|
18160
18381
|
const handleRetry = () => {
|
|
18161
18382
|
dispatchFlow({ type: "reset", hasPreSelectedContext });
|
|
18162
18383
|
setSelectedTicketTypeId(null);
|
|
18384
|
+
setSelectedSlidingAmountInput("");
|
|
18163
18385
|
setSelectedAttendanceMode(
|
|
18164
18386
|
preSelectedEvent?.deliveryMode === "online" ? "online" : preSelectedEvent?.deliveryMode === "in_person" ? "in_person" : null
|
|
18165
18387
|
);
|
|
@@ -18196,6 +18418,11 @@ function useEventRegistrationWizard(options) {
|
|
|
18196
18418
|
setSelectedAttendanceMode,
|
|
18197
18419
|
selectedTicketTypeId,
|
|
18198
18420
|
setSelectedTicketTypeId,
|
|
18421
|
+
selectedSlidingAmountInput,
|
|
18422
|
+
setSelectedSlidingAmountInput,
|
|
18423
|
+
selectedSlidingAmount,
|
|
18424
|
+
selectedEventSlidingScale,
|
|
18425
|
+
slidingScaleSelectionMessage,
|
|
18199
18426
|
selectedTicketType,
|
|
18200
18427
|
visibleTicketTypes,
|
|
18201
18428
|
ticketTypeSelectionRequired,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { normalizeCarouselProps, CarouselNodeClient } from './chunk-
|
|
1
|
+
import { normalizeCarouselProps, CarouselNodeClient } from './chunk-B5UC2D6X.mjs';
|
|
2
2
|
import './chunk-6N7YRNYU.mjs';
|
|
3
3
|
import { mountReactIsland } from './chunk-N7PBWBWQ.mjs';
|
|
4
|
-
import { defineIslandPropsDecoder } from './chunk-
|
|
5
|
-
import './chunk-
|
|
4
|
+
import { defineIslandPropsDecoder } from './chunk-R3CZQLXF.mjs';
|
|
5
|
+
import './chunk-GH6IIOOE.mjs';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
7
7
|
|
|
8
8
|
var decode = defineIslandPropsDecoder("carousel");
|