/** * @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved. * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options */ /** * @module ai/aichat/ui/feed/aichatfeedsuggestionitemview */ import { type Locale } from '@ckeditor/ckeditor5-utils'; import { AIChatFeedItemView, type AIChatItemViewOptions } from './aichatfeeditemview.js'; import { type AISuggestionContentPartDefinition } from '../../../aicore/utils/getsuggestionpartsfromreply.js'; import { type AISuggestionActionName } from './aichatfeedsuggestionitemactionsview.js'; import { type AIReplyChangeGroupState } from '../../../aicore/model/aireply.js'; import { type AISource } from '../../../aicore/aiconnector.js'; import { type AISuggestionBodyViewContentPartView } from '../../../aicore/ui/suggestioncontainer/aisuggestioncontentpartview.js'; import { type AIContentRenderingStrategy } from '../../../aicore/ui/suggestioncontainer/aisuggestionstreamablecontentview.js'; import { type BodyCollection } from '@ckeditor/ckeditor5-ui'; /** * A view for an AI suggestion item in the AI chat feed. * * It hosts a suggestion container and a suggestion actions view. * * It allows for displaying suggestion content and its preview. */ export declare class AIChatFeedSuggestionItemView extends AIChatFeedItemView { /** * @inheritDoc */ options: AIChatFeedSuggestionItemViewOptions; /** * @observable */ isTrackChangesOn: boolean; /** * @inheritDoc */ constructor(locale: Locale, options: AIChatFeedSuggestionItemViewOptions, bodyCollection: BodyCollection); /** * Updates the suggestion content. */ updateContent(options: { parts: Array; renderingStrategy: AIContentRenderingStrategy; abortSignal: AbortSignal; }): Promise; /** * Updates the state of a content part by its index. */ updatePartState(index: number, state: AIReplyChangeGroupState): void; /** * Sets the part active or not (active parts are those currently previewed in a dialog by the user). * * Passing `false` as the first argument deactivates all parts in the suggestion. */ setPartActive(isActive: false): void; setPartActive(index: number, isActive: boolean): void; updateSources(sources: Array): void; getPartView(index: number): AISuggestionBodyViewContentPartView | null; /** * Marks the suggestion as done and additionally updates the visibility of the actions view * depending if any suggestion parts are actionable. */ markAsDone(): void; } export type AIReplyLikeEvent = { name: 'like'; args: [{ replyId: string; }]; }; export type AIReplyDislikeEvent = { name: 'dislike'; args: [{ replyId: string; }]; }; export type AIToggleSuggestionDisplayModeEvent = { name: 'toggleSuggestionDisplayMode'; args: [{ replyId: string; showDiff: boolean; }]; }; export interface AIChatFeedSuggestionItemViewOptions extends AIChatItemViewOptions { /** * A flag indicating whether the item actions should be disabled. */ areActionsDisabled: boolean; /** * A flag indicating whether the suggestion should show the diff or final suggestion. */ showDiff: boolean; /** * The configuration of the advanced reply dropdown in the AI chat feed. */ availableActions: Array; }