@cossistant/next
Version:
Next.js-ready SDK for building AI-powered support/chat widgets. Hooks + primitives, WS-driven, TypeScript-first. Next.js-ready, Tailwind optional.
27 lines • 1.13 kB
TypeScript
//#region ../react/src/hooks/use-conversation.d.ts
type UseConversationOptions = {
enabled?: boolean;
refetchInterval?: number | false;
refetchOnWindowFocus?: boolean;
};
type UseConversationResult = {
conversation: GetConversationResponse["conversation"] | null;
isLoading: boolean;
error: Error | null;
refetch: (args?: GetConversationRequest) => Promise<GetConversationResponse | undefined>;
};
/**
* Loads and caches a single conversation identified by `conversationId`.
*
* The hook keeps the conversations store hydrated, exposes a derived loading
* state that respects cached data and provides a `refetch` helper to manually
* refresh the thread.
*
* @param conversationId The conversation to retrieve; when `null` the hook
* skips requests and returns `null` data.
* @param options Additional react-query style controls for the request.
*/
declare function useConversation(conversationId: string | null, options?: UseConversationOptions): UseConversationResult;
//#endregion
export { UseConversationOptions, UseConversationResult, useConversation };
//# sourceMappingURL=use-conversation.d.ts.map