@riverbankcms/sdk 0.148.0 → 0.149.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/README.md +1 -1
  2. package/dist/{PreviewEditorSidebar-DvEPG3Z2.mjs → PreviewEditorSidebar-DBKln68M.mjs} +103 -66
  3. package/dist/{PreviewEditorUI-D6eb6fkx.mjs → PreviewEditorUI-DpRX4Mum.mjs} +3 -6
  4. package/dist/{PreviewQueryProvider-5znTyJuz.mjs → PreviewQueryProvider-C0mndwHB.mjs} +3 -3
  5. package/dist/{SdkPreviewModeRuntime-DJ6utQ_R.mjs → SdkPreviewModeRuntime-DJPmPY-r.mjs} +95 -67
  6. package/dist/{SiteChromeCustomizeContext-CFJYh6vo.mjs → SiteChromeCustomizeContext-JYA0cJ_Z.mjs} +982 -734
  7. package/dist/_dts/api/src/bookingConfig.d.ts +33 -48
  8. package/dist/_dts/api/src/bookingManagementEndpoints.d.ts +2 -6
  9. package/dist/_dts/api/src/bookingOperations.d.ts +5 -7
  10. package/dist/_dts/api/src/bookingRecords.d.ts +15 -11
  11. package/dist/_dts/api/src/bookingRefundOutcomes.d.ts +5 -5
  12. package/dist/_dts/api/src/clientErrorReporting.d.ts +11 -0
  13. package/dist/_dts/api/src/commercePortalEndpoints.d.ts +0 -2
  14. package/dist/_dts/api/src/common/cancellation.d.ts +23 -0
  15. package/dist/_dts/api/src/customerMembershipOutcomes.d.ts +1 -1
  16. package/dist/_dts/api/src/endpoints.d.ts +2 -10
  17. package/dist/_dts/api/src/eventManagementContracts.d.ts +4 -7
  18. package/dist/_dts/api/src/index.d.ts +3 -3
  19. package/dist/_dts/api/src/publicAppointmentBookingContracts.d.ts +2 -2
  20. package/dist/_dts/api/src/publicExperience/commerceEndpoints.d.ts +2 -29
  21. package/dist/_dts/api/src/request.d.ts +1 -1
  22. package/dist/_dts/api/src/sdk-event-upsert.d.ts +1 -1
  23. package/dist/_dts/api/src/sdkPullEventContracts.d.ts +1 -1
  24. package/dist/_dts/api/src/siteOperations.d.ts +6 -2
  25. package/dist/_dts/blocks/src/contracts/index.d.ts +1 -1
  26. package/dist/_dts/blocks/src/contracts/non-block-islands.d.ts +2 -2
  27. package/dist/_dts/blocks/src/contracts/proof-block-islands.d.ts +38 -10
  28. package/dist/_dts/blocks/src/portal/types.d.ts +9 -6
  29. package/dist/_dts/blocks/src/system/blocks/events/shared/schemas.d.ts +24 -24
  30. package/dist/_dts/blocks/src/system/blocks/events/shared/types.d.ts +1 -1
  31. package/dist/_dts/blocks/src/system/blocks/shared/bookingPaymentTerms.d.ts +84 -160
  32. package/dist/_dts/blocks/src/system/blocks/shop.d.ts +2 -2
  33. package/dist/_dts/blocks/src/system/blocks/shop.shared.d.ts +31 -4
  34. package/dist/_dts/blocks/src/system/runtime/api/types/appointments.d.ts +2 -2
  35. package/dist/_dts/blocks/src/system/runtime/api/types/core.d.ts +3 -1
  36. package/dist/_dts/blocks/src/system/runtime/components/registry.client.d.ts +48 -6
  37. package/dist/_dts/blocks/src/system/runtime/components/runtime-backed-blocks.d.ts +24 -3
  38. package/dist/_dts/blocks/src/system/runtime/hooks/useBookingNowIso.d.ts +8 -0
  39. package/dist/_dts/blocks/src/system/runtime/nodes/booking-form.state.d.ts +2 -1
  40. package/dist/_dts/blocks/src/system/runtime/nodes/commerce/shared/display.d.ts +9 -2
  41. package/dist/_dts/blocks/src/system/runtime/nodes/event-details/presentation.d.ts +14 -2
  42. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/PaymentSelectionStep.d.ts +2 -0
  43. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/eventPaymentOptions.d.ts +3 -3
  44. package/dist/_dts/blocks/src/system/runtime/nodes/event-registration/useEventRegistrationWizard.d.ts +4 -0
  45. package/dist/_dts/blocks/src/system/runtime/nodes/events/shared/eventCollectionContract.d.ts +24 -24
  46. package/dist/_dts/blocks/src/system/runtime/nodes/shop.interactive.d.ts +41 -6
  47. package/dist/_dts/blocks/src/system/runtime/shared/bookingPaymentOptions.d.ts +7 -2
  48. package/dist/_dts/commerce/src/purchase/bookingPaymentSelection.d.ts +54 -0
  49. package/dist/_dts/commerce/src/purchase/checkoutCommitPlan.d.ts +58 -13
  50. package/dist/_dts/commerce/src/purchase/checkoutErrorCodes.d.ts +1 -1
  51. package/dist/_dts/commerce/src/purchase/checkoutPaymentPlanPlanning.d.ts +16 -21
  52. package/dist/_dts/commerce/src/purchase/checkoutPaymentTerms.d.ts +23 -40
  53. package/dist/_dts/commerce/src/purchase/checkoutSessionMetadata.d.ts +2 -2
  54. package/dist/_dts/commerce/src/purchase/checkoutStripeSessionPlanning.d.ts +5 -4
  55. package/dist/_dts/commerce/src/purchase/index.d.ts +1 -3
  56. package/dist/_dts/commerce/src/purchase/membershipOrderItemMetadata.d.ts +4 -0
  57. package/dist/_dts/commerce/src/purchase/oneTimeCheckoutPlanning.d.ts +9 -4
  58. package/dist/_dts/commerce/src/purchase/orderInstalmentClosure.d.ts +13 -1
  59. package/dist/_dts/commerce/src/purchase/orderInstalmentLifecycle.d.ts +5 -0
  60. package/dist/_dts/commerce/src/purchase/orderItemMetadata.d.ts +3 -1
  61. package/dist/_dts/commerce/src/purchase/orderTypes.d.ts +7 -1
  62. package/dist/_dts/commerce/src/purchase/refundRailSplit.d.ts +1 -1
  63. package/dist/_dts/commerce/src/purchase/stateTransitions.d.ts +2 -2
  64. package/dist/_dts/commerce/src/purchase/stripeMinimumCharge.d.ts +6 -0
  65. package/dist/_dts/commerce/src/purchase/types.d.ts +2 -1
  66. package/dist/_dts/content-editor/src/controller/editLeaseHandover.d.ts +30 -0
  67. package/dist/_dts/content-editor/src/lib/browserStorage.d.ts +5 -0
  68. package/dist/_dts/core/src/booking-flexible-balance.d.ts +2 -2
  69. package/dist/_dts/core/src/booking-instalment-deposit.d.ts +20 -0
  70. package/dist/_dts/core/src/booking-live-payment-terms.d.ts +72 -0
  71. package/dist/_dts/core/src/booking-payment-options.d.ts +24 -0
  72. package/dist/_dts/core/src/booking-payment-schemas.d.ts +522 -0
  73. package/dist/_dts/core/src/branded.d.ts +3 -0
  74. package/dist/_dts/core/src/edit-lease.d.ts +5 -0
  75. package/dist/_dts/core/src/index.d.ts +3 -0
  76. package/dist/_dts/db/src/generated/supabase/database.types.d.ts +297 -36
  77. package/dist/_dts/media-editor/src/MediaPickerDialog.d.ts +3 -1
  78. package/dist/_dts/media-editor/src/MediaPickerMiniDialog.d.ts +10 -0
  79. package/dist/_dts/media-editor/src/index.d.ts +2 -0
  80. package/dist/_dts/preview-next/src/client/preview/PreviewEntryControllerProvider.d.ts +0 -1
  81. package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +1 -1
  82. package/dist/_dts/preview-next/src/client/previewAuthStore.d.ts +7 -0
  83. package/dist/_dts/preview-next/src/constants.d.ts +4 -0
  84. package/dist/_dts/preview-next/src/keepAlive.d.ts +1 -0
  85. package/dist/_dts/sdk/src/rendering/islands/types.d.ts +2 -12
  86. package/dist/_dts/sdk/src/version.d.ts +1 -1
  87. package/dist/_dts/theme-core/src/site-styles/pageDesignIntent.d.ts +0 -5
  88. package/dist/_dts/ui/src/color-picker.d.ts +1 -1
  89. package/dist/_dts/ui/src/palette/useHexDraft.d.ts +7 -0
  90. package/dist/client/{BookingMailingListNote-CzRt2dF_.mjs → BookingMailingListNote-Cr3EeTP5.mjs} +408 -69
  91. package/dist/client/{DemoBookingPortalAccess-mxqwap3f.mjs → DemoBookingPortalAccess-BFGB1Fay.mjs} +2 -2
  92. package/dist/client/{EventCombined.client-CDb11igO.mjs → EventCombined.client-DKYV0_ft.mjs} +6 -6
  93. package/dist/client/{EventListing.client-EgYhzKPa.mjs → EventListing.client-B9UIcEYc.mjs} +2 -2
  94. package/dist/client/{LeafletStaticMap-gtmtaA2b.mjs → LeafletStaticMap-CFLPkP0K.mjs} +1 -1
  95. package/dist/client/{TerminalPanel-DvNUP5ot.mjs → TerminalPanel-JjmgxEsR.mjs} +1 -1
  96. package/dist/client/{ThemedButton-C7CeUJjW.mjs → ThemedButton-CKV1Jh2m.mjs} +1 -1
  97. package/dist/client/{accordion-kjvt49rA.mjs → accordion-DXWIfT3T.mjs} +1 -1
  98. package/dist/client/{bookingForm-pbRZordh.mjs → bookingForm-CjZgHNvv.mjs} +11 -8
  99. package/dist/client/bookings.mjs +424 -320
  100. package/dist/client/{carousel-f4Zbmicv.mjs → carousel-DSLikmvZ.mjs} +1 -1
  101. package/dist/client/{cart-DO20An50.mjs → cart-HDjWReFt.mjs} +3 -3
  102. package/dist/client/{checkout-Du5amDR_.mjs → checkout-CUvRZA3W.mjs} +3 -3
  103. package/dist/client/client.mjs +963 -866
  104. package/dist/client/{context-eW97E945.mjs → context-DFmaZa-Q.mjs} +1 -1
  105. package/dist/client/{dates-jPCirRea.mjs → dates-BBep1JnF.mjs} +2 -2
  106. package/dist/client/{eventCalendar-C2M-iE4j.mjs → eventCalendar-zEobhxo4.mjs} +9 -9
  107. package/dist/client/{eventCombined-W6ns3LHg.mjs → eventCombined-Dp7bz5k-.mjs} +4 -4
  108. package/dist/client/{eventDetails-CR-GT0f0.mjs → eventDetails-FE-zqTt7.mjs} +4 -4
  109. package/dist/client/{eventListing-BK8AfYZz.mjs → eventListing-BMt5snal.mjs} +4 -4
  110. package/dist/client/{eventRegistration-BJSd4KUu.mjs → eventRegistration-O6ZxHfOb.mjs} +67 -342
  111. package/dist/client/{form-BvpfbQaT.mjs → form-DFa1D8vt.mjs} +3 -3
  112. package/dist/client/{headerSection-I5sUQ8x-.mjs → headerSection-CmjHLR-N.mjs} +3 -3
  113. package/dist/client/hooks.mjs +160 -129
  114. package/dist/client/{locationMap-BLvwf9_f.mjs → locationMap-BXKP_lGh.mjs} +3 -3
  115. package/dist/client/{newsletterForm-DrQ2weE8.mjs → newsletterForm-CU-HmxGx.mjs} +3 -3
  116. package/dist/client/{pricing-BES87mrR.mjs → pricing-KEAEsibq.mjs} +1 -1
  117. package/dist/client/{productDetail-Url9jcc5.mjs → productDetail-Ckp7MGnt.mjs} +3 -3
  118. package/dist/client/{productList-DE7ngEZJ.mjs → productList-D91V0sYa.mjs} +3 -3
  119. package/dist/client/{propsDecoder-D1OtGXDV.mjs → propsDecoder-DZd6RJeA.mjs} +155 -77
  120. package/dist/client/rendering/client.mjs +3356 -3192
  121. package/dist/client/rendering/islands.mjs +17 -17
  122. package/dist/client/rendering.mjs +956 -841
  123. package/dist/client/{routeIslandApiConfig-BG9Y-SHg.mjs → routeIslandApiConfig-E1EkhhYY.mjs} +1 -1
  124. package/dist/client/{shop-CJkuySJ3.mjs → shop-4F2jLQPI.mjs} +12 -13
  125. package/dist/client/{shop-commerce-4rKj5n9h.mjs → shop-commerce-BbfCJjB3.mjs} +6 -6
  126. package/dist/client/{shop-commerce-store-Bxm75Pg6.mjs → shop-commerce-store-vicweP2K.mjs} +1 -1
  127. package/dist/client/{shopShared-DpoQDWfz.mjs → shopShared-DlONJt0T.mjs} +4 -4
  128. package/dist/client/{useEventFilters-D8HliSqR.mjs → useEventFilters-COYyL3m7.mjs} +6 -6
  129. package/dist/preview-next/before-render.mjs +15 -22
  130. package/dist/preview-next/client/runtime.mjs +4 -4
  131. package/dist/preview-next/constants.mjs +5 -1
  132. package/dist/preview-next/index.mjs +5 -1
  133. package/dist/preview-next/keepAlive.mjs +149 -82
  134. package/dist/preview-next/middleware.mjs +15 -22
  135. package/dist/{previewAuthStore-BXXF3hhW.mjs → previewAuthStore-BBmV7UsW.mjs} +49 -29
  136. package/dist/{sdk-runtime-C2a05WjL.mjs → sdk-runtime-CwvFFjB-.mjs} +2 -2
  137. package/dist/{separator-CuNhBAhS.mjs → separator-ByL72zUT.mjs} +1 -1
  138. package/dist/server/components.mjs +167 -131
  139. package/dist/server/config-validation.mjs +160 -129
  140. package/dist/server/config.mjs +160 -129
  141. package/dist/server/data.mjs +160 -129
  142. package/dist/server/index.mjs +20 -27
  143. package/dist/server/next.mjs +174 -156
  144. package/dist/server/page-converter.mjs +145 -65
  145. package/dist/server/prebuild.mjs +1 -1
  146. package/dist/server/rendering/server.mjs +169 -131
  147. package/dist/server/rendering.mjs +167 -131
  148. package/dist/server/routing.mjs +165 -118
  149. package/dist/server/server.mjs +167 -154
  150. package/package.json +1 -1
  151. package/dist/_dts/api/src/bookingPaymentTermSchemas.d.ts +0 -123
  152. package/dist/_dts/commerce/src/purchase/checkoutPaymentTermPlanning.d.ts +0 -10
  153. package/dist/_dts/commerce/src/purchase/checkoutValidatedItemPlanning.d.ts +0 -55
  154. package/dist/_dts/commerce/src/purchase/orderInstalmentPayoff.d.ts +0 -24
