import { type IChatConversation, type IChatConversationVisualisationContent } from "@gooddata/sdk-backend-spi"; import { type IDashboard, type IGenAIUserContext, type IInsight } from "@gooddata/sdk-model"; import { type SdkErrorType } from "@gooddata/sdk-ui"; import { type GenAIAssistantMode } from "../components/ConfigContext.js"; import { type IChatConversationLocal, type TextContentObject } from "../model.js"; /** * A common event definition for the Chat component. * @public */ export type BaseEvent = { threadId?: string; }; /** * A chat window opened event. * @public */ export type ChatOpenedEvent = BaseEvent & { type: "chatOpened"; }; /** * Type guard for the ChatOpenedEvent. * @public */ export declare const isChatOpenedEvent: (event: ChatEvent) => event is ChatOpenedEvent; /** * A chat window closed event. * @public */ export type ChatClosedEvent = BaseEvent & { type: "chatClosed"; }; /** * Type guard for the ChatClosedEvent. * @public */ export declare const isChatClosedEvent: (event: ChatEvent) => event is ChatClosedEvent; /** * A chat conversation clearing event. * @public */ export type ChatResetEvent = BaseEvent & { type: "chatReset"; }; /** * Type guard for the ChatResetEvent. * @public */ export declare const isChatResetEvent: (event: ChatEvent) => event is ChatResetEvent; /** * A chat conversation pinned state change event. * @public */ export type ChatConversationPinnedEvent = BaseEvent & { type: "chatConversationPinned"; conversation: IChatConversationLocal; pinned: boolean; }; /** * Type guard for the ChatConversationPinnedEvent. * @public */ export declare const isChatConversationPinnedEvent: (event: ChatEvent) => event is ChatConversationPinnedEvent; /** * A chat conversation pinned state change error event. * @public */ export type ChatConversationPinErrorEvent = BaseEvent & { type: "chatConversationPinError"; conversation: IChatConversationLocal; error: Error; }; /** * Type guard for the ChatConversationPinnedEvent. * @public */ export declare const isChatConversationPinErrorEvent: (event: ChatEvent) => event is ChatConversationPinErrorEvent; /** * A chat conversation deleted event. * @public */ export type ChatConversationDeleteEvent = BaseEvent & { type: "chatConversationDelete"; conversation: IChatConversation; }; /** * Type guard for the ChatConversationDeletedEvent. * @public */ export declare const isChatConversationDeleteEvent: (event: ChatEvent) => event is ChatConversationDeleteEvent; /** * A chat conversation deleted success event. * @public */ export type ChatConversationDeletedSuccessEvent = BaseEvent & { type: "chatConversationDeletedSuccess"; conversation: IChatConversation; }; /** * Type guard for the ChatConversationDeletedEvent. * @public */ export declare const isChatConversationDeletedSuccessEvent: (event: ChatEvent) => event is ChatConversationDeletedSuccessEvent; /** * A chat conversation deleted error event. * @public */ export type ChatConversationDeletedErrorEvent = BaseEvent & { type: "chatConversationDeletedError"; conversation: IChatConversation; error: Error; }; /** * Type guard for the ChatConversationDeletedEvent. * @public */ export declare const isChatConversationDeletedErrorEvent: (event: ChatEvent) => event is ChatConversationDeletedErrorEvent; /** * A chat conversation rename event. * @public */ export type ChatConversationRenameEvent = BaseEvent & { type: "chatConversationRename"; conversation: IChatConversationLocal; title: string; }; /** * Type guard for the ChatConversationRenameEvent. * @public */ export declare const isChatConversationRenameEvent: (event: ChatEvent) => event is ChatConversationRenameEvent; /** * A chat conversation renamed success event. * @public */ export type ChatConversationRenamedSuccessEvent = BaseEvent & { type: "chatConversationRenamedSuccess"; conversation: IChatConversationLocal; title: string; }; /** * Type guard for the ChatConversationRenamedSuccessEvent. * @public */ export declare const isChatConversationRenamedSuccessEvent: (event: ChatEvent) => event is ChatConversationRenamedSuccessEvent; /** * A chat conversation renamed error event. * @public */ export type ChatConversationRenamedErrorEvent = BaseEvent & { type: "chatConversationRenamedError"; conversation: IChatConversationLocal; title: string; error: Error; }; /** * Type guard for the ChatConversationRenamedErrorEvent. * @public */ export declare const isChatConversationRenamedErrorEvent: (event: ChatEvent) => event is ChatConversationRenamedErrorEvent; /** * A chat user message event. * @public */ export type ChatUserMessageEvent = BaseEvent & { type: "chatUserMessage"; question: string; objects: TextContentObject[]; }; /** * Type guard for the ChatUserMessageEvent. * @public */ export declare const isChatUserMessageEvent: (event: ChatEvent) => event is ChatUserMessageEvent; /** * A chat assistant message event. * @public */ export type ChatAssistantMessageEvent = BaseEvent & { type: "chatAssistantMessage"; interactionId?: string; useCase: string; }; /** * Type guard for the ChatAssistantMessageEvent. * @public */ export declare const isChatAssistantMessageEvent: (event: ChatEvent) => event is ChatAssistantMessageEvent; /** * A chat feedback event. * @public */ export type ChatFeedbackEvent = BaseEvent & { type: "chatFeedback"; interactionId?: string; feedback: "POSITIVE" | "NEGATIVE" | "NONE"; userTextFeedback?: string; }; /** * Type guard for the ChatFeedbackEvent. * @public */ export declare const isChatFeedbackEvent: (event: ChatEvent) => event is ChatFeedbackEvent; /** * A chat feedback error event. * @public */ export type ChatFeedbackErrorEvent = BaseEvent & { type: "chatFeedbackError"; interactionId?: string; errorMessage: string; }; /** * Type guard for the ChatFeedbackErrorEvent. * @public */ export declare const isChatFeedbackErrorEvent: (event: ChatEvent) => event is ChatFeedbackErrorEvent; /** * A chat visualization error event. * @public */ export type ChatVisualizationErrorEvent = BaseEvent & { type: "chatVisualizationError"; errorType: SdkErrorType; errorMessage?: string; }; /** * Type guard for the ChatVisualizationErrorEvent. * @public */ export declare const isChatVisualizationErrorEvent: (event: ChatEvent) => event is ChatVisualizationErrorEvent; /** * A chat save visualization error event. * @public */ export type ChatSaveVisualizationErrorEvent = BaseEvent & { type: "chatSaveVisualizationError"; errorType: string; errorMessage?: string; }; /** * Type guard for the ChatVisualizationErrorEvent. * @public */ export declare const isChatSaveVisualizationErrorEvent: (event: ChatEvent) => event is ChatSaveVisualizationErrorEvent; /** * A chat save visualization success event. * @public */ export type ChatSaveVisualizationSuccessEvent = BaseEvent & { type: "chatSaveVisualizationSuccess"; savedVisualizationId: string; }; /** * Type guard for the ChatSaveVisualizationSuccessEvent. * @public */ export declare const isChatSaveVisualizationSuccessEvent: (event: ChatEvent) => event is ChatSaveVisualizationSuccessEvent; /** * A chat copy to clipboard event. * @public */ export type ChatCopyToClipboardEvent = BaseEvent & { type: "chatCopyToClipboard"; content: string; }; /** * Type guard for the ChatCopyToClipboardEvent. * @public */ export declare const isChatCopyToClipboardEvent: (event: ChatEvent) => event is ChatCopyToClipboardEvent; /** * A chat copy to clipboard event. * @public */ export type ChatConversationChangedEvent = BaseEvent & { type: "chatConversationChanged"; conversation: IChatConversationLocal; }; /** * Type guard for the ChatCopyToClipboardEvent. * @public */ export declare const isChatConversationChangedEvent: (event: ChatEvent) => event is ChatConversationChangedEvent; /** * A chat definition received event. * @public */ export type ChatDefinitionReceivedEvent = BaseEvent & { type: "onDefinitionReceived"; definitionType: "dashboard" | "visualization"; itemId: string; conversationId: string; interactionId?: string; dashboard?: IDashboard; insights?: IInsight[]; visualization?: NonNullable; }; /** * Type guard for the ChatDefinitionReceivedEvent. * @public */ export declare const isChatDefinitionReceivedEvent: (event: ChatEvent) => event is ChatDefinitionReceivedEvent; /** * A chat mode changed * @public */ export type ChatModeChangeEvent = BaseEvent & { type: "onModeChange"; mode: GenAIAssistantMode; }; /** * Type guard for the ChatModeChangeEvent. * @public */ export declare const isChatModeChangeEvent: (event: ChatEvent) => event is ChatModeChangeEvent; /** * A chat agent changed * @public */ export type ChatAgentChangeEvent = BaseEvent & { type: "onSelectedAgentAction"; previousAgentId?: string; agentId?: string; }; /** * Type guard for the ChatAgentChangeEvent. * @public */ export declare const isChatAgentChangeEvent: (event: ChatEvent) => event is ChatAgentChangeEvent; /** * A chat context change event. * @public */ export type ChatContextChangeEvent = BaseEvent & { type: "onContextChange"; contextType: "ambient" | "user"; userContext?: IGenAIUserContext; replaceUserContext?: boolean; }; /** * Type guard for the ChatContextChangeEvent. * @public */ export declare const isChatContextChangeEvent: (event: ChatEvent) => event is ChatContextChangeEvent; /** * A union type for all chat events. * @public */ export type ChatEvent = ChatOpenedEvent | ChatClosedEvent | ChatResetEvent | ChatModeChangeEvent | ChatConversationPinnedEvent | ChatConversationPinErrorEvent | ChatConversationDeleteEvent | ChatConversationDeletedSuccessEvent | ChatConversationDeletedErrorEvent | ChatConversationRenameEvent | ChatConversationRenamedSuccessEvent | ChatConversationRenamedErrorEvent | ChatUserMessageEvent | ChatAgentChangeEvent | ChatAssistantMessageEvent | ChatFeedbackEvent | ChatFeedbackErrorEvent | ChatContextChangeEvent | ChatCopyToClipboardEvent | ChatVisualizationErrorEvent | ChatSaveVisualizationErrorEvent | ChatSaveVisualizationSuccessEvent | ChatConversationChangedEvent | ChatDefinitionReceivedEvent; /** * An event handler for the Chat component. * @public */ export type ChatEventHandler = { /** * A guard for a specific event type. */ eval: (event: ChatEvent) => event is TEvent; /** * Event handler. */ handler: (event: TEvent) => void; }; /** * A dispatcher for chat events. * @internal */ export declare class EventDispatcher { private handlers; setHandlers(handlers: ChatEventHandler[]): void; dispatch(event: ChatEvent): void; } //# sourceMappingURL=events.d.ts.map