import { InlineFlow } from '@getuserfeedback/sdk/internal/inline-flow'; export { InlineFlow } from '@getuserfeedback/sdk/internal/inline-flow'; import { OpenFlowOptions } from '@getuserfeedback/sdk'; /** * Per-open options for useFlow(). These apply to the specific response created * by that open action and do not affect prerendering. */ interface UseFlowOpenOptions { /** Optional response metadata to preserve with the eventual submission. */ metadata?: OpenFlowOptions["metadata"]; } /** * Return value for useFlow() when container is `"default"`: state and callbacks for the floating flow. */ interface UseFlowReturn { readonly container: "default"; /** True when the flow is visible. */ isOpen: boolean; /** True after open is requested while the flow is not visible yet. */ isLoading: boolean; /** Open the flow. */ open: (options?: UseFlowOpenOptions) => Promise; /** Close the flow. */ close: () => Promise; /** Prefetches the flow resources without opening it. */ prefetch: () => Promise; /** Prerendering warms up the flow for instant display later. */ prerender: () => Promise; } /** * Return value for useFlow() when container is `"custom"`: state and callbacks for host-managed container flows. */ interface UseCustomFlowReturn { readonly container: "custom"; /** True when the flow is visible. */ isOpen: boolean; /** True after open is requested while the flow is not visible yet. */ isLoading: boolean; /** True when your host UI should render the custom container element. */ shouldRenderContainer: boolean; /** Open the flow in the custom container. */ open: (options?: UseFlowOpenOptions) => Promise; /** Close the flow. */ close: () => Promise; /** Prefetches the flow resources without opening it. */ prefetch: () => Promise; /** * @deprecated Use `open()` or `close()` instead. Kept for compatibility. */ setOpen: (next: boolean) => Promise; /** Prerendering warms up the flow for instant display later. */ prerender: () => Promise; /** Ref callback: attach this to the container element where the flow should render. */ containerRef: (element: HTMLDivElement | null) => void; } /** * Internal supplied-flow options; intentionally absent from the public root. * The hook captures one provider client and immutable definition snapshot for * its mounted lifetime; remount the consumer to change either one. * * @see docs/specs/2026-08-02-flow-interaction-model.md */ interface UseFlowOptions { flow: InlineFlow; prefetchOnMount?: boolean; /** Remount the hook to change container mode. */ container?: "default" | "custom"; hideCloseButton?: boolean; } declare function useFlow(options: UseFlowOptions & { container?: "default"; }): UseFlowReturn; declare function useFlow(options: UseFlowOptions & { container: "custom"; }): UseCustomFlowReturn; export { useFlow }; export type { UseCustomFlowReturn, UseFlowOptions, UseFlowReturn };