Shared types

View as Markdown

interface App

Holds information about your TalkJS app.

Properties

custom
: Record<string, string>

Custom data set for this app.

This can be configured from your TalkJS dashboard.

defaultLocale
: string

The default locale.

This can be configured from your TalkJS dashboard.

id
: string

Your app's unique TalkJS ID. You can find it on the Settings page of the TalkJS dashboard.

name
: string

The name of your app.

interface CommonChatboxProps

A collection of props that's shared by every themed component used in the Chatbox UI.

Properties

app
: App

Holds information about your TalkJS app.

chatSearchState
: ChatSearchState

The current state of the chat search

Public interface of the chatbox instance.

conversation
: ConversationSnapshot

The conversation displayed in the chatbox.

conversationId
: string

The ID of the conversation displayed in the chatbox.

Prefer this field instead of common.conversation.id (which always has the same value), as this enables an optimization that prevents needless re-renders.

currentUser
: UserSnapshot

The user that mounted this chatbox.

Describes the capabilities of the current device.

focusedMessage
: MessageSnapshot | null

The message that was most recently scrolled into view as a result of calling one of the following methods: ChatboxController​.focusMessage, ChatboxController​.jumpToPreviousHighlight or ChatboxController​.jumpToNextHighlight

session
: TalkSession

The underlying TalkJS session object that handles sending and receiving chat data.

A translation object which holds localized strings for internationalization purposes.

theme
: Theme

The theme object that the chatbox is currently using.

Tells you which participants are currently typing.

themeCustom (optional)
: any

Arbitrary custom data passed down to the theme.

The data that you pass to ChatboxProps​.themeCustom will show up here so that you can use it from within theme components.

interface CommonConversationListProps

A collection of props that's shared by every themed component used in the ConversationList UI.

Properties

app
: App

Holds information about your TalkJS app.

conversationList
: ConversationListController

Public interface of the conversation list instance.

currentUser
: UserSnapshot

The user that mounted this chatbox.

Describes the capabilities of the current device.

session
: TalkSession

The underlying TalkJS session object that handles sending and receiving chat data.

A translation object which holds localized strings for internationalization purposes.

theme
: Theme

The theme object that the conversation list is currently using.

themeCustom (optional)
: any

Arbitrary custom data passed down to the theme.

The data that you pass to ConversationListProps​.themeCustom will show up here so that you can use it from within theme components.

interface Coordinates

Properties

latitude
: number
longitude
: number

interface DeviceFeatures

Describes the capabilities of the current device.

Properties

isMobile
: boolean

True if the user agents reports the current device as a mobile/tablet.

supportsEmojiPicker
: boolean

True if the browser supports IndexedDB, which the emoji picker depends on.

interface EditorController

Lets you query and control the message editor.

Available inside the MessageField theme component. Connects with the internals of the Editor system component.

Method Overview

attachFile

Open the "attach file" dialog

recordVoiceMessage

Start recording a voice message

send

Send the message and clear the editor

shareLocation

Open the "share location" dialog

toggleEmojiPicker

Open or close the emoji picker

Properties

atTextLimit
: boolean

True if the maximum message length has been exceeded.

Sending should be disabled when true

characterCount
: number

The number of characters in the editor.

Note that this is an estimation, and it may slightly exceed the actual number of characters in the editor.

isEmpty
: boolean

True if the editor is empty.

showEmojiPicker
: boolean

Whether the emoji picker should be shown. Toggle with toggleEmojiPicker.

attachFile

editorController.attachFile()

Open the "attach file" dialog

Returns

void

recordVoiceMessage

editorController.recordVoiceMessage()

Start recording a voice message

Returns

void

send

editorController.send()

Send the message and clear the editor

Returns

void

shareLocation

editorController.shareLocation()

Open the "share location" dialog

Returns

void

toggleEmojiPicker

editorController.toggleEmojiPicker()

Open or close the emoji picker

Returns

void

interface MessagePermissions

A set of permissions the current user has for a given message.

The values of these permissions come from the user's role.

Properties

canAddReaction
: boolean

True if the user has the ability to add an emoji reaction to the given message.

canDeleteMessage
: boolean

True if the user has the ability to delete the given message.

canEditMessage
: boolean

True if the user has the ability to edit the given message.

canLeaveConversation
: boolean

True if the user has the permission to leave a given conversation.

canMarkConversationAsUnread
: boolean

True if the user has the permission to mark the given conversation as unread.

canMention
: boolean

