From fc722dd1d3c2aab3fea8262032c7c521702184a8 Mon Sep 17 00:00:00 2001 From: WWebJS Bot Date: Fri, 4 Oct 2024 04:29:49 +0000 Subject: [PATCH] chore(): generate docs --- docs/Base.html | 6 +- docs/BaseAuthStrategy.html | 6 +- docs/Broadcast.html | 167 +++++++ docs/BusinessContact.html | 6 +- docs/Buttons.html | 6 +- docs/Call.html | 6 +- docs/Chat.html | 34 +- docs/Client.html | 105 ++-- docs/Client.js.html | 481 ++++++++++--------- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 20 +- docs/GroupNotification.html | 6 +- docs/InterfaceController.html | 6 +- docs/Label.html | 6 +- docs/List.html | 6 +- docs/LocalAuth.html | 6 +- docs/LocalWebCache.html | 6 +- docs/Location.html | 6 +- docs/Message.html | 6 +- docs/MessageMedia.html | 6 +- docs/NoAuth.html | 6 +- docs/Order.html | 6 +- docs/Poll.html | 6 +- docs/PollVote.html | 6 +- docs/PrivateChat.html | 34 +- docs/PrivateContact.html | 6 +- docs/Product.html | 6 +- docs/Reaction.html | 6 +- docs/RemoteAuth.html | 6 +- docs/RemoteWebCache.html | 6 +- docs/Util.html | 6 +- docs/WebCache.html | 6 +- docs/authStrategies_BaseAuthStrategy.js.html | 6 +- docs/authStrategies_LocalAuth.js.html | 6 +- docs/authStrategies_NoAuth.js.html | 6 +- docs/authStrategies_RemoteAuth.js.html | 6 +- docs/global.html | 88 +++- docs/index.html | 179 +++++-- docs/scripts/jsdoc-toc.js | 2 +- docs/structures_Base.js.html | 6 +- docs/structures_Broadcast.js.html | 123 +++++ docs/structures_BusinessContact.js.html | 6 +- docs/structures_Buttons.js.html | 6 +- docs/structures_Call.js.html | 6 +- docs/structures_Chat.js.html | 16 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 6 +- docs/structures_GroupNotification.js.html | 6 +- docs/structures_Label.js.html | 6 +- docs/structures_List.js.html | 6 +- docs/structures_Location.js.html | 6 +- docs/structures_Message.js.html | 6 +- docs/structures_MessageMedia.js.html | 6 +- docs/structures_Order.js.html | 6 +- docs/structures_Payment.js.html | 6 +- docs/structures_Poll.js.html | 6 +- docs/structures_PollVote.js.html | 6 +- docs/structures_PrivateChat.js.html | 6 +- docs/structures_PrivateContact.js.html | 6 +- docs/structures_Product.js.html | 6 +- docs/structures_ProductMetadata.js.html | 6 +- docs/structures_Reaction.js.html | 6 +- docs/util_Constants.js.html | 8 +- docs/util_Injected_LegacyStore.js.html | 6 +- docs/util_Injected_Store.js.html | 7 +- docs/util_Injected_Utils.js.html | 17 +- docs/util_InterfaceController.js.html | 12 +- docs/util_Puppeteer.js.html | 77 +++ docs/util_Util.js.html | 6 +- docs/webCache_LocalWebCache.js.html | 6 +- docs/webCache_RemoteWebCache.js.html | 6 +- docs/webCache_WebCache.js.html | 6 +- 74 files changed, 1179 insertions(+), 539 deletions(-) create mode 100644 docs/Broadcast.html create mode 100644 docs/structures_Broadcast.js.html create mode 100644 docs/util_Puppeteer.js.html diff --git a/docs/Base.html b/docs/Base.html index fdeaf0d866..9d7d0d448b 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Base + whatsapp-web.js 1.26.1-alpha.2 » Class: Base @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new Base diff --git a/docs/BaseAuthStrategy.html b/docs/BaseAuthStrategy.html index 535a68cf55..cb1ce385c4 100644 --- a/docs/BaseAuthStrategy.html +++ b/docs/BaseAuthStrategy.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: BaseAuthStrategy + whatsapp-web.js 1.26.1-alpha.2 » Class: BaseAuthStrategy @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new BaseAuthStrategy diff --git a/docs/Broadcast.html b/docs/Broadcast.html new file mode 100644 index 0000000000..bdbacd5021 --- /dev/null +++ b/docs/Broadcast.html @@ -0,0 +1,167 @@ + + + + + + + whatsapp-web.js 1.26.1-alpha.2 » Class: Broadcast + + + + + + + + +
+
+
+
+ +
+
+

Properties

+
+
+
+
id
+
+
+
msgs
+
+
+
+
+
+
+
timestamp
+
+
+
totalCount
+
+
+
+
+
+
+
unreadCount
+
+
+
+
+
+
+
+

Methods

+
+
+
+
getChat()
+
+
+
+
+
+
+
getContact()
+
+
+
+
+
+
+
+
+
+
+

new Broadcast()

+
+
Extends
+
Base
+
+
+
+

Properties

+
+

id +  object

+

ID that represents the chat

+
+
+

msgs +  Array of Message

+

Messages statuses

+
+
+

timestamp +  number

+

Unix timestamp of last status

+
+
+

totalCount +  number

+

Number of available statuses

+
+
+

unreadCount +  number

+

Number of not viewed

+
+
+
+

Methods

+
+

getChat() → Promise containing Chat

+

Returns the Chat this message was sent in

+
+
Returns
+
+

Promise containing Chat 

+
+
+

getContact() → Promise containing Contact

+

Returns the Contact this message was sent from

+
+
Returns
+
+

Promise containing Contact 

+
+
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 5229c4e221..ca7ee5a0c2 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: BusinessContact + whatsapp-web.js 1.26.1-alpha.2 » Class: BusinessContact @@ -15,7 +15,7 @@ @@ -326,7 +326,7 @@

unblock diff --git a/docs/Buttons.html b/docs/Buttons.html index a11069a332..9af390b411 100644 --- a/docs/Buttons.html +++ b/docs/Buttons.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Buttons + whatsapp-web.js 1.26.1-alpha.2 » Class: Buttons @@ -15,7 +15,7 @@ @@ -234,7 +234,7 @@

Parameter

diff --git a/docs/Call.html b/docs/Call.html index fb5c975511..5ef26a8f6c 100644 --- a/docs/Call.html +++ b/docs/Call.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Call + whatsapp-web.js 1.26.1-alpha.2 » Class: Call @@ -15,7 +15,7 @@ @@ -168,7 +168,7 @@

reject<
diff --git a/docs/Chat.html b/docs/Chat.html index cdaa946380..8a7fa77146 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Chat + whatsapp-web.js 1.26.1-alpha.2 » Class: Chat @@ -15,7 +15,7 @@ @@ -107,13 +107,13 @@

Methods

fetchMessages(searchOptions)
+
getContact()
+
+
-
getContact()
-
-
getLabels()
@@ -129,19 +129,22 @@

Methods

sendMessage(content[, options])
-
-
- +
+
sendStateTyping()
+
syncHistory()
+
+
unarchive()
@@ -515,6 +518,17 @@

sendStateTyping

async
+

syncHistory() → Promise containing boolean

+

Sync chat history conversation

+
+
Returns
+
+

Promise containing boolean  +

True if operation completed successfully, false otherwise.

+

+
+
+
async

unarchive()

un-archives this chat

@@ -545,7 +559,7 @@

unpin diff --git a/docs/Client.html b/docs/Client.html index 6a46128b22..9606cd6f91 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Client + whatsapp-web.js 1.26.1-alpha.2 » Class: Client @@ -15,7 +15,7 @@ @@ -26,7 +26,7 @@

-
requestPairingCode(phoneNumber, showNotification)
-
-
resetState()
@@ -223,6 +226,9 @@

Methods

setStatus(status)
+
syncHistory(chatId)
+
+
unarchiveChat()
@@ -938,6 +944,15 @@

getBlockedContacts<

async
+

getBroadcasts() → Promise containing Array of Broadcast

+

Get all current Broadcast

+
+
Returns
+
+

Promise containing Array of Broadcast 

