diff --git a/docs/Client.js.html b/docs/Client.js.html index ff52267..94fbc12 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -458,39 +458,37 @@

Source: Client.js

}); }, Events); - if (isAuthenticated === true) { - await this.playPage.evaluate((Events) => { - window.WPP.on('conn.main_ready', async () => { - window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); }); - window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); }); - window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); - window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); }); - window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); }); - window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); }); - window.WPP.on('chat.new_message', (msg) => { - if (msg.isNewMsg) { - if (msg.type === 'ciphertext') { - // defer message event until ciphertext is resolved (type changed) - msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg))); - } else { - window.onAddMessageEvent(window.WAJS.getMessageModel(msg)); - } + await this.playPage.evaluate((Events) => { + window.WPP.on('conn.main_ready', async () => { + window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); }); + window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); }); + window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); + window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); }); + window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); }); + window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); }); + window.WPP.on('chat.new_message', (msg) => { + if (msg.isNewMsg) { + if (msg.type === 'ciphertext') { + // defer message event until ciphertext is resolved (type changed) + msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg))); + } else { + window.onAddMessageEvent(window.WAJS.getMessageModel(msg)); } - }); - window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); }); - - window.WPP.on('chat.new_reaction', (reaction) => { - window.onReaction([reaction]); - }); - - window.EmitEvent(Events.READY); + } }); - }, Events); - } + window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); }); + + window.WPP.on('chat.new_reaction', (reaction) => { + window.onReaction([reaction]); + }); + + window.EmitEvent(Events.READY); + }); + }, Events); await this.playPage.evaluate((Events) => { window.WPP.whatsapp.Cmd.on('logout', () => window.EmitEvent(Events.DISCONNECTED, 'NAVIGATION')); @@ -604,12 +602,12 @@

Source: Client.js

if (content instanceof MessageMedia) { internalOptions.attachment = content; internalOptions.isViewOnce = options.isViewOnce, - content = ''; + content = ''; } else if (options.media instanceof MessageMedia) { internalOptions.attachment = options.media; internalOptions.caption = content; internalOptions.isViewOnce = options.isViewOnce, - content = ''; + content = ''; } else if (content instanceof Location) { internalOptions.location = content; content = ''; @@ -627,11 +625,11 @@

Source: Client.js

if (internalOptions.sendMediaAsSticker && internalOptions.attachment) { internalOptions.attachment = await Util.formatToWebpSticker( internalOptions.attachment, { - name: options.stickerName, - author: options.stickerAuthor, - categories: options.stickerCategories, - isAvatarSticker: options.stickerIsAvatar, - }, this.playPage + name: options.stickerName, + author: options.stickerAuthor, + categories: options.stickerCategories, + isAvatarSticker: options.stickerIsAvatar, + }, this.playPage ); } diff --git a/docs/global.html b/docs/global.html index cc2b1b3..a90f068 100644 --- a/docs/global.html +++ b/docs/global.html @@ -74,9 +74,6 @@

Abstract types

AddParticipnatsOptions
-
ButtonSpec
-
-
ContactId
@@ -86,19 +83,16 @@

Abstract types

CreateGroupResult
-
FormattedButtonSpec
-
-
- - -
-
GroupMembershipRequest
GroupMembershipRequest
+
+
+
+
GroupParticipant
@@ -114,16 +108,16 @@

Abstract types

MembershipRequestActionResult
-
-
-
-
MembershipRequestActionResult
MessageInfo
+
+
+
+
MessageSendOptions
@@ -1685,54 +1679,6 @@

Properties

-

ButtonSpec -  Object

-

Button spec used in Buttons constructor

-
-

Properties

- - - - - - - - - - - - - - - - - - - - - - - -
NameTypeOptionalDescription
-

id

-
-

string

-
-

Yes

-
-

Custom ID to set on the button. A random one will be generated if one is not passed.

-
-

body

-
-

string

-
-

 

-
-

The text to show on the button.

-
-
-
-

ContactId  Object

ID that represents a contact

@@ -1985,64 +1931,6 @@

Properties

-

FormattedButtonSpec -  Object

-
-

Properties

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameTypeOptionalDescription
-

buttonId

-
-

string

-
-

 

-
-
-

type

-
-

number

-
-

 

-
-
-

buttonText

-
-

Object

-
-

 

-
-
-
-
-

GroupMembershipRequest  Object

An object that handles the information about the group membership request

diff --git a/docs/index.html b/docs/index.html index 3b81080..e217f8a 100644 --- a/docs/index.html +++ b/docs/index.html @@ -359,55 +359,6 @@

BusinessContact

-
-
-

Buttons

-
- -
-
-
- Buttons#body -
-
-
-
- Buttons#buttons -
-
-
-
-
-
-
-
- Buttons#footer -
-
-
-
- Buttons#title -
-
-
-
-
-
-
-

Call

@@ -1866,60 +1817,6 @@

Label

-
-
-

List

-
- -
-
-
- List#description -
-
-
-
- List#footer -
-
-
-
- List#sections -
-
-
-
-
-
-
-
- List#title -
-
-
-
-
-
-
-

Location

diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js index 30b45c3..d88972d 100644 --- a/docs/scripts/jsdoc-toc.js +++ b/docs/scripts/jsdoc-toc.js @@ -6,7 +6,7 @@ treeNode.tree({ autoEscape: false, closedIcon: '⇢', - data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Buttons","id":"Buttons","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"List","id":"List","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"Util","id":"Util","children":[]}], + data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BusinessContact","id":"BusinessContact","children":[]},{"label":"Call","id":"Call","children":[]},{"label":"Chat","id":"Chat","children":[]},{"label":"Client","id":"Client","children":[]},{"label":"ClientInfo","id":"ClientInfo","children":[]},{"label":"Contact","id":"Contact","children":[]},{"label":"GroupChat","id":"GroupChat","children":[]},{"label":"GroupNotification","id":"GroupNotification","children":[]},{"label":"InterfaceController","id":"InterfaceController","children":[]},{"label":"Label","id":"Label","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"Util","id":"Util","children":[]}], openedIcon: ' ⇣', saveState: false, useContextMenu: false diff --git a/src/Client.js b/src/Client.js index 7abc1e2..9445d43 100644 --- a/src/Client.js +++ b/src/Client.js @@ -427,39 +427,37 @@ class Client extends EventEmitter { }); }, Events); - if (isAuthenticated === true) { - await this.playPage.evaluate((Events) => { - window.WPP.on('conn.main_ready', async () => { - window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); }); - window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); }); - window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); }); - window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); - window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); }); - window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); }); - window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); }); - window.WPP.on('chat.new_message', (msg) => { - if (msg.isNewMsg) { - if (msg.type === 'ciphertext') { - // defer message event until ciphertext is resolved (type changed) - msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg))); - } else { - window.onAddMessageEvent(window.WAJS.getMessageModel(msg)); - } + await this.playPage.evaluate((Events) => { + window.WPP.on('conn.main_ready', async () => { + window.WPP.whatsapp.MsgStore.on('change', (msg) => { window.onChangeMessageEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:ack', (msg, ack) => { window.onMessageAckEvent(window.WAJS.getMessageModel(msg), ack); }); + window.WPP.whatsapp.MsgStore.on('change:isUnsentMedia', (msg, unsent) => { if (msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('remove', (msg) => { if (msg.isNewMsg) window.onRemoveMessageEvent(window.WAJS.getMessageModel(msg)); }); + window.WPP.whatsapp.MsgStore.on('change:caption', (msg, newBody, prevBody) => { window.onEditMessageEvent(window.WAJS.getMessageModel(msg), newBody, prevBody); }); + window.WPP.whatsapp.Socket.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); + window.WPP.whatsapp.CallStore.on('add', (call) => { window.onIncomingCall(call); }); + window.WPP.whatsapp.ChatStore.on('remove', async (chat) => { window.onRemoveChatEvent(await window.WAJS.getChatModel(chat)); }); + window.WPP.whatsapp.ChatStore.on('change:archive', async (chat, currState, prevState) => { window.onArchiveChatEvent(await window.WAJS.getChatModel(chat), currState, prevState); }); + window.WPP.on('chat.new_message', (msg) => { + if (msg.isNewMsg) { + if (msg.type === 'ciphertext') { + // defer message event until ciphertext is resolved (type changed) + msg.once('change:type', (_msg) => window.onAddMessageEvent(window.WAJS.getMessageModel(_msg))); + } else { + window.onAddMessageEvent(window.WAJS.getMessageModel(msg)); } - }); - window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); }); - - window.WPP.on('chat.new_reaction', (reaction) => { - window.onReaction([reaction]); - }); - - window.EmitEvent(Events.READY); + } }); - }, Events); - } + window.WPP.whatsapp.ChatStore.on('change:unreadCount', async (chat) => { window.onChatUnreadCountEvent(await window.WAJS.getChatModel(chat)); }); + + window.WPP.on('chat.new_reaction', (reaction) => { + window.onReaction([reaction]); + }); + + window.EmitEvent(Events.READY); + }); + }, Events); await this.playPage.evaluate((Events) => { window.WPP.whatsapp.Cmd.on('logout', () => window.EmitEvent(Events.DISCONNECTED, 'NAVIGATION'));