@areumtecnologia/wasockets 2.2.3 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/README.md +98 -25
  2. package/lib/Client/Builders/Buttons.js +127 -0
  3. package/lib/Client/Builders/EventBuilder.js +122 -0
  4. package/lib/Client/Builders/InteractiveMessage.js +150 -0
  5. package/lib/Client/Builders/Lists.js +78 -0
  6. package/lib/Client/Builders/PollBuilder.js +84 -0
  7. package/lib/Client/Builders/index.js +21 -0
  8. package/lib/Client/Constants.js +54 -0
  9. package/lib/Client/Context/CallContext.js +96 -0
  10. package/lib/Client/Context/MediaObject.js +155 -0
  11. package/lib/Client/Context/MessageContext.js +213 -0
  12. package/lib/Client/Modules/BusinessManager.js +155 -0
  13. package/lib/Client/Modules/ChannelManager.js +144 -0
  14. package/lib/Client/Modules/ChatManager.js +113 -0
  15. package/lib/Client/Modules/CommunityManager.js +136 -0
  16. package/lib/Client/Modules/GroupManager.js +194 -0
  17. package/lib/Client/Modules/LabelManager.js +123 -0
  18. package/lib/Client/Modules/MessageManager.js +198 -0
  19. package/lib/Client/Modules/PresenceManager.js +68 -0
  20. package/lib/Client/Modules/PrivacyManager.js +98 -0
  21. package/lib/Client/Modules/ProfileManager.js +92 -0
  22. package/lib/Client/Modules/UserManager.js +92 -0
  23. package/lib/Client/Modules/VoipManager.js +117 -0
  24. package/lib/Client/Modules/index.js +29 -0
  25. package/lib/Client/Normalizers/EventNormalizer.js +99 -0
  26. package/lib/Client/Normalizers/JidNormalizer.js +96 -0
  27. package/lib/Client/Normalizers/MessageNormalizer.js +422 -0
  28. package/lib/Client/WaClient.js +438 -0
  29. package/lib/Client/index.d.ts +547 -0
  30. package/lib/Client/index.js +76 -0
  31. package/package.json +29 -23
