@riverbankcms/sdk 0.148.0 → 0.149.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.
Files changed (154) hide show
  1. package/README.md +1 -1
  2. package/dist/{PreviewEditorSidebar-DvEPG3Z2.mjs → PreviewEditorSidebar-DBKln68M.mjs} +103 -66
  3. package/dist/{PreviewEditorUI-D6eb6fkx.mjs → PreviewEditorUI-DpRX4Mum.mjs} +3 -6
  4. package/dist/{PreviewQueryProvider-5znTyJuz.mjs → PreviewQueryProvider-C0mndwHB.mjs} +3 -3
  5. package/dist/{SdkPreviewModeRuntime-DJ6utQ_R.mjs → SdkPreviewModeRuntime-DJPmPY-r.mjs} +95 -67
  6. package/dist/{SiteChromeCustomizeContext-CFJYh6vo.mjs → SiteChromeCustomizeContext-JYA0cJ_Z.mjs} +982 -734
  7. package/dist/_dts/api/src/bookingConfig.d.ts +33 -48
  8. package/dist/_dts/api/src/bookingManagementEndpoints.d.ts +2 -6
  9. package/dist/_dts/api/src/bookingOperations.d.ts +5 -7
  10. package/dist/_dts/api/src/bookingRecords.d.ts +15 -11
  11. package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +5 -5
  12. package/dist/_dts/api/src/clientErrorReporting.d.ts +11 -0
  13. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +0 -2
  14. package/dist/_dts/api/src/common/cancellation.d.ts +23 -0
  15. package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +1 -1
  16. package/dist/_dts/api/src/endpoints.d.ts +2 -10
  17. package/dist/_dts/api/src/eventManagementContracts.d.ts +4 -7
  18. package/dist/_dts/api/src/index.d.ts +3 -3
  19. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +2 -2
  20. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +2 -29
  21. package/dist/_dts/api/src/request.d.ts +1 -1
  22. package/dist/_dts/api/src/sdk-event-upsert.d.ts +1 -1
  23. package/dist/_dts/api/src/sdkPullEventContracts.d.ts +1 -1
  24. package/dist/_dts/api/src/siteOperations.d.ts +6 -2
  25. package/dist/_dts/blocks/src/contracts/index.d.ts +1 -1
  26. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +2 -2
  27. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +38 -10
  28. package/dist/_dts/blocks/src/portal/types.d.ts +9 -6
  29. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +24 -24
  30. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +1 -1
  31. package/dist/_dts/blocks/src/system/blocks/shared/bookingPaymentTerms.d.ts +84 -160
  32. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +2 -2
  33. package/dist/_dts/blocks/src/system/blocks/shop.shared.d.ts +31 -4
  34. package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +2 -2
  35. package/dist/_dts/blocks/src/system/runtime/api/types/core.d.ts +3 -1
  36. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -6
  37. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -3
  38. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingNowIso.d.ts +8 -0
  39. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +2 -1
  40. package/dist/_dts/blocks/src/system/runtime/nodes/commerce/shared/display.d.ts +9 -2
  41. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +14 -2
  42. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +2 -0
  43. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.d.ts +3 -3
  44. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +4 -0
  45. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +24 -24
  46. package/dist/_dts/blocks/src/system/runtime/nodes/shop.interactive.d.ts +41 -6
  47. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +7 -2
  48. package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +54 -0
  49. package/dist/_dts/commerce/src/purchase/checkoutCommitPlan.d.ts +58 -13
  50. package/dist/_dts/commerce/src/purchase/checkoutErrorCodes.d.ts +1 -1
  51. package/dist/_dts/commerce/src/purchase/checkoutPaymentPlanPlanning.d.ts +16 -21
  52. package/dist/_dts/commerce/src/purchase/checkoutPaymentTerms.d.ts +23 -40
  53. package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +2 -2
  54. package/dist/_dts/commerce/src/purchase/checkoutStripeSessionPlanning.d.ts +5 -4
  55. package/dist/_dts/commerce/src/purchase/index.d.ts +1 -3
  56. package/dist/_dts/commerce/src/purchase/membershipOrderItemMetadata.d.ts +4 -0
  57. package/dist/_dts/commerce/src/purchase/oneTimeCheckoutPlanning.d.ts +9 -4
  58. package/dist/_dts/commerce/src/purchase/orderInstalmentClosure.d.ts +13 -1
  59. package/dist/_dts/commerce/src/purchase/orderInstalmentLifecycle.d.ts +5 -0
  60. package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +3 -1
  61. package/dist/_dts/commerce/src/purchase/orderTypes.d.ts +7 -1
  62. package/dist/_dts/commerce/src/purchase/refundRailSplit.d.ts +1 -1
  63. package/dist/_dts/commerce/src/purchase/stateTransitions.d.ts +2 -2
  64. package/dist/_dts/commerce/src/purchase/stripeMinimumCharge.d.ts +6 -0
  65. package/dist/_dts/commerce/src/purchase/types.d.ts +2 -1
  66. package/dist/_dts/content-editor/src/controller/editLeaseHandover.d.ts +30 -0
  67. package/dist/_dts/content-editor/src/lib/browserStorage.d.ts +5 -0
  68. package/dist/_dts/core/src/booking-flexible-balance.d.ts +2 -2
  69. package/dist/_dts/core/src/booking-instalment-deposit.d.ts +20 -0
  70. package/dist/_dts/core/src/booking-live-payment-terms.d.ts +72 -0
  71. package/dist/_dts/core/src/booking-payment-options.d.ts +24 -0
  72. package/dist/_dts/core/src/booking-payment-schemas.d.ts +522 -0
  73. package/dist/_dts/core/src/branded.d.ts +3 -0
  74. package/dist/_dts/core/src/edit-lease.d.ts +5 -0
  75. package/dist/_dts/core/src/index.d.ts +3 -0
  76. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +297 -36
  77. package/dist/_dts/media-editor/src/MediaPickerDialog.d.ts +3 -1
  78. package/dist/_dts/media-editor/src/MediaPickerMiniDialog.d.ts +10 -0
  79. package/dist/_dts/media-editor/src/index.d.ts +2 -0
  80. package/dist/_dts/preview-next/src/client/preview/PreviewEntryControllerProvider.d.ts +0 -1
  81. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +1 -1
  82. package/dist/_dts/preview-next/src/client/previewAuthStore.d.ts +7 -0
  83. package/dist/_dts/preview-next/src/constants.d.ts +4 -0
  84. package/dist/_dts/preview-next/src/keepAlive.d.ts +1 -0
  85. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +2 -12
  86. package/dist/_dts/sdk/src/version.d.ts +1 -1
  87. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +0 -5
  88. package/dist/_dts/ui/src/color-picker.d.ts +1 -1
  89. package/dist/_dts/ui/src/palette/useHexDraft.d.ts +7 -0
  90. package/dist/client/{BookingMailingListNote-CzRt2dF_.mjs → BookingMailingListNote-Cr3EeTP5.mjs} +408 -69
  91. package/dist/client/{DemoBookingPortalAccess-mxqwap3f.mjs → DemoBookingPortalAccess-BFGB1Fay.mjs} +2 -2
  92. package/dist/client/{EventCombined.client-CDb11igO.mjs → EventCombined.client-DKYV0_ft.mjs} +6 -6
  93. package/dist/client/{EventListing.client-EgYhzKPa.mjs → EventListing.client-B9UIcEYc.mjs} +2 -2
  94. package/dist/client/{LeafletStaticMap-gtmtaA2b.mjs → LeafletStaticMap-CFLPkP0K.mjs} +1 -1
  95. package/dist/client/{TerminalPanel-DvNUP5ot.mjs → TerminalPanel-JjmgxEsR.mjs} +1 -1
  96. package/dist/client/{ThemedButton-C7CeUJjW.mjs → ThemedButton-CKV1Jh2m.mjs} +1 -1
  97. package/dist/client/{accordion-kjvt49rA.mjs → accordion-DXWIfT3T.mjs} +1 -1
  98. package/dist/client/{bookingForm-pbRZordh.mjs → bookingForm-CjZgHNvv.mjs} +11 -8
  99. package/dist/client/bookings.mjs +424 -320
  100. package/dist/client/{carousel-f4Zbmicv.mjs → carousel-DSLikmvZ.mjs} +1 -1
  101. package/dist/client/{cart-DO20An50.mjs → cart-HDjWReFt.mjs} +3 -3
  102. package/dist/client/{checkout-Du5amDR_.mjs → checkout-CUvRZA3W.mjs} +3 -3
  103. package/dist/client/client.mjs +963 -866
  104. package/dist/client/{context-eW97E945.mjs → context-DFmaZa-Q.mjs} +1 -1
  105. package/dist/client/{dates-jPCirRea.mjs → dates-BBep1JnF.mjs} +2 -2
  106. package/dist/client/{eventCalendar-C2M-iE4j.mjs → eventCalendar-zEobhxo4.mjs} +9 -9
  107. package/dist/client/{eventCombined-W6ns3LHg.mjs → eventCombined-Dp7bz5k-.mjs} +4 -4
  108. package/dist/client/{eventDetails-CR-GT0f0.mjs → eventDetails-FE-zqTt7.mjs} +4 -4
  109. package/dist/client/{eventListing-BK8AfYZz.mjs → eventListing-BMt5snal.mjs} +4 -4
  110. package/dist/client/{eventRegistration-BJSd4KUu.mjs → eventRegistration-O6ZxHfOb.mjs} +67 -342
  111. package/dist/client/{form-BvpfbQaT.mjs → form-DFa1D8vt.mjs} +3 -3
  112. package/dist/client/{headerSection-I5sUQ8x-.mjs → headerSection-CmjHLR-N.mjs} +3 -3
  113. package/dist/client/hooks.mjs +160 -129
  114. package/dist/client/{locationMap-BLvwf9_f.mjs → locationMap-BXKP_lGh.mjs} +3 -3
  115. package/dist/client/{newsletterForm-DrQ2weE8.mjs → newsletterForm-CU-HmxGx.mjs} +3 -3
  116. package/dist/client/{pricing-BES87mrR.mjs → pricing-KEAEsibq.mjs} +1 -1
  117. package/dist/client/{productDetail-Url9jcc5.mjs → productDetail-Ckp7MGnt.mjs} +3 -3
  118. package/dist/client/{productList-DE7ngEZJ.mjs → productList-D91V0sYa.mjs} +3 -3
  119. package/dist/client/{propsDecoder-D1OtGXDV.mjs → propsDecoder-DZd6RJeA.mjs} +155 -77
  120. package/dist/client/rendering/client.mjs +3356 -3192
  121. package/dist/client/rendering/islands.mjs +17 -17
  122. package/dist/client/rendering.mjs +956 -841
  123. package/dist/client/{routeIslandApiConfig-BG9Y-SHg.mjs → routeIslandApiConfig-E1EkhhYY.mjs} +1 -1
  124. package/dist/client/{shop-CJkuySJ3.mjs → shop-4F2jLQPI.mjs} +12 -13
  125. package/dist/client/{shop-commerce-4rKj5n9h.mjs → shop-commerce-BbfCJjB3.mjs} +6 -6
  126. package/dist/client/{shop-commerce-store-Bxm75Pg6.mjs → shop-commerce-store-vicweP2K.mjs} +1 -1
  127. package/dist/client/{shopShared-DpoQDWfz.mjs → shopShared-DlONJt0T.mjs} +4 -4
  128. package/dist/client/{useEventFilters-D8HliSqR.mjs → useEventFilters-COYyL3m7.mjs} +6 -6
  129. package/dist/preview-next/before-render.mjs +15 -22
  130. package/dist/preview-next/client/runtime.mjs +4 -4
  131. package/dist/preview-next/constants.mjs +5 -1
  132. package/dist/preview-next/index.mjs +5 -1
  133. package/dist/preview-next/keepAlive.mjs +149 -82
  134. package/dist/preview-next/middleware.mjs +15 -22
  135. package/dist/{previewAuthStore-BXXF3hhW.mjs → previewAuthStore-BBmV7UsW.mjs} +49 -29
  136. package/dist/{sdk-runtime-C2a05WjL.mjs → sdk-runtime-CwvFFjB-.mjs} +2 -2
  137. package/dist/{separator-CuNhBAhS.mjs → separator-ByL72zUT.mjs} +1 -1
  138. package/dist/server/components.mjs +167 -131
  139. package/dist/server/config-validation.mjs +160 -129
  140. package/dist/server/config.mjs +160 -129
  141. package/dist/server/data.mjs +160 -129
  142. package/dist/server/index.mjs +20 -27
  143. package/dist/server/next.mjs +174 -156
  144. package/dist/server/page-converter.mjs +145 -65
  145. package/dist/server/prebuild.mjs +1 -1
  146. package/dist/server/rendering/server.mjs +169 -131
  147. package/dist/server/rendering.mjs +167 -131
  148. package/dist/server/routing.mjs +165 -118
  149. package/dist/server/server.mjs +167 -154
  150. package/package.json +1 -1
  151. package/dist/_dts/api/src/bookingPaymentTermSchemas.d.ts +0 -123
  152. package/dist/_dts/commerce/src/purchase/checkoutPaymentTermPlanning.d.ts +0 -10
  153. package/dist/_dts/commerce/src/purchase/checkoutValidatedItemPlanning.d.ts +0 -55
  154. package/dist/_dts/commerce/src/purchase/orderInstalmentPayoff.d.ts +0 -24
