import { TrackChangeCustomAttribute, TrackChangeImagePreview } from '../../../../document-api/src/index.js'; import { CommentEvent, Comment as CommonComment, CommentThreadingStyle } from '../../../../../shared/common'; import { Modules, StoryLocator } from '../../core/types/index.js'; export declare const COMMENT_RECONCILIATION_TOKEN: unique symbol; type ReadOnlyMutationOutcome = { ok: false; reason: 'read-only-document'; }; type TrackedChangeDecision = 'accept' | 'reject'; type SelectionBounds = { top: number; left: number; right: number; bottom: number; }; type CommentMention = { name?: string | null; email?: string | null; }; type CommentAuthor = { name?: string | null; email?: string | null; }; type TrackedChangeDetailLine = { excerpt: string; label: string; }; type CommentSelectionParams = { documentId?: string | null; page?: number; selectionBounds?: Partial | null; source?: string | null; }; type CommentChange = { key: string; value: unknown; previousValue?: unknown; }; type CommentsUpdateEvent = { type: CommentEvent; changes?: CommentChange[]; comment: unknown; }; type CommentsHost = { emit: (event: 'comments-update', payload: CommentsUpdateEvent) => unknown; commentsStore?: { getConfig?: { readOnly?: boolean; }; }; config?: { modules?: Modules; }; }; type CommentIdentity = { commentId?: string; importedId?: string | null; parentCommentId?: string | null; trackedChangeParentId?: string | null; trackedChangeThreadParentId?: string | null; threadingParentCommentId?: string | null; }; export type UseCommentParams = CommentIdentity & { uid?: string; trackedChangeSide?: string | null; fileId?: string | null; fileType?: string | null; createdAtVersionNumber?: number | null; isInternal?: boolean; mentions?: CommentMention[]; isFocused?: boolean; creatorId?: string | null; creatorEmail?: string | null; creatorName?: string | null; creatorImage?: string | null; createdTime?: number; importedAuthor?: CommentAuthor | null; docxCommentJSON?: unknown; origin?: CommonComment['origin']; threadingMethod?: CommonComment['threadingMethod']; threadingStyleOverride?: CommentThreadingStyle; originalXmlStructure?: CommonComment['originalXmlStructure']; commentText?: string; selection?: CommentSelectionParams; trackedChange?: boolean; trackedChangeType?: string | null; trackedChangeText?: string | null; trackedChangeDisplayType?: string | null; semanticColorKey?: string | null; semanticColor?: string | null; trackedChangeStory?: StoryLocator | null; trackedChangeStoryKind?: string | null; trackedChangeStoryLabel?: string; trackedChangeAnchorKey?: string | null; trackedChangeCanonicalId?: string | null; trackedChangePositionAliases?: string[]; deletedText?: string | null; trackedChangeLabel?: string | null; trackedChangeDetailLines?: TrackedChangeDetailLine[] | null; trackedChangeImagePreview?: TrackChangeImagePreview | null; customAttributes?: readonly TrackChangeCustomAttribute[] | null; resolvedTime?: number | null; resolvedById?: string | null; resolvedByEmail?: string | null; resolvedByName?: string | null; trackedChangeDecision?: TrackedChangeDecision | null; }; type ResolveCommentParams = { id?: string | null; email?: string | null; name?: string | null; superdoc: CommentsHost; decision?: TrackedChangeDecision; reconciliationToken?: symbol; }; type SetTextParams = { text: string; superdoc?: CommentsHost; suppressUpdate: true; } | { text: string; superdoc: CommentsHost; suppressUpdate?: false; }; /** * Comment composable */ export default function useComment(params: UseCommentParams): { uid: string | undefined; commentId: string; importedId: string | null | undefined; parentCommentId: string | null | undefined; trackedChangeParentId: string | null | undefined; trackedChangeThreadParentId: string | null | undefined; trackedChangeSide: string | null | undefined; fileId: string | null | undefined; fileType: string | null | undefined; mentions: { name?: string | null | undefined; email?: string | null | undefined; }[]; commentElement: HTMLElement | null; isFocused: boolean; creatorId: string | null; creatorEmail: string | null; creatorName: string | null; creatorImage: string | null; createdTime: number; isInternal: boolean; commentText: string; selection: { documentId: unknown; page: number | undefined; selectionBounds: { top?: number | undefined; left?: number | undefined; right?: number | undefined; bottom?: number | undefined; }; getValues: () => { documentId: unknown; page: number | undefined; selectionBounds: { top?: number; left?: number; right?: number; bottom?: number; }; source: string | null | undefined; }; getContainerId: () => string; getContainerLocation: (parentContainer: Pick | null | undefined) => { top: number; left: number; }; source: string | null | undefined; }; floatingPosition: { top?: number | undefined; left?: number | undefined; right?: number | undefined; bottom?: number | undefined; }; trackedChange: boolean | undefined; deletedText: string | null; trackedChangeType: string | null; trackedChangeText: string | null; trackedChangeDisplayType: string | null; semanticColorKey: string | null; semanticColor: string | null; trackedChangeStory: StoryLocator | null; trackedChangeStoryKind: string | null; trackedChangeStoryLabel: string; trackedChangeAnchorKey: string | null; trackedChangeCanonicalId: string | null; trackedChangePositionAliases: string[]; trackedChangeDecision: TrackedChangeDecision | null; trackedChangeLabel: string | null; trackedChangeDetailLines: { excerpt: string; label: string; }[] | null; trackedChangeImagePreview: { src: string; contentType: string; role: "deleted" | "inserted" | "before" | "after"; partUri?: string | undefined; relationshipId?: string | undefined; width?: number | undefined; height?: number | undefined; alt?: string | undefined; } | null; customAttributes: readonly { name: string; namespaceUri: string; localName: string; value: string; }[] | null; resolvedTime: number | null; resolvedById: string | null; resolvedByEmail: string | null | undefined; resolvedByName: string | null | undefined; importedAuthor: { name?: string | null | undefined; email?: string | null | undefined; } | null; docxCommentJSON: {} | null; origin: "word" | "google-docs" | "unknown" | undefined; threadingMethod: "commentsExtended" | "range-based" | "mixed" | undefined; threadingStyleOverride: CommentThreadingStyle | undefined; threadingParentCommentId: string | null | undefined; originalXmlStructure: { hasCommentsExtended: boolean; hasCommentsExtensible: boolean; hasCommentsIds: boolean; } | undefined; setText: ({ text, superdoc, suppressUpdate }: SetTextParams) => ReadOnlyMutationOutcome | undefined; getValues: () => { uid: string | undefined; commentId: string | undefined; importedId: string | null | undefined; parentCommentId: string | null | undefined; trackedChangeParentId: string | null | undefined; trackedChangeThreadParentId: string | null | undefined; trackedChangeSide: string | null | undefined; fileId: string | null | undefined; fileType: string | null | undefined; mentions: { name: string | null | undefined; email?: string | null | undefined; }[]; createdAtVersionNumber: number | null | undefined; creatorId: string | null; creatorEmail: string | null; creatorName: string | null; creatorImage: string | null; createdTime: number; importedAuthor: { name?: string | null | undefined; email?: string | null | undefined; } | null; docxCommentJSON: {} | null; isInternal: boolean; commentText: string; selection: { documentId: unknown; page: number | undefined; selectionBounds: { top?: number; left?: number; right?: number; bottom?: number; }; source: string | null | undefined; } | null; trackedChange: boolean | undefined; trackedChangeText: string | null; trackedChangeType: string | null; trackedChangeDisplayType: string | null; semanticColorKey: string | null; semanticColor: string | null; trackedChangeStory: StoryLocator | null; trackedChangeStoryKind: string | null; trackedChangeStoryLabel: string; trackedChangeAnchorKey: string | null; trackedChangeCanonicalId: string | null; trackedChangePositionAliases: string[]; trackedChangeDecision: TrackedChangeDecision | null; trackedChangeLabel: string | null; trackedChangeDetailLines: { excerpt: string; label: string; }[] | null; trackedChangeImagePreview: { src: string; contentType: string; role: "deleted" | "inserted" | "before" | "after"; partUri?: string | undefined; relationshipId?: string | undefined; width?: number | undefined; height?: number | undefined; alt?: string | undefined; } | null; customAttributes: readonly { name: string; namespaceUri: string; localName: string; value: string; }[] | null; deletedText: string | null; resolvedTime: number | null; resolvedById: string | null; resolvedByEmail: string | null | undefined; resolvedByName: string | null | undefined; origin: "word" | "google-docs" | "unknown" | undefined; threadingMethod: "commentsExtended" | "range-based" | "mixed" | undefined; threadingStyleOverride: CommentThreadingStyle | undefined; threadingParentCommentId: string | null | undefined; originalXmlStructure: { hasCommentsExtended: boolean; hasCommentsExtensible: boolean; hasCommentsIds: boolean; } | undefined; }; resolveComment: ({ id, email, name, superdoc, decision, reconciliationToken, }: ResolveCommentParams) => ReadOnlyMutationOutcome | undefined; setIsInternal: ({ isInternal: newIsInternal, superdoc, }: { isInternal: boolean; superdoc: CommentsHost; }) => ReadOnlyMutationOutcome | undefined; updatePosition: (coords: SelectionBounds, parentElement: Pick) => void; getCommentUser: () => { name: string; email: string | null | undefined; id?: undefined; image?: undefined; } | { id: string | null; name: string | null; email: string | null; image: string | null; }; updateIdentityValues: (updates?: CommentIdentity) => void; }; export type CommentModel = ReturnType; export {};