@riverbankcms/sdk 0.91.0 → 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-3TT47WCF.mjs → PreviewEditorSidebar-3CI5MKV3.mjs} +2 -2
- package/dist/{PreviewEditorUI-ORCLLUNZ.mjs → PreviewEditorUI-DKEP636I.mjs} +2 -2
- 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 +7 -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/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/rendering/islands/types.d.ts +23 -1
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/{chunk-AFPMCLS7.mjs → chunk-6D7PLF4M.mjs} +1 -1
- package/dist/{chunk-RQUZYSES.mjs → chunk-I6EOKV6B.mjs} +520 -40
- package/dist/{chunk-S3YHJWEU.mjs → chunk-LERKJM3E.mjs} +5 -5
- package/dist/{chunk-GDT2QGIL.mjs → chunk-UOMTCHZD.mjs} +1 -1
- package/dist/cli/index.mjs +552 -80
- package/dist/client/{accordion-AFX37652.mjs → accordion-BUDH2G3S.mjs} +2 -2
- package/dist/client/{bookingForm-32V5QCOW.mjs → bookingForm-NQMCELVB.mjs} +89 -14
- package/dist/client/bookings.mjs +243 -17
- package/dist/client/{carousel-TJGQJ7ER.mjs → carousel-ONCEW6IJ.mjs} +3 -3
- package/dist/client/{cart-JUU2JEW4.mjs → cart-V2TCK2GI.mjs} +7 -7
- package/dist/client/{checkout-RD6BTFX4.mjs → checkout-ZI7SWNCS.mjs} +7 -7
- package/dist/client/{chunk-FMZZHAIR.mjs → chunk-AUMRQ242.mjs} +52 -5
- package/dist/client/{chunk-PMNAV6LO.mjs → chunk-B5UC2D6X.mjs} +7 -6
- package/dist/client/{chunk-6RN62XBV.mjs → chunk-ERQDHUS2.mjs} +1 -1
- package/dist/client/{chunk-RWYFG625.mjs → chunk-GH6IIOOE.mjs} +30 -2
- package/dist/client/{chunk-C4LP6BPG.mjs → chunk-HQWIJLYN.mjs} +1 -1
- package/dist/client/{chunk-RMOFBBNA.mjs → chunk-JXY6NHG6.mjs} +6 -6
- package/dist/client/{chunk-6QZIBNGV.mjs → chunk-KXYEKEV6.mjs} +154 -16
- package/dist/client/{chunk-E6VIWZUG.mjs → chunk-N2WJPTF7.mjs} +3 -3
- package/dist/client/{chunk-ISAUXU5R.mjs → chunk-QQNVQ62W.mjs} +1 -1
- package/dist/client/{chunk-MLBNVN4H.mjs → chunk-R3CZQLXF.mjs} +67 -4
- package/dist/client/{chunk-WHZQDPBZ.mjs → chunk-TNGL2WJF.mjs} +1 -0
- package/dist/client/{chunk-CKXEUWWA.mjs → chunk-ZJDBOLX7.mjs} +3 -3
- package/dist/client/client.mjs +515 -38
- package/dist/client/{courseRegistration-X63QAIVV.mjs → courseRegistration-JPWAQ6KM.mjs} +111 -11
- package/dist/client/{eventCalendar-5T24GCZL.mjs → eventCalendar-QDOCHBBV.mjs} +9 -9
- package/dist/client/{eventCombined-AZVTF22X.mjs → eventCombined-ZS2CXSIE.mjs} +9 -9
- package/dist/client/{eventDetails-7GPFNLGF.mjs → eventDetails-5LOBMPLN.mjs} +9 -9
- package/dist/client/{eventListing-QEUMTMUM.mjs → eventListing-SBGY4I3L.mjs} +9 -9
- package/dist/client/{eventRegistration-P2EDKCQZ.mjs → eventRegistration-XGPIU3Z2.mjs} +9 -9
- package/dist/client/{form-NUJ7H4IN.mjs → form-R7D4LZWW.mjs} +3 -3
- package/dist/client/{headerSection-JB7LECPL.mjs → headerSection-RRLYUCGC.mjs} +3 -3
- package/dist/client/hooks.mjs +22 -2
- package/dist/client/{locationMap-UEYWUCSW.mjs → locationMap-35ZJMRBZ.mjs} +3 -3
- package/dist/client/{newsletterForm-S2YZQ2X7.mjs → newsletterForm-MJ2VCFUT.mjs} +3 -3
- package/dist/client/{productDetail-H5MADGG7.mjs → productDetail-2O7YQNBX.mjs} +7 -7
- package/dist/client/{productList-DK7YON7H.mjs → productList-FDP5BH7W.mjs} +7 -7
- package/dist/client/rendering/client.mjs +495 -36
- package/dist/client/rendering/islands.mjs +19 -19
- package/dist/client/rendering.mjs +514 -37
- package/dist/client/{shop-6PA7RDRJ.mjs → shop-BGYJ3LDT.mjs} +7 -7
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/{sdk-runtime-JP5347OB.mjs → sdk-runtime-B3TFXRXZ.mjs} +4 -4
- package/dist/server/components.mjs +166 -7
- package/dist/server/config-validation.mjs +23 -2
- package/dist/server/config.mjs +23 -2
- package/dist/server/data.mjs +22 -2
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +167 -8
- package/dist/server/page-converter.mjs +19 -2
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +166 -7
- package/dist/server/rendering.mjs +166 -7
- package/dist/server/routing.mjs +29 -5
- package/dist/server/server.mjs +23 -3
- package/package.json +1 -1
- package/dist/SdkPreviewModeRuntime-GMCDQPZZ.mjs +0 -8
|
@@ -152,6 +152,14 @@ export declare const bookingFormBlockRuntime: Readonly<{
|
|
|
152
152
|
title: string;
|
|
153
153
|
description?: string;
|
|
154
154
|
durationMinutes?: number;
|
|
155
|
+
pricing?: Readonly<{
|
|
156
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
157
|
+
currency: string;
|
|
158
|
+
singlePriceAmount?: number | null;
|
|
159
|
+
slidingMinAmount?: number | null;
|
|
160
|
+
slidingMaxAmount?: number | null;
|
|
161
|
+
slidingSuggestedAmount?: number | null;
|
|
162
|
+
}>;
|
|
155
163
|
priceAmount?: number | null;
|
|
156
164
|
priceCurrency?: string | null;
|
|
157
165
|
paymentTerms?: import("../../blocks/shared/bookingPaymentTerms").BlockBookingPaymentTerms;
|
|
@@ -348,6 +356,14 @@ export declare const bookingFormBlockRuntime: Readonly<{
|
|
|
348
356
|
title: string;
|
|
349
357
|
description?: string;
|
|
350
358
|
durationMinutes?: number;
|
|
359
|
+
pricing?: Readonly<{
|
|
360
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
361
|
+
currency: string;
|
|
362
|
+
singlePriceAmount?: number | null;
|
|
363
|
+
slidingMinAmount?: number | null;
|
|
364
|
+
slidingMaxAmount?: number | null;
|
|
365
|
+
slidingSuggestedAmount?: number | null;
|
|
366
|
+
}>;
|
|
351
367
|
priceAmount?: number | null;
|
|
352
368
|
priceCurrency?: string | null;
|
|
353
369
|
paymentTerms?: import("../../blocks/shared/bookingPaymentTerms").BlockBookingPaymentTerms;
|
|
@@ -424,6 +440,14 @@ export declare const bookingFormBlockRuntime: Readonly<{
|
|
|
424
440
|
title: string;
|
|
425
441
|
description?: string;
|
|
426
442
|
durationMinutes?: number;
|
|
443
|
+
pricing?: Readonly<{
|
|
444
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
445
|
+
currency: string;
|
|
446
|
+
singlePriceAmount?: number | null;
|
|
447
|
+
slidingMinAmount?: number | null;
|
|
448
|
+
slidingMaxAmount?: number | null;
|
|
449
|
+
slidingSuggestedAmount?: number | null;
|
|
450
|
+
}>;
|
|
427
451
|
priceAmount?: number | null;
|
|
428
452
|
priceCurrency?: string | null;
|
|
429
453
|
paymentTerms?: import("../../blocks/shared/bookingPaymentTerms").BlockBookingPaymentTerms;
|
|
@@ -512,6 +536,14 @@ export declare const bookingFormInteractiveIslandPropsCodec: Readonly<{
|
|
|
512
536
|
title: string;
|
|
513
537
|
description?: string;
|
|
514
538
|
durationMinutes?: number;
|
|
539
|
+
pricing?: Readonly<{
|
|
540
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
541
|
+
currency: string;
|
|
542
|
+
singlePriceAmount?: number | null;
|
|
543
|
+
slidingMinAmount?: number | null;
|
|
544
|
+
slidingMaxAmount?: number | null;
|
|
545
|
+
slidingSuggestedAmount?: number | null;
|
|
546
|
+
}>;
|
|
515
547
|
priceAmount?: number | null;
|
|
516
548
|
priceCurrency?: string | null;
|
|
517
549
|
paymentTerms?: import("../../blocks/shared/bookingPaymentTerms").BlockBookingPaymentTerms;
|
|
@@ -597,6 +629,14 @@ export declare const bookingFormInteractiveIslandPropsCodec: Readonly<{
|
|
|
597
629
|
title: string;
|
|
598
630
|
description?: string;
|
|
599
631
|
durationMinutes?: number;
|
|
632
|
+
pricing?: Readonly<{
|
|
633
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
634
|
+
currency: string;
|
|
635
|
+
singlePriceAmount?: number | null;
|
|
636
|
+
slidingMinAmount?: number | null;
|
|
637
|
+
slidingMaxAmount?: number | null;
|
|
638
|
+
slidingSuggestedAmount?: number | null;
|
|
639
|
+
}>;
|
|
600
640
|
priceAmount?: number | null;
|
|
601
641
|
priceCurrency?: string | null;
|
|
602
642
|
paymentTerms?: import("../../blocks/shared/bookingPaymentTerms").BlockBookingPaymentTerms;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare const APPOINTMENT_BOOKING_BLOCK_ID: "block.appointment-booking";
|
|
2
|
-
export declare const BOOKING_FORM_DATA_RESERVED_KEY_VALUES: readonly ["serviceId", "resourceId", "selectedDate", "selectedSlot", "discountCode", "selectedCollectionOptionKind", "selectedAppointmentPackageId"];
|
|
2
|
+
export declare const BOOKING_FORM_DATA_RESERVED_KEY_VALUES: readonly ["serviceId", "resourceId", "selectedDate", "selectedSlot", "discountCode", "selectedSlidingAmountInput", "selectedCollectionOptionKind", "selectedAppointmentPackageId"];
|
|
3
3
|
export type BookingFormDataReservedKey = (typeof BOOKING_FORM_DATA_RESERVED_KEY_VALUES)[number];
|
|
4
4
|
export type BookingReservedFieldCollision = Readonly<{
|
|
5
5
|
fieldId: BookingFormDataReservedKey;
|
|
@@ -61,12 +61,21 @@ type BlockBookingPaymentTermsAvailability = Readonly<{
|
|
|
61
61
|
paymentTerms: BlockBookingPaymentTerms;
|
|
62
62
|
reason: "online_payment_configured_before_launch";
|
|
63
63
|
}>;
|
|
64
|
+
export type BookingFormServicePricing = Readonly<{
|
|
65
|
+
pricingStrategy: "free" | "single" | "tiered" | "sliding_scale";
|
|
66
|
+
currency: string;
|
|
67
|
+
singlePriceAmount?: number | null;
|
|
68
|
+
slidingMinAmount?: number | null;
|
|
69
|
+
slidingMaxAmount?: number | null;
|
|
70
|
+
slidingSuggestedAmount?: number | null;
|
|
71
|
+
}>;
|
|
64
72
|
export type BookingFormService = Readonly<{
|
|
65
73
|
id: string;
|
|
66
74
|
siteId: string;
|
|
67
75
|
title: string;
|
|
68
76
|
description?: string;
|
|
69
77
|
durationMinutes?: number;
|
|
78
|
+
pricing?: BookingFormServicePricing;
|
|
70
79
|
priceAmount?: number | null;
|
|
71
80
|
priceCurrency?: string | null;
|
|
72
81
|
paymentTerms?: BlockBookingPaymentTerms;
|
|
@@ -85,6 +94,7 @@ export type BookingFormData<TCustomFieldId extends string = never> = Readonly<{
|
|
|
85
94
|
selectedDate?: string;
|
|
86
95
|
selectedSlot?: string;
|
|
87
96
|
discountCode?: string;
|
|
97
|
+
selectedSlidingAmountInput?: string;
|
|
88
98
|
selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
|
|
89
99
|
selectedAppointmentPackageId?: string;
|
|
90
100
|
}> & BookingCustomFieldData<TCustomFieldId>;
|
|
@@ -101,6 +111,7 @@ type BookingSubmissionCommon = Readonly<{
|
|
|
101
111
|
export type BookingSubmissionData = (BookingSubmissionCommon & Readonly<{
|
|
102
112
|
kind: "standard";
|
|
103
113
|
discountCode?: string;
|
|
114
|
+
selectedSlidingAmount?: number;
|
|
104
115
|
selectedCollectionOptionKind?: BookingSelectedCollectionOptionKind;
|
|
105
116
|
altchaSolution?: string | null;
|
|
106
117
|
successUrl?: string;
|
|
@@ -111,6 +122,12 @@ export type BookingSubmissionData = (BookingSubmissionCommon & Readonly<{
|
|
|
111
122
|
}>);
|
|
112
123
|
export type BookingPaymentStepMode = "hidden" | "disclosure_only" | "choice_required" | "unsupported";
|
|
113
124
|
type BookingPaymentSelectionMode = "implicit_upfront" | "implicit_deferred_manual" | "implicit_instalment_plan" | "implicit_flexible_balance" | "choice_required" | "pending_stripe_setup" | "unsupported";
|
|
125
|
+
export type BookingServiceSlidingScale = Readonly<{
|
|
126
|
+
minAmount: number;
|
|
127
|
+
maxAmount: number;
|
|
128
|
+
suggestedAmount: number | null;
|
|
129
|
+
currency: string;
|
|
130
|
+
}>;
|
|
114
131
|
export type BookingPaymentStepResolution = Readonly<{
|
|
115
132
|
mode: BookingPaymentStepMode;
|
|
116
133
|
service: BookingFormService | null;
|
|
@@ -169,6 +186,14 @@ export type BookingSubmissionPreparationError = Readonly<{
|
|
|
169
186
|
tag: "payment-option-required";
|
|
170
187
|
serviceId: string;
|
|
171
188
|
serviceTitle: string;
|
|
189
|
+
}> | Readonly<{
|
|
190
|
+
tag: "sliding-amount-required";
|
|
191
|
+
serviceId: string;
|
|
192
|
+
serviceTitle: string;
|
|
193
|
+
}> | Readonly<{
|
|
194
|
+
tag: "sliding-amount-out-of-range";
|
|
195
|
+
serviceId: string;
|
|
196
|
+
serviceTitle: string;
|
|
172
197
|
}> | Readonly<{
|
|
173
198
|
tag: "payment-option-unsupported";
|
|
174
199
|
serviceId: string;
|
|
@@ -206,6 +231,10 @@ export declare function resolveBookingSiteId(siteId: string | undefined, form: B
|
|
|
206
231
|
export declare function normalizeBookingFormConfig(form: unknown): BookingFormConfig | null;
|
|
207
232
|
export declare function normalizeBookingServices(services: unknown): readonly BookingFormService[];
|
|
208
233
|
export declare function toSelectedCollectionOptionKind(value: unknown): BookingSelectedCollectionOptionKind | undefined;
|
|
234
|
+
export declare function getBookingServiceSlidingScale(service: BookingFormService | null | undefined): BookingServiceSlidingScale | null;
|
|
235
|
+
export declare function parseBookingCurrencyInputToCents(value: string | undefined): number | null;
|
|
236
|
+
export declare function formatBookingCentsAsCurrencyInput(amount: number): string;
|
|
237
|
+
export declare function isBookingServiceSlidingAmountInRange(slidingScale: BookingServiceSlidingScale, selectedAmount: number | null): selectedAmount is number;
|
|
209
238
|
export declare function getBookingServicePaymentSelectionMode(service: BookingFormService | undefined): BookingPaymentSelectionMode;
|
|
210
239
|
export declare function resolveDefaultBookingServiceId(formConfig: BookingFormConfig | null | undefined, services: readonly BookingFormService[]): string | null;
|
|
211
240
|
export declare function resolveBookingSelectedService(input: Readonly<{
|
|
@@ -91,6 +91,7 @@ export type AppointmentBookingServiceSourceInput = Readonly<{
|
|
|
91
91
|
title: string;
|
|
92
92
|
description?: string | null;
|
|
93
93
|
durationMinutes?: number;
|
|
94
|
+
pricing?: BookingFormService["pricing"];
|
|
94
95
|
priceAmount?: number | null;
|
|
95
96
|
priceCurrency?: string | null;
|
|
96
97
|
paymentTerms?: BookingFormService["paymentTerms"];
|
|
@@ -27,6 +27,12 @@ interface CoursePricingSelectorProps {
|
|
|
27
27
|
onSelect: (pricingOptionId: string) => void;
|
|
28
28
|
}
|
|
29
29
|
export declare function CoursePricingSelector({ pricing, selectedPricingOptionId, onSelect, }: CoursePricingSelectorProps): React.JSX.Element | null;
|
|
30
|
+
interface CourseSlidingScaleInputProps {
|
|
31
|
+
pricing: ResolvedCoursePricingState;
|
|
32
|
+
value: string;
|
|
33
|
+
onChange: (value: string) => void;
|
|
34
|
+
}
|
|
35
|
+
export declare function CourseSlidingScaleInput({ pricing, value, onChange, }: CourseSlidingScaleInputProps): React.JSX.Element | null;
|
|
30
36
|
interface EnrollmentFormProps {
|
|
31
37
|
formData: FormData;
|
|
32
38
|
errors: Partial<Record<keyof FormData, string>>;
|
|
@@ -10,12 +10,20 @@ export declare function useCourseRegistrationWizard(props: CourseRegistrationCli
|
|
|
10
10
|
selectedCourse: PublicCourse | null;
|
|
11
11
|
selectedPricingOptionId: string | null;
|
|
12
12
|
setSelectedPricingOptionId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
13
|
+
selectedSlidingAmountInput: string;
|
|
14
|
+
setSelectedSlidingAmountInput: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
13
15
|
selectedCoursePricing: Readonly<{
|
|
14
16
|
currency: string;
|
|
15
17
|
display: import("../../../blocks/courses/shared").CoursePriceDisplay;
|
|
16
18
|
selectableOptions: readonly import("../../../blocks/courses/shared").CoursePricingOption[];
|
|
17
19
|
requiresSelection: boolean;
|
|
18
20
|
selectedOption: import("../../../blocks/courses/shared").CoursePricingOption | null;
|
|
21
|
+
slidingScale: Readonly<{
|
|
22
|
+
minAmount: number;
|
|
23
|
+
maxAmount: number;
|
|
24
|
+
suggestedAmount: number | null;
|
|
25
|
+
}> | null;
|
|
26
|
+
selectedSlidingAmount: number | null;
|
|
19
27
|
selectedPriceAmount: number | null;
|
|
20
28
|
selectedRequiresPayment: boolean;
|
|
21
29
|
hasPaidSelection: boolean;
|
package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/TicketSelectionStep.d.ts
CHANGED
|
@@ -9,6 +9,14 @@ type TicketSelectionStepProps = {
|
|
|
9
9
|
maxTickets: number;
|
|
10
10
|
selectedTicketTypeId?: string | null;
|
|
11
11
|
onTicketTypeChange?: (ticketTypeId: string) => void;
|
|
12
|
+
slidingScale?: Readonly<{
|
|
13
|
+
minAmount: number;
|
|
14
|
+
maxAmount: number;
|
|
15
|
+
suggestedAmount: number | null;
|
|
16
|
+
}> | null;
|
|
17
|
+
selectedSlidingAmountInput?: string;
|
|
18
|
+
slidingScaleSelectionMessage?: string | null;
|
|
19
|
+
onSlidingAmountChange?: (amount: string) => void;
|
|
12
20
|
onTicketsChange: (count: number) => void;
|
|
13
21
|
};
|
|
14
22
|
/**
|
|
@@ -41,6 +41,7 @@ export declare function useEligibility(params: {
|
|
|
41
41
|
occurrenceId: string;
|
|
42
42
|
attendanceMode?: 'in_person' | 'online' | null;
|
|
43
43
|
ticketTypeId: string | null;
|
|
44
|
+
selectedSlidingAmount?: number | null;
|
|
44
45
|
email: string;
|
|
45
46
|
ticketsCount: number;
|
|
46
47
|
}): UseEligibilityResult;
|
|
@@ -43,7 +43,7 @@ export type EligibilityData = {
|
|
|
43
43
|
/** Whether the selected event/ticket type currently requires payment. */
|
|
44
44
|
requiresPayment: boolean;
|
|
45
45
|
/** Persisted pricing mode for the underlying event series. */
|
|
46
|
-
pricingMode?: 'single' | 'ticket_types';
|
|
46
|
+
pricingMode?: 'single' | 'ticket_types' | 'sliding_scale';
|
|
47
47
|
/** Selected ticket type echoed back from the eligibility API, if any. */
|
|
48
48
|
selectedTicketTypeId?: string | null;
|
|
49
49
|
/** Public ticket types available for selection in ticket-type mode. */
|
package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare function useEventRegistrationSubmit(options: {
|
|
|
26
26
|
registrationTarget: RegistrationTarget | null;
|
|
27
27
|
selectedAttendanceMode: 'in_person' | 'online' | null;
|
|
28
28
|
selectedTicketTypeId: string | null;
|
|
29
|
+
selectedSlidingAmount: number | null;
|
|
29
30
|
ticketsCount: number;
|
|
30
31
|
formData: FormData;
|
|
31
32
|
altchaSolution: string | null;
|
package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts
CHANGED
|
@@ -50,6 +50,15 @@ export declare function useEventRegistrationWizard(options: {
|
|
|
50
50
|
setSelectedAttendanceMode: import("react").Dispatch<import("react").SetStateAction<"in_person" | "online" | null>>;
|
|
51
51
|
selectedTicketTypeId: string | null;
|
|
52
52
|
setSelectedTicketTypeId: import("react").Dispatch<import("react").SetStateAction<string | null>>;
|
|
53
|
+
selectedSlidingAmountInput: string;
|
|
54
|
+
setSelectedSlidingAmountInput: import("react").Dispatch<import("react").SetStateAction<string>>;
|
|
55
|
+
selectedSlidingAmount: number | null;
|
|
56
|
+
selectedEventSlidingScale: Readonly<{
|
|
57
|
+
minAmount: number;
|
|
58
|
+
maxAmount: number;
|
|
59
|
+
suggestedAmount: number | null;
|
|
60
|
+
}> | null;
|
|
61
|
+
slidingScaleSelectionMessage: string | null;
|
|
53
62
|
selectedTicketType: import("./utils").SelectableEventTicketType | null;
|
|
54
63
|
visibleTicketTypes: import("./utils").SelectableEventTicketType[];
|
|
55
64
|
ticketTypeSelectionRequired: boolean;
|
|
@@ -6,6 +6,8 @@ type Brand<TValue, TBrand extends string> = TValue & {
|
|
|
6
6
|
export type SlotKey = Brand<string, 'SlotKey'>;
|
|
7
7
|
export type EntryBlockSlotId = Brand<string, 'EntryBlockSlotId'>;
|
|
8
8
|
export type EntrySlotContentEntryId = Brand<string, 'EntrySlotContentEntryId'>;
|
|
9
|
+
export type EntrySlotPageSurfaceId = Brand<string, 'EntrySlotPageSurfaceId'>;
|
|
10
|
+
export type PageSurfaceSlotId = Brand<string, 'PageSurfaceSlotId'>;
|
|
9
11
|
export type EntrySlotPageId = Brand<string, 'EntrySlotPageId'>;
|
|
10
12
|
export type EntrySlotBlockId = Brand<string, 'EntrySlotBlockId'>;
|
|
11
13
|
export type EntrySlotContentVersionId = Brand<string, 'EntrySlotContentVersionId'>;
|
|
@@ -41,12 +43,16 @@ export type NonEmptyStringParseError = Readonly<{
|
|
|
41
43
|
export declare function unsafeAsSlotKey(value: string): SlotKey;
|
|
42
44
|
export declare function unsafeAsEntryBlockSlotId(value: string): EntryBlockSlotId;
|
|
43
45
|
export declare function unsafeAsEntrySlotContentEntryId(value: string): EntrySlotContentEntryId;
|
|
46
|
+
export declare function unsafeAsEntrySlotPageSurfaceId(value: string): EntrySlotPageSurfaceId;
|
|
47
|
+
export declare function unsafeAsPageSurfaceSlotId(value: string): PageSurfaceSlotId;
|
|
44
48
|
export declare function unsafeAsEntrySlotPageId(value: string): EntrySlotPageId;
|
|
45
49
|
export declare function unsafeAsEntrySlotBlockId(value: string): EntrySlotBlockId;
|
|
46
50
|
export declare function unsafeAsEntrySlotContentVersionId(value: string): EntrySlotContentVersionId;
|
|
47
51
|
export declare function unsafeAsEntrySlotBlockOrderIndex(value: number): EntrySlotBlockOrderIndex;
|
|
48
52
|
export declare function parseSlotKey(value: unknown): EntrySlotResult<SlotKey, SlotKeyParseError>;
|
|
49
53
|
export declare function parseEntryBlockSlotId(value: unknown): EntrySlotResult<EntryBlockSlotId, BrandedUuidParseError>;
|
|
54
|
+
export declare function parseEntrySlotPageSurfaceId(value: unknown): EntrySlotResult<EntrySlotPageSurfaceId, BrandedUuidParseError>;
|
|
55
|
+
export declare function parsePageSurfaceSlotId(value: unknown): EntrySlotResult<PageSurfaceSlotId, BrandedUuidParseError>;
|
|
50
56
|
export declare const SYSTEM_ENTRY_SLOT_BLOCK_KIND: "system.entry-slot";
|
|
51
57
|
export declare const DEFAULT_ENTRY_SLOT_ALLOWED_BLOCKS: readonly ["block.body-text", "block.rich-text", "block.image-gallery", "block.cta-full"];
|
|
52
58
|
export type DefaultEntrySlotBlockKind = (typeof DEFAULT_ENTRY_SLOT_ALLOWED_BLOCKS)[number];
|
|
@@ -210,6 +216,33 @@ export type PublishedEntrySlotCompositionVersionDataV1 = Readonly<{
|
|
|
210
216
|
blockSequence: readonly PublishedEntrySlotBlockSnapshot[];
|
|
211
217
|
}>;
|
|
212
218
|
export type EntrySlotCompositionVersionDataV1 = DraftEntrySlotCompositionVersionDataV1 | PublishedEntrySlotCompositionVersionDataV1;
|
|
219
|
+
export type EntrySlotCompositionOwner = Readonly<{
|
|
220
|
+
kind: 'entrySlot';
|
|
221
|
+
entrySlotId: EntryBlockSlotId;
|
|
222
|
+
contentEntryId: EntrySlotContentEntryId;
|
|
223
|
+
}>;
|
|
224
|
+
export type SurfaceSlotCompositionOwner = Readonly<{
|
|
225
|
+
kind: 'surfaceSlot';
|
|
226
|
+
surfaceSlotId: PageSurfaceSlotId;
|
|
227
|
+
pageSurfaceId: EntrySlotPageSurfaceId;
|
|
228
|
+
}>;
|
|
229
|
+
export type SlotCompositionOwner = EntrySlotCompositionOwner | SurfaceSlotCompositionOwner;
|
|
230
|
+
export type DraftSlotCompositionVersionDataV2 = Readonly<{
|
|
231
|
+
schemaVersion: 2;
|
|
232
|
+
stage: 'draft';
|
|
233
|
+
owner: SlotCompositionOwner;
|
|
234
|
+
slotKey: SlotKey;
|
|
235
|
+
blockSequence: readonly EntrySlotBlockSnapshot[];
|
|
236
|
+
}>;
|
|
237
|
+
export type PublishedSlotCompositionVersionDataV2 = Readonly<{
|
|
238
|
+
schemaVersion: 2;
|
|
239
|
+
stage: 'published';
|
|
240
|
+
owner: SlotCompositionOwner;
|
|
241
|
+
slotKey: SlotKey;
|
|
242
|
+
blockSequence: readonly PublishedEntrySlotBlockSnapshot[];
|
|
243
|
+
}>;
|
|
244
|
+
export type SlotCompositionVersionDataV2 = DraftSlotCompositionVersionDataV2 | PublishedSlotCompositionVersionDataV2;
|
|
245
|
+
export type SlotCompositionVersionData = EntrySlotCompositionVersionDataV1 | SlotCompositionVersionDataV2;
|
|
213
246
|
export type PublishedEntrySlotCompositionBuildError = Readonly<{
|
|
214
247
|
kind: 'published-composition-contains-unpublished-block';
|
|
215
248
|
blockId: EntrySlotBlockId;
|
|
@@ -221,12 +254,23 @@ export declare function buildDraftEntrySlotCompositionVersionData(input: {
|
|
|
221
254
|
slotKey: SlotKey;
|
|
222
255
|
blockSequence: readonly EntrySlotBlockSnapshot[];
|
|
223
256
|
}): DraftEntrySlotCompositionVersionDataV1;
|
|
257
|
+
export declare function entrySlotCompositionOwnerFromV1(versionData: EntrySlotCompositionVersionDataV1): EntrySlotCompositionOwner;
|
|
258
|
+
export declare function buildDraftSlotCompositionVersionData(input: {
|
|
259
|
+
owner: SlotCompositionOwner;
|
|
260
|
+
slotKey: SlotKey;
|
|
261
|
+
blockSequence: readonly EntrySlotBlockSnapshot[];
|
|
262
|
+
}): DraftSlotCompositionVersionDataV2;
|
|
224
263
|
export declare function buildPublishedEntrySlotCompositionVersionData(input: {
|
|
225
264
|
entrySlotId: EntryBlockSlotId;
|
|
226
265
|
contentEntryId: EntrySlotContentEntryId;
|
|
227
266
|
slotKey: SlotKey;
|
|
228
267
|
blockSequence: readonly EntrySlotBlockSnapshot[];
|
|
229
268
|
}): EntrySlotResult<PublishedEntrySlotCompositionVersionDataV1, PublishedEntrySlotCompositionBuildError>;
|
|
269
|
+
export declare function buildPublishedSlotCompositionVersionData(input: {
|
|
270
|
+
owner: SlotCompositionOwner;
|
|
271
|
+
slotKey: SlotKey;
|
|
272
|
+
blockSequence: readonly EntrySlotBlockSnapshot[];
|
|
273
|
+
}): EntrySlotResult<PublishedSlotCompositionVersionDataV2, PublishedEntrySlotCompositionBuildError>;
|
|
230
274
|
export type EntrySlotCompositionParseError = Readonly<{
|
|
231
275
|
kind: 'not-object';
|
|
232
276
|
}> | Readonly<{
|
|
@@ -253,8 +297,33 @@ export type EntrySlotCompositionParseError = Readonly<{
|
|
|
253
297
|
kind: 'published-composition-contains-unpublished-block';
|
|
254
298
|
index: number;
|
|
255
299
|
}>;
|
|
300
|
+
export type SlotCompositionOwnerParseError = Readonly<{
|
|
301
|
+
kind: 'not-object';
|
|
302
|
+
}> | Readonly<{
|
|
303
|
+
kind: 'unsupported-owner-kind';
|
|
304
|
+
ownerKind: unknown;
|
|
305
|
+
}> | Readonly<{
|
|
306
|
+
kind: 'invalid-entry-slot-id';
|
|
307
|
+
error: BrandedUuidParseError | NonEmptyStringParseError;
|
|
308
|
+
}> | Readonly<{
|
|
309
|
+
kind: 'invalid-content-entry-id';
|
|
310
|
+
error: NonEmptyStringParseError;
|
|
311
|
+
}> | Readonly<{
|
|
312
|
+
kind: 'invalid-surface-slot-id';
|
|
313
|
+
error: BrandedUuidParseError;
|
|
314
|
+
}> | Readonly<{
|
|
315
|
+
kind: 'invalid-page-surface-id';
|
|
316
|
+
error: BrandedUuidParseError;
|
|
317
|
+
}>;
|
|
318
|
+
export type SlotCompositionParseError = EntrySlotCompositionParseError | Readonly<{
|
|
319
|
+
kind: 'invalid-owner';
|
|
320
|
+
error: SlotCompositionOwnerParseError;
|
|
321
|
+
}>;
|
|
256
322
|
export declare function parseEntrySlotCompositionVersionData(input: unknown): EntrySlotResult<EntrySlotCompositionVersionDataV1, EntrySlotCompositionParseError>;
|
|
323
|
+
export declare function parseSlotCompositionVersionData(input: unknown): EntrySlotResult<SlotCompositionVersionData, SlotCompositionParseError>;
|
|
324
|
+
export declare function parseSlotCompositionOwner(input: unknown): EntrySlotResult<SlotCompositionOwner, SlotCompositionOwnerParseError>;
|
|
257
325
|
export declare function blockContentVersionIdsForEntrySlotCompositionVersionData(versionData: EntrySlotCompositionVersionDataV1): readonly EntrySlotContentVersionId[];
|
|
326
|
+
export declare function blockContentVersionIdsForSlotCompositionVersionData(versionData: SlotCompositionVersionData): readonly EntrySlotContentVersionId[];
|
|
258
327
|
export type SlotPublishPlan = Readonly<{
|
|
259
328
|
kind: 'publishable';
|
|
260
329
|
slotKey: SlotKey;
|
|
@@ -330,6 +399,15 @@ export declare function describeSdkEntryBlocksPatchParseError(error: SdkEntryBlo
|
|
|
330
399
|
export type SlotContainerOwner = Readonly<{
|
|
331
400
|
kind: 'contentEntry';
|
|
332
401
|
contentEntryId: EntrySlotContentEntryId;
|
|
402
|
+
}> | Readonly<{
|
|
403
|
+
kind: 'pageSurface';
|
|
404
|
+
pageSurfaceId: EntrySlotPageSurfaceId;
|
|
405
|
+
}>;
|
|
406
|
+
export type ContentEntrySlotContainerOwner = Extract<SlotContainerOwner, {
|
|
407
|
+
kind: 'contentEntry';
|
|
408
|
+
}>;
|
|
409
|
+
export type PageSurfaceSlotContainerOwner = Extract<SlotContainerOwner, {
|
|
410
|
+
kind: 'pageSurface';
|
|
333
411
|
}>;
|
|
334
412
|
export type SlotContainerOwnerParseError = Readonly<{
|
|
335
413
|
kind: 'not-object';
|
|
@@ -339,10 +417,13 @@ export type SlotContainerOwnerParseError = Readonly<{
|
|
|
339
417
|
}> | Readonly<{
|
|
340
418
|
kind: 'invalid-content-entry-id';
|
|
341
419
|
error: NonEmptyStringParseError;
|
|
420
|
+
}> | Readonly<{
|
|
421
|
+
kind: 'invalid-page-surface-id';
|
|
422
|
+
error: BrandedUuidParseError;
|
|
342
423
|
}>;
|
|
343
424
|
export declare function parseSlotContainerOwner(input: unknown): EntrySlotResult<SlotContainerOwner, SlotContainerOwnerParseError>;
|
|
344
|
-
export declare function slotContainerOwnerToContentVersionOwner(owner:
|
|
345
|
-
export declare function slotContainerOwnerToEntrySlotLookup(owner:
|
|
425
|
+
export declare function slotContainerOwnerToContentVersionOwner(owner: ContentEntrySlotContainerOwner): ContentVersionOwner;
|
|
426
|
+
export declare function slotContainerOwnerToEntrySlotLookup(owner: ContentEntrySlotContainerOwner): Readonly<{
|
|
346
427
|
contentEntryId: EntrySlotContentEntryId;
|
|
347
428
|
}>;
|
|
348
429
|
export type PlannedSlotCompositionBlockWrite = Readonly<{
|
|
@@ -401,6 +482,33 @@ export type EditableBlockOwner = Readonly<{
|
|
|
401
482
|
kind: 'entry-slot';
|
|
402
483
|
entrySlotId: EntryBlockSlotId;
|
|
403
484
|
}>;
|
|
485
|
+
export type SlotCompositionTransferReviewReason = Readonly<{
|
|
486
|
+
kind: 'target-is-not-surface-slot';
|
|
487
|
+
targetKind: SlotCompositionOwner['kind'];
|
|
488
|
+
}>;
|
|
489
|
+
export type SlotCompositionTransferPlan = Readonly<{
|
|
490
|
+
kind: 'noChange';
|
|
491
|
+
owner: SlotCompositionOwner;
|
|
492
|
+
slotKey: SlotKey;
|
|
493
|
+
}> | Readonly<{
|
|
494
|
+
kind: 'copyEntrySlotToSurfaceSlot';
|
|
495
|
+
from: EntrySlotCompositionOwner;
|
|
496
|
+
to: SurfaceSlotCompositionOwner;
|
|
497
|
+
slotKey: SlotKey;
|
|
498
|
+
}> | Readonly<{
|
|
499
|
+
kind: 'forkSurfaceSlotComposition';
|
|
500
|
+
from: SurfaceSlotCompositionOwner;
|
|
501
|
+
to: SurfaceSlotCompositionOwner;
|
|
502
|
+
slotKey: SlotKey;
|
|
503
|
+
}> | Readonly<{
|
|
504
|
+
kind: 'manualReviewRequired';
|
|
505
|
+
reason: SlotCompositionTransferReviewReason;
|
|
506
|
+
}>;
|
|
507
|
+
export declare function planSlotCompositionTransfer(input: Readonly<{
|
|
508
|
+
from: SlotCompositionOwner;
|
|
509
|
+
to: SlotCompositionOwner;
|
|
510
|
+
slotKey: SlotKey;
|
|
511
|
+
}>): SlotCompositionTransferPlan;
|
|
404
512
|
export type EntryLifecycleRecoveryCheckpoint = 'entry-fields' | 'route-metadata' | 'slot-composition' | 'block-published-refs' | 'cache-revalidation';
|
|
405
513
|
export type EntryLifecycleCommitPlan = Readonly<{
|
|
406
514
|
kind: 'transactional-commit';
|
|
@@ -28,6 +28,7 @@ export type SiteRouteId = Brand<string, 'SiteRouteId'>;
|
|
|
28
28
|
export type PageId = Brand<string, 'PageId'>;
|
|
29
29
|
export type PageSurfaceId = Brand<string, 'PageSurfaceId'>;
|
|
30
30
|
export type OccurrenceId = Brand<string, 'OccurrenceId'>;
|
|
31
|
+
export type EventOfferingId = Brand<string, 'EventOfferingId'>;
|
|
31
32
|
export type EventSeriesId = Brand<string, 'EventSeriesId'>;
|
|
32
33
|
export type TicketTypeId = Brand<string, 'TicketTypeId'>;
|
|
33
34
|
export type EventCategoryId = Brand<string, 'EventCategoryId'>;
|
|
@@ -143,6 +144,7 @@ export declare const unsafeAsSiteRouteId: (id: string) => SiteRouteId;
|
|
|
143
144
|
export declare const unsafeAsPageId: (id: string) => PageId;
|
|
144
145
|
export declare const unsafeAsPageSurfaceId: (id: string) => PageSurfaceId;
|
|
145
146
|
export declare const unsafeAsOccurrenceId: (id: string) => OccurrenceId;
|
|
147
|
+
export declare const unsafeAsEventOfferingId: (id: string) => EventOfferingId;
|
|
146
148
|
export declare const unsafeAsEventSeriesId: (id: string) => EventSeriesId;
|
|
147
149
|
export declare const unsafeAsTicketTypeId: (id: string) => TicketTypeId;
|
|
148
150
|
export declare const unsafeAsEventCategoryId: (id: string) => EventCategoryId;
|
|
@@ -232,6 +234,7 @@ export declare const parseSiteRouteId: (value: unknown) => Result<SiteRouteId, B
|
|
|
232
234
|
export declare const parsePageId: (value: unknown) => Result<PageId, BrandedIdParseError>;
|
|
233
235
|
export declare const parsePageSurfaceId: (value: unknown) => Result<PageSurfaceId, BrandedIdParseError>;
|
|
234
236
|
export declare const parseOccurrenceId: (value: unknown) => Result<OccurrenceId, BrandedIdParseError>;
|
|
237
|
+
export declare const parseEventOfferingId: (value: unknown) => Result<EventOfferingId, BrandedIdParseError>;
|
|
235
238
|
export declare const parseTicketTypeId: (value: unknown) => Result<TicketTypeId, BrandedIdParseError>;
|
|
236
239
|
export declare const parsePricingOptionId: (value: unknown) => Result<PricingOptionId, BrandedIdParseError>;
|
|
237
240
|
export declare const parseUserId: (value: unknown) => Result<UserId, BrandedIdParseError>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CurrencyDecimals } from "./currency-format";
|
|
2
|
-
export declare const EVENT_PRICING_MODES: readonly ["single", "ticket_types"];
|
|
2
|
+
export declare const EVENT_PRICING_MODES: readonly ["single", "ticket_types", "sliding_scale"];
|
|
3
3
|
export type EventPricingMode = (typeof EVENT_PRICING_MODES)[number];
|
|
4
4
|
export type PublicEventPricingType = "free" | "paid" | "external";
|
|
5
5
|
export type PublicCoursePriceDisplay = Readonly<{
|
|
@@ -13,6 +13,11 @@ export type PublicCoursePriceDisplay = Readonly<{
|
|
|
13
13
|
kind: "from";
|
|
14
14
|
amount: number;
|
|
15
15
|
currency: string;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
kind: "range";
|
|
18
|
+
minAmount: number;
|
|
19
|
+
maxAmount: number;
|
|
20
|
+
currency: string;
|
|
16
21
|
}> | Readonly<{
|
|
17
22
|
kind: "unavailable";
|
|
18
23
|
currency: string;
|
|
@@ -70,6 +75,18 @@ export type PublicEventPricing<TTicketType = never> = Readonly<{
|
|
|
70
75
|
currency: string;
|
|
71
76
|
ticketTypes: readonly TTicketType[];
|
|
72
77
|
display: PublicEventTicketTypePriceDisplay;
|
|
78
|
+
}> | Readonly<{
|
|
79
|
+
kind: "sliding_scale";
|
|
80
|
+
minAmount: number;
|
|
81
|
+
maxAmount: number;
|
|
82
|
+
suggestedAmount: number | null;
|
|
83
|
+
currency: string;
|
|
84
|
+
display: Readonly<{
|
|
85
|
+
kind: "range";
|
|
86
|
+
minAmount: number;
|
|
87
|
+
maxAmount: number;
|
|
88
|
+
currency: string;
|
|
89
|
+
}>;
|
|
73
90
|
}> | Readonly<{
|
|
74
91
|
kind: "course";
|
|
75
92
|
display: Readonly<{
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Brand } from './branded';
|
|
2
2
|
import { type Result } from './result';
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
3
|
+
export type Cents = Brand<number, 'Cents'>;
|
|
4
|
+
export type NonNegativeCents = Brand<number, 'NonNegativeCents'>;
|
|
5
|
+
export type PositiveCents = Brand<number, 'PositiveCents'>;
|
|
5
6
|
export type MoneyInputParseError = Readonly<{
|
|
6
7
|
kind: 'empty';
|
|
7
8
|
}> | Readonly<{
|
|
@@ -11,6 +12,15 @@ export type MoneyInputParseError = Readonly<{
|
|
|
11
12
|
}> | Readonly<{
|
|
12
13
|
kind: 'zero-not-allowed';
|
|
13
14
|
}>;
|
|
15
|
+
export type CentsParseError = Readonly<{
|
|
16
|
+
kind: 'invalid-number';
|
|
17
|
+
}> | Readonly<{
|
|
18
|
+
kind: 'not-whole-cents';
|
|
19
|
+
}> | Readonly<{
|
|
20
|
+
kind: 'negative';
|
|
21
|
+
}> | Readonly<{
|
|
22
|
+
kind: 'zero-not-allowed';
|
|
23
|
+
}>;
|
|
14
24
|
export type ParseMoneyInputToCentsOptions = Readonly<{
|
|
15
25
|
allowZero?: boolean;
|
|
16
26
|
stripFormatting?: boolean;
|
|
@@ -18,7 +28,27 @@ export type ParseMoneyInputToCentsOptions = Readonly<{
|
|
|
18
28
|
export type ParseStrictMoneyInputToCentsOptions = Readonly<{
|
|
19
29
|
stripFormatting?: boolean;
|
|
20
30
|
}>;
|
|
21
|
-
export declare function
|
|
22
|
-
export declare function
|
|
31
|
+
export declare function unsafeAsCents(value: number): Cents;
|
|
32
|
+
export declare function unsafeAsNonNegativeCents(value: number): NonNegativeCents;
|
|
33
|
+
export declare function unsafeAsPositiveCents(value: number): PositiveCents;
|
|
34
|
+
export declare function unwrapCents(value: Cents): number;
|
|
35
|
+
export declare function isWholeCents(value: number): boolean;
|
|
36
|
+
export declare function isNonNegativeWholeCents(value: number): boolean;
|
|
37
|
+
export declare function isPositiveWholeCents(value: number): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Normalizes a derived amount to signed whole cents. Use parse*Cents for
|
|
40
|
+
* untrusted input that should fail instead of truncating or clamping.
|
|
41
|
+
*/
|
|
42
|
+
export declare function toCents(value: number): Cents;
|
|
43
|
+
/**
|
|
44
|
+
* Normalizes a derived amount to non-negative whole cents. This intentionally
|
|
45
|
+
* clamps negatives to zero; use parseNonNegativeCents for validation.
|
|
46
|
+
*/
|
|
47
|
+
export declare function toNonNegativeCents(value: number): NonNegativeCents;
|
|
48
|
+
export declare function parseCents(value: number): Result<Cents, CentsParseError>;
|
|
49
|
+
export declare function parseNonNegativeCents(value: number): Result<NonNegativeCents, CentsParseError>;
|
|
50
|
+
export declare function parsePositiveCents(value: number): Result<PositiveCents, CentsParseError>;
|
|
51
|
+
export declare function parsePositiveMoneyInputToCents(value: string, options?: ParseStrictMoneyInputToCentsOptions): Result<PositiveCents, MoneyInputParseError>;
|
|
52
|
+
export declare function parseNonNegativeMoneyInputToCents(value: string, options?: ParseStrictMoneyInputToCentsOptions): Result<NonNegativeCents, MoneyInputParseError>;
|
|
23
53
|
export declare function parseMoneyInputToCents(value: string, options?: ParseMoneyInputToCentsOptions): number | null;
|
|
24
54
|
export declare function formatMoneyInputFromCents(amountCents: number | null | undefined): string;
|