@@ -1,6 +1,7 @@
1
1
  import type { CookieStoreLike } from './session';
2
2
  export type PreviewKeepAliveLogger = {
3
3
  debug?: (message: string, meta?: Record<string, unknown>) => void;
4
+ info?: (message: string, meta?: Record<string, unknown>) => void;
4
5
  warn?: (message: string, meta?: Record<string, unknown>) => void;
5
6
  error?: (message: string, meta?: Record<string, unknown>) => void;
6
7
  };
@@ -1,6 +1,6 @@
1
1
  import type { ButtonVariant as SystemButtonVariant, EventScheduleScope as SystemEventScheduleScope, EventSurfacePreset as SystemEventSurfacePreset, RichTextDoc as SystemRichTextDoc } from '../../contracts/system-block-content';
2
2
  import type { PublicTeamMemberSummary } from '../../../../api/src/index';
3
- import type { BookingFlexibleBalanceConfig, BookingInstalmentPlanConfig, LocationCoordinates, PublicEventPriceDisplay, PublicEventPricing, PublicEventPricingOption, PublicEventPricingOptionAvailability, PublicEventPricingType } from '../../../../core/src/index';
3
+ import type { BookingPaymentCollectionOption, LocationCoordinates, PublicEventPriceDisplay, PublicEventPricing, PublicEventPricingOption, PublicEventPricingOptionAvailability, PublicEventPricingType } from '../../../../core/src/index';
4
4
  import type { AccordionIslandProps as BlocksAccordionIslandProps, BookingFormConfig as BlocksBookingFormConfig, BookingFormInteractiveIslandProps as BlocksBookingFormIslandProps, BookingFormService as BlocksBookingFormService, CarouselIslandProps as BlocksCarouselIslandProps, CartDisplay as BlocksCartDisplay, CartInteractiveIslandProps as BlocksCartIslandProps, CartLineDisplay as BlocksCartLineDisplay, CheckoutDisplay as BlocksCheckoutDisplay, CheckoutInteractiveIslandProps as BlocksCheckoutIslandProps, EventCalendarInteractiveIslandProps as BlocksEventCalendarIslandProps, EventCombinedInteractiveIslandProps as BlocksEventCombinedIslandProps, EventDetailsIslandProps as BlocksEventDetailsIslandProps, EventDetailsOccurrenceContext as BlocksEventDetailsOccurrenceContext, LocationMapIslandProps as BlocksLocationMapIslandProps, EventRegistrationInteractiveIslandProps as BlocksEventRegistrationIslandProps, EventListingDisplay as BlocksEventListingDisplay, EventListingHydration as BlocksEventListingHydration, EventListingInteractiveIslandProps as BlocksEventListingIslandProps, PublicEvent as BlocksPublicEvent, FormInteractiveIslandProps as BlocksFormIslandProps, HeaderSectionIslandProps as BlocksHeaderSectionIslandProps, MembershipCardDisplay as BlocksMembershipCardDisplay, NewsletterFormInteractiveIslandProps as BlocksNewsletterFormIslandProps, PassCardDisplay as BlocksPassCardDisplay, PassesMembershipsDisplay as BlocksPassesMembershipsDisplay, ProductCardDisplay as BlocksProductCardDisplay, ProductDetailDisplay as BlocksProductDetailDisplay, ProductDetailInteractiveIslandProps as BlocksProductDetailIslandProps, ProductListDisplay as BlocksProductListDisplay, ProductListInteractiveIslandProps as BlocksProductListIslandProps, ProductVariantOptionDisplay as BlocksProductVariantOptionDisplay, ShopInteractiveIslandProps as BlocksShopIslandProps } from '../../../../blocks/src/contracts/index';
