@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
package/README.md CHANGED
@@ -2835,7 +2835,7 @@ import {
2835
2835
 
2836
2836
  ## Content Configuration (SDK Content Scaffolding)
2837
2837
 
2838
- Define content type schema and SDK-managed configuration in code. File-based documents such as pages, entries, navigation, and settings live in `content/**` and sync with explicit `riverbankcms push` scopes; `push-config` syncs schema/config surfaces only.
2838
+ Define content type schema and SDK-managed configuration in code. File-based documents such as pages, entries, navigation, and settings live in `content/**` and sync with explicit `riverbankcms push` scopes; `push-config` syncs schema/config surfaces only. An existing page or slot block keeps its kind: to use a different kind, create a block with a new identifier and remove the old block.
2839
2839
 
2840
2840
  ### Quick Start
2841
2841
 
@@ -1,8 +1,8 @@
1
1
  "use client";
2
- import { $ as FooterComposerPanel, $i as VARIANT_ROLES, $o as valueStatus, $t as createStoreBackend, A as markApplySaving, Ai as curatedSiteStyles, An as listPageSurfaceContentSlots, B as setPaletteColors, Ba as CalloutDescription, Bn as resolvePageRouteSlug, C as cancelPreview, D as isPreviewingChange, Do as Maximize2, E as dismissWarnings, Eo as Monitor, F as previewFooterLook, Fa as SelectContent, Fn as routeLifecycleContext, Fo as ChevronDown, Ga as Input, Gi as curatedPalettes, H as syncStyleConfiguratorState, Ha as Popover, Hn as useEditorUiStore, I as previewHeaderLayout, Ia as SelectItem, Ii as resolveSdkFooterMode, Io as Check, Ja as TabsList, Ji as findButtonStyleRecipe, Jt as BlockEditor, Ka as Tabs, Ki as buttonStyleHoverPreferenceValue, L as previewHeaderStyle, La as SelectTrigger, Li as findFooterLook, Ln as isAdapterReferenceKind, Lo as Button, M as palettePreviewProjection, Mi as getCuratedSiteStyle, N as previewButtonStyle, No as ChevronRight, O as markApplyFailed, On as createManifestValidation, Oo as LoaderCircle, P as previewCuratedPalette, Pa as Select, Po as ChevronLeft, Q as resolvePreviewSidebarTab, Qi as buttonStyleSelectionKey, Qo as syncStateOf, Qt as FormRenderer, R as previewSiteStyle, Ra as SelectValue, Ri as getHeaderLayout, S as applyTypographyDraftPatch, T as deriveStyleConfiguratorCapabilities, U as toggleRow, Ua as PopoverContent, Un as useEditorUiStoreInstance, Uo as canWriteLinkedEntry, V as styleConfiguratorHistoryEntryForPersistedSelection, Va as SearchInput, Vn as resolveContentTitle, Vo as isEdited, Wa as PopoverTrigger, X as resolveStyleConfiguratorInitialSnapshot, Xi as updateButtonStyleHoverPreference, Ya as TabsTrigger, Yi as resolveButtonStyleSelection, Z as createOptimisticActionRunner, Zi as updateButtonStyleSelectionChoice, Zo as displayedValues, Zt as ManifestForm, _ as reportPreviewDesignError, _a as paletteColorEntries, _o as Tablet, ao as Surface, at as ContentFieldsForm, b as planSiteChromeSelection, bo as SlidersHorizontal, c as selectionSnapshotFromApplySiteStyleSelectionResponse, co as DropdownMenuItem, do as DropdownMenuTrigger, f as usePreviewDesignCoordinator, ft as useAutosaveStatus, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, io as CollapsibleTrigger, ir as toEditorBlockItem, j as openRow, jn as blocksKeys, jr as ThemedButtonSpecimen, k as markApplySaved, kn as listEntryPageContentSlots, l as deriveSiteStylePreviewUpdate, lo as DropdownMenuLabel, lt as useEntryController, n as useSiteChromeCustomizeOptional, no as Collapsible, oo as DropdownMenu, ot as useUISelector, po as X$1, qa as TabsContent, qi as buttonStyleSelectionParameterValue, ro as CollapsibleContent, s as buildApplySiteStyleSelectionBody, so as DropdownMenuContent, sr as ThemeScope, ts as assertNever$1, u as planConfiguratorPreview, uo as DropdownMenuSeparator, v as buildSiteChromeSelectionModels, va as paletteColorsSchema, vt as LinkedEntryLeaseBanner, w as createStyleConfiguratorState, x as applyResolvedSelections, y as cycleSiteChromeSelectionId, yo as Smartphone, z as resetTypographyToSaved, za as Callout, zi as getHeaderStyle, zn as deriveRouteMetadataPresentation, zo as cn } from "./SiteChromeCustomizeContext-CFJYh6vo.mjs";
3
- import { d as unwrapResponse, f as getDashboardUrl, r as usePreviewAuth } from "./previewAuthStore-BXXF3hhW.mjs";
4
- import { S as getSiteFontsStorageUrl, _ as usePreviewBlockCustomizeSelectionOptional, b as buildFontPreviewUrl, d as buildPreviewDashboardSetupUrl, f as resolvePreviewDashboardSetupHandoff, g as useBlockCustomizeControls, h as usePreviewSiteFontStorageUrl, m as resolvePreviewSidebarChromeModel, p as resolvePreviewEditorGuidanceModel, u as canInspectSiteStyle, v as PreviewFormProvider, x as generateFontFaceCss, y as previewWidgetOverrides } from "./SdkPreviewModeRuntime-DJ6utQ_R.mjs";
5
- import { t as Separator } from "./separator-CuNhBAhS.mjs";
2
+ import { $ as FooterComposerPanel, $i as VARIANT_ROLES, $o as syncStateOf, $t as createStoreBackend, A as markApplySaving, Ai as curatedSiteStyles, An as listPageSurfaceContentSlots, B as setPaletteColors, Ba as CalloutDescription, Bn as resolvePageRouteSlug, C as cancelPreview, D as isPreviewingChange, Do as Maximize2, E as dismissWarnings, Eo as Monitor, F as previewFooterLook, Fa as SelectContent, Fn as routeLifecycleContext, Fo as ChevronDown, Ga as Input, Gi as curatedPalettes, H as syncStyleConfiguratorState, Ha as Popover, Hn as useEditorUiStore, I as previewHeaderLayout, Ia as SelectItem, Ii as resolveSdkFooterMode, Io as Check, Ja as TabsList, Ji as findButtonStyleRecipe, Jt as BlockEditor, Ka as Tabs, Ki as buttonStyleHoverPreferenceValue, L as previewHeaderStyle, La as SelectTrigger, Li as findFooterLook, Ln as isAdapterReferenceKind, Lo as Button, M as palettePreviewProjection, Mi as getCuratedSiteStyle, N as previewButtonStyle, No as ChevronRight, O as markApplyFailed, On as createManifestValidation, Oo as LoaderCircle, P as previewCuratedPalette, Pa as Select, Po as ChevronLeft, Q as resolvePreviewSidebarTab, Qi as buttonStyleSelectionKey, Qo as displayedValues, Qt as FormRenderer, R as previewSiteStyle, Ra as SelectValue, Ri as getHeaderLayout, S as applyTypographyDraftPatch, T as deriveStyleConfiguratorCapabilities, U as toggleRow, Ua as PopoverContent, Un as useEditorUiStoreInstance, Uo as canWriteLinkedEntry, V as styleConfiguratorHistoryEntryForPersistedSelection, Va as SearchInput, Vn as resolveContentTitle, Vo as isEdited, Wa as PopoverTrigger, X as resolveStyleConfiguratorInitialSnapshot, Xi as updateButtonStyleHoverPreference, Ya as TabsTrigger, Yi as resolveButtonStyleSelection, Z as createOptimisticActionRunner, Zi as updateButtonStyleSelectionChoice, Zt as ManifestForm, _ as reportPreviewDesignError, _a as paletteColorEntries, _o as Tablet, ao as Surface, at as ContentFieldsForm, b as planSiteChromeSelection, bo as SlidersHorizontal, c as selectionSnapshotFromApplySiteStyleSelectionResponse, co as DropdownMenuItem, do as DropdownMenuTrigger, es as valueStatus, f as usePreviewDesignCoordinator, ft as useAutosaveStatus, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, io as CollapsibleTrigger, ir as toEditorBlockItem, j as openRow, jn as blocksKeys, jr as ThemedButtonSpecimen, k as markApplySaved, kn as listEntryPageContentSlots, l as deriveSiteStylePreviewUpdate, lo as DropdownMenuLabel, lt as useEntryController, n as useSiteChromeCustomizeOptional, no as Collapsible, ns as assertNever$1, oo as DropdownMenu, ot as useUISelector, po as X$1, qa as TabsContent, qi as buttonStyleSelectionParameterValue, ro as CollapsibleContent, s as buildApplySiteStyleSelectionBody, so as DropdownMenuContent, sr as ThemeScope, u as planConfiguratorPreview, uo as DropdownMenuSeparator, v as buildSiteChromeSelectionModels, va as paletteColorsSchema, vt as LinkedEntryLeaseBanner, w as createStyleConfiguratorState, x as applyResolvedSelections, y as cycleSiteChromeSelectionId, yo as Smartphone, z as resetTypographyToSaved, za as Callout, zi as getHeaderStyle, zn as deriveRouteMetadataPresentation, zo as cn } from "./SiteChromeCustomizeContext-JYA0cJ_Z.mjs";
3
+ import { a as usePreviewAuth, m as getDashboardUrl, p as unwrapResponse } from "./previewAuthStore-BBmV7UsW.mjs";
4
+ import { t as Separator } from "./separator-ByL72zUT.mjs";
5
+ import { C as getSiteFontsStorageUrl, S as generateFontFaceCss, _ as useBlockCustomizeControls, b as previewWidgetOverrides, d as canInspectSiteStyle, f as buildPreviewDashboardSetupUrl, g as usePreviewSiteFontStorageUrl, h as resolvePreviewSidebarChromeModel, m as resolvePreviewEditorGuidanceModel, p as resolvePreviewDashboardSetupHandoff, v as usePreviewBlockCustomizeSelectionOptional, x as buildFontPreviewUrl, y as PreviewFormProvider } from "./SdkPreviewModeRuntime-DJPmPY-r.mjs";
6
6
  import React, { createContext, forwardRef, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useQuery, useQueryClient } from "@tanstack/react-query";
@@ -347,6 +347,88 @@ var R, U = "undefined" != typeof window ? useLayoutEffect : useEffect, V = funct
347
347
  return React.createElement(Q, u({}, r, { colorModel: W }));
348
348
  };
