ChatPanelMixin

Configs

5

The path to an avatar to display at the top of the chat bubble area

An array of DomConfig items to show tool icons associated with each remote speech bubble. Each tool can be clicked by the user to perform an action. Upon clicking a tool, the chat panel will trigger a {#event-bubbleToolClick} event with details.

An introductory text (or DomConfig) shown at the top of the chat bubble area

The initial messages to display in the chat bubble area (e.g. a bot greeting message "Hello, how may I help you?"

Set to true to show a timestamp below each chat bubble

Properties

8

Class hierarchy

isChatPanelMixin: Boolean= truereadonly
Identifies an object as an instance of ChatPanelMixin class, or subclass thereof.
isChatPanelMixin: Boolean= truereadonlystatic
Identifies an object as an instance of ChatPanelMixin class, or subclass thereof.

Other

The path to an avatar to display at the top of the chat bubble area

An array of DomConfig items to show tool icons associated with each remote speech bubble. Each tool can be clicked by the user to perform an action. Upon clicking a tool, the chat panel will trigger a {#event-bubbleToolClick} event with details.

An introductory text (or DomConfig) shown at the top of the chat bubble area

The initial messages to display in the chat bubble area (e.g. a bot greeting message "Hello, how may I help you?"

Set to true to show a timestamp below each chat bubble

A reference to the data store storing all the chat messages.

Functions

1

Add a message bubble to the chat log. Accepts data for the ChatMessageModel, or a Promise that later resolves to such data. When passed a promise, the bubble will show a loading indicator until resolved.

ParameterTypeDescription
messagePromise | ChatMessageModelConfig

A message config object, or a Promise resolving a string with the text

Events

2

Fired when chat bubble tool icon is clicked.

// Adding a listener using the "on" method
chatPanelMixin.on('bubbleToolClick', ({ source, tool, message }) => {

});
ParameterTypeDescription
sourceChatPanel

This panel

toolString

The tool identifier

messageChatMessageModelConfig

The message data for the associated chat bubble

Fired when a client side message is added via the text input field (or by picking a predefined option bubble).

// Adding a listener using the "on" method
chatPanelMixin.on('localMessage', ({ source, text, id }) => {

});
ParameterTypeDescription
sourceChatPanel

This panel

textString

The text

idString

The message id

Event handlers

2

Called when chat bubble tool icon is clicked.

new ChatPanelMixin({
    onBubbleToolClick({ source, tool, message }) {

    }
});
ParameterTypeDescription
sourceChatPanel

This panel

toolString

The tool identifier

messageChatMessageModelConfig

The message data for the associated chat bubble

Called when a client side message is added via the text input field (or by picking a predefined option bubble).

new ChatPanelMixin({
    onLocalMessage({ source, text, id }) {

    }
});
ParameterTypeDescription
sourceChatPanel

This panel

textString

The text

idString

The message id