@riverbankcms/sdk 0.149.0 → 0.150.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 (165) hide show
  1. package/dist/EventEmbeddedCheckoutStep-D00Kc8Zj.mjs +285 -0
  2. package/dist/{PreviewEditorSidebar-DBKln68M.mjs → PreviewEditorSidebar-7ZhmmnBB.mjs} +3 -3
  3. package/dist/{PreviewEditorUI-DpRX4Mum.mjs → PreviewEditorUI-BIJucTRd.mjs} +2 -2
  4. package/dist/{SdkPreviewModeRuntime-DJPmPY-r.mjs → SdkPreviewModeRuntime-tj45gmCX.mjs} +4 -3
  5. package/dist/{SiteChromeCustomizeContext-JYA0cJ_Z.mjs → SiteChromeCustomizeContext-BFOt0ss-.mjs} +4454 -4059
  6. package/dist/_dts/ai/src/contracts/proposals.d.ts +660 -0
  7. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +510 -0
  8. package/dist/_dts/api/src/billing.d.ts +2 -2
  9. package/dist/_dts/api/src/contentRuntime.d.ts +5 -1
  10. package/dist/_dts/api/src/footerCompositionContracts.d.ts +9 -0
  11. package/dist/_dts/api/src/footerSettings.d.ts +3 -3
  12. package/dist/_dts/api/src/index.d.ts +1 -1
  13. package/dist/_dts/api/src/navigation/bookingPortalLink.d.ts +13 -0
  14. package/dist/_dts/api/src/navigation.d.ts +1 -0
  15. package/dist/_dts/api/src/publicExperience/eventEndpoints.d.ts +9 -173
  16. package/dist/_dts/api/src/sdkThemeWire.d.ts +12 -0
  17. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +3 -3
  18. package/dist/_dts/api/src/siteSettings.d.ts +2 -0
  19. package/dist/_dts/blocks/src/client/site-chrome.d.ts +1 -1
  20. package/dist/_dts/blocks/src/client.d.ts +2 -1
  21. package/dist/_dts/blocks/src/rendering/server.d.ts +1 -1
  22. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +30 -3
  23. package/dist/_dts/blocks/src/system/designCapabilities.d.ts +10 -1
  24. package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
  25. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +38 -18
  26. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessEventRegistrationFlow.d.ts +1 -1
  27. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.server.d.ts +6 -0
  28. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventEmbeddedCheckoutStep.d.ts +13 -0
  29. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.d.ts +15 -0
  30. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizardActions.d.ts +0 -1
  31. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/FullyBookedStep.d.ts +6 -0
  32. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentBlockingPanel.d.ts +3 -0
  33. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +2 -0
  34. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +15 -5
  35. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.d.ts +4 -2
  36. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentLocation.d.ts +3 -0
  37. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentResponse.d.ts +72 -0
  38. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationCompletion.d.ts +66 -5
  39. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.d.ts +1 -4
  40. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +13 -5
  41. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/sessionStorage.d.ts +11 -52
  42. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +19 -2
  43. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.d.ts +7 -42
  44. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +7 -8
  45. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +90 -24
  46. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useGuestRegistrationRecovery.d.ts +30 -0
  47. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/usePaymentStatusRecovery.d.ts +24 -12
  48. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useRegistrationAdmission.d.ts +18 -0
  49. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/wizardSteps.d.ts +6 -1
  50. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +1 -1
  51. package/dist/_dts/blocks/src/system/runtime/shared/stripe/browserStripe.d.ts +8 -0
  52. package/dist/_dts/blocks/src/system/transforms/registry/eventCalendar.d.ts +8 -0
  53. package/dist/_dts/commerce/src/purchase/checkoutCopy.d.ts +10 -0
  54. package/dist/_dts/commerce/src/purchase/checkoutPresentation.d.ts +49 -0
  55. package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +4 -4
  56. package/dist/_dts/commerce/src/purchase/checkoutStripeFinalizationPlanning.d.ts +5 -1
  57. package/dist/_dts/commerce/src/purchase/event-registration-errors.d.ts +9 -0
  58. package/dist/_dts/commerce/src/purchase/index.d.ts +2 -0
  59. package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +1 -0
  60. package/dist/_dts/commerce/src/purchase/stripeCheckoutReturnUrl.d.ts +9 -2
  61. package/dist/_dts/commerce/src/purchase/types.d.ts +5 -6
  62. package/dist/_dts/content-editor/src/FooterComposerOverview.d.ts +3 -2
  63. package/dist/_dts/content-editor/src/footerPreviewRuntime.d.ts +6 -1
  64. package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +7 -0
  65. package/dist/_dts/core/src/index.d.ts +1 -0
  66. package/dist/_dts/core/src/patch/index.d.ts +30 -0
  67. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +30 -1
  68. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -1
  69. package/dist/_dts/sdk/src/bookings/types.d.ts +1 -1
  70. package/dist/_dts/sdk/src/version.d.ts +1 -1
  71. package/dist/_dts/theme-core/src/blocks/index.d.ts +1 -0
  72. package/dist/_dts/theme-core/src/blocks/opaquePanels.d.ts +147 -0
  73. package/dist/_dts/theme-core/src/boxBackgroundSchema.d.ts +22 -0
  74. package/dist/_dts/theme-core/src/buttons/buttonSurfaceContext.d.ts +22 -0
  75. package/dist/_dts/theme-core/src/cards/roles.d.ts +12 -0
  76. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  77. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +198 -0
  78. package/dist/_dts/theme-core/src/palette/utils/index.d.ts +2 -0
  79. package/dist/_dts/theme-core/src/palette/utils/scrimContrast.d.ts +22 -0
  80. package/dist/_dts/theme-core/src/runtime/bridgeColourTokens.d.ts +10 -0
  81. package/dist/_dts/theme-core/src/schema.d.ts +330 -0
  82. package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +0 -51
  83. package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +0 -51
  84. package/dist/_dts/theme-core/src/site-styles/lookResolution.d.ts +11 -0
  85. package/dist/_dts/theme-core/src/site-styles/pageDesignEditorCapabilities.d.ts +7 -1
  86. package/dist/_dts/theme-core/src/site-styles/pageDesignEditorModel.d.ts +7 -1
  87. package/dist/_dts/theme-core/src/site-styles/previewRuntimeCapabilities.d.ts +12 -6
  88. package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +7 -4
  89. package/dist/_dts/theme-core/src/site-styles/sectionSurfaceBackgrounds.d.ts +65 -0
  90. package/dist/_dts/theme-core/src/site-styles/types.d.ts +17 -0
  91. package/dist/_dts/theme-core/src/surfaces/opaqueSurface.d.ts +43 -0
  92. package/dist/client/{BookingMailingListNote-Cr3EeTP5.mjs → BookingMailingListNote-CYHOufsI.mjs} +10 -440
  93. package/dist/client/{CheckboxChoice-B33MqoUo.mjs → CheckboxChoice-M-3HycLw.mjs} +1 -1
  94. package/dist/client/{DemoBookingPortalAccess-BFGB1Fay.mjs → DemoBookingPortalAccess-Cvr9O_ca.mjs} +2 -2
  95. package/dist/client/{EventCombined.client-DKYV0_ft.mjs → EventCombined.client-m5UZIobP.mjs} +7 -7
  96. package/dist/client/EventEmbeddedCheckoutStep-DL6zFAkA.mjs +289 -0
  97. package/dist/client/{EventListing.client-B9UIcEYc.mjs → EventListing.client-DeMfCM04.mjs} +2 -2
  98. package/dist/client/{LeafletStaticMap-CFLPkP0K.mjs → LeafletStaticMap-CvZ3gOdD.mjs} +1 -1
  99. package/dist/client/{checkoutUrls-CXhko2Rv.mjs → RichText-BtfNvQV6.mjs} +2 -29
  100. package/dist/client/{TerminalPanel-JjmgxEsR.mjs → TerminalPanel-CUCNEwlH.mjs} +2 -18
  101. package/dist/client/{ThemedButton-CKV1Jh2m.mjs → ThemedButton-C7WhXuRl.mjs} +2 -2
  102. package/dist/client/{accordion-DXWIfT3T.mjs → accordion-cQm5mjqs.mjs} +1 -1
  103. package/dist/client/{bookingForm-CjZgHNvv.mjs → bookingForm-BVPJE5RQ.mjs} +11 -10
  104. package/dist/client/bookings.mjs +2668 -1134
  105. package/dist/client/{carousel-DSLikmvZ.mjs → carousel-3vgnY7LC.mjs} +2 -2
  106. package/dist/client/{carousel.client-A2lG-9od.mjs → carousel.client-CISsdZvg.mjs} +1 -1
  107. package/dist/client/{cart-HDjWReFt.mjs → cart-BGK4oOjm.mjs} +3 -3
  108. package/dist/client/{checkout-CUvRZA3W.mjs → checkout-GsBLUNJD.mjs} +3 -3
  109. package/dist/client/checkoutUrls-ChxwaNtO.mjs +28 -0
  110. package/dist/client/client.mjs +3042 -1868
  111. package/dist/client/{colorStyles-j5U9v5JA.mjs → colorStyles-D-32xHZh.mjs} +2 -30
  112. package/dist/client/{context-DFmaZa-Q.mjs → context-D_8s12Fp.mjs} +1 -1
  113. package/dist/client/{dates-BBep1JnF.mjs → dates-DeJQbQ9T.mjs} +2 -2
  114. package/dist/client/{eventCalendar-zEobhxo4.mjs → eventCalendar-cmucD4NR.mjs} +10 -10
  115. package/dist/client/{eventCombined-Dp7bz5k-.mjs → eventCombined-ku3E9FTl.mjs} +4 -4
  116. package/dist/client/{eventDetails-FE-zqTt7.mjs → eventDetails-CyKZ61sF.mjs} +5 -5
  117. package/dist/client/{eventListing-BMt5snal.mjs → eventListing-B7yxGIhX.mjs} +4 -4
  118. package/dist/client/{eventRegistration-O6ZxHfOb.mjs → eventRegistration-BoXfSFgZ.mjs} +1403 -857
  119. package/dist/client/{form-DFa1D8vt.mjs → form-CNQOWhJo.mjs} +5 -5
  120. package/dist/client/{headerSection-CmjHLR-N.mjs → headerSection-DahaBJGQ.mjs} +3 -3
  121. package/dist/client/hooks.mjs +123 -64
  122. package/dist/client/{locationMap-BXKP_lGh.mjs → locationMap-BoDjqYlW.mjs} +4 -4
  123. package/dist/client/{media-Cl38iOMI.mjs → media-BFY0y2rb.mjs} +2 -1
  124. package/dist/client/{newsletterForm-CU-HmxGx.mjs → newsletterForm-DtzXDklw.mjs} +4 -4
  125. package/dist/client/{pricing-KEAEsibq.mjs → pricing-DXEh2Lhh.mjs} +1 -1
  126. package/dist/client/{productDetail-Ckp7MGnt.mjs → productDetail-D7cPa-00.mjs} +3 -3
  127. package/dist/client/{productList-D91V0sYa.mjs → productList-D1XMap66.mjs} +3 -3
  128. package/dist/client/{propsDecoder-DZd6RJeA.mjs → propsDecoder-DiIeBopB.mjs} +758 -245
  129. package/dist/client/rendering/client.mjs +4381 -2892
  130. package/dist/client/rendering/islands.mjs +19 -19
  131. package/dist/client/rendering.mjs +3026 -1852
  132. package/dist/client/result-DRW7JWXz.mjs +30 -0
  133. package/dist/client/{routeIslandApiConfig-E1EkhhYY.mjs → routeIslandApiConfig-wzR4lKAY.mjs} +1 -1
  134. package/dist/client/scrollToBlock-C86BYkyV.mjs +17 -0
  135. package/dist/client/{shop-4F2jLQPI.mjs → shop-CYT5P-S5.mjs} +8 -8
  136. package/dist/client/{shop-commerce-store-vicweP2K.mjs → shop-commerce-store-wKhsJQxI.mjs} +1 -1
  137. package/dist/client/{shop-commerce-BbfCJjB3.mjs → shop-commerce-ypBu_dx4.mjs} +9 -9
  138. package/dist/client/{shopShared-DlONJt0T.mjs → shopShared-DFGhYrf2.mjs} +52 -6
  139. package/dist/client/{useEventFilters-COYyL3m7.mjs → useEventFilters-blSbN5o7.mjs} +8 -8
  140. package/dist/preview-next/client/runtime.mjs +3 -3
  141. package/dist/{sdk-runtime-CwvFFjB-.mjs → sdk-runtime-2p8uQk1V.mjs} +1 -1
  142. package/dist/{separator-ByL72zUT.mjs → separator-Cvvzk0Oo.mjs} +1 -1
  143. package/dist/server/components.mjs +4066 -3765
  144. package/dist/server/config-validation.mjs +185 -126
  145. package/dist/server/config.mjs +185 -126
  146. package/dist/server/data.mjs +123 -64
  147. package/dist/server/index.mjs +1 -1
  148. package/dist/server/next.mjs +615 -314
  149. package/dist/server/page-converter.mjs +100 -56
  150. package/dist/server/prebuild.mjs +1 -1
  151. package/dist/server/rendering/server.mjs +4041 -3751
  152. package/dist/server/rendering.mjs +4069 -3768
  153. package/dist/server/routing.mjs +149 -72
  154. package/dist/server/server.mjs +124 -65
  155. package/dist/server/theme-bridge.mjs +1122 -310
  156. package/dist/server/theme.mjs +126 -116
  157. package/dist/spinner-CDo6AkDz.mjs +658 -0
  158. package/dist/styles/index.css +75 -212
  159. package/package.json +1 -1
  160. package/dist/_dts/billing/src/checkout/platform.d.ts +0 -77
  161. package/dist/_dts/billing/src/config/env.d.ts +0 -29
  162. package/dist/_dts/billing/src/stripe/client.d.ts +0 -29
  163. package/dist/_dts/blocks/src/system/runtime/hooks/usePaymentVerification.d.ts +0 -63
  164. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventCheckoutHandoffRestore.d.ts +0 -9
  165. package/dist/client/urlParams-D71VXFGx.mjs +0 -47