5
5
  export type ResponsiveSlidesToShow = {
6
6
  mobile?: number | string;
@@ -72,17 +72,7 @@ export type PublicEventAttendanceModeAvailability = {
72
72
  waitlistEnabled: boolean;
73
73
  };
74
74
  export type { PublicTeamMemberSummary };
75
- export type BookingPaymentCollectionOption = {
76
- kind: 'upfront';
77
- } | {
78
- kind: 'deferred_manual';
79
- } | {
80
- kind: 'instalment_plan';
81
- plan: BookingInstalmentPlanConfig;
82
- } | {
83
- kind: 'flexible_balance';
84
- config: BookingFlexibleBalanceConfig;
85
- };
75
+ export type { BookingPaymentCollectionOption };
86
76
  export type BookingPaymentTerms = {
87
77
  allowedOptions: BookingPaymentCollectionOption[];
88
78
  };
@@ -8,4 +8,4 @@
8
8
  * 1. This constant
9
9
  * 2. The "version" field in package.json
10
10
  */
11
- export declare const SDK_VERSION = "0.148.0";
11
+ export declare const SDK_VERSION = "0.149.0";
@@ -58,11 +58,6 @@ export type PageDesignStructureEvent<TBlockId extends DesignBlockId = DesignBloc
58
58
  }> | Readonly<{
59
59
  kind: 'blocks-reordered';
60
60
  orderedBlockIds: readonly TBlockId[];
61
- }> | Readonly<{
62
- kind: 'block-kind-changed';
63
- blockId: TBlockId;
64
- nextBlockKind: string;
65
- compatiblePinnedLookPresetIds: readonly AppearancePresetId[];
66
61
  }> | Readonly<{
67
62
  kind: 'block-duplicated';
68
63
  sourceBlockId: TBlockId;
@@ -5,5 +5,5 @@ interface ColorPickerProps {
5
5
  onBlur?: () => void;
6
6
  label?: string;
7
7
  }
8
- declare const ColorPicker: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "value" | "onBlur" | "onChange"> & ColorPickerProps & ButtonProps & import("react").RefAttributes<HTMLInputElement>>;
8
+ declare const ColorPicker: import("react").ForwardRefExoticComponent<Omit<ButtonProps, "value" | "onBlur" | "onChange"> & ColorPickerProps & import("react").RefAttributes<HTMLInputElement>>;
9
9
  export { ColorPicker };
@@ -0,0 +1,7 @@
1
+ /** Keeps incomplete text local while sending only complete colors to consumers. */
2
+ export declare function useHexDraft(value: string, onChange: (hex: string) => void): {
3
+ draft: string;
4
+ changeDraft: (next: string) => void;
5
+ finishDraft: () => void;
6
+ setDraft: import("react").Dispatch<import("react").SetStateAction<string>>;
7
+ };
@@ -1,9 +1,10 @@
1
1
  "use client";
2
- import { Cn as formatCurrencyAmount, Wt as assertNever$2 } from "./propsDecoder-D1OtGXDV.mjs";
3
- import { i as CheckIcon } from "./TerminalPanel-DvNUP5ot.mjs";
2
+ import { Cn as formatCurrencyAmount, Wt as assertNever$3, wn as parseCurrencyCode } from "./propsDecoder-DZd6RJeA.mjs";
3
+ import { i as CheckIcon } from "./TerminalPanel-JjmgxEsR.mjs";
4
4
  import { n as getBookingMailingListNoteCopy } from "./mailingListSignupCopy-DZSHZrm6.mjs";
5
5
  import { n as RichText } from "./checkoutUrls-CXhko2Rv.mjs";
6
- import { useCallback, useEffect, useReducer, useRef } from "react";
6
+ import { useCallback, useEffect, useReducer, useRef, useState } from "react";
7
+ import { z } from "zod";
7
8
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
9
  //#region ../core/src/date-math.ts
9
10
  function addDaysToDate(date, dayCount) {
@@ -20,6 +21,18 @@ function subtractDaysFromIso(isoString, dayCount) {
20
21
  return addDaysToIso(isoString, -dayCount);
21
22
  }
22
23
  //#endregion
24
+ //#region ../core/src/money-input.ts
25
+ function unsafeAsNonNegativeCents(value) {
26
+ return value;
27
+ }
28
+ /**
29
+ * Normalizes a derived amount to non-negative whole cents. This intentionally
30
+ * clamps negatives to zero; use parseNonNegativeCents for validation.
31
+ */
32
+ function toNonNegativeCents(value) {
33
+ return unsafeAsNonNegativeCents(Math.max(0, Math.trunc(value)));
34
+ }
35
+ //#endregion
23
36
  //#region ../core/src/booking-flexible-balance.ts
24
37
  function clampFlexibleBalanceConfiguredAmount(amountCents, totalAmountCents) {
25
38
  return Math.max(0, Math.min(amountCents, totalAmountCents));
@@ -31,10 +44,10 @@ function resolveFlexibleBalanceDueAt(input) {
31
44
  switch (input.dueDateRule.kind) {
32
45
  case "relative_to_start_date": return subtractDaysFromIso(input.bookingStartAt, input.dueDateRule.daysBeforeStart);
33
46
  case "fixed_calendar_date": return input.dueDateRule.dueAt;
34
- default: return assertNever$1(input.dueDateRule);
47
+ default: return assertNever$2(input.dueDateRule);
35
48
  }
36
49
  }
37
- function assertNever$1(value) {
50
+ function assertNever$2(value) {
38
51
  throw new Error(`Unexpected value: ${String(value)}`);
39
52
  }
40
53
  //#endregion
@@ -44,7 +57,7 @@ function isDepositBearingBookingInstalmentPlan(plan) {
44
57
  case "deposit_plus_one_remainder":
45
58
  case "deposit_plus_scheduled_instalments": return true;
46
59
  case "equal_scheduled_instalments": return false;
47
- default: return assertNever(plan);
60
+ default: return assertNever$1(plan);
48
61
  }
49
62
  }
50
63
  function getBookingInstalmentDepositRefundability(plan) {
@@ -70,7 +83,7 @@ function addIntervalPreservingMonthAnchor(isoString, intervalCount, intervalUnit
70
83
  date.setUTCDate(date.getUTCDate() + intervalCount * 7);
71
84
  return date.toISOString();
72
85
  case "month": return addMonthsPreservingAnchorDay(date, intervalCount).toISOString();
73
- default: return assertNever(intervalUnit);
86
+ default: return assertNever$1(intervalUnit);
74
87
  }
75
88
  }
76
89
  function getBookingInstalmentPlanIntervalCount(plan) {
@@ -78,7 +91,7 @@ function getBookingInstalmentPlanIntervalCount(plan) {
78
91
  case "deposit_plus_one_remainder": return plan.remainderDueCount;
79
92
  case "deposit_plus_scheduled_instalments":
80
93
  case "equal_scheduled_instalments": return plan.intervalCount;
81
- default: return assertNever(plan);
94
+ default: return assertNever$1(plan);
82
95
  }
83
96
  }
84
97
  function omitZeroAmountFutureRows(rows) {
@@ -94,10 +107,380 @@ function addMonthsPreservingAnchorDay(date, intervalCount) {
94
107
  nextMonth.setUTCDate(Math.min(anchorDay, lastDayOfTargetMonth));
95
108
  return nextMonth;
96
109
  }
97
- function assertNever(value) {
110
+ function assertNever$1(value) {
98
111
  throw new Error(`Unexpected value: ${String(value)}`);
99
112
  }
100
113
  //#endregion
114
+ //#region ../blocks/src/system/runtime/hooks/useBookingNowIso.ts
115
+ /**
116
+ * The moment a booking or registration flow opened, as an ISO timestamp.
117
+ *
118
+ * Payment previews take this as their "now" so the pure view-model builders
119
+ * never read the clock themselves. It's captured once per mount, which keeps
120
+ * memoised previews stable across renders.
121
+ */
122
+ function useBookingNowIso() {
123
+ const [nowIso] = useState(() => (/* @__PURE__ */ new Date()).toISOString());
124
+ return nowIso;
125
+ }
126
+ //#endregion
127
+ //#region ../commerce/src/utils/assertNever.ts
128
+ function assertNever(value, message) {
129
+ if (message) throw new Error(message);
130
+ throw new Error(`Unexpected value: ${String(value)}`);
131
+ }
132
+ //#endregion
133
+ //#region ../commerce/src/purchase/bookingInstalmentSchedule.ts
134
+ function resolveBookingInitialInstalmentAmountCents(input) {
135
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
136
+ switch (input.plan.kind) {
137
+ case "deposit_plus_one_remainder":
138
+ case "deposit_plus_scheduled_instalments": return clampConfiguredAmount(input.plan.depositAmountCents, totalAmountCents);
139
+ case "equal_scheduled_instalments": return splitAmountWithRemainderInFirst(totalAmountCents, input.plan.instalmentCount)[0] ?? 0;
140
+ default: return assertNever(input.plan);
141
+ }
142
+ }
143
+ function buildBookingInstalmentSchedule(input) {
144
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
145
+ switch (input.plan.kind) {
146
+ case "deposit_plus_one_remainder": {
147
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
148
+ const remainderAmountCents = Math.max(0, totalAmountCents - depositAmountCents);
149
+ return omitZeroAmountFutureRows([createScheduleRow({
150
+ sequence: 1,
151
+ stateAtBooking: "paid_today",
152
+ dueAt: input.anchorAt,
153
+ amountCents: depositAmountCents
154
+ }), createScheduleRow({
155
+ sequence: 2,
156
+ stateAtBooking: "scheduled",
157
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, input.plan.remainderDueCount, input.plan.intervalUnit),
158
+ amountCents: remainderAmountCents
159
+ })]);
160
+ }
161
+ case "deposit_plus_scheduled_instalments": {
162
+ const plan = input.plan;
163
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
164
+ const instalmentAmounts = splitAmountWithRemainderInFirst(Math.max(0, totalAmountCents - depositAmountCents), plan.instalmentCount);
165
+ return omitZeroAmountFutureRows([createScheduleRow({
166
+ sequence: 1,
167
+ stateAtBooking: "paid_today",
168
+ dueAt: input.anchorAt,
169
+ amountCents: depositAmountCents
170
+ }), ...instalmentAmounts.map((amountCents, index) => createScheduleRow({
171
+ sequence: index + 2,
172
+ stateAtBooking: "scheduled",
173
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * (index + 1), plan.intervalUnit),
174
+ amountCents
175
+ }))]);
176
+ }
177
+ case "equal_scheduled_instalments": {
178
+ const plan = input.plan;
179
+ return omitZeroAmountFutureRows(splitAmountWithRemainderInFirst(totalAmountCents, plan.instalmentCount).map((amountCents, index) => createScheduleRow({
180
+ sequence: index + 1,
181
+ stateAtBooking: index === 0 ? "paid_today" : "scheduled",
182
+ dueAt: index === 0 ? input.anchorAt : addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * index, plan.intervalUnit),
183
+ amountCents
184
+ })));
185
+ }
186
+ default: return assertNever(input.plan);
187
+ }
188
+ }
189
+ function createScheduleRow(input) {
190
+ return {
191
+ id: `payment-${input.sequence}`,
192
+ sequence: input.sequence,
193
+ stateAtBooking: input.stateAtBooking,
194
+ dueAt: input.dueAt,
195
+ amountCents: input.amountCents
196
+ };
197
+ }
198
+ //#endregion
199
+ //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
200
+ function planCheckoutPaymentFlow(options) {
201
+ const amountDueCents = toNonNegativeCents(options.amountDueCents);
202
+ const discountCents = toNonNegativeCents(options.discountCents);
203
+ const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
204
+ const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
205
+ if (amountDueCents <= 0) return {
206
+ kind: "bypass",
207
+ bypassReason: discountCents > 0 ? "discount_free" : "free",
208
+ reserveCreditCents: 0
209
+ };
210
+ if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
211
+ kind: "stripe",
212
+ reserveCreditCents: toNonNegativeCents(0)
213
+ };
214
+ if (availableCreditCents >= amountDueCents) return {
215
+ kind: "store_credit_only",
216
+ reserveCreditCents: amountDueCents
217
+ };
218
+ return {
219
+ kind: "stripe",
220
+ reserveCreditCents: planMixedPaymentCreditReservation({
221
+ amountDueCents,
222
+ availableCreditCents,
223
+ minimumStripeChargeCents
224
+ })
225
+ };
226
+ }
227
+ function planMixedPaymentCreditReservation(input) {
228
+ const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
229
+ if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
230
+ if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
231
+ return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
232
+ }
233
+ /**
234
+ * Apply site credit to a flexible-balance booking before card payment.
235
+ *
236
+ * Credit first reduces the configured payment due now. Once that payment is
237
+ * covered, any remaining credit reduces the later balance. If a partial credit
238
+ * application would leave a positive card charge below Stripe's minimum, less
239
+ * credit is used so the configured payment can still be collected.
240
+ */
241
+ function planFlexibleBalanceCreditFirst(input) {
242
+ const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
243
+ const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
244
+ const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
245
+ const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
246
+ if (availableCreditCents >= totalCents && totalCents > 0) return {
247
+ kind: "credit_only",
248
+ reserveCreditCents: totalCents,
249
+ cardDueNowCents: toNonNegativeCents(0),
250
+ laterBalanceCents: toNonNegativeCents(0)
251
+ };
252
+ let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
253
+ if (reserveCreditCents >= configuredDueNowCents) return {
254
+ kind: "flexible_balance",
255
+ reserveCreditCents,
256
+ cardDueNowCents: toNonNegativeCents(0),
257
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
258
+ };
259
+ const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
260
+ if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
261
+ if (configuredDueNowCents < minimumStripeChargeCents) return {
262
+ kind: "card_below_minimum",
263
+ reserveCreditCents: toNonNegativeCents(0),
264
+ cardDueNowCents: configuredDueNowCents,
265
+ laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
266
+ };
267
+ reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
268
+ }
269
+ const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
270
+ return {
271
+ kind: "flexible_balance",
272
+ reserveCreditCents,
273
+ cardDueNowCents,
274
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
275
+ };
276
+ }
277
+ //#endregion
278
+ //#region ../commerce/src/purchase/settlement.ts
279
+ function normalizeCurrencyCode(raw) {
280
+ const normalized = raw.trim().toUpperCase();
281
+ if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
282
+ return normalized;
283
+ }
284
+ //#endregion
285
+ //#region ../commerce/src/purchase/checkoutSessionMetadata.ts
286
+ const datedOfferingSharedEngineMetadataShape = {
287
+ datedOfferingEngineContractVersion: z.literal("shared_v1"),
288
+ datedOfferingEngineRouteKind: z.literal("shared_whole_series_registration"),
289
+ datedOfferingCapacityHoldId: z.string().uuid(),
290
+ datedOfferingCapacityHoldAuditRef: z.string().uuid(),
291
+ customerId: z.string().uuid(),
292
+ eventSeriesId: z.string().uuid()
293
+ };
294
+ z.object(datedOfferingSharedEngineMetadataShape);
295
+ const orderCheckoutSessionMetadataBaseShape = {
296
+ type: z.literal("order"),
297
+ site_id: z.string().uuid(),
298
+ order_id: z.string().uuid().optional(),
299
+ customer_email: z.string().email().optional(),
300
+ customer_name: z.string().optional(),
301
+ product_id: z.string().uuid().optional(),
302
+ attendee_id: z.string().uuid().optional(),
303
+ occurrence_id: z.string().uuid().optional(),
304
+ tickets_count: z.string().optional(),
305
+ notes: z.string().optional(),
306
+ discount_redemption_id: z.string().uuid().optional(),
307
+ discount_code_id: z.string().uuid().optional(),
308
+ discount_code: z.string().optional(),
309
+ discount_public_label: z.string().optional(),
310
+ credit_reservation_id: z.string().uuid().optional(),
311
+ credit_reserved_cents: z.string().optional(),
312
+ discount_code_amount_cents: z.string().optional(),
313
+ order_payment_reason: z.enum([
314
+ "instalment_payoff",
315
+ "flexible_balance_initial",
316
+ "flexible_balance_paydown"
317
+ ]).optional(),
318
+ order_payment_plan_id: z.string().uuid().optional(),
319
+ order_flexible_balance_contract_id: z.string().uuid().optional()
320
+ };
321
+ const absentDatedOfferingSharedEngineMetadataShape = {
322
+ datedOfferingEngineContractVersion: z.never().optional(),
323
+ datedOfferingEngineRouteKind: z.never().optional(),
324
+ datedOfferingCapacityHoldId: z.never().optional(),
325
+ datedOfferingCapacityHoldAuditRef: z.never().optional(),
326
+ customerId: z.never().optional(),
327
+ eventSeriesId: z.never().optional()
328
+ };
329
+ const LegacyOrderCheckoutSessionMetadataSchema = z.object({
330
+ ...orderCheckoutSessionMetadataBaseShape,
331
+ ...absentDatedOfferingSharedEngineMetadataShape
332
+ });
333
+ const SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z.object({
334
+ ...orderCheckoutSessionMetadataBaseShape,
335
+ ...datedOfferingSharedEngineMetadataShape
336
+ });
337
+ z.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
338
+ //#endregion
339
+ //#region ../commerce/src/purchase/stripeCommissionMetadata.ts
340
+ /** Reasons are payment evidence, not an independent pricing policy. */
341
+ const STRIPE_COMMISSION_FREE_REASONS = [
342
+ "managed_billing",
343
+ "no_commission_plan",
344
+ "billing_evidence_invalid",
345
+ "fee_rounds_to_zero",
346
+ "payment_not_stripe"
347
+ ];
348
+ const historicalContext = {
349
+ currency: z.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
350
+ sourcePlanId: z.string().trim().min(1).optional()
351
+ };
352
+ const percentSchema = z.number().finite().min(0).max(100);
353
+ z.discriminatedUnion("kind", [
354
+ z.object({
355
+ kind: z.literal("commission_free"),
356
+ reason: z.enum(STRIPE_COMMISSION_FREE_REASONS),
357
+ ...historicalContext
358
+ }),
359
+ z.object({
360
+ kind: z.literal("application_fee_amount"),
361
+ amountCents: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
362
+ percent: percentSchema,
363
+ ...historicalContext
364
+ }),
365
+ z.object({
366
+ kind: z.literal("application_fee_percent"),
367
+ percent: percentSchema,
368
+ ...historicalContext
369
+ })
370
+ ]);
371
+ toNonNegativeCents(0);
372
+ //#endregion
373
+ //#region ../commerce/src/purchase/stripeMinimumCharge.ts
374
+ const STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
375
+ GBP: 30,
376
+ USD: 50,
377
+ EUR: 50,
378
+ AED: 200,
379
+ AUD: 50,
380
+ BGN: 100,
381
+ BRL: 50,
382
+ CAD: 50,
383
+ CHF: 50,
384
+ CZK: 1500,
385
+ DKK: 250,
386
+ HKD: 400,
387
+ HUF: 17500,
388
+ JPY: 50,
389
+ MXN: 1e3,
390
+ MYR: 200,
391
+ NOK: 300,
392
+ NZD: 50,
393
+ PLN: 200,
394
+ RON: 200,
395
+ SEK: 300,
396
+ SGD: 50,
397
+ THB: 1e3
398
+ };
399
+ function isStripeMinimumChargeCurrency(currency) {
400
+ return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
401
+ }
402
+ function getStripeMinimumChargeRequirement(rawCurrency) {
403
+ let currency;
404
+ try {
405
+ currency = normalizeCurrencyCode(rawCurrency);
406
+ } catch {
407
+ return null;
408
+ }
409
+ const currencyKey = currency;
410
+ if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
411
+ return {
412
+ currency,
413
+ minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
414
+ };
415
+ }
416
+ //#endregion
417
+ //#region ../commerce/src/purchase/event-registration-errors.ts
418
+ const eventRegistrationErrors = {
419
+ registrationClosed: {
420
+ message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
421
+ action: "none"
422
+ },
423
+ paymentInvestigationRequired: {
424
+ message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
425
+ action: "none"
426
+ },
427
+ paymentProviderUnavailable: {
428
+ message: "We couldn’t reach the payment provider. Please try again in a minute.",
429
+ action: "retry"
430
+ },
431
+ paymentPageUnavailable: {
432
+ message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
433
+ action: "retry"
434
+ },
435
+ paymentUnavailable: {
436
+ message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
437
+ action: "none"
438
+ },
439
+ capacityChanged: {
440
+ message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
441
+ action: "places"
442
+ },
443
+ selectionChanged: {
444
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
445
+ action: "places"
446
+ },
447
+ registrationPreparationChanged: {
448
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
449
+ action: "places"
450
+ },
451
+ registrationAlreadyExists: {
452
+ message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
453
+ action: "portal"
454
+ },
455
+ holdExpired: {
456
+ message: "Your reservation has timed out. Please check availability and choose your places again.",
457
+ action: "start"
458
+ },
459
+ waitlistUnavailable: {
460
+ message: "Sorry, the waiting list place offered in this invitation is no longer available. Please check the event for available places or contact the organiser for help.",
461
+ action: "event"
462
+ },
463
+ paymentContextMismatch: {
464
+ message: "The payment options for this event have changed. Please check the latest options before continuing.",
465
+ action: "payment-options"
466
+ },
467
+ verificationFailed: {
468
+ message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
469
+ action: "none"
470
+ },
471
+ idempotencyConflict: {
472
+ message: "You’ve already started booking this event. Please finish in the other tab if it’s still open, or check your booking status before starting again.",
473
+ action: "portal"
474
+ },
475
+ invalidCommitInput: {
476
+ message: "We couldn’t accept your booking details. Please check the information you entered and try again. If this keeps happening, contact the organiser for help.",
477
+ action: "details"
478
+ }
479
+ };
480
+ function parseEventRegistrationErrorReason(value) {
481
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
482
+ }
483
+ //#endregion
101
484
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
102
485
  function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
