import { ReactNode } from 'react'; import { QuotaKind } from '../quota'; import { AIAssistantPanelProps } from './AIAssistantPanel'; import { AssistantNavigate } from './AssistantMarkdownRenderer'; import { AssistantOverlayKeys } from './assistantOverlayState'; export interface AssistantOverlayContextValue { isOpen: boolean; open: () => void; close: () => void; toggle: () => void; docked: boolean; toggleDock: () => void; /** Width the docked panel takes from the page right now, in px (0 if none). */ dockWidthPx: number; keys: AssistantOverlayKeys; } /** The overlay state in force, or null when no provider is mounted. */ export declare function useAssistantOverlayOrNull(): AssistantOverlayContextValue | null; /** * Width, in px, the docked assistant takes from the right of the page — 0 when * it is closed, floating, on a phone, or not mounted at all. The same value is * published as `var(--assistant-dock-width)` on `` for CSS consumers. */ export declare function useAssistantDockWidth(): number; /** * Listen for `:quota-exhausted` and hand each wall to the product. * * ★ The handler is read through a ref, so the listener is registered ONCE per * product id. Re-subscribing whenever a product passes a fresh inline function * would drop an event that arrived between the cleanup and the new listener. * * Called synchronously at dispatch. A product that must first see whether some * other dialog claims the wall (by deferring a tick, as a product microfrontend * might) does that inside its handler. */ export declare function useAssistantQuotaExhausted(product: string | null, onExhausted: (kind: QuotaKind, event: Event) => void): void; export interface AssistantOverlayProviderProps { /** * Short product prefix for the toggle event and the storage keys — see * `assistantOverlayKeys`. A host adopting this overlay keeps its existing * prefix, so remembered state and existing dispatchers carry over. */ keyPrefix: string; /** * Forward the assistant's quota walls to the product's own upgrade UI. * `product` is the id the assistant dispatches under (the * `AssistantProductProvider` id). Absent, nothing listens. */ quota?: { product: string; onExhausted: (kind: QuotaKind, event: Event) => void; }; children: ReactNode; } /** * Owns whether the assistant is open and docked, for the whole shell. * * ★★ Storage is written AFTER React commits, from one effect per value, never * inside a state updater. An updater must be pure — React may call it more than * once for one update, and Strict Mode does so on purpose — and one effect per * value catches every way it changes (launcher, shortcut, toggle event, Escape, * the panel's own close and dock buttons) without each path remembering to * persist. * * Mount ONE per page: the published dock width is a single `` variable. */ export declare function AssistantOverlayProvider({ keyPrefix, quota, children, }: AssistantOverlayProviderProps): import("react/jsx-runtime").JSX.Element; /** What the overlay hands the panel it renders. */ export interface AssistantOverlayPanelProps { panelId: string; visible: boolean; onClose: () => void; docked: boolean; onToggleDock: () => void; onNavigate?: AssistantNavigate; } export interface AssistantOverlayProps { /** Panel id handed to the panel. */ panelId?: string; /** * Extra props for the default `AIAssistantPanel` — `writeAccess`, * `connectSourceHref`, `preview`. The overlay's own props always win. * * ★★ `preview` is bridged HERE, by the overlay, not by the panel — so a * product surface outside the panel keeps following a run after the assistant * is closed (BOFF-7367). A `renderPanel` wrapper that hands its panel the * same controller should pass it here too; one it passes only to its panel is * bridged by that panel, for that panel's lifetime. */ panelProps?: Omit; /** * Render something other than the shared `AIAssistantPanel` — a product * wrapper around it. Receives the props the overlay owns; spread them. */ renderPanel?: (props: AssistantOverlayPanelProps) => ReactNode; /** * The product router's navigate. When given, links in replies route in-app; * when absent, they stay ordinary anchors. */ navigate?: (path: string) => void; /** Paths rendered without the shell hosting this overlay: opened in a new tab. */ isShellLessTarget?: (path: string) => boolean; /** Top of the docked side panel, below the product's header. Default 56. */ topOffsetPx?: number; /** Launcher icon. Default: a sparkles glyph. */ launcherIcon?: ReactNode; /** Launcher's inset above the bottom chrome. Default `1.5rem`. */ launcherBottomInset?: string; /** Hide the launcher when the product opens the assistant from its own chrome. */ showLauncher?: boolean; } /** * The launcher and the window. Renders nothing without an * `AssistantOverlayProvider` above it — there is no state to show. */ export declare function AssistantOverlay(props: AssistantOverlayProps): import("react/jsx-runtime").JSX.Element | null; //# sourceMappingURL=AssistantOverlay.d.ts.map