import { EmbedConfig, EmbedHandle, LauncherConfig, FloatHandle, TriggerConfig, ShowOnce, ThemeConfig } from '@perspective-ai/sdk'; export { AutoOpenConfig, BrandColors, EmbedConfig, EmbedError, EmbedHandle, FloatHandle, ShowOnce, TeaserConfig, ThemeValue, TriggerConfig } from '@perspective-ai/sdk'; import { ReactNode, HTMLAttributes, RefObject } from 'react'; import * as react_jsx_runtime from 'react/jsx-runtime'; /** Options for usePopup hook */ interface UsePopupOptions extends Omit { /** Controlled open state */ open?: boolean; /** Callback when open state changes */ onOpenChange?: (open: boolean) => void; } /** Return type for usePopup hook */ interface UsePopupReturn { /** Open the popup */ open: () => void; /** Close the popup */ close: () => void; /** Toggle the popup */ toggle: () => void; /** Whether the popup is currently open */ isOpen: boolean; /** The underlying SDK handle (null when closed) */ handle: EmbedHandle | null; } /** * Headless hook for programmatic popup control. * Use this when you need custom trigger elements or programmatic control. * * @example * ```tsx * // Basic usage with custom trigger * const { open, isOpen } = usePopup({ researchId: "abc" }); * Open Survey * * // Controlled mode * const [isOpen, setIsOpen] = useState(false); * const popup = usePopup({ * researchId: "abc", * open: isOpen, * onOpenChange: setIsOpen * }); * ``` */ declare function usePopup(options: UsePopupOptions): UsePopupReturn; /** Options for useSlider hook */ interface UseSliderOptions extends Omit { /** Controlled open state */ open?: boolean; /** Callback when open state changes */ onOpenChange?: (open: boolean) => void; } /** Return type for useSlider hook */ interface UseSliderReturn { /** Open the slider */ open: () => void; /** Close the slider */ close: () => void; /** Toggle the slider */ toggle: () => void; /** Whether the slider is currently open */ isOpen: boolean; /** The underlying SDK handle (null when closed) */ handle: EmbedHandle | null; } /** * Headless hook for programmatic slider control. * Use this when you need custom trigger elements or programmatic control. * * @example * ```tsx * const { open, isOpen } = useSlider({ researchId: "abc" }); * Give Feedback * ``` */ declare function useSlider(options: UseSliderOptions): UseSliderReturn; /** Launcher config with React support — icon accepts ReactNode in addition to SDK types */ interface LauncherConfigReact extends Omit { icon?: LauncherConfig["icon"] | ReactNode; } /** Options for useFloatBubble hook */ interface UseFloatBubbleOptions extends Omit { /** Controlled open state */ open?: boolean; /** Callback when open state changes */ onOpenChange?: (open: boolean) => void; /** Customize the floating launcher button appearance */ launcher?: LauncherConfigReact; } /** Return type for useFloatBubble hook */ interface UseFloatBubbleReturn { /** Open the float bubble window */ open: () => void; /** Close the float bubble window */ close: () => void; /** Toggle the float bubble window */ toggle: () => void; /** Unmount the float bubble entirely */ unmount: () => void; /** Whether the float bubble window is currently open */ isOpen: boolean; /** The underlying SDK handle (null until mounted) */ handle: FloatHandle | null; } /** * Headless hook for float bubble lifecycle management. * Creates a floating bubble button that expands into a chat window. * The bubble mounts on component mount and unmounts on component unmount. * * @example * ```tsx * // Basic usage - bubble mounts on component mount * useFloatBubble({ researchId: "abc" }); * * // With programmatic control * const { open, close, isOpen } = useFloatBubble({ researchId: "abc" }); * * ``` */ declare function useFloatBubble(options: UseFloatBubbleOptions): UseFloatBubbleReturn; interface UseAutoOpenOptions extends Omit { trigger: TriggerConfig; showOnce?: ShowOnce; } interface UseAutoOpenReturn { /** Cancel the pending trigger */ cancel: () => void; /** Whether the trigger has fired */ triggered: boolean; } declare function useAutoOpen(options: UseAutoOpenOptions): UseAutoOpenReturn; /** * Fetch embed config (theme, appearance, launcher) from the API. * Returns undefined while loading, then the resolved config. * Results are cached and deduplicated across hooks sharing a researchId. */ declare function useEmbedConfig(researchId: string, host?: string): ThemeConfig | undefined; type Theme = "light" | "dark"; type ThemeInput = "light" | "dark" | "system"; /** * Hook to resolve theme based on override and system preference. * Listens for system preference changes when theme is "system". */ declare function useThemeSync(theme?: ThemeInput): Theme; declare function useStableCallback any) | undefined>(callback: T): T; interface WidgetProps extends Omit, Omit, "onError" | "onSubmit"> { /** Ref to access the embed handle for programmatic control */ embedRef?: RefObject; } /** * Inline widget embed component. * Renders the interview directly in a container. */ declare function Widget({ researchId, params, brand, theme, host, frame, disableJsonLdAttribution, onReady, onVisualReady, onSubmit, onNavigate, onClose, onError, embedRef, className, style, ...divProps }: WidgetProps): react_jsx_runtime.JSX.Element; interface FullpageProps extends Omit { /** Ref to access the embed handle for programmatic control */ embedRef?: RefObject; } /** * Full viewport embed component. * Takes over the entire screen with the interview. */ declare function Fullpage({ researchId, params, brand, theme, host, disableJsonLdAttribution, onReady, onSubmit, onNavigate, onClose, onError, embedRef, }: FullpageProps): react_jsx_runtime.JSX.Element | null; interface FloatBubbleProps extends Omit { /** Ref to access the handle for programmatic control */ embedRef?: RefObject; /** Customize the floating launcher button appearance */ launcher?: LauncherConfigReact; } /** * Floating bubble widget that expands into a chat window. * This is a convenience wrapper around useFloatBubble hook. * * @example * ```tsx * * ``` */ declare function FloatBubble({ researchId, params, brand, theme, host, channel, welcomeMessage, teaser, disableJsonLdAttribution, launcher, onReady, onSubmit, onNavigate, onClose, onError, embedRef, }: FloatBubbleProps): react_jsx_runtime.JSX.Element | null; interface DiscoveryMetadataProps { /** Override the SDK version in the structured data */ version?: string; } /** * Server-side React component that renders JSON-LD structured data * for AEO (Answer Engine Optimization). * * Place this in your layout or page to ensure AI crawlers that don't * execute JavaScript can still identify Perspective AI on your site. * * The client SDK's `injectJsonLd()` checks for the * `[data-perspective-jsonld]` attribute to avoid duplicates. * * @example * // In a Next.js layout or page (server component) * import { DiscoveryMetadata } from '@perspective-ai/sdk-react'; * * export default function Layout({ children }) { * return ( * * * * * {children} * * ); * } */ declare function DiscoveryMetadata({ version }: DiscoveryMetadataProps): react_jsx_runtime.JSX.Element; export { DiscoveryMetadata, type DiscoveryMetadataProps, FloatBubble, type FloatBubbleProps, Fullpage, type FullpageProps, type UseAutoOpenOptions, type UseAutoOpenReturn, type UseFloatBubbleOptions, type UseFloatBubbleReturn, type UsePopupOptions, type UsePopupReturn, type UseSliderOptions, type UseSliderReturn, Widget, type WidgetProps, useAutoOpen, useEmbedConfig, useFloatBubble, usePopup, useSlider, useStableCallback, useThemeSync };