@riverbankcms/sdk 0.165.0 → 0.166.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 (241) hide show
  1. package/dist/_dts/{BlocksIslandsHydrator-CdsSMQEv.d.ts → BlocksIslandsHydrator-CPvN6RBW.d.ts} +1 -1
  2. package/dist/_dts/{Page-D6gp2Ipb.d.ts → Page-rW0xgQCA.d.ts} +18 -256
  3. package/dist/_dts/{SdkPreviewMode-DNXAvnet.d.ts → SdkPreviewMode-BWZh2WCk.d.ts} +26 -3
  4. package/dist/_dts/{client-BkkExozE.d.ts → client-D4BXQEZc.d.ts} +5 -1
  5. package/dist/_dts/{content-types-CXNAD7ef.d.ts → content-types-MUzta0l9.d.ts} +3 -3
  6. package/dist/_dts/{contracts-XRXhbLWP.d.ts → contracts-Cl9Xh1DO.d.ts} +4 -4
  7. package/dist/_dts/{footerPageOutline-BP2bJYdY.d.ts → footerPageOutline-4BgLKehl.d.ts} +6 -6
  8. package/dist/_dts/{generatePageMetadata-DcMtbztV.d.ts → generatePageMetadata-BsmJ0qKh.d.ts} +2 -2
  9. package/dist/_dts/{index-RXkE3a7M.d.ts → index--qflsCiy.d.ts} +4 -3
  10. package/dist/_dts/{index-C_3kdrUb.d.ts → index-BgJ2aU5c.d.ts} +2 -2
  11. package/dist/_dts/{index-CQfJhOEA.d.ts → index-Bmboeb49.d.ts} +1 -1
  12. package/dist/_dts/{index-CRRiddNp.d.ts → index-DdcwPqQN.d.ts} +4 -4
  13. package/dist/_dts/{index-DKNEgSOS.d.ts → index-ahxQCUc7.d.ts} +2 -2
  14. package/dist/_dts/{index-BdkHhyf8.d.ts → index-kQ5xkM6X.d.ts} +1 -1
  15. package/dist/_dts/{index-DAPTSmBM.d.ts → index-mMMvLLAJ.d.ts} +2596 -2511
  16. package/dist/_dts/{index-B4ozSzFP.d.ts → index-wbBZ0awa.d.ts} +9248 -8251
  17. package/dist/_dts/{loadContent-B9vJMq3s.d.ts → loadContent-BG5IAV-V.d.ts} +9 -6
  18. package/dist/_dts/resolveBlockData-Cmcle_zV.d.ts +136 -0
  19. package/dist/_dts/{resolvePageContent-DIQyYUi-.d.ts → resolvePageContent-BRJUTFoH.d.ts} +3 -2
  20. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -2
  21. package/dist/_dts/sdk/src/client/types.d.ts +2 -2
  22. package/dist/_dts/sdk/src/client.d.ts +9 -6
  23. package/dist/_dts/sdk/src/config/index.d.ts +6 -6
  24. package/dist/_dts/sdk/src/config/template-validation.d.ts +1 -1
  25. package/dist/_dts/sdk/src/config/validation.d.ts +1 -1
  26. package/dist/_dts/sdk/src/data/dataLoaderContext.d.ts +20 -0
  27. package/dist/_dts/sdk/src/data/resolveBlockData.d.ts +2 -0
  28. package/dist/_dts/sdk/src/data/types.d.ts +54 -0
  29. package/dist/_dts/sdk/src/index.d.ts +8 -8
  30. package/dist/_dts/sdk/src/manifest/index.d.ts +3 -3
  31. package/dist/_dts/sdk/src/metadata/index.d.ts +1 -1
  32. package/dist/_dts/sdk/src/navigation/index.d.ts +2 -2
  33. package/dist/_dts/sdk/src/next/index.d.ts +9 -8
  34. package/dist/_dts/sdk/src/next/middleware.d.ts +2 -2
  35. package/dist/_dts/sdk/src/page-converter/index.d.ts +36 -48
  36. package/dist/_dts/sdk/src/portal/client.d.ts +1 -1
  37. package/dist/_dts/sdk/src/prebuild/index.d.ts +1 -1
  38. package/dist/_dts/sdk/src/preview-next/before-render.d.ts +2 -2
  39. package/dist/_dts/sdk/src/preview-next/client/index.d.ts +2 -2
  40. package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
  41. package/dist/_dts/sdk/src/rendering/client.d.ts +2 -2
  42. package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +2 -0
  43. package/dist/_dts/sdk/src/rendering/helpers/loadPage.d.ts +3 -0
  44. package/dist/_dts/sdk/src/rendering/helpers/pageRuntimeSupport.d.ts +257 -0
  45. package/dist/_dts/sdk/src/rendering/index.d.ts +8 -7
  46. package/dist/_dts/sdk/src/rendering/islands/client.d.ts +1 -1
  47. package/dist/_dts/sdk/src/rendering/server.d.ts +3 -3
  48. package/dist/_dts/{themeAdmission-D_qtGYAT.d.ts → sdk/src/rendering/themeAdmission.d.ts} +3 -1
  49. package/dist/_dts/sdk/src/routing/index.d.ts +5 -5
  50. package/dist/_dts/sdk/src/server.d.ts +7 -5
  51. package/dist/_dts/sdk/src/spam-protection/index.d.ts +2 -2
  52. package/dist/_dts/sdk/src/theme/index.d.ts +1 -1
  53. package/dist/_dts/{types-Cl0nP6al.d.ts → types-BX3Y-EW3.d.ts} +3 -3
  54. package/dist/_dts/{types-mstFvhK4.d.ts → types-DF54stxv.d.ts} +8 -7
  55. package/dist/_dts/{types-BDF73NzM.d.ts → types-DuiHLiPo.d.ts} +2 -2
  56. package/dist/_dts/{validation-DVWqSvjK.d.ts → validation-Bxi0f81D.d.ts} +4 -4
  57. package/dist/client/{BlocksIslandsHydrator-CzKpH9Pm.mjs → BlocksIslandsHydrator-DwiRGtgh.mjs} +31 -24
  58. package/dist/client/{BookingMailingListNote-rUqsBN7L.mjs → BookingMailingListNote-DOWOZYlK.mjs} +2 -2
  59. package/dist/client/{CalendarNavigationChevron-YGzw2IPB.mjs → CalendarNavigationChevron-5a0x0vcC.mjs} +7 -7
  60. package/dist/client/{CheckboxChoice-DlTC4J2a.mjs → CheckboxChoice-CZ-anOqV.mjs} +1 -1
  61. package/dist/client/{DemoBookingPortalAccess-D2LyS_Bi.mjs → DemoBookingPortalAccess-B2qLkPRB.mjs} +6 -6
  62. package/dist/client/{DemoPortalSignInLink-BaFg2Uit.mjs → DemoPortalSignInLink-B9YrzZt2.mjs} +1 -1
  63. package/dist/client/{EventCalendar.client-tRrhPscX.mjs → EventCalendar.client-BhADnDCg.mjs} +9 -9
  64. package/dist/client/{EventCombined.client-6cfAVtnZ.mjs → EventCombined.client-jik34zTb.mjs} +8 -8
  65. package/dist/client/{EventEmbeddedCheckoutStep-CDNUpI0S.mjs → EventEmbeddedCheckoutStep-D_14yqAU.mjs} +27 -2
  66. package/dist/client/{EventItem-dILw2PN_.mjs → EventItem-CMKrtkT7.mjs} +26 -11
  67. package/dist/client/{EventListWeekNavigation-ClgLtjNY.mjs → EventListWeekNavigation-AGHjxy6C.mjs} +1 -1
  68. package/dist/client/{EventListing.client-BNueAHmU.mjs → EventListing.client-DZeDM0Qt.mjs} +3 -3
  69. package/dist/client/{EventListing.view-DtVbKVkt.mjs → EventListing.view-3BBRdNVa.mjs} +31 -20
  70. package/dist/client/{EventRegistrationPayment-CzkG0NSJ.mjs → EventRegistrationPayment-CpNcpga4.mjs} +108 -11
  71. package/dist/client/{LocationMapActions-zWQsJhE5.mjs → LocationMapActions-D5-H9ooQ.mjs} +2 -2
  72. package/dist/client/{MapDrawingSvg-D1AO_o4h.mjs → MapDrawingSvg-C30geMl-.mjs} +1 -1
  73. package/dist/client/{Page-DUr2YhFR.mjs → Page-DNDZLRlB.mjs} +1894 -11322
  74. package/dist/client/{ProtectedSubmitButton-2fJqT_NR.mjs → ProtectedSubmitButton-8DuDw2ag.mjs} +1 -1
  75. package/dist/client/{StepIndicator-udNHcpOT.mjs → StepIndicator-Bin7YR0A.mjs} +3 -3
  76. package/dist/client/{TabBarFragment-C_kt-PXh.mjs → TabBarFragment-_IAthZVM.mjs} +1 -1
  77. package/dist/client/{ThemedButton-Cfbo1bfh.mjs → ThemedButton-8jUc02mZ.mjs} +64 -2
  78. package/dist/client/{accordion-3CYNWzTS.mjs → accordion-uVqNowRX.mjs} +1 -1
  79. package/dist/client/{booking-form.client-BSbWgLyx.mjs → booking-form.client-w-PvyWBv.mjs} +19 -14
  80. package/dist/client/{bookingForm-2MoFBWSt.mjs → bookingForm-DNMojb6A.mjs} +4 -4
  81. package/dist/client/bookings.mjs +6 -6
  82. package/dist/client/{carousel-Cu5mcpO-.mjs → carousel-C8kxI3Dm.mjs} +2 -2
  83. package/dist/client/{carousel.client-CQLV8_Al.mjs → carousel.client-BO7sCEpH.mjs} +1 -1
  84. package/dist/client/{cart-CDc6x9cR.mjs → cart-DCxjE3Is.mjs} +3 -3
  85. package/dist/client/{cart.client-BWS2r5Ef.mjs → cart.client-Ceeng8fB.mjs} +1 -1
  86. package/dist/client/{checkout-CkxPqSwD.mjs → checkout-B0EKbeVv.mjs} +3 -3
  87. package/dist/client/{checkout.client-DJfomKQc.mjs → checkout.client-DtPj3fYk.mjs} +1 -1
  88. package/dist/client/client.mjs +9465 -15
  89. package/dist/client/{context-CBV21-9L.mjs → context-n6IZigd3.mjs} +8 -6
  90. package/dist/client/{cta-Bw-al3cs.mjs → cta-CDeAwYoN.mjs} +45 -28
  91. package/dist/client/{dateFormatting-CFIUJ4Uf.mjs → dateFormatting-BWPzdeZE.mjs} +1 -1
  92. package/dist/client/{demoPortalMagicLink-D0veHJyi.mjs → demoPortalMagicLink-BdXu0fj-.mjs} +1 -1
  93. package/dist/client/{enhanceHeaderSection-CEqqq92r.mjs → enhanceHeaderSection-VHfv8M6-.mjs} +3 -3
  94. package/dist/client/{event-details.client-Bk2kQ7ax.mjs → event-details.client-Cfr1_Cj4.mjs} +2 -2
  95. package/dist/client/{event-registration.client-QMqtIywj.mjs → event-registration.client-BhygihpQ.mjs} +33 -16
  96. package/dist/client/{eventCalendar-BTDTMosr.mjs → eventCalendar-B4XCL9u6.mjs} +4 -4
  97. package/dist/client/{eventCombined-BC7a709c.mjs → eventCombined-DVjz4wdf.mjs} +4 -4
  98. package/dist/client/{eventDetails-DL08GpUc.mjs → eventDetails-B0DA1Nw1.mjs} +2 -2
  99. package/dist/client/{eventListing-BfzuEQp_.mjs → eventListing-2-xjn2nz.mjs} +4 -4
  100. package/dist/client/{eventRegistration-Lfyzh1Ab.mjs → eventRegistration-ng4iGo9O.mjs} +4 -4
  101. package/dist/client/{form-L-xZOBUS.mjs → form-BeNQiZ2V.mjs} +3 -3
  102. package/dist/client/{form.client-BtpK3TZW.mjs → form.client-BFdCKlp7.mjs} +5 -5
  103. package/dist/client/{form.parts-Djos5Un4.mjs → form.parts-C7gLK3jh.mjs} +3 -3
  104. package/dist/client/{formatDate-DGmrm7YB.mjs → formatDate-CWfelfMt.mjs} +1 -1
  105. package/dist/client/gifting/client.mjs +3 -4
  106. package/dist/client/{headerSection-f16OGkz-.mjs → headerSection-CalNAShx.mjs} +2 -2
  107. package/dist/client/{mediaAssets-DHAmrVIi.mjs → mediaAssets-DpPauppt.mjs} +1 -1
  108. package/dist/client/{mediaContext-CwT6ZOm7.mjs → mediaContext-BLo4NtjP.mjs} +25 -19
  109. package/dist/client/{newsletter-form.client-DpHNZc7k.mjs → newsletter-form.client-Dq7GHGXU.mjs} +6 -6
  110. package/dist/client/{newsletter-form.parts-CLGH20PL.mjs → newsletter-form.parts-BSMDYQiS.mjs} +2 -2
  111. package/dist/client/{newsletterForm-BEU0Ocu9.mjs → newsletterForm-snzZ4L6i.mjs} +3 -3
  112. package/dist/client/{noop-CQU7tiMg.mjs → noop-D-RG9eR3.mjs} +394 -168
  113. package/dist/client/portal/client.mjs +13 -14
  114. package/dist/client/{product-detail.client-Be-om1BT.mjs → product-detail.client-Gu0INDb7.mjs} +1 -1
  115. package/dist/client/{product-list.client-DR7hD5Vs.mjs → product-list.client-BmH40fNf.mjs} +1 -1
  116. package/dist/client/{productDetail-BD42UOmG.mjs → productDetail-DsPUmJ0z.mjs} +3 -3
  117. package/dist/client/{productList-CSk8sXCl.mjs → productList-DjGrjOwD.mjs} +3 -3
  118. package/dist/client/{propsDecoder-C_Y6VYnF.mjs → propsDecoder-kTVPMnfD.mjs} +4 -4
  119. package/dist/client/{registry.server-CIKtTsCl.mjs → registry.server-CKK_RXZo.mjs} +213 -314
  120. package/dist/client/rendering/client.mjs +29 -28
  121. package/dist/client/rendering/islands.mjs +1 -1
  122. package/dist/client/rendering.mjs +70 -8
  123. package/dist/client/{richText-coerce-spWtx86G.mjs → richText-coerce-BcjTX-7h.mjs} +1 -1
  124. package/dist/client/{routeIslandApiConfig-CROHPlYS.mjs → routeIslandApiConfig-CaXesATK.mjs} +1 -1
  125. package/dist/client/{shop-DscvMz86.mjs → shop-DLufMauE.mjs} +3 -3
  126. package/dist/client/{shop-commerce-CDUohm_2.mjs → shop-commerce-BxYYXLNK.mjs} +12 -12
  127. package/dist/client/{shop-commerce-store-B9nw4lRP.mjs → shop-commerce-store-Dp3Nl5YK.mjs} +1 -1
  128. package/dist/client/{shop.client-M3kNsVPi.mjs → shop.client-CBy9_alG.mjs} +13 -13
  129. package/dist/client/{shop.interactive-BGmkdIAZ.mjs → shop.interactive-BM0NRsFQ.mjs} +48 -34
  130. package/dist/client/{shopShared-BdWp6LHa.mjs → shopShared-lS23OQE-.mjs} +2 -2
  131. package/dist/client/site-styles-D8jEPGxA.mjs +3 -0
  132. package/dist/{preview-next/client/ThemedButton-Dc6aJ34Z.mjs → client/site-styles-DELkUk9s.mjs} +25468 -17264
  133. package/dist/client/spam-protection.mjs +1 -1
  134. package/dist/client/src-DjnxOjXG.mjs +217 -0
  135. package/dist/client/surfaceTransportMarker-BXepAVF6.mjs +152 -0
  136. package/dist/client/{timetableModel-Dynh5-j4.mjs → timetableModel-DzRWikCU.mjs} +157 -139
  137. package/dist/client/types-sF-IrGQr.mjs +633 -0
  138. package/dist/client/{useAvailableSlots-Cw9paRPY.mjs → useAvailableSlots-C3LphWDX.mjs} +8 -5
  139. package/dist/client/{useBookingNowIso-C9SF2rC6.mjs → useBookingNowIso-Da-f9iHw.mjs} +1 -1
  140. package/dist/client/{useDiscountApply-B-QJfBg0.mjs → useDiscountApply-SLoWhcen.mjs} +3 -3
  141. package/dist/client/{useDiscountCodeUi-Uvum8q9d.mjs → useDiscountCodeUi-D6a2BJij.mjs} +1 -1
  142. package/dist/client/{useEventPagination-BfM3xk6j.mjs → useEventPagination-Ccr4TZlm.mjs} +9 -9
  143. package/dist/client/{view-DXOuduIr.mjs → view-8w4GA8rf.mjs} +4 -4
  144. package/dist/client/{view-DlkCDfuN.mjs → view-DAVEoe8A.mjs} +277 -227
  145. package/dist/client/{wizardSteps-DManVJpc.mjs → wizardSteps-DNpajrAH.mjs} +453 -141
  146. package/dist/preview-next/before-render.mjs +3 -140
  147. package/dist/preview-next/client/ArrangementLookControls-DY5TzhEa.mjs +31197 -0
  148. package/dist/preview-next/client/{EventEmbeddedCheckoutStep-Die6Y25O.mjs → EventEmbeddedCheckoutStep-C_h1cMYm.mjs} +33 -4
  149. package/dist/preview-next/client/{LocationPickerEnvironment-Bp4BHLCL.mjs → LocationPickerEnvironment-D56RD3e_.mjs} +1 -1
  150. package/dist/preview-next/client/{MapLibreEditMap-Cb0JhM9p.mjs → MapLibreEditMap-DFnyCckr.mjs} +2 -2
  151. package/dist/preview-next/client/PreviewEditorSidebar-DdnhmdFO.mjs +37049 -0
  152. package/dist/preview-next/client/{PreviewEditorUI-CxwlLBGw.mjs → PreviewEditorUI-C7ZmYE33.mjs} +45 -17
  153. package/dist/preview-next/client/PreviewShell-DnO38NaL.mjs +4707 -0
  154. package/dist/preview-next/client/SdkPreviewModeRuntime-D2OtoRMB.mjs +4258 -0
  155. package/dist/preview-next/client/SiteChromeCustomizeButton-eIu2RejJ.mjs +71144 -0
  156. package/dist/preview-next/client/ThemedButton-C0dgGJ5k.mjs +2006 -0
  157. package/dist/preview-next/client/{lucide-react-CqxuVAyz.mjs → lucide-react-CPBCf6QT.mjs} +15 -2
  158. package/dist/preview-next/client/previewAssistantSlot-Bp1AlAxx.mjs +110560 -0
  159. package/dist/preview-next/client/{previewChromeSurface-yuwnDP3B.mjs → previewChromeSurface-D2cREDJ5.mjs} +90 -28
  160. package/dist/preview-next/client/runtime.mjs +3 -3
  161. package/dist/preview-next/client/sdk-runtime-DK0PUhLL.mjs +5 -0
  162. package/dist/preview-next/client/{editorStatusDecision-DR4BBKhy.mjs → useAutosaveStatus--Pw8vnef.mjs} +40 -3
  163. package/dist/preview-next/client/useBlockCustomizeControls-C1Rl73N4.mjs +2724 -0
  164. package/dist/preview-next/client/useOpenBlockForSetup-CL3842FM.mjs +28 -0
  165. package/dist/preview-next/keepAlive.mjs +25 -2
  166. package/dist/preview-next/middleware.mjs +1 -1
  167. package/dist/preview-next/{route-contract-BBAJjFIz.mjs → route-contract-Bq7SUX3K.mjs} +132 -118
  168. package/dist/server/{Block.shared-ClFI3qpX.mjs → Block.shared-wXr7Iwhs.mjs} +7 -4
  169. package/dist/server/{src-DsYPhTbs.mjs → ThemeScopeCore-BI2mld9R.mjs} +178 -2532
  170. package/dist/server/accessibleSurfaces-CuN8U_iU.mjs +2102 -0
  171. package/dist/server/{bindings-Bi8EoRZD.mjs → bindings-DjdUq9FR.mjs} +2 -3
  172. package/dist/server/{publicProducts-Bz8loTRn.mjs → client-07UeMDzA.mjs} +2483 -351
  173. package/dist/server/config-validation.mjs +1 -1
  174. package/dist/server/config.mjs +33 -2
  175. package/dist/server/data/dataLoaderContext.mjs +2 -0
  176. package/dist/server/data/resolveBlockData.mjs +2 -0
  177. package/dist/server/data/types.mjs +1 -0
  178. package/dist/server/dataLoaderContext-B3fXA54R.mjs +47 -0
  179. package/dist/server/identity-Bn9OQiT1.mjs +6 -0
  180. package/dist/server/index.mjs +3 -3
  181. package/dist/server/{loadContent-dEEhQxL7.mjs → loadContent-ClpaSlBb.mjs} +6 -5
  182. package/dist/server/{loadPage-DBFBad8A.mjs → loadPage-BwtVqpaA.mjs} +4 -2
  183. package/dist/server/manifest.mjs +1 -1
  184. package/dist/server/media-DnlczCMA.mjs +231 -0
  185. package/dist/server/mode-Cv_TG9gP.mjs +63 -0
  186. package/dist/server/next.mjs +11 -11
  187. package/dist/server/opaqueSurface-3YSDPtDe.mjs +54 -0
  188. package/dist/server/{overrideResolution-BIJbiXYc.mjs → overrideResolution-Du_w3LY4.mjs} +2 -1
  189. package/dist/server/overrides-CD4d-1w7.mjs +177 -0
  190. package/dist/server/page-converter.mjs +243 -91
  191. package/dist/server/pageRenderPlan-BShULdc2.mjs +4055 -0
  192. package/dist/server/{themeAdmission-CSknYpxk.mjs → pageRuntimeSupport-C4Dh5-mB.mjs} +13 -28
  193. package/dist/server/{overrides-DhF87Vsd.mjs → pageShared-HdKFBpaX.mjs} +3472 -1795
  194. package/dist/server/parseThemeForPersistence-CJMrEkze.mjs +52 -0
  195. package/dist/server/{prebuild-DaemmWQL.mjs → prebuild-Cl-bkaMA.mjs} +1 -1
  196. package/dist/server/prebuild.mjs +1 -1
  197. package/dist/server/prefetchBlockData-C4yUmz-r.mjs +786 -0
  198. package/dist/server/publicProducts-W9hDRwjz.mjs +64 -0
  199. package/dist/server/{registry-Cdvz1OtL.mjs → registry-TFPJdGQi.mjs} +20624 -640
  200. package/dist/server/rendering/components/pageShared.mjs +2 -0
  201. package/dist/server/rendering/helpers/loadPage.mjs +2 -0
  202. package/dist/server/rendering/helpers/pageRuntimeSupport.mjs +2 -0
  203. package/dist/server/rendering/server.mjs +5 -4
  204. package/dist/server/rendering/themeAdmission.mjs +2 -0
  205. package/dist/server/rendering.mjs +11 -10
  206. package/dist/server/repeaterFields-MIz7r1ez.mjs +9 -0
  207. package/dist/server/{resolveBlockData-CLpAJWWf.mjs → resolveBlockData-OHlOXlOE.mjs} +6 -48
  208. package/dist/server/resolveButtonColourStates-lry2ORwX.mjs +2672 -0
  209. package/dist/server/{richTextSchema-YYc85FX4.mjs → richTextSchema-Euhuj-7V.mjs} +26 -1
  210. package/dist/server/routing.mjs +1 -1
  211. package/dist/server/schema-C2PqHrMo.mjs +2523 -0
  212. package/dist/server/server.mjs +3 -3
  213. package/dist/server/theme-bridge.mjs +1031 -1
  214. package/dist/server/theme.mjs +2 -1
  215. package/dist/server/themeAdmission-DGSAlFUK.mjs +18 -0
  216. package/dist/server/{three-pass-converter-Chnb1XD-.mjs → three-pass-converter-_j2UE2tR.mjs} +1 -1
  217. package/dist/server/validation-CDd6m8Ry.mjs +140 -0
  218. package/dist/server/{validation-DYxhLzqQ.mjs → validation-DIBFZeMB.mjs} +419 -3
  219. package/dist/server/{version-Beu4q-Gv.mjs → version-DZWZM1H6.mjs} +1 -1
  220. package/dist/styles/index.css +14 -4
  221. package/package.json +39 -1
  222. package/dist/client/purchase-BV5xfaZH.mjs +0 -894
  223. package/dist/client/schema-BdSglH2X.mjs +0 -16084
  224. package/dist/client/site-styles-CWHmlVT5.mjs +0 -14503
  225. package/dist/client/src-VIsPY-kw.mjs +0 -62
  226. package/dist/preview-next/client/PreviewEditorSidebar-DEP3xD9K.mjs +0 -5810
  227. package/dist/preview-next/client/SdkPreviewModeRuntime-Cpe-XP8e.mjs +0 -3
  228. package/dist/preview-next/client/SdkPreviewModeRuntime-QDkMPASV.mjs +0 -8059
  229. package/dist/preview-next/client/SiteChromeCustomizeButton-1JaoGOKX.mjs +0 -9367
  230. package/dist/preview-next/client/previewSidebarNavigation-AXUj9-qQ.mjs +0 -224683
  231. package/dist/preview-next/client/result-BjJUoxUF.mjs +0 -16
  232. package/dist/preview-next/client/sdk-runtime-O-eA9-rV.mjs +0 -4
  233. package/dist/preview-next/refresh-contract-uQ6BXgLJ.mjs +0 -25
  234. package/dist/server/bindings-Dgt_0goJ.mjs +0 -17
  235. package/dist/server/client-DfMDbZ41.mjs +0 -2330
  236. package/dist/server/effectiveNavLinkStyle-BHIYPVG1.mjs +0 -13713
  237. package/dist/server/loadPage-CnVB-aeL.mjs +0 -2
  238. package/dist/server/prefetchBlockData-FwcsT5H2.mjs +0 -4359
  239. package/dist/server/schema-uSA_x1Zh.mjs +0 -16311
  240. package/dist/server/site-styles-CntHn2KI.mjs +0 -793
  241. package/dist/server/siteChromeOverlayClearance-DqP40Ka0.mjs +0 -802