@@ -1,4 +1,4 @@
1
- import { G as createHostedBlockApiConfig } from "./propsDecoder-D1OtGXDV.mjs";
1
+ import { G as createHostedBlockApiConfig } from "./propsDecoder-DZd6RJeA.mjs";
2
2
  //#region src/rendering/islands/enhancers/routeIslandApiConfig.ts
3
3
  function buildRouteIslandApiConfig({ apiBaseUrl, portalToken, previewToken, siteId, stage, readAuthority }) {
4
4
  if (readAuthority) return createHostedBlockApiConfig({
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { Tn as assertNever$1, Wt as assertNever, kt as getShopSuccessCopy, o as formatCommercePrice, s as formatInterval, t as defineIslandPropsDecoder } from "./propsDecoder-D1OtGXDV.mjs";
3
- import { n as useBlockApi } from "./context-eW97E945.mjs";
4
- import { d as storeDemoBookingCheckoutReturn, o as DiscountCodeDisclosure, t as BookingConfirmation, u as readDemoBookingCheckoutReturnEmail } from "./DemoBookingPortalAccess-mxqwap3f.mjs";
5
- import { a as useDiscountCodeUi, i as CheckIcon, n as StateIcon, r as scrollToBlock, t as TerminalPanel } from "./TerminalPanel-DvNUP5ot.mjs";
6
- import { t as ThemedButton } from "./ThemedButton-C7CeUJjW.mjs";
2
+ import { Tn as assertNever$1, Wt as assertNever, kt as getShopSuccessCopy, o as formatCommercePrice, s as formatInterval, t as defineIslandPropsDecoder } from "./propsDecoder-DZd6RJeA.mjs";
3
+ import { n as useBlockApi } from "./context-DFmaZa-Q.mjs";
4
+ import { d as storeDemoBookingCheckoutReturn, o as DiscountCodeDisclosure, t as BookingConfirmation, u as readDemoBookingCheckoutReturnEmail } from "./DemoBookingPortalAccess-BFGB1Fay.mjs";
5
+ import { a as useDiscountCodeUi, i as CheckIcon, n as StateIcon, r as scrollToBlock, t as TerminalPanel } from "./TerminalPanel-JjmgxEsR.mjs";
6
+ import { t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
7
7
  import { t as FeedbackMessage } from "./FeedbackMessage-CtLvvS_d.mjs";
8
8
  import { t as createBodyThemePortalRoot } from "./themePortalRoot-AGs4cE7t.mjs";
9
9
  import { n as consumeSearchParams } from "./urlParams-D71VXFGx.mjs";
10
10
  import { t as CrossIcon } from "./CrossIcon-Dn1KRKW5.mjs";
11
- import { _ as MembershipCardView, a as getDiscountApplyFeedback, b as PassesMembershipsSectionView, d as planDirectShopCheckoutRequest, i as getAppliedDiscountCode, m as useTransientShopAddFeedback, n as useDiscountApply, o as initialDiscountApplyState, p as ShopAddFeedback, r as discountApplyReducer, s as isDiscountApplyInFlight, t as mountShopBlockIsland, v as PassCardView, y as PassPurchaseUnavailable } from "./shopShared-DpoQDWfz.mjs";
12
- import { t as addPassToCommerceCart } from "./shop-commerce-store-Bxm75Pg6.mjs";
11
+ import { _ as MembershipCardView, a as getDiscountApplyFeedback, b as PassesMembershipsSectionView, d as planDirectShopCheckoutRequest, i as getAppliedDiscountCode, m as useTransientShopAddFeedback, n as useDiscountApply, o as initialDiscountApplyState, p as ShopAddFeedback, r as discountApplyReducer, s as isDiscountApplyInFlight, t as mountShopBlockIsland, v as PassCardView, y as PassPurchaseUnavailable } from "./shopShared-DlONJt0T.mjs";
12
+ import { t as addPassToCommerceCart } from "./shop-commerce-store-vicweP2K.mjs";
13
13
  import { t as ModalShell } from "./ModalShell-CqkBvBIC.mjs";
14
14
  import React, { useCallback, useEffect, useRef, useState } from "react";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -441,19 +441,18 @@ function PassesMembershipsController({ render }) {
441
441
  }, passDisplay.id);
442
442
  }),
443
443
  membershipCards: display.memberships.map((membershipDisplay) => {
444
- const membership = hydration.memberships.find((candidate) => candidate.id === membershipDisplay.id);
445
- if (!membership) return null;
444
+ const { action } = membershipDisplay;
446
445
  return /* @__PURE__ */ jsx(MembershipCardView, {
447
446
  display: membershipDisplay,
448
- action: /* @__PURE__ */ jsx(ThemedButton, {
447
+ action: action.kind === "unavailable" ? /* @__PURE__ */ jsx(PassPurchaseUnavailable, { label: action.label }) : /* @__PURE__ */ jsx(ThemedButton, {
449
448
  type: "button",
450
449
  variant: hydration.buttonVariant,
451
450
  size: "md",
452
451
  extraClassName: "shop__cta",
453
- label: membershipDisplay.actionLabel,
454
- onClick: () => handleSubscribe(membership)
452
+ label: action.label,
453
+ onClick: () => handleSubscribe(action.product)
455
454
  })
456
- }, membership.id);
455
+ }, membershipDisplay.id);
457
456
  })
458
457
  })