103
486
  return {
@@ -164,16 +547,15 @@ function resolveBookingPaymentDueNowCents(input) {
164
547
  switch (input.option.kind) {
165
548
  case "upfront": return input.totalCents;
166
549
  case "deferred_manual": return 0;
167
- case "instalment_plan": return buildInstalmentSchedulePreview({
168
- totalCents: input.totalCents,
169
- option: input.option,
170
- bookingStartAt: input.bookingStartAt
171
- })[0]?.amountCents ?? input.totalCents;
550
+ case "instalment_plan": return resolveBookingInitialInstalmentAmountCents({
551
+ totalAmountCents: input.totalCents,
552
+ plan: input.option.plan
553
+ });
172
554
  case "flexible_balance": return resolveFlexibleBalanceInitialPaymentCents({
173
555
  totalAmountCents: input.totalCents,
174
556
  config: input.option.config
175
557
  });
176
- default: return assertNever$2(input.option);
558
+ default: return assertNever$3(input.option);
177
559
  }
178
560
  }
179
561
  function buildBookingPaymentSelectionViewModel(input) {
@@ -190,6 +572,7 @@ function buildBookingPaymentSelectionViewModel(input) {
190
572
  totalCents,
191
573
  currency,
192
574
  bookingStartAt: input.bookingStartAt,
575
+ nowIso: input.nowIso,
193
576
  locale: input.locale
194
577
  }))
