realtimecursor
Version:
Real-time collaboration system with cursor tracking and approval workflow
54 lines (53 loc) • 1.62 kB
TypeScript
import React from 'react';
import { RealtimeCursorSDK, RealtimeCursorConfig, User, Comment } from './legacy';
export interface UseRealtimeCursorOptions {
autoConnect?: boolean;
}
export declare function useRealtimeCursor(config: RealtimeCursorConfig, options?: UseRealtimeCursorOptions): {
client: any;
user: any;
loading: any;
error: any;
isAuthenticated: any;
login: (email: string, password: string) => Promise<any>;
register: (userData: {
email: string;
password: string;
firstName: string;
lastName: string;
}) => Promise<any>;
logout: () => void;
};
export declare function useProject(client: RealtimeCursorSDK, projectId?: string, user?: User): {
project: any;
content: any;
comments: any;
stagedChanges: any;
history: any;
collaborators: any;
cursors: any;
loading: any;
error: any;
updateContent: (newContent: string) => Promise<{
staged: boolean;
changeId: string;
} | {
staged: boolean;
changeId?: undefined;
}>;
updateCursor: (position: {
x: number;
y: number;
textPosition?: number;
}) => void;
addComment: (commentData: {
text: string;
selectedText: string;
startPosition?: number;
endPosition?: number;
}) => Promise<Comment>;
reviewChange: (changeId: string, approve: boolean, feedback?: string) => Promise<{
approved: boolean;
}>;
};
export declare function useCursorTracking(editorRef: React.RefObject<HTMLTextAreaElement>, client: RealtimeCursorSDK): void;