+
+
+
async

getChatById(chatId) → Promise containing Chat

Get chat instance by ID

@@ -1133,7 +1148,7 @@

Parameter

async
-

getContactDeviceCount(contactId) → number

+

getContactDeviceCount(userId) → Promise containing number

Get user device count by ID Each WaWeb Connection counts as one device, and the phone (if exists) counts as one So for a non-enterprise user with one WaWeb connection it should return "2"

@@ -1151,7 +1166,7 @@

Parameter

-

contactId

+

userId

string

@@ -1168,7 +1183,7 @@

Parameter

Returns
-

number 

+

Promise containing number 

async
@@ -1485,35 +1500,6 @@

initializeinject()

Injection logic Private function

-
-

Property

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

reinject

-
-

boolean

-
-

 

-
-

is this a reinject?

-
-
async
@@ -2235,6 +2221,45 @@

Parameter

async
+

syncHistory(chatId) → Promise containing boolean

+

Sync chat history conversation

+
+

Parameter

+ + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

chatId

+
+

string

+
+

 

+
+
+
+
+
Returns
+
+

Promise containing boolean  +

True if operation completed successfully, false otherwise.

+

+
+
+
async

unarchiveChat() → boolean

Changes and returns the archive state of the Chat

@@ -3555,7 +3580,7 @@

vote_update

diff --git a/docs/Client.js.html b/docs/Client.js.html index ec7519e1ef..31ef9361c4 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: Client.js + whatsapp-web.js 1.26.1-alpha.2 » Source: Client.js @@ -15,7 +15,7 @@ @@ -46,8 +46,9 @@

Source: Client.js

const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); const WebCacheFactory = require('./webCache/WebCacheFactory'); -const { ClientInfo, Message, MessageMedia, Contact, Location, Poll, PollVote, GroupNotification, Label, Call, Buttons, List, Reaction } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, Poll, PollVote, GroupNotification, Label, Call, Buttons, List, Reaction, Broadcast} = require('./structures'); const NoAuth = require('./authStrategies/NoAuth'); +const {exposeFunctionIfAbsent} = require('./util/Puppeteer'); /** * Starting point for interacting with the WhatsApp Web API @@ -121,9 +122,8 @@

Source: Client.js

/** * Injection logic * Private function - * @property {boolean} reinject is this a reinject? */ - async inject(reinject = false) { + async inject() { await this.pupPage.waitForFunction('window.Debug?.VERSION != undefined', {timeout: this.options.authTimeoutMs}); const version = await this.getWWebVersion(); @@ -173,26 +173,21 @@

Source: Client.js

// Register qr events let qrRetries = 0; - const injected = await this.pupPage.evaluate(() => { - return typeof window.onQRChangedEvent !== 'undefined'; - }); - if (!injected) { - await this.pupPage.exposeFunction('onQRChangedEvent', async (qr) => { - /** - * Emitted when a QR code is received - * @event Client#qr - * @param {string} qr QR Code - */ - this.emit(Events.QR_RECEIVED, qr); - if (this.options.qrMaxRetries > 0) { - qrRetries++; - if (qrRetries > this.options.qrMaxRetries) { - this.emit(Events.DISCONNECTED, 'Max qrcode retries reached'); - await this.destroy(); - } + await exposeFunctionIfAbsent(this.pupPage, 'onQRChangedEvent', async (qr) => { + /** + * Emitted when a QR code is received + * @event Client#qr + * @param {string} qr QR Code + */ + this.emit(Events.QR_RECEIVED, qr); + if (this.options.qrMaxRetries > 0) { + qrRetries++; + if (qrRetries > this.options.qrMaxRetries) { + this.emit(Events.DISCONNECTED, 'Max qrcode retries reached'); + await this.destroy(); } - }); - } + } + }); await this.pupPage.evaluate(async () => { @@ -209,86 +204,78 @@

Source: Client.js

}); } - if (!reinject) { - await this.pupPage.exposeFunction('onAuthAppStateChangedEvent', async (state) => { - if (state == 'UNPAIRED_IDLE') { - // refresh qr code - window.Store.Cmd.refreshQR(); - } - }); + await exposeFunctionIfAbsent(this.pupPage, 'onAuthAppStateChangedEvent', async (state) => { + if (state == 'UNPAIRED_IDLE') { + // refresh qr code + window.Store.Cmd.refreshQR(); + } + }); - await this.pupPage.exposeFunction('onAppStateHasSyncedEvent', async () => { - const authEventPayload = await this.authStrategy.getAuthEventPayload(); - /** + await exposeFunctionIfAbsent(this.pupPage, 'onAppStateHasSyncedEvent', async () => { + const authEventPayload = await this.authStrategy.getAuthEventPayload(); + /** * Emitted when authentication is successful * @event Client#authenticated */ - this.emit(Events.AUTHENTICATED, authEventPayload); + this.emit(Events.AUTHENTICATED, authEventPayload); - const injected = await this.pupPage.evaluate(async () => { - return typeof window.Store !== 'undefined' &amp;&amp; typeof window.WWebJS !== 'undefined'; - }); + const injected = await this.pupPage.evaluate(async () => { + return typeof window.Store !== 'undefined' &amp;&amp; typeof window.WWebJS !== 'undefined'; + }); - if (!injected) { - if (this.options.webVersionCache.type === 'local' &amp;&amp; this.currentIndexHtml) { - const { type: webCacheType, ...webCacheOptions } = this.options.webVersionCache; - const webCache = WebCacheFactory.createWebCache(webCacheType, webCacheOptions); + if (!injected) { + if (this.options.webVersionCache.type === 'local' &amp;&amp; this.currentIndexHtml) { + const { type: webCacheType, ...webCacheOptions } = this.options.webVersionCache; + const webCache = WebCacheFactory.createWebCache(webCacheType, webCacheOptions); - await webCache.persist(this.currentIndexHtml, version); - } + await webCache.persist(this.currentIndexHtml, version); + } - if (isCometOrAbove) { - await this.pupPage.evaluate(ExposeStore); - } else { - // make sure all modules are ready before injection - // 2 second delay after authentication makes sense and does not need to be made dyanmic or removed - await new Promise(r => setTimeout(r, 2000)); - await this.pupPage.evaluate(ExposeLegacyStore); - } + if (isCometOrAbove) { + await this.pupPage.evaluate(ExposeStore); + } else { + // make sure all modules are ready before injection + // 2 second delay after authentication makes sense and does not need to be made dyanmic or removed + await new Promise(r => setTimeout(r, 2000)); + await this.pupPage.evaluate(ExposeLegacyStore); + } - // Check window.Store Injection - await this.pupPage.waitForFunction('window.Store != undefined'); + // Check window.Store Injection + await this.pupPage.waitForFunction('window.Store != undefined'); - /** + /** * Current connection information * @type {ClientInfo} */ - this.info = new ClientInfo(this, await this.pupPage.evaluate(() => { - return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMeUser() }; - })); + this.info = new ClientInfo(this, await this.pupPage.evaluate(() => { + return { ...window.Store.Conn.serialize(), wid: window.Store.User.getMeUser() }; + })); - this.interface = new InterfaceController(this); + this.interface = new InterfaceController(this); - //Load util functions (serializers, helper functions) - await this.pupPage.evaluate(LoadUtils); + //Load util functions (serializers, helper functions) + await this.pupPage.evaluate(LoadUtils); - await this.attachEventListeners(reinject); - reinject = true; - } - /** + await this.attachEventListeners(); + } + /** * Emitted when the client has initialized and is ready to receive messages. * @event Client#ready */ - this.emit(Events.READY); - this.authStrategy.afterAuthReady(); - }); - let lastPercent = null; - await this.pupPage.exposeFunction('onOfflineProgressUpdateEvent', async (percent) => { - if (lastPercent !== percent) { - lastPercent = percent; - this.emit(Events.LOADING_SCREEN, percent, 'WhatsApp'); // Message is hardcoded as "WhatsApp" for now - } - }); - } - const logoutCatchInjected = await this.pupPage.evaluate(() => { - return typeof window.onLogoutEvent !== 'undefined'; + this.emit(Events.READY); + this.authStrategy.afterAuthReady(); + }); + let lastPercent = null; + await exposeFunctionIfAbsent(this.pupPage, 'onOfflineProgressUpdateEvent', async (percent) => { + if (lastPercent !== percent) { + lastPercent = percent; + this.emit(Events.LOADING_SCREEN, percent, 'WhatsApp'); // Message is hardcoded as "WhatsApp" for now + } + }); + await exposeFunctionIfAbsent(this.pupPage, 'onLogoutEvent', async () => { + this.lastLoggedOut = true; + await this.pupPage.waitForNavigation({waitUntil: 'load', timeout: 5000}).catch((_) => _); }); - if (!logoutCatchInjected) { - await this.pupPage.exposeFunction('onLogoutEvent', async () => { - this.lastLoggedOut = true; - await this.pupPage.waitForNavigation({waitUntil: 'load', timeout: 5000}).catch((_) => _); - }); - } await this.pupPage.evaluate(() => { window.AuthStore.AppState.on('change:state', (_AppState, state) => { window.onAuthAppStateChangedEvent(state); }); window.AuthStore.AppState.on('change:hasSynced', () => { window.onAppStateHasSyncedEvent(); }); @@ -380,7 +367,7 @@

Source: Client.js

await this.authStrategy.afterBrowserInitialized(); this.lastLoggedOut = false; } - await this.inject(true); + await this.inject(); }); } @@ -403,34 +390,33 @@

