import type { ConnectionStatus, GrantPayload } from "../core/types.js"; /** Configuration for the {@link useVanaConnect} hook. */ export interface UseVanaConnectConfig { /** Polling interval in milliseconds (default: 2000). */ pollingInterval?: number; /** SDK environment (`"dev"` or `"prod"`). Defaults to `"prod"`. */ environment?: "dev" | "prod"; } /** Return value of the {@link useVanaConnect} hook. */ export interface UseVanaConnectResult { /** Starts polling the Session Relay for the given session. */ connect: (params: { sessionId: string; connectUrl?: string; }) => void; /** Current connection status. */ status: ConnectionStatus; /** Grant payload after user approval, or `null`. */ grant: GrantPayload | null; /** Error message, or `null`. */ error: string | null; /** URL to account.vana.org where the user signs in and launches Data Connect, or `null`. */ connectUrl: string | null; /** Resets all state back to idle and stops polling. */ reset: () => void; } /** * @deprecated For current Account browser approval, use `useDirectVanaConnect` * from `@opendatalabs/vana-sdk/react`. This hook uses legacy Session Relay. * * React hook that polls the Session Relay and manages connection state. * * Call `connect()` with a session ID (from your server's `/api/connect` route) * to begin polling. The hook will update `status` through the lifecycle: * `idle` -> `connecting` -> `waiting` -> `approved` | `denied` | `expired` | `error`. * * @param config - Optional configuration for polling interval and environment. * @returns A {@link UseVanaConnectResult} with state and actions. * * @example * ```tsx * const { connect, status, grant, connectUrl } = useVanaConnect(); * * useEffect(() => { * connect({ sessionId: "sess-123" }); * }, []); * * if (status === "waiting") return Open Vana; * if (status === "approved") return
Connected! Grant: {grant!.grantId}
; * ``` */ export declare function useVanaConnect(config?: UseVanaConnectConfig): UseVanaConnectResult; //# sourceMappingURL=useVanaConnect.d.ts.map