@riverbankcms/sdk 0.148.0 → 0.150.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (250) hide show
  1. package/README.md +1 -1
  2. package/dist/EventEmbeddedCheckoutStep-D00Kc8Zj.mjs +285 -0
  3. package/dist/{PreviewEditorSidebar-DvEPG3Z2.mjs → PreviewEditorSidebar-7ZhmmnBB.mjs} +103 -66
  4. package/dist/{PreviewEditorUI-D6eb6fkx.mjs → PreviewEditorUI-BIJucTRd.mjs} +3 -6
  5. package/dist/{PreviewQueryProvider-5znTyJuz.mjs → PreviewQueryProvider-C0mndwHB.mjs} +3 -3
  6. package/dist/{SdkPreviewModeRuntime-DJ6utQ_R.mjs → SdkPreviewModeRuntime-tj45gmCX.mjs} +96 -67
  7. package/dist/{SiteChromeCustomizeContext-CFJYh6vo.mjs → SiteChromeCustomizeContext-BFOt0ss-.mjs} +4804 -4161
  8. package/dist/_dts/ai/src/contracts/proposals.d.ts +660 -0
  9. package/dist/_dts/ai/src/contracts/siteStyleProposalSchemas.d.ts +510 -0
  10. package/dist/_dts/api/src/billing.d.ts +2 -2
  11. package/dist/_dts/api/src/bookingConfig.d.ts +33 -48
  12. package/dist/_dts/api/src/bookingManagementEndpoints.d.ts +2 -6
  13. package/dist/_dts/api/src/bookingOperations.d.ts +5 -7
  14. package/dist/_dts/api/src/bookingRecords.d.ts +15 -11
  15. package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +5 -5
  16. package/dist/_dts/api/src/clientErrorReporting.d.ts +11 -0
  17. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +0 -2
  18. package/dist/_dts/api/src/common/cancellation.d.ts +23 -0
  19. package/dist/_dts/api/src/contentRuntime.d.ts +5 -1
  20. package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +1 -1
  21. package/dist/_dts/api/src/endpoints.d.ts +2 -10
  22. package/dist/_dts/api/src/eventManagementContracts.d.ts +4 -7
  23. package/dist/_dts/api/src/footerCompositionContracts.d.ts +9 -0
  24. package/dist/_dts/api/src/footerSettings.d.ts +3 -3
  25. package/dist/_dts/api/src/index.d.ts +4 -4
  26. package/dist/_dts/api/src/navigation/bookingPortalLink.d.ts +13 -0
  27. package/dist/_dts/api/src/navigation.d.ts +1 -0
  28. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +2 -2
  29. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +2 -29
  30. package/dist/_dts/api/src/publicExperience/eventEndpoints.d.ts +9 -173
  31. package/dist/_dts/api/src/request.d.ts +1 -1
  32. package/dist/_dts/api/src/sdk-event-upsert.d.ts +1 -1
  33. package/dist/_dts/api/src/sdkPullEventContracts.d.ts +1 -1
  34. package/dist/_dts/api/src/sdkThemeWire.d.ts +12 -0
  35. package/dist/_dts/api/src/siteManagementEndpoints.d.ts +3 -3
  36. package/dist/_dts/api/src/siteOperations.d.ts +6 -2
  37. package/dist/_dts/api/src/siteSettings.d.ts +2 -0
  38. package/dist/_dts/blocks/src/client/site-chrome.d.ts +1 -1
  39. package/dist/_dts/blocks/src/client.d.ts +2 -1
  40. package/dist/_dts/blocks/src/contracts/index.d.ts +1 -1
  41. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +2 -2
  42. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +38 -10
  43. package/dist/_dts/blocks/src/portal/types.d.ts +9 -6
  44. package/dist/_dts/blocks/src/rendering/server.d.ts +1 -1
  45. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +24 -24
  46. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +1 -1
  47. package/dist/_dts/blocks/src/system/blocks/shared/bookingPaymentTerms.d.ts +84 -160
  48. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +2 -2
  49. package/dist/_dts/blocks/src/system/blocks/shop.shared.d.ts +31 -4
  50. package/dist/_dts/blocks/src/system/blocks/site-footer-runtime.d.ts +30 -3
  51. package/dist/_dts/blocks/src/system/designCapabilities.d.ts +10 -1
  52. package/dist/_dts/blocks/src/system/runtime/api/index.d.ts +1 -1
  53. package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +2 -2
  54. package/dist/_dts/blocks/src/system/runtime/api/types/core.d.ts +3 -1
  55. package/dist/_dts/blocks/src/system/runtime/api/types/events.d.ts +38 -18
  56. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -6
  57. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -3
  58. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingNowIso.d.ts +8 -0
  59. package/dist/_dts/blocks/src/system/runtime/hooks/useHeadlessEventRegistrationFlow.d.ts +1 -1
  60. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.server.d.ts +6 -0
  61. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +2 -1
  62. package/dist/_dts/blocks/src/system/runtime/nodes/commerce/shared/display.d.ts +9 -2
  63. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +14 -2
  64. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventEmbeddedCheckoutStep.d.ts +13 -0
  65. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationPayment.d.ts +15 -0
  66. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/EventRegistrationWizardActions.d.ts +0 -1
  67. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/FullyBookedStep.d.ts +6 -0
  68. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentBlockingPanel.d.ts +3 -0
  69. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +4 -0
  70. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.contract.d.ts +15 -5
  71. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/event-registration.headless.planning.d.ts +4 -2
  72. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.d.ts +3 -3
  73. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentLocation.d.ts +3 -0
  74. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/paymentResponse.d.ts +72 -0
  75. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationCompletion.d.ts +66 -5
  76. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationErrorRecovery.d.ts +1 -4
  77. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/registrationStateMachine.d.ts +13 -5
  78. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/sessionStorage.d.ts +11 -52
  79. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/types.d.ts +19 -2
  80. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationStripeReturn.d.ts +7 -42
  81. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationSubmit.d.ts +7 -8
  82. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +94 -24
  83. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useGuestRegistrationRecovery.d.ts +30 -0
  84. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/usePaymentStatusRecovery.d.ts +24 -12
  85. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useRegistrationAdmission.d.ts +18 -0
  86. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/wizardSteps.d.ts +6 -1
  87. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration.interactive.d.ts +1 -1
  88. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +24 -24
  89. package/dist/_dts/blocks/src/system/runtime/nodes/shop.interactive.d.ts +41 -6
  90. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +7 -2
  91. package/dist/_dts/blocks/src/system/runtime/shared/stripe/browserStripe.d.ts +8 -0
  92. package/dist/_dts/blocks/src/system/transforms/registry/eventCalendar.d.ts +8 -0
  93. package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +54 -0
  94. package/dist/_dts/commerce/src/purchase/checkoutCommitPlan.d.ts +58 -13
  95. package/dist/_dts/commerce/src/purchase/checkoutCopy.d.ts +10 -0
  96. package/dist/_dts/commerce/src/purchase/checkoutErrorCodes.d.ts +1 -1
  97. package/dist/_dts/commerce/src/purchase/checkoutPaymentPlanPlanning.d.ts +16 -21
  98. package/dist/_dts/commerce/src/purchase/checkoutPaymentTerms.d.ts +23 -40
  99. package/dist/_dts/commerce/src/purchase/checkoutPresentation.d.ts +49 -0
  100. package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +6 -6
  101. package/dist/_dts/commerce/src/purchase/checkoutStripeFinalizationPlanning.d.ts +5 -1
  102. package/dist/_dts/commerce/src/purchase/checkoutStripeSessionPlanning.d.ts +5 -4
  103. package/dist/_dts/commerce/src/purchase/event-registration-errors.d.ts +9 -0
  104. package/dist/_dts/commerce/src/purchase/index.d.ts +3 -3
  105. package/dist/_dts/commerce/src/purchase/membershipOrderItemMetadata.d.ts +4 -0
  106. package/dist/_dts/commerce/src/purchase/oneTimeCheckoutPlanning.d.ts +9 -4
  107. package/dist/_dts/commerce/src/purchase/orderInstalmentClosure.d.ts +13 -1
  108. package/dist/_dts/commerce/src/purchase/orderInstalmentLifecycle.d.ts +5 -0
  109. package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +4 -1
  110. package/dist/_dts/commerce/src/purchase/orderTypes.d.ts +7 -1
  111. package/dist/_dts/commerce/src/purchase/refundRailSplit.d.ts +1 -1
  112. package/dist/_dts/commerce/src/purchase/stateTransitions.d.ts +2 -2
  113. package/dist/_dts/commerce/src/purchase/stripeCheckoutReturnUrl.d.ts +9 -2
  114. package/dist/_dts/commerce/src/purchase/stripeMinimumCharge.d.ts +6 -0
  115. package/dist/_dts/commerce/src/purchase/types.d.ts +7 -7
  116. package/dist/_dts/content-editor/src/FooterComposerOverview.d.ts +3 -2
  117. package/dist/_dts/content-editor/src/controller/editLeaseHandover.d.ts +30 -0
  118. package/dist/_dts/content-editor/src/footerPreviewRuntime.d.ts +6 -1
  119. package/dist/_dts/content-editor/src/lib/browserStorage.d.ts +5 -0
  120. package/dist/_dts/content-editor/src/useFooterComposerState.d.ts +7 -0
  121. package/dist/_dts/core/src/booking-flexible-balance.d.ts +2 -2
  122. package/dist/_dts/core/src/booking-instalment-deposit.d.ts +20 -0
  123. package/dist/_dts/core/src/booking-live-payment-terms.d.ts +72 -0
  124. package/dist/_dts/core/src/booking-payment-options.d.ts +24 -0
  125. package/dist/_dts/core/src/booking-payment-schemas.d.ts +522 -0
  126. package/dist/_dts/core/src/branded.d.ts +3 -0
  127. package/dist/_dts/core/src/edit-lease.d.ts +5 -0
  128. package/dist/_dts/core/src/index.d.ts +4 -0
  129. package/dist/_dts/core/src/patch/index.d.ts +30 -0
  130. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +326 -36
  131. package/dist/_dts/media-editor/src/MediaPickerDialog.d.ts +3 -1
  132. package/dist/_dts/media-editor/src/MediaPickerMiniDialog.d.ts +10 -0
  133. package/dist/_dts/media-editor/src/index.d.ts +2 -0
  134. package/dist/_dts/preview-next/src/client/preview/PreviewEntryControllerProvider.d.ts +0 -1
  135. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +1 -1
  136. package/dist/_dts/preview-next/src/client/previewAuthStore.d.ts +7 -0
  137. package/dist/_dts/preview-next/src/constants.d.ts +4 -0
  138. package/dist/_dts/preview-next/src/keepAlive.d.ts +1 -0
  139. package/dist/_dts/sdk/src/bookings/index.d.ts +2 -1
  140. package/dist/_dts/sdk/src/bookings/types.d.ts +1 -1
  141. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +2 -12
  142. package/dist/_dts/sdk/src/version.d.ts +1 -1
  143. package/dist/_dts/theme-core/src/blocks/index.d.ts +1 -0
  144. package/dist/_dts/theme-core/src/blocks/opaquePanels.d.ts +147 -0
  145. package/dist/_dts/theme-core/src/boxBackgroundSchema.d.ts +22 -0
  146. package/dist/_dts/theme-core/src/buttons/buttonSurfaceContext.d.ts +22 -0
  147. package/dist/_dts/theme-core/src/cards/roles.d.ts +12 -0
  148. package/dist/_dts/theme-core/src/generated/containerResponsiveThemeCss.d.ts +1 -1
  149. package/dist/_dts/theme-core/src/mock-themes/all.d.ts +198 -0
  150. package/dist/_dts/theme-core/src/palette/utils/index.d.ts +2 -0
  151. package/dist/_dts/theme-core/src/palette/utils/scrimContrast.d.ts +22 -0
  152. package/dist/_dts/theme-core/src/runtime/bridgeColourTokens.d.ts +10 -0
  153. package/dist/_dts/theme-core/src/schema.d.ts +330 -0
  154. package/dist/_dts/theme-core/src/site-styles/appearancePresetCatalog.d.ts +0 -51
  155. package/dist/_dts/theme-core/src/site-styles/blockAppearancePresets.d.ts +0 -51
  156. package/dist/_dts/theme-core/src/site-styles/lookResolution.d.ts +11 -0
  157. package/dist/_dts/theme-core/src/site-styles/pageDesignEditorCapabilities.d.ts +7 -1
  158. package/dist/_dts/theme-core/src/site-styles/pageDesignEditorModel.d.ts +7 -1
  159. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +0 -5
  160. package/dist/_dts/theme-core/src/site-styles/previewRuntimeCapabilities.d.ts +12 -6
  161. package/dist/_dts/theme-core/src/site-styles/runtimeCompiler.d.ts +7 -4
  162. package/dist/_dts/theme-core/src/site-styles/sectionSurfaceBackgrounds.d.ts +65 -0
  163. package/dist/_dts/theme-core/src/site-styles/types.d.ts +17 -0
  164. package/dist/_dts/theme-core/src/surfaces/opaqueSurface.d.ts +43 -0
  165. package/dist/_dts/ui/src/color-picker.d.ts +1 -1
  166. package/dist/_dts/ui/src/palette/useHexDraft.d.ts +7 -0
  167. package/dist/client/{BookingMailingListNote-CzRt2dF_.mjs → BookingMailingListNote-CYHOufsI.mjs} +33 -124
  168. package/dist/client/{CheckboxChoice-B33MqoUo.mjs → CheckboxChoice-M-3HycLw.mjs} +1 -1
  169. package/dist/client/{DemoBookingPortalAccess-mxqwap3f.mjs → DemoBookingPortalAccess-Cvr9O_ca.mjs} +2 -2
  170. package/dist/client/{EventCombined.client-CDb11igO.mjs → EventCombined.client-m5UZIobP.mjs} +7 -7
  171. package/dist/client/EventEmbeddedCheckoutStep-DL6zFAkA.mjs +289 -0
  172. package/dist/client/{EventListing.client-EgYhzKPa.mjs → EventListing.client-DeMfCM04.mjs} +2 -2
  173. package/dist/client/{LeafletStaticMap-gtmtaA2b.mjs → LeafletStaticMap-CvZ3gOdD.mjs} +1 -1
  174. package/dist/client/{checkoutUrls-CXhko2Rv.mjs → RichText-BtfNvQV6.mjs} +2 -29
  175. package/dist/client/{TerminalPanel-DvNUP5ot.mjs → TerminalPanel-CUCNEwlH.mjs} +2 -18
  176. package/dist/client/{ThemedButton-C7CeUJjW.mjs → ThemedButton-C7WhXuRl.mjs} +2 -2
  177. package/dist/client/{accordion-kjvt49rA.mjs → accordion-cQm5mjqs.mjs} +1 -1
  178. package/dist/client/{bookingForm-pbRZordh.mjs → bookingForm-BVPJE5RQ.mjs} +15 -11
  179. package/dist/client/bookings.mjs +2860 -1222
  180. package/dist/client/{carousel-f4Zbmicv.mjs → carousel-3vgnY7LC.mjs} +2 -2
  181. package/dist/client/{carousel.client-A2lG-9od.mjs → carousel.client-CISsdZvg.mjs} +1 -1
  182. package/dist/client/{cart-DO20An50.mjs → cart-BGK4oOjm.mjs} +3 -3
  183. package/dist/client/{checkout-Du5amDR_.mjs → checkout-GsBLUNJD.mjs} +3 -3
  184. package/dist/client/checkoutUrls-ChxwaNtO.mjs +28 -0
  185. package/dist/client/client.mjs +3324 -2053
  186. package/dist/client/{colorStyles-j5U9v5JA.mjs → colorStyles-D-32xHZh.mjs} +2 -30
  187. package/dist/client/{context-eW97E945.mjs → context-D_8s12Fp.mjs} +1 -1
  188. package/dist/client/{dates-jPCirRea.mjs → dates-DeJQbQ9T.mjs} +2 -2
  189. package/dist/client/{eventCalendar-C2M-iE4j.mjs → eventCalendar-cmucD4NR.mjs} +10 -10
  190. package/dist/client/{eventCombined-W6ns3LHg.mjs → eventCombined-ku3E9FTl.mjs} +4 -4
  191. package/dist/client/{eventDetails-CR-GT0f0.mjs → eventDetails-CyKZ61sF.mjs} +5 -5
  192. package/dist/client/{eventListing-BK8AfYZz.mjs → eventListing-B7yxGIhX.mjs} +4 -4
  193. package/dist/client/{eventRegistration-BJSd4KUu.mjs → eventRegistration-BoXfSFgZ.mjs} +1455 -1184
  194. package/dist/client/{form-BvpfbQaT.mjs → form-CNQOWhJo.mjs} +5 -5
  195. package/dist/client/{headerSection-I5sUQ8x-.mjs → headerSection-DahaBJGQ.mjs} +3 -3
  196. package/dist/client/hooks.mjs +283 -193
  197. package/dist/client/{locationMap-BLvwf9_f.mjs → locationMap-BoDjqYlW.mjs} +4 -4
  198. package/dist/client/{media-Cl38iOMI.mjs → media-BFY0y2rb.mjs} +2 -1
  199. package/dist/client/{newsletterForm-DrQ2weE8.mjs → newsletterForm-DtzXDklw.mjs} +4 -4
  200. package/dist/client/{pricing-BES87mrR.mjs → pricing-DXEh2Lhh.mjs} +1 -1
  201. package/dist/client/{productDetail-Url9jcc5.mjs → productDetail-D7cPa-00.mjs} +3 -3
  202. package/dist/client/{productList-DE7ngEZJ.mjs → productList-D1XMap66.mjs} +3 -3
  203. package/dist/client/{propsDecoder-D1OtGXDV.mjs → propsDecoder-DiIeBopB.mjs} +913 -322
  204. package/dist/client/rendering/client.mjs +3913 -2260
  205. package/dist/client/rendering/islands.mjs +19 -19
  206. package/dist/client/rendering.mjs +3302 -2013
  207. package/dist/client/result-DRW7JWXz.mjs +30 -0
  208. package/dist/client/{routeIslandApiConfig-BG9Y-SHg.mjs → routeIslandApiConfig-wzR4lKAY.mjs} +1 -1
  209. package/dist/client/scrollToBlock-C86BYkyV.mjs +17 -0
  210. package/dist/client/{shop-CJkuySJ3.mjs → shop-CYT5P-S5.mjs} +13 -14
  211. package/dist/client/{shop-commerce-store-Bxm75Pg6.mjs → shop-commerce-store-wKhsJQxI.mjs} +1 -1
  212. package/dist/client/{shop-commerce-4rKj5n9h.mjs → shop-commerce-ypBu_dx4.mjs} +9 -9
  213. package/dist/client/{shopShared-DpoQDWfz.mjs → shopShared-DFGhYrf2.mjs} +52 -6
  214. package/dist/client/{useEventFilters-D8HliSqR.mjs → useEventFilters-blSbN5o7.mjs} +8 -8
  215. package/dist/preview-next/before-render.mjs +15 -22
  216. package/dist/preview-next/client/runtime.mjs +4 -4
  217. package/dist/preview-next/constants.mjs +5 -1
  218. package/dist/preview-next/index.mjs +5 -1
  219. package/dist/preview-next/keepAlive.mjs +149 -82
  220. package/dist/preview-next/middleware.mjs +15 -22
  221. package/dist/{previewAuthStore-BXXF3hhW.mjs → previewAuthStore-BBmV7UsW.mjs} +49 -29
  222. package/dist/{sdk-runtime-C2a05WjL.mjs → sdk-runtime-2p8uQk1V.mjs} +2 -2
  223. package/dist/{separator-CuNhBAhS.mjs → separator-Cvvzk0Oo.mjs} +1 -1
  224. package/dist/server/components.mjs +4041 -3704
  225. package/dist/server/config-validation.mjs +345 -255
  226. package/dist/server/config.mjs +345 -255
  227. package/dist/server/data.mjs +283 -193
  228. package/dist/server/index.mjs +20 -27
  229. package/dist/server/next.mjs +788 -469
  230. package/dist/server/page-converter.mjs +245 -121
  231. package/dist/server/prebuild.mjs +1 -1
  232. package/dist/server/rendering/server.mjs +4018 -3690
  233. package/dist/server/rendering.mjs +4044 -3707
  234. package/dist/server/routing.mjs +314 -190
  235. package/dist/server/server.mjs +290 -218
  236. package/dist/server/theme-bridge.mjs +1122 -310
  237. package/dist/server/theme.mjs +126 -116
  238. package/dist/spinner-CDo6AkDz.mjs +658 -0
  239. package/dist/styles/index.css +75 -212
  240. package/package.json +1 -1
  241. package/dist/_dts/api/src/bookingPaymentTermSchemas.d.ts +0 -123
  242. package/dist/_dts/billing/src/checkout/platform.d.ts +0 -77
  243. package/dist/_dts/billing/src/config/env.d.ts +0 -29
  244. package/dist/_dts/billing/src/stripe/client.d.ts +0 -29
  245. package/dist/_dts/blocks/src/system/runtime/hooks/usePaymentVerification.d.ts +0 -63
  246. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventCheckoutHandoffRestore.d.ts +0 -9
  247. package/dist/_dts/commerce/src/purchase/checkoutPaymentTermPlanning.d.ts +0 -10
  248. package/dist/_dts/commerce/src/purchase/checkoutValidatedItemPlanning.d.ts +0 -55
  249. package/dist/_dts/commerce/src/purchase/orderInstalmentPayoff.d.ts +0 -24
  250. package/dist/client/urlParams-D71VXFGx.mjs +0 -47
