/** * @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/aicore/ui/suggestioncontainer/aisuggestionbodyview */ import { type Locale } from "@ckeditor/ckeditor5-utils"; import { type BodyCollection, View } from "@ckeditor/ckeditor5-ui"; import { AISuggestionBodyViewContentPartView } from "./aisuggestioncontentpartview.js"; import { type AISuggestionContentPartDefinition } from "../../utils/getsuggestionpartsfromreply.js"; import { type AISuggestionActionName } from "../../../aichat/ui/feed/aichatfeedsuggestionitemactionsview.js"; import { type AIReplyChangeGroupState, type AIReplyChangeGroupOutdatedReason } from "../../model/aireply.js"; import { type AISource } from "../../aiconnector.js"; /** * A read-only gating state for one suggestion reply: per-part (by change-group index) read-only flags and * whether "apply/suggest all" is currently enabled. Computed by the controller, applied by the views. */ export type AISuggestionGating = { readOnlyByIndex: Map; isAcceptAllEnabled: boolean; }; /** * The inner view of the suggestion container that displays the content of the suggestion (or multiple parts of it). */ export declare class AISuggestionBodyView extends View { /** * The observable that "apply/suggest all" action binds to. * * @observable */ isAcceptAllEnabled: boolean; /** * Observable property that indicates whether the track changes are on. */ isTrackChangesOn: boolean; constructor(locale: Locale, options: { areActionsDisabled: boolean; showUnchangedParts: boolean; availableActions: Array; bodyCollection: BodyCollection; }); /** * @inheritDoc */ override destroy(): void; /** * Gets the number of content parts in the suggestion. */ get partsCount(): number; /** * Updates the content parts of the suggestion. */ updateContentParts({ parts, abortSignal, skipLoadingEffects }: { parts: Array; abortSignal?: AbortSignal; /** * When `true`, all loading-state UI (skeleton, debounce timers) is bypassed and content * parts are inserted immediately. Use for content that is already complete and should * appear without any progressive-reveal delay (e.g. conversation history replays). */ skipLoadingEffects?: boolean; }): Promise; /** * Updates the state of a content part by its index. */ updatePartState(index: number, state: AIReplyChangeGroupState, outdatedReason?: AIReplyChangeGroupOutdatedReason): void; /** * Applies the gating state. * * Sets each existing part view's read-only flag and the "apply/suggest all" enablement. * Parts still streaming pick up the read-only flag on creation. */ setGating({ readOnlyByIndex, isAcceptAllEnabled }: AISuggestionGating): 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. */ setPartActive(isActive: false): void; setPartActive(index: number, isActive: boolean): void; /** * Displays and updates the web sources of the suggestion. */ updateSources(sources: Array): void; /** * Gets the view of a content part by its index. */ getPartView(index: number): AISuggestionBodyViewContentPartView | null; /** * Marks the body view as done. * * Updates the visibility of the empty parts warning that will show up if some parts in the suggestion are empty. */ markAsDone(): void; /** * Specifies whether among the displayed parts there are any that have any content that can be browsed or accepted. */ get hasNonEmptyParts(): boolean; }