/// import type EventEmitter from "events"; import { AuthenticationCreds } from './Auth'; import { Chat, PresenceData } from './Chat'; import { Contact } from './Contact'; import { ConnectionState } from './State'; import { proto } from '../Proto'; import { GroupMetadata, ParticipantAction } from './GroupMetadata'; import { MessageUpdateType, MessageUserReceiptUpdate, WAMessage, WAMessageKey, WAMessageUpdate } from './Message'; export declare type SuperChatsEventMap = { 'statusFind': string; 'qrcode': string; /** connection state has been updated -- WS closed, opened, connecting etc. */ 'connection.update': Partial; /** credentials updated -- some metadata, keys or something */ 'creds.update': Partial; /** set chats (history sync), chats are reverse chronologically sorted */ 'chats.set': { chats: Chat[]; isLatest: boolean; }; /** set messages (history sync), messages are reverse chronologically sorted */ 'messages.set': { messages: WAMessage[]; isLatest: boolean; }; /** set contacts (history sync) */ 'contacts.set': { contacts: Contact[]; }; /** upsert chats */ 'chats.upsert': Chat[]; /** update the given chats */ 'chats.update': Partial[]; /** delete chats with given ID */ 'chats.delete': string[]; /** presence of contact in a chat updated */ 'presence.update': { id: string; presences: { [participant: string]: PresenceData; }; }; 'contacts.upsert': Contact[]; 'contacts.update': Partial[]; 'messages.delete': { keys: WAMessageKey[]; } | { jid: string; all: true; }; 'messages.update': WAMessageUpdate[]; /** * add/update the given messages. If they were received while the connection was online, * the update will have type: "notify" * */ 'messages.upsert': { messages: WAMessage[]; type: MessageUpdateType; }; 'message-receipt.update': MessageUserReceiptUpdate[]; 'messages.reaction': { key: WAMessageKey; reaction: proto.IReaction; operation: 'add' | 'remove'; }; 'groups.upsert': GroupMetadata[]; 'groups.update': Partial[]; /** apply an action to participants in a group */ 'group-participants.update': { id: string; participants: string[]; action: ParticipantAction; }; 'blocklist.set': { blocklist: string[]; }; 'blocklist.update': { blocklist: string[]; type: 'add' | 'remove'; }; }; export interface CommonSuperChatsEventEmitter extends EventEmitter { on>(event: T, listener: (arg: SuperChatsEventMap[T]) => void): this; off>(event: T, listener: (arg: SuperChatsEventMap[T]) => void): this; removeAllListeners>(event: T): this; emit>(event: T, arg: SuperChatsEventMap[T]): boolean; } export declare type SuperChatsEventEmitter = CommonSuperChatsEventEmitter;