@@ -1,10 +1,9 @@
1
1
  "use client";
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";
2
+ import { Cn as getBookingInstalmentDepositRefundability, Nn as formatCurrencyAmount, Wt as assertNever$1, in as resolveBookingInitialInstalmentAmountCents, rn as buildBookingInstalmentSchedule, wn as getBookingInstalmentPlanIntervalCount } from "./propsDecoder-DiIeBopB.mjs";
3
+ import { r as CheckIcon } from "./TerminalPanel-CUCNEwlH.mjs";
4
4
  import { n as getBookingMailingListNoteCopy } from "./mailingListSignupCopy-DZSHZrm6.mjs";
5
- import { n as RichText } from "./checkoutUrls-CXhko2Rv.mjs";
5
+ import { t as RichText } from "./RichText-BtfNvQV6.mjs";
6
6
  import { useCallback, useEffect, useReducer, useRef, useState } from "react";
7
- import { z } from "zod";
8
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
8
  //#region ../core/src/date-math.ts
10
9
  function addDaysToDate(date, dayCount) {
@@ -21,18 +20,6 @@ function subtractDaysFromIso(isoString, dayCount) {
21
20
  return addDaysToIso(isoString, -dayCount);
22
21
  }
23
22
  //#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
36
23
  //#region ../core/src/booking-flexible-balance.ts
37
24
  function clampFlexibleBalanceConfiguredAmount(amountCents, totalAmountCents) {
38
25
  return Math.max(0, Math.min(amountCents, totalAmountCents));
@@ -44,70 +31,10 @@ function resolveFlexibleBalanceDueAt(input) {
44
31
  switch (input.dueDateRule.kind) {
45
32
  case "relative_to_start_date": return subtractDaysFromIso(input.bookingStartAt, input.dueDateRule.daysBeforeStart);
46
33
  case "fixed_calendar_date": return input.dueDateRule.dueAt;
47
- default: return assertNever$2(input.dueDateRule);
48
- }
49
- }
50
- function assertNever$2(value) {
51
- throw new Error(`Unexpected value: ${String(value)}`);
52
- }
53
- //#endregion
54
- //#region ../core/src/booking-instalments.ts
55
- function isDepositBearingBookingInstalmentPlan(plan) {
56
- switch (plan.kind) {
57
- case "deposit_plus_one_remainder":
58
- case "deposit_plus_scheduled_instalments": return true;
59
- case "equal_scheduled_instalments": return false;
60
- default: return assertNever$1(plan);
61
- }
62
- }
63
- function getBookingInstalmentDepositRefundability(plan) {
64
- return isDepositBearingBookingInstalmentPlan(plan) ? plan.depositRefundability : null;
65
- }
66
- function clampConfiguredAmount(amountCents, totalAmountCents) {
67
- return Math.max(0, Math.min(amountCents, totalAmountCents));
68
- }
69
- function splitAmountWithRemainderInFirst(totalAmountCents, partCount) {
70
- if (partCount <= 0) return [];
71
- const baseAmountCents = Math.floor(totalAmountCents / partCount);
72
- const remainderCents = totalAmountCents - baseAmountCents * partCount;
73
- return Array.from({ length: partCount }, (_, index) => index === 0 ? baseAmountCents + remainderCents : baseAmountCents);
74
- }
75
- function addIntervalPreservingMonthAnchor(isoString, intervalCount, intervalUnit) {
76
- const date = new Date(isoString);
77
- if (!Number.isFinite(date.getTime())) return isoString;
78
- switch (intervalUnit) {
79
- case "day":
80
- date.setUTCDate(date.getUTCDate() + intervalCount);
81
- return date.toISOString();
82
- case "week":
83
- date.setUTCDate(date.getUTCDate() + intervalCount * 7);
84
- return date.toISOString();
85
- case "month": return addMonthsPreservingAnchorDay(date, intervalCount).toISOString();
86
- default: return assertNever$1(intervalUnit);
87
- }
88
- }
89
- function getBookingInstalmentPlanIntervalCount(plan) {
90
- switch (plan.kind) {
91
- case "deposit_plus_one_remainder": return plan.remainderDueCount;
92
- case "deposit_plus_scheduled_instalments":
93
- case "equal_scheduled_instalments": return plan.intervalCount;
94
- default: return assertNever$1(plan);
34
+ default: return assertNever(input.dueDateRule);
95
35
  }
96
36
  }
97
- function omitZeroAmountFutureRows(rows) {
98
- if (rows.length <= 1) return rows;
99
- const firstRow = rows[0];
100
- if (firstRow === void 0) return [];
101
- return [firstRow, ...rows.slice(1).filter((row) => row.amountCents > 0)];
102
- }
103
- function addMonthsPreservingAnchorDay(date, intervalCount) {
104
- const anchorDay = date.getUTCDate();
105
- const nextMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + intervalCount, 1, date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()));
106
- const lastDayOfTargetMonth = new Date(Date.UTC(nextMonth.getUTCFullYear(), nextMonth.getUTCMonth() + 1, 0)).getUTCDate();
107
- nextMonth.setUTCDate(Math.min(anchorDay, lastDayOfTargetMonth));
108
- return nextMonth;
109
- }
110
- function assertNever$1(value) {
37
+ function assertNever(value) {
111
38
  throw new Error(`Unexpected value: ${String(value)}`);
112
39
  }
113
40
  //#endregion
@@ -124,363 +51,6 @@ function useBookingNowIso() {
124
51
  return nowIso;
125
52
  }
126
53
  //#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
484
54
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
485
55
  function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
486
56
  return {
@@ -555,7 +125,7 @@ function resolveBookingPaymentDueNowCents(input) {
555
125
  totalAmountCents: input.totalCents,
556
126
  config: input.option.config
557
127
  });
558
- default: return assertNever$3(input.option);
128
+ default: return assertNever$1(input.option);
559
129
  }
