@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
@@ -5,6 +5,7 @@ import { useWaitlistClaim } from '../../shared/useWaitlistClaim';
5
5
  import { useEventRegistrationStripeReturn } from './useEventRegistrationStripeReturn';
6
6
  import { useEventRegistrationSubmit } from './useEventRegistrationSubmit';
7
7
  import { useDiscountCodeUi } from './useDiscountCodeUi';
8
+ import { useBookingNowIso } from '../../hooks/useBookingNowIso';
8
9
  export type EventRegistrationDetailsCompleteResult = Readonly<{
9
10
  ok: true;
10
11
  outcome: 'payment-step' | 'submitted';
@@ -30,9 +31,11 @@ export type EventRegistrationWizardDeps = Readonly<{
30
31
  useEventRegistrationStripeReturn: typeof useEventRegistrationStripeReturn;
31
32
  useEventRegistrationSubmit: typeof useEventRegistrationSubmit;
32
33
  useDiscountCodeUi: typeof useDiscountCodeUi;
34
+ useBookingNowIso: typeof useBookingNowIso;
33
35
  }>;
34
36
  export declare function useEventRegistrationWizard(options: UseEventRegistrationWizardOptions): {
35
37
  api: import("../../api").BoundBlockApiClient;
38
+ nowIso: string;
36
39
  anchorId: string;
37
40
  occurrenceContext: {
38
41
  id: string;
@@ -165,6 +168,7 @@ export declare function useEventRegistrationWizard(options: UseEventRegistration
165
168
  };
166
169
  export declare function useEventRegistrationWizardWithDeps(options: UseEventRegistrationWizardOptions, deps: EventRegistrationWizardDeps): {
167
170
  api: import("../../api").BoundBlockApiClient;
171
+ nowIso: string;
168
172
  anchorId: string;
169
173
  occurrenceContext: {
170
174
  id: string;
@@ -549,13 +549,13 @@ export declare const eventCollectionSourceSchemaShape: {
549
549
  siteTimeZone: z.ZodOptional<z.ZodString>;
550
550
  pricing: z.ZodType<import("../../../../../../../core/src/index").PublicEventPricing, unknown, z.core.$ZodTypeInternals<import("../../../../../../../core/src/index").PublicEventPricing, unknown>>;
551
551
  paymentTerms: z.ZodObject<{
552
- allowedOptions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
552
+ allowedOptions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
553
553
  kind: z.ZodLiteral<"upfront">;
554
554
  }, z.core.$strip>, z.ZodObject<{
555
555
  kind: z.ZodLiteral<"deferred_manual">;
556
556
  }, z.core.$strip>, z.ZodObject<{
557
557
  kind: z.ZodLiteral<"instalment_plan">;
558
- plan: z.ZodUnion<readonly [z.ZodObject<{
558
+ plan: z.ZodDiscriminatedUnion<[z.ZodObject<{
559
559
  kind: z.ZodLiteral<"deposit_plus_one_remainder">;
560
560
  depositAmountCents: z.ZodNumber;
561
561
  depositRefundability: z.ZodEnum<{
@@ -591,24 +591,24 @@ export declare const eventCollectionSourceSchemaShape: {
591
591
  week: "week";
592
592
  month: "month";
593
593
  }>;
594
- }, z.core.$strip>]>;
594
+ }, z.core.$strip>], "kind">;
595
595
  }, z.core.$strip>, z.ZodObject<{
596
596
  kind: z.ZodLiteral<"flexible_balance">;
597
597
  config: z.ZodObject<{
598
598
  upfrontAmountCents: z.ZodNumber;
599
- dueDateRule: z.ZodUnion<readonly [z.ZodObject<{
599
+ dueDateRule: z.ZodDiscriminatedUnion<[z.ZodObject<{
600
600
  kind: z.ZodLiteral<"relative_to_start_date">;
601
601
  daysBeforeStart: z.ZodNumber;
602
602
  }, z.core.$strip>, z.ZodObject<{
603
603
  kind: z.ZodLiteral<"fixed_calendar_date">;
604
604
  dueAt: z.ZodString;
605
- }, z.core.$strip>]>;
605
+ }, z.core.$strip>], "kind">;
606
606
  depositRefundability: z.ZodEnum<{
607
607
  refundable: "refundable";
608
608
  non_refundable: "non_refundable";
609
609
  }>;
610
610
  }, z.core.$strip>;
611
- }, z.core.$strip>]>>;
611
+ }, z.core.$strip>], "kind">>;
612
612
  }, z.core.$strip>;
613
613
  cancellationPolicy: z.ZodObject<{
614
614
  refunds: z.ZodObject<{
@@ -1038,13 +1038,13 @@ export declare const eventCollectionSourceSchemaShape: {
1038
1038
  siteTimeZone: z.ZodOptional<z.ZodString>;
1039
1039
  pricing: z.ZodType<import("../../../../../../../core/src/index").PublicEventPricing, unknown, z.core.$ZodTypeInternals<import("../../../../../../../core/src/index").PublicEventPricing, unknown>>;
1040
1040
  paymentTerms: z.ZodObject<{
1041
- allowedOptions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1041
+ allowedOptions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1042
1042
  kind: z.ZodLiteral<"upfront">;
1043
1043
  }, z.core.$strip>, z.ZodObject<{
1044
1044
  kind: z.ZodLiteral<"deferred_manual">;
1045
1045
  }, z.core.$strip>, z.ZodObject<{
1046
1046
  kind: z.ZodLiteral<"instalment_plan">;
1047
- plan: z.ZodUnion<readonly [z.ZodObject<{
1047
+ plan: z.ZodDiscriminatedUnion<[z.ZodObject<{
1048
1048
  kind: z.ZodLiteral<"deposit_plus_one_remainder">;
1049
1049
  depositAmountCents: z.ZodNumber;
1050
1050
  depositRefundability: z.ZodEnum<{
@@ -1080,24 +1080,24 @@ export declare const eventCollectionSourceSchemaShape: {
1080
1080
  week: "week";
1081
1081
  month: "month";
1082
1082
  }>;
1083
- }, z.core.$strip>]>;
1083
+ }, z.core.$strip>], "kind">;
1084
1084
  }, z.core.$strip>, z.ZodObject<{
1085
1085
  kind: z.ZodLiteral<"flexible_balance">;
1086
1086
  config: z.ZodObject<{
1087
1087
  upfrontAmountCents: z.ZodNumber;
1088
- dueDateRule: z.ZodUnion<readonly [z.ZodObject<{
1088
+ dueDateRule: z.ZodDiscriminatedUnion<[z.ZodObject<{
1089
1089
  kind: z.ZodLiteral<"relative_to_start_date">;
1090
1090
  daysBeforeStart: z.ZodNumber;
1091
1091
  }, z.core.$strip>, z.ZodObject<{
1092
1092
  kind: z.ZodLiteral<"fixed_calendar_date">;
1093
1093
  dueAt: z.ZodString;
1094
- }, z.core.$strip>]>;
1094
+ }, z.core.$strip>], "kind">;
1095
1095
  depositRefundability: z.ZodEnum<{
1096
1096
  refundable: "refundable";
1097
1097
  non_refundable: "non_refundable";
1098
1098
  }>;
1099
1099
  }, z.core.$strip>;
1100
- }, z.core.$strip>]>>;
1100
+ }, z.core.$strip>], "kind">>;
1101
1101
  }, z.core.$strip>;
1102
1102
  cancellationPolicy: z.ZodObject<{
1103
1103
  refunds: z.ZodObject<{
@@ -1588,13 +1588,13 @@ export declare const eventCollectionDisplaySchemaShape: {
1588
1588
  siteTimeZone: z.ZodOptional<z.ZodString>;
1589
1589
  pricing: z.ZodType<import("../../../../../../../core/src/index").PublicEventPricing, unknown, z.core.$ZodTypeInternals<import("../../../../../../../core/src/index").PublicEventPricing, unknown>>;
1590
1590
  paymentTerms: z.ZodObject<{
1591
- allowedOptions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1591
+ allowedOptions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
1592
1592
  kind: z.ZodLiteral<"upfront">;
1593
1593
  }, z.core.$strip>, z.ZodObject<{
1594
1594
  kind: z.ZodLiteral<"deferred_manual">;
1595
1595
  }, z.core.$strip>, z.ZodObject<{
1596
1596
  kind: z.ZodLiteral<"instalment_plan">;
1597
- plan: z.ZodUnion<readonly [z.ZodObject<{
1597
+ plan: z.ZodDiscriminatedUnion<[z.ZodObject<{
1598
1598
  kind: z.ZodLiteral<"deposit_plus_one_remainder">;
1599
1599
  depositAmountCents: z.ZodNumber;
1600
1600
  depositRefundability: z.ZodEnum<{
@@ -1630,24 +1630,24 @@ export declare const eventCollectionDisplaySchemaShape: {
1630
1630
  week: "week";
1631
1631
  month: "month";
1632
1632
  }>;
1633
- }, z.core.$strip>]>;
1633
+ }, z.core.$strip>], "kind">;
1634
1634
  }, z.core.$strip>, z.ZodObject<{
1635
1635
  kind: z.ZodLiteral<"flexible_balance">;
1636
1636
  config: z.ZodObject<{
1637
1637
  upfrontAmountCents: z.ZodNumber;
1638
- dueDateRule: z.ZodUnion<readonly [z.ZodObject<{
1638
+ dueDateRule: z.ZodDiscriminatedUnion<[z.ZodObject<{
1639
1639
  kind: z.ZodLiteral<"relative_to_start_date">;
1640
1640
  daysBeforeStart: z.ZodNumber;
1641
1641
  }, z.core.$strip>, z.ZodObject<{
1642
1642
  kind: z.ZodLiteral<"fixed_calendar_date">;
1643
1643
  dueAt: z.ZodString;
1644
- }, z.core.$strip>]>;
1644
+ }, z.core.$strip>], "kind">;
1645
1645
  depositRefundability: z.ZodEnum<{
1646
1646
  refundable: "refundable";
1647
1647
  non_refundable: "non_refundable";
1648
1648
  }>;
1649
1649
  }, z.core.$strip>;
1650
- }, z.core.$strip>]>>;
1650
+ }, z.core.$strip>], "kind">>;
1651
1651
  }, z.core.$strip>;
1652
1652
  cancellationPolicy: z.ZodObject<{
1653
1653
  refunds: z.ZodObject<{
@@ -2077,13 +2077,13 @@ export declare const eventCollectionDisplaySchemaShape: {
2077
2077
  siteTimeZone: z.ZodOptional<z.ZodString>;
2078
2078
  pricing: z.ZodType<import("../../../../../../../core/src/index").PublicEventPricing, unknown, z.core.$ZodTypeInternals<import("../../../../../../../core/src/index").PublicEventPricing, unknown>>;
2079
2079
  paymentTerms: z.ZodObject<{
2080
- allowedOptions: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2080
+ allowedOptions: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
2081
2081
  kind: z.ZodLiteral<"upfront">;
2082
2082
  }, z.core.$strip>, z.ZodObject<{
2083
2083
  kind: z.ZodLiteral<"deferred_manual">;
2084
2084
  }, z.core.$strip>, z.ZodObject<{
2085
2085
  kind: z.ZodLiteral<"instalment_plan">;
2086
- plan: z.ZodUnion<readonly [z.ZodObject<{
2086
+ plan: z.ZodDiscriminatedUnion<[z.ZodObject<{
2087
2087
  kind: z.ZodLiteral<"deposit_plus_one_remainder">;
2088
2088
  depositAmountCents: z.ZodNumber;
2089
2089
  depositRefundability: z.ZodEnum<{
@@ -2119,24 +2119,24 @@ export declare const eventCollectionDisplaySchemaShape: {
2119
2119
  week: "week";
2120
2120
  month: "month";
2121
2121
  }>;
2122
- }, z.core.$strip>]>;
2122
+ }, z.core.$strip>], "kind">;
2123
2123
  }, z.core.$strip>, z.ZodObject<{
2124
2124
  kind: z.ZodLiteral<"flexible_balance">;
2125
2125
  config: z.ZodObject<{
2126
2126
  upfrontAmountCents: z.ZodNumber;
2127
- dueDateRule: z.ZodUnion<readonly [z.ZodObject<{
2127
+ dueDateRule: z.ZodDiscriminatedUnion<[z.ZodObject<{
2128
2128
  kind: z.ZodLiteral<"relative_to_start_date">;
2129
2129
  daysBeforeStart: z.ZodNumber;
2130
2130
  }, z.core.$strip>, z.ZodObject<{
2131
2131
  kind: z.ZodLiteral<"fixed_calendar_date">;
2132
2132
  dueAt: z.ZodString;
2133
- }, z.core.$strip>]>;
2133
+ }, z.core.$strip>], "kind">;
2134
2134
  depositRefundability: z.ZodEnum<{
2135
2135
  refundable: "refundable";
2136
2136
  non_refundable: "non_refundable";
2137
2137
  }>;
2138
2138
  }, z.core.$strip>;
2139
- }, z.core.$strip>]>>;
2139
+ }, z.core.$strip>], "kind">>;
2140
2140
  }, z.core.$strip>;
2141
2141
  cancellationPolicy: z.ZodObject<{
2142
2142
  refunds: z.ZodObject<{
@@ -1,5 +1,5 @@
1
1
  import { type BlockButtonRole } from '../../constants/buttonRoles';
2
- import type { PublicMembershipProduct } from '../../blocks/shop.shared';
2
+ import { type PublicMembershipProduct } from '../../blocks/shop.shared';
3
3
  import type { PublicProduct } from '../../blocks/products/shared';
4
4
  import { type CartDisplay, type CheckoutDisplay, type PassesMembershipsDisplay, type ProductDetailDisplay, type ProductListDisplay } from './commerce/shared/display';
5
5
  import type { CommerceCartItem } from './shop-commerce.shared';
@@ -112,7 +112,14 @@ export declare const shopBlockRuntime: Readonly<{
112
112
  description: string | null;
113
113
  priceLabel: string;
114
114
  intervalLabel: string;
115
- actionLabel: string;
115
+ action: Readonly<{
116
+ kind: "purchase";
117
+ label: string;
118
+ product: import("../..").PurchasablePublicMembershipProduct;
119
+ }> | Readonly<{
120
+ kind: "unavailable";
121
+ label: string;
122
+ }>;
116
123
  }>[];
117
124
  }>;
118
125
  hydration: Readonly<{
@@ -161,7 +168,14 @@ export declare const shopBlockRuntime: Readonly<{
161
168
  description: string | null;
162
169
  priceLabel: string;
163
170
  intervalLabel: string;
164
- actionLabel: string;
171
+ action: Readonly<{
172
+ kind: "purchase";
173
+ label: string;
174
+ product: import("../..").PurchasablePublicMembershipProduct;
175
+ }> | Readonly<{
176
+ kind: "unavailable";
177
+ label: string;
178
+ }>;
165
179
  }>[];
166
180
  }>;
167
181
  hydration: Readonly<{
@@ -204,7 +218,14 @@ export declare const shopBlockRuntime: Readonly<{
204
218
  description: string | null;
205
219
  priceLabel: string;
206
220
  intervalLabel: string;
207
- actionLabel: string;
221
+ action: Readonly<{
222
+ kind: "purchase";
223
+ label: string;
224
+ product: import("../..").PurchasablePublicMembershipProduct;
225
+ }> | Readonly<{
226
+ kind: "unavailable";
227
+ label: string;
228
+ }>;
208
229
  }>[];
209
230
  }>;
210
231
  hydration: Readonly<{
@@ -565,7 +586,14 @@ export declare const shopInteractiveIslandPropsCodec: Readonly<{
565
586
  description: string | null;
566
587
  priceLabel: string;
567
588
  intervalLabel: string;
568
- actionLabel: string;
589
+ action: Readonly<{
590
+ kind: "purchase";
591
+ label: string;
592
+ product: import("../..").PurchasablePublicMembershipProduct;
593
+ }> | Readonly<{
594
+ kind: "unavailable";
595
+ label: string;
596
+ }>;
569
597
  }>[];
570
598
  }>;
571
599
  hydration: Readonly<{
@@ -618,7 +646,14 @@ export declare const shopInteractiveIslandPropsCodec: Readonly<{
618
646
  description: string | null;
619
647
  priceLabel: string;
620
648
  intervalLabel: string;
621
- actionLabel: string;
649
+ action: Readonly<{
650
+ kind: "purchase";
651
+ label: string;
652
+ product: import("../..").PurchasablePublicMembershipProduct;
653
+ }> | Readonly<{
654
+ kind: "unavailable";
655
+ label: string;
656
+ }>;
622
657
  }>[];
623
658
  }>;
624
659
  hydration: Readonly<{
@@ -1,5 +1,6 @@
1
+ import { type BookingPaymentCollectionOptionKind } from '../../../../../core/src/index';
1
2
  import type { BlockBookingPaymentCollectionOption, BlockBookingPaymentTerms } from '../../blocks/shared/bookingPaymentTerms';
2
- export type BookingPaymentSelectionKind = 'upfront' | 'deferred_manual' | 'instalment_plan' | 'flexible_balance';
3
+ export type BookingPaymentSelectionKind = BookingPaymentCollectionOptionKind;
3
4
  export type BookingPaymentOptionSummaryRow = Readonly<{
4
5
  label: string;
5
6
  value: string;
@@ -21,7 +22,6 @@ export type BookingPaymentSelectionViewModel = Readonly<{
21
22
  export declare function resolveBookingPaymentDueNowCents(input: Readonly<{
22
23
  option: BlockBookingPaymentCollectionOption;
23
24
  totalCents: number;
24
- bookingStartAt?: string | null;
25
25
  }>): number;
26
26
  export declare function buildBookingPaymentSelectionViewModel(input: Readonly<{
27
27
  serviceTitle: string;
@@ -29,5 +29,10 @@ export declare function buildBookingPaymentSelectionViewModel(input: Readonly<{
29
29
  priceAmount?: number | null;
30
30
  priceCurrency?: string | null;
31
31
  bookingStartAt?: string | null;
32
+ /**
33
+ * When the booking is being made, as an ISO timestamp. Instalment schedules
34
+ * start from here, the same anchor the server uses (the order's creation).
35
+ */
36
+ nowIso: string;
32
37
  locale?: string;
33
38
  }>): BookingPaymentSelectionViewModel;
@@ -0,0 +1,54 @@
1
+ import type { AttendeeId, CheckoutLineId, BookingFlexibleBalanceConfig, BookingInstalmentPlanConfig, EventSeriesId, OccurrenceId } from '../../../core/src/index';
2
+ /** Identity within one checkout; a cart line is a booking command before persistence. */
3
+ export type BookingPaymentAttendeeReference = Readonly<{
4
+ kind: 'persisted';
5
+ attendeeId: AttendeeId;
6
+ }> | Readonly<{
7
+ kind: 'checkout_command';
8
+ checkoutLineId: CheckoutLineId;
9
+ }>;
10
+ /**
11
+ * The booking a payment plan or flexible-balance contract collects for. A plan
12
+ * or contract may only cover checkout lines that belong to this booking.
13
+ */
14
+ export type BookingPaymentBookingReference = Readonly<{
15
+ kind: 'appointment';
16
+ serviceId: string;
17
+ resourceId: string;
18
+ startAt: string;
19
+ }> | Readonly<{
20
+ kind: 'event_ticket';
21
+ occurrenceId: OccurrenceId;
22
+ attendee: BookingPaymentAttendeeReference;
23
+ }> | Readonly<{
24
+ kind: 'event_series_registration';
25
+ eventSeriesId: EventSeriesId;
26
+ attendee: BookingPaymentAttendeeReference;
27
+ }>;
28
+ /**
29
+ * How one booking is paid for, resolved from its payment terms and the
30
+ * customer's choice. Appointments and attendee bookings share this shape.
31
+ *
32
+ * `not_required` is the £0 path: nothing is due, so no option was chosen.
33
+ * Plans and contracts carry the booking they collect for and when it starts.
34
+ */
35
+ export type BookingPaymentSelection = Readonly<{
36
+ kind: 'not_required';
37
+ }> | Readonly<{
38
+ kind: 'upfront' | 'deferred_manual';
39
+ }> | Readonly<{
40
+ kind: 'instalment_plan';
41
+ plan: BookingInstalmentPlanConfig;
42
+ booking: BookingPaymentBookingReference;
43
+ bookingStartAt: string;
44
+ }> | Readonly<{
45
+ kind: 'flexible_balance';
46
+ config: BookingFlexibleBalanceConfig;
47
+ booking: BookingPaymentBookingReference;
48
+ bookingStartAt: string;
49
+ }>;
50
+ export type BookingPlanOrContractSelection = Extract<BookingPaymentSelection, {
51
+ kind: 'instalment_plan' | 'flexible_balance';
52
+ }>;
53
+ export declare function isBookingPlanOrContractSelection(selection: BookingPaymentSelection): selection is BookingPlanOrContractSelection;
54
+ export declare function isSameBookingPaymentReference(left: BookingPaymentBookingReference, right: BookingPaymentBookingReference): boolean;
@@ -6,7 +6,7 @@ export type CheckoutCommitOrderRecord = Readonly<{
6
6
  reconciliationState: OrderCheckoutReconciliationState;
7
7
  }>;
8
8
  export type CheckoutCommitOrderItemRecord = Readonly<Pick<OrderItemPlanningRecord, 'kind' | 'commitState' | 'reconciliationState' | 'fulfilledAt' | 'cancelledAt' | 'customerMembershipId'>>;
9
- export type CheckoutCommitPlanStepKind = 'consume_credit_reservation' | 'provision_memberships' | 'fulfill_order_items' | 'redeem_discount' | 'record_order_payment';
9
+ export type CheckoutCommitPlanStepKind = 'consume_credit_reservation' | 'provision_memberships' | 'fulfill_order_items' | 'redeem_discount';
10
10
  export type NormalizedOrderCommitItem<TItem extends CheckoutCommitOrderItemRecord = CheckoutCommitOrderItemRecord> = Readonly<{
11
11
  item: TItem;
12
12
  commitState: OrderItemCommitState;
@@ -18,23 +18,68 @@ export type NormalizedOrderCommitSnapshot<TOrder extends CheckoutCommitOrderReco
18
18
  reconciliationState: OrderCheckoutReconciliationState;
19
19
  items: readonly NormalizedOrderCommitItem<TItem>[];
20
20
  }>;
21
- export type CheckoutCommitPlanStep = Readonly<{
22
- kind: CheckoutCommitPlanStepKind;
21
+ /** Bypass checkouts take no Stripe session, so nothing provisions memberships from one. */
22
+ export type BypassCheckoutCommitPlanStepKind = Exclude<CheckoutCommitPlanStepKind, 'provision_memberships'>;
23
+ export type CheckoutCommitPlanStep<TStep extends CheckoutCommitPlanStepKind = CheckoutCommitPlanStepKind> = Readonly<{
24
+ kind: TStep;
23
25
  }>;
24
- export type CheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord = CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord = CheckoutCommitOrderItemRecord> = Readonly<{
25
- paymentRail: CheckoutPaymentRail;
26
+ /** A bypass commit never records a payment: there is no cash to record. */
27
+ export type BypassCheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord = CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord = CheckoutCommitOrderItemRecord> = Readonly<{
28
+ paymentRail: Extract<CheckoutPaymentRail, 'bypass'>;
29
+ normalized: NormalizedOrderCommitSnapshot<TOrder, TItem>;
30
+ steps: readonly CheckoutCommitPlanStep<BypassCheckoutCommitPlanStepKind>[];
31
+ paymentRecord: Extract<CheckoutCommitPaymentRecord, 'not_needed'>;
32
+ }>;
33
+ export type StripeCheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord = CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord = CheckoutCommitOrderItemRecord> = Readonly<{
34
+ paymentRail: Extract<CheckoutPaymentRail, 'stripe'>;
26
35
  normalized: NormalizedOrderCommitSnapshot<TOrder, TItem>;
27
36
  steps: readonly CheckoutCommitPlanStep[];
37
+ paymentRecord: CheckoutCommitPaymentRecord;
28
38
  }>;
29
- export declare function normalizeOrderCommitSnapshot<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord>(input: {
30
- order: TOrder;
31
- items: readonly TItem[];
32
- }): NormalizedOrderCommitSnapshot<TOrder, TItem>;
33
- export declare function buildCheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord>(input: {
34
- paymentRail: CheckoutPaymentRail;
39
+ export type CheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord = CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord = CheckoutCommitOrderItemRecord> = BypassCheckoutCommitPlan<TOrder, TItem> | StripeCheckoutCommitPlan<TOrder, TItem>;
40
+ type CheckoutCommitPlanInputBase<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord> = Readonly<{
35
41
  order: TOrder;
36
42
  items: readonly TItem[];
37
43
  creditReservationState: ReservationFinalizationState;
38
44
  hasDiscountRedemption: boolean;
39
- paymentRecorded: boolean;
40
- }): CheckoutCommitPlan<TOrder, TItem>;
45
+ }>;
46
+ export type BypassCheckoutCommitPlanInput<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord> = CheckoutCommitPlanInputBase<TOrder, TItem> & Readonly<{
47
+ paymentRail: Extract<CheckoutPaymentRail, 'bypass'>;
48
+ }>;
49
+ export type StripeCheckoutCommitPlanInput<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord> = CheckoutCommitPlanInputBase<TOrder, TItem> & Readonly<{
50
+ paymentRail: Extract<CheckoutPaymentRail, 'stripe'>;
51
+ /**
52
+ * True when the commit has no payment of its own to record: the webhook
53
+ * recorded the session's receipt before the plan ran, or a subscription
54
+ * invoice owns the cash (its invoice.paid webhook records it).
55
+ */
56
+ paymentOwnedElsewhere: boolean;
57
+ }>;
58
+ /**
59
+ * Whether the commit records the order's payment once every step has
60
+ * completed. A Stripe checkout records here only when nothing else owns its
61
+ * payment (see `paymentOwnedElsewhere`): in practice a zero-total checkout,
62
+ * whose record completes the order without a cash receipt.
63
+ */
64
+ export type CheckoutCommitPaymentRecord = 'record_after_steps' | 'not_needed';
65
+ /**
66
+ * What a checkout commit has done so far that a failure has to undo. The two
67
+ * facts move independently: a resumed commit can start with fulfillment
68
+ * already committed and credit still held. `held` also covers a checkout
69
+ * with no credit reservation, since there is nothing consumed to refund.
70
+ */
71
+ export type CheckoutCommitProgress = Readonly<{
72
+ credit: 'held' | 'consumed';
73
+ fulfillment: Extract<CheckoutCommitState, 'pending' | 'committed'>;
74
+ }>;
75
+ /** Progress before the first step: items an earlier run committed count as fulfilled. */
76
+ export declare function initialCheckoutCommitProgress(normalized: Pick<NormalizedOrderCommitSnapshot, 'items'>): CheckoutCommitProgress;
77
+ /** Progress after `step` completes. */
78
+ export declare function advanceCheckoutCommitProgress(progress: CheckoutCommitProgress, step: CheckoutCommitPlanStepKind): CheckoutCommitProgress;
79
+ export declare function normalizeOrderCommitSnapshot<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord>(input: {
80
+ order: TOrder;
81
+ items: readonly TItem[];
82
+ }): NormalizedOrderCommitSnapshot<TOrder, TItem>;
83
+ export declare function buildCheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord>(input: BypassCheckoutCommitPlanInput<TOrder, TItem>): BypassCheckoutCommitPlan<TOrder, TItem>;
84
+ export declare function buildCheckoutCommitPlan<TOrder extends CheckoutCommitOrderRecord, TItem extends CheckoutCommitOrderItemRecord>(input: StripeCheckoutCommitPlanInput<TOrder, TItem>): StripeCheckoutCommitPlan<TOrder, TItem>;
85
+ export {};
@@ -1 +1 @@
1
- export type CheckoutErrorCode = "appointment_not_found" | "appointment_slot_unavailable" | "appointment_payment_terms_not_supported" | "booking_payment_terms_not_supported" | "checkout_amount_below_minimum" | "sliding_amount_required" | "sliding_amount_invalid" | "sliding_amount_below_min" | "sliding_amount_above_max" | "not_found" | "site_mismatch" | "registration_disabled" | "invalid_payment_method" | "payment_already_completed" | "invalid_payment_status" | "no_event_association" | "payment_not_required" | "customer_not_found" | "stripe_not_configured" | "stripe_commission_not_supported" | "stripe_tax_not_ready" | "stripe_tax_status_unavailable" | "whole_series_pricing_option_not_available" | "product_not_available" | "product_not_eligible" | "insufficient_credits" | "invalid_discount_code" | "unsupported_discount_scope" | "checkout_in_progress" | "stripe_error" | "internal_error";
1
+ export type CheckoutErrorCode = "appointment_not_found" | "appointment_slot_unavailable" | "booking_payment_terms_not_supported" | "checkout_amount_below_minimum" | "sliding_amount_required" | "sliding_amount_invalid" | "sliding_amount_below_min" | "sliding_amount_above_max" | "not_found" | "site_mismatch" | "registration_disabled" | "invalid_payment_method" | "payment_already_completed" | "invalid_payment_status" | "no_event_association" | "payment_not_required" | "customer_not_found" | "stripe_not_configured" | "stripe_commission_not_supported" | "stripe_tax_not_ready" | "stripe_tax_status_unavailable" | "whole_series_pricing_option_not_available" | "product_not_available" | "product_not_eligible" | "insufficient_credits" | "invalid_discount_code" | "unsupported_discount_scope" | "checkout_in_progress" | "stripe_error" | "internal_error";
@@ -1,30 +1,25 @@
1
- import { type BookingFlexibleBalanceConfig } from '../../../core/src/index';
2
- export type CheckoutStripeRequiredPaymentObligation<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig> = Readonly<{
1
+ import { type BookingFlexibleBalanceConfig, type BookingInstalmentPlanConfig } from '../../../core/src/index';
2
+ import type { BookingPaymentSelection } from './bookingPaymentSelection';
3
+ /**
4
+ * What a paid checkout has to collect, given its payment selection. Paying in
5
+ * full, having nothing due and not choosing at all are all collected as one
6
+ * card payment; the free and credit-covered cases bypass before this matters.
7
+ */
8
+ export type CheckoutPaymentObligation = Readonly<{
3
9
  kind: 'stripe';
10
+ }> | Readonly<{
11
+ kind: 'deferred_manual';
4
12
  }> | Readonly<{
5
13
  kind: 'instalment_plan';
6
- planDefinition: TInstalmentPlan;
14
+ planDefinition: BookingInstalmentPlanConfig;
7
15
  }> | Readonly<{
8
16
  kind: 'flexible_balance';
9
- config: TFlexibleBalanceConfig;
10
- initialPaymentCents: number;
17
+ config: BookingFlexibleBalanceConfig;
18
+ configuredPaymentDueNowCents: number;
11
19
  bookingStartAt: string;
12
20
  dueAt: string;
13
21
  }>;
14
- export type CheckoutStripeRequiredPaymentTerms<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig> = Readonly<{
15
- kind: 'standard';
16
- }> | Readonly<{
17
- kind: 'instalment_plan';
18
- planDefinition: TInstalmentPlan;
19
- }> | Readonly<{
20
- kind: 'flexible_balance';
21
- selection: Readonly<{
22
- config: TFlexibleBalanceConfig;
23
- bookingStartAt: string;
24
- dueAt: string;
25
- }>;
26
- }>;
27
- export declare function planStripeRequiredCheckoutPaymentObligation<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig>(input: Readonly<{
22
+ export declare function planCheckoutPaymentObligation(input: Readonly<{
28
23
  totalAfterDiscountCents: number;
29
- paymentTerms?: CheckoutStripeRequiredPaymentTerms<TInstalmentPlan, TFlexibleBalanceConfig>;
30
- }>): CheckoutStripeRequiredPaymentObligation<TInstalmentPlan, TFlexibleBalanceConfig>;
24
+ paymentSelection: BookingPaymentSelection;
25
+ }>): CheckoutPaymentObligation;
@@ -1,53 +1,36 @@
1
- import { type BookingFlexibleBalanceConfig } from '../../../core/src/index';
2
- import { type Result } from '../../../core/src/index';
3
- export type CheckoutPaymentTermCollectionOptionKind = 'upfront' | 'deferred_manual' | 'instalment_plan' | 'flexible_balance';
1
+ import { type BookingPaymentCollectionOptionKind, type Result } from '../../../core/src/index';
2
+ import { type BookingPaymentSelection } from './bookingPaymentSelection';
3
+ export type CheckoutPaymentTermCollectionOptionKind = BookingPaymentCollectionOptionKind;
4
4
  export type CheckoutPaymentTermsError = Readonly<{
5
5
  _tag: 'instalment_plan_not_supported';
6
6
  }> | Readonly<{
7
7
  _tag: 'flexible_balance_empty_cart';
8
- }> | Readonly<{
9
- _tag: 'flexible_balance_requires_single_item';
10
8
  }> | Readonly<{
11
9
  _tag: 'flexible_balance_not_supported';
12
10
  }>;
13
- export type CheckoutAppointmentPaymentTermSelection<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig> = Readonly<{
14
- kind: 'upfront' | 'deferred_manual';
15
- }> | Readonly<{
16
- kind: 'instalment_plan';
17
- plan: TInstalmentPlan;
18
- }> | Readonly<{
19
- kind: 'flexible_balance';
20
- config: TFlexibleBalanceConfig;
21
- }> | null;
22
- export type CheckoutAttendeeBookingPaymentTermSelection<TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig> = Readonly<{
23
- kind: 'upfront' | 'deferred_manual';
24
- }> | Readonly<{
25
- kind: 'flexible_balance';
26
- config: TFlexibleBalanceConfig;
27
- }> | null;
28
- export type CheckoutPaymentTermLine<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig> = Readonly<{
29
- kind: 'appointment';
30
- bookingStartAt: string;
31
- selectedCollectionOption: CheckoutAppointmentPaymentTermSelection<TInstalmentPlan, TFlexibleBalanceConfig>;
32
- }> | Readonly<{
33
- kind: 'attendee_booking';
34
- bookingStartAt?: string | null;
35
- selectedCollectionOption: CheckoutAttendeeBookingPaymentTermSelection<TFlexibleBalanceConfig>;
11
+ /**
12
+ * A checkout line as payment terms see it. Bookings carry the selection their
13
+ * own terms resolved to; products and passes carry none.
14
+ */
15
+ export type CheckoutPaymentTermLine = Readonly<{
16
+ kind: 'booking';
17
+ selection: BookingPaymentSelection;
36
18
  }> | Readonly<{
37
19
  kind: 'other';
38
20
  }>;
39
- export type CheckoutFlexibleBalanceSelection<TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig> = Readonly<{
40
- config: TFlexibleBalanceConfig;
41
- bookingStartAt: string;
42
- dueAt: string;
43
- }>;
44
- export type CheckoutPaymentTerms<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig> = Readonly<{
45
- instalmentPlanDefinition: TInstalmentPlan | null;
46
- flexibleBalanceSelection: CheckoutFlexibleBalanceSelection<TFlexibleBalanceConfig> | null;
47
- }>;
48
- type CheckoutPaymentTermsInput<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig> = Readonly<{
21
+ type CheckoutPaymentTermsInput = Readonly<{
49
22
  requestedCollectionOptionKind?: CheckoutPaymentTermCollectionOptionKind;
50
- items: readonly CheckoutPaymentTermLine<TInstalmentPlan, TFlexibleBalanceConfig>[];
23
+ items: readonly CheckoutPaymentTermLine[];
51
24
  }>;
52
- export declare function resolveCheckoutPaymentTerms<TInstalmentPlan, TFlexibleBalanceConfig extends BookingFlexibleBalanceConfig = BookingFlexibleBalanceConfig>(input: CheckoutPaymentTermsInput<TInstalmentPlan, TFlexibleBalanceConfig>): Result<CheckoutPaymentTerms<TInstalmentPlan, TFlexibleBalanceConfig>, CheckoutPaymentTermsError>;
25
+ /**
26
+ * Resolves the one payment selection the whole checkout is paid with.
27
+ *
28
+ * A plan or contract only applies when the customer asked for it, and every
29
+ * line has to belong to the booking it collects for. Without a request the
30
+ * checkout pays whatever is due in full, even when a line's terms offered only
31
+ * a plan: that auto-selection stays on the line and isn't applied here.
32
+ */
33
+ export declare function resolveCheckoutPaymentTerms(input: CheckoutPaymentTermsInput): Result<BookingPaymentSelection, CheckoutPaymentTermsError>;
34
+ /** Checks an already resolved selection without choosing the payment option again. */
35
+ export declare function validateCheckoutPaymentSelection(selection: BookingPaymentSelection, items: readonly CheckoutPaymentTermLine[]): Result<BookingPaymentSelection, CheckoutPaymentTermsError>;
53
36
  export {};
@@ -17,7 +17,7 @@ export declare const OrderCheckoutSessionMetadataSchema: z.ZodUnion<readonly [z.
17
17
  type: z.ZodLiteral<"order">;
18
18
  site_id: z.ZodString;
19
19
  order_id: z.ZodOptional<z.ZodString>;
20
- customer_email: z.ZodString;
20
+ customer_email: z.ZodOptional<z.ZodString>;
21
21
  customer_name: z.ZodOptional<z.ZodString>;
22
22
  product_id: z.ZodOptional<z.ZodString>;
23
23
  attendee_id: z.ZodOptional<z.ZodString>;
@@ -48,7 +48,7 @@ export declare const OrderCheckoutSessionMetadataSchema: z.ZodUnion<readonly [z.
48
48
  type: z.ZodLiteral<"order">;
49
49
  site_id: z.ZodString;
50
50
  order_id: z.ZodOptional<z.ZodString>;
51
- customer_email: z.ZodString;
51
+ customer_email: z.ZodOptional<z.ZodString>;
52
52
  customer_name: z.ZodOptional<z.ZodString>;
53
53
  product_id: z.ZodOptional<z.ZodString>;
54
54
  attendee_id: z.ZodOptional<z.ZodString>;