import { ChativaSettings } from '../../core/src/index.ts'; import { ChatStoreState } from '../../../core/src/index.ts'; import { CommandContext } from '../../../core/src/index.ts'; import { CSSResult } from 'lit'; import { GenUIRegistry } from '../../genui/src/index.ts'; import { default as i18n } from 'i18next'; import { LitElement } from 'lit'; import { nothing } from 'lit'; import { TemplateResult } from 'lit'; import { ThemeConfig } from '../../../core/src/index.ts'; import { ToolCall } from '../../../core/src/index.ts'; /** * `` — embedded multi-conversation panel for agent / support desk use. * * Shows a sidebar with the conversation list on the left and the active chat on the right. * Does NOT show a floating button — it's meant to be embedded directly in an application. * * Attributes: * connector — name of the registered connector (default: "dummy") * sidebar-width — CSS width of the conversation sidebar (default: "260px") * * Example: * */ export declare class AgentPanel extends LitElement { static styles: CSSResult; connector: string; sidebarWidth: string; private _activeId; private _msgVersion; private _engine; private _unsubConv; private _unsubMsg; connectedCallback(): void; disconnectedCallback(): void; private _onConvSelect; private _onNewConv; private _onConvClose; private _onSendMessage; private _onChatAction; private _onFeedback; private _onRetry; private _onSendFile; private _onLoadHistory; private _onGenUISendEvent; render(): TemplateResult<1>; } export declare class ChatBotButton extends ChatBotButton_base { #private; static styles: CSSResult; /** True when consumer has placed content in the default slot */ private _hasSlot; private _onSlotChange; render(): TemplateResult<1>; } declare const ChatBotButton_base: (new (...args: any[]) => ChatbotMixinInterface) & typeof LitElement; export declare const ChatbotMixin: >(superClass: T) => Constructor & T; declare class ChatbotMixinInterface { lang: string; theme: ThemeConfig; themeState: ChatStoreState; } export declare class ChatWidget extends ChatWidget_base { static styles: CSSResult; connector: string; /** * Set as HTML attribute to start in fullscreen and hide the toggle: * * Equivalent to: setFullscreen(true) + setAllowFullscreen(false) */ get fulllscreenOnly(): boolean; set fulllscreenOnly(_v: boolean); private _showDropOverlay; private _showConvList; /** True when screen-mode survey is currently displayed over the message list. */ private _showSurveyOverlay; /** True once the end-of-conversation survey has been submitted or skipped this session. */ private _surveyResolved; /** True once the inline survey message has been injected this session. */ private _inlineSurveyInjected; /** Depth counter to handle dragenter/dragleave firing over child elements. */ private _dropDepth; /** Last stable drag position (used in _positionStyle). Triggers a render only at drag start/end. */ private _dragPos; private _wasOpened; private _dragAnchor; private _unsubscribeMessages; private _engine; private _multiEngine; /** True once the engine has been initialised (on first open). */ private _engineInitialised; private _vvRafId; /** * Tracks the visual viewport (the area above the virtual keyboard on iOS). * On iOS Safari, `position: fixed` elements shift when the keyboard opens * because the visual viewport scrolls. We compensate by setting CSS custom * properties `--_vv-top` and `--_vv-height` on the host element; the shadow * stylesheet uses `var(--_vv-top)` / `var(--_vv-height)` inside the mobile * media query so that the widget always fills exactly the visible area. * rAF-throttled to avoid layout thrashing during keyboard animation. */ private _onVisualViewport; connectedCallback(): void; disconnectedCallback(): void; private get _windowMode(); private _onDragStart; private _onMouseMove; private _onTouchMove; private _applyDrag; private _onMouseUp; private _detachDragListeners; private get _widget(); private handleSendMessage; private _onChatAction; private _onFeedback; private _onChatRetry; private _onSendFile; private _onLoadHistory; private _onGenUISendEvent; private _onShowConversations; private _onConvSelect; private _onNewConv; private _onConvClose; private _getSurveyConfig; /** * Decide whether to intercept a user-initiated close in order to show the survey. * Called from the header close button and the Escape key path. */ private _requestClose; private _onCloseRequested; private _onMinimizeRequested; private _onResetSurveyState; private _onSurveySubmitted; private _onSurveySkipped; private _onSurveyClose; /** * Reset the widget after a survey submit / skip. * * When `resetOnSubmit` is true (default), fully tear down the engine and * connector, wipe runtime state, and rebuild the engine so the next open * starts from scratch (fresh connection, empty history, launcher view). * Theme config and the active connector *name* are preserved; host pages * can listen for `chativa-reset` to swap the registered connector instance * before the rebuild (e.g. rotate a DirectLine userId / token). * * When `resetOnSubmit` is false, the session is kept alive — we only close * the widget and reset local survey flags so the next close can trigger * the survey again. */ private _resetConversation; private _onFileDragEnter; private _onFileDragOver; private _onFileDragLeave; private _onFileDrop; /** Element focused before the dialog opened — restored when it closes. */ private _prevActiveElement; /** * Walk the composed shadow tree and collect all focusable elements in DOM * order. Needed because querySelectorAll does not pierce shadow roots. */ private _getFocusable; private _onKeyDown; protected updated(changed: Map): void; private get _positionStyle(); render(): TemplateResult<1> | typeof nothing; } declare const ChatWidget_base: (new (...args: any[]) => ChatbotMixinInterface) & typeof LitElement; /** * Per-locale strings for a slash command. */ export declare interface CommandTranslations { description?: string; /** Optional parameter hint, e.g. "[count]" or "" */ usage?: string; } declare type Constructor = new (...args: any[]) => T; /** * `` — sidebar component for agent-panel mode. * * Reads from `conversationStore` and emits: * - `conversation-select` (detail: { id: string }) * - `new-conversation` (no detail) * - `conversation-close` (detail: { id: string }) */ export declare class ConversationList extends LitElement { static styles: CSSResult; private _convs; private _activeId; private _unsub; connectedCallback(): void; disconnectedCallback(): void; private _initials; private _onSelect; private _onNew; private _onClose; render(): TemplateResult<1>; } /** * End-of-conversation survey — star rating + optional comment. * * Rendered two ways: * - `inline` (default): via `MessageTypeRegistry` as a bot-authored card inside * the message list. `.messageData` / `.messageId` are set by `ChatMessageList`. * - `screen`: as a full-height overlay inside `ChatWidget`. Set `overlay=true`. * * On submit, dispatches `survey-submitted` (bubbles, composed) with * `{ rating, comment, kind, messageId? }`. `ChatWidget` calls * `ChatEngine.sendSurvey(...)`, marks the message as `submitted: true`, and * the card re-renders in its thank-you state. */ export declare class EndOfConversationSurvey extends EndOfConversationSurvey_base { static styles: CSSResult; /** Populated automatically when rendered via ChatMessageList. */ messageData: Record; messageId: string; /** Set to true when rendered as a fullscreen overlay (screen mode). */ overlay: boolean; private _rating; private _hovered; private _comment; private _submitted; private get _config(); private get _maxRating(); private get _requireCommentBelow(); private _onStar; private _onComment; private get _commentRequired(); private get _submitDisabled(); private _submit; private _skip; private _close; private _renderStars; private _renderThanks; render(): TemplateResult<1>; } declare const EndOfConversationSurvey_base: (new (...args: any[]) => ChatbotMixinInterface) & typeof LitElement; export { GenUIRegistry } export { i18n } export declare interface LinkMetadata { title?: string; description?: string; image?: string; favicon?: string; domain?: string; } export declare type LinkMetadataFetcher = (url: string) => Promise; export declare class LinkPreviewCard extends LitElement { static styles: CSSResult; url: string; variant: PreviewVariant; metadataFetcher: LinkMetadataFetcher | null; private _metadata; private _loading; private _error; connectedCallback(): void; updated(changed: Map): void; private _fetchMetadata; private _renderLoading; private _renderFallback; private _renderPreview; render(): TemplateResult<1>; } /** * Config object passed to `registerCommand()`. * * @example * registerCommand({ * name: "help", * translations: { * en: { description: "Show available topics", usage: "[topic]" }, * tr: { description: "Konuları göster", usage: "[konu]" }, * }, * execute({ args }) { * console.log("help", args); * }, * }); */ export declare interface LocalizedCommandConfig { name: string; /** * Locale → translations map. * At minimum supply an "en" entry so there is always a fallback. */ translations: Record; execute(context: CommandContext): void; } declare type PreviewVariant = "compact" | "expanded"; /** * Register a slash command with inline per-locale translations. * * The helper: * 1. Injects the provided strings into i18next (namespace "translation") * under the keys `commands..description` and `commands..usage`. * 2. Registers the command in `SlashCommandRegistry` with lazy description * and usage getters so they are re-evaluated on every render (picks up * language switches automatically). */ export declare function registerCommand(config: LocalizedCommandConfig): void; /** * Mount the Chativa chat widget into a container element. * * ```js * Chativa.render(document.body, { * connector: myConnector, * theme: { colors: { primary: "#1B1464" } }, * locale: "tr", * i18n: { en: { header: { title: "Hey!" } }, tr: { header: { title: "Selam!" } } }, * button: 'Chat', * }); * ``` */ export declare function render(container: HTMLElement, options?: RenderOptions): { widget: HTMLElement; button: HTMLElement | null; }; export declare interface RenderOptions extends ChativaSettings { /** * Floating button configuration. * - `false` → no button * - `true` → default animated button (default) * - `string` → treated as innerHTML for the button (e.g. an `` tag) * - `Node` → appended as a child of `` (slot content) */ button?: boolean | string | Node; } /** * — one-line tool activity strip, expandable to the * full invocation trace. * * Two modes: * - `live` — rendered by the message list while the bot is still working. * The line shows the currently running tool's description (or name) with * a spinner. * - attached (default) — rendered right above a bot message that carries a * `data.toolCalls` trace. The line shows a compact summary * ("N operations · M failed"). * * Clicking the line toggles the full list of s. */ export declare class ToolCallActivity extends LitElement { static styles: CSSResult; toolCalls: ToolCall[]; /** Live mode — the bot is still working; show the current tool + spinner. */ live: boolean; private _expanded; private _toggle; /** Unique tool names, in invocation order — tells the user *which* tools ran. */ private get _toolNames(); private _lineContent; render(): TemplateResult<1> | typeof nothing; } /** * — a single tool invocation. * * Collapsed: one row with the tool name, a status chip * (running / completed / error) and a chevron. Expanded: the invocation * parameters plus the result or error payload. Errors expand automatically * so failures are visible at a glance. */ export declare class ToolCallCard extends LitElement { static styles: CSSResult; toolCall: ToolCall | null; private _expanded; /** Once the user toggles manually, stop auto-expanding on error. */ private _userToggled; private _autoExpandedFor; protected willUpdate(): void; private _toggle; private _renderChip; private _pretty; render(): TemplateResult<1> | typeof nothing; } export { }