import type { ChatMessageBase } from './types'; import type { ComponentProps, Hooks, Renderer } from '../../types'; export type ResultCardStatus = 'hidden' | 'loading' | 'streaming' | 'complete' | 'failed'; export type ResultCardClassNames = { root: string | string[]; header: string | string[]; headerTitle: string | string[]; minimizeButton: string | string[]; body: string | string[]; loader: string | string[]; message: string | string[]; suggestions: string | string[]; expandButton: string | string[]; continueButton: string | string[]; }; export type ResultCardTranslations = { /** * The title displayed in the header. */ headerTitle: string; /** * Accessible label for the button that collapses the card to its header. */ minimizeLabel: string; /** * Accessible label for the button that restores a minimized card. */ maximizeLabel: string; /** * The text of the button that shows a clipped answer in full. */ expandText: string; /** * The text of the button that clips an expanded answer again. */ collapseText: string; /** * The text of the button that hands the conversation to the chat. */ continueInChatText: string; /** * The text of the retry button shown when the generation failed. */ retryText: string; }; export type ResultCardOwnProps = ComponentProps<'section'> & { status: ResultCardStatus; /** * The card's conversation: the user turn, then the assistant answer. */ messages: TMessage[]; /** * The error of the latest failed generation. */ error?: Error; /** * Follow-up suggestions sent by the agent with the answer. Only shown when * the conversation can continue in the chat. */ suggestions?: string[]; onRetry: () => void; /** * Whether the card is collapsed to its header. The answer keeps generating * meanwhile. */ minimized: boolean; onToggleMinimize: () => void; /** * Whether a `chat` widget with the same agent is available to hand the * conversation to. */ canContinueInChat: boolean; /** * Hands the conversation to the chat; `message` is the follow-up to send. */ onContinueInChat: (message?: string) => void; /** * Whether a long answer shows in full rather than clipped. */ expanded: boolean; onExpandedChange: (expanded: boolean) => void; translations?: Partial; classNames?: Partial; }; export declare function createResultCardComponent({ createElement, Fragment, useState, useEffect, }: Renderer & Pick): (userProps: ResultCardOwnProps) => JSX.Element | null;