import { EventEmitter } from '../stencil-public-runtime'; import { Message } from '@rasahq/chat-widget-sdk'; export declare class RasaChatbotWidget { private client; private messageDelayQueue; private disconnectTimeout; private sentMessage; /** * The CSAT prompt currently driving the thumbs popup. Captured so the * `feedbackSubmitted` handler can persist a per-prompt answered hash to * sessionStorage, which makes the answered check survive a page refresh * even when the server replays the same prompt on reconnect. */ private currentCsatMessage; el: HTMLRasaChatbotWidgetElement; isOpen: boolean; isFullScreen: boolean; messageHistory: Message[]; messages: Message[]; typingIndicator: boolean; cachedMessages: Element[]; isConnected: boolean; showFeedback: boolean; feedbackSubmitted: boolean; /** * True from the moment the thank-you starts fading out until the popup * fully unmounts. Used to collapse the chat content's bottom padding in * sync with the popup's fade, so the chat bubbles glide down as the popup * disappears - one continuous motion instead of fade-then-snap. */ isFeedbackDismissing: boolean; csatQuestion: string; csatThankYou: string; /** * Default payloads sent to the channel when the user picks a rating. These * fill the CALM `csat_score` slot via the response-button `/SetSlots` syntax. * A CSAT request from the bot can override these per-message. */ private csatPayloads; /** * Emitted when the Chat Widget is opened by the user */ chatSessionStarted: EventEmitter<{ sessionId: string; }>; /** * Emitted when the user receives a message */ chatWidgetReceivedMessage: EventEmitter; /** * Emitted when the user sends a message */ chatWidgetSentMessage: EventEmitter; /** * Emitted when the user click on quick reply */ chatWidgetQuickReply: EventEmitter; /** * Emitted when the Chat Widget is opened by the user */ chatWidgetOpened: EventEmitter; /** * Emitted when the Chat Widget is closed by the user */ chatWidgetClosed: EventEmitter; /** * Emitted when a user clicks on a hyperlink option. */ chatWidgetHyperlinkClicked: EventEmitter; /** * Emitted when a user is starting to download a file. */ chatWidgetFileStartedDownload: EventEmitter; /** * Emitted when conversation feedback is submitted. The `rating` value * matches the Rasa CALM `csat_score` slot vocabulary (`satisfied` / * `unsatisfied`). */ chatWidgetFeedbackSubmitted: EventEmitter<{ rating: 'satisfied' | 'unsatisfied'; helpful: boolean; }>; /** * Url of the Rasa chatbot backend server (example: https://example.com) */ serverUrl: string; /** * User authentication token */ authenticationToken: string; /** * Title of the Chat Widget */ widgetTitle: string; /** * Static icon for the chatbot */ botIcon: string; /** * Static icon for the widget */ widgetIcon: string; /** * Indicates if a message timestamp should be displayed */ displayTimestamp: boolean; /** * Format of the message timestamp */ messageTimestamp: string; /** * Data that should be sent on Chat Widget initialization */ initialPayload: string; /** * ID of a user engaged with the Chat Widget */ senderId: string; /** * Indicates time between message is received and printed. * */ messageDelay: number; /** * If set to True, bot messages will be received as stream (printing word by word). * */ streamMessages: boolean; /** * If set to True, it will open the chat, triggering the 'initialPayload' immediately if set. * */ autoOpen: boolean; /** * Message that should be displayed if an error occurs */ errorMessage: string; /** * Indicates whether the chat messenger can be toggled to full screen mode. * */ toggleFullScreen: boolean; /** * Message placeholder for input */ inputMessagePlaceholder: string; /** * If set to True, instead of the default WebSocket communication, the widget will use the HTTP protocol. * */ restEnabled: boolean; /** * If set to True, shows conversation feedback component at the bottom of the chat. * */ enableFeedback: boolean; /** * Text for the feedback question. If empty, feedback component will not be shown. * */ feedbackQuestionText: string; /** * Text for the thank you message after feedback submission. If empty, no thank you message will be shown. * */ feedbackThankYouText: string; /** * Text to display before the session start date in session divider * */ sessionStartedText: string; /** * Font family to use for the widget. Defaults to 'Lato, sans-serif' * */ fontFamily: string; componentWillLoad(): void; private scrollToBottom; private sessionConfirm; private onNewMessage; /** * Activates the thumbs feedback component in response to a bot-driven CSAT * request. The question and thank-you text default to the widget props but * can be overridden per-request by the bot. Option payloads (sent to the * channel on submit) can likewise be overridden by the bot. */ private handleCsatRequest; /** * Detects a standard buttons message that is actually a CSAT request and, if * so, shows the thumbs popup using the bot's own button payloads instead of * rendering the buttons in the chat. Returns true when handled as CSAT * (even if the popup is suppressed because the same prompt was already * answered earlier in this tab's session). */ private handleCsatButtons; private loadHistory; private connect; private disconnect; private emitChatWidgetOpenCloseEvents; private toggleOpenState; connectedCallback(): void; private sendMessageHandler; private quickReplySelected; private linkClickedHanlder; private handleFeedbackSubmitted; private getAltText; private toggleFullscreenMode; /** * Reacts to runtime changes of the `authentication-token` attribute / prop. * * Without this watcher, the token is captured once in `componentWillLoad` * and locked into the underlying Rasa client. Host pages that set the token * asynchronously (after the custom element is already in the DOM) would end * up with an empty/stale token for the entire lifetime of the widget, * causing every request to be sent without the `Authorization` header. */ onAuthenticationTokenChange(newToken: string, oldToken: string): void; onMessagesChange(): void; private renderMessage; render(): any; }