/* Copyright (c), CKSource Holding sp. z o.o. All rights reserved. */ import AddSuggestionResponse from './responses/addsuggestionresponse'; import GetSuggestionResponse from './responses/getsuggestionresponse'; import { type IWebSocketGateway } from '../websocketgateway/websocketgateway'; import type { ISuggestion } from './descriptors/suggestiondescriptor'; import type { ITrackChangesConnectDetails } from './descriptors/connectdetailsdescriptor'; export declare const _SERVICE: number; interface ISuggestionUpdateProps { hasComments?: boolean; state?: string; attributes?: Record; } export interface IBatchUpdateSuggestionsStateParams { ids: string[]; state: string; } export interface ITrackChangesConnectWithDetailsResult { suggestions: ISuggestion[]; /** * The authors of the suggestions, when {@link ITrackChangesConnectDetails#includeUsers} was requested. It is missing * when the server does not support the request. Fetch the users with `User.getMany()` then. When the server cannot * fetch the users, the connect fails. */ users?: Record[]; } declare const TrackChangesService_base: import("@ckeditor/ckeditor5-utils").EmitterMixinConstructor object>; declare class TrackChangesService extends /* #__PURE__ -- @preserve */ TrackChangesService_base { private readonly _documentId; private _isConnected; private _wsGateway?; private _channel?; private static readonly _SERVICE; constructor(_documentId: string); get isConnected(): boolean; /** * Connects to WebSocketGateway and starts listening on channel. */ connect(wsGateway: IWebSocketGateway): Promise; /** * Connects as {@link #connect} does, and also resolves with the requested details. */ connectWithDetails(wsGateway: IWebSocketGateway, details: ITrackChangesConnectDetails): Promise; /** * Disconnects TrackChangesService from CKEditor Cloud Services. */ disconnect(): void; /** * Adds suggestion and returns AddSuggestionResponse. */ add(id: string, type: string, data: Record, originalSuggestionId?: string | null, attributes?: Record): Promise; /** * Returns suggestion with given id. */ get(id: string, attempt?: number): Promise; /** * Returns suggestions from given documentId. */ getAll(): Promise; /** * Updates suggestion. */ update(id: string, props?: ISuggestionUpdateProps): Promise; batchUpdateState(params: IBatchUpdateSuggestionsStateParams): Promise; /** * Sends the given connect message and applies its response. */ private _connect; /** * Starts to listen on a given channel. */ private _connectToChannel; /** * Processes websocket gateway state changes. */ private _onWsGatewayStateChange; private _sendRequest; } export default TrackChangesService;