@veltdev/sdk
Version:
Velt is an SDK to add collaborative features to your product within minutes. Example: Comments like Figma, Frame.io, Google docs or sheets, Recording like Loom, Huddles like Slack and much more.
43 lines (42 loc) • 1.48 kB
TypeScript
import { Location } from './location.model';
export interface IUnreadCommentsMap {
[annotationId: string]: number;
}
export type UnreadCommentsMap = IUnreadCommentsMap | null;
export interface IUnreadCommentsCount {
count: number;
}
export type UnreadCommentsCount = IUnreadCommentsCount | null;
export interface TransformContext {
containerSelector: string;
transforms: {
scale: number;
transformOrigin: string;
inverseScale?: number;
};
}
/**
* Context data returned by the comment context provider.
* This is a flexible object that can contain custom properties.
*/
export interface CommentContext {
/**
* Optional comment type. When set to 'manual', the comment will be treated as a manual comment
* and the target element will be removed.
*/
commentType?: 'manual' | string;
/**
* Allow additional custom properties
*/
[key: string]: unknown;
}
export type CommentContextProviderResponse = CommentContext | null | undefined;
/**
* A function that provides custom context for comments.
* Can return the context synchronously or asynchronously via a Promise.
*
* @param documentId - The ID of the document
* @param location - Optional location information
* @returns The comment context object or a Promise that resolves to it
*/
export type CommentContextProvider = (documentId: string, location?: Location) => CommentContextProviderResponse | Promise<CommentContextProviderResponse>;