True if mentions are enabled.

canReplyToMessage
: boolean

True if the user has the ability to reply to the given message.

canSearch
: boolean

True if the user can use search and other related features.

canSendVoiceMessage
: boolean

True if voice messages are enabled.

canShareFile
: boolean

True if file sharing is enabled.

canShareLocation
: boolean

True if location sharing is enabled.

showOnlineStatus
: boolean

True if online status indicators are enabled.

showTypingIndicator
: boolean

True if typing indicators are enabled.

type MessageStatus

The current status of the message.

This type can have one of these values:

- "sending" - Message is still being sent to the server. a loading spinner is typically shown in chat UIs.

- "sent" - Message has arrived on the server. Typically represented using a single checkmark in chat UIs.

- "everyoneRead" - Everyone in the conversation has read this message. Typically represented using two checkmarks in chat UIs.

- "virtual" - a virtual message made with the system component

interface Theme

A theme can be used to customize the appearance & behavior of your TalkJS Chatbox and/or ConversationList.

The implementation of TalkJS's default theme is open-source and available on Github.

Properties

AfterMessages
: React.ComponentType<AfterMessagesProps>
AudioBlock
: React.ComponentType<AudioBlockProps>
Avatar
: React.ComponentType<AvatarProps>
BeforeMessages
: React.ComponentType<BeforeMessagesProps>
ChatHeader
: React.ComponentType<ChatHeaderProps>
ChatSearchBox
: React.ComponentType<ChatSearchBoxProps>
CompactMessageContent
: React.ComponentType<CompactMessageContentProps>
ConversationImage
: React.ComponentType<ConversationImageProps>
ConversationListItem
: React.ComponentType<ConversationListItemProps>
FileBlock
: React.ComponentType<FileBlockProps>
GlobalSearchBox
: React.ComponentType<GlobalSearchBoxProps>
GlobalSearchResultHeader
: React.ComponentType<GlobalSearchResultHeaderProps>
GlobalSearchResultItem
: React.ComponentType<GlobalSearchResultItemProps>
GroupChatImage
: React.ComponentType<GroupChatImageProps>
Icon
: React.ComponentType<IconProps>
ImageBlock
: React.ComponentType<ImageBlockProps>
LocationBlock
: React.ComponentType<LocationBlockProps>
Message
: React.ComponentType<MessageProps>
MessageActionMenu
: React.ComponentType<MessageActionMenuProps>
MessageDivider
: React.ComponentType<MessageDividerProps>
MessageField
: React.ComponentType<MessageFieldProps>
MessageListFooter
: React.ComponentType<MessageListFooterProps>
MessageListHeader
: React.ComponentType<MessageListHeaderProps>
NoConversationSelected
: React.ComponentType<NoConversationSelectedProps>
RecordingPreview
: React.ComponentType<RecordingPreviewProps>
ReferencedMessage
: React.ComponentType<ReferencedMessageProps>
ReplyBar
: React.ComponentType<ReplyBarProps>
TextBlock
: React.ComponentType<TextBlockProps>
TimeAgo
: React.ComponentType<TimeAgoProps>
VideoBlock
: React.ComponentType<VideoBlockProps>
VoiceBlock
: React.ComponentType<VoiceBlockProps>
VoiceRecorder
: React.ComponentType<VoiceRecorderProps>

interface Translation

Translation object

Properties

