import { JSONContent } from '@tiptap/react'; import { MessageEditorProps } from '../components/v2/message-editor/message-editor'; import { AnnotationBadgeTargetType } from './types/annotation-badge-types'; import { TextMessageType } from './types/message-types'; type MessageActionCallback = (content: JSONContent | null) => Promise | TextMessageType | void; type MessageEditActionCallback = (id: string, content: JSONContent | null) => Promise | void; interface ThreadedAnnotationsBaseProps { messages: TextMessageType[]; isResolved?: boolean; /** Display name of the user who resolved the thread. */ resolvedBy?: string; /** Unix timestamp (ms) when the thread was resolved. */ resolvedAt?: number; maxCharacterCount?: number; onDelete: (id: string) => void; onThreadDelete?: () => void; onAvatarClick: (id: number) => void; /** * Called when the user selects Copy link from a message's options menu. When omitted, the menu * item is hidden. The consumer owns URL construction and clipboard writes. */ onCopyLink?: (id: string) => void; /** * Called when the user saves an edited message. `content` is `null` when the editor was emptied. * Required to enable the Edit action, together with `permissions.canEdit` and `!isEditDisabled`. */ onEdit?: MessageEditActionCallback; /** * Maps an `onEdit` error to an inline editor message; return `undefined` for the default message. * Always invoked, even if the editor unmounts mid-save, so use it to log or toast on failure. */ onEditError?: (error: unknown) => string | undefined; onResolve?: (id: string) => void; onUnresolve?: (id: string) => void; onPost: MessageActionCallback; onPostError?: (error: unknown) => string | undefined; /** * When true, enables the rich text experience in every composer (create, reply, edit). * Defaults to false. Hosts gate this on their own feature split — the package has no * flag mechanism. */ isRichTextEnabled?: boolean; /** * Called when the user toggles a rich text format from the formatting bar or a keyboard * shortcut in any composer. `isActive` is the format's state after the toggle. */ onFormatToggle?: MessageEditorProps['onFormatToggle']; userSelectorProps: MessageEditorProps['userSelectorProps']; /** When true, globally disables replies (hides reply buttons and blocks editor opening on click). */ isReplyDisabled?: boolean; /** When true, or when the thread is resolved, hides the Edit menu item and blocks EDIT dispatch. */ isEditDisabled?: boolean; /** Called when the editor is opened or closed. Receives `true` when opened, `false` when closed. */ onEditorOpenChange?: (isOpen: boolean) => void; /** When true, collapses the editor and replies panel. */ collapsed?: boolean; /** * When true, the thread mounts expanded (all replies visible, editor open unless replies are * disabled) instead of collapsed. Initial state only — changing it after mount has no effect, * and `collapsed` always wins. Threads with no messages always mount expanded. */ defaultExpanded?: boolean; /** * When true, applies a visual highlight (border + background tint) to the thread card. * Clearing the prop fades the treatment out over 1s — the caller owns hold timing. Not a focus state. */ isHighlighted?: boolean; /** * When false, the reply composer does not autofocus or scroll itself into view when the thread * opens. Defaults to true. Set false when deep-linking to a specific message so the composer's * mount-time focus scroll does not fight the host's scroll-to-message. */ autoFocusReplyEditor?: boolean; } interface AnnotationModeProps extends ThreadedAnnotationsBaseProps { isAnnotations: true; annotationTarget?: never; onAnnotationBadgeClick?: never; originalContentDeleted?: never; } interface CommentModeProps extends ThreadedAnnotationsBaseProps { isAnnotations?: false; annotationTarget?: AnnotationBadgeTargetType; /** Called when the annotation badge is clicked. Receives the root message id. */ onAnnotationBadgeClick?: (id: string) => void; /** When true, renders the badge in a disabled (grayed) state with a tooltip. */ originalContentDeleted?: boolean; } export type ThreadedAnnotationsProps = AnnotationModeProps | CommentModeProps; export declare const ThreadedAnnotations: (props: ThreadedAnnotationsProps) => import("react/jsx-runtime").JSX.Element; export {};