349
349
  //#endregion
350
+ //#region ../ui/src/palette/hex.ts
351
+ /**
352
+ * Hex colour helpers shared by every palette-editing surface (Macadamia
353
+ * onboarding swatches, the LiveThemeEditor, the Style configurator advanced
354
+ * row). Consolidates three prior duplicates: `normalizeColorPickerValue` in
355
+ * Macadamia, `normalizeHex` + `contrastRatio` formerly in
356
+ * `theme-editor/utils.ts`, and the inline regex in `updateColorRole`.
357
+ *
358
+ * Pure functions; no DOM, no React.
359
+ */
360
+ /**
361
+ * Coerces user input into a canonical lowercase `#RRGGBB` form. Accepts
362
+ * 3-digit shorthand, case-insensitive 6-digit hex, and the same forms with or
363
+ * without a leading `#`; returns `fallback` for any other shape (empty
364
+ * string, garbage, characters outside `[0-9a-f]`, wrong length, etc.). Pass
365
+ * a `fallback` to make the fallback explicit at the call site — defaulting
366
+ * to `'#000000'` preserves the former theme-editor helper semantics.
367
+ */
368
+ function normalizeHex(input, fallback = "#000000") {
369
+ if (!input) return fallback;
370
+ const trimmed = input.trim().replace(/^#/, "").toLowerCase();
371
+ const expanded = trimmed.length === 3 ? trimmed.split("").map((char) => char + char).join("") : trimmed;
372
+ if (!/^[0-9a-f]{6}$/i.test(expanded)) return fallback;
373
+ return `#${expanded}`;
374
+ }
375
+ function hexToRgb(hex) {
376
+ const match = normalizeHex(hex).replace("#", "").match(/.{2}/g);
377
+ if (!match || match.length < 3) return null;
378
+ const [r, g, b] = match.map((value) => parseInt(value, 16));
379
+ return [
380
+ r,
381
+ g,
382
+ b
383
+ ];
384
+ }
385
+ function luminanceChannel(raw) {
386
+ const channel = raw / 255;
387
+ return channel <= .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
388
+ }
389
+ /**
390
+ * WCAG relative luminance + contrast ratio. Rounded to 2 decimal places so
391
+ * the result is stable for UI display.
392
+ */
393
+ function contrastRatio(hexA, hexB) {
394
+ const rgbA = hexToRgb(hexA);
395
+ const rgbB = hexToRgb(hexB);
396
+ if (!rgbA || !rgbB) return 1;
397
+ const lumA = .2126 * luminanceChannel(rgbA[0]) + .7152 * luminanceChannel(rgbA[1]) + .0722 * luminanceChannel(rgbA[2]);
398
+ const lumB = .2126 * luminanceChannel(rgbB[0]) + .7152 * luminanceChannel(rgbB[1]) + .0722 * luminanceChannel(rgbB[2]);
399
+ const brighter = Math.max(lumA, lumB);
400
+ const darker = Math.min(lumA, lumB);
401
+ return Number(((brighter + .05) / (darker + .05)).toFixed(2));
402
+ }
403
+ //#endregion
404
+ //#region ../ui/src/palette/useHexDraft.ts
405
+ /** Keeps incomplete text local while sending only complete colors to consumers. */
406
+ function useHexDraft(value, onChange) {
407
+ const [draft, setDraft] = useState(value);
408
+ useEffect(() => {
409
+ setDraft(value);
410
+ }, [value]);
411
+ const changeDraft = (next) => {
412
+ setDraft(next);
413
+ if (/^#?[0-9a-fA-F]{6}$/.test(next.trim())) onChange(normalizeHex(next));
414
+ };
415
+ const finishDraft = () => {
416
+ if (/^#?[0-9a-fA-F]{3}$/.test(draft.trim())) {
417
+ const normalized = normalizeHex(draft);
418
+ setDraft(normalized);
419
+ onChange(normalized);
420
+ return;
421
+ }
422
+ if (!normalizeHex(draft, "")) setDraft(value);
423
+ };
424
+ return {
425
+ draft,
426
+ changeDraft,
427
+ finishDraft,
428
+ setDraft
429
+ };
430
+ }
431
+ //#endregion
350
432
  //#region ../ui/src/color-picker.tsx
351
433
  function useForwardedRef(ref) {
352
434
  const innerRef = useRef(null);
@@ -363,6 +445,7 @@ const ColorPicker = forwardRef(({ disabled, value, onChange, onBlur, name, class
363
445
  const parsedValue = useMemo(() => {
364
446
  return value || "#FFFFFF";
365
447
  }, [value]);
448
+ const { draft, changeDraft, finishDraft, setDraft } = useHexDraft(parsedValue, onChange);
366
449
  return /* @__PURE__ */ jsxs("div", {
367
450
  className: cn("inline-block", props.style ? "" : ""),
368
451
  children: [/* @__PURE__ */ jsxs(Popover, {
@@ -391,14 +474,17 @@ const ColorPicker = forwardRef(({ disabled, value, onChange, onBlur, name, class
391
474
  className: "w-full",
392
475
  children: [/* @__PURE__ */ jsx(Z, {
393
476
  color: parsedValue,
394
- onChange
477
+ onChange: (next) => {
478
+ setDraft(next);
479
+ onChange(next);
480
+ }
395
481
  }), /* @__PURE__ */ jsx(Input, {
482
+ "aria-label": "Hex colour",
396
483
  maxLength: 7,
397
- onChange: (e) => {
398
- onChange(e?.currentTarget?.value);
399
- },
484
+ onChange: (event) => changeDraft(event.currentTarget.value),
485
+ onBlur: finishDraft,
400
486
  ref,
401
- value: parsedValue
487
+ value: draft
402
488
  })]
403
489
  })]
404
490
  }), label ? /* @__PURE__ */ jsx("div", {
@@ -1940,60 +2026,6 @@ function PreviewEditorGuidanceCard({ guidance, completeSetupDisabled, onComplete
1940
2026
  });
1941
2027
  }
1942
2028
  //#endregion
1943
- //#region ../ui/src/palette/hex.ts
1944
- /**
1945
- * Hex colour helpers shared by every palette-editing surface (Macadamia
1946
- * onboarding swatches, the LiveThemeEditor, the Style configurator advanced
1947
- * row). Consolidates three prior duplicates: `normalizeColorPickerValue` in
1948
- * Macadamia, `normalizeHex` + `contrastRatio` formerly in
1949
- * `theme-editor/utils.ts`, and the inline regex in `updateColorRole`.
1950
- *
1951
- * Pure functions; no DOM, no React.
1952
- */
1953
- /**
1954
- * Coerces user input into a canonical lowercase `#RRGGBB` form. Accepts
1955
- * 3-digit shorthand, case-insensitive 6-digit hex, and the same forms with or
1956
- * without a leading `#`; returns `fallback` for any other shape (empty
1957
- * string, garbage, characters outside `[0-9a-f]`, wrong length, etc.). Pass
1958
- * a `fallback` to make the fallback explicit at the call site — defaulting
1959
- * to `'#000000'` preserves the former theme-editor helper semantics.
1960
- */
1961
- function normalizeHex(input, fallback = "#000000") {
1962
- if (!input) return fallback;
1963
- const trimmed = input.trim().replace(/^#/, "").toLowerCase();
1964
- const expanded = trimmed.length === 3 ? trimmed.split("").map((char) => char + char).join("") : trimmed;
1965
- if (!/^[0-9a-f]{6}$/i.test(expanded)) return fallback;
1966
- return `#${expanded}`;
1967
- }
1968
- function hexToRgb(hex) {
1969
- const match = normalizeHex(hex).replace("#", "").match(/.{2}/g);
1970
- if (!match || match.length < 3) return null;
1971
- const [r, g, b] = match.map((value) => parseInt(value, 16));
1972
- return [
1973
- r,
1974
- g,
1975
- b
1976
- ];
1977
- }
1978
- function luminanceChannel(raw) {
1979
- const channel = raw / 255;
1980
- return channel <= .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4);
1981
- }
1982
- /**
1983
- * WCAG relative luminance + contrast ratio. Rounded to 2 decimal places so
1984
- * the result is stable for UI display.
1985
- */
1986
- function contrastRatio(hexA, hexB) {
1987
- const rgbA = hexToRgb(hexA);
1988
- const rgbB = hexToRgb(hexB);
1989
- if (!rgbA || !rgbB) return 1;
1990
- const lumA = .2126 * luminanceChannel(rgbA[0]) + .7152 * luminanceChannel(rgbA[1]) + .0722 * luminanceChannel(rgbA[2]);
1991
- const lumB = .2126 * luminanceChannel(rgbB[0]) + .7152 * luminanceChannel(rgbB[1]) + .0722 * luminanceChannel(rgbB[2]);
1992
- const brighter = Math.max(lumA, lumB);
1993
- const darker = Math.min(lumA, lumB);
1994
- return Number(((brighter + .05) / (darker + .05)).toFixed(2));
1995
- }
1996
- //#endregion
1997
2029
  //#region ../ui/src/palette/PaletteTokenEditor.tsx
1998
2030
  const DEFAULT_BRAND_ROLES = [
1999
2031
  {
@@ -2149,6 +2181,7 @@ function ColorRoleGroup({ title, roles, getColor, onChange, disabled }) {
2149
2181
  function ColorRoleField({ role, value, onChange, disabled }) {
2150
2182
  const inputId = useId();
2151
2183
  const colorPickerLabel = `${role.label} colour picker`;
2184
+ const { draft, changeDraft, finishDraft, setDraft } = useHexDraft(value, (hex) => onChange(role.key, hex));
2152
2185
  return /* @__PURE__ */ jsxs("div", {
2153
2186
  className: "rounded-lg bg-muted p-3 space-y-2",
2154
2187
  children: [
@@ -2160,7 +2193,10 @@ function ColorRoleField({ role, value, onChange, disabled }) {
2160
2193
  /* @__PURE__ */ jsx(ColorPicker, {
2161
2194
  value,
2162
2195
  onChange: (next) => {
2163
- if (typeof next === "string") onChange(role.key, next);
2196
+ if (typeof next === "string") {
2197
+ setDraft(next);
2198
+ onChange(role.key, next);
2199
+ }
2164
2200
  },
2165
2201
  className: "w-full",
2166
2202
  "aria-label": colorPickerLabel,
@@ -2168,8 +2204,9 @@ function ColorRoleField({ role, value, onChange, disabled }) {
2168
2204
  }),
2169
2205
  /* @__PURE__ */ jsx(Input, {
2170
2206
  id: inputId,
2171
- value,
2172
- onChange: (event) => onChange(role.key, event.target.value),
2207
+ value: draft,
2208
+ onChange: (event) => changeDraft(event.target.value),
2209
+ onBlur: finishDraft,
2173
2210
  className: "font-mono text-xs uppercase",
2174
2211
  placeholder: "#000000",
2175
2212
  disabled
@@ -1,7 +1,7 @@
1
1
  "use client";
2
- import { Co as Pencil, Fo as ChevronDown, Gn as canDiscardDraft, Gt as useEditor, Hn as useEditorUiStore, Lo as Button, Ma as TooltipContent, Mo as EllipsisVertical, Na as TooltipTrigger, Oo as LoaderCircle, Qa as DialogDescription, Ro as cva, So as Redo2, To as Palette, Un as useEditorUiStoreInstance, Xa as Dialog, Za as DialogContent, a as previewDesignHistoryDomainForCommand, co as DropdownMenuItem, do as DropdownMenuTrigger, dt as classifyHistoryShortcut, eo as DialogHeader, ft as useAutosaveStatus, go as TriangleAlert, ho as Undo2, i as usePreviewDesignHistoryOrder, ja as Tooltip, jo as Eye, n as useSiteChromeCustomizeOptional, o as selectPreviewDesignHistoryDomain, oo as DropdownMenu, so as DropdownMenuContent, to as DialogTitle, ut as useEntryEditorController, vo as Sparkles, wo as PenLine, xt as EditorWriteSurface, zo as cn } from "./SiteChromeCustomizeContext-CFJYh6vo.mjs";
3
- import { d as unwrapResponse, r as usePreviewAuth } from "./previewAuthStore-BXXF3hhW.mjs";
4
- import { C as FixedBottomSurface, a as usePreviewPageDesignEditorState, c as applyPreviewChromeSurfaceToElement, l as resolvePreviewChromeSurface, o as PREVIEW_CHROME_PORTAL_CLASS_NAME, s as PREVIEW_CHROME_THEME_CLASS_NAME } from "./SdkPreviewModeRuntime-DJ6utQ_R.mjs";
2
+ import { Co as Pencil, Fo as ChevronDown, Gn as canDiscardDraft, Gt as useEditor, Hn as useEditorUiStore, Lo as Button, Ma as TooltipContent, Mo as EllipsisVertical, Na as TooltipTrigger, Oo as LoaderCircle, Qa as DialogDescription, Ro as cva, So as Redo2, To as Palette, Un as useEditorUiStoreInstance, Xa as Dialog, Za as DialogContent, a as previewDesignHistoryDomainForCommand, co as DropdownMenuItem, do as DropdownMenuTrigger, dt as classifyHistoryShortcut, eo as DialogHeader, ft as useAutosaveStatus, go as TriangleAlert, ho as Undo2, i as usePreviewDesignHistoryOrder, ja as Tooltip, jo as Eye, n as useSiteChromeCustomizeOptional, o as selectPreviewDesignHistoryDomain, oo as DropdownMenu, so as DropdownMenuContent, to as DialogTitle, ut as useEntryEditorController, vo as Sparkles, wo as PenLine, xt as EditorWriteSurface, zo as cn } from "./SiteChromeCustomizeContext-JYA0cJ_Z.mjs";
3
+ import { a as usePreviewAuth, p as unwrapResponse } from "./previewAuthStore-BBmV7UsW.mjs";
4
+ import { a as usePreviewPageDesignEditorState, c as applyPreviewChromeSurfaceToElement, l as resolvePreviewChromeSurface, o as PREVIEW_CHROME_PORTAL_CLASS_NAME, s as PREVIEW_CHROME_THEME_CLASS_NAME, u as PREVIEW_THEME_COOKIE_NAME, w as FixedBottomSurface } from "./SdkPreviewModeRuntime-DJPmPY-r.mjs";
5
5
  import * as React$1 from "react";
6
6
  import { useCallback, useEffect, useMemo, useState, useTransition } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -473,9 +473,6 @@ function MaintenanceModeBadge({ dashboardBaseUrl, siteId }) {
473
473
  });
474
474
  }
475
475
  //#endregion
476
- //#region ../preview-next/src/constants.ts
477
- const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
478
- //#endregion
479
476
  //#region ../preview-next/src/client/preview/OnboardingThemeSwitcher.tsx
480
477
  function getDefaultThemeId(payload) {
481
478
  return payload.currentThemeId ?? payload.themes[0]?.id ?? null;
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { n as markPreviewAuthExpired, s as ApiRequestError } from "./previewAuthStore-BXXF3hhW.mjs";
2
+ import { c as wasPreviewApiAuthErrorHandled, r as markPreviewAuthExpired, u as ApiRequestError } from "./previewAuthStore-BBmV7UsW.mjs";
3
3
  import { createContext, useContext, useRef } from "react";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { MutationCache, QueryCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
@@ -33,10 +33,10 @@ function createPreviewQueryClient() {
33
33
  refetchOnWindowFocus: false
34
34
  } },
35
35
  queryCache: new QueryCache({ onError: (error) => {
36
- if (error instanceof ApiRequestError && error.status === 401) markPreviewAuthExpired("query");
36
+ if (error instanceof ApiRequestError && error.status === 401 && !wasPreviewApiAuthErrorHandled(error)) markPreviewAuthExpired("query");
37
37
  } }),
38
38
  mutationCache: new MutationCache({ onError: (error) => {
39
- if (error instanceof ApiRequestError && error.status === 401) markPreviewAuthExpired("query");
39
+ if (error instanceof ApiRequestError && error.status === 401 && !wasPreviewApiAuthErrorHandled(error)) markPreviewAuthExpired("query");
40
40
  } })
41
41
  });
42
42
  }
@@ -1,40 +1,13 @@
1
1
  "use client";
2
- import { $a as DialogFooter, $n as canUndoHistory, $r as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, $t as createStoreBackend, Aa as attachRenderableMediaAssetFields, Ao as GripVertical, Ar as parseGeneratedIconSetId, At as MailingListTargetingProvider, Bi as gradientToCss, Bo as baselineRevisionOf, Br as bookingConsentCarrierSchema, Bt as ReferenceWidgetProvider, Ca as makeBoundaryId, Ci as parseBackgroundContent, Cn as stripTopLevelRoutingUi, Cr as escapeStyleContent, Ct as createSiteOptionWidgetAdapters, Da as bodyCopyFragment, Di as planPageDesignLayoutLookCompatibility, Dn as createManifestFormAdapter, Dt as OfferingsPreviewWidgetProvider, Ea as ctaButton, Ei as formatSiteChromeBackgroundTokenLabel, En as isHeaderField, Er as getDefaultComponentRegistry, Et as OfferingsPreviewGroupOrderField, Fa as SelectContent, Fi as parseThemeForPersistence, Fr as RichText$1, Ft as ButtonVariantField, G as confirmAutosaveBatch, Go as buildMailingListSignupBlockSourceRef, Gr as resolvePageRouteTarget, Gt as useEditor, Hi as GRADIENT_PRESET_IDS, Hn as useEditorUiStore, Ho as recordsEqual, Hr as eventCalendarListLayoutCompatibleDisplayModeValues, Ht as RichTextField, Ia as SelectItem, Ii as resolveSdkFooterMode, In as BUILT_IN_REFERENCE_KINDS, Ir as getAtPath, It as ButtonWidgetProvider, J as idleEditorTransactionQueueState, Ja as TabsList, Jn as remoteDraftValues, Jo as parseMailingListPlacementTargeting, Jr as isRecord$11, K as deriveTransactionCapabilities, Ka as Tabs, Kn as activeLinkedSaveHandover, Ko as sameMailingListPlacementTargeting, Kr as resolveRouteTarget, Kt as LinkField, La as SelectTrigger, Lo as Button, Lr as siblingPath, Lt as FileField, Mn as getBlockManifestFromSdkConfig, Mr as renderInlineText, Mt as IconPickerField, Ni as surfaceResolutionContextFromTheme, Nn as createRoutingHelpers, No as ChevronRight, Nr as logger, Nt as EntryPickerField, Oa as defineFragment, Oi as resolvePageDesignEditorBoundaryForChoice, Or as parseBlockIconValue, Ot as MailingListTargetingField, Pa as Select, Pi as corners, Pn as createSnapshotFromPageRecord, Po as ChevronLeft, Pr as Text$1, Pt as EntryPickerWidgetProvider, Q as resolvePreviewSidebarTab, Qa as DialogDescription, Qn as canRedoHistory, Qr as setContextResolveImageUrlContext, Qt as FormRenderer, Ra as SelectValue, Rn as parseReferenceKind, Rr as defaultTransforms, Rt as MediaField, Sa as assertNever$1, Si as heroCopyFragment, Sn as prepareBlockEditorManifest, Sr as getResponsiveScopeSpec, St as createSiteOptionApiLoader, Ta as runTransforms, Ti as compileEditorModelRuntime, Tn as getFieldIntent, Tr as readBlockComposition, Tt as SiteOptionWidgetProvider, Ui as getGradientPreset, Un as useEditorUiStoreInstance, Ur as eventCalendarListLayoutOptions, Ut as RichTextWidgetProvider, Vi as GRADIENT_PRESETS, Vo as isEdited, Vr as isRichTextDoc, Vt as useRichTextImagePicker, W as beginAutosaveBatch, Wi as parseGradientPresetId, Wn as useOptionalEditorUiStoreInstance, Wo as canEditorWrite, Wr as resolveEntryRouteTarget, Wt as EditorProvider, Xa as Dialog, Xn as renderedFieldChanges, Xo as selectedContentVersionId, Xr as getCurrentResolveImageUrlContext, Xt as usePalette, Y as rejectAutosaveBatch, Ya as TabsTrigger, Yn as renderSourceFor, Yo as NO_BLOCK_VERSIONS, Yr as buildResolveImageUrlContext, Yt as PaletteProvider, Za as DialogContent, Zn as resolveRenderedValues, Zr as resolveImageUrlWithContext, _ as reportPreviewDesignError, _i as testimonialsCarouselFragment, _n as mapOptionValueForSelect, _r as resolveVariantKey, _t as VIEWING_PARTICIPATION, aa as boundaryTreatmentForBoundaryOptionId, ai as LINKED_CONTENT_ENTRY_META_KEY, an as deriveLaunchReadiness, ar as unsafeAsLinkedContentEntryId, as as parsePageId, ba as defaultThemeTokens, bi as heroCtaRowFragment, bn as useField, br as buildThemeRuntime, bt as EditLeaseModal, ca as sectionTransitionFamilyForBoundaryOptionId, ci as richTextFragment, cn as useMediaEditorOptional, cr as containerResponsiveThemeCss, cs as __exportAll, ct as EntryControllerProvider, d as PreviewDesignCoordinatorProvider, da as pageDesignEditorBackgroundOverrideOwner, di as faqAccordionFragment, dn as ImageResolveContextProvider, dr as getBlockDefinition, ea as autoDesignChoice, ei as planSiteChromePlacement, en as MediaEditor, eo as DialogHeader, er as createHistoryState, es as unsafeAsEditorBlockId, et as renderSiteChromeBlock, fa as stripStaleTransitionStyleGroup, fi as faqHeadingFragment, fn as BlockApiProvider, fr as projectRecurringSchedule, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, ga as textColorStyle, gi as formCopyFragment, gn as mapCurrentValueForSelect, gr as visibleHeaderClearancePx, gt as useRetentionTicks, h as PREVIEW_DESIGN_LOAD_ERROR_MESSAGE, ha as parseBackgroundAppearanceColorToken, hi as formEmbedFragment, hn as hasEmptyOption, hr as planSiteOverlayHeaderClearance, ht as createPageSurfaceEditorServices, i as usePreviewDesignHistoryOrder, ia as sectionFactsForContent, ii as plainTextToInlineText, in as DEFAULT_LAUNCH_READINESS_INPUT, ir as toEditorBlockItem, is as parseMediaAssetId, it as PREVIEW_EDITABLE_OUTLINE, ji as designRuntimeRulesForTheme, jn as blocksKeys, jt as InlineTextField, ka as bindingSchema, ki as componentRuntimeRulesForTheme, ko as Image, kr as parseGeneratedIconAssetId, kt as loadMailingListAuthoringContext, la as sectionTransitionVariantForBoundaryOptionId, li as headingFragment, ln as useApiMediaUploader, lr as createCustomBlockRegistry, m as usePreviewThemeOverlay, ma as backgroundAppearanceQuickColorTokenNames, mi as singleButtonFragment, mn as useSdkConfig, mo as Upload, mr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, mt as createEditorApiClientFactory, n as useSiteChromeCustomizeOptional, na as boundaryLayout, ni as inlineTextToPlainText, nn as getPageDesignEditorState, nr as redoHistory, ns as expectParsedBrandedId, nt as PreviewInlineTextEditor, oa as defaultSectionTransitionVariantForFamily, oi as coerceLinkedContentEntriesPayload, on as AMBIENT_BACKGROUND_ROLES, or as isSupportedLoaderEndpoint, os as parsePageSurfaceId, ot as useUISelector, p as PreviewThemeOverlayProvider, pa as backgroundAppearanceColorTokenNames, pi as blogFeaturedPostFragment, pn as SdkConfigProvider, po as X, pr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, pt as useDebouncedLatestSave, q as enqueueTransaction, qa as TabsContent, qn as planLinkedSaveHandoverRetention, qo as parseFooterModuleId, qr as isObjectRecord, qt as LinkWidgetProvider, r as PreviewDesignHistoryOrderProvider, ra as composeBoundary, ri as isInlineTextEmpty, rn as decodePublicProductCategorySelectorQuery, rr as undoHistory, rs as parseContentEntryId, rt as PreviewTextEditor, sa as sectionTransitionFamilies, si as getLinkedContentEntryMeta, sn as MediaEditorContextProvider, sr as ThemeScope, ss as parseSiteId, st as EditableBlockProvider, t as SiteChromeCustomizeProvider, ta as userPinnedDesignChoice, ti as coerceInlineTextWithFallback, tn as applyPageDesignEditorAction, to as DialogTitle, tr as pushHistoryEntry, ts as assertNever$2, tt as PreviewRichTextEditor, ua as isThemeV2NormalEditorRawStyleFieldName, ui as cardFragment, un as clientComponentRegistry, ur as makeDefaultBlockComponent, ut as useEntryEditorController, va as paletteColorsSchema, vi as testimonialsHeadingFragment, vn as unmapValueFromSelect, vr as compileManifestContentContract, wa as ORDINARY_TEXT_MIN_CONTRAST_RATIO, wi as applyCompiledRuntimeFieldsToContent, wn as evaluateVisibility, wr as mergeContentWithBlockStyleOverrides, wt as SiteOptionPickerField, xa as asDesignBlockId, xi as ctaRowFragment, xn as hideThemeV2RawStyleFields, xo as RotateCcw, xr as DEFAULT_THEME_RESPONSIVE_MODE, xt as EditorWriteSurface, ya as paletteModeSchema, yi as ctaCopyFragment, yn as FieldFrame, yr as validateManifestDraft, yt as EditLeaseDiscardedNotice, zo as cn, zr as calendarWindowQuerySchema, zt as ReferenceField } from "./SiteChromeCustomizeContext-CFJYh6vo.mjs";
3
- import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-5znTyJuz.mjs";
4
- import { _ as API_ENDPOINTS, a as usePreviewToken, c as createBearerAPIClient, d as unwrapResponse, g as resolveSurfaceDocumentAttributes, h as SURFACE_IDS, i as usePreviewAuthFetch, m as SURFACE_DOCUMENT_DATA_ATTRIBUTE, n as markPreviewAuthExpired, o as isPreviewRuntimeSessionEditable, r as usePreviewAuth, s as ApiRequestError, t as initPreviewAuth } from "./previewAuthStore-BXXF3hhW.mjs";
2
+ import { $a as DialogFooter, $n as canUndoHistory, $r as SECTION_BACKGROUND_MIN_SOURCE_WIDTH, $t as createStoreBackend, Aa as attachRenderableMediaAssetFields, Ao as GripVertical, Ar as parseGeneratedIconSetId, At as MailingListTargetingProvider, Bi as gradientToCss, Bo as baselineRevisionOf, Br as bookingConsentCarrierSchema, Bt as ReferenceWidgetProvider, Ca as makeBoundaryId, Ci as parseBackgroundContent, Cn as stripTopLevelRoutingUi, Cr as escapeStyleContent, Ct as createSiteOptionWidgetAdapters, Da as bodyCopyFragment, Di as planPageDesignLayoutLookCompatibility, Dn as createManifestFormAdapter, Dt as OfferingsPreviewWidgetProvider, Ea as ctaButton, Ei as formatSiteChromeBackgroundTokenLabel, En as isHeaderField, Er as getDefaultComponentRegistry, Et as OfferingsPreviewGroupOrderField, Fa as SelectContent, Fi as parseThemeForPersistence, Fr as RichText$1, Ft as ButtonVariantField, G as confirmAutosaveBatch, Go as buildMailingListSignupBlockSourceRef, Gr as resolvePageRouteTarget, Gt as useEditor, Hi as GRADIENT_PRESET_IDS, Hn as useEditorUiStore, Ho as recordsEqual, Hr as eventCalendarListLayoutCompatibleDisplayModeValues, Ht as RichTextField, Ia as SelectItem, Ii as resolveSdkFooterMode, In as BUILT_IN_REFERENCE_KINDS, Ir as getAtPath, It as ButtonWidgetProvider, J as idleEditorTransactionQueueState, Ja as TabsList, Jn as remoteDraftValues, Jo as parseMailingListPlacementTargeting, Jr as isRecord$11, K as deriveTransactionCapabilities, Ka as Tabs, Kn as activeLinkedSaveHandover, Ko as sameMailingListPlacementTargeting, Kr as resolveRouteTarget, Kt as LinkField, La as SelectTrigger, Lo as Button, Lr as siblingPath, Lt as FileField, Mn as getBlockManifestFromSdkConfig, Mr as renderInlineText, Mt as IconPickerField, Ni as surfaceResolutionContextFromTheme, Nn as createRoutingHelpers, No as ChevronRight, Nr as logger, Nt as EntryPickerField, Oa as defineFragment, Oi as resolvePageDesignEditorBoundaryForChoice, Or as parseBlockIconValue, Ot as MailingListTargetingField, Pa as Select, Pi as corners, Pn as createSnapshotFromPageRecord, Po as ChevronLeft, Pr as Text$1, Pt as EntryPickerWidgetProvider, Q as resolvePreviewSidebarTab, Qa as DialogDescription, Qn as canRedoHistory, Qr as setContextResolveImageUrlContext, Qt as FormRenderer, Ra as SelectValue, Rn as parseReferenceKind, Rr as defaultTransforms, Rt as MediaField, Sa as assertNever$1, Si as heroCopyFragment, Sn as prepareBlockEditorManifest, Sr as getResponsiveScopeSpec, St as createSiteOptionApiLoader, Ta as runTransforms, Ti as compileEditorModelRuntime, Tn as getFieldIntent, Tr as readBlockComposition, Tt as SiteOptionWidgetProvider, Ui as getGradientPreset, Un as useEditorUiStoreInstance, Ur as eventCalendarListLayoutOptions, Ut as RichTextWidgetProvider, Vi as GRADIENT_PRESETS, Vo as isEdited, Vr as isRichTextDoc, Vt as useRichTextImagePicker, W as beginAutosaveBatch, Wi as parseGradientPresetId, Wn as useOptionalEditorUiStoreInstance, Wo as canEditorWrite, Wr as resolveEntryRouteTarget, Wt as EditorProvider, Xa as Dialog, Xn as renderedFieldChanges, Xo as selectedContentVersionId, Xr as getCurrentResolveImageUrlContext, Xt as usePalette, Y as rejectAutosaveBatch, Ya as TabsTrigger, Yn as renderSourceFor, Yo as NO_BLOCK_VERSIONS, Yr as buildResolveImageUrlContext, Yt as PaletteProvider, Za as DialogContent, Zn as resolveRenderedValues, Zo as parseEditLeaseScope, Zr as resolveImageUrlWithContext, _ as reportPreviewDesignError, _i as testimonialsCarouselFragment, _n as mapOptionValueForSelect, _r as resolveVariantKey, _t as VIEWING_PARTICIPATION, aa as boundaryTreatmentForBoundaryOptionId, ai as LINKED_CONTENT_ENTRY_META_KEY, an as deriveLaunchReadiness, ar as unsafeAsLinkedContentEntryId, as as parseSiteId, ba as defaultThemeTokens, bi as heroCtaRowFragment, bn as useField, br as buildThemeRuntime, bt as EditLeaseModal, ca as sectionTransitionFamilyForBoundaryOptionId, ci as richTextFragment, cn as useMediaEditorOptional, cr as containerResponsiveThemeCss, ct as EntryControllerProvider, d as PreviewDesignCoordinatorProvider, da as pageDesignEditorBackgroundOverrideOwner, di as faqAccordionFragment, dn as ImageResolveContextProvider, dr as getBlockDefinition, ea as autoDesignChoice, ei as planSiteChromePlacement, en as MediaEditor, eo as DialogHeader, er as createHistoryState, et as renderSiteChromeBlock, fa as stripStaleTransitionStyleGroup, fi as faqHeadingFragment, fn as BlockApiProvider, fr as projectRecurringSchedule, g as PREVIEW_DESIGN_SAVE_ERROR_MESSAGE, ga as textColorStyle, gi as formCopyFragment, gn as mapCurrentValueForSelect, gr as visibleHeaderClearancePx, gt as useRetentionTicks, h as PREVIEW_DESIGN_LOAD_ERROR_MESSAGE, ha as parseBackgroundAppearanceColorToken, hi as formEmbedFragment, hn as hasEmptyOption, hr as planSiteOverlayHeaderClearance, ht as createPageSurfaceEditorServices, i as usePreviewDesignHistoryOrder, ia as sectionFactsForContent, ii as plainTextToInlineText, in as DEFAULT_LAUNCH_READINESS_INPUT, ir as toEditorBlockItem, is as parseMediaAssetId, it as PREVIEW_EDITABLE_OUTLINE, ji as designRuntimeRulesForTheme, jn as blocksKeys, jt as InlineTextField, ka as bindingSchema, ki as componentRuntimeRulesForTheme, ko as Image, kr as parseGeneratedIconAssetId, kt as loadMailingListAuthoringContext, la as sectionTransitionVariantForBoundaryOptionId, li as headingFragment, ln as useApiMediaUploader, lr as createCustomBlockRegistry, m as usePreviewThemeOverlay, ma as backgroundAppearanceQuickColorTokenNames, mi as singleButtonFragment, mn as useSdkConfig, mo as Upload, mr as SITE_OVERLAY_HEADER_CLEARANCE_CSS_VAR, mt as createEditorApiClientFactory, n as useSiteChromeCustomizeOptional, na as boundaryLayout, ni as inlineTextToPlainText, nn as getPageDesignEditorState, nr as redoHistory, ns as assertNever$2, nt as PreviewInlineTextEditor, oa as defaultSectionTransitionVariantForFamily, oi as coerceLinkedContentEntriesPayload, on as AMBIENT_BACKGROUND_ROLES, or as isSupportedLoaderEndpoint, os as __exportAll, ot as useUISelector, p as PreviewThemeOverlayProvider, pa as backgroundAppearanceColorTokenNames, pi as blogFeaturedPostFragment, pn as SdkConfigProvider, po as X, pr as SITE_CHROME_VISIBLE_HEADER_SELECTOR, pt as useDebouncedLatestSave, q as enqueueTransaction, qa as TabsContent, qn as planLinkedSaveHandoverRetention, qo as parseFooterModuleId, qr as isObjectRecord, qt as LinkWidgetProvider, r as PreviewDesignHistoryOrderProvider, ra as composeBoundary, ri as isInlineTextEmpty, rn as decodePublicProductCategorySelectorQuery, rr as undoHistory, rs as expectParsedBrandedId, rt as PreviewTextEditor, sa as sectionTransitionFamilies, si as getLinkedContentEntryMeta, sn as MediaEditorContextProvider, sr as ThemeScope, st as EditableBlockProvider, t as SiteChromeCustomizeProvider, ta as userPinnedDesignChoice, ti as coerceInlineTextWithFallback, tn as applyPageDesignEditorAction, to as DialogTitle, tr as pushHistoryEntry, ts as unsafeAsEditorBlockId, tt as PreviewRichTextEditor, ua as isThemeV2NormalEditorRawStyleFieldName, ui as cardFragment, un as clientComponentRegistry, ur as makeDefaultBlockComponent, ut as useEntryEditorController, va as paletteColorsSchema, vi as testimonialsHeadingFragment, vn as unmapValueFromSelect, vr as compileManifestContentContract, wa as ORDINARY_TEXT_MIN_CONTRAST_RATIO, wi as applyCompiledRuntimeFieldsToContent, wn as evaluateVisibility, wr as mergeContentWithBlockStyleOverrides, wt as SiteOptionPickerField, xa as asDesignBlockId, xi as ctaRowFragment, xn as hideThemeV2RawStyleFields, xo as RotateCcw, xr as DEFAULT_THEME_RESPONSIVE_MODE, xt as EditorWriteSurface, ya as paletteModeSchema, yi as ctaCopyFragment, yn as FieldFrame, yr as validateManifestDraft, yt as EditLeaseDiscardedNotice, zo as cn, zr as calendarWindowQuerySchema, zt as ReferenceField } from "./SiteChromeCustomizeContext-JYA0cJ_Z.mjs";
3
+ import { i as useOptionalPreviewLayout, t as PreviewQueryProvider } from "./PreviewQueryProvider-C0mndwHB.mjs";
4
+ import { _ as SURFACE_IDS, a as usePreviewAuth, g as SURFACE_DOCUMENT_DATA_ATTRIBUTE, i as setPreviewAccessToken, l as isPreviewRuntimeSessionEditable, n as initPreviewAuth, o as usePreviewAuthFetch, p as unwrapResponse, r as markPreviewAuthExpired, s as usePreviewToken, t as createGuardedPreviewApiClient, u as ApiRequestError, v as resolveSurfaceDocumentAttributes, y as API_ENDPOINTS } from "./previewAuthStore-BBmV7UsW.mjs";
5
5
  import * as React$1 from "react";
6
6
  import React, { Children, Fragment, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useId, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
7
7
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
8
8
  import { useQueryClient } from "@tanstack/react-query";
9
9
  import { z } from "zod";
10
10
  import { createPortal } from "react-dom";
11
- //#region ../core/src/edit-lease.ts
12
- function parseEditLeaseScope(input) {
13
- switch (input.nodeType) {
14
- case "page": {
15
- const id = parsePageId(input.nodeId);
16
- return id.ok ? {
17
- nodeType: "page",
18
- nodeId: id.value
19
- } : null;
20
- }
21
- case "content_entry": {
22
- const id = parseContentEntryId(input.nodeId);
23
- return id.ok ? {
24
- nodeType: "content_entry",
25
- nodeId: id.value
26
- } : null;
27
- }
28
- case "page_surface": {
29
- const id = parsePageSurfaceId(input.nodeId);
30
- return id.ok ? {
31
- nodeType: "page_surface",
32
- nodeId: id.value
33
- } : null;
34
- }
35
- }
36
- }
37
- //#endregion
38
11
  //#region ../ui/src/fixed-bottom-surface.tsx
39
12
  const SURFACE_CLASS_BY_VARIANT = {
40
13
  light: "z-40 border-t border-border bg-editor-chrome-surface text-foreground",
@@ -5192,6 +5165,11 @@ function canInspectSiteStyle(access) {
5192
5165
  return access.kind === "apply-allowed";
5193
5166
  }
5194
5167
  //#endregion
5168
+ //#region ../preview-next/src/constants.ts
5169
+ const PREVIEW_THEME_COOKIE_NAME = "preview_theme_id";
5170
+ const PREVIEW_KEEP_ALIVE_INTERVAL_MS = 600 * 1e3;
5171
+ const PREVIEW_KEEP_ALIVE_JITTER_RATIO = .1;
5172
+ //#endregion
5195
5173
  //#region ../preview-next/src/client/preview/previewChromeSurface.ts
5196
5174
  const PREVIEW_CHROME_THEME_CLASS_NAME = "builder-dashboard-chrome-theme";
5197
5175
  const PREVIEW_CHROME_PORTAL_CLASS_NAME = "builder-editor-chrome";
@@ -7068,7 +7046,7 @@ function blockIdForRuntimePatch(action) {
7068
7046
  function PreviewAuthInit({ children, session, siteId, siteSlug, pageId, token }) {
7069
7047
  const lastInitRef = useRef(null);
7070
7048
  const sessionKey = session ? session.kind === "userSession" ? `${session.kind}:${session.canEdit}:${session.canManage}:${session.expiresAt ?? "no-expiry"}` : `${session.kind}:${session.expiresAt ?? "no-expiry"}` : "none";
7071
- const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ? "has-token" : "no-token"}`;
7049
+ const currentKey = `${siteId}:${pageId ?? "no-page"}:${sessionKey}:${token ?? "no-token"}`;
7072
7050
  if (lastInitRef.current !== currentKey) {
7073
7051
  initPreviewAuth({
7074
7052
  session,
@@ -7356,13 +7334,13 @@ function toEditorInitialBlock(block, index) {
7356
7334
  orderIndex: typeof block.orderIndex === "number" ? block.orderIndex : index
7357
7335
  };
7358
7336
  }
7359
- function previewLiveDraftsConfig(liveDrafts, siteId, scope) {
7360
- if (!liveDrafts) return null;
7337
+ function previewLiveDraftsConfig(liveDrafts, previewToken, siteId, scope) {
7338
+ if (!liveDrafts || !previewToken) return null;
7361
7339
  return {
7362
7340
  client: liveDrafts.client,
7363
7341
  auth: {
7364
7342
  kind: "token",
7365
- accessToken: liveDrafts.previewToken
7343
+ accessToken: previewToken
7366
7344
  },
7367
7345
  siteId,
7368
7346
  scope,
@@ -7451,6 +7429,7 @@ function previewValues(entryData, pageMetadata) {
7451
7429
  }
7452
7430
  function PreviewEntryControllerProvider({ children, siteId, pageId, pageNodeType = "page", routeId: providedRouteId, entryData, contentTypeSchema, initialStatus = "draft", initialBlocks, blockFieldExtensions, pageMetadata, apiClient, subscribeToLeaseChanges, onLeaseGranted, liveDrafts }) {
7453
7431
  const { isEditingMode, requestedEditingMode } = useEditor();
7432
+ const previewToken = usePreviewToken();
7454
7433
  const schema = contentTypeSchema ?? PAGE_CONTENT_TYPE_SCHEMA;
7455
7434
  const initialEntry = useMemo(() => initialPreviewEntry(entryData, pageMetadata, pageId, schema), [
7456
7435
  entryData,
@@ -7495,7 +7474,7 @@ function PreviewEntryControllerProvider({ children, siteId, pageId, pageNodeType
7495
7474
  initialBlocks: pageNodeType === "page_surface" ? void 0 : normalizedInitialBlocks,
7496
7475
  blockFieldExtensions,
7497
7476
  historyShortcutsEnabled: isEditingMode,
7498
- liveDrafts: previewLiveDraftsConfig(liveDrafts, siteId, leaseScope)
7477
+ liveDrafts: previewLiveDraftsConfig(liveDrafts, previewToken, siteId, leaseScope)
7499
7478
  };
7500
7479
  if (pageNodeType === "page_surface" && pageId && pageMetadata) {
7501
7480
  if (values.kind !== "content") throw new Error("Preview draft is missing its editor revision");
@@ -7585,33 +7564,54 @@ function requiredPreviewLeaseScope(input) {
7585
7564
  }
7586
7565
  //#endregion
7587
7566
  //#region ../preview-next/src/client/preview/usePreviewKeepAlive.ts
7588
- const DEFAULT_INTERVAL_MS = 600 * 1e3;
7589
7567
  function withJitter(baseMs) {
7590
- const jitter = .1 * baseMs;
7568
+ const jitter = PREVIEW_KEEP_ALIVE_JITTER_RATIO * baseMs;
7591
7569
  const delta = (Math.random() * 2 - 1) * jitter;
7592
7570
  return Math.max(15e3, Math.round(baseMs + delta));
7593
7571
  }
7594
- function usePreviewKeepAlive({ enabled, fetcher, onExpired, intervalMs = DEFAULT_INTERVAL_MS }) {
7572
+ async function readCurrentAccessToken(response) {
7573
+ const payload = await response.json();
7574
+ if (typeof payload !== "object" || payload === null || !("accessToken" in payload) || typeof payload.accessToken !== "string" || !payload.accessToken) throw new Error("Preview keep-alive returned no access token");
7575
+ return payload.accessToken;
7576
+ }
7577
+ function usePreviewKeepAlive({ enabled, fetcher, onExpired, intervalMs = PREVIEW_KEEP_ALIVE_INTERVAL_MS }) {
7595
7578
  useEffect(() => {
7596
7579
  if (!enabled) return void 0;
7597
- let isActive = true;
7580
+ const requestState = {
7581
+ active: true,
7582
+ pending: false
7583
+ };
7598
7584
  async function keepAlive() {
7585
+ if (requestState.pending) return;
7586
+ requestState.pending = true;
7599
7587
  try {
7600
7588
  const response = await fetcher("/api/preview/keep-alive", { method: "POST" }, "keep-alive");
7601
- if (response.status === 401 && isActive) {
7589
+ if (response.status === 401 && requestState.active) {
7602
7590
  onExpired("keep-alive");
7603
7591
  return;
7604
7592
  }
7605
- if (!response.ok && isActive) console.warn("Preview keep-alive failed", await response.text());
7593
+ if (!response.ok && requestState.active) {
7594
+ console.warn("Preview keep-alive failed", await response.text());
7595
+ return;
7596
+ }
7597
+ const currentToken = await readCurrentAccessToken(response);
7598
+ if (requestState.active) setPreviewAccessToken(currentToken);
7606
7599
  } catch (error) {
7607
- if (isActive) console.warn("Preview keep-alive error", error);
7600
+ if (requestState.active) console.warn("Preview keep-alive error", error);
7601
+ } finally {
7602
+ requestState.pending = false;
7608
7603
  }
7609
7604
  }
7605
+ function checkWhenVisible() {
7606
+ if (document.visibilityState === "visible") keepAlive();
7607
+ }
7610
7608
  keepAlive();
7611
7609
  const id = window.setInterval(keepAlive, withJitter(intervalMs));
7610
+ document.addEventListener("visibilitychange", checkWhenVisible);
7612
7611
  return () => {
7613
- isActive = false;
7612
+ requestState.active = false;
7614
7613
  window.clearInterval(id);
7614
+ document.removeEventListener("visibilitychange", checkWhenVisible);
7615
7615
  };
7616
7616
  }, [
7617
7617
  enabled,
@@ -9842,10 +9842,10 @@ function resolveShellThemeRoles(props) {
9842
9842
  }
9843
9843
  const previewContainerResponsiveEnabled = process.env.NEXT_PUBLIC_ENABLE_PREVIEW_CONTAINER_RESPONSIVE !== "false";
9844
9844
  const PreviewEditorSidebar = React.lazy(async () => {
9845
- return { default: (await import("./PreviewEditorSidebar-DvEPG3Z2.mjs")).PreviewEditorSidebar };
9845
+ return { default: (await import("./PreviewEditorSidebar-DBKln68M.mjs")).PreviewEditorSidebar };
9846
9846
  });
9847
9847
  const PreviewEditorUI = React.lazy(async () => {
9848
- return { default: (await import("./PreviewEditorUI-D6eb6fkx.mjs")).PreviewEditorUI };
9848
+ return { default: (await import("./PreviewEditorUI-DpRX4Mum.mjs")).PreviewEditorUI };
9849
9849
  });
9850
9850
  const previewPaneContainmentStyle = {
9851
9851
  contain: "layout paint",
@@ -10180,7 +10180,7 @@ function resolveShellLayoutProps(input) {
10180
10180
  draftContent: props.draftContent,
10181
10181
  currentTemplate: props.currentTemplate,
10182
10182
  apiClient: input.apiClient,
10183
- bearerToken: props.previewToken,
10183
+ bearerToken: input.bearerToken,
10184
10184
  themeId: props.themeId ?? null,
10185
10185
  themeSelectionId: props.themeSelectionId ?? null,
10186
10186
  themeSelectionVersion: props.themeSelectionVersion ?? null,
@@ -10224,6 +10224,7 @@ function wrapPreviewSiteFontStorage(children, siteFontStorageUrl) {
10224
10224
  }
10225
10225
  function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
10226
10226
  const { apiClient } = useEntryEditorController();
10227
+ const bearerToken = usePreviewToken();
10227
10228
  return /* @__PURE__ */ jsx(PreviewDesignHistoryOrderProvider, { children: /* @__PURE__ */ jsx(PreviewPageDesignEditorStateProvider, {
10228
10229
  apiClient,
10229
10230
  siteId: props.siteId,
@@ -10232,20 +10233,41 @@ function PreviewEditorBody({ props, designEditorEnabled, siteStyleAccess }) {
10232
10233
  children: /* @__PURE__ */ jsxs(MediaEditorProvider, {
10233
10234
  siteId: props.siteId,
10234
10235
  apiClient,
10235
- bearerToken: props.previewToken,
10236
+ bearerToken,
10236
10237
  supabaseUrl: props.supabaseUrl,
10237
10238
  mediaAssets: props.mediaAssets,
10238
10239
  children: [/* @__PURE__ */ jsx(PreviewKeepAliveClient, { baseFetch: props.baseFetch }), wrapPreviewSiteFontStorage(renderShellLayout({
10239
10240
  props,
10240
10241
  apiClient,
10241
- siteStyleAccess
10242
+ siteStyleAccess,
10243
+ bearerToken
10242
10244
  }), props.siteFontStorageUrl)]
10243
10245
  })
10244
10246
  }) });
10245
10247
  }
10248
+ function PreviewBlockApiProvider({ config, children }) {
10249
+ const token = usePreviewToken();
10250
+ return /* @__PURE__ */ jsx(BlockApiProvider, {
10251
+ config: useMemo(() => {
10252
+ if (!config || !token) return config;
10253
+ return {
10254
+ ...config,
10255
+ auth: config.auth.type === "bearer" ? {
10256
+ ...config.auth,
10257
+ token
10258
+ } : config.auth,
10259
+ readAuthority: config.readAuthority?.kind === "preview" ? {
10260
+ ...config.readAuthority,
10261
+ token
10262
+ } : config.readAuthority
10263
+ };
10264
+ }, [config, token]),
10265
+ children
10266
+ });
10267
+ }
10246
10268
  function PreviewShell(props) {
10247
10269
  const { apiBaseUrl, blockApiConfig, siteId, siteSlug, editableId, previewSession, previewToken, pageId, routeId, entryData, contentTypeSchema, initialStatus, initialBlocks, pageMetadata, designEditorEligibility, hideSiteStyleConfigurator = false } = props;
10248
- const apiClient = useMemo(() => createBearerAPIClient(previewToken, apiBaseUrl), [previewToken, apiBaseUrl]);
10270
+ const apiClient = useMemo(() => createGuardedPreviewApiClient(apiBaseUrl), [apiBaseUrl]);
10249
10271
  const { designEditorEnabled, siteStyleAccess } = resolveShellAccess({
10250
10272
  previewSession,
10251
10273
  designEditorEligibility,
@@ -10253,14 +10275,14 @@ function PreviewShell(props) {
10253
10275
  entryData,
10254
10276
  hideSiteStyleConfigurator
10255
10277
  });
10256
- return /* @__PURE__ */ jsx(BlockApiProvider, {
10257
- config: blockApiConfig,
10258
- children: /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
10259
- session: previewSession,
10260
- token: previewToken,
10261
- siteId,
10262
- siteSlug,
10263
- pageId: editableId,
10278
+ return /* @__PURE__ */ jsx(PreviewQueryProvider, { children: /* @__PURE__ */ jsx(PreviewAuthInit, {
10279
+ session: previewSession,
10280
+ token: previewToken,
10281
+ siteId,
10282
+ siteSlug,
10283
+ pageId: editableId,
10284
+ children: /* @__PURE__ */ jsx(PreviewBlockApiProvider, {
10285
+ config: blockApiConfig,
10264
10286
  children: /* @__PURE__ */ jsx(EditorProvider, {
10265
10287
  initialEditingMode: false,
10266
10288
  initialEditingAllowed: false,
@@ -10278,10 +10300,7 @@ function PreviewShell(props) {
10278
10300
  apiClient,
10279
10301
  subscribeToLeaseChanges: props.subscribeToLeaseChanges,
10280
10302
  onLeaseGranted: props.onLeaseGranted,
10281
- liveDrafts: props.liveDrafts ? {
10282
- ...props.liveDrafts,
10283
- previewToken
10284
- } : void 0,
10303
+ liveDrafts: props.liveDrafts ?? void 0,
10285
10304
  children: [/* @__PURE__ */ jsx(PreviewLeaseEditingMode, {}), /* @__PURE__ */ jsx(PreviewEditorBody, {
10286
10305
  props,
10287
10306
  designEditorEnabled,
@@ -10289,8 +10308,8 @@ function PreviewShell(props) {
10289
10308
  })]
10290
10309
  })
10291
10310
  })
10292
- }) })
10293
- });
10311
+ })
10312
+ }) });
10294
10313
  }
10295
10314
  function defaultDesignEditorEligibility(input) {
10296
10315
  if (input.entryData) return { kind: "content-entry" };
@@ -12902,6 +12921,16 @@ function resolveContentStorageUrl(content) {
12902
12921
  //#endregion
12903
12922
  //#region ../preview-next/src/client/sdk/SdkPreviewModeRuntime.tsx
12904
12923
  var SdkPreviewModeRuntime_exports = /* @__PURE__ */ __exportAll({ SdkPreviewModeRuntime: () => SdkPreviewModeRuntime });
12924
+ function SdkEditablePageRenderer(props) {
12925
+ const previewToken = usePreviewToken();
12926
+ return /* @__PURE__ */ jsx(EditablePageRenderer, {
12927
+ ...props,
12928
+ dataContext: {
12929
+ ...props.dataContext,
12930
+ previewToken
12931
+ }
12932
+ });
12933
+ }
12905
12934
  function isSdkCustomBlockArray(value) {
12906
12935
  return Array.isArray(value);
12907
12936
  }
@@ -12956,7 +12985,7 @@ function SdkPreviewModeRuntime(props) {
12956
12985
  previewToken,
12957
12986
  siteId
12958
12987
  ]);
12959
- const editablePage = model.rendering.kind === "overrides-only" ? /* @__PURE__ */ jsx(EditablePageRenderer, {
12988
+ const editablePage = model.rendering.kind === "overrides-only" ? /* @__PURE__ */ jsx(SdkEditablePageRenderer, {
12960
12989
  rendering: { kind: "overrides-only" },
12961
12990
  page,
12962
12991
  dataContext,
@@ -12964,7 +12993,7 @@ function SdkPreviewModeRuntime(props) {
12964
12993
  blockOverrides: typedBlockOverrides ?? {},
12965
12994
  sdkConfig: sdkConfig ?? void 0,
12966
12995
  customBlocks: customBlocks ?? void 0
12967
- }) : /* @__PURE__ */ jsx(EditablePageRenderer, {
12996
+ }) : /* @__PURE__ */ jsx(SdkEditablePageRenderer, {
12968
12997
  theme: requireSdkPreviewTheme(model.theme),
12969
12998
  page,
12970
12999
  dataContext,
@@ -13033,7 +13062,6 @@ function resolveSdkPreviewRuntimeModel(props) {
13033
13062
  siteId,
13034
13063
  apiBaseUrl,
13035
13064
  portalToken: null,
13036
- previewToken: props.previewToken,
13037
13065
  resolvedData: content.resolvedData,
13038
13066
  routes: routeMap,
13039
13067
  pagesByIdentifier: content.pagesByIdentifier ?? void 0,
@@ -13079,4 +13107,4 @@ function deriveDashboardBaseUrlFromApiBaseUrl(apiBaseUrl) {
13079
13107
  }
13080
13108
  }
13081
13109
  //#endregion
13082
- export { FixedBottomSurface as C, getSiteFontsStorageUrl as S, usePreviewBlockCustomizeSelectionOptional as _, usePreviewPageDesignEditorState as a, buildFontPreviewUrl as b, applyPreviewChromeSurfaceToElement as c, buildPreviewDashboardSetupUrl as d, resolvePreviewDashboardSetupHandoff as f, useBlockCustomizeControls as g, usePreviewSiteFontStorageUrl as h, PreviewShellLayout as i, resolvePreviewChromeSurface as l, resolvePreviewSidebarChromeModel as m, SdkPreviewModeRuntime_exports as n, PREVIEW_CHROME_PORTAL_CLASS_NAME as o, resolvePreviewEditorGuidanceModel as p, PreviewShell as r, PREVIEW_CHROME_THEME_CLASS_NAME as s, SdkPreviewModeRuntime as t, canInspectSiteStyle as u, PreviewFormProvider as v, generateFontFaceCss as x, previewWidgetOverrides as y };
13110
+ export { getSiteFontsStorageUrl as C, generateFontFaceCss as S, useBlockCustomizeControls as _, usePreviewPageDesignEditorState as a, previewWidgetOverrides as b, applyPreviewChromeSurfaceToElement as c, canInspectSiteStyle as d, buildPreviewDashboardSetupUrl as f, usePreviewSiteFontStorageUrl as g, resolvePreviewSidebarChromeModel as h, PreviewShellLayout as i, resolvePreviewChromeSurface as l, resolvePreviewEditorGuidanceModel as m, SdkPreviewModeRuntime_exports as n, PREVIEW_CHROME_PORTAL_CLASS_NAME as o, resolvePreviewDashboardSetupHandoff as p, PreviewShell as r, PREVIEW_CHROME_THEME_CLASS_NAME as s, SdkPreviewModeRuntime as t, PREVIEW_THEME_COOKIE_NAME as u, usePreviewBlockCustomizeSelectionOptional as v, FixedBottomSurface as w, buildFontPreviewUrl as x, PreviewFormProvider as y };