import type { Node, Text } from '@contentful/rich-text-types'; import type { BasicMetaSysProps, DefaultElements, GetCommentParams, GetEntryParams, GetSpaceEnvironmentParams, Link, MakeRequest, SysLink, VersionedLink } from '../common-types'; interface LinkWithReference extends Link { sys: Link['sys'] & { ref: string; }; } export type CommentSysProps = Pick & { type: 'Comment'; space: SysLink; environment: SysLink; parentEntity: Link<'ContentType'> | LinkWithReference<'ContentType'> | Link<'Entry'> | LinkWithReference<'Entry'> | VersionedLink<'Workflow'>; parent: Link<'Comment'> | null; }; export type PlainTextBodyProperty = 'plain-text'; export type RichTextBodyProperty = 'rich-text'; export type RichTextBodyFormat = { bodyFormat: RichTextBodyProperty; }; export type PlainTextBodyFormat = { bodyFormat?: PlainTextBodyProperty; }; export type CommentStatus = 'active' | 'resolved'; export type CommentProps = { sys: CommentSysProps; body: string; status: CommentStatus; }; export type CreateCommentProps = Omit & { status?: CommentStatus; }; export type UpdateCommentProps = Omit & { sys: Pick; }; export declare enum CommentNode { Document = "document", Paragraph = "paragraph", Mention = "mention" } export interface Mention { nodeType: CommentNode.Mention; data: { target: Link<'User'> | Link<'Team'>; }; content: Text[]; } export interface RootParagraph extends Node { nodeType: CommentNode.Paragraph; content: (Text | Mention)[]; } export interface RichTextCommentDocument extends Node { nodeType: CommentNode.Document; content: RootParagraph[]; } export type RichTextCommentBodyPayload = { body: RichTextCommentDocument; }; export type RichTextCommentProps = Omit & RichTextCommentBodyPayload; export type GetCommentParentEntityParams = GetSpaceEnvironmentParams & ({ parentEntityType: 'ContentType'; parentEntityId: string; parentEntityReference?: string; } | { parentEntityType: 'Entry'; parentEntityId: string; parentEntityReference?: string; } | { parentEntityType: 'Workflow'; parentEntityId: string; parentEntityVersion?: number; }); export type GetManyCommentsParams = (GetEntryParams | GetCommentParentEntityParams) & { status?: CommentStatus; }; export type CreateCommentParams = (GetEntryParams | GetCommentParentEntityParams) & { parentCommentId?: string; }; export type UpdateCommentParams = GetCommentParams; export type DeleteCommentParams = GetCommentParams & { version: number; }; type CommentApi = { update(): Promise; delete(): Promise; }; export interface Comment extends CommentProps, DefaultElements, CommentApi { } export interface RichTextComment extends Omit, RichTextCommentProps, DefaultElements, CommentApi { } /** * @private */ export default function createCommentApi(makeRequest: MakeRequest): CommentApi; /** * @private */ export declare function wrapComment(makeRequest: MakeRequest, data: CommentProps | RichTextCommentProps): Comment | RichTextComment; /** * @private */ export declare const wrapCommentCollection: (makeRequest: MakeRequest, data: import("../common-types").CollectionProp) => import("../common-types").Collection; export {};