195
578
  };
@@ -232,17 +615,12 @@ function buildBookingPaymentOptionViewModel(input) {
232
615
  };
233
616
  }
234
617
  case "instalment_plan": {
235
- const schedulePreview = buildInstalmentSchedulePreview({
236
- totalCents: input.totalCents,
237
- option: input.option,
238
- bookingStartAt: input.bookingStartAt
239
- });
240
- const dueToday = resolveBookingPaymentDueNowCents({
241
- option: input.option,
242
- totalCents: input.totalCents,
243
- bookingStartAt: input.bookingStartAt
618
+ const [firstRow, ...futureRows] = buildBookingInstalmentSchedule({
619
+ anchorAt: input.nowIso,
620
+ totalAmountCents: input.totalCents,
621
+ plan: input.option.plan
244
622
  });
245
- const futureRows = schedulePreview.slice(1);
623
+ const dueToday = firstRow?.amountCents ?? 0;
246
624
  const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
247
625
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
248
626
  const depositRefundability = getBookingInstalmentDepositRefundability(input.option.plan);
@@ -289,7 +667,7 @@ function buildBookingPaymentOptionViewModel(input) {
289
667
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
290
668
  const formattedRemainingBalance = formatPrice(remainingBalance, input.currency, input.locale);
291
669
  const dueAt = resolveFlexibleBalanceDueAt({
292
- bookingStartAt: input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString(),
670
+ bookingStartAt: input.bookingStartAt ?? input.nowIso,
293
671
  dueDateRule: input.option.config.dueDateRule
294
672
  });
295
673
  const copy = buildFlexibleBalanceBookingPaymentOptionCopy({
@@ -327,43 +705,7 @@ function buildBookingPaymentOptionViewModel(input) {
327
705
  ctaLabel: copy.ctaLabel
328
706
  };
329
707
  }
330
- default: return assertNever$2(input.option);
331
- }
332
- }
333
- function buildInstalmentSchedulePreview(input) {
334
- const startAt = input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString();
335
- switch (input.option.plan.kind) {
336
- case "deposit_plus_one_remainder": {
337
- const deposit = clampConfiguredAmount(input.option.plan.depositAmountCents, input.totalCents);
338
- const remainder = Math.max(0, input.totalCents - deposit);
339
- return compactSchedulePreview([{
340
- dueAt: startAt,
341
- amountCents: deposit
342
- }, {
343
- dueAt: addIntervalPreservingMonthAnchor(startAt, input.option.plan.remainderDueCount, input.option.plan.intervalUnit),
344
- amountCents: remainder
345
- }]);
346
- }
347
- case "deposit_plus_scheduled_instalments": {
348
- const plan = input.option.plan;
349
- const deposit = clampConfiguredAmount(plan.depositAmountCents, input.totalCents);
350
- const instalments = splitAmountWithRemainderInFirst(Math.max(0, input.totalCents - deposit), plan.instalmentCount);
351
- return compactSchedulePreview([{
352
- dueAt: startAt,
353
- amountCents: deposit
354
- }, ...instalments.map((amountCents, index) => ({
355
- dueAt: addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * (index + 1), plan.intervalUnit),
356
- amountCents
357
- }))]);
358
- }
359
- case "equal_scheduled_instalments": {
360
- const plan = input.option.plan;
361
- return compactSchedulePreview(splitAmountWithRemainderInFirst(input.totalCents, plan.instalmentCount).map((amountCents, index) => ({
362
- dueAt: index === 0 ? startAt : addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * index, plan.intervalUnit),
363
- amountCents
364
- })));
365
- }
366
- default: return assertNever$2(input.option.plan);
708
+ default: return assertNever$3(input.option);
367
709
  }
368
710
  }
369
711
  function getPaymentCadenceLabel(plan) {
@@ -371,9 +713,6 @@ function getPaymentCadenceLabel(plan) {
371
713
  const unitLabel = intervalCount === 1 ? plan.intervalUnit : `${plan.intervalUnit}s`;
372
714
  return intervalCount === 1 ? unitLabel : `every ${intervalCount} ${unitLabel}`;
373
715
  }
374
- function compactSchedulePreview(schedule) {
375
- return omitZeroAmountFutureRows(schedule);
376
- }
377
716
  function formatScheduleDate(isoString, locale) {
378
717
  const date = new Date(isoString);
379
718
  if (!Number.isFinite(date.getTime())) return isoString;
@@ -425,14 +764,14 @@ function pollingReducer(state, action) {
425
764
  case "completed":
426
765
  case "failed":
427
766
  case "timeout": return state;
428
- default: return assertNever$2(state);
767
+ default: return assertNever$3(state);
429
768
  }
430
769
  case "polling-timed-out": return {
431
770
  tag: "timeout",
432
771
  result: state.result,
433
772
  error: /* @__PURE__ */ new Error("Polling timed out")
434
773
  };
435
- default: return assertNever$2(action);
774
+ default: return assertNever$3(action);
436
775
  }
437
776
  }
438
777
  //#endregion
@@ -710,4 +1049,4 @@ function BookingMailingListNote(props) {
710
1049
  });
711
1050
  }
712
1051
  //#endregion
713
- export { buildBookingPaymentSelectionViewModel as a, usePolling as i, BookingConsentAgreement as n, resolveBookingPaymentDueNowCents as o, StepIndicator as r, formatPrice as s, BookingMailingListNote as t };
1052
+ export { buildBookingPaymentSelectionViewModel as a, eventRegistrationErrors as c, planCheckoutPaymentFlow as d, planFlexibleBalanceCreditFirst as f, usePolling as i, parseEventRegistrationErrorReason as l, BookingConsentAgreement as n, resolveBookingPaymentDueNowCents as o, useBookingNowIso as p, StepIndicator as r, formatPrice as s, BookingMailingListNote as t, getStripeMinimumChargeRequirement as u };
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { n as useBlockApi, r as BlockApiError } from "./context-eW97E945.mjs";
3
- import { t as ThemedButton } from "./ThemedButton-C7CeUJjW.mjs";
2
+ import { n as useBlockApi, r as BlockApiError } from "./context-DFmaZa-Q.mjs";
3
+ import { t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
4
4
  import React, { useId } from "react";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  //#region ../blocks/src/system/runtime/shared/utils/demoBookingPassStorage.ts