@@ -0,0 +1,547 @@
1
+ import { EventEmitter } from 'events'
2
+ import { Readable } from 'stream'
3
+ import { AuthenticationState, proto, AnyMessageContent, MiscMessageGenerationOptions, GroupMetadata } from '../Types'
4
+
5
+ export declare const Events: {
6
+ readonly STATUS_CHANGE: 'status.change'
7
+ readonly QR_CODE: 'qr'
8
+ readonly PAIRING_CODE: 'pairing.code'
9
+ readonly CONNECTED: 'connected'
10
+ readonly DISCONNECTED: 'disconnected'
11
+ readonly LOGGED_OUT: 'logged.out'
12
+ readonly MESSAGE_RECEIVED: 'message.received'
13
+ readonly MESSAGE_SENT: 'message.sent'
14
+ readonly MESSAGE_UPDATE: 'message.update'
15
+ readonly MESSAGE_DELETE: 'message.delete'
16
+ readonly PRESENCE_UPDATE: 'presence.update'
17
+ readonly CONTACTS_UPSERT: 'contacts.upsert'
18
+ readonly CALL_INCOMING: 'call.incoming'
19
+ readonly CALL_STATUS: 'call.status'
20
+ readonly GROUP_PARTICIPANTS_UPDATE: 'group.participants.update'
21
+ readonly ERROR: 'error'
22
+ }
23
+
24
+ export type EventNames = typeof Events[keyof typeof Events]
25
+
26
+ export declare const ConnectionStatus: {
27
+ readonly IDLE: 'idle'
28
+ readonly INITIALIZING: 'initializing'
29
+ readonly CONNECTING: 'connecting'
30
+ readonly QR_READY: 'qr_ready'
31
+ readonly PAIRING_READY: 'pairing_ready'
32
+ readonly CONNECTED: 'connected'
33
+ readonly RECONNECTING: 'reconnecting'
34
+ readonly LOGGED_OUT: 'logged_out'
35
+ readonly DISCONNECTED: 'disconnected'
36
+ }
37
+
38
+ export type ConnectionStatusType = typeof ConnectionStatus[keyof typeof ConnectionStatus]
39
+
40
+ export interface WaClientOptions {
41
+ sessionName?: string
42
+ dataPath?: string
43
+ auth?: { state: AuthenticationState; saveCreds: () => Promise<void> }
44
+ phoneNumber?: string
45
+ printQRInTerminal?: boolean
46
+ restartOnClose?: boolean
47
+ maxReconnectAttempts?: number
48
+ syncFullHistory?: boolean
49
+ markOnlineOnConnect?: boolean
50
+ socketOptions?: Record<string, any>
51
+ logger?: any
52
+ }
53
+
54
+ export declare class MediaObject {
55
+ mediaNode: any
56
+ rawType: string
57
+ mediaType: string
58
+ mimetype: string
59
+ fileLength: number
60
+ fileName: string
61
+ seconds: number
62
+ isVoice: boolean
63
+ isAnimated: boolean
64
+ extension: string
65
+
66
+ constructor(mediaNode: any, canonicalType: string)
67
+
68
+ toStream(options?: any): Promise<Readable>
69
+ toBuffer(options?: any): Promise<Buffer>
70
+ save(destinationPath: string, options?: any): Promise<string>
71
+ toBase64(options?: any): Promise<string>
72
+ toDataUri(options?: any): Promise<string>
73
+ toSharp(options?: any): Promise<any>
74
+ }
75
+
76
+ export declare class CallContext {
77
+ client: WaClient
78
+ raw: any
79
+ id: string
80
+ from: string
81
+ fromNumber: string
82
+ isVideo: boolean
83
+ status: string
84
+ startTime: number
85
+ instance: any | null
86
+
87
+ constructor(client: WaClient, callData: any, activeCallInstance?: any)
88
+
89
+ accept(options?: { isVideo?: boolean; durationMs?: number; audioSource?: any }): Promise<any>
90
+ reject(reason?: number | string): Promise<void>
91
+ hangup(): Promise<void>
92
+ playAudio(audioPathOrBuffer: string | Buffer): Promise<any>
93
+ }
94
+
95
+ export interface InteractiveReplyData {
96
+ id: string
97
+ text: string
98
+ params?: any
99
+ flowName?: string
100
+ description?: string
101
+ type: 'button' | 'list' | 'native_flow' | 'template_button' | 'question_reply' | string
102
+ }
103
+
104
+ export interface ContactData {
105
+ name: string
106
+ number: string
107
+ org?: string
108
+ vcard: string
109
+ }
110
+
111
+ export interface LocationData {
112
+ latitude: number
113
+ longitude: number
114
+ name: string
115
+ address: string
116
+ url: string
117
+ accuracyInMeters?: number
118
+ speedInMps?: number
119
+ isLive: boolean
120
+ }
121
+
122
+ export interface ReactionData {
123
+ emoji: string
124
+ reactedMessageId: string
125
+ targetKey: any
126
+ isRemoval: boolean
127
+ senderTimestamp: Date
128
+ }
129
+
130
+ export interface PollData {
131
+ id: string
132
+ name: string
133
+ selectableOptionsCount: number
134
+ allowsMultipleAnswers: boolean
135
+ options: Array<{ name: string; hash: string | null }>
136
+ }
137
+
138
+ export interface MediaDetailsData {
139
+ mimetype: string
140
+ fileName: string
141
+ caption: string
142
+ duration: number | null
143
+ isPtt: boolean
144
+ isGif: boolean
145
+ isViewOnce: boolean
146
+ }
147
+
148
+ export interface QuotedMessageContext {
149
+ id: string
150
+ sender: string
151
+ senderNumber: string
152
+ type: string
153
+ body: string
154
+ raw: proto.IMessage | any
155
+ }
156
+
157
+ export declare class MessageContext {
158
+ client: WaClient
159
+ raw: proto.IWebMessageInfo
160
+ id: string
161
+ chatId: string
162
+ fromMe: boolean
163
+ isFromMe: boolean
164
+ isGroup: boolean
165
+ isChannel: boolean
166
+ isBroadcast: boolean
167
+
168
+ from: string
169
+ to: string
170
+ fromPushName: string
171
+ fromNumber: string
172
+ sender: string
173
+ senderNumber: string
174
+ senderName: string
175
+
176
+ timestamp: Date
177
+ isEdited: boolean
178
+ editTimestamp: Date | null
179
+
180
+ type: string
181
+ body: string
182
+ interactiveReply: InteractiveReplyData | null
183
+ contacts: ContactData[]
184
+ location: LocationData | null
185
+ reaction: ReactionData | null
186
+ poll: PollData | null
187
+
188
+ mediaNode: any | null
189
+ hasMedia: boolean
190
+ media: MediaObject | null
191
+ mediaDetails: MediaDetailsData | null
192
+
193
+ contextInfo: proto.IContextInfo | null
194
+ mentions: string[]
195
+ mentionedJids: string[]
196
+ isForwarded: boolean
197
+ forwardingScore: number
198
+ isMentioningMe: boolean
199
+
200
+ isReply: boolean
201
+ quoted: MessageContext | QuotedMessageContext | null
202
+
203
+ constructor(client: WaClient, rawMessage: proto.IWebMessageInfo, depth?: number)
204
+
205
+ reply(content: string | AnyMessageContent, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
206
+ react(emoji: string): Promise<proto.WebMessageInfo | undefined>
207
+ removeReaction(): Promise<proto.WebMessageInfo | undefined>
208
+ delete(): Promise<proto.WebMessageInfo | undefined>
209
+ markRead(): Promise<void>
210
+ forward(targetJid: string, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
211
+ pin(durationInSeconds?: number): Promise<any>
212
+ unpin(): Promise<any>
213
+ }
214
+
215
+ export declare class QuickReplyButton {
216
+ displayText: string
217
+ id: string
218
+ constructor(displayText: string, id?: string)
219
+ build(): { name: string; buttonParamsJson: string }
220
+ }
221
+
222
+ export declare class UrlButton {
223
+ displayText: string
224
+ url: string
225
+ merchantUrl?: string
226
+ constructor(displayText: string, url: string, merchantUrl?: string)
227
+ build(): { name: string; buttonParamsJson: string }
228
+ }
229
+
230
+ export declare class CopyCodeButton {
231
+ displayText: string
232
+ copyCode: string
233
+ id?: string
234
+ constructor(displayText: string, copyCode: string, id?: string)
235
+ build(): { name: string; buttonParamsJson: string }
236
+ }
237
+
238
+ export declare class CallButton {
239
+ displayText: string
240
+ phoneNumber: string
241
+ constructor(displayText: string, phoneNumber: string)
242
+ build(): { name: string; buttonParamsJson: string }
243
+ }
244
+
245
+ export declare class PixButton {
246
+ displayText: string
247
+ pixKey: string
248
+ keyType: string
249
+ merchantName: string
250
+ constructor(displayText: string, pixKey: string, keyType?: 'CPF' | 'EMAIL' | 'PHONE' | 'EVP' | string, merchantName?: string)
251
+ build(): { name: string; buttonParamsJson: string }
252
+ }
253
+
254
+ export declare class ListRow {
255
+ title: string
256
+ description: string
257
+ rowId: string
258
+ constructor(title: string, description?: string, rowId?: string)
259
+ build(): { title: string; description: string; rowId: string }
260
+ }
261
+
262
+ export declare class ListSection {
263
+ title: string
264
+ rows: (ListRow | any)[]
265
+ constructor(title: string, rows?: ListRow[])
266
+ addRow(titleOrRow: string | ListRow, description?: string, rowId?: string): this
267
+ build(): { title: string; rows: any[] }
268
+ }
269
+
270
+ export declare class ListButton {
271
+ buttonText: string
272
+ sections: (ListSection | any)[]
273
+ constructor(buttonText: string, sections?: ListSection[])
274
+ addSection(titleOrSection: string | ListSection, rows?: ListRow[]): this
275
+ build(): { buttonText: string; sections: any[] }
276
+ }
277
+
278
+ export declare class InteractiveMessage {
279
+ setTitle(title: string): this
280
+ setSubtitle(subtitle: string): this
281
+ setText(text: string): this
282
+ setFooter(footer: string): this
283
+ setHeaderImage(image: string | Buffer | { url: string }): this
284
+ setHeaderVideo(video: string | Buffer | { url: string }): this
285
+ addButton(button: any): this
286
+ addButtons(buttons: any[]): this
287
+ build(): any
288
+ }
289
+
290
+ export declare class PollBuilder {
291
+ setName(name: string): this
292
+ addOption(option: string): this
293
+ addOptions(options: string[]): this
294
+ setSelectableCount(count: number): this
295
+ build(): { poll: { name: string; values: string[]; selectableCount: number } }
296
+ }
297
+
298
+ export declare class EventBuilder {
299
+ setName(name: string): this
300
+ setDescription(description: string): this
301
+ setStartDate(date: Date | number): this
302
+ setEndDate(date: Date | number): this
303
+ setLocation(name: string, degreesLatitude?: number, degreesLongitude?: number): this
304
+ setCall(callType?: 'voice' | 'video' | 1 | 2): this
305
+ build(): { event: any }
306
+ }
307
+
308
+ export declare class MessageManager {
309
+ constructor(client: WaClient)
310
+ sendText(jid: string, text: string, options?: any): Promise<proto.WebMessageInfo | undefined>
311
+ sendMedia(jid: string, type: 'image' | 'video' | 'audio' | 'document' | 'sticker', content: any, options?: any): Promise<proto.WebMessageInfo | undefined>
312
+ sendAlbum(jid: string, items: any[], options?: any): Promise<proto.WebMessageInfo | undefined>
313
+ sendVoice(jid: string, audioSource: any, options?: any): Promise<proto.WebMessageInfo | undefined>
314
+ sendContact(jid: string, name: string, phoneNumber: string, options?: any): Promise<proto.WebMessageInfo | undefined>
315
+ sendLocation(jid: string, coords: { latitude: number; longitude: number; name?: string; address?: string; live?: boolean }, options?: any): Promise<proto.WebMessageInfo | undefined>
316
+ forward(targetJid: string, message: any, options?: any): Promise<proto.WebMessageInfo | undefined>
317
+ delete(jid: string, messageKey: proto.IMessageKey): Promise<proto.WebMessageInfo | undefined>
318
+ edit(jid: string, messageKey: proto.IMessageKey, newText: string): Promise<proto.WebMessageInfo | undefined>
319
+ pin(jid: string, messageKey: proto.IMessageKey, durationSeconds?: number): Promise<any>
320
+ unpin(jid: string, messageKey: proto.IMessageKey): Promise<any>
321
+ react(jid: string, messageKey: proto.IMessageKey, emoji: string): Promise<proto.WebMessageInfo | undefined>
322
+ }
323
+
324
+ export declare class GroupManager {
325
+ constructor(client: WaClient)
326
+ create(subject: string, participants: string[]): Promise<GroupMetadata>
327
+ getMetadata(groupJid: string): Promise<GroupMetadata>
328
+ addMembers(groupJid: string, participants: string[]): Promise<any>
329
+ removeMembers(groupJid: string, participants: string[]): Promise<any>
330
+ promote(groupJid: string, participants: string[]): Promise<any>
331
+ demote(groupJid: string, participants: string[]): Promise<any>
332
+ getInviteCode(groupJid: string): Promise<string>
333
+ revokeInviteCode(groupJid: string): Promise<string>
334
+ joinWithCode(inviteCode: string): Promise<string>
335
+ setSubject(groupJid: string, subject: string): Promise<void>
336
+ setDescription(groupJid: string, description: string): Promise<void>
337
+ setAnnounceOnly(groupJid: string, announceOnly?: boolean): Promise<void>
338
+ setLocked(groupJid: string, locked?: boolean): Promise<void>
339
+ mentionAll(groupJid: string, textOrContent: string | any, options?: any): Promise<proto.WebMessageInfo | undefined>
340
+ }
341
+
342
+ export declare class ChannelManager {
343
+ constructor(client: WaClient)
344
+ create(name: string, description?: string): Promise<any>
345
+ getMetadata(channelJidOrInvite: string): Promise<any>
346
+ subscribe(channelJid: string): Promise<any>
347
+ unsubscribe(channelJid: string): Promise<any>
348
+ mute(channelJid: string): Promise<any>
349
+ unmute(channelJid: string): Promise<any>
350
+ listSubscribed(): Promise<any[]>
351
+ fetchMessages(channelJid: string, count?: number, sinceTimestamp?: number): Promise<proto.WebMessageInfo[]>
352
+ fetchReactions(channelJid: string, messageServerId: string): Promise<any>
353
+ setName(channelJid: string, name: string): Promise<any>
354
+ setDescription(channelJid: string, description: string): Promise<any>
355
+ }
356
+
357
+ export declare class PresenceManager {
358
+ constructor(client: WaClient)
359
+ startTyping(jid: string): { stop: () => Promise<void> }
360
+ startRecording(jid: string): { stop: () => Promise<void> }
361
+ setOnline(): Promise<void>
362
+ setOffline(): Promise<void>
363
+ subscribe(jid: string): Promise<void>
364
+ }
365
+
366
+ export declare class ProfileManager {
367
+ constructor(client: WaClient)
368
+ updateName(name: string): Promise<void>
369
+ updateAbout(aboutText: string): Promise<void>
370
+ getAbout(jid?: string): Promise<any>
371
+ updatePicture(jidOrSelf: string, imageSource: any): Promise<void>
372
+ removePicture(jidOrSelf?: string): Promise<void>
373
+ getPictureUrl(jid: string, highRes?: boolean): Promise<string | null>
374
+ }
375
+
376
+ export declare class PrivacyManager {
377
+ constructor(client: WaClient)
378
+ block(jid: string): Promise<void>
379
+ unblock(jid: string): Promise<void>
380
+ getBlocklist(): Promise<string[]>
381
+ setLastSeen(privacy: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
382
+ setOnline(privacy: 'all' | 'match_last_seen'): Promise<void>
383
+ setProfilePicture(privacy: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
384
+ setAbout(privacy: 'all' | 'contacts' | 'contact_blacklist' | 'none'): Promise<void>
385
+ setReadReceipts(enabled: boolean): Promise<void>
386
+ }
387
+
388
+ export declare class UserManager {
389
+ constructor(client: WaClient)
390
+ isOnWhatsApp(phoneOrJid: string): Promise<{ exists: boolean; jid: string } | null>
391
+ resolveJid(jidOrPhone: string, fetchIfMissing?: boolean): Promise<string>
392
+ getPnForLid(lidJid: string, fetchIfMissing?: boolean): Promise<string | null>
393
+ getLidForPn(pnJid: string, fetchIfMissing?: boolean): Promise<string | null>
394
+ getBusinessProfile(jid: string): Promise<any>
395
+ }
396
+
397
+ export declare class ChatManager {
398
+ constructor(client: WaClient)
399
+ pin(jid: string): Promise<void>
400
+ unpin(jid: string): Promise<void>
401
+ mute(jid: string, durationMs?: number): Promise<void>
402
+ unmute(jid: string): Promise<void>
403
+ archive(jid: string): Promise<void>
404
+ unarchive(jid: string): Promise<void>
405
+ setFavorite(jid: string, isFavorite?: boolean): Promise<void>
406
+ setChatNote(jid: string, note: string): Promise<void>
407
+ }
408
+
409
+ export declare class VoipManager {
410
+ constructor(client: WaClient)
411
+ call(phoneNumber: string, options?: any): Promise<CallContext>
412
+ callVideo(phoneNumber: string, options?: any): Promise<CallContext>
413
+ get activeCall(): CallContext | null
414
+ clearActiveCall(): void
415
+ acceptCall(callId: string, from: string, options?: any): Promise<any>
416
+ rejectCall(callId: string, from: string, reason?: number | string): Promise<void>
417
+ }
418
+
419
+ export declare class BusinessManager {
420
+ constructor(client: WaClient)
421
+ createProduct(product: {
422
+ name: string
423
+ description?: string
424
+ price: number
425
+ currency?: string
426
+ images?: (string | Buffer)[]
427
+ retailerId?: string
428
+ url?: string
429
+ isHidden?: boolean
430
+ }): Promise<any>
431
+ updateProduct(productId: string, update: any): Promise<any>
432
+ deleteProduct(productIds: string | string[]): Promise<{ deleted: number }>
433
+ getProduct(productId: string, merchantJid?: string): Promise<any>
434
+ getCatalog(options?: { jid?: string; limit?: number; cursor?: string }): Promise<any>
435
+ getCollections(merchantJid?: string, limit?: number): Promise<any>
436
+ getOrderDetails(orderId: string, orderToken: string): Promise<any>
437
+ }
438
+
439
+ export declare class CommunityManager {
440
+ constructor(client: WaClient)
441
+ create(subject: string, description?: string): Promise<any>
442
+ getMetadata(communityJid: string): Promise<any>
443
+ createSubgroup(communityJid: string, subject: string, participants?: string[]): Promise<any>
444
+ linkSubgroup(communityJid: string, groupJid: string): Promise<any>
445
+ unlinkSubgroup(communityJid: string, groupJid: string): Promise<any>
446
+ getSubgroups(communityJid: string): Promise<any>
447
+ leave(communityJid: string): Promise<any>
448
+ setName(communityJid: string, subject: string): Promise<any>
449
+ }
450
+
451
+ export declare class LabelManager {
452
+ constructor(client: WaClient)
453
+ create(name: string, color?: number, predefinedId?: number): Promise<any>
454
+ update(id: string, name: string, color?: number, predefinedId?: number): Promise<any>
455
+ delete(id: string): Promise<any>
456
+ addChat(jid: string, labelId: string): Promise<any>
457
+ removeChat(jid: string, labelId: string): Promise<any>
458
+ addMessage(jid: string, messageId: string, labelId: string): Promise<any>
459
+ removeMessage(jid: string, messageId: string, labelId: string): Promise<any>
460
+ }
461
+
462
+ export declare class JidNormalizer {
463
+ static toJid(input: string): string
464
+ static toPhoneNumber(jid: string): string
465
+ static isGroup(jid: string): boolean
466
+ static isNewsletter(jid: string): boolean
467
+ static isLid(jid: string): boolean
468
+ static isUser(jid: string): boolean
469
+ static isStatusBroadcast(jid: string): boolean
470
+ static isBroadcast(jid: string): boolean
471
+ }
472
+
473
+ export declare class MessageNormalizer {
474
+ static unwrapMessage(rawMessageContent: any): any
475
+ static extractType(messageContent: any): string
476
+ static extractBody(messageContent: any): string
477
+ static extractInteractiveReply(messageContent: any): InteractiveReplyData | null
478
+ static extractContacts(messageContent: any): ContactData[]
479
+ static extractLocation(messageContent: any): LocationData | null
480
+ static extractReaction(messageContent: any): ReactionData | null
481
+ static extractPollCreation(messageContent: any, rawMessage?: any): PollData | null
482
+ static extractMediaNode(messageContent: any): any | null
483
+ static extractMediaDetails(messageContent: any): MediaDetailsData | null
484
+ static extractContextInfo(messageContent: any): proto.IContextInfo | null
485
+ }
486
+
487
+ export declare class WaClient extends EventEmitter {
488
+ options: WaClientOptions
489
+ status: ConnectionStatusType
490
+ sock: any
491
+ authState: AuthenticationState | null
492
+ saveCreds: (() => Promise<void>) | null
493
+ reconnectAttempts: number
494
+
495
+ // Specialized Domain Managers
496
+ messages: MessageManager
497
+ groups: GroupManager
498
+ channels: ChannelManager
499
+ presence: PresenceManager
500
+ profile: ProfileManager
501
+ privacy: PrivacyManager
502
+ users: UserManager
503
+ chat: ChatManager
504
+ voip: VoipManager
505
+ business: BusinessManager
506
+ communities: CommunityManager
507
+ labels: LabelManager
508
+
509
+ constructor(options?: WaClientOptions)
510
+
511
+ connect(): Promise<this>
512
+ disconnect(): Promise<void>
513
+ logout(): Promise<void>
514
+
515
+ sendMessage(jid: string, content: AnyMessageContent, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
516
+ sendInteractive(jid: string, interactiveOrBuilder: InteractiveMessage | any, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
517
+ sendPoll(jid: string, pollOrBuilder: PollBuilder | any, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
518
+ sendEvent(jid: string, eventOrBuilder: EventBuilder | any, options?: MiscMessageGenerationOptions): Promise<proto.WebMessageInfo | undefined>
519
+
520
+ startTyping(jid: string): { stop: () => Promise<void> }
521
+ startRecording(jid: string): { stop: () => Promise<void> }
522
+ isOnWhatsApp(jidOrNumber: string): Promise<{ exists: boolean; jid: string } | null>
523
+
524
+ get user(): { id: string; name?: string } | null
525
+ get isConnected(): boolean
526
+ get rawSocket(): any
527
+
528
+ on(event: 'status.change', listener: (status: { current: ConnectionStatusType; previous: ConnectionStatusType }) => void): this
529
+ on(event: 'qr', listener: (data: { qr: string }) => void): this
530
+ on(event: 'pairing.code', listener: (data: { code: string }) => void): this
531
+ on(event: 'connected', listener: (data: { user: any }) => void): this
532
+ on(event: 'disconnected', listener: (data: { error?: any; willReconnect: boolean; attempt?: number; delayMs?: number }) => void): this
533
+ on(event: 'logged.out', listener: (data: { error?: any }) => void): this
534
+ on(event: 'call.incoming', listener: (call: CallContext) => void): this
535
+ on(event: 'call.status', listener: (calls: any[]) => void): this
536
+ on(event: 'message.received', listener: (ctx: MessageContext, raw: proto.IWebMessageInfo) => void): this
537
+ on(event: 'message.sent', listener: (ctx: MessageContext, raw: proto.IWebMessageInfo) => void): this
538
+ on(event: 'message.update', listener: (updates: any[]) => void): this
539
+ on(event: 'message.delete', listener: (item: any) => void): this
540
+ on(event: 'presence.update', listener: (presence: any) => void): this
541
+ on(event: 'contacts.upsert', listener: (contacts: any[]) => void): this
542
+ on(event: 'group.participants.update', listener: (update: any) => void): this
543
+ on(event: 'error', listener: (error: any) => void): this
544
+ on(event: string | symbol, listener: (...args: any[]) => void): this
545
+ }
546
+
547
+ export default WaClient
@@ -0,0 +1,76 @@
1
+ "use strict"
2
+
3
+ Object.defineProperty(exports, "__esModule", { value: true })
4
+
5
+ const { WaClient } = require("./WaClient")
6
+ const { Events, ConnectionStatus } = require("./Constants")
7
+ const { MessageContext } = require("./Context/MessageContext")
8
+ const { MediaObject } = require("./Context/MediaObject")
9
+ const { CallContext } = require("./Context/CallContext")
10
+ const { JidNormalizer } = require("./Normalizers/JidNormalizer")
11
+ const { MessageNormalizer } = require("./Normalizers/MessageNormalizer")
12
+ const {
13
+ InteractiveMessage,
14
+ QuickReplyButton,
15
+ UrlButton,
16
+ CopyCodeButton,
17
+ CallButton,
18
+ PixButton,
19
+ ListButton,
20
+ ListSection,
21
+ ListRow,
22
+ PollBuilder,
23
+ EventBuilder
24
+ } = require("./Builders")
25
+ const {
26
+ MessageManager,
27
+ GroupManager,
28
+ ChannelManager,
29
+ PresenceManager,
30
+ ProfileManager,
31
+ PrivacyManager,
32
+ UserManager,
33
+ ChatManager,
34
+ VoipManager,
35
+ BusinessManager,
36
+ CommunityManager,
37
+ LabelManager
38
+ } = require("./Modules")
39
+
40
+ exports.WaClient = WaClient
41
+ exports.Events = Events
42
+ exports.ConnectionStatus = ConnectionStatus
43
+ exports.MessageContext = MessageContext
44
+ exports.MediaObject = MediaObject
45
+ exports.CallContext = CallContext
46
+ exports.JidNormalizer = JidNormalizer
47
+ exports.MessageNormalizer = MessageNormalizer
48
+
49
+ // Builders
50
+ exports.InteractiveMessage = InteractiveMessage
51
+ exports.QuickReplyButton = QuickReplyButton
52
+ exports.UrlButton = UrlButton
53
+ exports.CopyCodeButton = CopyCodeButton
54
+ exports.CallButton = CallButton
55
+ exports.PixButton = PixButton
56
+ exports.ListButton = ListButton
57
+ exports.ListSection = ListSection
58
+ exports.ListRow = ListRow
59
+ exports.PollBuilder = PollBuilder
60
+ exports.EventBuilder = EventBuilder
61
+
62
+ // Domain Managers
63
+ exports.MessageManager = MessageManager
64
+ exports.GroupManager = GroupManager
65
+ exports.ChannelManager = ChannelManager
66
+ exports.PresenceManager = PresenceManager
67
+ exports.ProfileManager = ProfileManager
68
+ exports.PrivacyManager = PrivacyManager
69
+ exports.UserManager = UserManager
70
+ exports.ChatManager = ChatManager
71
+ exports.VoipManager = VoipManager
72
+ exports.BusinessManager = BusinessManager
73
+ exports.CommunityManager = CommunityManager
74
+ exports.LabelManager = LabelManager
75
+
76
+ exports.default = WaClient