Source: Client.js

* Private function * @property {boolean} reinject is this a reinject? */ - async attachEventListeners(reinject = false) { - if (!reinject) { - await this.pupPage.exposeFunction('onAddMessageEvent', msg => { - if (msg.type === 'gp2') { - const notification = new GroupNotification(this, msg); - if (['add', 'invite', 'linked_group_join'].includes(msg.subtype)) { - /** + async attachEventListeners() { + await exposeFunctionIfAbsent(this.pupPage, 'onAddMessageEvent', msg => { + if (msg.type === 'gp2') { + const notification = new GroupNotification(this, msg); + if (['add', 'invite', 'linked_group_join'].includes(msg.subtype)) { + /** * Emitted when a user joins the chat via invite link or is added by an admin. * @event Client#group_join * @param {GroupNotification} notification GroupNotification with more information about the action */ - this.emit(Events.GROUP_JOIN, notification); - } else if (msg.subtype === 'remove' || msg.subtype === 'leave') { - /** + this.emit(Events.GROUP_JOIN, notification); + } else if (msg.subtype === 'remove' || msg.subtype === 'leave') { + /** * Emitted when a user leaves the chat or is removed by an admin. * @event Client#group_leave * @param {GroupNotification} notification GroupNotification with more information about the action */ - this.emit(Events.GROUP_LEAVE, notification); - } else if (msg.subtype === 'promote' || msg.subtype === 'demote') { - /** + this.emit(Events.GROUP_LEAVE, notification); + } else if (msg.subtype === 'promote' || msg.subtype === 'demote') { + /** * Emitted when a current user is promoted to an admin or demoted to a regular user. * @event Client#group_admin_changed * @param {GroupNotification} notification GroupNotification with more information about the action */ - this.emit(Events.GROUP_ADMIN_CHANGED, notification); - } else if (msg.subtype === 'membership_approval_request') { - /** + this.emit(Events.GROUP_ADMIN_CHANGED, notification); + } else if (msg.subtype === 'membership_approval_request') { + /** * Emitted when some user requested to join the group * that has the membership approval mode turned on * @event Client#group_membership_request @@ -439,86 +425,86 @@

Source: Client.js

* @param {string} notification.author The user ID that made a request * @param {number} notification.timestamp The timestamp the request was made at */ - this.emit(Events.GROUP_MEMBERSHIP_REQUEST, notification); - } else { - /** + this.emit(Events.GROUP_MEMBERSHIP_REQUEST, notification); + } else { + /** * Emitted when group settings are updated, such as subject, description or picture. * @event Client#group_update * @param {GroupNotification} notification GroupNotification with more information about the action */ - this.emit(Events.GROUP_UPDATE, notification); - } - return; + this.emit(Events.GROUP_UPDATE, notification); } + return; + } - const message = new Message(this, msg); + const message = new Message(this, msg); - /** + /** * Emitted when a new message is created, which may include the current user's own messages. * @event Client#message_create * @param {Message} message The message that was created */ - this.emit(Events.MESSAGE_CREATE, message); + this.emit(Events.MESSAGE_CREATE, message); - if (msg.id.fromMe) return; + if (msg.id.fromMe) return; - /** + /** * Emitted when a new message is received. * @event Client#message * @param {Message} message The message that was received */ - this.emit(Events.MESSAGE_RECEIVED, message); - }); + this.emit(Events.MESSAGE_RECEIVED, message); + }); - let last_message; + let last_message; - await this.pupPage.exposeFunction('onChangeMessageTypeEvent', (msg) => { + await exposeFunctionIfAbsent(this.pupPage, 'onChangeMessageTypeEvent', (msg) => { - if (msg.type === 'revoked') { - const message = new Message(this, msg); - let revoked_msg; - if (last_message &amp;&amp; msg.id.id === last_message.id.id) { - revoked_msg = new Message(this, last_message); - } + if (msg.type === 'revoked') { + const message = new Message(this, msg); + let revoked_msg; + if (last_message &amp;&amp; msg.id.id === last_message.id.id) { + revoked_msg = new Message(this, last_message); + } - /** + /** * Emitted when a message is deleted for everyone in the chat. * @event Client#message_revoke_everyone * @param {Message} message The message that was revoked, in its current state. It will not contain the original message's data. * @param {?Message} revoked_msg The message that was revoked, before it was revoked. It will contain the message's original data. * Note that due to the way this data is captured, it may be possible that this param will be undefined. */ - this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg); - } + this.emit(Events.MESSAGE_REVOKED_EVERYONE, message, revoked_msg); + } - }); + }); - await this.pupPage.exposeFunction('onChangeMessageEvent', (msg) => { + await exposeFunctionIfAbsent(this.pupPage, 'onChangeMessageEvent', (msg) => { - if (msg.type !== 'revoked') { - last_message = msg; - } + if (msg.type !== 'revoked') { + last_message = msg; + } - /** + /** * The event notification that is received when one of * the group participants changes their phone number. */ - const isParticipant = msg.type === 'gp2' &amp;&amp; msg.subtype === 'modify'; + const isParticipant = msg.type === 'gp2' &amp;&amp; msg.subtype === 'modify'; - /** + /** * The event notification that is received when one of * the contacts changes their phone number. */ - const isContact = msg.type === 'notification_template' &amp;&amp; msg.subtype === 'change_number'; + const isContact = msg.type === 'notification_template' &amp;&amp; msg.subtype === 'change_number'; - if (isParticipant || isContact) { - /** @type {GroupNotification} object does not provide enough information about this event, so a @type {Message} object is used. */ - const message = new Message(this, msg); + if (isParticipant || isContact) { + /** @type {GroupNotification} object does not provide enough information about this event, so a @type {Message} object is used. */ + const message = new Message(this, msg); - const newId = isParticipant ? msg.recipients[0] : msg.to; - const oldId = isParticipant ? msg.author : msg.templateParams.find(id => id !== newId); + const newId = isParticipant ? msg.recipients[0] : msg.to; + const oldId = isParticipant ? msg.author : msg.templateParams.find(id => id !== newId); - /** + /** * Emitted when a contact or a group participant changes their phone number. * @event Client#contact_changed * @param {Message} message Message with more information about the event. @@ -527,98 +513,98 @@

Source: Client.js

* @param {String} newId The user's new id after the change. * @param {Boolean} isContact Indicates if a contact or a group participant changed their phone number. */ - this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact); - } - }); + this.emit(Events.CONTACT_CHANGED, message, oldId, newId, isContact); + } + }); - await this.pupPage.exposeFunction('onRemoveMessageEvent', (msg) => { + await exposeFunctionIfAbsent(this.pupPage, 'onRemoveMessageEvent', (msg) => { - if (!msg.isNewMsg) return; + if (!msg.isNewMsg) return; - const message = new Message(this, msg); + const message = new Message(this, msg); - /** + /** * Emitted when a message is deleted by the current user. * @event Client#message_revoke_me * @param {Message} message The message that was revoked */ - this.emit(Events.MESSAGE_REVOKED_ME, message); + this.emit(Events.MESSAGE_REVOKED_ME, message); - }); + }); - await this.pupPage.exposeFunction('onMessageAckEvent', (msg, ack) => { + await exposeFunctionIfAbsent(this.pupPage, 'onMessageAckEvent', (msg, ack) => { - const message = new Message(this, msg); + const message = new Message(this, msg); - /** + /** * Emitted when an ack event occurrs on message type. * @event Client#message_ack * @param {Message} message The message that was affected * @param {MessageAck} ack The new ACK value */ - this.emit(Events.MESSAGE_ACK, message, ack); + this.emit(Events.MESSAGE_ACK, message, ack); - }); + }); - await this.pupPage.exposeFunction('onChatUnreadCountEvent', async (data) =>{ - const chat = await this.getChatById(data.id); + await exposeFunctionIfAbsent(this.pupPage, 'onChatUnreadCountEvent', async (data) =>{ + const chat = await this.getChatById(data.id); - /** + /** * Emitted when the chat unread count changes */ - this.emit(Events.UNREAD_COUNT, chat); - }); + this.emit(Events.UNREAD_COUNT, chat); + }); - await this.pupPage.exposeFunction('onMessageMediaUploadedEvent', (msg) => { + await exposeFunctionIfAbsent(this.pupPage, 'onMessageMediaUploadedEvent', (msg) => { - const message = new Message(this, msg); + const message = new Message(this, msg); - /** + /** * Emitted when media has been uploaded for a message sent by the client. * @event Client#media_uploaded * @param {Message} message The message with media that was uploaded */ - this.emit(Events.MEDIA_UPLOADED, message); - }); + this.emit(Events.MEDIA_UPLOADED, message); + }); - await this.pupPage.exposeFunction('onAppStateChangedEvent', async (state) => { - /** + await exposeFunctionIfAbsent(this.pupPage, 'onAppStateChangedEvent', async (state) => { + /** * Emitted when the connection state changes * @event Client#change_state * @param {WAState} state the new connection state */ - this.emit(Events.STATE_CHANGED, state); + this.emit(Events.STATE_CHANGED, state); - const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT]; + const ACCEPTED_STATES = [WAState.CONNECTED, WAState.OPENING, WAState.PAIRING, WAState.TIMEOUT]; - if (this.options.takeoverOnConflict) { - ACCEPTED_STATES.push(WAState.CONFLICT); + if (this.options.takeoverOnConflict) { + ACCEPTED_STATES.push(WAState.CONFLICT); - if (state === WAState.CONFLICT) { - setTimeout(() => { - this.pupPage.evaluate(() => window.Store.AppState.takeover()); - }, this.options.takeoverTimeoutMs); - } + if (state === WAState.CONFLICT) { + setTimeout(() => { + this.pupPage.evaluate(() => window.Store.AppState.takeover()); + }, this.options.takeoverTimeoutMs); } + } - if (!ACCEPTED_STATES.includes(state)) { - /** + if (!ACCEPTED_STATES.includes(state)) { + /** * Emitted when the client has been disconnected * @event Client#disconnected * @param {WAState|"LOGOUT"} reason reason that caused the disconnect */ - await this.authStrategy.disconnect(); - this.emit(Events.DISCONNECTED, state); - this.destroy(); - } - }); + await this.authStrategy.disconnect(); + this.emit(Events.DISCONNECTED, state); + this.destroy(); + } + }); - await this.pupPage.exposeFunction('onBatteryStateChangedEvent', (state) => { - const { battery, plugged } = state; + await exposeFunctionIfAbsent(this.pupPage, 'onBatteryStateChangedEvent', (state) => { + const { battery, plugged } = state; - if (battery === undefined) return; + if (battery === undefined) return; - /** + /** * Emitted when the battery percentage for the attached device changes. Will not be sent if using multi-device. * @event Client#change_battery * @param {object} batteryInfo @@ -626,11 +612,11 @@

Source: Client.js

* @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false) * @deprecated */ - this.emit(Events.BATTERY_CHANGED, { battery, plugged }); - }); + this.emit(Events.BATTERY_CHANGED, { battery, plugged }); + }); - await this.pupPage.exposeFunction('onIncomingCall', (call) => { - /** + await exposeFunctionIfAbsent(this.pupPage, 'onIncomingCall', (call) => { + /** * Emitted when a call is received * @event Client#incoming_call * @param {object} call @@ -643,13 +629,13 @@

Source: Client.js

* @param {boolean} call.webClientShouldHandle - If Waweb should handle * @param {object} call.participants - Participants */ - const cll = new Call(this, call); - this.emit(Events.INCOMING_CALL, cll); - }); + const cll = new Call(this, call); + this.emit(Events.INCOMING_CALL, cll); + }); - await this.pupPage.exposeFunction('onReaction', (reactions) => { - for (const reaction of reactions) { - /** + await exposeFunctionIfAbsent(this.pupPage, 'onReaction', (reactions) => { + for (const reaction of reactions) { + /** * Emitted when a reaction is sent, received, updated or removed * @event Client#message_reaction * @param {object} reaction @@ -664,61 +650,60 @@

Source: Client.js

* @param {?number} reaction.ack - Ack */ - this.emit(Events.MESSAGE_REACTION, new Reaction(this, reaction)); - } - }); + this.emit(Events.MESSAGE_REACTION, new Reaction(this, reaction)); + } + }); - await this.pupPage.exposeFunction('onRemoveChatEvent', async (chat) => { - const _chat = await this.getChatById(chat.id); + await exposeFunctionIfAbsent(this.pupPage, 'onRemoveChatEvent', async (chat) => { + const _chat = await this.getChatById(chat.id); - /** + /** * Emitted when a chat is removed * @event Client#chat_removed * @param {Chat} chat */ - this.emit(Events.CHAT_REMOVED, _chat); - }); + this.emit(Events.CHAT_REMOVED, _chat); + }); - await this.pupPage.exposeFunction('onArchiveChatEvent', async (chat, currState, prevState) => { - const _chat = await this.getChatById(chat.id); + await exposeFunctionIfAbsent(this.pupPage, 'onArchiveChatEvent', async (chat, currState, prevState) => { + const _chat = await this.getChatById(chat.id); - /** + /** * Emitted when a chat is archived/unarchived * @event Client#chat_archived * @param {Chat} chat * @param {boolean} currState * @param {boolean} prevState */ - this.emit(Events.CHAT_ARCHIVED, _chat, currState, prevState); - }); + this.emit(Events.CHAT_ARCHIVED, _chat, currState, prevState); + }); - await this.pupPage.exposeFunction('onEditMessageEvent', (msg, newBody, prevBody) => { + await exposeFunctionIfAbsent(this.pupPage, 'onEditMessageEvent', (msg, newBody, prevBody) => { - if(msg.type === 'revoked'){ - return; - } - /** + if(msg.type === 'revoked'){ + return; + } + /** * Emitted when messages are edited * @event Client#message_edit * @param {Message} message * @param {string} newBody * @param {string} prevBody */ - this.emit(Events.MESSAGE_EDIT, new Message(this, msg), newBody, prevBody); - }); + this.emit(Events.MESSAGE_EDIT, new Message(this, msg), newBody, prevBody); + }); - await this.pupPage.exposeFunction('onAddMessageCiphertextEvent', msg => { + await exposeFunctionIfAbsent(this.pupPage, 'onAddMessageCiphertextEvent', msg => { - /** + /** * Emitted when messages are edited * @event Client#message_ciphertext * @param {Message} message */ - this.emit(Events.MESSAGE_CIPHERTEXT, new Message(this, msg)); - }); - } + this.emit(Events.MESSAGE_CIPHERTEXT, new Message(this, msg)); + }); - await this.pupPage.exposeFunction('onPollVoteEvent', (vote) => { + await exposeFunctionIfAbsent(this.pupPage, 'onPollVoteEvent', (vote) => { const _vote = new PollVote(this, vote); /** * Emitted when some poll option is selected or deselected, @@ -1518,6 +1503,17 @@

Source: Client.js

return labels.map(data => new Label(this, data)); } + + /** + * Get all current Broadcast + * @returns {Promise&lt;Array&lt;Broadcast>>} + */ + async getBroadcasts() { + const broadcasts = await this.pupPage.evaluate(async () => { + return window.WWebJS.getAllStatuses(); + }); + return broadcasts.map(data => new Broadcast(this, data)); + } /** * Get Label instance by ID @@ -1760,19 +1756,40 @@

Source: Client.js

* Get user device count by ID * Each WaWeb Connection counts as one device, and the phone (if exists) counts as one * So for a non-enterprise user with one WaWeb connection it should return "2" - * @param {string} contactId - * @returns {number} + * @param {string} userId + * @returns {Promise&lt;number>} */ - async getContactDeviceCount(contactId) { - let devices = await window.Store.DeviceList.getDeviceIds([window.Store.WidFactory.createWid(contactId)]); - if(devices &amp;&amp; devices.length &amp;&amp; devices[0] != null &amp;&amp; typeof devices[0].devices == 'object'){ - return devices[0].devices.length; - } - return 0; + async getContactDeviceCount(userId) { + return await this.pupPage.evaluate(async (userId) => { + const devices = await window.Store.DeviceList.getDeviceIds([window.Store.WidFactory.createWid(userId)]); + if (devices &amp;&amp; devices.length &amp;&amp; devices[0] != null &amp;&amp; typeof devices[0].devices == 'object') { + return devices[0].devices.length; + } + return 0; + }, userId); + } + + /** + * Sync chat history conversation + * @param {string} chatId + * @return {Promise&lt;boolean>} True if operation completed successfully, false otherwise. + */ + async syncHistory(chatId) { + return await this.pupPage.evaluate(async (chatId) => { + const chat = await window.WWebJS.getChat(chatId); + if (chat.endOfHistoryTransferType === 0) { + await window.Store.HistorySync.sendPeerDataOperationRequest(3, { + chatId: chat.id + }); + return true; + } + return false; + }, chatId); } } -module.exports = Client; +module.exports = Client; +
@@ -1782,7 +1799,7 @@

Source: Client.js

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index df2c6aaec6..0cf2985702 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: ClientInfo + whatsapp-web.js 1.26.1-alpha.2 » Class: ClientInfo @@ -15,7 +15,7 @@ @@ -242,7 +242,7 @@

getBatteryStatus diff --git a/docs/Contact.html b/docs/Contact.html index fa564cb5f0..ea6727b0b0 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Contact + whatsapp-web.js 1.26.1-alpha.2 » Class: Contact @@ -15,7 +15,7 @@ @@ -293,7 +293,7 @@

unblock diff --git a/docs/GroupChat.html b/docs/GroupChat.html index f030c2f550..0360c43316 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: GroupChat + whatsapp-web.js 1.26.1-alpha.2 » Class: GroupChat @@ -15,7 +15,7 @@ @@ -205,6 +205,9 @@

Methods

setSubject(subject)
+
syncHistory()
+
+
unarchive()
@@ -1173,6 +1176,17 @@

Parameter

async
+

syncHistory() → Promise containing boolean

+

Sync chat history conversation

+
+
Inherited from
+
Chat#syncHistory
+
Returns
+
+

True if operation completed successfully, false otherwise.

+
+
+
async

unarchive()

un-archives this chat

@@ -1207,7 +1221,7 @@

unpin diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index b9698d9a7a..f8808ac016 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: GroupNotification + whatsapp-web.js 1.26.1-alpha.2 » Class: GroupNotification @@ -15,7 +15,7 @@ @@ -233,7 +233,7 @@

Parameters

diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html index 9fa2ab3207..535544e448 100644 --- a/docs/InterfaceController.html +++ b/docs/InterfaceController.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: InterfaceController + whatsapp-web.js 1.26.1-alpha.2 » Class: InterfaceController @@ -15,7 +15,7 @@ @@ -382,7 +382,7 @@

Parameter

diff --git a/docs/Label.html b/docs/Label.html index e3109ec53b..a32c5fe870 100644 --- a/docs/Label.html +++ b/docs/Label.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Label + whatsapp-web.js 1.26.1-alpha.2 » Class: Label @@ -15,7 +15,7 @@ @@ -163,7 +163,7 @@

getChats diff --git a/docs/List.html b/docs/List.html index 4a4d88c3d5..b6a19fc831 100644 --- a/docs/List.html +++ b/docs/List.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: List + whatsapp-web.js 1.26.1-alpha.2 » Class: List @@ -15,7 +15,7 @@ @@ -256,7 +256,7 @@

Parameter

diff --git a/docs/LocalAuth.html b/docs/LocalAuth.html index f33cae4ff9..64dedee41c 100644 --- a/docs/LocalAuth.html +++ b/docs/LocalAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: LocalAuth + whatsapp-web.js 1.26.1-alpha.2 » Class: LocalAuth @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/LocalWebCache.html b/docs/LocalWebCache.html index 7c8e972511..b08cf8020c 100644 --- a/docs/LocalWebCache.html +++ b/docs/LocalWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: LocalWebCache + whatsapp-web.js 1.26.1-alpha.2 » Class: LocalWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Location.html b/docs/Location.html index af24f450e8..3349deda4b 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Location + whatsapp-web.js 1.26.1-alpha.2 » Class: Location @@ -15,7 +15,7 @@ @@ -173,7 +173,7 @@

url
diff --git a/docs/Message.html b/docs/Message.html index 063daef89b..fb3c37f992 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Message + whatsapp-web.js 1.26.1-alpha.2 » Class: Message @@ -15,7 +15,7 @@ @@ -800,7 +800,7 @@

unstar<
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 80d2104e9f..9d90f4cd60 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: MessageMedia + whatsapp-web.js 1.26.1-alpha.2 » Class: MessageMedia @@ -15,7 +15,7 @@ @@ -364,7 +364,7 @@

Parameters

diff --git a/docs/NoAuth.html b/docs/NoAuth.html index 913f14c8d1..a008f8f80e 100644 --- a/docs/NoAuth.html +++ b/docs/NoAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: NoAuth + whatsapp-web.js 1.26.1-alpha.2 » Class: NoAuth @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

new NoAuth diff --git a/docs/Order.html b/docs/Order.html index a27a89320c..da6cf7cfc6 100644 --- a/docs/Order.html +++ b/docs/Order.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Order + whatsapp-web.js 1.26.1-alpha.2 » Class: Order @@ -15,7 +15,7 @@ @@ -102,7 +102,7 @@

total diff --git a/docs/Poll.html b/docs/Poll.html index 56eab4d9d4..9083d1a81c 100644 --- a/docs/Poll.html +++ b/docs/Poll.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Poll + whatsapp-web.js 1.26.1-alpha.2 » Class: Poll @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

pollOptions diff --git a/docs/PollVote.html b/docs/PollVote.html index 2516a2adb9..d8c8025448 100644 --- a/docs/PollVote.html +++ b/docs/PollVote.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: PollVote + whatsapp-web.js 1.26.1-alpha.2 » Class: PollVote @@ -15,7 +15,7 @@ @@ -104,7 +104,7 @@

voter diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index ed4e95c92f..18586b239c 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: PrivateChat + whatsapp-web.js 1.26.1-alpha.2 » Class: PrivateChat @@ -15,7 +15,7 @@ @@ -107,13 +107,13 @@

Methods

fetchMessages(searchOptions)
+
getContact()
+
+

-
getContact()
-
-
getLabels()
@@ -129,19 +129,22 @@

Methods

sendMessage(content[, options])
-
-
- +
+
sendStateTyping()
+
syncHistory()
+
+
unarchive()
@@ -549,6 +552,17 @@

sendStateTypingChat#sendStateTyping

async
+

syncHistory() → Promise containing boolean

+

Sync chat history conversation

+
+
Inherited from
+
Chat#syncHistory
+
Returns
+
+

True if operation completed successfully, false otherwise.

+
+
+
async

unarchive()

un-archives this chat

@@ -583,7 +597,7 @@

unpin diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index a4a76a77ba..2d9494569c 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: PrivateContact + whatsapp-web.js 1.26.1-alpha.2 » Class: PrivateContact @@ -15,7 +15,7 @@ @@ -319,7 +319,7 @@

unblock diff --git a/docs/Product.html b/docs/Product.html index 40dfb48dd7..22b312640e 100644 --- a/docs/Product.html +++ b/docs/Product.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Product + whatsapp-web.js 1.26.1-alpha.2 » Class: Product @@ -15,7 +15,7 @@ @@ -127,7 +127,7 @@

thumbnailUrl diff --git a/docs/Reaction.html b/docs/Reaction.html index 6848cbf0df..a89121529e 100644 --- a/docs/Reaction.html +++ b/docs/Reaction.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Reaction + whatsapp-web.js 1.26.1-alpha.2 » Class: Reaction @@ -15,7 +15,7 @@ @@ -144,7 +144,7 @@

timestamp diff --git a/docs/RemoteAuth.html b/docs/RemoteAuth.html index 2a51db1123..6560ae5ecc 100644 --- a/docs/RemoteAuth.html +++ b/docs/RemoteAuth.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: RemoteAuth + whatsapp-web.js 1.26.1-alpha.2 » Class: RemoteAuth @@ -15,7 +15,7 @@ @@ -148,7 +148,7 @@

Parameters

diff --git a/docs/RemoteWebCache.html b/docs/RemoteWebCache.html index 0ac8c8759b..395f0d209f 100644 --- a/docs/RemoteWebCache.html +++ b/docs/RemoteWebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: RemoteWebCache + whatsapp-web.js 1.26.1-alpha.2 » Class: RemoteWebCache @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Parameters

diff --git a/docs/Util.html b/docs/Util.html index 2ee6d46b26..84ed99703d 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: Util + whatsapp-web.js 1.26.1-alpha.2 » Class: Util @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Parameter

diff --git a/docs/WebCache.html b/docs/WebCache.html index deb2656f9e..6f0e86370d 100644 --- a/docs/WebCache.html +++ b/docs/WebCache.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Class: WebCache + whatsapp-web.js 1.26.1-alpha.2 » Class: WebCache @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

new WebCache diff --git a/docs/authStrategies_BaseAuthStrategy.js.html b/docs/authStrategies_BaseAuthStrategy.js.html index 7e3087dc59..f283cbd124 100644 --- a/docs/authStrategies_BaseAuthStrategy.js.html +++ b/docs/authStrategies_BaseAuthStrategy.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: authStrategies/BaseAuthStrategy.js + whatsapp-web.js 1.26.1-alpha.2 » Source: authStrategies/BaseAuthStrategy.js @@ -15,7 +15,7 @@ @@ -65,7 +65,7 @@

Source: authStrategies/BaseAuthStrategy.js

diff --git a/docs/authStrategies_LocalAuth.js.html b/docs/authStrategies_LocalAuth.js.html index 1aba149ec6..54c423da18 100644 --- a/docs/authStrategies_LocalAuth.js.html +++ b/docs/authStrategies_LocalAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: authStrategies/LocalAuth.js + whatsapp-web.js 1.26.1-alpha.2 » Source: authStrategies/LocalAuth.js @@ -15,7 +15,7 @@ @@ -95,7 +95,7 @@

Source: authStrategies/LocalAuth.js

diff --git a/docs/authStrategies_NoAuth.js.html b/docs/authStrategies_NoAuth.js.html index 1870304cd9..549ce200a6 100644 --- a/docs/authStrategies_NoAuth.js.html +++ b/docs/authStrategies_NoAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: authStrategies/NoAuth.js + whatsapp-web.js 1.26.1-alpha.2 » Source: authStrategies/NoAuth.js @@ -15,7 +15,7 @@ @@ -50,7 +50,7 @@

Source: authStrategies/NoAuth.js

diff --git a/docs/authStrategies_RemoteAuth.js.html b/docs/authStrategies_RemoteAuth.js.html index 49f3cc689c..5126d78d37 100644 --- a/docs/authStrategies_RemoteAuth.js.html +++ b/docs/authStrategies_RemoteAuth.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: authStrategies/RemoteAuth.js + whatsapp-web.js 1.26.1-alpha.2 » Source: authStrategies/RemoteAuth.js @@ -15,7 +15,7 @@ @@ -243,7 +243,7 @@

Source: authStrategies/RemoteAuth.js

diff --git a/docs/global.html b/docs/global.html index aaea4b3236..f8b86cd8ca 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Globals + whatsapp-web.js 1.26.1-alpha.2 » Globals @@ -15,7 +15,7 @@ @@ -63,6 +63,22 @@

Properties

+
+

Method

+
+ +
+
+
+
+
+

Abstract types

@@ -1587,6 +1603,72 @@

Properties

+

Method

+
+
async
+

exposeFunctionIfAbsent(page, name, fn)

+

Expose a function to the page if it does not exist

+

NOTE: + Rewrite it to 'upsertFunction' after updating Puppeteer to 20.6 or higher + using page.removeExposedFunction + https://pptr.dev/api/puppeteer.page.removeExposedFunction

+
+

Parameters

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeOptionalDescription
+

page

+
+

 

+
+

 

+
+
+

name

+
+

string

+
+

 

+
+
+

fn

+
+

function()

+
+

 

+
+
+
+
+
+

Abstract types

AddParticipantsResult @@ -3599,7 +3681,7 @@

Properties

diff --git a/docs/index.html b/docs/index.html index b07a22a6e5..9a5499dc8c 100644 --- a/docs/index.html +++ b/docs/index.html @@ -3,7 +3,7 @@ - whatsapp-web.js 1.26.0 » Home + whatsapp-web.js 1.26.1-alpha.2 » Home @@ -13,7 +13,7 @@ @@ -26,7 +26,7 @@
@@ -39,7 +39,7 @@

npm Depfu - WhatsApp_Web 2.2346.52 + WhatsApp_Web 2.2346.52 Discord server


@@ -325,6 +325,68 @@

BaseAuthStrategy

+
+
+

Broadcast

+
+
+
+
+ Broadcast() +
+
+
+
+ Broadcast#getChat() +
+
+
+
+ Broadcast#getContact() +
+
+
+
+
+ +
+
+
+ Broadcast#id +
+
+
+
+ Broadcast#msgs +
+
+
+
+ Broadcast#timestamp +
+
+
+
+
+ +
+
+
+ Broadcast#totalCount +
+
+
+
+ Broadcast#unreadCount +
+
+
+
+
+ +
+
+

BusinessContact

@@ -647,16 +709,16 @@

Chat

- -
- -
-
Chat#id
+
+
+ +
+
Chat#isGroup
@@ -702,11 +764,6 @@

Chat

-
-
- -
-
Chat#pinned
@@ -717,6 +774,11 @@

Chat

+
+
+ +
+
Chat#sendSeen()
@@ -732,6 +794,11 @@

Chat

+
+ Chat#syncHistory() +
+
+
Chat#timestamp
@@ -946,16 +1013,16 @@

Client

-
-
- - + +
+
Client#event:message_edit
@@ -996,6 +1063,11 @@

Client

+
+ Client#getBroadcasts() +
+
+
Client#getChatById(chatId)
@@ -1027,7 +1099,7 @@

Client

- Client#getContactDeviceCount(contactId) + Client#getContactDeviceCount(userId)
@@ -1091,16 +1163,16 @@

Client

-
-
- - + +
+
Client#inject()
@@ -1216,6 +1288,11 @@

Client

+
+ Client#syncHistory(chatId) +
+
+
Client#unarchiveChat()
@@ -1684,16 +1761,16 @@

GroupChat

-
-
- - + +
+
GroupChat#id
@@ -1774,11 +1851,6 @@

GroupChat

-
-
- -
-
GroupChat#removeParticipants(participantIds)
@@ -1789,6 +1861,11 @@

GroupChat

+
+
+ +
+
GroupChat#sendMessage(content[, options])
@@ -1839,6 +1916,11 @@

GroupChat

+
+ GroupChat#syncHistory() +
+
+
GroupChat#timestamp
@@ -3190,16 +3272,16 @@

PrivateChat

-
-
- - + +
+
PrivateChat#isGroup
@@ -3245,11 +3327,6 @@

PrivateChat

-
-
- -
-
PrivateChat#pinned
@@ -3260,6 +3337,11 @@

PrivateChat

+
+
+ +
+
PrivateChat#sendSeen()
@@ -3275,6 +3357,11 @@

PrivateChat

+
+ PrivateChat#syncHistory() +
+
+
PrivateChat#timestamp
@@ -3908,7 +3995,7 @@

window

diff --git a/docs/scripts/jsdoc-toc.js b/docs/scripts/jsdoc-toc.js index a21d2ac0c3..f35ad9d0d6 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":"BaseAuthStrategy","id":"BaseAuthStrategy","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":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], + data: [{"label":"Globals","id":"global","children":[]},{"label":"Base","id":"Base","children":[]},{"label":"BaseAuthStrategy","id":"BaseAuthStrategy","children":[]},{"label":"Broadcast","id":"Broadcast","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":"LocalAuth","id":"LocalAuth","children":[]},{"label":"LocalWebCache","id":"LocalWebCache","children":[]},{"label":"Location","id":"Location","children":[]},{"label":"Message","id":"Message","children":[]},{"label":"MessageMedia","id":"MessageMedia","children":[]},{"label":"NoAuth","id":"NoAuth","children":[]},{"label":"Order","id":"Order","children":[]},{"label":"Poll","id":"Poll","children":[]},{"label":"PollVote","id":"PollVote","children":[]},{"label":"PrivateChat","id":"PrivateChat","children":[]},{"label":"PrivateContact","id":"PrivateContact","children":[]},{"label":"Product","id":"Product","children":[]},{"label":"Reaction","id":"Reaction","children":[]},{"label":"RemoteAuth","id":"RemoteAuth","children":[]},{"label":"RemoteWebCache","id":"RemoteWebCache","children":[]},{"label":"Util","id":"Util","children":[]},{"label":"WebCache","id":"WebCache","children":[]}], openedIcon: ' ⇣', saveState: false, useContextMenu: false diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index f5a09a22d4..765fc87e95 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Base.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Base.js @@ -15,7 +15,7 @@ @@ -60,7 +60,7 @@

Source: structures/Base.js

diff --git a/docs/structures_Broadcast.js.html b/docs/structures_Broadcast.js.html new file mode 100644 index 0000000000..3151f82dab --- /dev/null +++ b/docs/structures_Broadcast.js.html @@ -0,0 +1,123 @@ + + + + + + + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Broadcast.js + + + + + + + + +
+
+
+ +
+ +
+
'use strict';
+
+const Base = require('./Base');
+const Message = require('./Message');
+
+/**
+ * Represents a Status/Story on WhatsApp
+ * @extends {Base}
+ */
+class Broadcast extends Base {
+    constructor(client, data) {
+        super(client);
+
+        if (data) this._patch(data);
+    }
+
+    _patch(data) {
+        /**
+         * ID that represents the chat
+         * @type {object}
+         */
+        this.id = data.id;
+
+        /**
+         * Unix timestamp of last status
+         * @type {number}
+         */
+        this.timestamp = data.t;
+
+        /**
+         * Number of available statuses
+         * @type {number}
+         */
+        this.totalCount = data.totalCount;
+
+        /**
+         * Number of not viewed
+         * @type {number}
+         */
+        this.unreadCount = data.unreadCount;
+
+        /**
+         * Messages statuses
+         * @type {Message[]}
+         */
+        this.msgs = data.msgs.map(msg => new Message(this.client, msg));
+
+        return super._patch(data);
+    }
+
+    /**
+     * Returns the Chat this message was sent in
+     * @returns {Promise&lt;Chat>}
+     */
+    getChat() {
+        return this.client.getChatById(this.id._serialized);
+    }
+
+    /**
+     * Returns the Contact this message was sent from
+     * @returns {Promise&lt;Contact>}
+     */
+    getContact() {
+        return this.client.getContactById(this.id._serialized);
+    }
+
+}
+
+module.exports = Broadcast;
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 5d34a72817..8a10d67f67 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/BusinessContact.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@ @@ -59,7 +59,7 @@

Source: structures/BusinessContact.js

diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html index 626459905e..15ffef88e9 100644 --- a/docs/structures_Buttons.js.html +++ b/docs/structures_Buttons.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Buttons.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Buttons.js @@ -15,7 +15,7 @@ @@ -120,7 +120,7 @@

Source: structures/Buttons.js

diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html index c76c3ffcf5..f0660cd115 100644 --- a/docs/structures_Call.js.html +++ b/docs/structures_Call.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Call.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Call.js @@ -15,7 +15,7 @@ @@ -114,7 +114,7 @@

Source: structures/Call.js

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 22bea7b017..47c2efaa1b 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Chat.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Chat.js @@ -15,7 +15,7 @@ @@ -110,7 +110,7 @@

Source: structures/Chat.js

* Last message fo chat * @type {Message} */ - this.lastMessage = data.lastMessage ? new Message(super.client, data.lastMessage) : undefined; + this.lastMessage = data.lastMessage ? new Message(this.client, data.lastMessage) : undefined; return super._patch(data); } @@ -301,6 +301,14 @@

Source: structures/Chat.js

async changeLabels(labelIds) { return this.client.addOrRemoveLabels(labelIds, [this.id._serialized]); } + + /** + * Sync chat history conversation + * @return {Promise&lt;boolean>} True if operation completed successfully, false otherwise. + */ + async syncHistory() { + return this.client.syncHistory(this.id._serialized); + } } module.exports = Chat; @@ -314,7 +322,7 @@

Source: structures/Chat.js

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index 2d7f831630..a70b09a207 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/ClientInfo.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@ @@ -109,7 +109,7 @@

Source: structures/ClientInfo.js

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index 58aaaf7c2d..8bfa28083c 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Contact.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Contact.js @@ -15,7 +15,7 @@ @@ -247,7 +247,7 @@

Source: structures/Contact.js

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 03b4e35969..7ade6cfef2 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/GroupChat.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@ @@ -514,7 +514,7 @@

Source: structures/GroupChat.js

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 2ebf6d216f..996ca10608 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/GroupNotification.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@ @@ -143,7 +143,7 @@

Source: structures/GroupNotification.js

diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html index 74aee292d7..03c82a176d 100644 --- a/docs/structures_Label.js.html +++ b/docs/structures_Label.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Label.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Label.js @@ -15,7 +15,7 @@ @@ -88,7 +88,7 @@

Source: structures/Label.js

diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html index 722e99fc2a..4a3cdc2223 100644 --- a/docs/structures_List.js.html +++ b/docs/structures_List.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/List.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/List.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/List.js

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 217e826374..1f8bf6cdf3 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Location.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Location.js @@ -15,7 +15,7 @@ @@ -99,7 +99,7 @@

Source: structures/Location.js

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 5013f81003..70f44d32c0 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Message.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Message.js @@ -15,7 +15,7 @@ @@ -750,7 +750,7 @@

Source: structures/Message.js

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index 4b334eb6ae..ce499f7a26 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/MessageMedia.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@ @@ -150,7 +150,7 @@

Source: structures/MessageMedia.js

diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html index 4a89915fa9..bbc5c6bf6c 100644 --- a/docs/structures_Order.js.html +++ b/docs/structures_Order.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Order.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Order.js @@ -15,7 +15,7 @@ @@ -90,7 +90,7 @@

Source: structures/Order.js

diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html index a0cd91e08f..beeb2c8e1b 100644 --- a/docs/structures_Payment.js.html +++ b/docs/structures_Payment.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Payment.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Payment.js @@ -15,7 +15,7 @@ @@ -118,7 +118,7 @@

Source: structures/Payment.js

diff --git a/docs/structures_Poll.js.html b/docs/structures_Poll.js.html index 7e05c31726..e9ed7a5ced 100644 --- a/docs/structures_Poll.js.html +++ b/docs/structures_Poll.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Poll.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Poll.js @@ -15,7 +15,7 @@ @@ -83,7 +83,7 @@

Source: structures/Poll.js

diff --git a/docs/structures_PollVote.js.html b/docs/structures_PollVote.js.html index 63e4c20924..651e3911d0 100644 --- a/docs/structures_PollVote.js.html +++ b/docs/structures_PollVote.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/PollVote.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/PollVote.js @@ -15,7 +15,7 @@ @@ -100,7 +100,7 @@

Source: structures/PollVote.js

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index e8889b9246..7a3dea040b 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/PrivateChat.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateChat.js

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 2df6faedde..244d473ea1 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/PrivateContact.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@ @@ -51,7 +51,7 @@

Source: structures/PrivateContact.js

diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html index ab12f12518..dc69a22d96 100644 --- a/docs/structures_Product.js.html +++ b/docs/structures_Product.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Product.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Product.js @@ -15,7 +15,7 @@ @@ -106,7 +106,7 @@

Source: structures/Product.js

diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html index 7b09d69981..b377bab414 100644 --- a/docs/structures_ProductMetadata.js.html +++ b/docs/structures_ProductMetadata.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/ProductMetadata.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/ProductMetadata.js @@ -15,7 +15,7 @@ @@ -63,7 +63,7 @@

Source: structures/ProductMetadata.js

diff --git a/docs/structures_Reaction.js.html b/docs/structures_Reaction.js.html index 80ff22a5b0..99384fe383 100644 --- a/docs/structures_Reaction.js.html +++ b/docs/structures_Reaction.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: structures/Reaction.js + whatsapp-web.js 1.26.1-alpha.2 » Source: structures/Reaction.js @@ -15,7 +15,7 @@ @@ -107,7 +107,7 @@

Source: structures/Reaction.js

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index c045d043b2..be63339589 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/Constants.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Constants.js @@ -15,7 +15,7 @@ @@ -38,7 +38,7 @@

Source: util/Constants.js

headless: true, defaultViewport: null }, - webVersion: '2.2346.52', + webVersion: '2.3000.1017054665', webVersionCache: { type: 'local', }, @@ -215,7 +215,7 @@

Source: util/Constants.js

diff --git a/docs/util_Injected_LegacyStore.js.html b/docs/util_Injected_LegacyStore.js.html index 82d7127688..8839ce3568 100644 --- a/docs/util_Injected_LegacyStore.js.html +++ b/docs/util_Injected_LegacyStore.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/Injected/LegacyStore.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Injected/LegacyStore.js @@ -15,7 +15,7 @@ @@ -184,7 +184,7 @@

Source: util/Injected/LegacyStore.js

diff --git a/docs/util_Injected_Store.js.html b/docs/util_Injected_Store.js.html index b96ac29fb9..2546fea72a 100644 --- a/docs/util_Injected_Store.js.html +++ b/docs/util_Injected_Store.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/Injected/Store.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Injected/Store.js @@ -15,7 +15,7 @@ @@ -129,6 +129,7 @@

Source: util/Injected/Store.js

window.Store.BotSecret = window.require('WAWebBotMessageSecret'); window.Store.BotProfiles = window.require('WAWebBotProfileCollection'); window.Store.DeviceList = window.require('WAWebApiDeviceList'); + window.Store.HistorySync = window.require('WAWebSendNonMessageDataRequest'); if (window.compareWwebVersions(window.Debug.VERSION, '>=', '2.3000.1014111620')) window.Store.AddonReactionTable = window.require('WAWebAddonReactionTableMode').reactionTableMode; @@ -206,7 +207,7 @@

Source: util/Injected/Store.js

diff --git a/docs/util_Injected_Utils.js.html b/docs/util_Injected_Utils.js.html index 2cf922c694..11d9c2b908 100644 --- a/docs/util_Injected_Utils.js.html +++ b/docs/util_Injected_Utils.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/Injected/Utils.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Injected/Utils.js @@ -15,7 +15,7 @@ @@ -1044,7 +1044,18 @@

Source: util/Injected/Utils.js

const response = await window.Store.pinUnpinMsg(message, action, duration); return response.messageSendResult === 'OK'; }; + + window.WWebJS.getStatusModel = status => { + let res = status.serialize(); + delete res._msgs; + res.msgs = status._msgs.map(msg => window.WWebJS.getMessageModel(msg)); + return res; + }; + window.WWebJS.getAllStatuses = () => { + const statuses = window.Store.Status.getModelsArray(); + return statuses.map(status => window.WWebJS.getStatusModel(status)); + }; }; @@ -1056,7 +1067,7 @@