ADD_REACTION
: string
ARIA_CANCEL_RECORDING
: string
ARIA_CANCEL_UPLOAD
: string
ARIA_CHAT
: string
ARIA_CLOSE_CHAT_POPUP
: string
ARIA_INSERT_EMOJI
: string
ARIA_LEAVE_SEARCH_MODE
: string
ARIA_MORE_ACTIONS
: string
ARIA_PAUSE_AUDIO
: string
ARIA_PLAY_AUDIO
: string
ARIA_REACTION_COUNT
: (numReactions: number, emoji: string) => string
ARIA_REPLYING_TO
: (senderName: string, content: string) => string
: string
ARIA_SEARCH_DOWN
: string
ARIA_SEARCH_INSIDE_CONVERSATION
: string
ARIA_SEARCH_UP
: string
ARIA_SET_PLAYBACK_SPEED
: string
ARIA_STOP_RECORDING
: string
AUTH_EXPIRED_OVERLAY_DESCRIPTION
: string
AUTH_EXPIRED_OVERLAY_TITLE
: string
CANCEL
: string
CHAT_NOT_FOUND
: string
CONTACT_INFORMATION_HIDDEN
: string
DAYS
: string
DELETE_MESSAGE
: string
DELETION_EXPLANATION
: string
DESKTOP_NOTIFICATIONS
: string
DESKTOP_NOTIFICATIONS_DEMO_BODY
: string
DESKTOP_NOTIFICATIONS_DEMO_TITLE
: (appName: string) => string
DESKTOP_NOTIFICATIONS_ERROR
: string
DISABLE_TRANSLATION
: string
EDITED_INDICATOR
: string
EDIT_MESSAGE
: string
ENABLE_TRANSLATION
: string
ENTRYBOX_PLACEHOLDER
: string
ENTRYBOX_PLACEHOLDER_CHAT_CLOSED
: string
ENTRYBOX_PLACEHOLDER_CHAT_READONLY
: string
ENTRYBOX_TEXT_LIMIT
: string
HOURS
: string
HUB_EMPTY
: string
HUB_SHOW_EARLIER
: string
INBOX
: string
INBOX_NO_CHATS_BODY
: string
INBOX_NO_CHATS_TITLE
: string
JUST_NOW
: string
LEAVE_CONVERSATION
: string
LOADING
: string
LOCATION
: string
MARK_CONVERSATION_AS_UNREAD
: string
MESSAGELIST_LOADING_OLDER
: string
MESSAGELIST_NEW_MARKER
: string
MESSAGELIST_SHOW_OLDER
: string
MESSAGE_SENT_VIA_EMAIL
: string
MINUTES
: string
REPLY_MODE_LEAVE_ARIA_LABEL
: string
REPLY_TO_MESSAGE
: string
SAVE
: string
SEARCH_NO_MORE_RESULTS
: string
SEARCH_NO_RESULTS
: string
SEARCH_PLACEHOLDER_TEXT
: string
SEARCH_RESULTS_CONVERSATIONS
: string
SEARCH_RESULTS_MESSAGES
: string
SEARCH_RESULTS_SHOW_MORE
: string
SEARCH_SEARCHING
: string
SEND_BUTTON_TEXT
: string
SHARE_LOCATION_ERROR
: string
STATUS_INDICATOR_OFFLINE
: string
STATUS_INDICATOR_ONLINE
: string
TODAY
: string
UPLOAD_ERROR
: string
UPLOAD_IN_PROGRESS
: string
UPLOAD_SEND_FILE
: string
UPLOAD_SHARE_LOCATION
: string
VOICE_MESSAGE
: string
YESTERDAY
: string
YOU_MARKER
: string
locale
: string

interface UserPermissions

A set of permissions for the current user.

The values of these permissions come from the user's role.

Properties

canLeaveConversation
: boolean

True if the user has the permission to leave a given conversation.

canMarkConversationAsUnread
: boolean

True if the user has the permission to mark the given conversation as unread.

canMention
: boolean

True if mentions are enabled.

canSearch
: boolean

True if the user can use search and other related features.

canSendVoiceMessage
: boolean

True if voice messages are enabled.

canShareFile
: boolean

True if file sharing is enabled.

canShareLocation
: boolean

True if location sharing is enabled.

showOnlineStatus
: boolean

True if online status indicators are enabled.

showTypingIndicator
: boolean

True if typing indicators are enabled.

interface VoiceRecorderController

Controller for voice recording. Contains methods and fields related to the voice message currently being recorded.

Use EditorController​.recordVoiceMessage to begin recording a voice message.

Method Overview

cancel

Cancels the recording or preview process.

send

Sends a message containing the just uploaded voice recording.

stop

Stops the voice recording and changes the state to "previewing". This also starts the process of uploading the audio file.

Properties

duration
: number

The amount of seconds since the user began recording.

state
: VoiceRecorderState

Whether "recording" or "previewing".

When not recording at all, the voiceController field is undefined.

uploadState
: UploadState

TalkJS will immediately upload the voice message while it's being previewed. This field lets you know how that's coming along.

recordingUrl (optional)
: string

Defined after stop() has been called. Pass to the src prop of AudioPlayer to preview the recording.

cancel

voiceRecorderController.cancel()

Cancels the recording or preview process.

Returns

void

send

voiceRecorderController.send()

Sends a message containing the just uploaded voice recording.

Returns

void

stop

voiceRecorderController.stop()

Stops the voice recording and changes the state to "previewing". This also starts the process of uploading the audio file.

Returns

void