459
458
  }), checkout ? /* @__PURE__ */ jsx(ModalShell, {
@@ -1,15 +1,15 @@
1
1
  "use client";
2
- import { Gt as clearWorkflowFeedback, Ht as RichTextDocSchema, Wt as assertNever, Yt as reportWorkflowError, a as buildProductDetailDisplay, bt as logger, d as deriveCommerceCheckoutState, i as buildProductCardDisplay, n as getShopDisplayForItems, o as formatCommercePrice, p as productItemKey, u as buildProductCartItem } from "./propsDecoder-D1OtGXDV.mjs";
3
- import { n as useBlockApi } from "./context-eW97E945.mjs";
4
- import { d as storeDemoBookingCheckoutReturn, n as DemoBookingPortalAccess, o as DiscountCodeDisclosure, u as readDemoBookingCheckoutReturnEmail } from "./DemoBookingPortalAccess-mxqwap3f.mjs";
5
- import { n as ThemedButtonLink, t as ThemedButton } from "./ThemedButton-C7CeUJjW.mjs";
2
+ import { Gt as clearWorkflowFeedback, Ht as RichTextDocSchema, Wt as assertNever, Yt as reportWorkflowError, a as buildProductDetailDisplay, bt as logger, d as deriveCommerceCheckoutState, i as buildProductCardDisplay, n as getShopDisplayForItems, o as formatCommercePrice, p as productItemKey, u as buildProductCartItem } from "./propsDecoder-DZd6RJeA.mjs";
3
+ import { n as useBlockApi } from "./context-DFmaZa-Q.mjs";
4
+ import { d as storeDemoBookingCheckoutReturn, n as DemoBookingPortalAccess, o as DiscountCodeDisclosure, u as readDemoBookingCheckoutReturnEmail } from "./DemoBookingPortalAccess-BFGB1Fay.mjs";
5
+ import { n as ThemedButtonLink, t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
6
6
  import { t as FeedbackMessage } from "./FeedbackMessage-CtLvvS_d.mjs";
7
7
  import { n as RichText, t as buildCheckoutReturnUrls } from "./checkoutUrls-CXhko2Rv.mjs";
8
8
  import { t as consumeSearchParam } from "./urlParams-D71VXFGx.mjs";
9
9
  import { t as CarouselNodeClient } from "./carousel.client-A2lG-9od.mjs";
10
10
  import { t as resolveDedicatedCheckoutPath } from "./checkoutRoute-ClwHwYVA.mjs";
11
- import { C as ProductGalleryFrameView, S as ProductDetailView, T as VariantSelectView, a as getDiscountApplyFeedback, c as aggregateCartDiscountUiState, f as planUnifiedCheckoutRequest, g as CheckoutShellView, h as CartShellView, i as getAppliedDiscountCode, l as checkoutFormForDiscountUiState, m as useTransientShopAddFeedback, n as useDiscountApply, o as initialDiscountApplyState, p as ShopAddFeedback, r as discountApplyReducer, s as isDiscountApplyInFlight, u as planCartDiscountAvailabilityRequests, w as ProductListSectionView, x as ProductCardView } from "./shopShared-DpoQDWfz.mjs";
12
- import { n as useCommerceCart } from "./shop-commerce-store-Bxm75Pg6.mjs";
11
+ import { C as ProductGalleryFrameView, S as ProductDetailView, T as VariantSelectView, a as getDiscountApplyFeedback, c as aggregateCartDiscountUiState, f as planUnifiedCheckoutRequest, g as CheckoutShellView, h as CartShellView, i as getAppliedDiscountCode, l as checkoutFormForDiscountUiState, m as useTransientShopAddFeedback, n as useDiscountApply, o as initialDiscountApplyState, p as ShopAddFeedback, r as discountApplyReducer, s as isDiscountApplyInFlight, u as planCartDiscountAvailabilityRequests, w as ProductListSectionView, x as ProductCardView } from "./shopShared-DlONJt0T.mjs";
12
+ import { n as useCommerceCart } from "./shop-commerce-store-vicweP2K.mjs";
13
13
  import * as React$1 from "react";
14
14
  import { useEffect, useState } from "react";
15
15
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { c as EMPTY_COMMERCE_CART_STATE, f as parseStoredCommerceCartState, l as buildPassCartItem, m as reduceCommerceCart } from "./propsDecoder-D1OtGXDV.mjs";
2
+ import { c as EMPTY_COMMERCE_CART_STATE, f as parseStoredCommerceCartState, l as buildPassCartItem, m as reduceCommerceCart } from "./propsDecoder-DZd6RJeA.mjs";
3
3
  import * as React$1 from "react";
4
4
  //#region ../blocks/src/system/runtime/nodes/shop-commerce-store.ts
5
5
  const EMPTY_STATE = EMPTY_COMMERCE_CART_STATE;
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import { D as ok, E as err } from "./colorStyles-j5U9v5JA.mjs";
3
- import { Wt as assertNever } from "./propsDecoder-D1OtGXDV.mjs";
4
- import { t as BlockApiProvider } from "./context-eW97E945.mjs";
5
- import { c as discountAvailabilityHasDiscounts, l as getAutoAppliedDiscountPreview, s as discountAvailabilityAllowsManualEntry } from "./DemoBookingPortalAccess-mxqwap3f.mjs";
3
+ import { Wt as assertNever } from "./propsDecoder-DZd6RJeA.mjs";
4
+ import { t as BlockApiProvider } from "./context-DFmaZa-Q.mjs";
5
+ import { c as discountAvailabilityHasDiscounts, l as getAutoAppliedDiscountPreview, s as discountAvailabilityAllowsManualEntry } from "./DemoBookingPortalAccess-BFGB1Fay.mjs";
6
6
  import { t as FeedbackMessage } from "./FeedbackMessage-CtLvvS_d.mjs";
7
7
  import { t as mountReactIsland } from "./reactMount-SY8AVRof.mjs";
8
- import { t as buildRouteIslandApiConfig } from "./routeIslandApiConfig-BG9Y-SHg.mjs";
8
+ import { t as buildRouteIslandApiConfig } from "./routeIslandApiConfig-E1EkhhYY.mjs";
9
9
  import * as React$1 from "react";
10
10
  import { useCallback } from "react";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import { d as hexToRgb, u as relativeLuminance } from "./colorStyles-j5U9v5JA.mjs";
3
- import { F as resolveSpacing, J as getEventRuntimeFiltersKey, K as getBlockApiReadStage, N as SEMANTIC_SPACING_VALUES, P as isSemanticSpacing, Wt as assertNever, X as normalizeCsvString, Y as normalizeCsvIds, Z as normalizeOptionalId, gt as resolveTokenOrCssColorValue, ht as resolveOnColorForThemeToken, mt as isCssColorLiteral, pt as boxBackgroundSchema, yt as normalizeCardRole } from "./propsDecoder-D1OtGXDV.mjs";
3
+ import { F as resolveSpacing, J as getEventRuntimeFiltersKey, K as getBlockApiReadStage, N as SEMANTIC_SPACING_VALUES, P as isSemanticSpacing, Wt as assertNever, X as normalizeCsvString, Y as normalizeCsvIds, Z as normalizeOptionalId, gt as resolveTokenOrCssColorValue, ht as resolveOnColorForThemeToken, mt as isCssColorLiteral, pt as boxBackgroundSchema, yt as normalizeCardRole } from "./propsDecoder-DZd6RJeA.mjs";
4
4
  import { a as getCurrentResolveImageUrlContext, i as computeMediaTransformStyle, l as resolveMediaNodeResponsiveImage, n as MediaPlaceholder, o as renderAudio, s as renderVideo, t as ImagePresets } from "./media-Cl38iOMI.mjs";
5
- import { o as formatEventRemainingPlaces, t as formatEventPrice } from "./pricing-BES87mrR.mjs";
6
- import { a as formatEventNextDateFact, f as resolveEventCta, n as formatDate, o as formatEventTimeRange, p as resolveEventLinkProps, r as formatEventCompactDateRail, s as formatTime, t as eventDateOptions } from "./dates-jPCirRea.mjs";
7
- import { n as useBlockApi } from "./context-eW97E945.mjs";
8
- import { n as ThemedButtonLink, r as ClockIcon, t as ThemedButton } from "./ThemedButton-C7CeUJjW.mjs";
9
- import { t as LeafletStaticMap } from "./LeafletStaticMap-gtmtaA2b.mjs";
5
+ import { o as formatEventRemainingPlaces, t as formatEventPrice } from "./pricing-KEAEsibq.mjs";
6
+ import { a as formatEventNextDateFact, f as resolveEventCta, n as formatDate, o as formatEventTimeRange, p as resolveEventLinkProps, r as formatEventCompactDateRail, s as formatTime, t as eventDateOptions } from "./dates-BBep1JnF.mjs";
7
+ import { n as useBlockApi } from "./context-DFmaZa-Q.mjs";
8
+ import { n as ThemedButtonLink, r as ClockIcon, t as ThemedButton } from "./ThemedButton-CKV1Jh2m.mjs";
9
+ import { t as LeafletStaticMap } from "./LeafletStaticMap-CFLPkP0K.mjs";
10
10
  import { useCallback, useEffect, useId, useMemo, useReducer, useRef, useState } from "react";
11
11
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
12
12
  //#region ../theme-core/src/palette/utils/textColor.ts
@@ -2816,7 +2816,8 @@ const CLIENT_ERROR_REPORT_LIMITS = {
2816
2816
  stack: 8e3,
2817
2817
  digest: 128,
2818
2818
  componentStack: 8e3,
2819
- sourceLocation: 1024
2819
+ sourceLocation: 1024,
2820
+ navigationAgeMs: 6e4
2820
2821
  };
2821
2822
  const clientErrorEventSchema = z.enum([
2822
2823
  "dashboard:route-error",
@@ -2833,7 +2834,17 @@ z.object({
2833
2834
  stack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.stack).nullable(),
2834
2835
  digest: z.string().max(CLIENT_ERROR_REPORT_LIMITS.digest).nullable(),
2835
2836
  componentStack: z.string().max(CLIENT_ERROR_REPORT_LIMITS.componentStack).nullable(),
2836
- sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable()
2837
+ sourceLocation: z.string().max(CLIENT_ERROR_REPORT_LIMITS.sourceLocation).nullable(),
2838
+ navigation: z.object({
2839
+ fromPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2840
+ toPathname: z.string().regex(/^\/[^?#]*$/).max(CLIENT_ERROR_REPORT_LIMITS.pathname),
2841
+ type: z.enum([
2842
+ "push",
2843
+ "replace",
2844
+ "traverse"
2845
+ ]),
2846
+ ageMs: z.number().int().min(0).max(CLIENT_ERROR_REPORT_LIMITS.navigationAgeMs)
2847
+ }).strict().nullable().optional()
2837
2848
  }).strict();
2838
2849
  const API_ENDPOINTS = {
2839
2850
  ...SITE_LIFECYCLE_ENDPOINT_DEFINITIONS,
@@ -6590,24 +6601,6 @@ const API_ENDPOINTS = {
6590
6601
  "server:internal_error"
6591
6602
  ]
6592
6603
  },
6593
- syncBookingPassWithStripe: {
6594
- path: "/sites/{siteId}/bookings/passes/{passId}/sync-stripe",
6595
- method: "POST",
6596
- tags: [
6597
- "site-{siteId}",
6598
- "passes-{siteId}",
6599
- "pass-{passId}"
6600
- ],
6601
- auth: "user",
6602
- responseKind: "json",
6603
- errors: [
6604
- "validation:invalid_input",
6605
- "auth:forbidden",
6606
- "resource:not_found",
6607
- "resource:conflict",
6608
- "server:internal_error"
6609
- ]
6610
- },
6611
6604
  refundCustomerPass: {
6612
6605
  path: "/sites/{siteId}/bookings/customer-passes/{customerPassId}/refund",
6613
6606
  method: "POST",
@@ -8071,7 +8064,7 @@ const API_ENDPOINTS = {
8071
8064
  ]
8072
8065
  },
8073
8066
  cancelFlexibleBalanceBookingDueToNonPayment: {
8074
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/cancel-due-to-non-payment",
8067
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/cancel-due-to-non-payment",
8075
8068
  method: "POST",
8076
8069
  auth: "user",
8077
8070
  responseKind: "json",
@@ -8082,7 +8075,7 @@ const API_ENDPOINTS = {
8082
8075
  ]
8083
8076
  },
8084
8077
  reopenFlexibleBalanceBookingAfterNonPaymentCancellation: {
8085
- path: "/sites/{siteId}/shop/orders/{orderId}/items/{orderItemId}/flexible-balance/reopen",
8078
+ path: "/sites/{siteId}/shop/orders/{orderId}/flexible-balance/reopen",
8086
8079
  method: "POST",
8087
8080
  auth: "user",
8088
8081
  responseKind: "json",
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import { a as usePreviewLayout, i as useOptionalPreviewLayout, n as createPreviewQueryClient, r as PreviewLayoutProvider, t as PreviewQueryProvider } from "../../PreviewQueryProvider-5znTyJuz.mjs";
2
+ import { a as usePreviewLayout, i as useOptionalPreviewLayout, n as createPreviewQueryClient, r as PreviewLayoutProvider, t as PreviewQueryProvider } from "../../PreviewQueryProvider-C0mndwHB.mjs";
3
3
  import React from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  //#region src/preview-next/client/runtime.tsx
6
6
  const LazySdkPreviewMode = React.lazy(async () => {
7
- return { default: (await import("../../SdkPreviewModeRuntime-DJ6utQ_R.mjs").then((n) => n.n)).SdkPreviewModeRuntime };
7
+ return { default: (await import("../../SdkPreviewModeRuntime-DJPmPY-r.mjs").then((n) => n.n)).SdkPreviewModeRuntime };
8
8
  });
9
9
  const LazyPreviewShell = React.lazy(async () => {
10
- return { default: (await import("../../sdk-runtime-C2a05WjL.mjs")).PreviewShell };
10
+ return { default: (await import("../../sdk-runtime-CwvFFjB-.mjs")).PreviewShell };
11
11
  });
12
12
  const LazyPreviewShellLayout = React.lazy(async () => {
13
- return { default: (await import("../../sdk-runtime-C2a05WjL.mjs")).PreviewShellLayout };
13
+ return { default: (await import("../../sdk-runtime-CwvFFjB-.mjs")).PreviewShellLayout };
14
14
  });
15
15
  function SdkPreviewMode(props) {
16
16
  return /* @__PURE__ */ jsx(React.Suspense, {
@@ -4,5 +4,9 @@ const PREVIEW_REFRESH_COOKIE_NAME = "preview_refresh_token";
4
4
  const PREVIEW_COOKIE_MAX_AGE = 3600 * 12;
5
5
  const PREVIEW_CODE_PARAM = "preview_code";
6
6
  const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
7
+ const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
8
+ const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
9
+ const PREVIEW_KEEP_ALIVE_MAX_INTERVAL_MS = PREVIEW_KEEP_ALIVE_INTERVAL_MS * 1.1;
10
+ const PREVIEW_REFRESH_THRESHOLD_SECONDS = 900;
7
11
  //#endregion
8
- export { PREVIEW_CODE_PARAM, PREVIEW_COOKIE_MAX_AGE, PREVIEW_COOKIE_NAME, PREVIEW_REFRESH_COOKIE_NAME, PREVIEW_THEME_COOKIE_NAME };
12
+ export { PREVIEW_CODE_PARAM, PREVIEW_COOKIE_MAX_AGE, PREVIEW_COOKIE_NAME, PREVIEW_KEEP_ALIVE_INTERVAL_MS, PREVIEW_KEEP_ALIVE_JITTER_RATIO, PREVIEW_KEEP_ALIVE_MAX_INTERVAL_MS, PREVIEW_REFRESH_COOKIE_NAME, PREVIEW_REFRESH_THRESHOLD_SECONDS, PREVIEW_THEME_COOKIE_NAME };
@@ -4,6 +4,10 @@ const PREVIEW_REFRESH_COOKIE_NAME = "preview_refresh_token";
4
4
  const PREVIEW_COOKIE_MAX_AGE = 3600 * 12;
5
5
  const PREVIEW_CODE_PARAM = "preview_code";
6
6
  const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
7
+ const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
8
+ const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
9
+ const PREVIEW_KEEP_ALIVE_MAX_INTERVAL_MS = PREVIEW_KEEP_ALIVE_INTERVAL_MS * 1.1;
10
+ const PREVIEW_REFRESH_THRESHOLD_SECONDS = 900;
7
11
  //#endregion
8
12
  //#region ../preview-next/src/cookies.ts
9
13
  function getPreviewCookieOptions(options = {}) {
@@ -35,4 +39,4 @@ function clearPreviewCookies(res) {
35
39
  return res;
36
40
  }
37
41
  //#endregion
38
- export { PREVIEW_CODE_PARAM, PREVIEW_COOKIE_MAX_AGE, PREVIEW_COOKIE_NAME, PREVIEW_REFRESH_COOKIE_NAME, PREVIEW_THEME_COOKIE_NAME, clearPreviewCookies, setPreviewAuthCookies, setPreviewCookie, setPreviewRefreshCookie };
42
+ export { PREVIEW_CODE_PARAM, PREVIEW_COOKIE_MAX_AGE, PREVIEW_COOKIE_NAME, PREVIEW_KEEP_ALIVE_INTERVAL_MS, PREVIEW_KEEP_ALIVE_JITTER_RATIO, PREVIEW_KEEP_ALIVE_MAX_INTERVAL_MS, PREVIEW_REFRESH_COOKIE_NAME, PREVIEW_REFRESH_THRESHOLD_SECONDS, PREVIEW_THEME_COOKIE_NAME, clearPreviewCookies, setPreviewAuthCookies, setPreviewCookie, setPreviewRefreshCookie };
@@ -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",