sticky-horse
Version:
With StickyHorse allow your users to send feedback to your team.
90 lines (89 loc) • 1.98 kB
TypeScript
export interface User {
userId: string;
connectionTime: string;
cursor?: {
x: number;
y: number;
} | null;
isAdmin?: boolean;
location?: {
country: string;
city?: string;
flag?: string;
};
isConnected?: boolean;
currentPage?: string;
}
export interface Comment {
id?: string;
comment: string;
position: {
x: number;
y: number;
};
timestamp: string;
fromUserId: string;
targetUserId?: string;
page?: string;
parentId?: string;
replies?: Comment[];
isAdmin?: boolean;
}
export interface StickyNote {
id?: string;
content: string;
position: {
x: number;
y: number;
};
color: string;
userId: string;
targetUserId?: string;
page?: string;
}
export interface Cursor {
x: number;
y: number;
}
export interface CursorData {
userId: string;
cursor: Cursor;
isAdmin: boolean;
page: string;
connectionTime: string;
}
export interface EmailConfig {
apiKey?: string;
fromEmail: string;
toEmail: string;
serverUrl?: string;
}
export interface StickyHorseConfig {
socketUrl?: string;
userId?: string;
page?: string;
apiKey: string;
email?: EmailConfig;
serverUrl?: string;
onUserJoin?: (user: User) => void;
onUserLeave?: (user: User) => void;
onComment?: (comment: Comment) => void;
onStickyNote?: (note: StickyNote) => void;
onCursorMove?: (cursor: CursorData) => void;
}
export interface TrackingProps {
activeUsers: User[];
isConnected: boolean;
currentUserId: string;
trackedUserId: string | null;
onTrackUser: (userId: string) => void;
isLoading: boolean;
isDemoActive?: boolean;
setIsDemoActive?: (value: boolean) => void;
}
export interface SocketContextType {
socket: any | null;
isConnected: boolean;
users: User[];
}
export type { Socket } from 'socket.io-client';