/** * usePresence Hook * * Provides document-level presence information with polling. */ import type { ActorPresence } from '@pantheon-systems/css-client'; /** * Options for the usePresence hook. */ export interface UsePresenceOptions { /** Polling interval in ms (default: 10000) */ pollingInterval?: number; /** Include self in presence list (default: false) */ includeSelf?: boolean; } /** * Return value for the usePresence hook. */ export interface UsePresenceReturn { /** All actors present in the document */ actors: ActorPresence[]; /** Actors currently editing */ editingActors: ActorPresence[]; /** Human actors only */ humans: ActorPresence[]; /** Agent actors only */ agents: ActorPresence[]; /** Whether any human is actively editing */ hasActiveHumans: boolean; /** Whether any agent is actively editing */ hasActiveAgents: boolean; /** Loading state */ isLoading: boolean; /** Error state */ error: Error | null; /** Force refresh presence data */ refresh: () => Promise; } /** * Hook for consuming document-level presence data. * * @param options - Configuration options * @returns Presence state and operations * * @example * ```tsx * function CollaboratorList() { * const { actors, hasActiveAgents } = usePresence(); * * return ( *
* {hasActiveAgents && Agents are working...} * {actors.map(actor => ( * * ))} *
* ); * } * ``` */ export declare function usePresence(options?: UsePresenceOptions): UsePresenceReturn;