/** * React entry point for the Vana SDK direct Data Portability flow. * * @remarks * Exposes {@link useDirectVanaConnect} (and the underlying framework-agnostic * connect-flow store) for browser apps. This entry point is browser-safe and * imports nothing Node-only. `react` is a peer dependency. * * @example * ```tsx * "use client"; * import { useDirectVanaConnect } from "@opendatalabs/vana-sdk/react"; * * export function ConnectNotesButton() { * const connect = useDirectVanaConnect({ * createRequest: () => fetch("/api/vana/request", { method: "POST" }).then((r) => r.json()), * getStatus: (id) => fetch(`/api/vana/status?requestId=${id}`).then((r) => r.json()), * readResult: (id) => fetch(`/api/vana/data?requestId=${id}`).then((r) => r.json()), * }); * const { state, start } = connect; * return ( *
* * {state.type === "awaiting_approval" && ( * // Fallback link: if the browser blocked the approval popup, the user * // can still open it manually instead of the flow silently hanging. * * {state.popupBlocked ? "Popup blocked — open approval" : "Open approval"} * * )} * {state.type === "ready_to_open" && ( * // Mobile deep Direct: render the HTTPS continuation as a primary tap. * // The SDK keeps polling in this tab; if the tab is lost, restart. * * Open Vana * * )} *
* ); * } * ``` * * @category Direct * @module react */ export { useDirectVanaConnect, type UseDirectVanaConnectOptions, type UseDirectVanaConnectResult, } from "./direct/use-direct-vana-connect.js"; export { createDirectConnectFlow, type ConnectWindow, type DirectBrowserPlatform, type DirectBrowserPlatformPolicy, type DirectConnectFlow, type DirectConnectRetryOutcome, type DirectConnectState, type DirectConnectOptions, type DirectConnectTransports, } from "./direct/connect-flow.js"; export type { ForegroundDelivery, AccessRequest, AccessRequestStatus, AccessRequestStatusValue, ApprovedDataResult, } from "./direct/types.js";