@@ -30,11 +30,6 @@ function setPreviewAuthCookies(res, { accessToken, refreshToken }, options) {
30
30
  if (refreshToken) setPreviewRefreshCookie(res, refreshToken, options);
31
31
  return res;
32
32
  }
33
- function clearPreviewCookies(res) {
34
- res.cookies.delete(PREVIEW_COOKIE_NAME);
35
- res.cookies.delete(PREVIEW_REFRESH_COOKIE_NAME);
36
- return res;
37
- }
38
33
  //#endregion
39
34
  //#region ../preview-next/src/jwt.ts
40
35
  function base64UrlDecodeToString(value) {
@@ -2806,7 +2801,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
2806
2801
  stack: 8e3,
2807
2802
  digest: 128,
2808
2803
  componentStack: 8e3,
2809
- sourceLocation: 1024
2804
+ sourceLocation: 1024,
2805
+ navigationAgeMs: 6e4
2810
2806
  };
2811
2807
  const clientErrorEventSchema = z.enum([
2812
2808
  "dashboard:route-error",
@@ -2823,7 +2819,17 @@ z.object({
2823
2819
  stack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
2824
2820
  digest: z.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
2825
2821
  componentStack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
2826
- sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
2822
+ sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
2823
+ navigation: z.object({
2824
+ fromPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2825
+ toPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2826
+ type: z.enum([
2827
+ "push",
2828
+ "replace",
2829
+ "traverse"
2830
+ ]),
2831
+ ageMs: z.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
2832
+ }).strict().nullable().optional()
2827
2833
  }).strict();
2828
2834
  const API_ENDPOINTS = {
2829
2835
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -6580,24 +6586,6 @@ const API_ENDPOINTS = {
6580
6586
  "server:internal_error"
6581
6587
  ]
6582
6588
  },
6583
- syncBookingPassWithStripe: {
6584
- path: "/sites/{siteId}/bookings/passes/{passId}/sync-stripe",
6585
- method: "POST",
6586
- tags: [
6587
- "site-{siteId}",
6588
- "passes-{siteId}",
6589
- "pass-{passId}"
6590
- ],
6591
- auth: "user",
6592
- responseKind: "json",
6593
- errors: [
6594
- "validation:invalid_input",
6595
- "auth:forbidden",
6596
- "resource:not_found",
6597
- "resource:conflict",
6598
- "server:internal_error"
6599
- ]
6600
- },
6601
6589
  refundCustomerPass: {
6602
6590
  path: "/sites/{siteId}/bookings/customer-passes/{customerPassId}/refund",
6603
6591
  method: "POST",
@@ -8061,7 +8049,7 @@ const API_ENDPOINTS = {
8061
8049
  ]
8062
8050
  },
8063
8051
  cancelFlexibleBalanceBookingDueToNonPayment: {
8064
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/cancel-due-to-non-payment",
8052
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/cancel-due-to-non-payment",
8065
8053
  method: "POST",
8066
8054
  auth: "user",
8067
8055
  responseKind: "json",
@@ -8072,7 +8060,7 @@ const API_ENDPOINTS = {
8072
8060
  ]
8073
8061
  },
8074
8062
  reopenFlexibleBalanceBookingAfterNonPaymentCancellation: {
8075
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/reopen",
8063
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/reopen",
8076
8064
  method: "POST",
8077
8065
  auth: "user",
8078
8066
  responseKind: "json",
@@ -8186,52 +8174,138 @@ function parsePreviewRefreshResponse(value) {
8186
8174
  }
8187
8175
  //#endregion
8188
8176
  //#region ../preview-next/src/keepAlive.ts
8189
- function shouldRefreshToken(accessToken, thresholdSeconds) {
8190
- if (!accessToken) return true;
8177
+ function inspectAccessToken(accessToken, nowSeconds) {
8178
+ if (!accessToken) return { kind: "missing" };
8191
8179
  try {
8192
8180
  const exp = decodeJwtPayload(accessToken)?.exp;
8193
- if (typeof exp !== "number") return true;
8194
- return exp - Math.floor(Date.now() / 1e3) < thresholdSeconds;
8181
+ return typeof exp === "number" ? {
8182
+ kind: "known",
8183
+ expiresInSeconds: exp - nowSeconds
8184
+ } : { kind: "unreadable" };
8195
8185
  } catch {
8196
- return true;
8186
+ return { kind: "unreadable" };
8197
8187
  }
8198
8188
  }
8189
+ function tokenTtlBucket(lifetime) {
8190
+ if (lifetime.kind !== "known") return lifetime.kind;
8191
+ if (lifetime.expiresInSeconds <= 0) return "expired";
8192
+ if (lifetime.expiresInSeconds < 300) return "under_5m";
8193
+ if (lifetime.expiresInSeconds < 900) return "under_15m";
8194
+ return "at_least_15m";
8195
+ }
8196
+ function isCurrentToken(lifetime, thresholdSeconds) {
8197
+ return lifetime.kind === "known" && lifetime.expiresInSeconds >= thresholdSeconds;
8198
+ }
8199
+ function planPreviewTokens(accessToken, refreshToken, refreshThresholdSeconds, lifetime) {
8200
+ if (!refreshToken) return accessToken && isCurrentToken(lifetime, 1) ? {
8201
+ kind: "current",
8202
+ accessToken
8203
+ } : { kind: "unavailable" };
8204
+ return accessToken && isCurrentToken(lifetime, refreshThresholdSeconds) ? {
8205
+ kind: "current",
8206
+ accessToken
8207
+ } : {
8208
+ kind: "refresh",
8209
+ refreshToken
8210
+ };
8211
+ }
8199
8212
  async function refreshAccessToken(params) {
8200
- const { refreshToken, dashboardUrl, logger, fetcher } = params;
8213
+ const { refreshToken, dashboardUrl, correlationId, fetcher } = params;
8201
8214
  try {
8202
8215
  const request = { refreshToken };
8203
8216
  const response = await fetcher(buildPreviewAuthRefreshUrl({ dashboardBaseUrl: dashboardUrl }), {
8204
8217
  method: "POST",
8205
8218
  headers: {
8206
8219
  "Content-Type": "application/json",
8207
- Accept: "application/json"
8220
+ Accept: "application/json",
8221
+ "x-correlation-id": correlationId
8208
8222
  },
8209
8223
  cache: "no-store",
8210
8224
  credentials: "omit",
8211
8225
  body: JSON.stringify(request)
8212
8226
  });
8213
- if (!response.ok) {
8214
- logger?.warn?.("preview-keepalive:refresh-failed", { status: response.status });
8215
- return null;
8216
- }
8227
+ if (!response.ok) return {
8228
+ kind: "dashboard_rejected",
8229
+ dashboardStatus: response.status
8230
+ };
8217
8231
  const envelope = await response.json().catch(() => null);
8218
8232
  const data = parsePreviewRefreshResponse(isSuccessfulResponseEnvelope(envelope) ? envelope.data : null);
8219
- if (!data.success) {
8220
- logger?.warn?.("preview-keepalive:malformed-response");
8221
- return null;
8222
- }
8223
- return data.data;
8233
+ if (!data.success) return {
8234
+ kind: "malformed_response",
8235
+ dashboardStatus: response.status
8236
+ };
8237
+ return {
8238
+ kind: "refreshed",
8239
+ tokens: data.data,
8240
+ dashboardStatus: response.status
8241
+ };
8224
8242
  } catch {
8225
- logger?.error?.("preview-keepalive:error");
8226
- return null;
8243
+ return {
8244
+ kind: "network_error",
8245
+ dashboardStatus: null
8246
+ };
8227
8247
  }
8228
8248
  }
8249
+ function logKeepAliveOutcome({ logger, fields, previewOutcome, status, previewDashboardStatus = null }) {
8250
+ const meta = {
8251
+ ...fields,
8252
+ previewOutcome,
8253
+ status,
8254
+ previewDashboardStatus
8255
+ };
8256
+ if (status >= 400) logger?.warn?.("preview-keepalive:outcome", meta);
8257
+ else logger?.info?.("preview-keepalive:outcome", meta);
8258
+ }
8259
+ async function respondToRefresh(params) {
8260
+ const { dashboardUrl, tokenPlan, correlationId, logFields, logger, fetcher, maxAge, secure } = params;
8261
+ if (!dashboardUrl) {
8262
+ logKeepAliveOutcome({
8263
+ logger,
8264
+ fields: logFields,
8265
+ previewOutcome: "dashboard_url_missing",
8266
+ status: 401
8267
+ });
8268
+ return NextResponse.json({ error: "Preview refresh is unavailable" }, { status: 401 });
8269
+ }
8270
+ const outcome = await refreshAccessToken({
8271
+ refreshToken: tokenPlan.refreshToken,
8272
+ dashboardUrl,
8273
+ correlationId,
8274
+ fetcher
8275
+ });
8276
+ if (outcome.kind !== "refreshed") {
8277
+ logKeepAliveOutcome({
8278
+ logger,
8279
+ fields: logFields,
8280
+ previewOutcome: outcome.kind,
8281
+ status: 401,
8282
+ previewDashboardStatus: outcome.dashboardStatus
8283
+ });
8284
+ return NextResponse.json({ error: "Unable to refresh preview session" }, { status: 401 });
8285
+ }
8286
+ logKeepAliveOutcome({
8287
+ logger,
8288
+ fields: logFields,
8289
+ previewOutcome: "refreshed",
8290
+ status: 200,
8291
+ previewDashboardStatus: outcome.dashboardStatus
8292
+ });
8293
+ const response = responseWithAccessToken(outcome.tokens.accessToken);
8294
+ setPreviewAuthCookies(response, outcome.tokens, {
8295
+ maxAge,
8296
+ secure
8297
+ });
8298
+ return response;
8299
+ }
8229
8300
  function isSuccessfulResponseEnvelope(value) {
8230
8301
  return typeof value === "object" && value !== null && !Array.isArray(value) && "success" in value && value.success === true && "data" in value;
8231
8302
  }
8303
+ function responseWithAccessToken(accessToken) {
8304
+ return NextResponse.json({ accessToken }, { headers: { "Cache-Control": "no-store" } });
8305
+ }
8232
8306
  function createPreviewKeepAliveRouteHandler(options = {}) {
8233
8307
  const maxAge = options.maxAge ?? 43200;
8234
- const refreshThresholdSeconds = options.refreshThresholdSeconds ?? 300;
8308
+ const refreshThresholdSeconds = options.refreshThresholdSeconds ?? 900;
8235
8309
  const logger = options.logger;
8236
8310
  const getCookies = options.getCookies ?? (async () => {
8237
8311
  const store = await cookies();
@@ -8239,56 +8313,49 @@ function createPreviewKeepAliveRouteHandler(options = {}) {
8239
8313
  });
8240
8314
  const fetcher = options.fetcher ?? fetch;
8241
8315
  return async function previewKeepAliveHandler(request) {
8242
- const res = new NextResponse(null, { status: 204 });
8243
8316
  const cookieStore = await getCookies();
8244
8317
  const accessToken = cookieStore.get(PREVIEW_COOKIE_NAME)?.value;
8245
8318
  const refreshToken = cookieStore.get(PREVIEW_REFRESH_COOKIE_NAME)?.value;
8246
8319
  const url = new URL(request.url);
8320
+ const correlationId = crypto.randomUUID();
8247
8321
  const isSecure = ((request.headers.get("x-forwarded-proto") ?? "").split(",")[0]?.trim() || url.protocol.replace(":", "")) === "https";
8248
- if (!refreshToken) {
8249
- if (accessToken) setPreviewAuthCookies(res, {
8250
- accessToken,
8251
- refreshToken
8252
- }, {
8253
- maxAge,
8254
- secure: isSecure
8322
+ const lifetime = inspectAccessToken(accessToken, Math.floor(Date.now() / 1e3));
8323
+ const tokenPlan = planPreviewTokens(accessToken, refreshToken, refreshThresholdSeconds, lifetime);
8324
+ const logFields = {
8325
+ host: url.host,
8326
+ correlationId,
8327
+ previewDecision: tokenPlan.kind,
8328
+ previewTokenTtlBucket: tokenTtlBucket(lifetime),
8329
+ previewRefreshCookiePresent: Boolean(refreshToken)
8330
+ };
8331
+ if (tokenPlan.kind === "unavailable") {
8332
+ logKeepAliveOutcome({
8333
+ logger,
8334
+ fields: logFields,
8335
+ previewOutcome: "session_unavailable",
8336
+ status: 401
8255
8337
  });
8256
- return res;
8338
+ return NextResponse.json({ error: "Preview session is unavailable" }, { status: 401 });
8257
8339
  }
8258
- if (!shouldRefreshToken(accessToken, refreshThresholdSeconds)) {
8259
- setPreviewAuthCookies(res, {
8260
- accessToken,
8261
- refreshToken
8262
- }, {
8263
- maxAge,
8264
- secure: isSecure
8340
+ if (tokenPlan.kind === "current") {
8341
+ logKeepAliveOutcome({
8342
+ logger,
8343
+ fields: logFields,
8344
+ previewOutcome: "current",
8345
+ status: 200
8265
8346
  });
8266
- return res;
8267
- }
8268
- if (!options.dashboardUrl) {
8269
- logger?.warn?.("preview-keepalive:missing-dashboard-url");
8270
- const failure = NextResponse.json({ error: "Preview refresh is unavailable" }, { status: 401 });
8271
- clearPreviewCookies(failure);
8272
- return failure;
8347
+ return responseWithAccessToken(tokenPlan.accessToken);
8273
8348
  }
8274
- logger?.debug?.("preview-keepalive:needs-refresh");
8275
- const refreshed = await refreshAccessToken({
8276
- refreshToken,
8349
+ return respondToRefresh({
8277
8350
  dashboardUrl: options.dashboardUrl,
8351
+ tokenPlan,
8352
+ correlationId,
8353
+ logFields,
8278
8354
  logger,
8279
- fetcher
8280
- });
8281
- if (!refreshed) {
8282
- logger?.warn?.("preview-keepalive:cleared-cookies");
8283
- const failure = NextResponse.json({ error: "Unable to refresh preview session" }, { status: 401 });
8284
- clearPreviewCookies(failure);
8285
- return failure;
8286
- }
8287
- setPreviewAuthCookies(res, refreshed, {
8355
+ fetcher,
8288
8356
  maxAge,
8289
8357
  secure: isSecure
8290
8358
  });
8291
- return res;
8292
8359
  };
8293
8360
  }
8294
8361
  //#endregion
@@ -2778,7 +2778,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
2778
2778
  stack: 8e3,
2779
2779
  digest: 128,
2780
2780
  componentStack: 8e3,
2781
- sourceLocation: 1024
2781
+ sourceLocation: 1024,
2782
+ navigationAgeMs: 6e4
2782
2783
  };
2783
2784
  const clientErrorEventSchema = z.enum([
2784
2785
  "dashboard:route-error",
@@ -2795,7 +2796,17 @@ z.object({
2795
2796
  stack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
2796
2797
  digest: z.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
2797
2798
  componentStack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
2798
- sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
2799
+ sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
2800
+ navigation: z.object({
2801
+ fromPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2802
+ toPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2803
+ type: z.enum([
2804
+ "push",
2805
+ "replace",
2806
+ "traverse"
2807
+ ]),
2808
+ ageMs: z.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
2809
+ }).strict().nullable().optional()
2799
2810
  }).strict();
2800
2811
  const API_ENDPOINTS = {
2801
2812
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -6552,24 +6563,6 @@ const API_ENDPOINTS = {
6552
6563
  "server:internal_error"
6553
6564
  ]
6554
6565
  },
6555
- syncBookingPassWithStripe: {
6556
- path: "/sites/{siteId}/bookings/passes/{passId}/sync-stripe",
6557
- method: "POST",
6558
- tags: [
6559
- "site-{siteId}",
6560
- "passes-{siteId}",
6561
- "pass-{passId}"
6562
- ],
6563
- auth: "user",
6564
- responseKind: "json",
6565
- errors: [
6566
- "validation:invalid_input",
6567
- "auth:forbidden",
6568
- "resource:not_found",
6569
- "resource:conflict",
6570
- "server:internal_error"
6571
- ]
6572
- },
6573
6566
  refundCustomerPass: {
6574
6567
  path: "/sites/{siteId}/bookings/customer-passes/{customerPassId}/refund",
6575
6568
  method: "POST",
@@ -8033,7 +8026,7 @@ const API_ENDPOINTS = {
8033
8026
  ]
8034
8027
  },
8035
8028
  cancelFlexibleBalanceBookingDueToNonPayment: {
8036
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/cancel-due-to-non-payment",
8029
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/cancel-due-to-non-payment",
8037
8030
  method: "POST",
8038
8031
  auth: "user",
8039
8032
  responseKind: "json",
@@ -8044,7 +8037,7 @@ const API_ENDPOINTS = {
8044
8037
  ]
8045
8038
  },
8046
8039
  reopenFlexibleBalanceBookingAfterNonPaymentCancellation: {
8047
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/reopen",
8040
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/reopen",
8048
8041
  method: "POST",
8049
8042
  auth: "user",
8050
8043
  responseKind: "json",
@@ -2749,7 +2749,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
2749
2749
  stack: 8e3,
2750
2750
  digest: 128,
2751
2751
  componentStack: 8e3,
2752
- sourceLocation: 1024
2752
+ sourceLocation: 1024,
2753
+ navigationAgeMs: 6e4
2753
2754
  };
2754
2755
  const clientErrorEventSchema = z.enum([
2755
2756
  "dashboard:route-error",
@@ -2766,7 +2767,17 @@ z.object({
2766
2767
  stack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
2767
2768
  digest: z.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
2768
2769
  componentStack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
2769
- sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
2770
+ sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
2771
+ navigation: z.object({
2772
+ fromPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2773
+ toPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2774
+ type: z.enum([
2775
+ "push",
2776
+ "replace",
2777
+ "traverse"
2778
+ ]),
2779
+ ageMs: z.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
2780
+ }).strict().nullable().optional()
2770
2781
  }).strict();
2771
2782
  const API_ENDPOINTS = {
2772
2783
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -6523,24 +6534,6 @@ const API_ENDPOINTS = {
6523
6534
  "server:internal_error"
6524
6535
  ]
6525
6536
  },
6526
- syncBookingPassWithStripe: {
6527
- path: "/sites/{siteId}/bookings/passes/{passId}/sync-stripe",
6528
- method: "POST",
6529
- tags: [
6530
- "site-{siteId}",
6531
- "passes-{siteId}",
6532
- "pass-{passId}"
6533
- ],
6534
- auth: "user",
6535
- responseKind: "json",
6536
- errors: [
6537
- "validation:invalid_input",
6538
- "auth:forbidden",
6539
- "resource:not_found",
6540
- "resource:conflict",
6541
- "server:internal_error"
6542
- ]
6543
- },
6544
6537
  refundCustomerPass: {
6545
6538
  path: "/sites/{siteId}/bookings/customer-passes/{customerPassId}/refund",
6546
6539
  method: "POST",
@@ -8004,7 +7997,7 @@ const API_ENDPOINTS = {
8004
7997
  ]
8005
7998
  },
8006
7999
  cancelFlexibleBalanceBookingDueToNonPayment: {
8007
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/cancel-due-to-non-payment",
8000
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/cancel-due-to-non-payment",
8008
8001
  method: "POST",
8009
8002
  auth: "user",
8010
8003
  responseKind: "json",
@@ -8015,7 +8008,7 @@ const API_ENDPOINTS = {
8015
8008
  ]
8016
8009
  },
8017
8010
  reopenFlexibleBalanceBookingAfterNonPaymentCancellation: {
8018
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/reopen",
8011
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/reopen",
8019
8012
  method: "POST",
8020
8013
  auth: "user",
8021
8014
  responseKind: "json",
@@ -8646,14 +8639,14 @@ async function parseSuccessResponse(endpoint, response, config) {
8646
8639
  default: return buildSuccessEnvelope(void 0, requestId);
8647
8640
  }
8648
8641
  }
8649
- function createRawCMSClient(headers = {}, baseUrl) {
8642
+ function createRawCMSClient(getHeaders = () => ({}), baseUrl) {
8650
8643
  return ({ endpoint, body, params, options = {} }) => {
8651
8644
  const plan = buildApiRequestPlan({
8652
8645
  endpoint,
8653
8646
  body,
8654
8647
  params,
8655
8648
  options,
8656
- headers,
8649
+ headers: getHeaders(),
8657
8650
  baseUrl: normalizeCmsApiBaseUrl(baseUrl ?? resolveApiBaseUrl()),
8658
8651
  sdkVersion
8659
8652
  });
@@ -8758,11 +8751,8 @@ function createParsedClient(rawClient) {
8758
8751
  return parseSuccessResponse(endpoint, response, config);
8759
8752
  };
8760
8753
  }
8761
- function createCMSClient(headers = {}, baseUrl) {
8762
- return createParsedClient(createRawCMSClient(headers, baseUrl));
8763
- }
8764
8754
  function createBearerAPIClient(token, baseUrl) {
8765
- return createCMSClient({ Authorization: `Bearer ${token}` }, baseUrl);
8755
+ return createParsedClient(createRawCMSClient(() => ({ Authorization: `Bearer ${typeof token === "function" ? token() : token}` }), baseUrl));
8766
8756
  }
8767
8757
  //#endregion
8768
8758
  //#region ../preview-next/src/auth-contract.ts
@@ -8788,6 +8778,7 @@ function getPreviewRuntimeSessionAuthMode(session) {
8788
8778
  //#endregion
8789
8779
  //#region ../preview-next/src/client/previewAuthStore.ts
8790
8780
  const listeners = /* @__PURE__ */ new Set();
8781
+ const handledApiAuthErrors = /* @__PURE__ */ new WeakSet();
8791
8782
  let internal = {
8792
8783
  state: "expired",
8793
8784
  session: null,
@@ -8832,6 +8823,15 @@ function usePreviewAuth() {
8832
8823
  function usePreviewToken() {
8833
8824
  return useSyncExternalStore(subscribe, getState, getState).token;
8834
8825
  }
8826
+ function getPreviewAccessToken() {
8827
+ const { token, state } = getState();
8828
+ if (token && state === "ok") return token;
8829
+ markPreviewAuthExpired("query");
8830
+ throw new Error("Preview access token is unavailable");
8831
+ }
8832
+ function setPreviewAccessToken(token) {
8833
+ if (getState().state === "ok") setState({ token });
8834
+ }
8835
8835
  function normalizePreviewRuntimeSession(input) {
8836
8836
  if ("session" in input) return input.session;
8837
8837
  return resolvePreviewRuntimeSession({
@@ -8860,6 +8860,26 @@ function markPreviewAuthExpired(source) {
8860
8860
  token: null
8861
8861
  });
8862
8862
  }
8863
+ /** Handle bearer 401s at the request boundary, including calls outside the query cache. */
8864
+ function createGuardedPreviewApiClient(baseUrl) {
8865
+ return async (params) => {
8866
+ const requestToken = getPreviewAccessToken();
8867
+ try {
8868
+ return await createBearerAPIClient(requestToken, baseUrl)(params);
8869
+ } catch (error) {
8870
+ if (error instanceof ApiRequestError && error.status === 401) {
8871
+ handledApiAuthErrors.add(error);
8872
+ const current = getState();
8873
+ if (current.state === "ok" && current.token === requestToken) markPreviewAuthExpired("query");
8874
+ }
8875
+ throw error;
8876
+ }
8877
+ };
8878
+ }
8879
+ /** Query callbacks receive the same error after the request guard has decided auth state. */
8880
+ function wasPreviewApiAuthErrorHandled(error) {
8881
+ return error instanceof ApiRequestError && handledApiAuthErrors.has(error);
8882
+ }
8863
8883
  function usePreviewAuthFetch(baseFetch) {
8864
8884
  return React$1.useCallback(async (input, init, source) => {
8865
8885
  if (getState().state === "expired") {
@@ -8883,4 +8903,4 @@ function usePreviewAuthFetch(baseFetch) {
8883
8903
  }, [baseFetch]);
8884
8904
  }
8885
8905
  //#endregion
8886
- export { API_ENDPOINTS as _, usePreviewToken as a, createBearerAPIClient as c, unwrapResponse as d, getDashboardUrl as f, resolveSurfaceDocumentAttributes as g, SURFACE_IDS as h, usePreviewAuthFetch as i, ApiEnvelopeError as l, SURFACE_DOCUMENT_DATA_ATTRIBUTE as m, markPreviewAuthExpired as n, isPreviewRuntimeSessionEditable as o, DEFAULT_SURFACE_ID as p, usePreviewAuth as r, ApiRequestError as s, initPreviewAuth as t, extractApiEnvelopeErrorDetails as u };
8906
+ export { SURFACE_IDS as _, usePreviewAuth as a, wasPreviewApiAuthErrorHandled as c, ApiEnvelopeError as d, extractApiEnvelopeErrorDetails as f, SURFACE_DOCUMENT_DATA_ATTRIBUTE as g, DEFAULT_SURFACE_ID as h, setPreviewAccessToken as i, isPreviewRuntimeSessionEditable as l, getDashboardUrl as m, initPreviewAuth as n, usePreviewAuthFetch as o, unwrapResponse as p, markPreviewAuthExpired as r, usePreviewToken as s, createGuardedPreviewApiClient as t, ApiRequestError as u, resolveSurfaceDocumentAttributes as v, API_ENDPOINTS as y };
@@ -1,4 +1,4 @@
1
1
  "use client";
2
- import "./PreviewQueryProvider-5znTyJuz.mjs";
3
- import { i as PreviewShellLayout, r as PreviewShell } from "./SdkPreviewModeRuntime-DJ6utQ_R.mjs";
2
+ import "./PreviewQueryProvider-C0mndwHB.mjs";
3
+ import { i as PreviewShellLayout, r as PreviewShell } from "./SdkPreviewModeRuntime-tj45gmCX.mjs";
4
4
  export { PreviewShell, PreviewShellLayout };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { fo as Primitive, zo as cn } from "./SiteChromeCustomizeContext-CFJYh6vo.mjs";
2
+ import { fo as Primitive, zo as cn } from "./SiteChromeCustomizeContext-BFOt0ss-.mjs";
3
3
  import * as React$1 from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region ../../node_modules/.pnpm/@radix-ui+react-separator@1.1.10_@types+react-dom@19.2.3_@types+react@19.2.17__@types+r_adfab47c9055efb8b0c4b77a2b96b053/node_modules/@radix-ui/react-separator/dist/index.mjs