560
130
  }
561
131
  function buildBookingPaymentSelectionViewModel(input) {
@@ -705,7 +275,7 @@ function buildBookingPaymentOptionViewModel(input) {
705
275
  ctaLabel: copy.ctaLabel
706
276
  };
707
277
  }
708
- default: return assertNever$3(input.option);
278
+ default: return assertNever$1(input.option);
709
279
  }
710
280
  }
711
281
  function getPaymentCadenceLabel(plan) {
@@ -764,14 +334,14 @@ function pollingReducer(state, action) {
764
334
  case "completed":
765
335
  case "failed":
766
336
  case "timeout": return state;
767
- default: return assertNever$3(state);
337
+ default: return assertNever$1(state);
768
338
  }
769
339
  case "polling-timed-out": return {
770
340
  tag: "timeout",
771
341
  result: state.result,
772
342
  error: /* @__PURE__ */ new Error("Polling timed out")
773
343
  };
774
- default: return assertNever$3(action);
344
+ default: return assertNever$1(action);
775
345
  }
776
346
  }
777
347
  //#endregion
@@ -1049,4 +619,4 @@ function BookingMailingListNote(props) {
1049
619
  });
1050
620
  }
1051
621
  //#endregion
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 };
622
+ export { buildBookingPaymentSelectionViewModel as a, useBookingNowIso as c, usePolling as i, BookingConsentAgreement as n, resolveBookingPaymentDueNowCents as o, StepIndicator as r, formatPrice as s, BookingMailingListNote as t };
@@ -1,4 +1,4 @@
1
- import { O as clsx } from "./colorStyles-j5U9v5JA.mjs";
1
+ import { r as clsx } from "./result-DRW7JWXz.mjs";
2
2
  import "react";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  //#region ../blocks/src/system/runtime/shared/components/CheckboxChoice.tsx
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { n as useBlockApi, r as BlockApiError } from "./context-DFmaZa-Q.mjs";
3
- import { t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
2
+ import { t as ThemedButton } from "./ThemedButton-C7WhXuRl.mjs";
3
+ import { n as useBlockApi, r as BlockApiError } from "./context-D_8s12Fp.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
@@ -1,11 +1,11 @@
1
1
  "use client";
2
- import { O as clsx } from "./colorStyles-j5U9v5JA.mjs";
3
- import { $ as getContainerClass, B as calendarWindowBounds, I as calendarMonthDate, J as getEventRuntimeFiltersKey, K as getBlockApiReadStage, L as calendarMonthKey, Q as getCardOrientation, R as calendarPageResponseError, U as planCalendarMonthRanges, V as calendarWindowMonths$1, at as getDayOfWeek, ct as isSameCalendarDay, et as MONTH_NAMES, it as formatDateKey, ln as getLocalScheduleDate, lt as isToday, nt as addMonths, ot as getOrderedDayNames, q as buildEventRuntimeFilters, rt as buildCalendarViewport, sn as formatLocalScheduleDate, ut as shiftCalendarAnchorDate, z as calendarQueryKey } from "./propsDecoder-DZd6RJeA.mjs";
4
- import { a as EventCardClient, i as EventPaginatedListView, n as useEventPagination, o as EventFilters, r as toError, s as formatEventTeacherLine, t as useEventFilters } from "./useEventFilters-COYyL3m7.mjs";
5
- import { o as formatEventRemainingPlaces, p as isEventFull, t as formatEventPrice } from "./pricing-KEAEsibq.mjs";
6
- import { c as groupEventsByDate, f as resolveEventCta, l as resolveEventTimeZone, n as formatDate, p as resolveEventLinkProps, s as formatTime } from "./dates-BBep1JnF.mjs";
7
- import { n as useBlockApi } from "./context-DFmaZa-Q.mjs";
8
- import { n as ThemedButtonLink, t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
2
+ import { r as clsx } from "./result-DRW7JWXz.mjs";
3
+ import { $ as getContainerClass, B as calendarWindowBounds, I as calendarMonthDate, J as getEventRuntimeFiltersKey, K as getBlockApiReadStage, L as calendarMonthKey, Q as getCardOrientation, R as calendarPageResponseError, U as planCalendarMonthRanges, V as calendarWindowMonths$1, _n as getLocalScheduleDate, at as getDayOfWeek, ct as isSameCalendarDay, et as MONTH_NAMES, hn as formatLocalScheduleDate, it as formatDateKey, lt as isToday, nt as addMonths, ot as getOrderedDayNames, q as buildEventRuntimeFilters, rt as buildCalendarViewport, ut as shiftCalendarAnchorDate, z as calendarQueryKey } from "./propsDecoder-DiIeBopB.mjs";
4
+ import { n as ThemedButtonLink, t as ThemedButton } from "./ThemedButton-C7WhXuRl.mjs";
5
+ import { a as EventCardClient, i as EventPaginatedListView, n as useEventPagination, o as EventFilters, r as toError, s as formatEventTeacherLine, t as useEventFilters } from "./useEventFilters-blSbN5o7.mjs";
6
+ import { o as formatEventRemainingPlaces, p as isEventFull, t as formatEventPrice } from "./pricing-DXEh2Lhh.mjs";
7
+ import { c as groupEventsByDate, f as resolveEventCta, l as resolveEventTimeZone, n as formatDate, p as resolveEventLinkProps, s as formatTime } from "./dates-DeJQbQ9T.mjs";
8
+ import { n as useBlockApi } from "./context-D_8s12Fp.mjs";
9
9
  import { t as createBodyThemePortalRoot } from "./themePortalRoot-AGs4cE7t.mjs";
10
10
  import { t as ModalShell } from "./ModalShell-CqkBvBIC.mjs";
11
11
  import React, { createContext, useCallback, useContext, useEffect, useId, useMemo, useRef, useState } from "react";