@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.
52 lines (51 loc) • 1.45 kB
TypeScript
//#region ../react/src/hooks/use-conversation-auto-seen.d.ts
declare const CONVERSATION_AUTO_SEEN_DELAY_MS = 2000;
type UseConversationAutoSeenOptions = {
/**
* The Cossistant client instance.
*/
client: CossistantClient | null;
/**
* The real conversation ID. Pass null if no conversation exists yet.
*/
conversationId: string | null;
/**
* Current visitor ID.
*/
visitorId?: string;
/**
* The last timeline item in the conversation.
* Used to determine if we should mark as seen.
*/
lastTimelineItem: TimelineItem | null;
/**
* Whether to enable auto-seen tracking.
* Default: true
*/
enabled?: boolean;
};
/**
* Automatically marks timeline items as seen when:
* - A new timeline item arrives from someone else
* - The page is visible/focused
* - The visitor is the current user
*
* Also handles:
* - Fetching and hydrating initial seen data
* - Preventing duplicate API calls
* - Page visibility tracking
*
* @example
* ```tsx
* useConversationAutoSeen({
* client,
* conversationId: realConversationId,
* visitorId: visitor?.id,
* lastTimelineItem: items[items.length - 1] ?? null,
* });
* ```
*/
declare function useConversationAutoSeen(options: UseConversationAutoSeenOptions): void;
//#endregion
export { CONVERSATION_AUTO_SEEN_DELAY_MS, UseConversationAutoSeenOptions, useConversationAutoSeen };
//# sourceMappingURL=use-conversation-auto-seen.d.ts.map