@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
@@ -1181,7 +1181,25 @@ function addMonthsPreservingAnchorDay(date, intervalCount) {
1181
1181
  function assertNever$18(value) {
1182
1182
  throw new Error(`Unexpected value: ${String(value)}`);
1183
1183
  }
1184
- var init_booking_instalments = __esmMin((() => {}));
1184
+ var init_booking_instalments = __esmMin((() => {})), init_booking_instalment_deposit = __esmMin((() => {
1185
+ init_result$1();
1186
+ init_currency_format();
1187
+ init_booking_instalments();
1188
+ }));
1189
+ var init_booking_live_payment_terms = __esmMin((() => {}));
1190
+ //#endregion
1191
+ //#region ../core/src/booking-payment-options.ts
1192
+ /** Automatic instalments and a flexible balance cannot share one booking offer. */
1193
+ function validateBookingPaymentOptionKinds(kinds) {
1194
+ if (kinds.length === 0) return err$3("no_options");
1195
+ const uniqueKinds = new Set(kinds);
1196
+ if (uniqueKinds.size !== kinds.length) return err$3("duplicate_kind");
1197
+ if (uniqueKinds.has("instalment_plan") && uniqueKinds.has("flexible_balance")) return err$3("incompatible_collection_options");
1198
+ return ok$3(void 0);
1199
+ }
1200
+ var init_booking_payment_options = __esmMin((() => {
1201
+ init_result$1();
1202
+ }));
1185
1203
  //#endregion
1186
1204
  //#region ../core/src/booking-time-zone.ts
1187
1205
  function isValidBookingTimeZone(timeZone) {
@@ -2847,6 +2865,9 @@ var init_src$2 = __esmMin((() => {
2847
2865
  init_booking_flexible_balance();
2848
2866
  init_booking_refunds();
2849
2867
  init_booking_instalments();
2868
+ init_booking_instalment_deposit();
2869
+ init_booking_live_payment_terms();
2870
+ init_booking_payment_options();
2850
2871
  init_booking_date_time();
2851
2872
  init_booking_consent();
2852
2873
  init_appointment_service_categories();
@@ -13734,7 +13755,7 @@ function isRecord$33(value) {
13734
13755
  * callsites even though arrays pass at runtime. Follow-up cleanup should replace
13735
13756
  * this API with a more precise predicate type and migrate consumers.
13736
13757
  */
13737
- function isObjectRecord$2(value) {
13758
+ function isObjectRecord$3(value) {
13738
13759
  return typeof value === "object" && value !== null;
13739
13760
  }
13740
13761
  var init_typeGuards = __esmMin((() => {}));
@@ -13819,70 +13840,119 @@ var init_richTextSchema = __esmMin((() => {
13819
13840
  }).strict();
13820
13841
  }));
13821
13842
  //#endregion
13822
- //#region ../blocks/src/system/blocks/shared/bookingPaymentTerms.ts
13823
- var bookingDepositRefundPolicySchema$1, bookingInstalmentPlanSchema$1, bookingFlexibleBalanceDueDateRuleSchema$1, bookingFlexibleBalanceConfigSchema$1, blockBookingPaymentCollectionOptionSchema, blockBookingPaymentTermsSchema;
13824
- var init_bookingPaymentTerms = __esmMin((() => {
13825
- bookingDepositRefundPolicySchema$1 = z$1.enum(["refundable", "non_refundable"]);
13826
- bookingInstalmentPlanSchema$1 = z$1.union([
13827
- z$1.object({
13843
+ //#region ../core/src/booking-payment-schemas.ts
13844
+ function createInstalmentPlanSchema(object) {
13845
+ return z$1.discriminatedUnion("kind", [
13846
+ object({
13828
13847
  kind: z$1.literal("deposit_plus_one_remainder"),
13829
- depositAmountCents: z$1.number().int().min(0),
13830
- depositRefundability: bookingDepositRefundPolicySchema$1,
13831
- remainderDueCount: z$1.number().int().positive(),
13832
- intervalUnit: z$1.enum([
13833
- "day",
13834
- "week",
13835
- "month"
13836
- ])
13848
+ depositAmountCents: nonNegativeIntegerSchema,
13849
+ depositRefundability: depositRefundPolicySchema,
13850
+ remainderDueCount: positiveIntegerSchema,
13851
+ intervalUnit: intervalUnitSchema
13837
13852
  }),
13838
- z$1.object({
13853
+ object({
13839
13854
  kind: z$1.literal("deposit_plus_scheduled_instalments"),
13840
- depositAmountCents: z$1.number().int().min(0),
13841
- depositRefundability: bookingDepositRefundPolicySchema$1,
13842
- instalmentCount: z$1.number().int().positive(),
13843
- intervalCount: z$1.number().int().positive(),
13844
- intervalUnit: z$1.enum([
13845
- "day",
13846
- "week",
13847
- "month"
13848
- ])
13855
+ depositAmountCents: nonNegativeIntegerSchema,
13856
+ depositRefundability: depositRefundPolicySchema,
13857
+ instalmentCount: positiveIntegerSchema,
13858
+ intervalCount: positiveIntegerSchema,
13859
+ intervalUnit: intervalUnitSchema
13849
13860
  }),
13850
- z$1.object({
13861
+ object({
13851
13862
  kind: z$1.literal("equal_scheduled_instalments"),
13852
- instalmentCount: z$1.number().int().positive(),
13853
- intervalCount: z$1.number().int().positive(),
13854
- intervalUnit: z$1.enum([
13855
- "day",
13856
- "week",
13857
- "month"
13858
- ])
13863
+ instalmentCount: positiveIntegerSchema,
13864
+ intervalCount: positiveIntegerSchema,
13865
+ intervalUnit: intervalUnitSchema
13859
13866
  })
13860
13867
  ]);
13861
- bookingFlexibleBalanceDueDateRuleSchema$1 = z$1.union([z$1.object({
13868
+ }
13869
+ function createFlexibleBalanceSchemas(object) {
13870
+ const dueDateRule = z$1.discriminatedUnion("kind", [object({
13862
13871
  kind: z$1.literal("relative_to_start_date"),
13863
- daysBeforeStart: z$1.number().int().positive()
13864
- }), z$1.object({
13872
+ daysBeforeStart: positiveIntegerSchema
13873
+ }), object({
13865
13874
  kind: z$1.literal("fixed_calendar_date"),
13866
13875
  dueAt: z$1.string().datetime()
13867
13876
  })]);
13868
- bookingFlexibleBalanceConfigSchema$1 = z$1.object({
13869
- upfrontAmountCents: z$1.number().int().min(0),
13870
- dueDateRule: bookingFlexibleBalanceDueDateRuleSchema$1,
13871
- depositRefundability: bookingDepositRefundPolicySchema$1
13872
- });
13873
- blockBookingPaymentCollectionOptionSchema = z$1.union([
13874
- z$1.object({ kind: z$1.literal("upfront") }),
13875
- z$1.object({ kind: z$1.literal("deferred_manual") }),
13876
- z$1.object({
13877
+ return {
13878
+ dueDateRule,
13879
+ config: object({
13880
+ upfrontAmountCents: nonNegativeIntegerSchema,
13881
+ dueDateRule,
13882
+ depositRefundability: depositRefundPolicySchema
13883
+ })
13884
+ };
13885
+ }
13886
+ function buildBookingPaymentOptionSchemas(object) {
13887
+ const instalmentPlan = createInstalmentPlanSchema(object);
13888
+ const flexibleBalance = createFlexibleBalanceSchemas(object);
13889
+ const paymentCollectionOption = z$1.discriminatedUnion("kind", [
13890
+ object({ kind: z$1.literal("upfront") }),
13891
+ object({ kind: z$1.literal("deferred_manual") }),
13892
+ object({
13877
13893
  kind: z$1.literal("instalment_plan"),
13878
- plan: bookingInstalmentPlanSchema$1
13894
+ plan: instalmentPlan
13879
13895
  }),
13880
- z$1.object({
13896
+ object({
13881
13897
  kind: z$1.literal("flexible_balance"),
13882
- config: bookingFlexibleBalanceConfigSchema$1
13898
+ config: flexibleBalance.config
13883
13899
  })
13884
13900
  ]);
13885
- blockBookingPaymentTermsSchema = z$1.object({ allowedOptions: z$1.array(blockBookingPaymentCollectionOptionSchema).min(1) });
13901
+ const paymentTerms = object({ allowedOptions: z$1.array(paymentCollectionOption) }).superRefine(({ allowedOptions }, ctx) => {
13902
+ const result = validateBookingPaymentOptionKinds(allowedOptions.map(({ kind }) => kind));
13903
+ if (!result.ok) ctx.addIssue({
13904
+ code: "custom",
13905
+ path: ["allowedOptions"],
13906
+ message: paymentOptionKindsMessages[result.error]
13907
+ });
13908
+ });
13909
+ const paymentOptionsChoice = z$1.discriminatedUnion("source", [z$1.strictObject({ source: z$1.literal("default") }), z$1.strictObject({
13910
+ source: z$1.literal("custom"),
13911
+ paymentTerms
13912
+ })]);
13913
+ return {
13914
+ depositRefundPolicy: depositRefundPolicySchema,
13915
+ instalmentPlan,
13916
+ flexibleBalanceDueDateRule: flexibleBalance.dueDateRule,
13917
+ flexibleBalanceConfig: flexibleBalance.config,
13918
+ paymentCollectionOption,
13919
+ paymentTerms,
13920
+ paymentOptionsChoice
13921
+ };
13922
+ }
13923
+ function createBookingPaymentOptionSchemas(mode) {
13924
+ return mode === "strict" ? buildBookingPaymentOptionSchemas(strictObject) : buildBookingPaymentOptionSchemas(stripObject);
13925
+ }
13926
+ var stripObject, strictObject, depositRefundPolicySchema, intervalUnitSchema, nonNegativeIntegerSchema, positiveIntegerSchema, paymentOptionKindsMessages, bookingPaymentOptionSchemas, bookingPaymentTermsSchema;
13927
+ var init_booking_payment_schemas = __esmMin((() => {
13928
+ init_booking_payment_options();
13929
+ stripObject = (shape) => z$1.object(shape);
13930
+ strictObject = (shape) => z$1.strictObject(shape);
13931
+ depositRefundPolicySchema = z$1.enum(["refundable", "non_refundable"]);
13932
+ intervalUnitSchema = z$1.enum([
13933
+ "day",
13934
+ "week",
13935
+ "month"
13936
+ ]);
13937
+ nonNegativeIntegerSchema = z$1.number().int().nonnegative();
13938
+ positiveIntegerSchema = z$1.number().int().positive();
13939
+ paymentOptionKindsMessages = {
13940
+ no_options: "Choose at least one way for customers to pay.",
13941
+ duplicate_kind: "Choose each payment option only once.",
13942
+ incompatible_collection_options: "Offer instalments or a deposit with the rest paid later, but not both."
13943
+ };
13944
+ bookingPaymentOptionSchemas = createBookingPaymentOptionSchemas("strip");
13945
+ bookingPaymentOptionSchemas.depositRefundPolicy;
13946
+ bookingPaymentOptionSchemas.instalmentPlan;
13947
+ bookingPaymentOptionSchemas.flexibleBalanceDueDateRule;
13948
+ bookingPaymentOptionSchemas.flexibleBalanceConfig;
13949
+ bookingPaymentOptionSchemas.paymentCollectionOption;
13950
+ bookingPaymentTermsSchema = bookingPaymentOptionSchemas.paymentTerms;
13951
+ bookingPaymentOptionSchemas.paymentOptionsChoice;
13952
+ })), blockBookingPaymentTermsSchema;
13953
+ var init_bookingPaymentTerms = __esmMin((() => {
13954
+ init_booking_payment_schemas();
13955
+ blockBookingPaymentTermsSchema = bookingPaymentTermsSchema;
13886
13956
  }));
13887
13957
  //#endregion
13888
13958
  //#region ../blocks/src/system/blocks/shared/bookingConsent.ts
@@ -14550,7 +14620,7 @@ function defineClientOwnedBlockRuntime(runtime) {
14550
14620
  var init_runtime = __esmMin((() => {}));
14551
14621
  //#endregion
14552
14622
  //#region ../blocks/src/system/blocks/shop.shared.ts
14553
- var publicPassProductFields, purchasablePublicPassProductSchema, publicPassProductSchema, publicPassProductCollectionSchema, publicMembershipProductSchema, publicMembershipProductCollectionSchema;
14623
+ var publicPassProductFields, purchasablePublicPassProductSchema, publicPassProductSchema, publicPassProductCollectionSchema, publicMembershipProductFields, purchasablePublicMembershipProductSchema, publicMembershipProductSchema, publicMembershipProductCollectionSchema;
14554
14624
  var init_shop_shared = __esmMin((() => {
14555
14625
  publicPassProductFields = {
14556
14626
  id: z$1.string(),
@@ -14575,7 +14645,7 @@ var init_shop_shared = __esmMin((() => {
14575
14645
  unavailabilityReason: z$1.literal("online_payments_unavailable")
14576
14646
  })]);
14577
14647
  publicPassProductCollectionSchema = z$1.object({ passes: z$1.array(publicPassProductSchema) });
14578
- publicMembershipProductSchema = z$1.object({
14648
+ publicMembershipProductFields = {
14579
14649
  id: z$1.string(),
14580
14650
  name: z$1.string(),
14581
14651
  description: z$1.string().nullable(),
@@ -14584,7 +14654,16 @@ var init_shop_shared = __esmMin((() => {
14584
14654
  billingInterval: z$1.enum(["month", "year"]),
14585
14655
  eligibleCategoryIds: z$1.array(z$1.string()),
14586
14656
  eligibleCategoryNames: z$1.array(z$1.string())
14657
+ };
14658
+ purchasablePublicMembershipProductSchema = z$1.object({
14659
+ ...publicMembershipProductFields,
14660
+ purchaseAvailability: z$1.literal("purchasable")
14587
14661
  });
14662
+ publicMembershipProductSchema = z$1.discriminatedUnion("purchaseAvailability", [purchasablePublicMembershipProductSchema, z$1.object({
14663
+ ...publicMembershipProductFields,
14664
+ purchaseAvailability: z$1.literal("display_only"),
14665
+ unavailabilityReason: z$1.literal("online_payments_unavailable")
14666
+ })]);
14588
14667
  publicMembershipProductCollectionSchema = z$1.object({ memberships: z$1.array(publicMembershipProductSchema) });
14589
14668
  }));
14590
14669
  //#endregion
@@ -30132,14 +30211,14 @@ var init_non_block_islands = __esmMin((() => {
30132
30211
  }));
30133
30212
  //#endregion
30134
30213
  //#region ../blocks/src/contracts/islands.ts
30135
- function isObjectRecord$1(value) {
30214
+ function isObjectRecord$2(value) {
30136
30215
  return typeof value === "object" && value !== null;
30137
30216
  }
30138
30217
  function pickRecordKeys(source, keys) {
30139
30218
  return Object.fromEntries(keys.map((key) => [key, source[key]]));
30140
30219
  }
30141
30220
  function expectEncodedRecord(value, label) {
30142
- if (isObjectRecord$1(value)) return value;
30221
+ if (isObjectRecord$2(value)) return value;
30143
30222
  throw new Error(`Expected ${label} codec to encode an object`);
30144
30223
  }
30145
30224
  function prefixIssues(prefix, issues) {
@@ -30180,7 +30259,7 @@ function createInteractiveIslandCodec(options) {
30180
30259
  };
30181
30260
  },
30182
30261
  decode: (input) => {
30183
- if (!isObjectRecord$1(input)) return decodeFailure([{
30262
+ if (!isObjectRecord$2(input)) return decodeFailure([{
30184
30263
  path: [],
30185
30264
  message: "Expected island props object"
30186
30265
  }]);
@@ -30191,7 +30270,7 @@ function createInteractiveIslandCodec(options) {
30191
30270
  message: `Expected renderKind "${options.runtime.kind}"`
30192
30271
  });
30193
30272
  const renderInput = input.render;
30194
- if (!isObjectRecord$1(renderInput)) renderIssues.push({
30273
+ if (!isObjectRecord$2(renderInput)) renderIssues.push({
30195
30274
  path: ["render"],
30196
30275
  message: "Expected render object"
30197
30276
  });
@@ -30605,19 +30684,17 @@ function getBookingServicePaymentSelectionMode(service) {
30605
30684
  if (service?.paymentTermsAvailability?.kind === "pending_stripe_setup") return "pending_stripe_setup";
30606
30685
  const allowedKinds = service?.paymentTerms?.allowedOptions.map((option) => option.kind) ?? [];
30607
30686
  if (allowedKinds.length === 0) return "implicit_upfront";
30608
- if (allowedKinds.length === 1) {
30609
- const onlyKind = allowedKinds[0];
30610
- if (!onlyKind) return "unsupported";
30611
- switch (onlyKind) {
30612
- case "upfront": return "implicit_upfront";
30613
- case "deferred_manual": return "implicit_deferred_manual";
30614
- case "instalment_plan": return "implicit_instalment_plan";
30615
- case "flexible_balance": return "implicit_flexible_balance";
30616
- default: return assertNever$11(onlyKind);
30617
- }
30687
+ if (!validateBookingPaymentOptionKinds(allowedKinds).ok) return "unsupported";
30688
+ if (allowedKinds.length > 1) return "choice_required";
30689
+ const onlyKind = allowedKinds[0];
30690
+ switch (onlyKind) {
30691
+ case "upfront": return "implicit_upfront";
30692
+ case "deferred_manual": return "implicit_deferred_manual";
30693
+ case "instalment_plan": return "implicit_instalment_plan";
30694
+ case "flexible_balance": return "implicit_flexible_balance";
30695
+ case void 0: return "unsupported";
30696
+ default: return assertNever$11(onlyKind);
30618
30697
  }
30619
- if (allowedKinds.length === 2 && allowedKinds.includes("upfront") && (allowedKinds.includes("deferred_manual") || allowedKinds.includes("instalment_plan") || allowedKinds.includes("flexible_balance"))) return "choice_required";
30620
- return "unsupported";
30621
30698
  }
30622
30699
  function resolveDefaultBookingServiceId(formConfig, services) {
30623
30700
  const configuredServiceId = toTrimmedString(formConfig?.settings?.serviceId);
@@ -37394,7 +37471,7 @@ function buildPassesMembershipsDisplay(options) {
37394
37471
  product: pass
37395
37472
  } : {
37396
37473
  kind: "unavailable",
37397
- label: "Online purchasing coming soon."
37474
+ label: "Online purchasing is unavailable."
37398
37475
  }
37399
37476
  };
37400
37477
  });
@@ -37404,7 +37481,14 @@ function buildPassesMembershipsDisplay(options) {
37404
37481
  description: options.showDescriptions ? membership.description : null,
37405
37482
  priceLabel: formatCommercePrice(membership.price, membership.currency),
37406
37483
  intervalLabel: formatInterval(membership.billingInterval),
37407
- actionLabel: options.membershipActionLabel
37484
+ action: membership.purchaseAvailability === "purchasable" ? {
37485
+ kind: "purchase",
37486
+ label: options.membershipActionLabel,
37487
+ product: membership
37488
+ } : {
37489
+ kind: "unavailable",
37490
+ label: "Online purchasing is unavailable."
37491
+ }
37408
37492
  }));
37409
37493
  return {
37410
37494
  kind: "passes-memberships",
@@ -37755,7 +37839,14 @@ var init_shop_interactive = __esmMin((() => {
37755
37839
  description: z$1.string().nullable(),
37756
37840
  priceLabel: z$1.string(),
37757
37841
  intervalLabel: z$1.string(),
37758
- actionLabel: z$1.string()
37842
+ action: z$1.discriminatedUnion("kind", [z$1.object({
37843
+ kind: z$1.literal("purchase"),
37844
+ label: z$1.string(),
37845
+ product: purchasablePublicMembershipProductSchema
37846
+ }), z$1.object({
37847
+ kind: z$1.literal("unavailable"),
37848
+ label: z$1.string()
37849
+ })])
37759
37850
  });
37760
37851
  passesMembershipsDisplaySchema = z$1.object({
37761
37852
  kind: z$1.literal("passes-memberships"),
@@ -100153,6 +100244,20 @@ var init_useAvailableSlots = __esmMin((() => {
100153
100244
  AVAILABILITY_REFRESH_JITTER_MS = 5e3;
100154
100245
  }));
100155
100246
  //#endregion
100247
+ //#region ../blocks/src/system/runtime/hooks/useBookingNowIso.ts
100248
+ /**
100249
+ * The moment a booking or registration flow opened, as an ISO timestamp.
100250
+ *
100251
+ * Payment previews take this as their "now" so the pure view-model builders
100252
+ * never read the clock themselves. It's captured once per mount, which keeps
100253
+ * memoised previews stable across renders.
100254
+ */
100255
+ function useBookingNowIso() {
100256
+ const [nowIso] = useState(() => (/* @__PURE__ */ new Date()).toISOString());
100257
+ return nowIso;
100258
+ }
100259
+ var init_useBookingNowIso = __esmMin((() => {}));
100260
+ //#endregion
100156
100261
  //#region ../blocks/src/system/runtime/hooks/useBookingSubmission.state.ts
100157
100262
  function bookingSubmissionReducer(state, action) {
100158
100263
  switch (action.type) {
@@ -100555,6 +100660,679 @@ var init_useDiscountCodeUi = __esmMin((() => {
100555
100660
  init_useDiscountCodeUi_state();
100556
100661
  }));
100557
100662
  //#endregion
100663
+ //#region ../commerce/src/purchase/types.ts
100664
+ var init_types$2 = __esmMin((() => {}));
100665
+ var init_allocation = __esmMin((() => {
100666
+ init_src$2();
100667
+ })), ORDER_STATUSES, CLOSED_ORDER_STATUSES, ORDER_PAYMENT_METHODS, CHECKOUT_COMMIT_STATES, ORDER_CHECKOUT_RECONCILIATION_STATES, ORDER_ITEM_RECONCILIATION_STATES, ORDER_ITEM_COMMIT_STATES, RESERVATION_FINALIZATION_STATES, DISCOUNT_REDEMPTION_STATUSES, ORDER_ITEM_KINDS;
100668
+ var init_orderTypes = __esmMin((() => {
100669
+ ORDER_STATUSES = [
100670
+ "pending",
100671
+ "paid",
100672
+ "partially_refunded",
100673
+ "refunded",
100674
+ "failed",
100675
+ "cancelled"
100676
+ ];
100677
+ new Set(ORDER_STATUSES);
100678
+ CLOSED_ORDER_STATUSES = ["failed", "cancelled"];
100679
+ new Set(CLOSED_ORDER_STATUSES);
100680
+ ORDER_PAYMENT_METHODS = [
100681
+ "stripe",
100682
+ "store_credit",
100683
+ "mixed",
100684
+ "pass_redemption",
100685
+ "membership_access",
100686
+ "free",
100687
+ "manual",
100688
+ "waived"
100689
+ ];
100690
+ new Set(ORDER_PAYMENT_METHODS);
100691
+ CHECKOUT_COMMIT_STATES = [
100692
+ "pending",
100693
+ "committing",
100694
+ "committed",
100695
+ "compensated"
100696
+ ];
100697
+ new Set(CHECKOUT_COMMIT_STATES);
100698
+ ORDER_CHECKOUT_RECONCILIATION_STATES = [
100699
+ "not_needed",
100700
+ "evidence_pending",
100701
+ "needed"
100702
+ ];
100703
+ new Set(ORDER_CHECKOUT_RECONCILIATION_STATES);
100704
+ ORDER_ITEM_RECONCILIATION_STATES = ["not_needed", "needed"];
100705
+ new Set(ORDER_ITEM_RECONCILIATION_STATES);
100706
+ ORDER_ITEM_COMMIT_STATES = [
100707
+ "pending",
100708
+ "committed",
100709
+ "compensated"
100710
+ ];
100711
+ new Set(ORDER_ITEM_COMMIT_STATES);
100712
+ RESERVATION_FINALIZATION_STATES = [
100713
+ "not_applicable",
100714
+ "reserved",
100715
+ "consumed",
100716
+ "released"
100717
+ ];
100718
+ new Set(RESERVATION_FINALIZATION_STATES);
100719
+ DISCOUNT_REDEMPTION_STATUSES = [
100720
+ "pending",
100721
+ "redeemed",
100722
+ "released",
100723
+ "expired"
100724
+ ];
100725
+ new Set(DISCOUNT_REDEMPTION_STATUSES);
100726
+ ORDER_ITEM_KINDS = [
100727
+ "event_ticket",
100728
+ "product",
100729
+ "pass",
100730
+ "event_series_registration",
100731
+ "appointment",
100732
+ "membership"
100733
+ ];
100734
+ new Set(ORDER_ITEM_KINDS);
100735
+ }));
100736
+ //#endregion
100737
+ //#region ../commerce/src/purchase/orderPlanningTypes.ts
100738
+ var init_orderPlanningTypes = __esmMin((() => {}));
100739
+ //#endregion
100740
+ //#region ../commerce/src/utils/assertNever.ts
100741
+ function assertNever$8(value, message) {
100742
+ if (message) throw new Error(message);
100743
+ throw new Error(`Unexpected value: ${String(value)}`);
100744
+ }
100745
+ var init_assertNever = __esmMin((() => {}));
100746
+ //#endregion
100747
+ //#region ../commerce/src/purchase/bookingInstalmentSchedule.ts
100748
+ function resolveBookingInitialInstalmentAmountCents(input) {
100749
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
100750
+ switch (input.plan.kind) {
100751
+ case "deposit_plus_one_remainder":
100752
+ case "deposit_plus_scheduled_instalments": return clampConfiguredAmount(input.plan.depositAmountCents, totalAmountCents);
100753
+ case "equal_scheduled_instalments": return splitAmountWithRemainderInFirst(totalAmountCents, input.plan.instalmentCount)[0] ?? 0;
100754
+ default: return assertNever$8(input.plan);
100755
+ }
100756
+ }
100757
+ function buildBookingInstalmentSchedule(input) {
100758
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
100759
+ switch (input.plan.kind) {
100760
+ case "deposit_plus_one_remainder": {
100761
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
100762
+ const remainderAmountCents = Math.max(0, totalAmountCents - depositAmountCents);
100763
+ return omitZeroAmountFutureRows([createScheduleRow({
100764
+ sequence: 1,
100765
+ stateAtBooking: "paid_today",
100766
+ dueAt: input.anchorAt,
100767
+ amountCents: depositAmountCents
100768
+ }), createScheduleRow({
100769
+ sequence: 2,
100770
+ stateAtBooking: "scheduled",
100771
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, input.plan.remainderDueCount, input.plan.intervalUnit),
100772
+ amountCents: remainderAmountCents
100773
+ })]);
100774
+ }
100775
+ case "deposit_plus_scheduled_instalments": {
100776
+ const plan = input.plan;
100777
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
100778
+ const instalmentAmounts = splitAmountWithRemainderInFirst(Math.max(0, totalAmountCents - depositAmountCents), plan.instalmentCount);
100779
+ return omitZeroAmountFutureRows([createScheduleRow({
100780
+ sequence: 1,
100781
+ stateAtBooking: "paid_today",
100782
+ dueAt: input.anchorAt,
100783
+ amountCents: depositAmountCents
100784
+ }), ...instalmentAmounts.map((amountCents, index) => createScheduleRow({
100785
+ sequence: index + 2,
100786
+ stateAtBooking: "scheduled",
100787
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * (index + 1), plan.intervalUnit),
100788
+ amountCents
100789
+ }))]);
100790
+ }
100791
+ case "equal_scheduled_instalments": {
100792
+ const plan = input.plan;
100793
+ return omitZeroAmountFutureRows(splitAmountWithRemainderInFirst(totalAmountCents, plan.instalmentCount).map((amountCents, index) => createScheduleRow({
100794
+ sequence: index + 1,
100795
+ stateAtBooking: index === 0 ? "paid_today" : "scheduled",
100796
+ dueAt: index === 0 ? input.anchorAt : addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * index, plan.intervalUnit),
100797
+ amountCents
100798
+ })));
100799
+ }
100800
+ default: return assertNever$8(input.plan);
100801
+ }
100802
+ }
100803
+ function createScheduleRow(input) {
100804
+ return {
100805
+ id: `payment-${input.sequence}`,
100806
+ sequence: input.sequence,
100807
+ stateAtBooking: input.stateAtBooking,
100808
+ dueAt: input.dueAt,
100809
+ amountCents: input.amountCents
100810
+ };
100811
+ }
100812
+ var init_bookingInstalmentSchedule = __esmMin((() => {
100813
+ init_src$2();
100814
+ init_assertNever();
100815
+ }));
100816
+ var init_bookingPaymentSelection = __esmMin((() => {
100817
+ init_assertNever();
100818
+ }));
100819
+ var init_cancellationPolicy = __esmMin((() => {}));
100820
+ var init_checkoutCollectionPlan = __esmMin((() => {
100821
+ init_src$2();
100822
+ }));
100823
+ var init_checkoutCommitPlan = __esmMin((() => {}));
100824
+ var init_checkoutDiscountContextPlanning = __esmMin((() => {
100825
+ init_src$2();
100826
+ }));
100827
+ //#endregion
100828
+ //#region ../commerce/src/purchase/checkoutErrorCodes.ts
100829
+ var init_checkoutErrorCodes = __esmMin((() => {}));
100830
+ var init_checkoutOrderItemProjection = __esmMin((() => {}));
100831
+ //#endregion
100832
+ //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
100833
+ function planCheckoutPaymentFlow(options) {
100834
+ const amountDueCents = toNonNegativeCents(options.amountDueCents);
100835
+ const discountCents = toNonNegativeCents(options.discountCents);
100836
+ const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
100837
+ const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
100838
+ if (amountDueCents <= 0) return {
100839
+ kind: "bypass",
100840
+ bypassReason: discountCents > 0 ? "discount_free" : "free",
100841
+ reserveCreditCents: 0
100842
+ };
100843
+ if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
100844
+ kind: "stripe",
100845
+ reserveCreditCents: toNonNegativeCents(0)
100846
+ };
100847
+ if (availableCreditCents >= amountDueCents) return {
100848
+ kind: "store_credit_only",
100849
+ reserveCreditCents: amountDueCents
100850
+ };
100851
+ return {
100852
+ kind: "stripe",
100853
+ reserveCreditCents: planMixedPaymentCreditReservation({
100854
+ amountDueCents,
100855
+ availableCreditCents,
100856
+ minimumStripeChargeCents
100857
+ })
100858
+ };
100859
+ }
100860
+ function planMixedPaymentCreditReservation(input) {
100861
+ const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
100862
+ if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
100863
+ if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
100864
+ return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
100865
+ }
100866
+ /**
100867
+ * Apply site credit to a flexible-balance booking before card payment.
100868
+ *
100869
+ * Credit first reduces the configured payment due now. Once that payment is
100870
+ * covered, any remaining credit reduces the later balance. If a partial credit
100871
+ * application would leave a positive card charge below Stripe's minimum, less
100872
+ * credit is used so the configured payment can still be collected.
100873
+ */
100874
+ function planFlexibleBalanceCreditFirst(input) {
100875
+ const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
100876
+ const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
100877
+ const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
100878
+ const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
100879
+ if (availableCreditCents >= totalCents && totalCents > 0) return {
100880
+ kind: "credit_only",
100881
+ reserveCreditCents: totalCents,
100882
+ cardDueNowCents: toNonNegativeCents(0),
100883
+ laterBalanceCents: toNonNegativeCents(0)
100884
+ };
100885
+ let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
100886
+ if (reserveCreditCents >= configuredDueNowCents) return {
100887
+ kind: "flexible_balance",
100888
+ reserveCreditCents,
100889
+ cardDueNowCents: toNonNegativeCents(0),
100890
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
100891
+ };
100892
+ const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
100893
+ if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
100894
+ if (configuredDueNowCents < minimumStripeChargeCents) return {
100895
+ kind: "card_below_minimum",
100896
+ reserveCreditCents: toNonNegativeCents(0),
100897
+ cardDueNowCents: configuredDueNowCents,
100898
+ laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
100899
+ };
100900
+ reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
100901
+ }
100902
+ const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
100903
+ return {
100904
+ kind: "flexible_balance",
100905
+ reserveCreditCents,
100906
+ cardDueNowCents,
100907
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
100908
+ };
100909
+ }
100910
+ var init_checkoutPaymentFlow = __esmMin((() => {
100911
+ init_src$2();
100912
+ }));
100913
+ var init_checkoutPaymentPlanPlanning = __esmMin((() => {
100914
+ init_src$2();
100915
+ init_assertNever();
100916
+ }));
100917
+ var init_checkoutPaymentTerms = __esmMin((() => {
100918
+ init_src$2();
100919
+ init_assertNever();
100920
+ init_bookingPaymentSelection();
100921
+ }));
100922
+ var init_checkoutQuantity = __esmMin((() => {
100923
+ init_src$2();
100924
+ }));
100925
+ //#endregion
100926
+ //#region ../commerce/src/purchase/settlement.ts
100927
+ function normalizeCurrencyCode(raw) {
100928
+ const normalized = raw.trim().toUpperCase();
100929
+ if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
100930
+ return normalized;
100931
+ }
100932
+ var init_settlement = __esmMin((() => {
100933
+ init_src$2();
100934
+ }));
100935
+ var init_result = __esmMin((() => {
100936
+ init_src$2();
100937
+ }));
100938
+ var init_checkoutSettlement = __esmMin((() => {
100939
+ init_src$2();
100940
+ init_settlement();
100941
+ init_result();
100942
+ }));
100943
+ var init_checkoutStripeFinalizationPlanning = __esmMin((() => {}));
100944
+ var init_checkoutStripeSessionPlanning = __esmMin((() => {
100945
+ init_src$2();
100946
+ })), datedOfferingSharedEngineMetadataShape, orderCheckoutSessionMetadataBaseShape, absentDatedOfferingSharedEngineMetadataShape, LegacyOrderCheckoutSessionMetadataSchema, SharedDatedOfferingOrderCheckoutSessionMetadataSchema;
100947
+ var init_checkoutSessionMetadata = __esmMin((() => {
100948
+ datedOfferingSharedEngineMetadataShape = {
100949
+ datedOfferingEngineContractVersion: z$1.literal("shared_v1"),
100950
+ datedOfferingEngineRouteKind: z$1.literal("shared_whole_series_registration"),
100951
+ datedOfferingCapacityHoldId: z$1.string().uuid(),
100952
+ datedOfferingCapacityHoldAuditRef: z$1.string().uuid(),
100953
+ customerId: z$1.string().uuid(),
100954
+ eventSeriesId: z$1.string().uuid()
100955
+ };
100956
+ z$1.object(datedOfferingSharedEngineMetadataShape);
100957
+ orderCheckoutSessionMetadataBaseShape = {
100958
+ type: z$1.literal("order"),
100959
+ site_id: z$1.string().uuid(),
100960
+ order_id: z$1.string().uuid().optional(),
100961
+ customer_email: z$1.string().email().optional(),
100962
+ customer_name: z$1.string().optional(),
100963
+ product_id: z$1.string().uuid().optional(),
100964
+ attendee_id: z$1.string().uuid().optional(),
100965
+ occurrence_id: z$1.string().uuid().optional(),
100966
+ tickets_count: z$1.string().optional(),
100967
+ notes: z$1.string().optional(),
100968
+ discount_redemption_id: z$1.string().uuid().optional(),
100969
+ discount_code_id: z$1.string().uuid().optional(),
100970
+ discount_code: z$1.string().optional(),
100971
+ discount_public_label: z$1.string().optional(),
100972
+ credit_reservation_id: z$1.string().uuid().optional(),
100973
+ credit_reserved_cents: z$1.string().optional(),
100974
+ discount_code_amount_cents: z$1.string().optional(),
100975
+ order_payment_reason: z$1.enum([
100976
+ "instalment_payoff",
100977
+ "flexible_balance_initial",
100978
+ "flexible_balance_paydown"
100979
+ ]).optional(),
100980
+ order_payment_plan_id: z$1.string().uuid().optional(),
100981
+ order_flexible_balance_contract_id: z$1.string().uuid().optional()
100982
+ };
100983
+ absentDatedOfferingSharedEngineMetadataShape = {
100984
+ datedOfferingEngineContractVersion: z$1.never().optional(),
100985
+ datedOfferingEngineRouteKind: z$1.never().optional(),
100986
+ datedOfferingCapacityHoldId: z$1.never().optional(),
100987
+ datedOfferingCapacityHoldAuditRef: z$1.never().optional(),
100988
+ customerId: z$1.never().optional(),
100989
+ eventSeriesId: z$1.never().optional()
100990
+ };
100991
+ LegacyOrderCheckoutSessionMetadataSchema = z$1.object({
100992
+ ...orderCheckoutSessionMetadataBaseShape,
100993
+ ...absentDatedOfferingSharedEngineMetadataShape
100994
+ });
100995
+ SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z$1.object({
100996
+ ...orderCheckoutSessionMetadataBaseShape,
100997
+ ...datedOfferingSharedEngineMetadataShape
100998
+ });
100999
+ z$1.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
101000
+ }));
101001
+ var init_canonicalRefundPlanner = __esmMin((() => {}));
101002
+ var init_shipmentEligibility = __esmMin((() => {}));
101003
+ var init_refundPolicy = __esmMin((() => {}));
101004
+ var init_orderItemSupport = __esmMin((() => {
101005
+ init_shipmentEligibility();
101006
+ init_refundPolicy();
101007
+ }));
101008
+ var init_confirmationEmailPayment = __esmMin((() => {
101009
+ init_orderItemSupport();
101010
+ init_assertNever();
101011
+ }));
101012
+ var init_discountApplication = __esmMin((() => {
101013
+ init_src$2();
101014
+ init_settlement();
101015
+ }));
101016
+ var init_oneTimeCheckoutPlanning = __esmMin((() => {
101017
+ init_src$2();
101018
+ init_assertNever();
101019
+ init_bookingInstalmentSchedule();
101020
+ init_settlement();
101021
+ }));
101022
+ var init_order_number = __esmMin((() => {}));
101023
+ var init_orderCancellationPlan = __esmMin((() => {
101024
+ init_orderItemSupport();
101025
+ }));
101026
+ var init_orderTotals = __esmMin((() => {
101027
+ init_src$2();
101028
+ }));
101029
+ var init_orderConfirmationPlanning = __esmMin((() => {
101030
+ init_assertNever();
101031
+ init_orderTotals();
101032
+ }));
101033
+ var init_orderCompletionEmailPlan = __esmMin((() => {
101034
+ init_confirmationEmailPayment();
101035
+ }));
101036
+ var init_orderFulfillmentPlan = __esmMin((() => {
101037
+ init_src$2();
101038
+ }));
101039
+ //#endregion
101040
+ //#region ../commerce/src/purchase/orderFulfillmentResult.ts
101041
+ var init_orderFulfillmentResult = __esmMin((() => {}));
101042
+ //#endregion
101043
+ //#region ../commerce/src/purchase/orderHistoryLedgerFilters.ts
101044
+ var init_orderHistoryLedgerFilters = __esmMin((() => {}));
101045
+ var init_orderHistorySource = __esmMin((() => {})), MANUALLY_SETTLEABLE_PLAN_STATUSES, MANUALLY_SETTLEABLE_INSTALMENT_STATUSES;
101046
+ var init_orderInstalmentAdminSettlement = __esmMin((() => {
101047
+ init_src$2();
101048
+ MANUALLY_SETTLEABLE_PLAN_STATUSES = ["active", "payment_failed"];
101049
+ new Set(MANUALLY_SETTLEABLE_PLAN_STATUSES);
101050
+ MANUALLY_SETTLEABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
101051
+ new Set(MANUALLY_SETTLEABLE_INSTALMENT_STATUSES);
101052
+ }));
101053
+ var init_orderInstalmentClosure = __esmMin((() => {
101054
+ init_src$2();
101055
+ init_assertNever();
101056
+ })), RECURRING_COLLECTIBLE_STATUSES;
101057
+ var init_orderInstalmentLifecycle = __esmMin((() => {
101058
+ init_src$2();
101059
+ RECURRING_COLLECTIBLE_STATUSES = ["scheduled", "failed"];
101060
+ new Set(RECURRING_COLLECTIBLE_STATUSES);
101061
+ }));
101062
+ var init_orderInstalmentPlan = __esmMin((() => {
101063
+ init_src$2();
101064
+ init_assertNever();
101065
+ init_bookingInstalmentSchedule();
101066
+ })), STRIPE_COMMISSION_FREE_REASONS, historicalContext, percentSchema;
101067
+ var init_stripeCommissionMetadata = __esmMin((() => {
101068
+ init_src$2();
101069
+ STRIPE_COMMISSION_FREE_REASONS = [
101070
+ "managed_billing",
101071
+ "no_commission_plan",
101072
+ "billing_evidence_invalid",
101073
+ "fee_rounds_to_zero",
101074
+ "payment_not_stripe"
101075
+ ];
101076
+ historicalContext = {
101077
+ currency: z$1.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
101078
+ sourcePlanId: z$1.string().trim().min(1).optional()
101079
+ };
101080
+ percentSchema = z$1.number().finite().min(0).max(100);
101081
+ z$1.discriminatedUnion("kind", [
101082
+ z$1.object({
101083
+ kind: z$1.literal("commission_free"),
101084
+ reason: z$1.enum(STRIPE_COMMISSION_FREE_REASONS),
101085
+ ...historicalContext
101086
+ }),
101087
+ z$1.object({
101088
+ kind: z$1.literal("application_fee_amount"),
101089
+ amountCents: z$1.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
101090
+ percent: percentSchema,
101091
+ ...historicalContext
101092
+ }),
101093
+ z$1.object({
101094
+ kind: z$1.literal("application_fee_percent"),
101095
+ percent: percentSchema,
101096
+ ...historicalContext
101097
+ })
101098
+ ]);
101099
+ }));
101100
+ var init_eventOrderOptionSnapshot = __esmMin((() => {
101101
+ init_src$2();
101102
+ }));
101103
+ var init_membershipOrderItemMetadata = __esmMin((() => {
101104
+ init_src$2();
101105
+ }));
101106
+ var init_orderItemMetadata = __esmMin((() => {
101107
+ init_stripeCommissionMetadata();
101108
+ init_src$2();
101109
+ init_eventOrderOptionSnapshot();
101110
+ init_membershipOrderItemMetadata();
101111
+ }));
101112
+ var init_orderListFilters = __esmMin((() => {}));
101113
+ var init_orderPaymentState = __esmMin((() => {
101114
+ init_src$2();
101115
+ init_assertNever();
101116
+ toNonNegativeCents(0);
101117
+ }));
101118
+ var init_orderPaymentReceipt = __esmMin((() => {
101119
+ init_src$2();
101120
+ init_settlement();
101121
+ }));
101122
+ var init_pendingCheckoutSessionClaim = __esmMin((() => {}));
101123
+ var init_orderPaymentLinkPlanning = __esmMin((() => {
101124
+ init_assertNever();
101125
+ init_orderPaymentState();
101126
+ init_pendingCheckoutSessionClaim();
101127
+ }));
101128
+ var init_orderRefundPlanning = __esmMin((() => {
101129
+ init_src$2();
101130
+ init_settlement();
101131
+ }));
101132
+ var init_orderRefundPolicy = __esmMin((() => {
101133
+ init_src$2();
101134
+ }));
101135
+ var init_persistedCheckoutLines = __esmMin((() => {
101136
+ init_src$2();
101137
+ init_settlement();
101138
+ init_checkoutQuantity();
101139
+ }));
101140
+ var init_protectedDepositRefundPolicy = __esmMin((() => {
101141
+ init_src$2();
101142
+ }));
101143
+ var init_refundRailSplit = __esmMin((() => {
101144
+ init_src$2();
101145
+ }));
101146
+ var init_shopRefundPlanning = __esmMin((() => {
101147
+ init_orderItemSupport();
101148
+ init_refundPolicy();
101149
+ }));
101150
+ //#endregion
101151
+ //#region ../commerce/src/purchase/stripeMinimumCharge.ts
101152
+ function isStripeMinimumChargeCurrency(currency) {
101153
+ return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
101154
+ }
101155
+ function getStripeMinimumChargeRequirement(rawCurrency) {
101156
+ let currency;
101157
+ try {
101158
+ currency = normalizeCurrencyCode(rawCurrency);
101159
+ } catch {
101160
+ return null;
101161
+ }
101162
+ const currencyKey = currency;
101163
+ if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
101164
+ return {
101165
+ currency,
101166
+ minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
101167
+ };
101168
+ }
101169
+ var STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
101170
+ var init_stripeMinimumCharge = __esmMin((() => {
101171
+ init_settlement();
101172
+ STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
101173
+ GBP: 30,
101174
+ USD: 50,
101175
+ EUR: 50,
101176
+ AED: 200,
101177
+ AUD: 50,
101178
+ BGN: 100,
101179
+ BRL: 50,
101180
+ CAD: 50,
101181
+ CHF: 50,
101182
+ CZK: 1500,
101183
+ DKK: 250,
101184
+ HKD: 400,
101185
+ HUF: 17500,
101186
+ JPY: 50,
101187
+ MXN: 1e3,
101188
+ MYR: 200,
101189
+ NOK: 300,
101190
+ NZD: 50,
101191
+ PLN: 200,
101192
+ RON: 200,
101193
+ SEK: 300,
101194
+ SGD: 50,
101195
+ THB: 1e3
101196
+ };
101197
+ }));
101198
+ var init_stripeCheckoutReturnUrl = __esmMin((() => {}));
101199
+ var init_stateTransitions = __esmMin((() => {
101200
+ init_src$2();
101201
+ }));
101202
+ //#endregion
101203
+ //#region ../commerce/src/purchase/event-registration-errors.ts
101204
+ function parseEventRegistrationErrorReason(value) {
101205
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
101206
+ }
101207
+ var eventRegistrationErrors;
101208
+ var init_event_registration_errors = __esmMin((() => {
101209
+ eventRegistrationErrors = {
101210
+ registrationClosed: {
101211
+ message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
101212
+ action: "none"
101213
+ },
101214
+ paymentInvestigationRequired: {
101215
+ message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
101216
+ action: "none"
101217
+ },
101218
+ paymentProviderUnavailable: {
101219
+ message: "We couldn’t reach the payment provider. Please try again in a minute.",
101220
+ action: "retry"
101221
+ },
101222
+ paymentPageUnavailable: {
101223
+ message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
101224
+ action: "retry"
101225
+ },
101226
+ paymentUnavailable: {
101227
+ message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
101228
+ action: "none"
101229
+ },
101230
+ capacityChanged: {
101231
+ message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
101232
+ action: "places"
101233
+ },
101234
+ selectionChanged: {
101235
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
101236
+ action: "places"
101237
+ },
101238
+ registrationPreparationChanged: {
101239
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
101240
+ action: "places"
101241
+ },
101242
+ registrationAlreadyExists: {
101243
+ message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
101244
+ action: "portal"
101245
+ },
101246
+ holdExpired: {
101247
+ message: "Your reservation has timed out. Please check availability and choose your places again.",
101248
+ action: "start"
101249
+ },
101250
+ waitlistUnavailable: {
101251
+ 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.",
101252
+ action: "event"
101253
+ },
101254
+ paymentContextMismatch: {
101255
+ message: "The payment options for this event have changed. Please check the latest options before continuing.",
101256
+ action: "payment-options"
101257
+ },
101258
+ verificationFailed: {
101259
+ message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
101260
+ action: "none"
101261
+ },
101262
+ idempotencyConflict: {
101263
+ 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.",
101264
+ action: "portal"
101265
+ },
101266
+ invalidCommitInput: {
101267
+ 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.",
101268
+ action: "details"
101269
+ }
101270
+ };
101271
+ }));
101272
+ var init_eventCheckoutRecoveryWindow = __esmMin((() => {}));
101273
+ //#endregion
101274
+ //#region ../commerce/src/purchase/index.ts
101275
+ var init_purchase = __esmMin((() => {
101276
+ init_types$2();
101277
+ init_allocation();
101278
+ init_orderTypes();
101279
+ init_orderPlanningTypes();
101280
+ init_bookingInstalmentSchedule();
101281
+ init_bookingPaymentSelection();
101282
+ init_cancellationPolicy();
101283
+ init_checkoutCollectionPlan();
101284
+ init_checkoutCommitPlan();
101285
+ init_checkoutDiscountContextPlanning();
101286
+ init_checkoutErrorCodes();
101287
+ init_checkoutOrderItemProjection();
101288
+ init_checkoutPaymentFlow();
101289
+ init_checkoutPaymentPlanPlanning();
101290
+ init_checkoutPaymentTerms();
101291
+ init_checkoutQuantity();
101292
+ init_checkoutSettlement();
101293
+ init_checkoutStripeFinalizationPlanning();
101294
+ init_checkoutStripeSessionPlanning();
101295
+ init_checkoutSessionMetadata();
101296
+ init_canonicalRefundPlanner();
101297
+ init_confirmationEmailPayment();
101298
+ init_discountApplication();
101299
+ init_oneTimeCheckoutPlanning();
101300
+ init_order_number();
101301
+ init_orderCancellationPlan();
101302
+ init_orderConfirmationPlanning();
101303
+ init_orderCompletionEmailPlan();
101304
+ init_orderFulfillmentPlan();
101305
+ init_orderFulfillmentResult();
101306
+ init_orderHistoryLedgerFilters();
101307
+ init_orderHistorySource();
101308
+ init_orderInstalmentAdminSettlement();
101309
+ init_orderInstalmentClosure();
101310
+ init_orderInstalmentLifecycle();
101311
+ init_orderInstalmentPlan();
101312
+ init_orderItemMetadata();
101313
+ init_orderItemSupport();
101314
+ init_orderListFilters();
101315
+ init_orderPaymentState();
101316
+ init_orderPaymentReceipt();
101317
+ init_orderPaymentLinkPlanning();
101318
+ init_orderRefundPlanning();
101319
+ init_orderRefundPolicy();
101320
+ init_orderTotals();
101321
+ init_persistedCheckoutLines();
101322
+ init_pendingCheckoutSessionClaim();
101323
+ init_protectedDepositRefundPolicy();
101324
+ init_refundRailSplit();
101325
+ init_refundPolicy();
101326
+ init_settlement();
101327
+ init_shopRefundPlanning();
101328
+ init_stripeMinimumCharge();
101329
+ init_stripeCheckoutReturnUrl();
101330
+ init_stateTransitions();
101331
+ init_event_registration_errors();
101332
+ init_eventCheckoutRecoveryWindow();
101333
+ init_stripeCommissionMetadata();
101334
+ }));
101335
+ //#endregion
100558
101336
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
100559
101337
  function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
100560
101338
  return {
@@ -100598,7 +101376,7 @@ function formatDepositRefundabilityLabel(depositRefundability) {
100598
101376
  return depositRefundability === "non_refundable" ? "non-refundable" : "refundable";
100599
101377
  }
100600
101378
  var init_bookingPaymentOptionCopy = __esmMin((() => {}));
100601
- var init_types$2 = __esmMin((() => {}));
101379
+ var init_types$1 = __esmMin((() => {}));
100602
101380
  //#endregion
100603
101381
  //#region ../blocks/src/system/runtime/shared/utils/formatting.ts
100604
101382
  /**
@@ -100614,7 +101392,7 @@ function formatPrice(cents, currency = "GBP", locale) {
100614
101392
  }
100615
101393
  var init_formatting = __esmMin((() => {
100616
101394
  init_src$2();
100617
- init_types$2();
101395
+ init_types$1();
100618
101396
  }));
100619
101397
  //#endregion
100620
101398
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptions.ts
@@ -100622,11 +101400,10 @@ function resolveBookingPaymentDueNowCents(input) {
100622
101400
  switch (input.option.kind) {
100623
101401
  case "upfront": return input.totalCents;
100624
101402
  case "deferred_manual": return 0;
100625
- case "instalment_plan": return buildInstalmentSchedulePreview({
100626
- totalCents: input.totalCents,
100627
- option: input.option,
100628
- bookingStartAt: input.bookingStartAt
100629
- })[0]?.amountCents ?? input.totalCents;
101403
+ case "instalment_plan": return resolveBookingInitialInstalmentAmountCents({
101404
+ totalAmountCents: input.totalCents,
101405
+ plan: input.option.plan
101406
+ });
100630
101407
  case "flexible_balance": return resolveFlexibleBalanceInitialPaymentCents({
100631
101408
  totalAmountCents: input.totalCents,
100632
101409
  config: input.option.config
@@ -100648,6 +101425,7 @@ function buildBookingPaymentSelectionViewModel(input) {
100648
101425
  totalCents,
100649
101426
  currency,
100650
101427
  bookingStartAt: input.bookingStartAt,
101428
+ nowIso: input.nowIso,
100651
101429
  locale: input.locale
100652
101430
  }))
100653
101431
  };
@@ -100690,17 +101468,12 @@ function buildBookingPaymentOptionViewModel(input) {
100690
101468
  };
100691
101469
  }
100692
101470
  case "instalment_plan": {
100693
- const schedulePreview = buildInstalmentSchedulePreview({
100694
- totalCents: input.totalCents,
100695
- option: input.option,
100696
- bookingStartAt: input.bookingStartAt
100697
- });
100698
- const dueToday = resolveBookingPaymentDueNowCents({
100699
- option: input.option,
100700
- totalCents: input.totalCents,
100701
- bookingStartAt: input.bookingStartAt
101471
+ const [firstRow, ...futureRows] = buildBookingInstalmentSchedule({
101472
+ anchorAt: input.nowIso,
101473
+ totalAmountCents: input.totalCents,
101474
+ plan: input.option.plan
100702
101475
  });
100703
- const futureRows = schedulePreview.slice(1);
101476
+ const dueToday = firstRow?.amountCents ?? 0;
100704
101477
  const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
100705
101478
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
100706
101479
  const depositRefundability = getBookingInstalmentDepositRefundability(input.option.plan);
@@ -100747,7 +101520,7 @@ function buildBookingPaymentOptionViewModel(input) {
100747
101520
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
100748
101521
  const formattedRemainingBalance = formatPrice(remainingBalance, input.currency, input.locale);
100749
101522
  const dueAt = resolveFlexibleBalanceDueAt({
100750
- bookingStartAt: input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString(),
101523
+ bookingStartAt: input.bookingStartAt ?? input.nowIso,
100751
101524
  dueDateRule: input.option.config.dueDateRule
100752
101525
  });
100753
101526
  const copy = buildFlexibleBalanceBookingPaymentOptionCopy({
@@ -100788,58 +101561,20 @@ function buildBookingPaymentOptionViewModel(input) {
100788
101561
  default: return assertNever$11(input.option);
100789
101562
  }
100790
101563
  }
100791
- function buildInstalmentSchedulePreview(input) {
100792
- const startAt = input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString();
100793
- switch (input.option.plan.kind) {
100794
- case "deposit_plus_one_remainder": {
100795
- const deposit = clampConfiguredAmount(input.option.plan.depositAmountCents, input.totalCents);
100796
- const remainder = Math.max(0, input.totalCents - deposit);
100797
- return compactSchedulePreview([{
100798
- dueAt: startAt,
100799
- amountCents: deposit
100800
- }, {
100801
- dueAt: addIntervalPreservingMonthAnchor(startAt, input.option.plan.remainderDueCount, input.option.plan.intervalUnit),
100802
- amountCents: remainder
100803
- }]);
100804
- }
100805
- case "deposit_plus_scheduled_instalments": {
100806
- const plan = input.option.plan;
100807
- const deposit = clampConfiguredAmount(plan.depositAmountCents, input.totalCents);
100808
- const instalments = splitAmountWithRemainderInFirst(Math.max(0, input.totalCents - deposit), plan.instalmentCount);
100809
- return compactSchedulePreview([{
100810
- dueAt: startAt,
100811
- amountCents: deposit
100812
- }, ...instalments.map((amountCents, index) => ({
100813
- dueAt: addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * (index + 1), plan.intervalUnit),
100814
- amountCents
100815
- }))]);
100816
- }
100817
- case "equal_scheduled_instalments": {
100818
- const plan = input.option.plan;
100819
- return compactSchedulePreview(splitAmountWithRemainderInFirst(input.totalCents, plan.instalmentCount).map((amountCents, index) => ({
100820
- dueAt: index === 0 ? startAt : addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * index, plan.intervalUnit),
100821
- amountCents
100822
- })));
100823
- }
100824
- default: return assertNever$11(input.option.plan);
100825
- }
100826
- }
100827
101564
  function getPaymentCadenceLabel(plan) {
100828
101565
  const intervalCount = getBookingInstalmentPlanIntervalCount(plan);
100829
101566
  const unitLabel = intervalCount === 1 ? plan.intervalUnit : `${plan.intervalUnit}s`;
100830
101567
  return intervalCount === 1 ? unitLabel : `every ${intervalCount} ${unitLabel}`;
100831
101568
  }
100832
- function compactSchedulePreview(schedule) {
100833
- return omitZeroAmountFutureRows(schedule);
100834
- }
100835
101569
  function formatScheduleDate(isoString, locale) {
100836
101570
  const date = new Date(isoString);
100837
101571
  if (!Number.isFinite(date.getTime())) return isoString;
100838
101572
  return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
100839
101573
  }
100840
101574
  var init_bookingPaymentOptions = __esmMin((() => {
100841
- init_dist$1();
101575
+ init_purchase();
100842
101576
  init_src$2();
101577
+ init_dist$1();
100843
101578
  init_bookingPaymentOptionCopy();
100844
101579
  init_formatting();
100845
101580
  }));
@@ -102064,13 +102799,16 @@ function useHeadlessBookingFlow(options) {
102064
102799
  defaultServiceId,
102065
102800
  options.services
102066
102801
  ]);
102802
+ const bookingNowIso = useBookingNowIso();
102067
102803
  const paymentSelection = useMemo(() => selectedService && paymentResolution.mode !== "unsupported" ? buildBookingPaymentSelectionViewModel({
102068
102804
  serviceTitle: selectedService.title,
102069
102805
  paymentTerms: selectedService.paymentTerms,
102070
102806
  priceAmount: selectedAppointmentPriceAmount,
102071
102807
  priceCurrency: selectedService.priceCurrency,
102072
- bookingStartAt: state.selectedSlot?.startAt
102808
+ bookingStartAt: state.selectedSlot?.startAt,
102809
+ nowIso: bookingNowIso
102073
102810
  }) : null, [
102811
+ bookingNowIso,
102074
102812
  paymentResolution.mode,
102075
102813
  selectedAppointmentPriceAmount,
102076
102814
  selectedService,
@@ -102227,6 +102965,7 @@ var init_useHeadlessBookingFlow = __esmMin((() => {
102227
102965
  init_useSelectedAppointmentConsentForm();
102228
102966
  init_useAvailableDates();
102229
102967
  init_useAvailableSlots();
102968
+ init_useBookingNowIso();
102230
102969
  init_useBookingSubmission();
102231
102970
  init_booking_form_submit_success();
102232
102971
  init_useDiscountCodeUi();
@@ -104404,7 +105143,7 @@ var init_components = __esmMin((() => {
104404
105143
  //#endregion
104405
105144
  //#region ../blocks/src/system/runtime/shared/index.ts
104406
105145
  var init_shared = __esmMin((() => {
104407
- init_types$2();
105146
+ init_types$1();
104408
105147
  init_utils$1();
104409
105148
  init_components();
104410
105149
  }));
@@ -105038,6 +105777,7 @@ function buildEventRegistrationPaymentOptionsViewModel(input) {
105038
105777
  priceAmount: input.totalPriceCents,
105039
105778
  priceCurrency: input.currency,
105040
105779
  bookingStartAt: input.startsAt,
105780
+ nowIso: input.nowIso,
105041
105781
  locale: input.locale
105042
105782
  });
105043
105783
  return {
@@ -105045,7 +105785,7 @@ function buildEventRegistrationPaymentOptionsViewModel(input) {
105045
105785
  sectionTitle: selection.sectionTitle,
105046
105786
  options: selection.options.flatMap((option, index) => {
105047
105787
  const sourceOption = approvedOptions[index];
105048
- return sourceOption ? [toEventDirectPaymentOption(option, sourceOption, selection.mode, input.totalPriceCents, input.startsAt)] : [];
105788
+ return sourceOption ? [toEventDirectPaymentOption(option, sourceOption, selection.mode, input.totalPriceCents)] : [];
105049
105789
  })
105050
105790
  };
105051
105791
  }
@@ -105053,11 +105793,10 @@ function selectApprovedEventDirectPaymentOptions(approvedPaymentOptions, payment
105053
105793
  const approvedKinds = new Set(getApprovedDirectPaymentCollectionOptionKinds(approvedPaymentOptions));
105054
105794
  return paymentTerms.allowedOptions.filter((option) => approvedKinds.has(option.kind));
105055
105795
  }
105056
- function toEventDirectPaymentOption(option, sourceOption, mode, totalCents, startsAt) {
105796
+ function toEventDirectPaymentOption(option, sourceOption, mode, totalCents) {
105057
105797
  const configuredPaymentDueNowCents = resolveBookingPaymentDueNowCents({
105058
105798
  option: sourceOption,
105059
- totalCents,
105060
- bookingStartAt: startsAt
105799
+ totalCents
105061
105800
  });
105062
105801
  switch (option.kind) {
105063
105802
  case "upfront": return {
@@ -105993,604 +106732,6 @@ var init_hooks = __esmMin((() => {
105993
106732
  REGISTRATION_OPTIONS_DEBOUNCE_MS = 150;
105994
106733
  }));
105995
106734
  //#endregion
105996
- //#region ../commerce/src/purchase/types.ts
105997
- var init_types$1 = __esmMin((() => {}));
105998
- var init_allocation = __esmMin((() => {
105999
- init_src$2();
106000
- })), ORDER_STATUSES, ORDER_PAYMENT_METHODS, CHECKOUT_COMMIT_STATES, ORDER_CHECKOUT_RECONCILIATION_STATES, ORDER_ITEM_RECONCILIATION_STATES, ORDER_ITEM_COMMIT_STATES, RESERVATION_FINALIZATION_STATES, DISCOUNT_REDEMPTION_STATUSES, ORDER_ITEM_KINDS;
106001
- var init_orderTypes = __esmMin((() => {
106002
- ORDER_STATUSES = [
106003
- "pending",
106004
- "paid",
106005
- "partially_refunded",
106006
- "refunded",
106007
- "failed",
106008
- "cancelled"
106009
- ];
106010
- new Set(ORDER_STATUSES);
106011
- ORDER_PAYMENT_METHODS = [
106012
- "stripe",
106013
- "store_credit",
106014
- "mixed",
106015
- "pass_redemption",
106016
- "membership_access",
106017
- "free",
106018
- "manual",
106019
- "waived"
106020
- ];
106021
- new Set(ORDER_PAYMENT_METHODS);
106022
- CHECKOUT_COMMIT_STATES = [
106023
- "pending",
106024
- "committing",
106025
- "committed",
106026
- "compensated"
106027
- ];
106028
- new Set(CHECKOUT_COMMIT_STATES);
106029
- ORDER_CHECKOUT_RECONCILIATION_STATES = [
106030
- "not_needed",
106031
- "evidence_pending",
106032
- "needed"
106033
- ];
106034
- new Set(ORDER_CHECKOUT_RECONCILIATION_STATES);
106035
- ORDER_ITEM_RECONCILIATION_STATES = ["not_needed", "needed"];
106036
- new Set(ORDER_ITEM_RECONCILIATION_STATES);
106037
- ORDER_ITEM_COMMIT_STATES = [
106038
- "pending",
106039
- "committed",
106040
- "compensated"
106041
- ];
106042
- new Set(ORDER_ITEM_COMMIT_STATES);
106043
- RESERVATION_FINALIZATION_STATES = [
106044
- "not_applicable",
106045
- "reserved",
106046
- "consumed",
106047
- "released"
106048
- ];
106049
- new Set(RESERVATION_FINALIZATION_STATES);
106050
- DISCOUNT_REDEMPTION_STATUSES = [
106051
- "pending",
106052
- "redeemed",
106053
- "released",
106054
- "expired"
106055
- ];
106056
- new Set(DISCOUNT_REDEMPTION_STATUSES);
106057
- ORDER_ITEM_KINDS = [
106058
- "event_ticket",
106059
- "product",
106060
- "pass",
106061
- "event_series_registration",
106062
- "appointment",
106063
- "membership"
106064
- ];
106065
- new Set(ORDER_ITEM_KINDS);
106066
- }));
106067
- //#endregion
106068
- //#region ../commerce/src/purchase/orderPlanningTypes.ts
106069
- var init_orderPlanningTypes = __esmMin((() => {}));
106070
- var init_assertNever = __esmMin((() => {}));
106071
- var init_bookingInstalmentSchedule = __esmMin((() => {
106072
- init_src$2();
106073
- init_assertNever();
106074
- }));
106075
- var init_cancellationPolicy = __esmMin((() => {}));
106076
- var init_checkoutCollectionPlan = __esmMin((() => {
106077
- init_src$2();
106078
- }));
106079
- var init_checkoutCommitPlan = __esmMin((() => {}));
106080
- var init_checkoutDiscountContextPlanning = __esmMin((() => {
106081
- init_src$2();
106082
- }));
106083
- //#endregion
106084
- //#region ../commerce/src/purchase/checkoutErrorCodes.ts
106085
- var init_checkoutErrorCodes = __esmMin((() => {}));
106086
- var init_checkoutOrderItemProjection = __esmMin((() => {}));
106087
- //#endregion
106088
- //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
106089
- function planCheckoutPaymentFlow(options) {
106090
- const amountDueCents = toNonNegativeCents(options.amountDueCents);
106091
- const discountCents = toNonNegativeCents(options.discountCents);
106092
- const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
106093
- const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
106094
- if (amountDueCents <= 0) return {
106095
- kind: "bypass",
106096
- bypassReason: discountCents > 0 ? "discount_free" : "free",
106097
- reserveCreditCents: 0
106098
- };
106099
- if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
106100
- kind: "stripe",
106101
- reserveCreditCents: toNonNegativeCents(0)
106102
- };
106103
- if (availableCreditCents >= amountDueCents) return {
106104
- kind: "store_credit_only",
106105
- reserveCreditCents: amountDueCents
106106
- };
106107
- return {
106108
- kind: "stripe",
106109
- reserveCreditCents: planMixedPaymentCreditReservation({
106110
- amountDueCents,
106111
- availableCreditCents,
106112
- minimumStripeChargeCents
106113
- })
106114
- };
106115
- }
106116
- function planMixedPaymentCreditReservation(input) {
106117
- const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
106118
- if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
106119
- if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
106120
- return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
106121
- }
106122
- /**
106123
- * Apply site credit to a flexible-balance booking before card payment.
106124
- *
106125
- * Credit first reduces the configured payment due now. Once that payment is
106126
- * covered, any remaining credit reduces the later balance. If a partial credit
106127
- * application would leave a positive card charge below Stripe's minimum, less
106128
- * credit is used so the configured payment can still be collected.
106129
- */
106130
- function planFlexibleBalanceCreditFirst(input) {
106131
- const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
106132
- const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
106133
- const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
106134
- const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
106135
- if (availableCreditCents >= totalCents && totalCents > 0) return {
106136
- kind: "credit_only",
106137
- reserveCreditCents: totalCents,
106138
- cardDueNowCents: toNonNegativeCents(0),
106139
- laterBalanceCents: toNonNegativeCents(0)
106140
- };
106141
- let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
106142
- if (reserveCreditCents >= configuredDueNowCents) return {
106143
- kind: "flexible_balance",
106144
- reserveCreditCents,
106145
- cardDueNowCents: toNonNegativeCents(0),
106146
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
106147
- };
106148
- const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
106149
- if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
106150
- if (configuredDueNowCents < minimumStripeChargeCents) return {
106151
- kind: "card_below_minimum",
106152
- reserveCreditCents: toNonNegativeCents(0),
106153
- cardDueNowCents: configuredDueNowCents,
106154
- laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
106155
- };
106156
- reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
106157
- }
106158
- const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
106159
- return {
106160
- kind: "flexible_balance",
106161
- reserveCreditCents,
106162
- cardDueNowCents,
106163
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
106164
- };
106165
- }
106166
- var init_checkoutPaymentFlow = __esmMin((() => {
106167
- init_src$2();
106168
- }));
106169
- var init_checkoutPaymentPlanPlanning = __esmMin((() => {
106170
- init_src$2();
106171
- }));
106172
- var init_checkoutPaymentTermPlanning = __esmMin((() => {}));
106173
- var init_checkoutPaymentTerms = __esmMin((() => {
106174
- init_src$2();
106175
- init_assertNever();
106176
- }));
106177
- var init_checkoutQuantity = __esmMin((() => {
106178
- init_src$2();
106179
- }));
106180
- //#endregion
106181
- //#region ../commerce/src/purchase/settlement.ts
106182
- function normalizeCurrencyCode(raw) {
106183
- const normalized = raw.trim().toUpperCase();
106184
- if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
106185
- return normalized;
106186
- }
106187
- var init_settlement = __esmMin((() => {
106188
- init_src$2();
106189
- }));
106190
- var init_result = __esmMin((() => {
106191
- init_src$2();
106192
- }));
106193
- var init_checkoutSettlement = __esmMin((() => {
106194
- init_src$2();
106195
- init_settlement();
106196
- init_result();
106197
- }));
106198
- var init_checkoutStripeFinalizationPlanning = __esmMin((() => {}));
106199
- var init_checkoutStripeSessionPlanning = __esmMin((() => {
106200
- init_src$2();
106201
- })), datedOfferingSharedEngineMetadataShape, orderCheckoutSessionMetadataBaseShape, absentDatedOfferingSharedEngineMetadataShape, LegacyOrderCheckoutSessionMetadataSchema, SharedDatedOfferingOrderCheckoutSessionMetadataSchema;
106202
- var init_checkoutSessionMetadata = __esmMin((() => {
106203
- datedOfferingSharedEngineMetadataShape = {
106204
- datedOfferingEngineContractVersion: z$1.literal("shared_v1"),
106205
- datedOfferingEngineRouteKind: z$1.literal("shared_whole_series_registration"),
106206
- datedOfferingCapacityHoldId: z$1.string().uuid(),
106207
- datedOfferingCapacityHoldAuditRef: z$1.string().uuid(),
106208
- customerId: z$1.string().uuid(),
106209
- eventSeriesId: z$1.string().uuid()
106210
- };
106211
- z$1.object(datedOfferingSharedEngineMetadataShape);
106212
- orderCheckoutSessionMetadataBaseShape = {
106213
- type: z$1.literal("order"),
106214
- site_id: z$1.string().uuid(),
106215
- order_id: z$1.string().uuid().optional(),
106216
- customer_email: z$1.string().email(),
106217
- customer_name: z$1.string().optional(),
106218
- product_id: z$1.string().uuid().optional(),
106219
- attendee_id: z$1.string().uuid().optional(),
106220
- occurrence_id: z$1.string().uuid().optional(),
106221
- tickets_count: z$1.string().optional(),
106222
- notes: z$1.string().optional(),
106223
- discount_redemption_id: z$1.string().uuid().optional(),
106224
- discount_code_id: z$1.string().uuid().optional(),
106225
- discount_code: z$1.string().optional(),
106226
- discount_public_label: z$1.string().optional(),
106227
- credit_reservation_id: z$1.string().uuid().optional(),
106228
- credit_reserved_cents: z$1.string().optional(),
106229
- discount_code_amount_cents: z$1.string().optional(),
106230
- order_payment_reason: z$1.enum([
106231
- "instalment_payoff",
106232
- "flexible_balance_initial",
106233
- "flexible_balance_paydown"
106234
- ]).optional(),
106235
- order_payment_plan_id: z$1.string().uuid().optional(),
106236
- order_flexible_balance_contract_id: z$1.string().uuid().optional()
106237
- };
106238
- absentDatedOfferingSharedEngineMetadataShape = {
106239
- datedOfferingEngineContractVersion: z$1.never().optional(),
106240
- datedOfferingEngineRouteKind: z$1.never().optional(),
106241
- datedOfferingCapacityHoldId: z$1.never().optional(),
106242
- datedOfferingCapacityHoldAuditRef: z$1.never().optional(),
106243
- customerId: z$1.never().optional(),
106244
- eventSeriesId: z$1.never().optional()
106245
- };
106246
- LegacyOrderCheckoutSessionMetadataSchema = z$1.object({
106247
- ...orderCheckoutSessionMetadataBaseShape,
106248
- ...absentDatedOfferingSharedEngineMetadataShape
106249
- });
106250
- SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z$1.object({
106251
- ...orderCheckoutSessionMetadataBaseShape,
106252
- ...datedOfferingSharedEngineMetadataShape
106253
- });
106254
- z$1.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
106255
- }));
106256
- var init_checkoutValidatedItemPlanning = __esmMin((() => {}));
106257
- var init_canonicalRefundPlanner = __esmMin((() => {}));
106258
- var init_shipmentEligibility = __esmMin((() => {}));
106259
- var init_refundPolicy = __esmMin((() => {}));
106260
- var init_orderItemSupport = __esmMin((() => {
106261
- init_shipmentEligibility();
106262
- init_refundPolicy();
106263
- }));
106264
- var init_confirmationEmailPayment = __esmMin((() => {
106265
- init_orderItemSupport();
106266
- init_assertNever();
106267
- }));
106268
- var init_discountApplication = __esmMin((() => {
106269
- init_src$2();
106270
- init_settlement();
106271
- }));
106272
- var init_oneTimeCheckoutPlanning = __esmMin((() => {
106273
- init_src$2();
106274
- init_assertNever();
106275
- init_settlement();
106276
- }));
106277
- var init_order_number = __esmMin((() => {}));
106278
- var init_orderCancellationPlan = __esmMin((() => {
106279
- init_orderItemSupport();
106280
- }));
106281
- var init_orderTotals = __esmMin((() => {
106282
- init_src$2();
106283
- }));
106284
- var init_orderConfirmationPlanning = __esmMin((() => {
106285
- init_assertNever();
106286
- init_orderTotals();
106287
- }));
106288
- var init_orderCompletionEmailPlan = __esmMin((() => {
106289
- init_confirmationEmailPayment();
106290
- }));
106291
- var init_orderFulfillmentPlan = __esmMin((() => {
106292
- init_src$2();
106293
- }));
106294
- //#endregion
106295
- //#region ../commerce/src/purchase/orderFulfillmentResult.ts
106296
- var init_orderFulfillmentResult = __esmMin((() => {}));
106297
- //#endregion
106298
- //#region ../commerce/src/purchase/orderHistoryLedgerFilters.ts
106299
- var init_orderHistoryLedgerFilters = __esmMin((() => {}));
106300
- var init_orderHistorySource = __esmMin((() => {})), MANUALLY_SETTLEABLE_PLAN_STATUSES, MANUALLY_SETTLEABLE_INSTALMENT_STATUSES;
106301
- var init_orderInstalmentAdminSettlement = __esmMin((() => {
106302
- init_src$2();
106303
- MANUALLY_SETTLEABLE_PLAN_STATUSES = ["active", "payment_failed"];
106304
- new Set(MANUALLY_SETTLEABLE_PLAN_STATUSES);
106305
- MANUALLY_SETTLEABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
106306
- new Set(MANUALLY_SETTLEABLE_INSTALMENT_STATUSES);
106307
- }));
106308
- var init_orderInstalmentClosure = __esmMin((() => {
106309
- init_src$2();
106310
- init_assertNever();
106311
- })), RECURRING_COLLECTIBLE_STATUSES;
106312
- var init_orderInstalmentLifecycle = __esmMin((() => {
106313
- init_src$2();
106314
- RECURRING_COLLECTIBLE_STATUSES = ["scheduled", "failed"];
106315
- new Set(RECURRING_COLLECTIBLE_STATUSES);
106316
- })), CANCELLABLE_INSTALMENT_STATUSES;
106317
- var init_orderInstalmentPayoff = __esmMin((() => {
106318
- init_src$2();
106319
- CANCELLABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
106320
- new Set(CANCELLABLE_INSTALMENT_STATUSES);
106321
- }));
106322
- var init_orderInstalmentPlan = __esmMin((() => {
106323
- init_src$2();
106324
- init_assertNever();
106325
- init_bookingInstalmentSchedule();
106326
- })), STRIPE_COMMISSION_FREE_REASONS, historicalContext, percentSchema;
106327
- var init_stripeCommissionMetadata = __esmMin((() => {
106328
- init_src$2();
106329
- STRIPE_COMMISSION_FREE_REASONS = [
106330
- "managed_billing",
106331
- "no_commission_plan",
106332
- "billing_evidence_invalid",
106333
- "fee_rounds_to_zero",
106334
- "payment_not_stripe"
106335
- ];
106336
- historicalContext = {
106337
- currency: z$1.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
106338
- sourcePlanId: z$1.string().trim().min(1).optional()
106339
- };
106340
- percentSchema = z$1.number().finite().min(0).max(100);
106341
- z$1.discriminatedUnion("kind", [
106342
- z$1.object({
106343
- kind: z$1.literal("commission_free"),
106344
- reason: z$1.enum(STRIPE_COMMISSION_FREE_REASONS),
106345
- ...historicalContext
106346
- }),
106347
- z$1.object({
106348
- kind: z$1.literal("application_fee_amount"),
106349
- amountCents: z$1.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
106350
- percent: percentSchema,
106351
- ...historicalContext
106352
- }),
106353
- z$1.object({
106354
- kind: z$1.literal("application_fee_percent"),
106355
- percent: percentSchema,
106356
- ...historicalContext
106357
- })
106358
- ]);
106359
- }));
106360
- var init_eventOrderOptionSnapshot = __esmMin((() => {
106361
- init_src$2();
106362
- }));
106363
- var init_orderItemMetadata = __esmMin((() => {
106364
- init_stripeCommissionMetadata();
106365
- init_src$2();
106366
- init_eventOrderOptionSnapshot();
106367
- }));
106368
- var init_orderListFilters = __esmMin((() => {}));
106369
- var init_orderPaymentState = __esmMin((() => {
106370
- init_src$2();
106371
- init_assertNever();
106372
- toNonNegativeCents(0);
106373
- }));
106374
- var init_orderPaymentReceipt = __esmMin((() => {
106375
- init_src$2();
106376
- init_settlement();
106377
- }));
106378
- var init_pendingCheckoutSessionClaim = __esmMin((() => {}));
106379
- var init_orderPaymentLinkPlanning = __esmMin((() => {
106380
- init_assertNever();
106381
- init_orderPaymentState();
106382
- init_pendingCheckoutSessionClaim();
106383
- }));
106384
- var init_orderRefundPlanning = __esmMin((() => {
106385
- init_src$2();
106386
- init_settlement();
106387
- }));
106388
- var init_orderRefundPolicy = __esmMin((() => {
106389
- init_src$2();
106390
- }));
106391
- var init_persistedCheckoutLines = __esmMin((() => {
106392
- init_src$2();
106393
- init_settlement();
106394
- init_checkoutQuantity();
106395
- }));
106396
- var init_protectedDepositRefundPolicy = __esmMin((() => {
106397
- init_src$2();
106398
- }));
106399
- var init_refundRailSplit = __esmMin((() => {
106400
- init_src$2();
106401
- }));
106402
- var init_shopRefundPlanning = __esmMin((() => {
106403
- init_orderItemSupport();
106404
- init_refundPolicy();
106405
- }));
106406
- //#endregion
106407
- //#region ../commerce/src/purchase/stripeMinimumCharge.ts
106408
- function isStripeMinimumChargeCurrency(currency) {
106409
- return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
106410
- }
106411
- function getStripeMinimumChargeRequirement(rawCurrency) {
106412
- let currency;
106413
- try {
106414
- currency = normalizeCurrencyCode(rawCurrency);
106415
- } catch {
106416
- return null;
106417
- }
106418
- const currencyKey = currency;
106419
- if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
106420
- return {
106421
- currency,
106422
- minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
106423
- };
106424
- }
106425
- var STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
106426
- var init_stripeMinimumCharge = __esmMin((() => {
106427
- init_settlement();
106428
- STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
106429
- GBP: 30,
106430
- USD: 50,
106431
- EUR: 50,
106432
- AED: 200,
106433
- AUD: 50,
106434
- BGN: 100,
106435
- BRL: 50,
106436
- CAD: 50,
106437
- CHF: 50,
106438
- CZK: 1500,
106439
- DKK: 250,
106440
- HKD: 400,
106441
- HUF: 17500,
106442
- JPY: 50,
106443
- MXN: 1e3,
106444
- MYR: 200,
106445
- NOK: 300,
106446
- NZD: 50,
106447
- PLN: 200,
106448
- RON: 200,
106449
- SEK: 300,
106450
- SGD: 50,
106451
- THB: 1e3
106452
- };
106453
- }));
106454
- var init_stripeCheckoutReturnUrl = __esmMin((() => {}));
106455
- var init_stateTransitions = __esmMin((() => {
106456
- init_src$2();
106457
- }));
106458
- //#endregion
106459
- //#region ../commerce/src/purchase/event-registration-errors.ts
106460
- function parseEventRegistrationErrorReason(value) {
106461
- return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
106462
- }
106463
- var eventRegistrationErrors;
106464
- var init_event_registration_errors = __esmMin((() => {
106465
- eventRegistrationErrors = {
106466
- registrationClosed: {
106467
- message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
106468
- action: "none"
106469
- },
106470
- paymentInvestigationRequired: {
106471
- message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
106472
- action: "none"
106473
- },
106474
- paymentProviderUnavailable: {
106475
- message: "We couldn’t reach the payment provider. Please try again in a minute.",
106476
- action: "retry"
106477
- },
106478
- paymentPageUnavailable: {
106479
- message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
106480
- action: "retry"
106481
- },
106482
- paymentUnavailable: {
106483
- message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
106484
- action: "none"
106485
- },
106486
- capacityChanged: {
106487
- message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
106488
- action: "places"
106489
- },
106490
- selectionChanged: {
106491
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
106492
- action: "places"
106493
- },
106494
- registrationPreparationChanged: {
106495
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
106496
- action: "places"
106497
- },
106498
- registrationAlreadyExists: {
106499
- message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
106500
- action: "portal"
106501
- },
106502
- holdExpired: {
106503
- message: "Your reservation has timed out. Please check availability and choose your places again.",
106504
- action: "start"
106505
- },
106506
- waitlistUnavailable: {
106507
- 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.",
106508
- action: "event"
106509
- },
106510
- paymentContextMismatch: {
106511
- message: "The payment options for this event have changed. Please check the latest options before continuing.",
106512
- action: "payment-options"
106513
- },
106514
- verificationFailed: {
106515
- message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
106516
- action: "none"
106517
- },
106518
- idempotencyConflict: {
106519
- 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.",
106520
- action: "portal"
106521
- },
106522
- invalidCommitInput: {
106523
- 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.",
106524
- action: "details"
106525
- }
106526
- };
106527
- }));
106528
- var init_eventCheckoutRecoveryWindow = __esmMin((() => {}));
106529
- //#endregion
106530
- //#region ../commerce/src/purchase/index.ts
106531
- var init_purchase = __esmMin((() => {
106532
- init_types$1();
106533
- init_allocation();
106534
- init_orderTypes();
106535
- init_orderPlanningTypes();
106536
- init_bookingInstalmentSchedule();
106537
- init_cancellationPolicy();
106538
- init_checkoutCollectionPlan();
106539
- init_checkoutCommitPlan();
106540
- init_checkoutDiscountContextPlanning();
106541
- init_checkoutErrorCodes();
106542
- init_checkoutOrderItemProjection();
106543
- init_checkoutPaymentFlow();
106544
- init_checkoutPaymentPlanPlanning();
106545
- init_checkoutPaymentTermPlanning();
106546
- init_checkoutPaymentTerms();
106547
- init_checkoutQuantity();
106548
- init_checkoutSettlement();
106549
- init_checkoutStripeFinalizationPlanning();
106550
- init_checkoutStripeSessionPlanning();
106551
- init_checkoutSessionMetadata();
106552
- init_checkoutValidatedItemPlanning();
106553
- init_canonicalRefundPlanner();
106554
- init_confirmationEmailPayment();
106555
- init_discountApplication();
106556
- init_oneTimeCheckoutPlanning();
106557
- init_order_number();
106558
- init_orderCancellationPlan();
106559
- init_orderConfirmationPlanning();
106560
- init_orderCompletionEmailPlan();
106561
- init_orderFulfillmentPlan();
106562
- init_orderFulfillmentResult();
106563
- init_orderHistoryLedgerFilters();
106564
- init_orderHistorySource();
106565
- init_orderInstalmentAdminSettlement();
106566
- init_orderInstalmentClosure();
106567
- init_orderInstalmentLifecycle();
106568
- init_orderInstalmentPayoff();
106569
- init_orderInstalmentPlan();
106570
- init_orderItemMetadata();
106571
- init_orderItemSupport();
106572
- init_orderListFilters();
106573
- init_orderPaymentState();
106574
- init_orderPaymentReceipt();
106575
- init_orderPaymentLinkPlanning();
106576
- init_orderRefundPlanning();
106577
- init_orderRefundPolicy();
106578
- init_orderTotals();
106579
- init_persistedCheckoutLines();
106580
- init_pendingCheckoutSessionClaim();
106581
- init_protectedDepositRefundPolicy();
106582
- init_refundRailSplit();
106583
- init_refundPolicy();
106584
- init_settlement();
106585
- init_shopRefundPlanning();
106586
- init_stripeMinimumCharge();
106587
- init_stripeCheckoutReturnUrl();
106588
- init_stateTransitions();
106589
- init_event_registration_errors();
106590
- init_eventCheckoutRecoveryWindow();
106591
- init_stripeCommissionMetadata();
106592
- }));
106593
- //#endregion
106594
106735
  //#region ../blocks/src/system/runtime/shared/useWaitlistClaim.state.ts
106595
106736
  function createInitialWaitlistClaimState(hasToken) {
106596
106737
  return hasToken ? { kind: "resolving" } : { kind: "idle" };
@@ -107790,6 +107931,7 @@ function useEventRegistrationWizard(options) {
107790
107931
  }
107791
107932
  function useEventRegistrationWizardWithDeps(options, deps) {
107792
107933
  const api = useBlockApi();
107934
+ const nowIso = deps.useBookingNowIso();
107793
107935
  const registrationEvents = useMemo(() => [...toRegistrationEvents(options.events ?? []), ...toWholeSeriesRegistrationEvents(options.events ?? [])], [options.events]);
107794
107936
  const scopedEvents = useMemo(() => {
107795
107937
  return resolveEventRegistrationScopedEvents(registrationEvents, {
@@ -108320,6 +108462,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
108320
108462
  });
108321
108463
  return {
108322
108464
  api,
108465
+ nowIso,
108323
108466
  anchorId: options.anchorId,
108324
108467
  occurrenceContext: options.occurrenceContext,
108325
108468
  registrationTarget,
@@ -108429,6 +108572,7 @@ var init_useEventRegistrationWizard = __esmMin((() => {
108429
108572
  init_useEventRegistrationStripeReturn();
108430
108573
  init_useEventRegistrationSubmit();
108431
108574
  init_useDiscountCodeUi();
108575
+ init_useBookingNowIso();
108432
108576
  init_useSettledCommerceView();
108433
108577
  init_utils();
108434
108578
  init_ticketSelectionLines();
@@ -108449,7 +108593,8 @@ var init_useEventRegistrationWizard = __esmMin((() => {
108449
108593
  useWaitlistClaim,
108450
108594
  useEventRegistrationStripeReturn,
108451
108595
  useEventRegistrationSubmit,
108452
- useDiscountCodeUi
108596
+ useDiscountCodeUi,
108597
+ useBookingNowIso
108453
108598
  };
108454
108599
  }));
108455
108600
  //#endregion
@@ -108908,6 +109053,16 @@ function resolveEntitlementSummaryCopy(method, passCreditsRemaining) {
108908
109053
  function getSummaryRow(option, label) {
108909
109054
  return option.summaryRows.find((row) => row.label === label)?.value ?? null;
108910
109055
  }
109056
+ function getFlexibleBalanceSummary(option) {
109057
+ if (option?.kind !== "flexible_balance") return null;
109058
+ return {
109059
+ total: getSummaryRow(option, "Total"),
109060
+ dueToday: getSummaryRow(option, "Due today"),
109061
+ remainingBalance: getSummaryRow(option, "Remaining balance"),
109062
+ balanceDueBy: getSummaryRow(option, "Balance due by"),
109063
+ depositPolicy: getSummaryRow(option, "Deposit policy")
109064
+ };
109065
+ }
108911
109066
  function getSelectedDirectPaymentOption(input) {
108912
109067
  const summaryEvent = input.wizard.selectedEvent ?? input.wizard.preSelectedEvent;
108913
109068
  const eligibility = input.wizard.eligibility;
@@ -108918,7 +109073,8 @@ function getSelectedDirectPaymentOption(input) {
108918
109073
  paymentTerms: eligibility.paymentTerms,
108919
109074
  totalPriceCents: input.totalCents,
108920
109075
  currency: input.currency,
108921
- startsAt: getRegistrationStartAt(summaryEvent, input.wizard.occurrenceContext)
109076
+ startsAt: getRegistrationStartAt(summaryEvent, input.wizard.occurrenceContext),
109077
+ nowIso: input.wizard.nowIso
108922
109078
  }).options;
108923
109079
  const requestedKind = input.wizard.paymentSelection.collectionOptionKind;
108924
109080
  return options.find((option) => option.kind === requestedKind) ?? options.find((option) => option.kind === "upfront") ?? options[0] ?? null;
@@ -108968,18 +109124,11 @@ function EventRegistrationSummaryBar(props) {
108968
109124
  const autoAppliedDiscount = wizard.discountCode.trim().length > 0 ? null : wizard.autoAppliedDiscount;
108969
109125
  const autoAppliedDiscountCents = Math.max(0, autoAppliedDiscount?.computedAmountCents ?? 0);
108970
109126
  const discountedTotalCents = Math.max(0, subtotalCents - autoAppliedDiscountCents);
108971
- const selectedDirectPaymentOption = getSelectedDirectPaymentOption({
109127
+ const flexibleBalanceSummary = getFlexibleBalanceSummary(getSelectedDirectPaymentOption({
108972
109128
  wizard,
108973
109129
  totalCents: discountedTotalCents,
108974
109130
  currency: summaryCurrency
108975
- });
108976
- const flexibleBalanceSummary = selectedDirectPaymentOption?.kind === "flexible_balance" ? {
108977
- total: getSummaryRow(selectedDirectPaymentOption, "Total"),
108978
- dueToday: getSummaryRow(selectedDirectPaymentOption, "Due today"),
108979
- remainingBalance: getSummaryRow(selectedDirectPaymentOption, "Remaining balance"),
108980
- balanceDueBy: getSummaryRow(selectedDirectPaymentOption, "Balance due by"),
108981
- depositPolicy: getSummaryRow(selectedDirectPaymentOption, "Deposit policy")
108982
- } : null;
109131
+ }));
108983
109132
  const scheduleSummary = summaryEvent ? getScheduleSummary(wizard, summaryEvent) : null;
108984
109133
  const bookingUnit = summaryEvent?.registrationSubject.kind === "wholeSeries" ? "place" : "ticket";
108985
109134
  const productMethod = isProductMethod(wizard.paymentSelection.method);
@@ -110436,6 +110585,17 @@ function canContinueWithPaymentSelection(selection, directPaymentSelection) {
110436
110585
  case null: return false;
110437
110586
  }
110438
110587
  }
110588
+ function buildEventDirectPaymentOptions(input) {
110589
+ return buildEventRegistrationPaymentOptionsViewModel({
110590
+ eventTitle: input.event?.title ?? "Event",
110591
+ approvedPaymentOptions: input.eligibility.paymentOptions,
110592
+ paymentTerms: input.eligibility.paymentTerms,
110593
+ totalPriceCents: input.totalPriceCents,
110594
+ currency: input.eligibility.currency,
110595
+ startsAt: getRegistrationStartAt(input.event, input.occurrenceContext),
110596
+ nowIso: input.nowIso
110597
+ }).options;
110598
+ }
110439
110599
  var PaymentSelectionStep;
110440
110600
  var init_PaymentSelectionStep = __esmMin((() => {
110441
110601
  init_registrationEventAdapter();
@@ -110447,19 +110607,18 @@ var init_PaymentSelectionStep = __esmMin((() => {
110447
110607
  init_siteCreditPreview();
110448
110608
  init_SiteCreditPreviewPanel();
110449
110609
  init_PaymentBlockingPanel();
110450
- PaymentSelectionStep = ({ event, occurrenceContext, ticketsCount, email, isAuthenticated = false, creditState = { kind: "not_authenticated" }, directPaymentTotalCents, manualDiscountPending = false, selectedSelection, onSelectionChange, eligibility, eligibilityLoading, eligibilityError = null, onRequestLogin, onStateChange }) => {
110610
+ PaymentSelectionStep = ({ event, occurrenceContext, ticketsCount, email, isAuthenticated = false, creditState = { kind: "not_authenticated" }, directPaymentTotalCents, manualDiscountPending = false, selectedSelection, onSelectionChange, eligibility, eligibilityLoading, eligibilityError = null, onRequestLogin, onStateChange, nowIso }) => {
110451
110611
  const occurrenceId = occurrenceContext?.id ?? (event?.registrationSubject.kind === "occurrence" ? event.registrationSubject.occurrenceId : "");
110452
110612
  const selectedMethod = selectedSelection.method;
110453
110613
  const totalPrice = directPaymentTotalCents;
110454
110614
  const canShowDirectPaymentOptions = Boolean(eligibility?.requiresPayment && eligibility.price);
110455
- const directPaymentOptions = eligibility && canShowDirectPaymentOptions ? buildEventRegistrationPaymentOptionsViewModel({
110456
- eventTitle: event?.title ?? "Event",
110457
- approvedPaymentOptions: eligibility.paymentOptions,
110458
- paymentTerms: eligibility.paymentTerms,
110615
+ const directPaymentOptions = eligibility && canShowDirectPaymentOptions ? buildEventDirectPaymentOptions({
110616
+ event,
110617
+ occurrenceContext,
110618
+ eligibility,
110459
110619
  totalPriceCents: totalPrice,
110460
- currency: eligibility.currency,
110461
- startsAt: getRegistrationStartAt(event, occurrenceContext)
110462
- }).options : [];
110620
+ nowIso
110621
+ }) : [];
110463
110622
  const directPaymentSelectionState = resolveEventRegistrationDirectPaymentSelection({
110464
110623
  options: directPaymentOptions,
110465
110624
  selection: selectedSelection
@@ -110887,6 +111046,22 @@ function AttendeeDetailsContent(props) {
110887
111046
  })
110888
111047
  ] });
110889
111048
  }
111049
+ function EventDiscountCodeDisclosure(props) {
111050
+ const { wizard } = props;
111051
+ if (wizard.discountsAvailableLoading || !wizard.shouldShowDiscountToggle) return null;
111052
+ return /* @__PURE__ */ jsx(DiscountCodeDisclosure, {
111053
+ surface: "event-registration",
111054
+ isOpen: wizard.discountUiOpen,
111055
+ code: wizard.discountCode,
111056
+ onOpen: () => wizard.setDiscountUiOpen(true),
111057
+ onChange: wizard.setDiscountCode,
111058
+ onRemove: () => {
111059
+ wizard.setDiscountCode("");
111060
+ wizard.setDiscountUiOpen(false);
111061
+ },
111062
+ id: "er-discount-code"
111063
+ });
111064
+ }
110890
111065
  function PaymentSelectionContent(props) {
110891
111066
  const { wizard } = props;
110892
111067
  const subtotalCents = wizard.ticketSelectionSubtotalCents;
@@ -110920,19 +111095,9 @@ function PaymentSelectionContent(props) {
110920
111095
  eligibilityLoading: wizard.eligibilityLoading,
110921
111096
  eligibilityError: wizard.eligibilityError,
110922
111097
  onRequestLogin: () => wizard.setShowMagicLinkModal(true),
110923
- onStateChange: wizard.handlePaymentStepStateChange
110924
- }), wizard.discountsAvailableLoading ? null : wizard.shouldShowDiscountToggle ? /* @__PURE__ */ jsx(DiscountCodeDisclosure, {
110925
- surface: "event-registration",
110926
- isOpen: wizard.discountUiOpen,
110927
- code: wizard.discountCode,
110928
- onOpen: () => wizard.setDiscountUiOpen(true),
110929
- onChange: wizard.setDiscountCode,
110930
- onRemove: () => {
110931
- wizard.setDiscountCode("");
110932
- wizard.setDiscountUiOpen(false);
110933
- },
110934
- id: "er-discount-code"
110935
- }) : null] });
111098
+ onStateChange: wizard.handlePaymentStepStateChange,
111099
+ nowIso: wizard.nowIso
111100
+ }), /* @__PURE__ */ jsx(EventDiscountCodeDisclosure, { wizard })] });
110936
111101
  }
110937
111102
  function EventRegistrationWizardContent(props) {
110938
111103
  const { wizard } = props;
@@ -117531,19 +117696,18 @@ function PassesMembershipsController({ render }) {
117531
117696
  }, passDisplay.id);
117532
117697
  }),
117533
117698
  membershipCards: display.memberships.map((membershipDisplay) => {
117534
- const membership = hydration.memberships.find((candidate) => candidate.id === membershipDisplay.id);
117535
- if (!membership) return null;
117699
+ const { action } = membershipDisplay;
117536
117700
  return /* @__PURE__ */ jsx(MembershipCardView, {
117537
117701
  display: membershipDisplay,
117538
- action: /* @__PURE__ */ jsx(ThemedButton, {
117702
+ action: action.kind === "unavailable" ? /* @__PURE__ */ jsx(PassPurchaseUnavailable, { label: action.label }) : /* @__PURE__ */ jsx(ThemedButton, {
117539
117703
  type: "button",
117540
117704
  variant: hydration.buttonVariant,
117541
117705
  size: "md",
117542
117706
  extraClassName: "shop__cta",
117543
- label: membershipDisplay.actionLabel,
117544
- onClick: () => handleSubscribe(membership)
117707
+ label: action.label,
117708
+ onClick: () => handleSubscribe(action.product)
117545
117709
  })
117546
- }, membership.id);
117710
+ }, membershipDisplay.id);
117547
117711
  })
117548
117712
  })
117549
117713
  }), checkout ? /* @__PURE__ */ jsx(ModalShell, {
@@ -127723,11 +127887,11 @@ function ShopSSR({ blockId, siteId, apiBaseUrl, stage, children, checkoutEndpoin
127723
127887
  }, pass.id)),
127724
127888
  membershipCards: render.display.memberships.map((membership) => /* @__PURE__ */ jsx(MembershipCardView, {
127725
127889
  display: membership,
127726
- action: /* @__PURE__ */ jsx(ThemedButton, {
127890
+ action: membership.action.kind === "unavailable" ? /* @__PURE__ */ jsx(PassPurchaseUnavailable, { label: membership.action.label }) : /* @__PURE__ */ jsx(ThemedButton, {
127727
127891
  type: "button",
127728
127892
  variant: render.hydration.buttonVariant,
127729
127893
  size: "md",
127730
- label: membership.actionLabel,
127894
+ label: membership.action.label,
127731
127895
  disabled: true,
127732
127896
  "aria-disabled": "true"
127733
127897
  })
@@ -141971,7 +142135,7 @@ function getBlockOverride(blockKind, overrides) {
141971
142135
  */
141972
142136
  function getRenderableContent(block, previewStage = "published") {
141973
142137
  const source = previewStage === "preview" && block.draftContent ? block.draftContent : block.content ?? {};
141974
- return isObjectRecord$2(source) ? stripStaleTransitionStyleGroup(source) : {};
142138
+ return isObjectRecord$3(source) ? stripStaleTransitionStyleGroup(source) : {};
141975
142139
  }
141976
142140
  //#endregion
141977
142141
  //#region ../blocks/src/system/manifest/hydrateLinks.ts
@@ -157804,10 +157968,10 @@ function normalizeDataLoaders(def) {
157804
157968
  */
157805
157969
  function normalizeContent(block) {
157806
157970
  const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
157807
- if (!isObjectRecord$2(source)) return {};
157971
+ if (!isObjectRecord$3(source)) return {};
157808
157972
  if ("data" in source) {
157809
157973
  const data = source.data;
157810
- if (isObjectRecord$2(data)) return data;
157974
+ if (isObjectRecord$3(data)) return data;
157811
157975
  if (data === null || data === void 0) return {};
157812
157976
  }
157813
157977
  return source;
@@ -158044,7 +158208,7 @@ function stableNormalize(value) {
158044
158208
  //#region ../blocks/src/system/data/normalizeLoaderParams.ts
158045
158209
  init_typeGuards();
158046
158210
  function toStringParams(value) {
158047
- if (!isObjectRecord$2(value)) return {};
158211
+ if (!isObjectRecord$3(value)) return {};
158048
158212
  const out = {};
158049
158213
  for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
158050
158214
  return out;
@@ -162107,7 +162271,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
162107
162271
  stack: 8e3,
162108
162272
  digest: 128,
162109
162273
  componentStack: 8e3,
162110
- sourceLocation: 1024
162274
+ sourceLocation: 1024,
162275
+ navigationAgeMs: 6e4
162111
162276
  };
162112
162277
  const clientErrorEventSchema = z$1.enum([
162113
162278
  "dashboard:route-error",
@@ -162124,7 +162289,17 @@ z$1.object({
162124
162289
  stack: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
162125
162290
  digest: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
162126
162291
  componentStack: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
162127
- sourceLocation: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
162292
+ sourceLocation: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
162293
+ navigation: z$1.object({
162294
+ fromPathname: z$1.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
162295
+ toPathname: z$1.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
162296
+ type: z$1.enum([
162297
+ "push",
162298
+ "replace",
162299
+ "traverse"
162300
+ ]),
162301
+ ageMs: z$1.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
162302
+ }).strict().nullable().optional()
162128
162303
  }).strict();
162129
162304
  ({
162130
162305
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -163023,6 +163198,7 @@ const CANONICAL_REFUND_PLANNER_ERROR_CODES = [
163023
163198
  "refund_failed"
163024
163199
  ];
163025
163200
  const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
163201
+ "refund_blocked_by_live_payment_terms",
163026
163202
  ...CANONICAL_REFUND_PLANNER_ERROR_CODES,
163027
163203
  "payment_intent_not_found",
163028
163204
  "stripe_error",
@@ -163038,6 +163214,7 @@ const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
163038
163214
  //#endregion
163039
163215
  //#region ../api/src/bookingRefundOutcomes.ts
163040
163216
  const STANDARD_LINE_ITEM_REFUND_INVALID_CODES = [
163217
+ "refund_blocked_by_live_payment_terms",
163041
163218
  "missing_amount",
163042
163219
  "invalid_amount",
163043
163220
  "amount_exceeds_remaining",
@@ -163444,68 +163621,6 @@ z$1.enum(["public", "unlisted"], { error: "visibility must be 'public' or 'unlis
163444
163621
  //#region ../api/src/bookingConfig.ts
163445
163622
  init_src$2();
163446
163623
  //#endregion
163447
- //#region ../api/src/bookingPaymentTermSchemas.ts
163448
- const bookingDepositRefundPolicySchema = z$1.enum(["refundable", "non_refundable"]);
163449
- const bookingInstalmentPlanSchema = z$1.discriminatedUnion("kind", [
163450
- z$1.object({
163451
- kind: z$1.literal("deposit_plus_one_remainder"),
163452
- depositAmountCents: z$1.number().int().nonnegative(),
163453
- depositRefundability: bookingDepositRefundPolicySchema,
163454
- remainderDueCount: z$1.number().int().positive(),
163455
- intervalUnit: z$1.enum([
163456
- "day",
163457
- "week",
163458
- "month"
163459
- ])
163460
- }),
163461
- z$1.object({
163462
- kind: z$1.literal("deposit_plus_scheduled_instalments"),
163463
- depositAmountCents: z$1.number().int().nonnegative(),
163464
- depositRefundability: bookingDepositRefundPolicySchema,
163465
- instalmentCount: z$1.number().int().positive(),
163466
- intervalCount: z$1.number().int().positive(),
163467
- intervalUnit: z$1.enum([
163468
- "day",
163469
- "week",
163470
- "month"
163471
- ])
163472
- }),
163473
- z$1.object({
163474
- kind: z$1.literal("equal_scheduled_instalments"),
163475
- instalmentCount: z$1.number().int().positive(),
163476
- intervalCount: z$1.number().int().positive(),
163477
- intervalUnit: z$1.enum([
163478
- "day",
163479
- "week",
163480
- "month"
163481
- ])
163482
- })
163483
- ]);
163484
- const bookingFlexibleBalanceDueDateRuleSchema = z$1.discriminatedUnion("kind", [z$1.object({
163485
- kind: z$1.literal("relative_to_start_date"),
163486
- daysBeforeStart: z$1.number().int().positive()
163487
- }), z$1.object({
163488
- kind: z$1.literal("fixed_calendar_date"),
163489
- dueAt: z$1.string().datetime()
163490
- })]);
163491
- const bookingFlexibleBalanceConfigSchema = z$1.object({
163492
- upfrontAmountCents: z$1.number().int().nonnegative(),
163493
- dueDateRule: bookingFlexibleBalanceDueDateRuleSchema,
163494
- depositRefundability: bookingDepositRefundPolicySchema
163495
- });
163496
- z$1.discriminatedUnion("kind", [
163497
- z$1.object({ kind: z$1.literal("upfront") }),
163498
- z$1.object({ kind: z$1.literal("deferred_manual") }),
163499
- z$1.object({
163500
- kind: z$1.literal("instalment_plan"),
163501
- plan: bookingInstalmentPlanSchema
163502
- }),
163503
- z$1.object({
163504
- kind: z$1.literal("flexible_balance"),
163505
- config: bookingFlexibleBalanceConfigSchema
163506
- })
163507
- ]);
163508
- //#endregion
163509
163624
  //#region ../api/src/navigationMenuValidation.ts
163510
163625
  function hasChildren(item) {
163511
163626
  return Array.isArray(item.children) && item.children.length > 0;