@@ -1,894 +0,0 @@
1
- "use client";
2
- import { Nr as err, Pr as ok } from "./schema-BdSglH2X.mjs";
3
- import { z } from "zod";
4
- //#region ../core/src/date-math.ts
5
- function addDaysToDate(date, dayCount) {
6
- const next = new Date(date);
7
- next.setUTCDate(next.getUTCDate() + dayCount);
8
- return next;
9
- }
10
- function addDaysToIso(isoString, dayCount) {
11
- const date = new Date(isoString);
12
- if (!Number.isFinite(date.getTime())) return isoString;
13
- return addDaysToDate(date, dayCount).toISOString();
14
- }
15
- function subtractDaysFromIso(isoString, dayCount) {
16
- return addDaysToIso(isoString, -dayCount);
17
- }
18
- //#endregion
19
- //#region ../core/src/currency-format.ts
20
- const CURRENCY_CODE_INPUT_PATTERN = /^[A-Za-z]{3}$/;
21
- /** Parse + normalize a currency code, or return null if it isn't a 3-letter code. */
22
- function parseCurrencyCode(value) {
23
- return CURRENCY_CODE_INPUT_PATTERN.test(value) ? value.toUpperCase() : null;
24
- }
25
- const CURRENCY_LOCALE_BY_CODE = {
26
- USD: "en-US",
27
- GBP: "en-GB",
28
- EUR: "de-DE",
29
- AUD: "en-AU",
30
- CAD: "en-CA",
31
- NZD: "en-NZ",
32
- JPY: "ja-JP",
33
- CNY: "zh-CN",
34
- CHF: "de-CH"
35
- };
36
- function resolveCurrencyLocale(currencyCode, override) {
37
- return override ?? CURRENCY_LOCALE_BY_CODE[currencyCode] ?? "en";
38
- }
39
- function fractionDigitsFor(decimals, exactFormatter, amount) {
40
- switch (decimals) {
41
- case "exact": return {};
42
- case "auto": return exactFormatter.formatToParts(amount).find((part) => part.type === "fraction")?.value === exactFormatter.formatToParts(0).find((part) => part.type === "fraction")?.value ? {
43
- minimumFractionDigits: 0,
44
- maximumFractionDigits: exactFormatter.resolvedOptions().maximumFractionDigits
45
- } : {};
46
- case "whole": return {
47
- minimumFractionDigits: 0,
48
- maximumFractionDigits: 0
49
- };
50
- }
51
- }
52
- /**
53
- * The single currency-amount formatter for the product: minor units in,
54
- * localized string out.
55
- *
56
- * The locale is derived from the currency by default, so output is deterministic
57
- * across server and client (no SSR/hydration mismatch). All other money
58
- * formatters in the codebase should delegate here rather than constructing their
59
- * own `Intl.NumberFormat`.
60
- */
61
- function formatCurrencyAmount(amountCents, currency, options) {
62
- return formatCurrencyMajorUnits(amountCents / 100, currency, options);
63
- }
64
- /**
65
- * `formatCurrencyAmount` for an amount already in MAJOR units (29.99 = £29.99),
66
- * such as a registrar price. Prefer minor units everywhere else.
67
- */
68
- function formatCurrencyMajorUnits(amount, currency, options) {
69
- const currencyCode = currency.toUpperCase();
70
- const locale = resolveCurrencyLocale(currencyCode, options?.locale);
71
- try {
72
- const exactFormatter = new Intl.NumberFormat(locale, {
73
- style: "currency",
74
- currency: currencyCode
75
- });
76
- return new Intl.NumberFormat(locale, {
77
- style: "currency",
78
- currency: currencyCode,
79
- ...fractionDigitsFor(options?.decimals ?? "exact", exactFormatter, amount)
80
- }).format(amount);
81
- } catch {
82
- return `${amount.toFixed(2)} ${currencyCode}`;
83
- }
84
- }
85
- /** Gift-card copy retains pence only when the amount has a fractional part. */
86
- function formatGiftCardAmountLabel(amountCents, currency = "GBP") {
87
- return formatCurrencyAmount(amountCents, currency, {
88
- locale: "en-GB",
89
- decimals: amountCents % 100 === 0 ? "whole" : "exact"
90
- });
91
- }
92
- //#endregion
93
- //#region ../core/src/money-input.ts
94
- function unsafeAsCents(value) {
95
- return value;
96
- }
97
- function unsafeAsNonNegativeCents(value) {
98
- return value;
99
- }
100
- function unsafeAsPositiveCents(value) {
101
- return value;
102
- }
103
- /**
104
- * Normalizes a derived amount to non-negative whole cents. This intentionally
105
- * clamps negatives to zero; use parseNonNegativeCents for validation.
106
- */
107
- function toNonNegativeCents(value) {
108
- return unsafeAsNonNegativeCents(Math.max(0, Math.trunc(value)));
109
- }
110
- function parseCents(value) {
111
- if (!Number.isFinite(value)) return err({ kind: "invalid-number" });
112
- if (!Number.isInteger(value)) return err({ kind: "not-whole-cents" });
113
- return ok(unsafeAsCents(value));
114
- }
115
- function parseNonNegativeCents(value) {
116
- const parsed = parseCents(value);
117
- if (!parsed.ok) return parsed;
118
- if (parsed.value < 0) return err({ kind: "negative" });
119
- return ok(unsafeAsNonNegativeCents(parsed.value));
120
- }
121
- function parsePositiveCents(value) {
122
- const parsed = parseNonNegativeCents(value);
123
- if (!parsed.ok) return parsed;
124
- if (parsed.value === 0) return err({ kind: "zero-not-allowed" });
125
- return ok(unsafeAsPositiveCents(parsed.value));
126
- }
127
- function normalizeMoneyInput(value, options) {
128
- return (options.stripFormatting === true ? value.replace(/[^0-9.-]/g, "") : value).trim();
129
- }
130
- function parseFiniteMoneyAmount(value, options) {
131
- const normalized = normalizeMoneyInput(value, options);
132
- if (normalized.length === 0) return err({ kind: "empty" });
133
- const amount = Number(normalized);
134
- if (!Number.isFinite(amount)) return err({ kind: "invalid-number" });
135
- return ok(amount);
136
- }
137
- function roundMoneyAmountToCents(amount) {
138
- return Math.round(amount * 100);
139
- }
140
- function parsePositiveMoneyInputToCents(value, options = {}) {
141
- const parsed = parseFiniteMoneyAmount(value, options);
142
- if (!parsed.ok) return parsed;
143
- if (parsed.value < 0) return err({ kind: "negative" });
144
- const amountCents = roundMoneyAmountToCents(parsed.value);
145
- if (amountCents <= 0) return err({ kind: "zero-not-allowed" });
146
- return ok(unsafeAsPositiveCents(amountCents));
147
- }
148
- //#endregion
149
- //#region ../core/src/booking-flexible-balance.ts
150
- function clampFlexibleBalanceConfiguredAmount(amountCents, totalAmountCents) {
151
- return Math.max(0, Math.min(amountCents, totalAmountCents));
152
- }
153
- function resolveFlexibleBalanceInitialPaymentCents(input) {
154
- return clampFlexibleBalanceConfiguredAmount(input.config.upfrontAmountCents, input.totalAmountCents);
155
- }
156
- function resolveFlexibleBalanceDueAt(input) {
157
- switch (input.dueDateRule.kind) {
158
- case "relative_to_start_date": return subtractDaysFromIso(input.bookingStartAt, input.dueDateRule.daysBeforeStart);
159
- case "fixed_calendar_date": return input.dueDateRule.dueAt;
160
- default: return assertNever$2(input.dueDateRule);
161
- }
162
- }
163
- function calculateFlexibleBalanceMinimumPaymentCents(input) {
164
- if (input.remainingBalanceCents <= 0) return 0;
165
- const minimumPercentageBps = input.minimumPercentageBps ?? 1e3;
166
- const percentageFloor = Math.ceil(input.remainingBalanceCents * minimumPercentageBps / 1e4);
167
- return Math.min(input.remainingBalanceCents, Math.max(input.stripeMinimumChargeCents, percentageFloor));
168
- }
169
- function resolveFlexibleBalancePaymentEligibility(input) {
170
- if (input.remainingBalanceCents <= 0 || input.status === "completed") return {
171
- kind: "unavailable",
172
- reason: "already_settled"
173
- };
174
- switch (input.status) {
175
- case "payment_pending":
176
- case "cancelled_due_to_non_payment":
177
- case "refunded":
178
- case "waived": return {
179
- kind: "unavailable",
180
- reason: input.status
181
- };
182
- case "closed_order_failed": return {
183
- kind: "unavailable",
184
- reason: "order_failed"
185
- };
186
- case "overdue": return {
187
- kind: "full_balance_only",
188
- remainingBalanceCents: input.remainingBalanceCents,
189
- reason: "overdue"
190
- };
191
- case "active": {
192
- const minimumAmountCents = calculateFlexibleBalanceMinimumPaymentCents({
193
- remainingBalanceCents: input.remainingBalanceCents,
194
- stripeMinimumChargeCents: input.stripeMinimumChargeCents,
195
- minimumPercentageBps: input.minimumPercentageBps
196
- });
197
- if (minimumAmountCents >= input.remainingBalanceCents) return {
198
- kind: "full_balance_only",
199
- remainingBalanceCents: input.remainingBalanceCents,
200
- reason: "dust_balance"
201
- };
202
- return {
203
- kind: "eligible",
204
- minimumAmountCents,
205
- maximumCustomAmountCents: input.remainingBalanceCents,
206
- suggestedPayFullAmountCents: input.remainingBalanceCents
207
- };
208
- }
209
- default: return assertNever$2(input.status);
210
- }
211
- }
212
- function assertNever$2(value) {
213
- throw new Error(`Unexpected value: ${String(value)}`);
214
- }
215
- //#endregion
216
- //#region ../core/src/booking-instalments.ts
217
- function isDepositBearingBookingInstalmentPlan(plan) {
218
- switch (plan.kind) {
219
- case "deposit_plus_one_remainder":
220
- case "deposit_plus_scheduled_instalments": return true;
221
- case "equal_scheduled_instalments": return false;
222
- default: return assertNever$1(plan);
223
- }
224
- }
225
- function getBookingInstalmentDepositRefundability(plan) {
226
- return isDepositBearingBookingInstalmentPlan(plan) ? plan.depositRefundability : null;
227
- }
228
- function clampConfiguredAmount(amountCents, totalAmountCents) {
229
- return Math.max(0, Math.min(amountCents, totalAmountCents));
230
- }
231
- function splitAmountWithRemainderInFirst(totalAmountCents, partCount) {
232
- if (partCount <= 0) return [];
233
- const baseAmountCents = Math.floor(totalAmountCents / partCount);
234
- const remainderCents = totalAmountCents - baseAmountCents * partCount;
235
- return Array.from({ length: partCount }, (_, index) => index === 0 ? baseAmountCents + remainderCents : baseAmountCents);
236
- }
237
- function addIntervalPreservingMonthAnchor(isoString, intervalCount, intervalUnit) {
238
- const date = new Date(isoString);
239
- if (!Number.isFinite(date.getTime())) return isoString;
240
- switch (intervalUnit) {
241
- case "day":
242
- date.setUTCDate(date.getUTCDate() + intervalCount);
243
- return date.toISOString();
244
- case "week":
245
- date.setUTCDate(date.getUTCDate() + intervalCount * 7);
246
- return date.toISOString();
247
- case "month": return addMonthsPreservingAnchorDay(date, intervalCount).toISOString();
248
- default: return assertNever$1(intervalUnit);
249
- }
250
- }
251
- function getBookingInstalmentPlanIntervalCount(plan) {
252
- switch (plan.kind) {
253
- case "deposit_plus_one_remainder": return plan.remainderDueCount;
254
- case "deposit_plus_scheduled_instalments":
255
- case "equal_scheduled_instalments": return plan.intervalCount;
256
- default: return assertNever$1(plan);
257
- }
258
- }
259
- function omitZeroAmountFutureRows(rows) {
260
- if (rows.length <= 1) return rows;
261
- const firstRow = rows[0];
262
- if (firstRow === void 0) return [];
263
- return [firstRow, ...rows.slice(1).filter((row) => row.amountCents > 0)];
264
- }
265
- function formatOrderInstalmentStatusLabel(input) {
266
- switch (input.status) {
267
- case "pending_initial_payment": return input.phaseKind === "initial" ? "Due today" : "Scheduled";
268
- case "scheduled": return "Scheduled";
269
- case "paid": return input.phaseKind === "initial" ? "Paid today" : "Paid";
270
- case "failed": return "Payment failed";
271
- case "waived": return "Waived";
272
- case "cancelled": return "Cancelled";
273
- case "cancelled_as_paid_early": return "Paid early";
274
- case "refunded": return "Refunded";
275
- default: return assertNever$1(input.status);
276
- }
277
- }
278
- function addMonthsPreservingAnchorDay(date, intervalCount) {
279
- const anchorDay = date.getUTCDate();
280
- const nextMonth = new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth() + intervalCount, 1, date.getUTCHours(), date.getUTCMinutes(), date.getUTCSeconds(), date.getUTCMilliseconds()));
281
- const lastDayOfTargetMonth = new Date(Date.UTC(nextMonth.getUTCFullYear(), nextMonth.getUTCMonth() + 1, 0)).getUTCDate();
282
- nextMonth.setUTCDate(Math.min(anchorDay, lastDayOfTargetMonth));
283
- return nextMonth;
284
- }
285
- function assertNever$1(value) {
286
- throw new Error(`Unexpected value: ${String(value)}`);
287
- }
288
- //#endregion
289
- //#region ../core/src/booking-payment-options.ts
290
- /** Automatic instalments and a flexible balance cannot share one booking offer. */
291
- function validateBookingPaymentOptionKinds(kinds) {
292
- if (kinds.length === 0) return err("no_options");
293
- const uniqueKinds = new Set(kinds);
294
- if (uniqueKinds.size !== kinds.length) return err("duplicate_kind");
295
- if (uniqueKinds.has("instalment_plan") && uniqueKinds.has("flexible_balance")) return err("incompatible_collection_options");
296
- return ok(void 0);
297
- }
298
- //#endregion
299
- //#region ../commerce/src/utils/assertNever.ts
300
- function assertNever(value, message) {
301
- if (message) throw new Error(message);
302
- throw new Error(`Unexpected value: ${String(value)}`);
303
- }
304
- //#endregion
305
- //#region ../commerce/src/purchase/bookingInstalmentSchedule.ts
306
- function resolveBookingInitialInstalmentAmountCents(input) {
307
- const totalAmountCents = Math.max(0, input.totalAmountCents);
308
- switch (input.plan.kind) {
309
- case "deposit_plus_one_remainder":
310
- case "deposit_plus_scheduled_instalments": return clampConfiguredAmount(input.plan.depositAmountCents, totalAmountCents);
311
- case "equal_scheduled_instalments": return splitAmountWithRemainderInFirst(totalAmountCents, input.plan.instalmentCount)[0] ?? 0;
312
- default: return assertNever(input.plan);
313
- }
314
- }
315
- function buildBookingInstalmentSchedule(input) {
316
- const totalAmountCents = Math.max(0, input.totalAmountCents);
317
- switch (input.plan.kind) {
318
- case "deposit_plus_one_remainder": {
319
- const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
320
- const remainderAmountCents = Math.max(0, totalAmountCents - depositAmountCents);
321
- return omitZeroAmountFutureRows([createScheduleRow({
322
- sequence: 1,
323
- stateAtBooking: "paid_today",
324
- dueAt: input.anchorAt,
325
- amountCents: depositAmountCents
326
- }), createScheduleRow({
327
- sequence: 2,
328
- stateAtBooking: "scheduled",
329
- dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, input.plan.remainderDueCount, input.plan.intervalUnit),
330
- amountCents: remainderAmountCents
331
- })]);
332
- }
333
- case "deposit_plus_scheduled_instalments": {
334
- const plan = input.plan;
335
- const depositAmountCents = resolveBookingInitialInstalmentAmountCents(input);
336
- const instalmentAmounts = splitAmountWithRemainderInFirst(Math.max(0, totalAmountCents - depositAmountCents), plan.instalmentCount);
337
- return omitZeroAmountFutureRows([createScheduleRow({
338
- sequence: 1,
339
- stateAtBooking: "paid_today",
340
- dueAt: input.anchorAt,
341
- amountCents: depositAmountCents
342
- }), ...instalmentAmounts.map((amountCents, index) => createScheduleRow({
343
- sequence: index + 2,
344
- stateAtBooking: "scheduled",
345
- dueAt: addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * (index + 1), plan.intervalUnit),
346
- amountCents
347
- }))]);
348
- }
349
- case "equal_scheduled_instalments": {
350
- const plan = input.plan;
351
- return omitZeroAmountFutureRows(splitAmountWithRemainderInFirst(totalAmountCents, plan.instalmentCount).map((amountCents, index) => createScheduleRow({
352
- sequence: index + 1,
353
- stateAtBooking: index === 0 ? "paid_today" : "scheduled",
354
- dueAt: index === 0 ? input.anchorAt : addIntervalPreservingMonthAnchor(input.anchorAt, plan.intervalCount * index, plan.intervalUnit),
355
- amountCents
356
- })));
357
- }
358
- default: return assertNever(input.plan);
359
- }
360
- }
361
- function createScheduleRow(input) {
362
- return {
363
- id: `payment-${input.sequence}`,
364
- sequence: input.sequence,
365
- stateAtBooking: input.stateAtBooking,
366
- dueAt: input.dueAt,
367
- amountCents: input.amountCents
368
- };
369
- }
370
- /** Resolve real rows first: zero future payments do not extend the deadline. */
371
- function canInstalmentPlanCompleteBefore(input) {
372
- const deadline = Date.parse(input.deadline);
373
- if (!Number.isFinite(Date.parse(input.now)) || !Number.isFinite(deadline)) return false;
374
- return input.schedule.every((row) => Date.parse(row.dueAt) < deadline);
375
- }
376
- /** Later obligations are identified by their state, never their position. */
377
- function getBookingLaterInstalments(schedule) {
378
- return schedule.filter((row) => row.stateAtBooking === "scheduled");
379
- }
380
- //#endregion
381
- //#region ../commerce/src/purchase/bookingPaymentSelection.ts
382
- /** Identity is decided against the authoritative quote, before display repricing. */
383
- function resolveAvailableBookingCollectionOptions(input) {
384
- const configured = input.paymentTerms.allowedOptions;
385
- if (!validateBookingPaymentOptionKinds(configured.map((option) => option.kind)).ok) return [];
386
- const available = configured.filter((option) => option.kind !== "instalment_plan" || Number.isFinite(Date.parse(input.now))).map((option) => resolveBookingCollectionOptionFacts({
387
- option,
388
- totalCents: input.totalCents,
389
- anchorAt: input.now,
390
- bookingStartAt: input.bookingStartAt
391
- })).filter((option) => option.kind !== "instalment_plan" || input.bookingStartAt !== null && canInstalmentPlanCompleteBefore({
392
- now: input.now,
393
- deadline: input.bookingStartAt,
394
- schedule: option.schedule
395
- }));
396
- const upfront = resolveBookingCollectionOptionFacts({
397
- option: { kind: "upfront" },
398
- totalCents: input.totalCents,
399
- anchorAt: input.now,
400
- bookingStartAt: input.bookingStartAt
401
- });
402
- const collapsed = available.map((option) => isBookingCollectionEquivalentToUpfront(option) ? upfront : option);
403
- const unique = collapsed.filter((option, index) => collapsed.findIndex((other) => other.kind === option.kind) === index);
404
- return unique.length > 0 ? unique : [upfront];
405
- }
406
- function isBookingCollectionEquivalentToUpfront(option) {
407
- switch (option.kind) {
408
- case "upfront": return true;
409
- case "deferred_manual": return false;
410
- case "flexible_balance": return option.config.depositRefundability === "refundable" && option.dueNowCents === option.totalCents;
411
- case "instalment_plan": return option.depositRefundability !== "non_refundable" && option.schedule.length === 1;
412
- default: return assertNever(option);
413
- }
414
- }
415
- function resolveBookingCollectionOptionFacts(input) {
416
- const money = {
417
- totalCents: input.totalCents,
418
- anchorAt: input.anchorAt,
419
- bookingStartAt: input.bookingStartAt
420
- };
421
- switch (input.option.kind) {
422
- case "upfront": return {
423
- ...money,
424
- kind: "upfront",
425
- dueNowCents: input.totalCents
426
- };
427
- case "deferred_manual": return {
428
- ...money,
429
- kind: "deferred_manual",
430
- dueNowCents: 0
431
- };
432
- case "instalment_plan": {
433
- const schedule = buildBookingInstalmentSchedule({
434
- anchorAt: input.anchorAt,
435
- totalAmountCents: input.totalCents,
436
- plan: input.option.plan
437
- });
438
- return {
439
- ...money,
440
- kind: "instalment_plan",
441
- plan: input.option.plan,
442
- schedule,
443
- dueNowCents: schedule[0]?.amountCents ?? 0,
444
- depositRefundability: getBookingInstalmentDepositRefundability(input.option.plan)
445
- };
446
- }
447
- case "flexible_balance": {
448
- const dueNowCents = resolveFlexibleBalanceInitialPaymentCents({
449
- totalAmountCents: input.totalCents,
450
- config: input.option.config
451
- });
452
- return {
453
- ...money,
454
- kind: "flexible_balance",
455
- config: input.option.config,
456
- dueNowCents,
457
- remainingBalanceCents: Math.max(0, input.totalCents - dueNowCents),
458
- balanceDueAt: resolveFlexibleBalanceDueAt({
459
- bookingStartAt: input.bookingStartAt ?? input.anchorAt,
460
- dueDateRule: input.option.config.dueDateRule
461
- })
462
- };
463
- }
464
- default: return assertNever(input.option);
465
- }
466
- }
467
- /** Discounts change preview money, never an already admitted collection identity. */
468
- function repriceBookingCollectionOptions(input) {
469
- return input.options.map((option) => option.totalCents === input.totalCents ? option : resolveBookingCollectionOptionFacts({
470
- option,
471
- totalCents: input.totalCents,
472
- anchorAt: option.anchorAt,
473
- bookingStartAt: option.bookingStartAt
474
- }));
475
- }
476
- //#endregion
477
- //#region ../commerce/src/purchase/checkoutPaymentFlow.ts
478
- function planCheckoutPaymentFlow(options) {
479
- const amountDueCents = toNonNegativeCents(options.amountDueCents);
480
- const discountCents = toNonNegativeCents(options.discountCents);
481
- const availableCreditCents = toNonNegativeCents(options.availableCreditCents);
482
- const minimumStripeChargeCents = toNonNegativeCents(options.minimumStripeChargeCents ?? 0);
483
- if (amountDueCents <= 0) return {
484
- kind: "bypass",
485
- bypassReason: discountCents > 0 ? "discount_free" : "free",
486
- reserveCreditCents: 0
487
- };
488
- if (!options.creditCurrencyMatches || availableCreditCents <= 0) return {
489
- kind: "stripe",
490
- reserveCreditCents: toNonNegativeCents(0)
491
- };
492
- if (availableCreditCents >= amountDueCents) return {
493
- kind: "store_credit_only",
494
- reserveCreditCents: amountDueCents
495
- };
496
- return {
497
- kind: "stripe",
498
- reserveCreditCents: planMixedPaymentCreditReservation({
499
- amountDueCents,
500
- availableCreditCents,
501
- minimumStripeChargeCents
502
- })
503
- };
504
- }
505
- function planMixedPaymentCreditReservation(input) {
506
- const chargeAfterFullCredit = input.amountDueCents - input.availableCreditCents;
507
- if (input.minimumStripeChargeCents <= 0 || chargeAfterFullCredit <= 0 || chargeAfterFullCredit >= input.minimumStripeChargeCents) return input.availableCreditCents;
508
- if (input.amountDueCents < input.minimumStripeChargeCents) return toNonNegativeCents(0);
509
- return toNonNegativeCents(input.amountDueCents - input.minimumStripeChargeCents);
510
- }
511
- /**
512
- * Apply site credit to a flexible-balance booking before card payment.
513
- *
514
- * Credit first reduces the configured payment due now. Once that payment is
515
- * covered, any remaining credit reduces the later balance. If a partial credit
516
- * application would leave a positive card charge below Stripe's minimum, less
517
- * credit is used so the configured payment can still be collected.
518
- */
519
- function planFlexibleBalanceCreditFirst(input) {
520
- const totalCents = toNonNegativeCents(input.totalAfterDiscountCents);
521
- const configuredDueNowCents = toNonNegativeCents(Math.min(input.configuredPaymentDueNowCents, totalCents));
522
- const availableCreditCents = toNonNegativeCents(input.creditCurrencyMatches ? input.availableCreditCents : 0);
523
- const minimumStripeChargeCents = toNonNegativeCents(input.minimumStripeChargeCents ?? 0);
524
- if (availableCreditCents >= totalCents && totalCents > 0) return {
525
- kind: "credit_only",
526
- reserveCreditCents: totalCents,
527
- cardDueNowCents: toNonNegativeCents(0),
528
- laterBalanceCents: toNonNegativeCents(0)
529
- };
530
- let reserveCreditCents = toNonNegativeCents(Math.min(availableCreditCents, totalCents));
531
- if (reserveCreditCents >= configuredDueNowCents) return {
532
- kind: "flexible_balance",
533
- reserveCreditCents,
534
- cardDueNowCents: toNonNegativeCents(0),
535
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents)
536
- };
537
- const plannedCardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
538
- if (plannedCardDueNowCents > 0 && plannedCardDueNowCents < minimumStripeChargeCents) {
539
- if (configuredDueNowCents < minimumStripeChargeCents) return {
540
- kind: "card_below_minimum",
541
- reserveCreditCents: toNonNegativeCents(0),
542
- cardDueNowCents: configuredDueNowCents,
543
- laterBalanceCents: toNonNegativeCents(totalCents - configuredDueNowCents)
544
- };
545
- reserveCreditCents = toNonNegativeCents(configuredDueNowCents - minimumStripeChargeCents);
546
- }
547
- const cardDueNowCents = toNonNegativeCents(configuredDueNowCents - reserveCreditCents);
548
- return {
549
- kind: "flexible_balance",
550
- reserveCreditCents,
551
- cardDueNowCents,
552
- laterBalanceCents: toNonNegativeCents(totalCents - reserveCreditCents - cardDueNowCents)
553
- };
554
- }
555
- //#endregion
556
- //#region ../commerce/src/purchase/settlement.ts
557
- function normalizeCurrencyCode(raw) {
558
- const normalized = raw.trim().toUpperCase();
559
- if (!/^[A-Z]{3}$/.test(normalized)) throw new Error(`Invalid currency code: ${raw}`);
560
- return normalized;
561
- }
562
- //#endregion
563
- //#region ../commerce/src/purchase/checkoutSessionMetadata.ts
564
- const datedOfferingSharedEngineMetadataShape = {
565
- datedOfferingEngineContractVersion: z.literal("shared_v1"),
566
- datedOfferingEngineRouteKind: z.literal("shared_whole_series_registration"),
567
- datedOfferingCapacityHoldId: z.string().uuid(),
568
- datedOfferingCapacityHoldAuditRef: z.string().uuid(),
569
- customerId: z.string().uuid(),
570
- eventSeriesId: z.string().uuid()
571
- };
572
- z.object(datedOfferingSharedEngineMetadataShape);
573
- const orderCheckoutSessionMetadataBaseShape = {
574
- type: z.literal("order"),
575
- site_id: z.string().uuid(),
576
- order_id: z.string().uuid().optional(),
577
- customer_email: z.string().email().optional(),
578
- customer_name: z.string().optional(),
579
- product_id: z.string().uuid().optional(),
580
- attendee_id: z.string().uuid().optional(),
581
- occurrence_id: z.string().uuid().optional(),
582
- tickets_count: z.string().optional(),
583
- notes: z.string().optional(),
584
- discount_redemption_id: z.string().uuid().optional(),
585
- discount_code_id: z.string().uuid().optional(),
586
- discount_code: z.string().optional(),
587
- discount_public_label: z.string().optional(),
588
- credit_reservation_id: z.string().uuid().optional(),
589
- credit_reserved_cents: z.string().optional(),
590
- discount_code_amount_cents: z.string().optional(),
591
- order_payment_reason: z.enum([
592
- "instalment_payoff",
593
- "flexible_balance_initial",
594
- "flexible_balance_paydown"
595
- ]).optional(),
596
- order_payment_plan_id: z.string().uuid().optional(),
597
- order_flexible_balance_contract_id: z.string().uuid().optional()
598
- };
599
- const absentDatedOfferingSharedEngineMetadataShape = {
600
- datedOfferingEngineContractVersion: z.never().optional(),
601
- datedOfferingEngineRouteKind: z.never().optional(),
602
- datedOfferingCapacityHoldId: z.never().optional(),
603
- datedOfferingCapacityHoldAuditRef: z.never().optional(),
604
- customerId: z.never().optional(),
605
- eventSeriesId: z.never().optional()
606
- };
607
- const LegacyOrderCheckoutSessionMetadataSchema = z.object({
608
- ...orderCheckoutSessionMetadataBaseShape,
609
- ...absentDatedOfferingSharedEngineMetadataShape
610
- });
611
- const SharedDatedOfferingOrderCheckoutSessionMetadataSchema = z.object({
612
- ...orderCheckoutSessionMetadataBaseShape,
613
- ...datedOfferingSharedEngineMetadataShape
614
- });
615
- z.union([SharedDatedOfferingOrderCheckoutSessionMetadataSchema, LegacyOrderCheckoutSessionMetadataSchema]);
616
- //#endregion
617
- //#region ../commerce/src/purchase/confirmationPaymentSchema.ts
618
- const settledBalanceSchema = z.strictObject({ kind: z.literal("settled") });
619
- const dueBalanceSchema = z.strictObject({
620
- kind: z.literal("due"),
621
- amountCents: z.number().int().positive().transform((value, ctx) => {
622
- const cents = parsePositiveCents(value);
623
- if (cents.ok) return cents.value;
624
- ctx.addIssue({
625
- code: "custom",
626
- message: "Expected positive whole cents"
627
- });
628
- return z.NEVER;
629
- }),
630
- dueAt: z.string().nullable()
631
- });
632
- const paymentBalanceSchema = z.discriminatedUnion("kind", [settledBalanceSchema, dueBalanceSchema]);
633
- const currencySchema = z.string().regex(/^[A-Z]{3}$/).transform(normalizeCurrencyCode);
634
- const moneyFields = {
635
- amountPaidCents: z.number().int().nonnegative().transform(toNonNegativeCents),
636
- currency: currencySchema
637
- };
638
- const confirmationPaymentSchema = z.discriminatedUnion("kind", [
639
- z.strictObject({
640
- kind: z.literal("free"),
641
- balance: settledBalanceSchema
642
- }),
643
- z.strictObject({
644
- kind: z.literal("waived"),
645
- balance: settledBalanceSchema
646
- }),
647
- z.strictObject({
648
- kind: z.literal("pass"),
649
- passName: z.string().nullable(),
650
- passCreditsUsed: z.number().int().positive().nullable(),
651
- balance: settledBalanceSchema
652
- }),
653
- z.strictObject({
654
- kind: z.literal("membership"),
655
- membershipName: z.string().nullable(),
656
- balance: settledBalanceSchema
657
- }),
658
- z.strictObject({
659
- kind: z.literal("manual_due"),
660
- currency: currencySchema,
661
- balance: dueBalanceSchema
662
- }),
663
- z.strictObject({
664
- kind: z.literal("managed_balance_due"),
665
- ...moneyFields,
666
- balance: dueBalanceSchema
667
- }),
668
- z.strictObject({
669
- kind: z.literal("monetary"),
670
- ...moneyFields,
671
- paymentMethod: z.enum([
672
- "stripe",
673
- "store_credit",
674
- "mixed",
675
- "manual"
676
- ]),
677
- balance: paymentBalanceSchema
678
- })
679
- ]);
680
- toNonNegativeCents(0);
681
- //#endregion
682
- //#region ../commerce/src/purchase/stripeCommissionMetadata.ts
683
- /** Reasons are payment evidence, not an independent pricing policy. */
684
- const STRIPE_COMMISSION_FREE_REASONS = [
685
- "managed_billing",
686
- "no_commission_plan",
687
- "billing_evidence_invalid",
688
- "fee_rounds_to_zero",
689
- "payment_not_stripe"
690
- ];
691
- const historicalContext = {
692
- currency: z.string().refine((value) => parseCurrencyCode(value) !== null).optional(),
693
- sourcePlanId: z.string().trim().min(1).optional()
694
- };
695
- const percentSchema = z.number().finite().min(0).max(100);
696
- z.discriminatedUnion("kind", [
697
- z.object({
698
- kind: z.literal("commission_free"),
699
- reason: z.enum(STRIPE_COMMISSION_FREE_REASONS),
700
- ...historicalContext
701
- }),
702
- z.object({
703
- kind: z.literal("application_fee_amount"),
704
- amountCents: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER),
705
- percent: percentSchema,
706
- ...historicalContext
707
- }),
708
- z.object({
709
- kind: z.literal("application_fee_percent"),
710
- percent: percentSchema,
711
- ...historicalContext
712
- })
713
- ]);
714
- //#endregion
715
- //#region ../commerce/src/purchase/stripeMinimumCharge.ts
716
- const STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY = {
717
- GBP: 30,
718
- USD: 50,
719
- EUR: 50,
720
- AED: 200,
721
- AUD: 50,
722
- BGN: 100,
723
- BRL: 50,
724
- CAD: 50,
725
- CHF: 50,
726
- CZK: 1500,
727
- DKK: 250,
728
- HKD: 400,
729
- HUF: 17500,
730
- JPY: 50,
731
- MXN: 1e3,
732
- MYR: 200,
733
- NOK: 300,
734
- NZD: 50,
735
- PLN: 200,
736
- RON: 200,
737
- SEK: 300,
738
- SGD: 50,
739
- THB: 1e3
740
- };
741
- function isStripeMinimumChargeCurrency(currency) {
742
- return currency in STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY;
743
- }
744
- function getStripeMinimumChargeRequirement(rawCurrency) {
745
- let currency;
746
- try {
747
- currency = normalizeCurrencyCode(rawCurrency);
748
- } catch {
749
- return null;
750
- }
751
- const currencyKey = currency;
752
- if (!isStripeMinimumChargeCurrency(currencyKey)) return null;
753
- return {
754
- currency,
755
- minimumAmountCents: STRIPE_MINIMUM_CHARGE_CENTS_BY_CURRENCY[currencyKey]
756
- };
757
- }
758
- //#endregion
759
- //#region ../commerce/src/purchase/checkoutCopy.ts
760
- /**
761
- * Customer copy shared by checkout surfaces, so one approved wording reaches
762
- * every place that shows it.
763
- */
764
- const checkoutCopy = {
765
- /** A payment is still being confirmed; checking again is safe. */
766
- checkoutStillConfirming: "We’re still confirming your payment. This can take a minute – you can check again, and you won’t be charged twice.",
767
- /** A previous attempt can't be confirmed automatically; the business needs to check it. */
768
- checkoutAssistanceRequired: "We can’t confirm your last payment attempt yet. Please don’t pay again – contact the business so they can check it."
769
- };
770
- //#endregion
771
- //#region ../commerce/src/purchase/event-registration-errors.ts
772
- const eventRegistrationErrors = {
773
- registrationClosed: {
774
- endsCommand: false,
775
- message: "Booking is currently closed for this event. Please contact the organiser if you’d like to find out more.",
776
- action: "none"
777
- },
778
- paymentInvestigationRequired: {
779
- endsCommand: false,
780
- message: "We still can’t confirm your payment. Please don’t make another payment. Contact the organiser so they can check your booking.",
781
- action: "none"
782
- },
783
- paymentProviderUnavailable: {
784
- endsCommand: false,
785
- message: "We couldn’t reach the payment provider. Please try again in a minute.",
786
- action: "retry"
787
- },
788
- paymentHostUnavailable: {
789
- endsCommand: false,
790
- message: "Card payments aren’t available on this web address yet. Please contact the organiser to book.",
791
- action: "none"
792
- },
793
- paymentPageUnavailable: {
794
- endsCommand: false,
795
- message: "We couldn’t open the payment page. Please refresh this page and try again. If this keeps happening, contact the organiser for help.",
796
- action: "retry"
797
- },
798
- paymentUnavailable: {
799
- endsCommand: false,
800
- message: "Online payment is not available for this event right now. Please contact the organiser for help with booking.",
801
- action: "none"
802
- },
803
- capacityChanged: {
804
- endsCommand: false,
805
- message: "Sorry, there aren’t enough places left for your selection. Please check the available places and choose again.",
806
- action: "places"
807
- },
808
- selectionChanged: {
809
- endsCommand: false,
810
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
811
- action: "places"
812
- },
813
- paymentSetupFailed: {
814
- endsCommand: true,
815
- message: "We couldn't set up payment for this booking, so your place hasn't been reserved and you haven't been charged. Please try again in a few minutes, or contact the organiser if it keeps happening.",
816
- action: "retry"
817
- },
818
- registrationAttemptEnded: {
819
- endsCommand: true,
820
- message: "That booking attempt has ended, so we couldn't finish it. You haven't been charged. Please start your booking again.",
821
- action: "start"
822
- },
823
- registrationPreparationChanged: {
824
- endsCommand: true,
825
- message: "The booking options for this event have changed. Please check the latest options and choose your places again.",
826
- action: "places"
827
- },
828
- registrationAlreadyExists: {
829
- endsCommand: false,
830
- message: "You already have a booking for this event. Please check your bookings to see its status. If you need help, contact the organiser.",
831
- action: "portal"
832
- },
833
- holdExpired: {
834
- endsCommand: false,
835
- message: "Your reservation has timed out. Please check availability and choose your places again.",
836
- action: "start"
837
- },
838
- waitlistUnavailable: {
839
- endsCommand: false,
840
- 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.",
841
- action: "event"
842
- },
843
- paymentContextMismatch: {
844
- endsCommand: false,
845
- message: "The payment options for this event have changed. Please check the latest options before continuing.",
846
- action: "payment-options"
847
- },
848
- idempotencyConflict: {
849
- endsCommand: false,
850
- 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.",
851
- action: "portal"
852
- },
853
- invalidCommitInput: {
854
- endsCommand: false,
855
- 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.",
856
- action: "details"
857
- }
858
- };
859
- function parseEventRegistrationErrorReason(value) {
860
- return typeof value === "string" && Object.prototype.hasOwnProperty.call(eventRegistrationErrors, value) ? value : null;
861
- }
862
- /** Only a server-confirmed refusal ends an identity; transport uncertainty retains it. */
863
- function eventRegistrationErrorEndsCommand(value) {
864
- const reason = parseEventRegistrationErrorReason(value);
865
- return reason !== null && eventRegistrationErrors[reason].endsCommand;
866
- }
867
- //#endregion
868
- //#region ../commerce/src/purchase/checkoutPresentation.ts
869
- function publishableKeyMode(publishableKey) {
870
- if (publishableKey.startsWith("pk_live_")) return "live";
871
- if (publishableKey.startsWith("pk_test_")) return "test";
872
- return null;
873
- }
874
- function checkBrowserStripeKey(publishableKey, livemode) {
875
- const key = publishableKey?.trim();
876
- if (!key) return {
877
- tag: "unavailable",
878
- reason: "missing_key"
879
- };
880
- const mode = publishableKeyMode(key);
881
- if (mode === null) return {
882
- tag: "unavailable",
883
- reason: "invalid_key"
884
- };
885
- return mode === (livemode ? "live" : "test") ? {
886
- tag: "ready",
887
- publishableKey: key
888
- } : {
889
- tag: "unavailable",
890
- reason: "mode_mismatch"
891
- };
892
- }
893
- //#endregion
894
- export { getBookingInstalmentPlanIntervalCount as _, checkoutCopy as a, formatCurrencyAmount as b, planCheckoutPaymentFlow as c, repriceBookingCollectionOptions as d, resolveAvailableBookingCollectionOptions as f, formatOrderInstalmentStatusLabel as g, validateBookingPaymentOptionKinds as h, parseEventRegistrationErrorReason as i, planFlexibleBalanceCreditFirst as l, getBookingLaterInstalments as m, eventRegistrationErrorEndsCommand as n, getStripeMinimumChargeRequirement as o, resolveBookingCollectionOptionFacts as p, eventRegistrationErrors as r, confirmationPaymentSchema as s, checkBrowserStripeKey as t, isBookingCollectionEquivalentToUpfront as u, resolveFlexibleBalancePaymentEligibility as v, formatGiftCardAmountLabel as x, parsePositiveMoneyInputToCents as y };