UNPKG

@xapp/chat-widget

Version:
77 lines (76 loc) 2.09 kB
import 'rollup-plugin-inject-process-env'; import { ChatUserInfo } from "@xapp/stentor-chat-widget"; import { ChatServerActionLink } from "../xapp/ChatServerMessage"; import { ACCOUNT_STATUS_TYPE, ChatDetail, CONNECTION_STATUS_TYPE, DepartmentUpdateDetail } from "./ChatAction"; interface ChatDepartments { [id: string]: DepartmentUpdateDetail; } export interface ChatAgents { readonly [nick: string]: ChatAgentInfo | undefined; } export interface ChatAgentInfo { readonly typing: boolean; readonly user: ChatUserInfo; readonly joined: boolean; readonly requestFailed?: boolean; } export interface ChatFailureMsgDetail { delay: number; text: string; } export interface ChatState { readonly connection: ConnectionState; accountStatus: ACCOUNT_STATUS_TYPE; departments: ChatDepartments; visitor: ChatUserInfo; /** * Available agents in the chat */ readonly agents: ChatAgents; chats: ChatDetail[]; lastTimestamp: number; lastRatingRequestTimestamp: number; hasRating: boolean; isChatting: boolean; queuePosition: number; failureMsg: ChatFailureMsgDetail; chips: (string | ChatServerActionLink)[]; /** * @deprecated Use userId */ visitorId: string; /** * ID to be used for the user */ userId?: string; /** * Users access token for making authenticated API calls. */ accessToken?: string; /** * Current active contexts */ activeContexts?: readonly string[]; /** * Attributes to be sent on every request. */ attributes?: Record<string, unknown>; /** * ISO-8601 string for when the session expires */ sessionExpiration?: string; visuals: VisualState; sessionId?: string; } export interface VisualState { visible?: boolean; opened?: boolean; drawer?: boolean; } export interface ConnectionState { readonly token: string | null; readonly connectionStatus: CONNECTION_STATUS_TYPE; readonly greetingRequested: boolean; readonly nonce?: string; } export {};