Source: util/Injected/Utils.js

diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html index ec6a5c2aaf..bd5ac2b8b7 100644 --- a/docs/util_InterfaceController.js.html +++ b/docs/util_InterfaceController.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/InterfaceController.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/InterfaceController.js @@ -15,7 +15,7 @@ @@ -46,9 +46,9 @@

Source: util/InterfaceController.js

*/ async openChatWindow(chatId) { await this.pupPage.evaluate(async chatId => { - let chatWid = window.Store.WidFactory.createWid(chatId); - let chat = await window.Store.Chat.find(chatWid); - await window.Store.Cmd.openChatAt(chat); + const chatWid = window.Store.WidFactory.createWid(chatId); + const chat = window.Store.Chat.get(chatWid) || await window.Store.Chat.find(chatWid); + await window.Store.Cmd.openChatBottom(chat); }, chatId); } @@ -166,7 +166,7 @@

Source: util/InterfaceController.js

diff --git a/docs/util_Puppeteer.js.html b/docs/util_Puppeteer.js.html new file mode 100644 index 0000000000..095a8a8cc6 --- /dev/null +++ b/docs/util_Puppeteer.js.html @@ -0,0 +1,77 @@ + + + + + + + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Puppeteer.js + + + + + + + + +
+
+
+ +
+ +
+
/**
+ * Expose a function to the page if it does not exist
+ *
+ * NOTE:
+ * Rewrite it to 'upsertFunction' after updating Puppeteer to 20.6 or higher
+ * using page.removeExposedFunction
+ * https://pptr.dev/api/puppeteer.page.removeExposedFunction
+ *
+ * @param {import(puppeteer).Page} page
+ * @param {string} name
+ * @param {Function} fn
+ */
+async function exposeFunctionIfAbsent(page, name, fn) {
+    const exist = await page.evaluate((name) => {
+        return !!window[name];
+    }, name);
+    if (exist) {
+        return;
+    }
+    await page.exposeFunction(name, fn);
+}
+
+module.exports = {exposeFunctionIfAbsent};
+
+
+
+
+ +
+
+
+ +
+ + + + + + + + + \ No newline at end of file diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index bda87a945c..a534d7ad43 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: util/Util.js + whatsapp-web.js 1.26.1-alpha.2 » Source: util/Util.js @@ -15,7 +15,7 @@ @@ -225,7 +225,7 @@

