UNPKG

@xapp/chat-widget

Version:
51 lines (50 loc) 1.93 kB
import 'rollup-plugin-inject-process-env'; import { ActionType } from "../store/ChatAction"; import { ChatServer, ChatServerOptions, OfflineMessage, VisitorInfoMessage } from "./ChatServer"; import { ChatMessageRequest, ChatServerMessage } from "./ChatServerMessage"; export interface StentorDirectChatConfig { readonly url: string; readonly key: string; readonly timeout?: number; } export declare class StentorDirectChat implements ChatServer { private visitorInfo; private _userId; private _sessionId; private _accessToken; private _attributes; private dispatch; private isNewSession; private readonly configurableMessages; private readonly config; private readonly options; private readonly hooks?; constructor(config: StentorDirectChatConfig, options?: ChatServerOptions); init(dispatch: (action: ActionType) => void): void; private setConnectionStatus; private setAccountStatus; private sendNewMessage; private userJoined; private typing; private stopTyping; private sendFailureMessage; sendOfflineMsg(_: OfflineMessage, cb: (error?: Error) => void): void; sendChatMsg(message: ChatServerMessage, cb: (err?: Error) => void): Promise<void>; bargeOut(_cb: (err?: Error) => void): Promise<void>; bargeIn(_agentName: string, _cb: (err?: Error) => void): Promise<void>; private getBot; sendChatMsgRequest(serviceRequest: ChatMessageRequest, cb: (err?: Error) => void): Promise<void>; sendTyping(): void; setVisitorInfo(visitorInfo: VisitorInfoMessage, sessionId: string, cb: (error?: Error) => void): void; sendChatRating(): void; sendFile(_: File, cb: (err?: Error) => void): void; markAsRead(): void; flush(): void; dispose(): void; sleep(): void; wakeup(): void; private postMessage; private startSession; get userId(): string; get sessionId(): string; }