@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
@@ -1110,7 +1110,25 @@ function addMonthsPreservingAnchorDay(date, intervalCount) {
1110
1110
  function assertNever$18(value) {
1111
1111
  throw new Error(`Unexpected value: ${String(value)}`);
1112
1112
  }
1113
- var init_booking_instalments = __esmMin((() => {}));
1113
+ var init_booking_instalments = __esmMin((() => {})), init_booking_instalment_deposit = __esmMin((() => {
1114
+ init_result$1();
1115
+ init_currency_format();
1116
+ init_booking_instalments();
1117
+ }));
1118
+ var init_booking_live_payment_terms = __esmMin((() => {}));
1119
+ //#endregion
1120
+ //#region ../core/src/booking-payment-options.ts
1121
+ /** Automatic instalments and a flexible balance cannot share one booking offer. */
1122
+ function validateBookingPaymentOptionKinds(kinds) {
1123
+ if (kinds.length === 0) return err$2("no_options");
1124
+ const uniqueKinds = new Set(kinds);
1125
+ if (uniqueKinds.size !== kinds.length) return err$2("duplicate_kind");
1126
+ if (uniqueKinds.has("instalment_plan") && uniqueKinds.has("flexible_balance")) return err$2("incompatible_collection_options");
1127
+ return ok$2(void 0);
1128
+ }
1129
+ var init_booking_payment_options = __esmMin((() => {
1130
+ init_result$1();
1131
+ }));
1114
1132
  //#endregion
1115
1133
  //#region ../core/src/booking-time-zone.ts
1116
1134
  function isValidBookingTimeZone(timeZone) {
@@ -2771,6 +2789,9 @@ var init_src$2 = __esmMin((() => {
2771
2789
  init_booking_flexible_balance();
2772
2790
  init_booking_refunds();
2773
2791
  init_booking_instalments();
2792
+ init_booking_instalment_deposit();
2793
+ init_booking_live_payment_terms();
2794
+ init_booking_payment_options();
2774
2795
  init_booking_date_time();
2775
2796
  init_booking_consent();
2776
2797
  init_appointment_service_categories();
@@ -13616,7 +13637,7 @@ function isRecord$29(value) {
13616
13637
  * callsites even though arrays pass at runtime. Follow-up cleanup should replace
13617
13638
  * this API with a more precise predicate type and migrate consumers.
13618
13639
  */
13619
- function isObjectRecord$2(value) {
13640
+ function isObjectRecord$3(value) {
13620
13641
  return typeof value === "object" && value !== null;
13621
13642
  }
13622
13643
  var init_typeGuards = __esmMin((() => {}));
@@ -13676,70 +13697,119 @@ var init_richTextSchema = __esmMin((() => {
13676
13697
  }).strict();
13677
13698
  }));
13678
13699
  //#endregion
13679
- //#region ../blocks/src/system/blocks/shared/bookingPaymentTerms.ts
13680
- var bookingDepositRefundPolicySchema$1, bookingInstalmentPlanSchema$1, bookingFlexibleBalanceDueDateRuleSchema$1, bookingFlexibleBalanceConfigSchema$1, blockBookingPaymentCollectionOptionSchema, blockBookingPaymentTermsSchema;
13681
- var init_bookingPaymentTerms = __esmMin((() => {
13682
- bookingDepositRefundPolicySchema$1 = z$1.enum(["refundable", "non_refundable"]);
13683
- bookingInstalmentPlanSchema$1 = z$1.union([
13684
- z$1.object({
13700
+ //#region ../core/src/booking-payment-schemas.ts
13701
+ function createInstalmentPlanSchema(object) {
13702
+ return z$1.discriminatedUnion("kind", [
13703
+ object({
13685
13704
  kind: z$1.literal("deposit_plus_one_remainder"),
13686
- depositAmountCents: z$1.number().int().min(0),
13687
- depositRefundability: bookingDepositRefundPolicySchema$1,
13688
- remainderDueCount: z$1.number().int().positive(),
13689
- intervalUnit: z$1.enum([
13690
- "day",
13691
- "week",
13692
- "month"
13693
- ])
13705
+ depositAmountCents: nonNegativeIntegerSchema,
13706
+ depositRefundability: depositRefundPolicySchema,
13707
+ remainderDueCount: positiveIntegerSchema,
13708
+ intervalUnit: intervalUnitSchema
13694
13709
  }),
13695
- z$1.object({
13710
+ object({
13696
13711
  kind: z$1.literal("deposit_plus_scheduled_instalments"),
13697
- depositAmountCents: z$1.number().int().min(0),
13698
- depositRefundability: bookingDepositRefundPolicySchema$1,
13699
- instalmentCount: z$1.number().int().positive(),
13700
- intervalCount: z$1.number().int().positive(),
13701
- intervalUnit: z$1.enum([
13702
- "day",
13703
- "week",
13704
- "month"
13705
- ])
13712
+ depositAmountCents: nonNegativeIntegerSchema,
13713
+ depositRefundability: depositRefundPolicySchema,
13714
+ instalmentCount: positiveIntegerSchema,
13715
+ intervalCount: positiveIntegerSchema,
13716
+ intervalUnit: intervalUnitSchema
13706
13717
  }),
13707
- z$1.object({
13718
+ object({
13708
13719
  kind: z$1.literal("equal_scheduled_instalments"),
13709
- instalmentCount: z$1.number().int().positive(),
13710
- intervalCount: z$1.number().int().positive(),
13711
- intervalUnit: z$1.enum([
13712
- "day",
13713
- "week",
13714
- "month"
13715
- ])
13720
+ instalmentCount: positiveIntegerSchema,
13721
+ intervalCount: positiveIntegerSchema,
13722
+ intervalUnit: intervalUnitSchema
13716
13723
  })
13717
13724
  ]);
13718
- bookingFlexibleBalanceDueDateRuleSchema$1 = z$1.union([z$1.object({
13725
+ }
13726
+ function createFlexibleBalanceSchemas(object) {
13727
+ const dueDateRule = z$1.discriminatedUnion("kind", [object({
13719
13728
  kind: z$1.literal("relative_to_start_date"),
13720
- daysBeforeStart: z$1.number().int().positive()
13721
- }), z$1.object({
13729
+ daysBeforeStart: positiveIntegerSchema
13730
+ }), object({
13722
13731
  kind: z$1.literal("fixed_calendar_date"),
13723
13732
  dueAt: z$1.string().datetime()
13724
13733
  })]);
13725
- bookingFlexibleBalanceConfigSchema$1 = z$1.object({
13726
- upfrontAmountCents: z$1.number().int().min(0),
13727
- dueDateRule: bookingFlexibleBalanceDueDateRuleSchema$1,
13728
- depositRefundability: bookingDepositRefundPolicySchema$1
13729
- });
13730
- blockBookingPaymentCollectionOptionSchema = z$1.union([
13731
- z$1.object({ kind: z$1.literal("upfront") }),
13732
- z$1.object({ kind: z$1.literal("deferred_manual") }),
13733
- z$1.object({
13734
+ return {
13735
+ dueDateRule,
13736
+ config: object({
13737
+ upfrontAmountCents: nonNegativeIntegerSchema,
13738
+ dueDateRule,
13739
+ depositRefundability: depositRefundPolicySchema
13740
+ })
13741
+ };
13742
+ }
13743
+ function buildBookingPaymentOptionSchemas(object) {
13744
+ const instalmentPlan = createInstalmentPlanSchema(object);
13745
+ const flexibleBalance = createFlexibleBalanceSchemas(object);
13746
+ const paymentCollectionOption = z$1.discriminatedUnion("kind", [
13747
+ object({ kind: z$1.literal("upfront") }),
13748
+ object({ kind: z$1.literal("deferred_manual") }),
13749
+ object({
13734
13750
  kind: z$1.literal("instalment_plan"),
13735
- plan: bookingInstalmentPlanSchema$1
13751
+ plan: instalmentPlan
13736
13752
  }),
13737
- z$1.object({
13753
+ object({
13738
13754
  kind: z$1.literal("flexible_balance"),
13739
- config: bookingFlexibleBalanceConfigSchema$1
13755
+ config: flexibleBalance.config
13740
13756
  })
13741
13757
  ]);
13742
- blockBookingPaymentTermsSchema = z$1.object({ allowedOptions: z$1.array(blockBookingPaymentCollectionOptionSchema).min(1) });
13758
+ const paymentTerms = object({ allowedOptions: z$1.array(paymentCollectionOption) }).superRefine(({ allowedOptions }, ctx) => {
13759
+ const result = validateBookingPaymentOptionKinds(allowedOptions.map(({ kind }) => kind));
13760
+ if (!result.ok) ctx.addIssue({
13761
+ code: "custom",
13762
+ path: ["allowedOptions"],
13763
+ message: paymentOptionKindsMessages[result.error]
13764
+ });
13765
+ });
13766
+ const paymentOptionsChoice = z$1.discriminatedUnion("source", [z$1.strictObject({ source: z$1.literal("default") }), z$1.strictObject({
13767
+ source: z$1.literal("custom"),
13768
+ paymentTerms
13769
+ })]);
13770
+ return {
13771
+ depositRefundPolicy: depositRefundPolicySchema,
13772
+ instalmentPlan,
13773
+ flexibleBalanceDueDateRule: flexibleBalance.dueDateRule,
13774
+ flexibleBalanceConfig: flexibleBalance.config,
13775
+ paymentCollectionOption,
13776
+ paymentTerms,
13777
+ paymentOptionsChoice
13778
+ };
13779
+ }
13780
+ function createBookingPaymentOptionSchemas(mode) {
13781
+ return mode === "strict" ? buildBookingPaymentOptionSchemas(strictObject) : buildBookingPaymentOptionSchemas(stripObject);
13782
+ }
13783
+ var stripObject, strictObject, depositRefundPolicySchema, intervalUnitSchema, nonNegativeIntegerSchema, positiveIntegerSchema, paymentOptionKindsMessages, bookingPaymentOptionSchemas, bookingPaymentTermsSchema;
13784
+ var init_booking_payment_schemas = __esmMin((() => {
13785
+ init_booking_payment_options();
13786
+ stripObject = (shape) => z$1.object(shape);
13787
+ strictObject = (shape) => z$1.strictObject(shape);
13788
+ depositRefundPolicySchema = z$1.enum(["refundable", "non_refundable"]);
13789
+ intervalUnitSchema = z$1.enum([
13790
+ "day",
13791
+ "week",
13792
+ "month"
13793
+ ]);
13794
+ nonNegativeIntegerSchema = z$1.number().int().nonnegative();
13795
+ positiveIntegerSchema = z$1.number().int().positive();
13796
+ paymentOptionKindsMessages = {
13797
+ no_options: "Choose at least one way for customers to pay.",
13798
+ duplicate_kind: "Choose each payment option only once.",
13799
+ incompatible_collection_options: "Offer instalments or a deposit with the rest paid later, but not both."
13800
+ };
13801
+ bookingPaymentOptionSchemas = createBookingPaymentOptionSchemas("strip");
13802
+ bookingPaymentOptionSchemas.depositRefundPolicy;
13803
+ bookingPaymentOptionSchemas.instalmentPlan;
13804
+ bookingPaymentOptionSchemas.flexibleBalanceDueDateRule;
13805
+ bookingPaymentOptionSchemas.flexibleBalanceConfig;
13806
+ bookingPaymentOptionSchemas.paymentCollectionOption;
13807
+ bookingPaymentTermsSchema = bookingPaymentOptionSchemas.paymentTerms;
13808
+ bookingPaymentOptionSchemas.paymentOptionsChoice;
13809
+ })), blockBookingPaymentTermsSchema;
13810
+ var init_bookingPaymentTerms = __esmMin((() => {
13811
+ init_booking_payment_schemas();
13812
+ blockBookingPaymentTermsSchema = bookingPaymentTermsSchema;
13743
13813
  }));
13744
13814
  //#endregion
13745
13815
  //#region ../blocks/src/system/blocks/shared/bookingConsent.ts
@@ -14407,7 +14477,7 @@ function defineClientOwnedBlockRuntime(runtime) {
14407
14477
  var init_runtime = __esmMin((() => {}));
14408
14478
  //#endregion
14409
14479
  //#region ../blocks/src/system/blocks/shop.shared.ts
14410
- var publicPassProductFields, purchasablePublicPassProductSchema, publicPassProductSchema, publicPassProductCollectionSchema, publicMembershipProductSchema, publicMembershipProductCollectionSchema;
14480
+ var publicPassProductFields, purchasablePublicPassProductSchema, publicPassProductSchema, publicPassProductCollectionSchema, publicMembershipProductFields, purchasablePublicMembershipProductSchema, publicMembershipProductSchema, publicMembershipProductCollectionSchema;
14411
14481
  var init_shop_shared = __esmMin((() => {
14412
14482
  publicPassProductFields = {
14413
14483
  id: z$1.string(),
@@ -14432,7 +14502,7 @@ var init_shop_shared = __esmMin((() => {
14432
14502
  unavailabilityReason: z$1.literal("online_payments_unavailable")
14433
14503
  })]);
14434
14504
  publicPassProductCollectionSchema = z$1.object({ passes: z$1.array(publicPassProductSchema) });
14435
- publicMembershipProductSchema = z$1.object({
14505
+ publicMembershipProductFields = {
14436
14506
  id: z$1.string(),
14437
14507
  name: z$1.string(),
14438
14508
  description: z$1.string().nullable(),
@@ -14441,7 +14511,16 @@ var init_shop_shared = __esmMin((() => {
14441
14511
  billingInterval: z$1.enum(["month", "year"]),
14442
14512
  eligibleCategoryIds: z$1.array(z$1.string()),
14443
14513
  eligibleCategoryNames: z$1.array(z$1.string())
14514
+ };
14515
+ purchasablePublicMembershipProductSchema = z$1.object({
14516
+ ...publicMembershipProductFields,
14517
+ purchaseAvailability: z$1.literal("purchasable")
14444
14518
  });
14519
+ publicMembershipProductSchema = z$1.discriminatedUnion("purchaseAvailability", [purchasablePublicMembershipProductSchema, z$1.object({
14520
+ ...publicMembershipProductFields,
14521
+ purchaseAvailability: z$1.literal("display_only"),
14522
+ unavailabilityReason: z$1.literal("online_payments_unavailable")
14523
+ })]);
14445
14524
  publicMembershipProductCollectionSchema = z$1.object({ memberships: z$1.array(publicMembershipProductSchema) });
14446
14525
  }));
14447
14526
  //#endregion
@@ -29989,14 +30068,14 @@ var init_non_block_islands = __esmMin((() => {
29989
30068
  }));
29990
30069
  //#endregion
29991
30070
  //#region ../blocks/src/contracts/islands.ts
29992
- function isObjectRecord$1(value) {
30071
+ function isObjectRecord$2(value) {
29993
30072
  return typeof value === "object" && value !== null;
29994
30073
  }
29995
30074
  function pickRecordKeys(source, keys) {
29996
30075
  return Object.fromEntries(keys.map((key) => [key, source[key]]));
29997
30076
  }
29998
30077
  function expectEncodedRecord(value, label) {
29999
- if (isObjectRecord$1(value)) return value;
30078
+ if (isObjectRecord$2(value)) return value;
30000
30079
  throw new Error(`Expected ${label} codec to encode an object`);
30001
30080
  }
30002
30081
  function prefixIssues(prefix, issues) {
@@ -30037,7 +30116,7 @@ function createInteractiveIslandCodec(options) {
30037
30116
  };
30038
30117
  },
30039
30118
  decode: (input) => {
30040
- if (!isObjectRecord$1(input)) return decodeFailure([{
30119
+ if (!isObjectRecord$2(input)) return decodeFailure([{
30041
30120
  path: [],
30042
30121
  message: "Expected island props object"
30043
30122
  }]);
@@ -30048,7 +30127,7 @@ function createInteractiveIslandCodec(options) {
30048
30127
  message: `Expected renderKind "${options.runtime.kind}"`
30049
30128
  });
30050
30129
  const renderInput = input.render;
30051
- if (!isObjectRecord$1(renderInput)) renderIssues.push({
30130
+ if (!isObjectRecord$2(renderInput)) renderIssues.push({
30052
30131
  path: ["render"],
30053
30132
  message: "Expected render object"
30054
30133
  });
@@ -30462,19 +30541,17 @@ function getBookingServicePaymentSelectionMode(service) {
30462
30541
  if (service?.paymentTermsAvailability?.kind === "pending_stripe_setup") return "pending_stripe_setup";
30463
30542
  const allowedKinds = service?.paymentTerms?.allowedOptions.map((option) => option.kind) ?? [];
30464
30543
  if (allowedKinds.length === 0) return "implicit_upfront";
30465
- if (allowedKinds.length === 1) {
30466
- const onlyKind = allowedKinds[0];
30467
- if (!onlyKind) return "unsupported";
30468
- switch (onlyKind) {
30469
- case "upfront": return "implicit_upfront";
30470
- case "deferred_manual": return "implicit_deferred_manual";
30471
- case "instalment_plan": return "implicit_instalment_plan";
30472
- case "flexible_balance": return "implicit_flexible_balance";
30473
- default: return assertNever$11(onlyKind);
30474
- }
30544
+ if (!validateBookingPaymentOptionKinds(allowedKinds).ok) return "unsupported";
30545
+ if (allowedKinds.length > 1) return "choice_required";
30546
+ const onlyKind = allowedKinds[0];
30547
+ switch (onlyKind) {
30548
+ case "upfront": return "implicit_upfront";
30549
+ case "deferred_manual": return "implicit_deferred_manual";
30550
+ case "instalment_plan": return "implicit_instalment_plan";
30551
+ case "flexible_balance": return "implicit_flexible_balance";
30552
+ case void 0: return "unsupported";
30553
+ default: return assertNever$11(onlyKind);
30475
30554
  }
30476
- if (allowedKinds.length === 2 && allowedKinds.includes("upfront") && (allowedKinds.includes("deferred_manual") || allowedKinds.includes("instalment_plan") || allowedKinds.includes("flexible_balance"))) return "choice_required";
30477
- return "unsupported";
30478
30555
  }
30479
30556
  function resolveDefaultBookingServiceId(formConfig, services) {
30480
30557
  const configuredServiceId = toTrimmedString(formConfig?.settings?.serviceId);
@@ -37226,7 +37303,7 @@ function buildPassesMembershipsDisplay(options) {
37226
37303
  product: pass
37227
37304
  } : {
37228
37305
  kind: "unavailable",
37229
- label: "Online purchasing coming soon."
37306
+ label: "Online purchasing is unavailable."
37230
37307
  }
37231
37308
  };
37232
37309
  });
@@ -37236,7 +37313,14 @@ function buildPassesMembershipsDisplay(options) {
37236
37313
  description: options.showDescriptions ? membership.description : null,
37237
37314
  priceLabel: formatCommercePrice(membership.price, membership.currency),
37238
37315
  intervalLabel: formatInterval(membership.billingInterval),
37239
- actionLabel: options.membershipActionLabel
37316
+ action: membership.purchaseAvailability === "purchasable" ? {
37317
+ kind: "purchase",
37318
+ label: options.membershipActionLabel,
37319
+ product: membership
37320
+ } : {
37321
+ kind: "unavailable",
37322
+ label: "Online purchasing is unavailable."
37323
+ }
37240
37324
  }));
37241
37325
  return {
37242
37326
  kind: "passes-memberships",
@@ -37587,7 +37671,14 @@ var init_shop_interactive = __esmMin((() => {
37587
37671
  description: z$1.string().nullable(),
37588
37672
  priceLabel: z$1.string(),
37589
37673
  intervalLabel: z$1.string(),
37590
- actionLabel: z$1.string()
37674
+ action: z$1.discriminatedUnion("kind", [z$1.object({
37675
+ kind: z$1.literal("purchase"),
37676
+ label: z$1.string(),
37677
+ product: purchasablePublicMembershipProductSchema
37678
+ }), z$1.object({
37679
+ kind: z$1.literal("unavailable"),
37680
+ label: z$1.string()
37681
+ })])
37591
37682
  });
37592
37683
  passesMembershipsDisplaySchema = z$1.object({
37593
37684
  kind: z$1.literal("passes-memberships"),
@@ -40602,7 +40693,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
40602
40693
  stack: 8e3,
40603
40694
  digest: 128,
40604
40695
  componentStack: 8e3,
40605
- sourceLocation: 1024
40696
+ sourceLocation: 1024,
40697
+ navigationAgeMs: 6e4
40606
40698
  };
40607
40699
  const clientErrorEventSchema = z$1.enum([
40608
40700
  "dashboard:route-error",
@@ -40619,7 +40711,17 @@ z$1.object({
40619
40711
  stack: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
40620
40712
  digest: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
40621
40713
  componentStack: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
40622
- sourceLocation: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
40714
+ sourceLocation: z$1.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
40715
+ navigation: z$1.object({
40716
+ fromPathname: z$1.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
40717
+ toPathname: z$1.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
40718
+ type: z$1.enum([
40719
+ "push",
40720
+ "replace",
40721
+ "traverse"
40722
+ ]),
40723
+ ageMs: z$1.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
40724
+ }).strict().nullable().optional()
40623
40725
  }).strict();
40624
40726
  const API_ENDPOINTS$1 = {
40625
40727
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -44376,24 +44478,6 @@ const API_ENDPOINTS$1 = {
44376
44478
  "server:internal_error"
44377
44479
  ]
44378
44480
  },
44379
- syncBookingPassWithStripe: {
44380
- path: "/sites/{siteId}/bookings/passes/{passId}/sync-stripe",
44381
- method: "POST",
44382
- tags: [
44383
- "site-{siteId}",
44384
- "passes-{siteId}",
44385
- "pass-{passId}"
44386
- ],
44387
- auth: "user",
44388
- responseKind: "json",
44389
- errors: [
44390
- "validation:invalid_input",
44391
- "auth:forbidden",
44392
- "resource:not_found",
44393
- "resource:conflict",
44394
- "server:internal_error"
44395
- ]
44396
- },
44397
44481
  refundCustomerPass: {
44398
44482
  path: "/sites/{siteId}/bookings/customer-passes/{customerPassId}/refund",
44399
44483
  method: "POST",
@@ -45857,7 +45941,7 @@ const API_ENDPOINTS$1 = {
45857
45941
  ]
45858
45942
  },
45859
45943
  cancelFlexibleBalanceBookingDueToNonPayment: {
45860
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/cancel-due-to-non-payment",
45944
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/cancel-due-to-non-payment",
45861
45945
  method: "POST",
45862
45946
  auth: "user",
45863
45947
  responseKind: "json",
@@ -45868,7 +45952,7 @@ const API_ENDPOINTS$1 = {
45868
45952
  ]
45869
45953
  },
45870
45954
  reopenFlexibleBalanceBookingAfterNonPaymentCancellation: {
45871
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/reopen",
45955
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/reopen",
45872
45956
  method: "POST",
45873
45957
  auth: "user",
45874
45958
  responseKind: "json",
@@ -57815,11 +57899,11 @@ function ShopSSR({ blockId, siteId, apiBaseUrl, stage, children, checkoutEndpoin
57815
57899
  }, pass.id)),
57816
57900
  membershipCards: render.display.memberships.map((membership) => /* @__PURE__ */ jsx(MembershipCardView, {
57817
57901
  display: membership,
57818
- action: /* @__PURE__ */ jsx(ThemedButton, {
57902
+ action: membership.action.kind === "unavailable" ? /* @__PURE__ */ jsx(PassPurchaseUnavailable, { label: membership.action.label }) : /* @__PURE__ */ jsx(ThemedButton, {
57819
57903
  type: "button",
57820
57904
  variant: render.hydration.buttonVariant,
57821
57905
  size: "md",
57822
- label: membership.actionLabel,
57906
+ label: membership.action.label,
57823
57907
  disabled: true,
57824
57908
  "aria-disabled": "true"
57825
57909
  })
@@ -71960,7 +72044,7 @@ function getBlockOverride(blockKind, overrides) {
71960
72044
  */
71961
72045
  function getRenderableContent(block, previewStage = "published") {
71962
72046
  const source = previewStage === "preview" && block.draftContent ? block.draftContent : block.content ?? {};
71963
- return isObjectRecord$2(source) ? stripStaleTransitionStyleGroup(source) : {};
72047
+ return isObjectRecord$3(source) ? stripStaleTransitionStyleGroup(source) : {};
71964
72048
  }
71965
72049
  //#endregion
71966
72050
  //#region ../blocks/src/system/manifest/hydrateLinks.ts
@@ -87734,10 +87818,10 @@ function normalizeDataLoaders(def) {
87734
87818
  */
87735
87819
  function normalizeContent(block) {
87736
87820
  const source = block.draftContent ?? block.content ?? block.publishedContent ?? {};
87737
- if (!isObjectRecord$2(source)) return {};
87821
+ if (!isObjectRecord$3(source)) return {};
87738
87822
  if ("data" in source) {
87739
87823
  const data = source.data;
87740
- if (isObjectRecord$2(data)) return data;
87824
+ if (isObjectRecord$3(data)) return data;
87741
87825
  if (data === null || data === void 0) return {};
87742
87826
  }
87743
87827
  return source;
@@ -87977,7 +88061,7 @@ function stableNormalize(value) {
87977
88061
  //#region ../blocks/src/system/data/normalizeLoaderParams.ts
87978
88062
  init_typeGuards();
87979
88063
  function toStringParams(value) {
87980
- if (!isObjectRecord$2(value)) return {};
88064
+ if (!isObjectRecord$3(value)) return {};
87981
88065
  const out = {};
87982
88066
  for (const [k, v] of Object.entries(value)) if (typeof v === "string") out[k] = v;
87983
88067
  return out;
@@ -88772,14 +88856,14 @@ async function parseSuccessResponse(endpoint, response, config) {
88772
88856
  default: return buildSuccessEnvelope(void 0, requestId);
88773
88857
  }
88774
88858
  }
88775
- function createRawCMSClient(headers = {}, baseUrl) {
88859
+ function createRawCMSClient(getHeaders = () => ({}), baseUrl) {
88776
88860
  return ({ endpoint, body, params, options = {} }) => {
88777
88861
  const plan = buildApiRequestPlan({
88778
88862
  endpoint,
88779
88863
  body,
88780
88864
  params,
88781
88865
  options,
88782
- headers,
88866
+ headers: getHeaders(),
88783
88867
  baseUrl: normalizeCmsApiBaseUrl(baseUrl ?? resolveApiBaseUrl()),
88784
88868
  sdkVersion
88785
88869
  });
@@ -88885,13 +88969,13 @@ function createParsedClient(rawClient) {
88885
88969
  };
88886
88970
  }
88887
88971
  function createCMSClient(headers = {}, baseUrl) {
88888
- return createParsedClient(createRawCMSClient(headers, baseUrl));
88972
+ return createParsedClient(createRawCMSClient(() => headers, baseUrl));
88889
88973
  }
88890
88974
  function createInternalAPIClient(baseUrl) {
88891
88975
  return createCMSClient({}, baseUrl);
88892
88976
  }
88893
88977
  function createBearerAPIClient(token, baseUrl) {
88894
- return createCMSClient({ Authorization: `Bearer ${token}` }, baseUrl);
88978
+ return createParsedClient(createRawCMSClient(() => ({ Authorization: `Bearer ${typeof token === "function" ? token() : token}` }), baseUrl));
88895
88979
  }
88896
88980
  //#endregion
88897
88981
  //#region ../api/src/accountApi.ts
@@ -89119,6 +89203,7 @@ const CANONICAL_REFUND_PLANNER_ERROR_CODES = [
89119
89203
  "refund_failed"
89120
89204
  ];
89121
89205
  const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
89206
+ "refund_blocked_by_live_payment_terms",
89122
89207
  ...CANONICAL_REFUND_PLANNER_ERROR_CODES,
89123
89208
  "payment_intent_not_found",
89124
89209
  "stripe_error",
@@ -89134,6 +89219,7 @@ const CANONICAL_ADMIN_REFUND_FAILURE_CODES = [
89134
89219
  //#endregion
89135
89220
  //#region ../api/src/bookingRefundOutcomes.ts
89136
89221
  const STANDARD_LINE_ITEM_REFUND_INVALID_CODES = [
89222
+ "refund_blocked_by_live_payment_terms",
89137
89223
  "missing_amount",
89138
89224
  "invalid_amount",
89139
89225
  "amount_exceeds_remaining",
@@ -89555,68 +89641,6 @@ z$1.enum(["public", "unlisted"], { error: "visibility must be 'public' or 'unlis
89555
89641
  //#region ../api/src/bookingConfig.ts
89556
89642
  init_src$2();
89557
89643
  //#endregion
89558
- //#region ../api/src/bookingPaymentTermSchemas.ts
89559
- const bookingDepositRefundPolicySchema = z$1.enum(["refundable", "non_refundable"]);
89560
- const bookingInstalmentPlanSchema = z$1.discriminatedUnion("kind", [
89561
- z$1.object({
89562
- kind: z$1.literal("deposit_plus_one_remainder"),
89563
- depositAmountCents: z$1.number().int().nonnegative(),
89564
- depositRefundability: bookingDepositRefundPolicySchema,
89565
- remainderDueCount: z$1.number().int().positive(),
89566
- intervalUnit: z$1.enum([
89567
- "day",
89568
- "week",
89569
- "month"
89570
- ])
89571
- }),
89572
- z$1.object({
89573
- kind: z$1.literal("deposit_plus_scheduled_instalments"),
89574
- depositAmountCents: z$1.number().int().nonnegative(),
89575
- depositRefundability: bookingDepositRefundPolicySchema,
89576
- instalmentCount: z$1.number().int().positive(),
89577
- intervalCount: z$1.number().int().positive(),
89578
- intervalUnit: z$1.enum([
89579
- "day",
89580
- "week",
89581
- "month"
89582
- ])
89583
- }),
89584
- z$1.object({
89585
- kind: z$1.literal("equal_scheduled_instalments"),
89586
- instalmentCount: z$1.number().int().positive(),
89587
- intervalCount: z$1.number().int().positive(),
89588
- intervalUnit: z$1.enum([
89589
- "day",
89590
- "week",
89591
- "month"
89592
- ])
89593
- })
89594
- ]);
89595
- const bookingFlexibleBalanceDueDateRuleSchema = z$1.discriminatedUnion("kind", [z$1.object({
89596
- kind: z$1.literal("relative_to_start_date"),
89597
- daysBeforeStart: z$1.number().int().positive()
89598
- }), z$1.object({
89599
- kind: z$1.literal("fixed_calendar_date"),
89600
- dueAt: z$1.string().datetime()
89601
- })]);
89602
- const bookingFlexibleBalanceConfigSchema = z$1.object({
89603
- upfrontAmountCents: z$1.number().int().nonnegative(),
89604
- dueDateRule: bookingFlexibleBalanceDueDateRuleSchema,
89605
- depositRefundability: bookingDepositRefundPolicySchema
89606
- });
89607
- z$1.discriminatedUnion("kind", [
89608
- z$1.object({ kind: z$1.literal("upfront") }),
89609
- z$1.object({ kind: z$1.literal("deferred_manual") }),
89610
- z$1.object({
89611
- kind: z$1.literal("instalment_plan"),
89612
- plan: bookingInstalmentPlanSchema
89613
- }),
89614
- z$1.object({
89615
- kind: z$1.literal("flexible_balance"),
89616
- config: bookingFlexibleBalanceConfigSchema
89617
- })
89618
- ]);
89619
- //#endregion
89620
89644
  //#region ../api/src/navigationMenuValidation.ts
89621
89645
  function hasChildren(item) {
89622
89646
  return Array.isArray(item.children) && item.children.length > 0;
@@ -152626,6 +152650,20 @@ var init_useAvailableSlots = __esmMin((() => {
152626
152650
  AVAILABILITY_REFRESH_JITTER_MS = 5e3;
152627
152651
  }));
152628
152652
  //#endregion
152653
+ //#region ../blocks/src/system/runtime/hooks/useBookingNowIso.ts
152654
+ /**
152655
+ * The moment a booking or registration flow opened, as an ISO timestamp.
152656
+ *
152657
+ * Payment previews take this as their "now" so the pure view-model builders
152658
+ * never read the clock themselves. It's captured once per mount, which keeps
152659
+ * memoised previews stable across renders.
152660
+ */
152661
+ function useBookingNowIso() {
152662
+ const [nowIso] = useState(() => (/* @__PURE__ */ new Date()).toISOString());
152663
+ return nowIso;
152664
+ }
152665
+ var init_useBookingNowIso = __esmMin((() => {}));
152666
+ //#endregion
152629
152667
  //#region ../blocks/src/system/runtime/hooks/useBookingSubmission.state.ts
152630
152668
  function bookingSubmissionReducer(state, action) {
152631
152669
  switch (action.type) {
@@ -153028,6 +153066,679 @@ var init_useDiscountCodeUi = __esmMin((() => {
153028
153066
  init_useDiscountCodeUi_state();
153029
153067
  }));
153030
153068
  //#endregion
153069
+ //#region ../commerce/src/purchase/types.ts
153070
+ var init_types$2 = __esmMin((() => {}));
153071
+ var init_allocation = __esmMin((() => {
153072
+ init_src$2();
153073
+ })), 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;
153074
+ var init_orderTypes = __esmMin((() => {
153075
+ ORDER_STATUSES = [
153076
+ "pending",
153077
+ "paid",
153078
+ "partially_refunded",
153079
+ "refunded",
153080
+ "failed",
153081
+ "cancelled"
153082
+ ];
153083
+ new Set(ORDER_STATUSES);
153084
+ CLOSED_ORDER_STATUSES = ["failed", "cancelled"];
153085
+ new Set(CLOSED_ORDER_STATUSES);
153086
+ ORDER_PAYMENT_METHODS = [
153087
+ "stripe",
153088
+ "store_credit",
153089
+ "mixed",
153090
+ "pass_redemption",
153091
+ "membership_access",
153092
+ "free",
153093
+ "manual",
153094
+ "waived"
153095
+ ];
153096
+ new Set(ORDER_PAYMENT_METHODS);
153097
+ CHECKOUT_COMMIT_STATES = [
153098
+ "pending",
153099
+ "committing",
153100
+ "committed",
153101
+ "compensated"
153102
+ ];
153103
+ new Set(CHECKOUT_COMMIT_STATES);
153104
+ ORDER_CHECKOUT_RECONCILIATION_STATES = [
153105
+ "not_needed",
153106
+ "evidence_pending",
153107
+ "needed"
153108
+ ];
153109
+ new Set(ORDER_CHECKOUT_RECONCILIATION_STATES);
153110
+ ORDER_ITEM_RECONCILIATION_STATES = ["not_needed", "needed"];
153111
+ new Set(ORDER_ITEM_RECONCILIATION_STATES);
153112
+ ORDER_ITEM_COMMIT_STATES = [
153113
+ "pending",
153114
+ "committed",
153115
+ "compensated"
153116
+ ];
153117
+ new Set(ORDER_ITEM_COMMIT_STATES);
153118
+ RESERVATION_FINALIZATION_STATES = [
153119
+ "not_applicable",
153120
+ "reserved",
153121
+ "consumed",
153122
+ "released"
153123
+ ];
153124
+ new Set(RESERVATION_FINALIZATION_STATES);
153125
+ DISCOUNT_REDEMPTION_STATUSES = [
153126
+ "pending",
153127
+ "redeemed",
153128
+ "released",
153129
+ "expired"
153130
+ ];
153131
+ new Set(DISCOUNT_REDEMPTION_STATUSES);
153132
+ ORDER_ITEM_KINDS = [
153133
+ "event_ticket",
153134
+ "product",
153135
+ "pass",
153136
+ "event_series_registration",
153137
+ "appointment",
153138
+ "membership"
153139
+ ];
153140
+ new Set(ORDER_ITEM_KINDS);
153141
+ }));
153142
+ //#endregion
153143
+ //#region ../commerce/src/purchase/orderPlanningTypes.ts
153144
+ var init_orderPlanningTypes = __esmMin((() => {}));
153145
+ //#endregion
153146
+ //#region ../commerce/src/utils/assertNever.ts
153147
+ function assertNever$1(value, message) {
153148
+ if (message) throw new Error(message);
153149
+ throw new Error(`Unexpected value: ${String(value)}`);
153150
+ }
153151
+ var init_assertNever = __esmMin((() => {}));
153152
+ //#endregion
153153
+ //#region ../commerce/src/purchase/bookingInstalmentSchedule.ts
153154
+ function resolveBookingInitialInstalmentAmountCents(input) {
153155
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
153156
+ switch (input.plan.kind) {
153157
+ case "deposit_plus_one_remainder":
153158
+ case "deposit_plus_scheduled_instalments": return clampConfiguredAmount(input.plan.depositAmountCents, totalAmountCents);
153159
+ case "equal_scheduled_instalments": return splitAmountWithRemainderInFirst(totalAmountCents, input.plan.instalmentCount)[0] ?? 0;
153160
+ default: return assertNever$1(input.plan);
153161
+ }
153162
+ }
153163
+ function buildBookingInstalmentSchedule(input) {
153164
+ const totalAmountCents = Math.max(0, input.totalAmountCents);
153165
+ switch (input.plan.kind) {
153166
+ case "deposit_plus_one_remainder": {
153167
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
153168
+ const remainderAmountCents = Math.max(0, totalAmountCents - depositAmountCents);
153169
+ return omitZeroAmountFutureRows([createScheduleRow({
153170
+ sequence: 1,
153171
+ stateAtBooking: "paid_today",
153172
+ dueAt: input.anchorAt,
153173
+ amountCents: depositAmountCents
153174
+ }), createScheduleRow({
153175
+ sequence: 2,
153176
+ stateAtBooking: "scheduled",
153177
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, input.plan.remainderDueCount, input.plan.intervalUnit),
153178
+ amountCents: remainderAmountCents
153179
+ })]);
153180
+ }
153181
+ case "deposit_plus_scheduled_instalments": {
153182
+ const plan = input.plan;
153183
+ const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
153184
+ const instalmentAmounts = splitAmountWithRemainderInFirst(Math.max(0, totalAmountCents - depositAmountCents), plan.instalmentCount);
153185
+ return omitZeroAmountFutureRows([createScheduleRow({
153186
+ sequence: 1,
153187
+ stateAtBooking: "paid_today",
153188
+ dueAt: input.anchorAt,
153189
+ amountCents: depositAmountCents
153190
+ }), ...instalmentAmounts.map((amountCents, index) => createScheduleRow({
153191
+ sequence: index + 2,
153192
+ stateAtBooking: "scheduled",
153193
+ dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * (index + 1), plan.intervalUnit),
153194
+ amountCents
153195
+ }))]);
153196
+ }
153197
+ case "equal_scheduled_instalments": {
153198
+ const plan = input.plan;
153199
+ return omitZeroAmountFutureRows(splitAmountWithRemainderInFirst(totalAmountCents, plan.instalmentCount).map((amountCents, index) => createScheduleRow({
153200
+ sequence: index + 1,
153201
+ stateAtBooking: index === 0 ? "paid_today" : "scheduled",
153202
+ dueAt: index === 0 ? input.anchorAt : addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * index, plan.intervalUnit),
153203
+ amountCents
153204
+ })));
153205
+ }
153206
+ default: return assertNever$1(input.plan);
153207
+ }
153208
+ }
153209
+ function createScheduleRow(input) {
153210
+ return {
153211
+ id: `payment-${input.sequence}`,
153212
+ sequence: input.sequence,
153213
+ stateAtBooking: input.stateAtBooking,
153214
+ dueAt: input.dueAt,
153215
+ amountCents: input.amountCents
153216
+ };
153217
+ }
153218
+ var init_bookingInstalmentSchedule = __esmMin((() => {
153219
+ init_src$2();
153220
+ init_assertNever();
153221
+ }));
153222
+ var init_bookingPaymentSelection = __esmMin((() => {
153223
+ init_assertNever();
153224
+ }));
153225
+ var init_cancellationPolicy = __esmMin((() => {}));
153226
+ var init_checkoutCollectionPlan = __esmMin((() => {
153227
+ init_src$2();
153228
+ }));
153229
+ var init_checkoutCommitPlan = __esmMin((() => {}));
153230
+ var init_checkoutDiscountContextPlanning = __esmMin((() => {
153231
+ init_src$2();
153232
+ }));
153233
+ //#endregion
153234
+ //#region ../commerce/src/purchase/checkoutErrorCodes.ts
153235
+ var init_checkoutErrorCodes = __esmMin((() => {}));
153236
+ var init_checkoutOrderItemProjection = __esmMin((() => {}));
153237
+ //#endregion
153238
+ //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
153239
+ function planCheckoutPaymentFlow(options) {
153240
+ const amountDueCents = toNonNegativeCents(options.amountDueCents);
153241
+ const discountCents = toNonNegativeCents(options.discountCents);
153242
+ const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
153243
+ const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
153244
+ if (amountDueCents <= 0) return {
153245
+ kind: "bypass",
153246
+ bypassReason: discountCents > 0 ? "discount_free" : "free",
153247
+ reserveCreditCents: 0
153248
+ };
153249
+ if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
153250
+ kind: "stripe",
153251
+ reserveCreditCents: toNonNegativeCents(0)
153252
+ };
153253
+ if (availableCreditCents >= amountDueCents) return {
153254
+ kind: "store_credit_only",
153255
+ reserveCreditCents: amountDueCents
153256
+ };
153257
+ return {
153258
+ kind: "stripe",
153259
+ reserveCreditCents: planMixedPaymentCreditReservation({
153260
+ amountDueCents,
153261
+ availableCreditCents,
153262
+ minimumStripeChargeCents
153263
+ })
153264
+ };
153265
+ }
153266
+ function planMixedPaymentCreditReservation(input) {
153267
+ const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
153268
+ if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
153269
+ if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
153270
+ return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
153271
+ }
153272
+ /**
153273
+ * Apply site credit to a flexible-balance booking before card payment.
153274
+ *
153275
+ * Credit first reduces the configured payment due now. Once that payment is
153276
+ * covered, any remaining credit reduces the later balance. If a partial credit
153277
+ * application would leave a positive card charge below Stripe's minimum, less
153278
+ * credit is used so the configured payment can still be collected.
153279
+ */
153280
+ function planFlexibleBalanceCreditFirst(input) {
153281
+ const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
153282
+ const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
153283
+ const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
153284
+ const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
153285
+ if (availableCreditCents >= totalCents && totalCents > 0) return {
153286
+ kind: "credit_only",
153287
+ reserveCreditCents: totalCents,
153288
+ cardDueNowCents: toNonNegativeCents(0),
153289
+ laterBalanceCents: toNonNegativeCents(0)
153290
+ };
153291
+ let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
153292
+ if (reserveCreditCents >= configuredDueNowCents) return {
153293
+ kind: "flexible_balance",
153294
+ reserveCreditCents,
153295
+ cardDueNowCents: toNonNegativeCents(0),
153296
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
153297
+ };
153298
+ const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
153299
+ if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
153300
+ if (configuredDueNowCents < minimumStripeChargeCents) return {
153301
+ kind: "card_below_minimum",
153302
+ reserveCreditCents: toNonNegativeCents(0),
153303
+ cardDueNowCents: configuredDueNowCents,
153304
+ laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
153305
+ };
153306
+ reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
153307
+ }
153308
+ const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
153309
+ return {
153310
+ kind: "flexible_balance",
153311
+ reserveCreditCents,
153312
+ cardDueNowCents,
153313
+ laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
153314
+ };
153315
+ }
153316
+ var init_checkoutPaymentFlow = __esmMin((() => {
153317
+ init_src$2();
153318
+ }));
153319
+ var init_checkoutPaymentPlanPlanning = __esmMin((() => {
153320
+ init_src$2();
153321
+ init_assertNever();
153322
+ }));
153323
+ var init_checkoutPaymentTerms = __esmMin((() => {
153324
+ init_src$2();
153325
+ init_assertNever();
153326
+ init_bookingPaymentSelection();
153327
+ }));
153328
+ var init_checkoutQuantity = __esmMin((() => {
153329
+ init_src$2();
153330
+ }));
153331
+ //#endregion
153332
+ //#region ../commerce/src/purchase/settlement.ts
153333
+ function normalizeCurrencyCode(raw) {
153334
+ const normalized = raw.trim().toUpperCase();
153335
+ if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
153336
+ return normalized;
153337
+ }
153338
+ var init_settlement = __esmMin((() => {
153339
+ init_src$2();
153340
+ }));
153341
+ var init_result = __esmMin((() => {
153342
+ init_src$2();
153343
+ }));
153344
+ var init_checkoutSettlement = __esmMin((() => {
153345
+ init_src$2();
153346
+ init_settlement();
153347
+ init_result();
153348
+ }));
153349
+ var init_checkoutStripeFinalizationPlanning = __esmMin((() => {}));
153350
+ var init_checkoutStripeSessionPlanning = __esmMin((() => {
153351
+ init_src$2();
153352
+ })), datedOfferingSharedEngineMetadataShape, orderCheckoutSessionMetadataBaseShape, absentDatedOfferingSharedEngineMetadataShape, LegacyOrderCheckoutSessionMetadataSchema, SharedDatedOfferingOrderCheckoutSessionMetadataSchema;
153353
+ var init_checkoutSessionMetadata = __esmMin((() => {
153354
+ datedOfferingSharedEngineMetadataShape = {
153355
+ datedOfferingEngineContractVersion: z$1.literal("shared_v1"),
153356
+ datedOfferingEngineRouteKind: z$1.literal("shared_whole_series_registration"),
153357
+ datedOfferingCapacityHoldId: z$1.string().uuid(),
153358
+ datedOfferingCapacityHoldAuditRef: z$1.string().uuid(),
153359
+ customerId: z$1.string().uuid(),
153360
+ eventSeriesId: z$1.string().uuid()
153361
+ };
153362
+ z$1.object(datedOfferingSharedEngineMetadataShape);
153363
+ orderCheckoutSessionMetadataBaseShape = {
153364
+ type: z$1.literal("order"),
153365
+ site_id: z$1.string().uuid(),
153366
+ order_id: z$1.string().uuid().optional(),
153367
+ customer_email: z$1.string().email().optional(),
153368
+ customer_name: z$1.string().optional(),
153369
+ product_id: z$1.string().uuid().optional(),
153370
+ attendee_id: z$1.string().uuid().optional(),
153371
+ occurrence_id: z$1.string().uuid().optional(),
153372
+ tickets_count: z$1.string().optional(),
153373
+ notes: z$1.string().optional(),
153374
+ discount_redemption_id: z$1.string().uuid().optional(),
153375
+ discount_code_id: z$1.string().uuid().optional(),
153376
+ discount_code: z$1.string().optional(),
153377
+ discount_public_label: z$1.string().optional(),
153378
+ credit_reservation_id: z$1.string().uuid().optional(),
153379
+ credit_reserved_cents: z$1.string().optional(),
153380
+ discount_code_amount_cents: z$1.string().optional(),
153381
+ order_payment_reason: z$1.enum([
153382
+ "instalment_payoff",
153383
+ "flexible_balance_initial",
153384
+ "flexible_balance_paydown"
153385
+ ]).optional(),
153386
+ order_payment_plan_id: z$1.string().uuid().optional(),
153387
+ order_flexible_balance_contract_id: z$1.string().uuid().optional()
153388
+ };
153389
+ absentDatedOfferingSharedEngineMetadataShape = {
153390
+ datedOfferingEngineContractVersion: z$1.never().optional(),
153391
+ datedOfferingEngineRouteKind: z$1.never().optional(),
153392
+ datedOfferingCapacityHoldId: z$1.never().optional(),
153393
+ datedOfferingCapacityHoldAuditRef: z$1.never().optional(),
153394
+ customerId: z$1.never().optional(),
153395
+ eventSeriesId: z$1.never().optional()
153396
+ };
153397
+ LegacyOrderCheckoutSessionMetadataSchema = z$1.object({
153398
+ ...orderCheckoutSessionMetadataBaseShape,
153399
+ ...absentDatedOfferingSharedEngineMetadataShape
153400
+ });
153401
+ SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z$1.object({
153402
+ ...orderCheckoutSessionMetadataBaseShape,
153403
+ ...datedOfferingSharedEngineMetadataShape
153404
+ });
153405
+ z$1.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
153406
+ }));
153407
+ var init_canonicalRefundPlanner = __esmMin((() => {}));
153408
+ var init_shipmentEligibility = __esmMin((() => {}));
153409
+ var init_refundPolicy = __esmMin((() => {}));
153410
+ var init_orderItemSupport = __esmMin((() => {
153411
+ init_shipmentEligibility();
153412
+ init_refundPolicy();
153413
+ }));
153414
+ var init_confirmationEmailPayment = __esmMin((() => {
153415
+ init_orderItemSupport();
153416
+ init_assertNever();
153417
+ }));
153418
+ var init_discountApplication = __esmMin((() => {
153419
+ init_src$2();
153420
+ init_settlement();
153421
+ }));
153422
+ var init_oneTimeCheckoutPlanning = __esmMin((() => {
153423
+ init_src$2();
153424
+ init_assertNever();
153425
+ init_bookingInstalmentSchedule();
153426
+ init_settlement();
153427
+ }));
153428
+ var init_order_number = __esmMin((() => {}));
153429
+ var init_orderCancellationPlan = __esmMin((() => {
153430
+ init_orderItemSupport();
153431
+ }));
153432
+ var init_orderTotals = __esmMin((() => {
153433
+ init_src$2();
153434
+ }));
153435
+ var init_orderConfirmationPlanning = __esmMin((() => {
153436
+ init_assertNever();
153437
+ init_orderTotals();
153438
+ }));
153439
+ var init_orderCompletionEmailPlan = __esmMin((() => {
153440
+ init_confirmationEmailPayment();
153441
+ }));
153442
+ var init_orderFulfillmentPlan = __esmMin((() => {
153443
+ init_src$2();
153444
+ }));
153445
+ //#endregion
153446
+ //#region ../commerce/src/purchase/orderFulfillmentResult.ts
153447
+ var init_orderFulfillmentResult = __esmMin((() => {}));
153448
+ //#endregion
153449
+ //#region ../commerce/src/purchase/orderHistoryLedgerFilters.ts
153450
+ var init_orderHistoryLedgerFilters = __esmMin((() => {}));
153451
+ var init_orderHistorySource = __esmMin((() => {})), MANUALLY_SETTLEABLE_PLAN_STATUSES, MANUALLY_SETTLEABLE_INSTALMENT_STATUSES;
153452
+ var init_orderInstalmentAdminSettlement = __esmMin((() => {
153453
+ init_src$2();
153454
+ MANUALLY_SETTLEABLE_PLAN_STATUSES = ["active", "payment_failed"];
153455
+ new Set(MANUALLY_SETTLEABLE_PLAN_STATUSES);
153456
+ MANUALLY_SETTLEABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
153457
+ new Set(MANUALLY_SETTLEABLE_INSTALMENT_STATUSES);
153458
+ }));
153459
+ var init_orderInstalmentClosure = __esmMin((() => {
153460
+ init_src$2();
153461
+ init_assertNever();
153462
+ })), RECURRING_COLLECTIBLE_STATUSES;
153463
+ var init_orderInstalmentLifecycle = __esmMin((() => {
153464
+ init_src$2();
153465
+ RECURRING_COLLECTIBLE_STATUSES = ["scheduled", "failed"];
153466
+ new Set(RECURRING_COLLECTIBLE_STATUSES);
153467
+ }));
153468
+ var init_orderInstalmentPlan = __esmMin((() => {
153469
+ init_src$2();
153470
+ init_assertNever();
153471
+ init_bookingInstalmentSchedule();
153472
+ })), STRIPE_COMMISSION_FREE_REASONS, historicalContext, percentSchema;
153473
+ var init_stripeCommissionMetadata = __esmMin((() => {
153474
+ init_src$2();
153475
+ STRIPE_COMMISSION_FREE_REASONS = [
153476
+ "managed_billing",
153477
+ "no_commission_plan",
153478
+ "billing_evidence_invalid",
153479
+ "fee_rounds_to_zero",
153480
+ "payment_not_stripe"
153481
+ ];
153482
+ historicalContext = {
153483
+ currency: z$1.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
153484
+ sourcePlanId: z$1.string().trim().min(1).optional()
153485
+ };
153486
+ percentSchema = z$1.number().finite().min(0).max(100);
153487
+ z$1.discriminatedUnion("kind", [
153488
+ z$1.object({
153489
+ kind: z$1.literal("commission_free"),
153490
+ reason: z$1.enum(STRIPE_COMMISSION_FREE_REASONS),
153491
+ ...historicalContext
153492
+ }),
153493
+ z$1.object({
153494
+ kind: z$1.literal("application_fee_amount"),
153495
+ amountCents: z$1.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
153496
+ percent: percentSchema,
153497
+ ...historicalContext
153498
+ }),
153499
+ z$1.object({
153500
+ kind: z$1.literal("application_fee_percent"),
153501
+ percent: percentSchema,
153502
+ ...historicalContext
153503
+ })
153504
+ ]);
153505
+ }));
153506
+ var init_eventOrderOptionSnapshot = __esmMin((() => {
153507
+ init_src$2();
153508
+ }));
153509
+ var init_membershipOrderItemMetadata = __esmMin((() => {
153510
+ init_src$2();
153511
+ }));
153512
+ var init_orderItemMetadata = __esmMin((() => {
153513
+ init_stripeCommissionMetadata();
153514
+ init_src$2();
153515
+ init_eventOrderOptionSnapshot();
153516
+ init_membershipOrderItemMetadata();
153517
+ }));
153518
+ var init_orderListFilters = __esmMin((() => {}));
153519
+ var init_orderPaymentState = __esmMin((() => {
153520
+ init_src$2();
153521
+ init_assertNever();
153522
+ toNonNegativeCents(0);
153523
+ }));
153524
+ var init_orderPaymentReceipt = __esmMin((() => {
153525
+ init_src$2();
153526
+ init_settlement();
153527
+ }));
153528
+ var init_pendingCheckoutSessionClaim = __esmMin((() => {}));
153529
+ var init_orderPaymentLinkPlanning = __esmMin((() => {
153530
+ init_assertNever();
153531
+ init_orderPaymentState();
153532
+ init_pendingCheckoutSessionClaim();
153533
+ }));
153534
+ var init_orderRefundPlanning = __esmMin((() => {
153535
+ init_src$2();
153536
+ init_settlement();
153537
+ }));
153538
+ var init_orderRefundPolicy = __esmMin((() => {
153539
+ init_src$2();
153540
+ }));
153541
+ var init_persistedCheckoutLines = __esmMin((() => {
153542
+ init_src$2();
153543
+ init_settlement();
153544
+ init_checkoutQuantity();
153545
+ }));
153546
+ var init_protectedDepositRefundPolicy = __esmMin((() => {
153547
+ init_src$2();
153548
+ }));
153549
+ var init_refundRailSplit = __esmMin((() => {
153550
+ init_src$2();
153551
+ }));
153552
+ var init_shopRefundPlanning = __esmMin((() => {
153553
+ init_orderItemSupport();
153554
+ init_refundPolicy();
153555
+ }));
153556
+ //#endregion
153557
+ //#region ../commerce/src/purchase/stripeMinimumCharge.ts
153558
+ function isStripeMinimumChargeCurrency(currency) {
153559
+ return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
153560
+ }
153561
+ function getStripeMinimumChargeRequirement(rawCurrency) {
153562
+ let currency;
153563
+ try {
153564
+ currency = normalizeCurrencyCode(rawCurrency);
153565
+ } catch {
153566
+ return null;
153567
+ }
153568
+ const currencyKey = currency;
153569
+ if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
153570
+ return {
153571
+ currency,
153572
+ minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
153573
+ };
153574
+ }
153575
+ var STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
153576
+ var init_stripeMinimumCharge = __esmMin((() => {
153577
+ init_settlement();
153578
+ STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
153579
+ GBP: 30,
153580
+ USD: 50,
153581
+ EUR: 50,
153582
+ AED: 200,
153583
+ AUD: 50,
153584
+ BGN: 100,
153585
+ BRL: 50,
153586
+ CAD: 50,
153587
+ CHF: 50,
153588
+ CZK: 1500,
153589
+ DKK: 250,
153590
+ HKD: 400,
153591
+ HUF: 17500,
153592
+ JPY: 50,
153593
+ MXN: 1e3,
153594
+ MYR: 200,
153595
+ NOK: 300,
153596
+ NZD: 50,
153597
+ PLN: 200,
153598
+ RON: 200,
153599
+ SEK: 300,
153600
+ SGD: 50,
153601
+ THB: 1e3
153602
+ };
153603
+ }));
153604
+ var init_stripeCheckoutReturnUrl = __esmMin((() => {}));
153605
+ var init_stateTransitions = __esmMin((() => {
153606
+ init_src$2();
153607
+ }));
153608
+ //#endregion
153609
+ //#region ../commerce/src/purchase/event-registration-errors.ts
153610
+ function parseEventRegistrationErrorReason(value) {
153611
+ return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
153612
+ }
153613
+ var eventRegistrationErrors;
153614
+ var init_event_registration_errors = __esmMin((() => {
153615
+ eventRegistrationErrors = {
153616
+ registrationClosed: {
153617
+ message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
153618
+ action: "none"
153619
+ },
153620
+ paymentInvestigationRequired: {
153621
+ message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
153622
+ action: "none"
153623
+ },
153624
+ paymentProviderUnavailable: {
153625
+ message: "We couldn’t reach the payment provider. Please try again in a minute.",
153626
+ action: "retry"
153627
+ },
153628
+ paymentPageUnavailable: {
153629
+ message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
153630
+ action: "retry"
153631
+ },
153632
+ paymentUnavailable: {
153633
+ message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
153634
+ action: "none"
153635
+ },
153636
+ capacityChanged: {
153637
+ message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
153638
+ action: "places"
153639
+ },
153640
+ selectionChanged: {
153641
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
153642
+ action: "places"
153643
+ },
153644
+ registrationPreparationChanged: {
153645
+ message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
153646
+ action: "places"
153647
+ },
153648
+ registrationAlreadyExists: {
153649
+ message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
153650
+ action: "portal"
153651
+ },
153652
+ holdExpired: {
153653
+ message: "Your reservation has timed out. Please check availability and choose your places again.",
153654
+ action: "start"
153655
+ },
153656
+ waitlistUnavailable: {
153657
+ 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.",
153658
+ action: "event"
153659
+ },
153660
+ paymentContextMismatch: {
153661
+ message: "The payment options for this event have changed. Please check the latest options before continuing.",
153662
+ action: "payment-options"
153663
+ },
153664
+ verificationFailed: {
153665
+ message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
153666
+ action: "none"
153667
+ },
153668
+ idempotencyConflict: {
153669
+ 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.",
153670
+ action: "portal"
153671
+ },
153672
+ invalidCommitInput: {
153673
+ 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.",
153674
+ action: "details"
153675
+ }
153676
+ };
153677
+ }));
153678
+ var init_eventCheckoutRecoveryWindow = __esmMin((() => {}));
153679
+ //#endregion
153680
+ //#region ../commerce/src/purchase/index.ts
153681
+ var init_purchase = __esmMin((() => {
153682
+ init_types$2();
153683
+ init_allocation();
153684
+ init_orderTypes();
153685
+ init_orderPlanningTypes();
153686
+ init_bookingInstalmentSchedule();
153687
+ init_bookingPaymentSelection();
153688
+ init_cancellationPolicy();
153689
+ init_checkoutCollectionPlan();
153690
+ init_checkoutCommitPlan();
153691
+ init_checkoutDiscountContextPlanning();
153692
+ init_checkoutErrorCodes();
153693
+ init_checkoutOrderItemProjection();
153694
+ init_checkoutPaymentFlow();
153695
+ init_checkoutPaymentPlanPlanning();
153696
+ init_checkoutPaymentTerms();
153697
+ init_checkoutQuantity();
153698
+ init_checkoutSettlement();
153699
+ init_checkoutStripeFinalizationPlanning();
153700
+ init_checkoutStripeSessionPlanning();
153701
+ init_checkoutSessionMetadata();
153702
+ init_canonicalRefundPlanner();
153703
+ init_confirmationEmailPayment();
153704
+ init_discountApplication();
153705
+ init_oneTimeCheckoutPlanning();
153706
+ init_order_number();
153707
+ init_orderCancellationPlan();
153708
+ init_orderConfirmationPlanning();
153709
+ init_orderCompletionEmailPlan();
153710
+ init_orderFulfillmentPlan();
153711
+ init_orderFulfillmentResult();
153712
+ init_orderHistoryLedgerFilters();
153713
+ init_orderHistorySource();
153714
+ init_orderInstalmentAdminSettlement();
153715
+ init_orderInstalmentClosure();
153716
+ init_orderInstalmentLifecycle();
153717
+ init_orderInstalmentPlan();
153718
+ init_orderItemMetadata();
153719
+ init_orderItemSupport();
153720
+ init_orderListFilters();
153721
+ init_orderPaymentState();
153722
+ init_orderPaymentReceipt();
153723
+ init_orderPaymentLinkPlanning();
153724
+ init_orderRefundPlanning();
153725
+ init_orderRefundPolicy();
153726
+ init_orderTotals();
153727
+ init_persistedCheckoutLines();
153728
+ init_pendingCheckoutSessionClaim();
153729
+ init_protectedDepositRefundPolicy();
153730
+ init_refundRailSplit();
153731
+ init_refundPolicy();
153732
+ init_settlement();
153733
+ init_shopRefundPlanning();
153734
+ init_stripeMinimumCharge();
153735
+ init_stripeCheckoutReturnUrl();
153736
+ init_stateTransitions();
153737
+ init_event_registration_errors();
153738
+ init_eventCheckoutRecoveryWindow();
153739
+ init_stripeCommissionMetadata();
153740
+ }));
153741
+ //#endregion
153031
153742
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptionCopy.ts
153032
153743
  function buildUpfrontBookingPaymentOptionCopy(formattedTotal) {
153033
153744
  return {
@@ -153071,7 +153782,7 @@ function formatDepositRefundabilityLabel(depositRefundability) {
153071
153782
  return depositRefundability === "non_refundable" ? "non-refundable" : "refundable";
153072
153783
  }
153073
153784
  var init_bookingPaymentOptionCopy = __esmMin((() => {}));
153074
- var init_types$2 = __esmMin((() => {}));
153785
+ var init_types$1 = __esmMin((() => {}));
153075
153786
  //#endregion
153076
153787
  //#region ../blocks/src/system/runtime/shared/utils/formatting.ts
153077
153788
  /**
@@ -153087,7 +153798,7 @@ function formatPrice(cents, currency = "GBP", locale) {
153087
153798
  }
153088
153799
  var init_formatting = __esmMin((() => {
153089
153800
  init_src$2();
153090
- init_types$2();
153801
+ init_types$1();
153091
153802
  }));
153092
153803
  //#endregion
153093
153804
  //#region ../blocks/src/system/runtime/shared/bookingPaymentOptions.ts
@@ -153095,11 +153806,10 @@ function resolveBookingPaymentDueNowCents(input) {
153095
153806
  switch (input.option.kind) {
153096
153807
  case "upfront": return input.totalCents;
153097
153808
  case "deferred_manual": return 0;
153098
- case "instalment_plan": return buildInstalmentSchedulePreview({
153099
- totalCents: input.totalCents,
153100
- option: input.option,
153101
- bookingStartAt: input.bookingStartAt
153102
- })[0]?.amountCents ?? input.totalCents;
153809
+ case "instalment_plan": return resolveBookingInitialInstalmentAmountCents({
153810
+ totalAmountCents: input.totalCents,
153811
+ plan: input.option.plan
153812
+ });
153103
153813
  case "flexible_balance": return resolveFlexibleBalanceInitialPaymentCents({
153104
153814
  totalAmountCents: input.totalCents,
153105
153815
  config: input.option.config
@@ -153121,6 +153831,7 @@ function buildBookingPaymentSelectionViewModel(input) {
153121
153831
  totalCents,
153122
153832
  currency,
153123
153833
  bookingStartAt: input.bookingStartAt,
153834
+ nowIso: input.nowIso,
153124
153835
  locale: input.locale
153125
153836
  }))
153126
153837
  };
@@ -153163,17 +153874,12 @@ function buildBookingPaymentOptionViewModel(input) {
153163
153874
  };
153164
153875
  }
153165
153876
  case "instalment_plan": {
153166
- const schedulePreview = buildInstalmentSchedulePreview({
153167
- totalCents: input.totalCents,
153168
- option: input.option,
153169
- bookingStartAt: input.bookingStartAt
153170
- });
153171
- const dueToday = resolveBookingPaymentDueNowCents({
153172
- option: input.option,
153173
- totalCents: input.totalCents,
153174
- bookingStartAt: input.bookingStartAt
153877
+ const [firstRow, ...futureRows] = buildBookingInstalmentSchedule({
153878
+ anchorAt: input.nowIso,
153879
+ totalAmountCents: input.totalCents,
153880
+ plan: input.option.plan
153175
153881
  });
153176
- const futureRows = schedulePreview.slice(1);
153882
+ const dueToday = firstRow?.amountCents ?? 0;
153177
153883
  const formattedTotal = formatPrice(input.totalCents, input.currency, input.locale);
153178
153884
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
153179
153885
  const depositRefundability = getBookingInstalmentDepositRefundability(input.option.plan);
@@ -153220,7 +153926,7 @@ function buildBookingPaymentOptionViewModel(input) {
153220
153926
  const formattedDueToday = formatPrice(dueToday, input.currency, input.locale);
153221
153927
  const formattedRemainingBalance = formatPrice(remainingBalance, input.currency, input.locale);
153222
153928
  const dueAt = resolveFlexibleBalanceDueAt({
153223
- bookingStartAt: input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString(),
153929
+ bookingStartAt: input.bookingStartAt ?? input.nowIso,
153224
153930
  dueDateRule: input.option.config.dueDateRule
153225
153931
  });
153226
153932
  const copy = buildFlexibleBalanceBookingPaymentOptionCopy({
@@ -153261,58 +153967,20 @@ function buildBookingPaymentOptionViewModel(input) {
153261
153967
  default: return assertNever$11(input.option);
153262
153968
  }
153263
153969
  }
153264
- function buildInstalmentSchedulePreview(input) {
153265
- const startAt = input.bookingStartAt ?? (/* @__PURE__ */ new Date()).toISOString();
153266
- switch (input.option.plan.kind) {
153267
- case "deposit_plus_one_remainder": {
153268
- const deposit = clampConfiguredAmount(input.option.plan.depositAmountCents, input.totalCents);
153269
- const remainder = Math.max(0, input.totalCents - deposit);
153270
- return compactSchedulePreview([{
153271
- dueAt: startAt,
153272
- amountCents: deposit
153273
- }, {
153274
- dueAt: addIntervalPreservingMonthAnchor(startAt, input.option.plan.remainderDueCount, input.option.plan.intervalUnit),
153275
- amountCents: remainder
153276
- }]);
153277
- }
153278
- case "deposit_plus_scheduled_instalments": {
153279
- const plan = input.option.plan;
153280
- const deposit = clampConfiguredAmount(plan.depositAmountCents, input.totalCents);
153281
- const instalments = splitAmountWithRemainderInFirst(Math.max(0, input.totalCents - deposit), plan.instalmentCount);
153282
- return compactSchedulePreview([{
153283
- dueAt: startAt,
153284
- amountCents: deposit
153285
- }, ...instalments.map((amountCents, index) => ({
153286
- dueAt: addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * (index + 1), plan.intervalUnit),
153287
- amountCents
153288
- }))]);
153289
- }
153290
- case "equal_scheduled_instalments": {
153291
- const plan = input.option.plan;
153292
- return compactSchedulePreview(splitAmountWithRemainderInFirst(input.totalCents, plan.instalmentCount).map((amountCents, index) => ({
153293
- dueAt: index === 0 ? startAt : addIntervalPreservingMonthAnchor(startAt, plan.intervalCount * index, plan.intervalUnit),
153294
- amountCents
153295
- })));
153296
- }
153297
- default: return assertNever$11(input.option.plan);
153298
- }
153299
- }
153300
153970
  function getPaymentCadenceLabel(plan) {
153301
153971
  const intervalCount = getBookingInstalmentPlanIntervalCount(plan);
153302
153972
  const unitLabel = intervalCount === 1 ? plan.intervalUnit : `${plan.intervalUnit}s`;
153303
153973
  return intervalCount === 1 ? unitLabel : `every ${intervalCount} ${unitLabel}`;
153304
153974
  }
153305
- function compactSchedulePreview(schedule) {
153306
- return omitZeroAmountFutureRows(schedule);
153307
- }
153308
153975
  function formatScheduleDate(isoString, locale) {
153309
153976
  const date = new Date(isoString);
153310
153977
  if (!Number.isFinite(date.getTime())) return isoString;
153311
153978
  return new Intl.DateTimeFormat(locale, { dateStyle: "medium" }).format(date);
153312
153979
  }
153313
153980
  var init_bookingPaymentOptions = __esmMin((() => {
153314
- init_dist$1();
153981
+ init_purchase();
153315
153982
  init_src$2();
153983
+ init_dist$1();
153316
153984
  init_bookingPaymentOptionCopy();
153317
153985
  init_formatting();
153318
153986
  }));
@@ -154537,13 +155205,16 @@ function useHeadlessBookingFlow(options) {
154537
155205
  defaultServiceId,
154538
155206
  options.services
154539
155207
  ]);
155208
+ const bookingNowIso = useBookingNowIso();
154540
155209
  const paymentSelection = useMemo(() => selectedService && paymentResolution.mode !== "unsupported" ? buildBookingPaymentSelectionViewModel({
154541
155210
  serviceTitle: selectedService.title,
154542
155211
  paymentTerms: selectedService.paymentTerms,
154543
155212
  priceAmount: selectedAppointmentPriceAmount,
154544
155213
  priceCurrency: selectedService.priceCurrency,
154545
- bookingStartAt: state.selectedSlot?.startAt
155214
+ bookingStartAt: state.selectedSlot?.startAt,
155215
+ nowIso: bookingNowIso
154546
155216
  }) : null, [
155217
+ bookingNowIso,
154547
155218
  paymentResolution.mode,
154548
155219
  selectedAppointmentPriceAmount,
154549
155220
  selectedService,
@@ -154700,6 +155371,7 @@ var init_useHeadlessBookingFlow = __esmMin((() => {
154700
155371
  init_useSelectedAppointmentConsentForm();
154701
155372
  init_useAvailableDates();
154702
155373
  init_useAvailableSlots();
155374
+ init_useBookingNowIso();
154703
155375
  init_useBookingSubmission();
154704
155376
  init_booking_form_submit_success();
154705
155377
  init_useDiscountCodeUi();
@@ -156690,7 +157362,7 @@ var init_components = __esmMin((() => {
156690
157362
  //#endregion
156691
157363
  //#region ../blocks/src/system/runtime/shared/index.ts
156692
157364
  var init_shared = __esmMin((() => {
156693
- init_types$2();
157365
+ init_types$1();
156694
157366
  init_utils$1();
156695
157367
  init_components();
156696
157368
  }));
@@ -157324,6 +157996,7 @@ function buildEventRegistrationPaymentOptionsViewModel(input) {
157324
157996
  priceAmount: input.totalPriceCents,
157325
157997
  priceCurrency: input.currency,
157326
157998
  bookingStartAt: input.startsAt,
157999
+ nowIso: input.nowIso,
157327
158000
  locale: input.locale
157328
158001
  });
157329
158002
  return {
@@ -157331,7 +158004,7 @@ function buildEventRegistrationPaymentOptionsViewModel(input) {
157331
158004
  sectionTitle: selection.sectionTitle,
157332
158005
  options: selection.options.flatMap((option, index) => {
157333
158006
  const sourceOption = approvedOptions[index];
157334
- return sourceOption ? [toEventDirectPaymentOption(option, sourceOption, selection.mode, input.totalPriceCents, input.startsAt)] : [];
158007
+ return sourceOption ? [toEventDirectPaymentOption(option, sourceOption, selection.mode, input.totalPriceCents)] : [];
157335
158008
  })
157336
158009
  };
157337
158010
  }
@@ -157339,11 +158012,10 @@ function selectApprovedEventDirectPaymentOptions(approvedPaymentOptions, payment
157339
158012
  const approvedKinds = new Set(getApprovedDirectPaymentCollectionOptionKinds(approvedPaymentOptions));
157340
158013
  return paymentTerms.allowedOptions.filter((option) => approvedKinds.has(option.kind));
157341
158014
  }
157342
- function toEventDirectPaymentOption(option, sourceOption, mode, totalCents, startsAt) {
158015
+ function toEventDirectPaymentOption(option, sourceOption, mode, totalCents) {
157343
158016
  const configuredPaymentDueNowCents = resolveBookingPaymentDueNowCents({
157344
158017
  option: sourceOption,
157345
- totalCents,
157346
- bookingStartAt: startsAt
158018
+ totalCents
157347
158019
  });
157348
158020
  switch (option.kind) {
157349
158021
  case "upfront": return {
@@ -158279,604 +158951,6 @@ var init_hooks = __esmMin((() => {
158279
158951
  REGISTRATION_OPTIONS_DEBOUNCE_MS = 150;
158280
158952
  }));
158281
158953
  //#endregion
158282
- //#region ../commerce/src/purchase/types.ts
158283
- var init_types$1 = __esmMin((() => {}));
158284
- var init_allocation = __esmMin((() => {
158285
- init_src$2();
158286
- })), 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;
158287
- var init_orderTypes = __esmMin((() => {
158288
- ORDER_STATUSES = [
158289
- "pending",
158290
- "paid",
158291
- "partially_refunded",
158292
- "refunded",
158293
- "failed",
158294
- "cancelled"
158295
- ];
158296
- new Set(ORDER_STATUSES);
158297
- ORDER_PAYMENT_METHODS = [
158298
- "stripe",
158299
- "store_credit",
158300
- "mixed",
158301
- "pass_redemption",
158302
- "membership_access",
158303
- "free",
158304
- "manual",
158305
- "waived"
158306
- ];
158307
- new Set(ORDER_PAYMENT_METHODS);
158308
- CHECKOUT_COMMIT_STATES = [
158309
- "pending",
158310
- "committing",
158311
- "committed",
158312
- "compensated"
158313
- ];
158314
- new Set(CHECKOUT_COMMIT_STATES);
158315
- ORDER_CHECKOUT_RECONCILIATION_STATES = [
158316
- "not_needed",
158317
- "evidence_pending",
158318
- "needed"
158319
- ];
158320
- new Set(ORDER_CHECKOUT_RECONCILIATION_STATES);
158321
- ORDER_ITEM_RECONCILIATION_STATES = ["not_needed", "needed"];
158322
- new Set(ORDER_ITEM_RECONCILIATION_STATES);
158323
- ORDER_ITEM_COMMIT_STATES = [
158324
- "pending",
158325
- "committed",
158326
- "compensated"
158327
- ];
158328
- new Set(ORDER_ITEM_COMMIT_STATES);
158329
- RESERVATION_FINALIZATION_STATES = [
158330
- "not_applicable",
158331
- "reserved",
158332
- "consumed",
158333
- "released"
158334
- ];
158335
- new Set(RESERVATION_FINALIZATION_STATES);
158336
- DISCOUNT_REDEMPTION_STATUSES = [
158337
- "pending",
158338
- "redeemed",
158339
- "released",
158340
- "expired"
158341
- ];
158342
- new Set(DISCOUNT_REDEMPTION_STATUSES);
158343
- ORDER_ITEM_KINDS = [
158344
- "event_ticket",
158345
- "product",
158346
- "pass",
158347
- "event_series_registration",
158348
- "appointment",
158349
- "membership"
158350
- ];
158351
- new Set(ORDER_ITEM_KINDS);
158352
- }));
158353
- //#endregion
158354
- //#region ../commerce/src/purchase/orderPlanningTypes.ts
158355
- var init_orderPlanningTypes = __esmMin((() => {}));
158356
- var init_assertNever = __esmMin((() => {}));
158357
- var init_bookingInstalmentSchedule = __esmMin((() => {
158358
- init_src$2();
158359
- init_assertNever();
158360
- }));
158361
- var init_cancellationPolicy = __esmMin((() => {}));
158362
- var init_checkoutCollectionPlan = __esmMin((() => {
158363
- init_src$2();
158364
- }));
158365
- var init_checkoutCommitPlan = __esmMin((() => {}));
158366
- var init_checkoutDiscountContextPlanning = __esmMin((() => {
158367
- init_src$2();
158368
- }));
158369
- //#endregion
158370
- //#region ../commerce/src/purchase/checkoutErrorCodes.ts
158371
- var init_checkoutErrorCodes = __esmMin((() => {}));
158372
- var init_checkoutOrderItemProjection = __esmMin((() => {}));
158373
- //#endregion
158374
- //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
158375
- function planCheckoutPaymentFlow(options) {
158376
- const amountDueCents = toNonNegativeCents(options.amountDueCents);
158377
- const discountCents = toNonNegativeCents(options.discountCents);
158378
- const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
158379
- const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
158380
- if (amountDueCents <= 0) return {
158381
- kind: "bypass",
158382
- bypassReason: discountCents > 0 ? "discount_free" : "free",
158383
- reserveCreditCents: 0
158384
- };
158385
- if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
158386
- kind: "stripe",
158387
- reserveCreditCents: toNonNegativeCents(0)
158388
- };
158389
- if (availableCreditCents >= amountDueCents) return {
158390
- kind: "store_credit_only",
158391
- reserveCreditCents: amountDueCents
158392
- };
158393
- return {
158394
- kind: "stripe",
158395
- reserveCreditCents: planMixedPaymentCreditReservation({
158396
- amountDueCents,
158397
- availableCreditCents,
158398
- minimumStripeChargeCents
158399
- })
158400
- };
158401
- }
158402
- function planMixedPaymentCreditReservation(input) {
158403
- const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
158404
- if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
158405
- if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
158406
- return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
158407
- }
158408
- /**
158409
- * Apply site credit to a flexible-balance booking before card payment.
158410
- *
158411
- * Credit first reduces the configured payment due now. Once that payment is
158412
- * covered, any remaining credit reduces the later balance. If a partial credit
158413
- * application would leave a positive card charge below Stripe's minimum, less
158414
- * credit is used so the configured payment can still be collected.
158415
- */
158416
- function planFlexibleBalanceCreditFirst(input) {
158417
- const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
158418
- const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
158419
- const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
158420
- const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
158421
- if (availableCreditCents >= totalCents && totalCents > 0) return {
158422
- kind: "credit_only",
158423
- reserveCreditCents: totalCents,
158424
- cardDueNowCents: toNonNegativeCents(0),
158425
- laterBalanceCents: toNonNegativeCents(0)
158426
- };
158427
- let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
158428
- if (reserveCreditCents >= configuredDueNowCents) return {
158429
- kind: "flexible_balance",
158430
- reserveCreditCents,
158431
- cardDueNowCents: toNonNegativeCents(0),
158432
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
158433
- };
158434
- const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
158435
- if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
158436
- if (configuredDueNowCents < minimumStripeChargeCents) return {
158437
- kind: "card_below_minimum",
158438
- reserveCreditCents: toNonNegativeCents(0),
158439
- cardDueNowCents: configuredDueNowCents,
158440
- laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
158441
- };
158442
- reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
158443
- }
158444
- const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
158445
- return {
158446
- kind: "flexible_balance",
158447
- reserveCreditCents,
158448
- cardDueNowCents,
158449
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
158450
- };
158451
- }
158452
- var init_checkoutPaymentFlow = __esmMin((() => {
158453
- init_src$2();
158454
- }));
158455
- var init_checkoutPaymentPlanPlanning = __esmMin((() => {
158456
- init_src$2();
158457
- }));
158458
- var init_checkoutPaymentTermPlanning = __esmMin((() => {}));
158459
- var init_checkoutPaymentTerms = __esmMin((() => {
158460
- init_src$2();
158461
- init_assertNever();
158462
- }));
158463
- var init_checkoutQuantity = __esmMin((() => {
158464
- init_src$2();
158465
- }));
158466
- //#endregion
158467
- //#region ../commerce/src/purchase/settlement.ts
158468
- function normalizeCurrencyCode(raw) {
158469
- const normalized = raw.trim().toUpperCase();
158470
- if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
158471
- return normalized;
158472
- }
158473
- var init_settlement = __esmMin((() => {
158474
- init_src$2();
158475
- }));
158476
- var init_result = __esmMin((() => {
158477
- init_src$2();
158478
- }));
158479
- var init_checkoutSettlement = __esmMin((() => {
158480
- init_src$2();
158481
- init_settlement();
158482
- init_result();
158483
- }));
158484
- var init_checkoutStripeFinalizationPlanning = __esmMin((() => {}));
158485
- var init_checkoutStripeSessionPlanning = __esmMin((() => {
158486
- init_src$2();
158487
- })), datedOfferingSharedEngineMetadataShape, orderCheckoutSessionMetadataBaseShape, absentDatedOfferingSharedEngineMetadataShape, LegacyOrderCheckoutSessionMetadataSchema, SharedDatedOfferingOrderCheckoutSessionMetadataSchema;
158488
- var init_checkoutSessionMetadata = __esmMin((() => {
158489
- datedOfferingSharedEngineMetadataShape = {
158490
- datedOfferingEngineContractVersion: z$1.literal("shared_v1"),
158491
- datedOfferingEngineRouteKind: z$1.literal("shared_whole_series_registration"),
158492
- datedOfferingCapacityHoldId: z$1.string().uuid(),
158493
- datedOfferingCapacityHoldAuditRef: z$1.string().uuid(),
158494
- customerId: z$1.string().uuid(),
158495
- eventSeriesId: z$1.string().uuid()
158496
- };
158497
- z$1.object(datedOfferingSharedEngineMetadataShape);
158498
- orderCheckoutSessionMetadataBaseShape = {
158499
- type: z$1.literal("order"),
158500
- site_id: z$1.string().uuid(),
158501
- order_id: z$1.string().uuid().optional(),
158502
- customer_email: z$1.string().email(),
158503
- customer_name: z$1.string().optional(),
158504
- product_id: z$1.string().uuid().optional(),
158505
- attendee_id: z$1.string().uuid().optional(),
158506
- occurrence_id: z$1.string().uuid().optional(),
158507
- tickets_count: z$1.string().optional(),
158508
- notes: z$1.string().optional(),
158509
- discount_redemption_id: z$1.string().uuid().optional(),
158510
- discount_code_id: z$1.string().uuid().optional(),
158511
- discount_code: z$1.string().optional(),
158512
- discount_public_label: z$1.string().optional(),
158513
- credit_reservation_id: z$1.string().uuid().optional(),
158514
- credit_reserved_cents: z$1.string().optional(),
158515
- discount_code_amount_cents: z$1.string().optional(),
158516
- order_payment_reason: z$1.enum([
158517
- "instalment_payoff",
158518
- "flexible_balance_initial",
158519
- "flexible_balance_paydown"
158520
- ]).optional(),
158521
- order_payment_plan_id: z$1.string().uuid().optional(),
158522
- order_flexible_balance_contract_id: z$1.string().uuid().optional()
158523
- };
158524
- absentDatedOfferingSharedEngineMetadataShape = {
158525
- datedOfferingEngineContractVersion: z$1.never().optional(),
158526
- datedOfferingEngineRouteKind: z$1.never().optional(),
158527
- datedOfferingCapacityHoldId: z$1.never().optional(),
158528
- datedOfferingCapacityHoldAuditRef: z$1.never().optional(),
158529
- customerId: z$1.never().optional(),
158530
- eventSeriesId: z$1.never().optional()
158531
- };
158532
- LegacyOrderCheckoutSessionMetadataSchema = z$1.object({
158533
- ...orderCheckoutSessionMetadataBaseShape,
158534
- ...absentDatedOfferingSharedEngineMetadataShape
158535
- });
158536
- SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z$1.object({
158537
- ...orderCheckoutSessionMetadataBaseShape,
158538
- ...datedOfferingSharedEngineMetadataShape
158539
- });
158540
- z$1.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
158541
- }));
158542
- var init_checkoutValidatedItemPlanning = __esmMin((() => {}));
158543
- var init_canonicalRefundPlanner = __esmMin((() => {}));
158544
- var init_shipmentEligibility = __esmMin((() => {}));
158545
- var init_refundPolicy = __esmMin((() => {}));
158546
- var init_orderItemSupport = __esmMin((() => {
158547
- init_shipmentEligibility();
158548
- init_refundPolicy();
158549
- }));
158550
- var init_confirmationEmailPayment = __esmMin((() => {
158551
- init_orderItemSupport();
158552
- init_assertNever();
158553
- }));
158554
- var init_discountApplication = __esmMin((() => {
158555
- init_src$2();
158556
- init_settlement();
158557
- }));
158558
- var init_oneTimeCheckoutPlanning = __esmMin((() => {
158559
- init_src$2();
158560
- init_assertNever();
158561
- init_settlement();
158562
- }));
158563
- var init_order_number = __esmMin((() => {}));
158564
- var init_orderCancellationPlan = __esmMin((() => {
158565
- init_orderItemSupport();
158566
- }));
158567
- var init_orderTotals = __esmMin((() => {
158568
- init_src$2();
158569
- }));
158570
- var init_orderConfirmationPlanning = __esmMin((() => {
158571
- init_assertNever();
158572
- init_orderTotals();
158573
- }));
158574
- var init_orderCompletionEmailPlan = __esmMin((() => {
158575
- init_confirmationEmailPayment();
158576
- }));
158577
- var init_orderFulfillmentPlan = __esmMin((() => {
158578
- init_src$2();
158579
- }));
158580
- //#endregion
158581
- //#region ../commerce/src/purchase/orderFulfillmentResult.ts
158582
- var init_orderFulfillmentResult = __esmMin((() => {}));
158583
- //#endregion
158584
- //#region ../commerce/src/purchase/orderHistoryLedgerFilters.ts
158585
- var init_orderHistoryLedgerFilters = __esmMin((() => {}));
158586
- var init_orderHistorySource = __esmMin((() => {})), MANUALLY_SETTLEABLE_PLAN_STATUSES, MANUALLY_SETTLEABLE_INSTALMENT_STATUSES;
158587
- var init_orderInstalmentAdminSettlement = __esmMin((() => {
158588
- init_src$2();
158589
- MANUALLY_SETTLEABLE_PLAN_STATUSES = ["active", "payment_failed"];
158590
- new Set(MANUALLY_SETTLEABLE_PLAN_STATUSES);
158591
- MANUALLY_SETTLEABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
158592
- new Set(MANUALLY_SETTLEABLE_INSTALMENT_STATUSES);
158593
- }));
158594
- var init_orderInstalmentClosure = __esmMin((() => {
158595
- init_src$2();
158596
- init_assertNever();
158597
- })), RECURRING_COLLECTIBLE_STATUSES;
158598
- var init_orderInstalmentLifecycle = __esmMin((() => {
158599
- init_src$2();
158600
- RECURRING_COLLECTIBLE_STATUSES = ["scheduled", "failed"];
158601
- new Set(RECURRING_COLLECTIBLE_STATUSES);
158602
- })), CANCELLABLE_INSTALMENT_STATUSES;
158603
- var init_orderInstalmentPayoff = __esmMin((() => {
158604
- init_src$2();
158605
- CANCELLABLE_INSTALMENT_STATUSES = ["scheduled", "failed"];
158606
- new Set(CANCELLABLE_INSTALMENT_STATUSES);
158607
- }));
158608
- var init_orderInstalmentPlan = __esmMin((() => {
158609
- init_src$2();
158610
- init_assertNever();
158611
- init_bookingInstalmentSchedule();
158612
- })), STRIPE_COMMISSION_FREE_REASONS, historicalContext, percentSchema;
158613
- var init_stripeCommissionMetadata = __esmMin((() => {
158614
- init_src$2();
158615
- STRIPE_COMMISSION_FREE_REASONS = [
158616
- "managed_billing",
158617
- "no_commission_plan",
158618
- "billing_evidence_invalid",
158619
- "fee_rounds_to_zero",
158620
- "payment_not_stripe"
158621
- ];
158622
- historicalContext = {
158623
- currency: z$1.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
158624
- sourcePlanId: z$1.string().trim().min(1).optional()
158625
- };
158626
- percentSchema = z$1.number().finite().min(0).max(100);
158627
- z$1.discriminatedUnion("kind", [
158628
- z$1.object({
158629
- kind: z$1.literal("commission_free"),
158630
- reason: z$1.enum(STRIPE_COMMISSION_FREE_REASONS),
158631
- ...historicalContext
158632
- }),
158633
- z$1.object({
158634
- kind: z$1.literal("application_fee_amount"),
158635
- amountCents: z$1.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
158636
- percent: percentSchema,
158637
- ...historicalContext
158638
- }),
158639
- z$1.object({
158640
- kind: z$1.literal("application_fee_percent"),
158641
- percent: percentSchema,
158642
- ...historicalContext
158643
- })
158644
- ]);
158645
- }));
158646
- var init_eventOrderOptionSnapshot = __esmMin((() => {
158647
- init_src$2();
158648
- }));
158649
- var init_orderItemMetadata = __esmMin((() => {
158650
- init_stripeCommissionMetadata();
158651
- init_src$2();
158652
- init_eventOrderOptionSnapshot();
158653
- }));
158654
- var init_orderListFilters = __esmMin((() => {}));
158655
- var init_orderPaymentState = __esmMin((() => {
158656
- init_src$2();
158657
- init_assertNever();
158658
- toNonNegativeCents(0);
158659
- }));
158660
- var init_orderPaymentReceipt = __esmMin((() => {
158661
- init_src$2();
158662
- init_settlement();
158663
- }));
158664
- var init_pendingCheckoutSessionClaim = __esmMin((() => {}));
158665
- var init_orderPaymentLinkPlanning = __esmMin((() => {
158666
- init_assertNever();
158667
- init_orderPaymentState();
158668
- init_pendingCheckoutSessionClaim();
158669
- }));
158670
- var init_orderRefundPlanning = __esmMin((() => {
158671
- init_src$2();
158672
- init_settlement();
158673
- }));
158674
- var init_orderRefundPolicy = __esmMin((() => {
158675
- init_src$2();
158676
- }));
158677
- var init_persistedCheckoutLines = __esmMin((() => {
158678
- init_src$2();
158679
- init_settlement();
158680
- init_checkoutQuantity();
158681
- }));
158682
- var init_protectedDepositRefundPolicy = __esmMin((() => {
158683
- init_src$2();
158684
- }));
158685
- var init_refundRailSplit = __esmMin((() => {
158686
- init_src$2();
158687
- }));
158688
- var init_shopRefundPlanning = __esmMin((() => {
158689
- init_orderItemSupport();
158690
- init_refundPolicy();
158691
- }));
158692
- //#endregion
158693
- //#region ../commerce/src/purchase/stripeMinimumCharge.ts
158694
- function isStripeMinimumChargeCurrency(currency) {
158695
- return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
158696
- }
158697
- function getStripeMinimumChargeRequirement(rawCurrency) {
158698
- let currency;
158699
- try {
158700
- currency = normalizeCurrencyCode(rawCurrency);
158701
- } catch {
158702
- return null;
158703
- }
158704
- const currencyKey = currency;
158705
- if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
158706
- return {
158707
- currency,
158708
- minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
158709
- };
158710
- }
158711
- var STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
158712
- var init_stripeMinimumCharge = __esmMin((() => {
158713
- init_settlement();
158714
- STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
158715
- GBP: 30,
158716
- USD: 50,
158717
- EUR: 50,
158718
- AED: 200,
158719
- AUD: 50,
158720
- BGN: 100,
158721
- BRL: 50,
158722
- CAD: 50,
158723
- CHF: 50,
158724
- CZK: 1500,
158725
- DKK: 250,
158726
- HKD: 400,
158727
- HUF: 17500,
158728
- JPY: 50,
158729
- MXN: 1e3,
158730
- MYR: 200,
158731
- NOK: 300,
158732
- NZD: 50,
158733
- PLN: 200,
158734
- RON: 200,
158735
- SEK: 300,
158736
- SGD: 50,
158737
- THB: 1e3
158738
- };
158739
- }));
158740
- var init_stripeCheckoutReturnUrl = __esmMin((() => {}));
158741
- var init_stateTransitions = __esmMin((() => {
158742
- init_src$2();
158743
- }));
158744
- //#endregion
158745
- //#region ../commerce/src/purchase/event-registration-errors.ts
158746
- function parseEventRegistrationErrorReason(value) {
158747
- return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
158748
- }
158749
- var eventRegistrationErrors;
158750
- var init_event_registration_errors = __esmMin((() => {
158751
- eventRegistrationErrors = {
158752
- registrationClosed: {
158753
- message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
158754
- action: "none"
158755
- },
158756
- paymentInvestigationRequired: {
158757
- message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
158758
- action: "none"
158759
- },
158760
- paymentProviderUnavailable: {
158761
- message: "We couldn’t reach the payment provider. Please try again in a minute.",
158762
- action: "retry"
158763
- },
158764
- paymentPageUnavailable: {
158765
- message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
158766
- action: "retry"
158767
- },
158768
- paymentUnavailable: {
158769
- message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
158770
- action: "none"
158771
- },
158772
- capacityChanged: {
158773
- message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
158774
- action: "places"
158775
- },
158776
- selectionChanged: {
158777
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
158778
- action: "places"
158779
- },
158780
- registrationPreparationChanged: {
158781
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
158782
- action: "places"
158783
- },
158784
- registrationAlreadyExists: {
158785
- message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
158786
- action: "portal"
158787
- },
158788
- holdExpired: {
158789
- message: "Your reservation has timed out. Please check availability and choose your places again.",
158790
- action: "start"
158791
- },
158792
- waitlistUnavailable: {
158793
- 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.",
158794
- action: "event"
158795
- },
158796
- paymentContextMismatch: {
158797
- message: "The payment options for this event have changed. Please check the latest options before continuing.",
158798
- action: "payment-options"
158799
- },
158800
- verificationFailed: {
158801
- message: "We couldn’t confirm this request came from a person. Please refresh the page and try again.",
158802
- action: "none"
158803
- },
158804
- idempotencyConflict: {
158805
- 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.",
158806
- action: "portal"
158807
- },
158808
- invalidCommitInput: {
158809
- 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.",
158810
- action: "details"
158811
- }
158812
- };
158813
- }));
158814
- var init_eventCheckoutRecoveryWindow = __esmMin((() => {}));
158815
- //#endregion
158816
- //#region ../commerce/src/purchase/index.ts
158817
- var init_purchase = __esmMin((() => {
158818
- init_types$1();
158819
- init_allocation();
158820
- init_orderTypes();
158821
- init_orderPlanningTypes();
158822
- init_bookingInstalmentSchedule();
158823
- init_cancellationPolicy();
158824
- init_checkoutCollectionPlan();
158825
- init_checkoutCommitPlan();
158826
- init_checkoutDiscountContextPlanning();
158827
- init_checkoutErrorCodes();
158828
- init_checkoutOrderItemProjection();
158829
- init_checkoutPaymentFlow();
158830
- init_checkoutPaymentPlanPlanning();
158831
- init_checkoutPaymentTermPlanning();
158832
- init_checkoutPaymentTerms();
158833
- init_checkoutQuantity();
158834
- init_checkoutSettlement();
158835
- init_checkoutStripeFinalizationPlanning();
158836
- init_checkoutStripeSessionPlanning();
158837
- init_checkoutSessionMetadata();
158838
- init_checkoutValidatedItemPlanning();
158839
- init_canonicalRefundPlanner();
158840
- init_confirmationEmailPayment();
158841
- init_discountApplication();
158842
- init_oneTimeCheckoutPlanning();
158843
- init_order_number();
158844
- init_orderCancellationPlan();
158845
- init_orderConfirmationPlanning();
158846
- init_orderCompletionEmailPlan();
158847
- init_orderFulfillmentPlan();
158848
- init_orderFulfillmentResult();
158849
- init_orderHistoryLedgerFilters();
158850
- init_orderHistorySource();
158851
- init_orderInstalmentAdminSettlement();
158852
- init_orderInstalmentClosure();
158853
- init_orderInstalmentLifecycle();
158854
- init_orderInstalmentPayoff();
158855
- init_orderInstalmentPlan();
158856
- init_orderItemMetadata();
158857
- init_orderItemSupport();
158858
- init_orderListFilters();
158859
- init_orderPaymentState();
158860
- init_orderPaymentReceipt();
158861
- init_orderPaymentLinkPlanning();
158862
- init_orderRefundPlanning();
158863
- init_orderRefundPolicy();
158864
- init_orderTotals();
158865
- init_persistedCheckoutLines();
158866
- init_pendingCheckoutSessionClaim();
158867
- init_protectedDepositRefundPolicy();
158868
- init_refundRailSplit();
158869
- init_refundPolicy();
158870
- init_settlement();
158871
- init_shopRefundPlanning();
158872
- init_stripeMinimumCharge();
158873
- init_stripeCheckoutReturnUrl();
158874
- init_stateTransitions();
158875
- init_event_registration_errors();
158876
- init_eventCheckoutRecoveryWindow();
158877
- init_stripeCommissionMetadata();
158878
- }));
158879
- //#endregion
158880
158954
  //#region ../blocks/src/system/runtime/shared/useWaitlistClaim.state.ts
158881
158955
  function createInitialWaitlistClaimState(hasToken) {
158882
158956
  return hasToken ? { kind: "resolving" } : { kind: "idle" };
@@ -160069,6 +160143,7 @@ function useEventRegistrationWizard(options) {
160069
160143
  }
160070
160144
  function useEventRegistrationWizardWithDeps(options, deps) {
160071
160145
  const api = useBlockApi();
160146
+ const nowIso = deps.useBookingNowIso();
160072
160147
  const registrationEvents = useMemo(() => [...toRegistrationEvents(options.events ?? []), ...toWholeSeriesRegistrationEvents(options.events ?? [])], [options.events]);
160073
160148
  const scopedEvents = useMemo(() => {
160074
160149
  return resolveEventRegistrationScopedEvents(registrationEvents, {
@@ -160599,6 +160674,7 @@ function useEventRegistrationWizardWithDeps(options, deps) {
160599
160674
  });
160600
160675
  return {
160601
160676
  api,
160677
+ nowIso,
160602
160678
  anchorId: options.anchorId,
160603
160679
  occurrenceContext: options.occurrenceContext,
160604
160680
  registrationTarget,
@@ -160708,6 +160784,7 @@ var init_useEventRegistrationWizard = __esmMin((() => {
160708
160784
  init_useEventRegistrationStripeReturn();
160709
160785
  init_useEventRegistrationSubmit();
160710
160786
  init_useDiscountCodeUi();
160787
+ init_useBookingNowIso();
160711
160788
  init_useSettledCommerceView();
160712
160789
  init_utils();
160713
160790
  init_ticketSelectionLines();
@@ -160728,7 +160805,8 @@ var init_useEventRegistrationWizard = __esmMin((() => {
160728
160805
  useWaitlistClaim,
160729
160806
  useEventRegistrationStripeReturn,
160730
160807
  useEventRegistrationSubmit,
160731
- useDiscountCodeUi
160808
+ useDiscountCodeUi,
160809
+ useBookingNowIso
160732
160810
  };
160733
160811
  }));
160734
160812
  //#endregion
@@ -161187,6 +161265,16 @@ function resolveEntitlementSummaryCopy(method, passCreditsRemaining) {
161187
161265
  function getSummaryRow(option, label) {
161188
161266
  return option.summaryRows.find((row) => row.label === label)?.value ?? null;
161189
161267
  }
161268
+ function getFlexibleBalanceSummary(option) {
161269
+ if (option?.kind !== "flexible_balance") return null;
161270
+ return {
161271
+ total: getSummaryRow(option, "Total"),
161272
+ dueToday: getSummaryRow(option, "Due today"),
161273
+ remainingBalance: getSummaryRow(option, "Remaining balance"),
161274
+ balanceDueBy: getSummaryRow(option, "Balance due by"),
161275
+ depositPolicy: getSummaryRow(option, "Deposit policy")
161276
+ };
161277
+ }
161190
161278
  function getSelectedDirectPaymentOption(input) {
161191
161279
  const summaryEvent = input.wizard.selectedEvent ?? input.wizard.preSelectedEvent;
161192
161280
  const eligibility = input.wizard.eligibility;
@@ -161197,7 +161285,8 @@ function getSelectedDirectPaymentOption(input) {
161197
161285
  paymentTerms: eligibility.paymentTerms,
161198
161286
  totalPriceCents: input.totalCents,
161199
161287
  currency: input.currency,
161200
- startsAt: getRegistrationStartAt(summaryEvent, input.wizard.occurrenceContext)
161288
+ startsAt: getRegistrationStartAt(summaryEvent, input.wizard.occurrenceContext),
161289
+ nowIso: input.wizard.nowIso
161201
161290
  }).options;
161202
161291
  const requestedKind = input.wizard.paymentSelection.collectionOptionKind;
161203
161292
  return options.find((option) => option.kind === requestedKind) ?? options.find((option) => option.kind === "upfront") ?? options[0] ?? null;
@@ -161247,18 +161336,11 @@ function EventRegistrationSummaryBar(props) {
161247
161336
  const autoAppliedDiscount = wizard.discountCode.trim().length > 0 ? null : wizard.autoAppliedDiscount;
161248
161337
  const autoAppliedDiscountCents = Math.max(0, autoAppliedDiscount?.computedAmountCents ?? 0);
161249
161338
  const discountedTotalCents = Math.max(0, subtotalCents - autoAppliedDiscountCents);
161250
- const selectedDirectPaymentOption = getSelectedDirectPaymentOption({
161339
+ const flexibleBalanceSummary = getFlexibleBalanceSummary(getSelectedDirectPaymentOption({
161251
161340
  wizard,
161252
161341
  totalCents: discountedTotalCents,
161253
161342
  currency: summaryCurrency
161254
- });
161255
- const flexibleBalanceSummary = selectedDirectPaymentOption?.kind === "flexible_balance" ? {
161256
- total: getSummaryRow(selectedDirectPaymentOption, "Total"),
161257
- dueToday: getSummaryRow(selectedDirectPaymentOption, "Due today"),
161258
- remainingBalance: getSummaryRow(selectedDirectPaymentOption, "Remaining balance"),
161259
- balanceDueBy: getSummaryRow(selectedDirectPaymentOption, "Balance due by"),
161260
- depositPolicy: getSummaryRow(selectedDirectPaymentOption, "Deposit policy")
161261
- } : null;
161343
+ }));
161262
161344
  const scheduleSummary = summaryEvent ? getScheduleSummary(wizard, summaryEvent) : null;
161263
161345
  const bookingUnit = summaryEvent?.registrationSubject.kind === "wholeSeries" ? "place" : "ticket";
161264
161346
  const productMethod = isProductMethod(wizard.paymentSelection.method);
@@ -162715,6 +162797,17 @@ function canContinueWithPaymentSelection(selection, directPaymentSelection) {
162715
162797
  case null: return false;
162716
162798
  }
162717
162799
  }
162800
+ function buildEventDirectPaymentOptions(input) {
162801
+ return buildEventRegistrationPaymentOptionsViewModel({
162802
+ eventTitle: input.event?.title ?? "Event",
162803
+ approvedPaymentOptions: input.eligibility.paymentOptions,
162804
+ paymentTerms: input.eligibility.paymentTerms,
162805
+ totalPriceCents: input.totalPriceCents,
162806
+ currency: input.eligibility.currency,
162807
+ startsAt: getRegistrationStartAt(input.event, input.occurrenceContext),
162808
+ nowIso: input.nowIso
162809
+ }).options;
162810
+ }
162718
162811
  var PaymentSelectionStep;
162719
162812
  var init_PaymentSelectionStep = __esmMin((() => {
162720
162813
  init_registrationEventAdapter();
@@ -162726,19 +162819,18 @@ var init_PaymentSelectionStep = __esmMin((() => {
162726
162819
  init_siteCreditPreview();
162727
162820
  init_SiteCreditPreviewPanel();
162728
162821
  init_PaymentBlockingPanel();
162729
- PaymentSelectionStep = ({ event, occurrenceContext, ticketsCount, email, isAuthenticated = false, creditState = { kind: "not_authenticated" }, directPaymentTotalCents, manualDiscountPending = false, selectedSelection, onSelectionChange, eligibility, eligibilityLoading, eligibilityError = null, onRequestLogin, onStateChange }) => {
162822
+ PaymentSelectionStep = ({ event, occurrenceContext, ticketsCount, email, isAuthenticated = false, creditState = { kind: "not_authenticated" }, directPaymentTotalCents, manualDiscountPending = false, selectedSelection, onSelectionChange, eligibility, eligibilityLoading, eligibilityError = null, onRequestLogin, onStateChange, nowIso }) => {
162730
162823
  const occurrenceId = occurrenceContext?.id ?? (event?.registrationSubject.kind === "occurrence" ? event.registrationSubject.occurrenceId : "");
162731
162824
  const selectedMethod = selectedSelection.method;
162732
162825
  const totalPrice = directPaymentTotalCents;
162733
162826
  const canShowDirectPaymentOptions = Boolean(eligibility?.requiresPayment && eligibility.price);
162734
- const directPaymentOptions = eligibility && canShowDirectPaymentOptions ? buildEventRegistrationPaymentOptionsViewModel({
162735
- eventTitle: event?.title ?? "Event",
162736
- approvedPaymentOptions: eligibility.paymentOptions,
162737
- paymentTerms: eligibility.paymentTerms,
162827
+ const directPaymentOptions = eligibility && canShowDirectPaymentOptions ? buildEventDirectPaymentOptions({
162828
+ event,
162829
+ occurrenceContext,
162830
+ eligibility,
162738
162831
  totalPriceCents: totalPrice,
162739
- currency: eligibility.currency,
162740
- startsAt: getRegistrationStartAt(event, occurrenceContext)
162741
- }).options : [];
162832
+ nowIso
162833
+ }) : [];
162742
162834
  const directPaymentSelectionState = resolveEventRegistrationDirectPaymentSelection({
162743
162835
  options: directPaymentOptions,
162744
162836
  selection: selectedSelection
@@ -163166,6 +163258,22 @@ function AttendeeDetailsContent(props) {
163166
163258
  })
163167
163259
  ] });
163168
163260
  }
163261
+ function EventDiscountCodeDisclosure(props) {
163262
+ const { wizard } = props;
163263
+ if (wizard.discountsAvailableLoading || !wizard.shouldShowDiscountToggle) return null;
163264
+ return /* @__PURE__ */ jsx(DiscountCodeDisclosure, {
163265
+ surface: "event-registration",
163266
+ isOpen: wizard.discountUiOpen,
163267
+ code: wizard.discountCode,
163268
+ onOpen: () => wizard.setDiscountUiOpen(true),
163269
+ onChange: wizard.setDiscountCode,
163270
+ onRemove: () => {
163271
+ wizard.setDiscountCode("");
163272
+ wizard.setDiscountUiOpen(false);
163273
+ },
163274
+ id: "er-discount-code"
163275
+ });
163276
+ }
163169
163277
  function PaymentSelectionContent(props) {
163170
163278
  const { wizard } = props;
163171
163279
  const subtotalCents = wizard.ticketSelectionSubtotalCents;
@@ -163199,19 +163307,9 @@ function PaymentSelectionContent(props) {
163199
163307
  eligibilityLoading: wizard.eligibilityLoading,
163200
163308
  eligibilityError: wizard.eligibilityError,
163201
163309
  onRequestLogin: () => wizard.setShowMagicLinkModal(true),
163202
- onStateChange: wizard.handlePaymentStepStateChange
163203
- }), wizard.discountsAvailableLoading ? null : wizard.shouldShowDiscountToggle ? /* @__PURE__ */ jsx(DiscountCodeDisclosure, {
163204
- surface: "event-registration",
163205
- isOpen: wizard.discountUiOpen,
163206
- code: wizard.discountCode,
163207
- onOpen: () => wizard.setDiscountUiOpen(true),
163208
- onChange: wizard.setDiscountCode,
163209
- onRemove: () => {
163210
- wizard.setDiscountCode("");
163211
- wizard.setDiscountUiOpen(false);
163212
- },
163213
- id: "er-discount-code"
163214
- }) : null] });
163310
+ onStateChange: wizard.handlePaymentStepStateChange,
163311
+ nowIso: wizard.nowIso
163312
+ }), /* @__PURE__ */ jsx(EventDiscountCodeDisclosure, { wizard })] });
163215
163313
  }
163216
163314
  function EventRegistrationWizardContent(props) {
163217
163315
  const { wizard } = props;
@@ -168019,19 +168117,18 @@ function PassesMembershipsController({ render }) {
168019
168117
  }, passDisplay.id);
168020
168118
  }),
168021
168119
  membershipCards: display.memberships.map((membershipDisplay) => {
168022
- const membership = hydration.memberships.find((candidate) => candidate.id === membershipDisplay.id);
168023
- if (!membership) return null;
168120
+ const { action } = membershipDisplay;
168024
168121
  return /* @__PURE__ */ jsx(MembershipCardView, {
168025
168122
  display: membershipDisplay,
168026
- action: /* @__PURE__ */ jsx(ThemedButton, {
168123
+ action: action.kind === "unavailable" ? /* @__PURE__ */ jsx(PassPurchaseUnavailable, { label: action.label }) : /* @__PURE__ */ jsx(ThemedButton, {
168027
168124
  type: "button",
168028
168125
  variant: hydration.buttonVariant,
168029
168126
  size: "md",
168030
168127
  extraClassName: "shop__cta",
168031
- label: membershipDisplay.actionLabel,
168032
- onClick: () => handleSubscribe(membership)
168128
+ label: action.label,
168129
+ onClick: () => handleSubscribe(action.product)
168033
168130
  })
168034
- }, membership.id);
168131
+ }, membershipDisplay.id);
168035
168132
  })
168036
168133
  })
168037
168134
  }), checkout ? /* @__PURE__ */ jsx(ModalShell, {
@@ -169417,7 +169514,7 @@ var SimpleCache = class {
169417
169514
  * 1. This constant
169418
169515
  * 2. The "version" field in package.json
169419
169516
  */
169420
- const SDK_VERSION = "0.148.0";
169517
+ const SDK_VERSION = "0.149.0";
169421
169518
  //#endregion
169422
169519
  //#region src/client/error.ts
169423
169520
  let _Symbol$for;