@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.
30 lines (29 loc) • 1.27 kB
TypeScript
//#region ../react/src/hooks/use-conversations.d.ts
type UseConversationsOptions = Partial<Omit<ListConversationsRequest, "visitorId">> & {
enabled?: boolean;
refetchInterval?: number | false;
refetchOnWindowFocus?: boolean;
};
type UseConversationsResult = {
conversations: ListConversationsResponse["conversations"];
pagination: ConversationPagination | null;
isLoading: boolean;
error: Error | null;
refetch: (args?: Partial<ListConversationsRequest>) => Promise<ListConversationsResponse | undefined>;
};
/**
* Fetches and subscribes to the authenticated visitor's conversation list.
*
* The hook keeps the store in sync with the REST client and exposes
* pagination metadata plus a refetch helper for manual refreshes. The
* `options` mirror the public API filters so the UI can request slices of the
* inbox without duplicating data-fetching logic.
*
* @param options Filtering and lifecycle controls for the query.
* @returns Conversations, pagination data, loading state, and a refetch
* helper.
*/
declare function useConversations(options?: UseConversationsOptions): UseConversationsResult;
//#endregion
export { UseConversationsOptions, UseConversationsResult, useConversations };
//# sourceMappingURL=use-conversations.d.ts.map