Source: util/Util.js

diff --git a/docs/webCache_LocalWebCache.js.html b/docs/webCache_LocalWebCache.js.html index d820adf976..9ba6eee142 100644 --- a/docs/webCache_LocalWebCache.js.html +++ b/docs/webCache_LocalWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: webCache/LocalWebCache.js + whatsapp-web.js 1.26.1-alpha.2 » Source: webCache/LocalWebCache.js @@ -15,7 +15,7 @@ @@ -79,7 +79,7 @@

Source: webCache/LocalWebCache.js

diff --git a/docs/webCache_RemoteWebCache.js.html b/docs/webCache_RemoteWebCache.js.html index 88d4f7b896..1f0b1fd105 100644 --- a/docs/webCache_RemoteWebCache.js.html +++ b/docs/webCache_RemoteWebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: webCache/RemoteWebCache.js + whatsapp-web.js 1.26.1-alpha.2 » Source: webCache/RemoteWebCache.js @@ -15,7 +15,7 @@ @@ -78,7 +78,7 @@

Source: webCache/RemoteWebCache.js

diff --git a/docs/webCache_WebCache.js.html b/docs/webCache_WebCache.js.html index 7f335795bd..df0eabb436 100644 --- a/docs/webCache_WebCache.js.html +++ b/docs/webCache_WebCache.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.26.0 » Source: webCache/WebCache.js + whatsapp-web.js 1.26.1-alpha.2 » Source: webCache/WebCache.js @@ -15,7 +15,7 @@ @@ -52,7 +52,7 @@

Source: webCache/WebCache.js