ChatState

data class ChatState(val phase: ChatPhase = ChatPhase.IDLE, val connection: HatangConnectionState = HatangConnectionState.DISCONNECTED, val config: SiteConfig? = null, val visitor: VisitorDto? = null, val conversation: ConversationSummary? = null, val timeline: Timeline = Timeline.EMPTY, val pending: List<PendingMessage> = emptyList(), val typingAgent: String? = null, val availability: Availability = Availability.OFFLINE, val unread: Int = 0, val locale: HatangLocale = HatangLocale.VI, val needsEmail: Boolean = false, val skippedEmail: Boolean = false, val rated: Int? = null, val transientError: HatangException? = null, val outdatedReason: String? = null, val visitorEmail: String? = null, val visitorName: String? = null, val loadingEarlier: Boolean = false, val visible: Boolean = false, val foreground: Boolean = true, val draft: String? = null)

Immutable snapshot of everything the UI renders (ChatEngine.state).

Constructors

Link copied to clipboard
constructor(phase: ChatPhase = ChatPhase.IDLE, connection: HatangConnectionState = HatangConnectionState.DISCONNECTED, config: SiteConfig? = null, visitor: VisitorDto? = null, conversation: ConversationSummary? = null, timeline: Timeline = Timeline.EMPTY, pending: List<PendingMessage> = emptyList(), typingAgent: String? = null, availability: Availability = Availability.OFFLINE, unread: Int = 0, locale: HatangLocale = HatangLocale.VI, needsEmail: Boolean = false, skippedEmail: Boolean = false, rated: Int? = null, transientError: HatangException? = null, outdatedReason: String? = null, visitorEmail: String? = null, visitorName: String? = null, loadingEarlier: Boolean = false, visible: Boolean = false, foreground: Boolean = true, draft: String? = null)

Properties

Link copied to clipboard

Team availability.

Link copied to clipboard

visible && foreground: incoming messages count as read.

Link copied to clipboard
val config: SiteConfig? = null

Site settings (after bootstrap).

Link copied to clipboard
Link copied to clipboard

The active conversation.

Link copied to clipboard
val draft: String? = null

Text held back by the pre-chat form; sent once it is answered.

Link copied to clipboard
val foreground: Boolean = true

The app is in the foreground.

Link copied to clipboard
val loadingEarlier: Boolean = false

An earlier page is loading.

Link copied to clipboard

Locale in use.

Link copied to clipboard
val needsEmail: Boolean = false

Show the pre-chat (offline) form before sending.

Link copied to clipboard

The site is online (someone or the bot can reply).

Link copied to clipboard
val outdatedReason: String? = null

Why the gateway wants a newer SDK.

Link copied to clipboard

Outgoing messages without an ack.

Link copied to clipboard

Life-cycle phase.

Link copied to clipboard
val rated: Int? = null

Score the visitor gave (from a rated event or rate).

Link copied to clipboard

Host-facing session view.

Link copied to clipboard
val skippedEmail: Boolean = false

The visitor skipped the optional email form this session.

Link copied to clipboard

Loaded items.

Link copied to clipboard

Last error worth a banner (cleared by the UI).

Link copied to clipboard
val typingAgent: String? = null

Name of the agent typing (empty string when unnamed); null when nobody is.

Link copied to clipboard
val unread: Int = 0

Messages received while the screen was not visible.

Link copied to clipboard
val visible: Boolean = false

The conversation is on screen.

Link copied to clipboard
val visitor: VisitorDto? = null

The visitor (after bootstrap).

Link copied to clipboard
val visitorEmail: String? = null

Email known for the visitor (from bootstrap, identify or forms).

Link copied to clipboard
val visitorName: String? = null

Name known for the visitor.