import SocketService, { EventHandler } from '../../socket/index.js'; import { EbotifyLiveChatConnectorConfig, SessionUser, SessionSetting, MessageDto } from './types.js'; import 'socket.io-client'; import '../../base/message.js'; import './enums/message-type.js'; import './enums/sender-type.js'; import './enums/socket-events.js'; /** * @class * Handles the EbotifyLiveChat connection * Also dispatch the action to handle data */ declare class EbotifyLiveChatConnector extends SocketService { connected: boolean; private user; private sessionSettings; private explicitlySetUserInfoKeys; /** * Creates an instance of EbotifyLiveChatConnector. * @constructor * @param {EbotifyLiveChatConnectorConfig} config */ constructor(config: EbotifyLiveChatConnectorConfig); /** * @method * return the object of the Session user * @public * @returns {SessionUser} */ getUser(): SessionUser; /** * @method * update the session user detail * @public * @param {SessionUser} user */ updateUser(user: SessionUser): void; /** * @method * Update multiple user info key/value pairs and persist them in storage * Also syncs the in-memory `user` where applicable and stores in sessionStorage * All key-value pairs will be automatically included in the connect event * * @example * connector.updateUserInfo([ * {key: 'name', value: 'John Doe'}, * {key: 'email', value: 'john@example.com'}, * {key: 'department', value: 'Engineering'} * ], true); * * @public * @param {Array<{key: string; value: string}>} updates Array of key-value pairs * @param {boolean} shouldPersist When true, stores in persistent storage */ updateUserInfo(updates: Array<{ key: string; value: string; }>): void; /** * @method * Helper method to update user properties based on key * @private * @param {string} key * @param {string} value */ private _updateUserProperty; /** * @method * return the SessionSetting object * @public * @returns {SessionSetting} */ getSettings(): SessionSetting; /** * @method * update the SessionSetting object * @public * @param {Partial} settings */ updateSettings(settings: Partial): void; /** * @method * Listen the incoming message from the EbotifyLiveChat * @public * @param {EventHandler} handler */ listenMessage(handler: EventHandler): void; /** * @method * Handle the messages */ message(data: MessageDto): void; /** * @method * Create connection with socket */ private _handleConnectEvent; /** * @method * Get only explicitly set user info from storage * @private * @returns {UserInfoDto[]} */ private _getAllStoredUserInfo; /** * @method * Emit the message to the socket * @param data */ private _basePayload; } export { EbotifyLiveChatConnector as default };