From 93c8a2b05e204c6d63615f3351ea87c75c4e2b6f Mon Sep 17 00:00:00 2001
From: Pedro Lopez
Date: Sun, 6 Feb 2022 22:20:08 -0400
Subject: [PATCH] chore: mark version v1.15.5
---
docs/Base.html | 6 +-
docs/BusinessContact.html | 6 +-
docs/Buttons.html | 17 +-
docs/Call.html | 6 +-
docs/Chat.html | 29 +-
docs/Client.html | 33 ++-
docs/Client.js.html | 57 ++--
docs/ClientInfo.html | 15 +-
docs/Contact.html | 6 +-
docs/GroupChat.html | 24 +-
docs/GroupNotification.html | 6 +-
docs/InterfaceController.html | 6 +-
docs/Label.html | 6 +-
docs/List.html | 6 +-
docs/Location.html | 6 +-
docs/Message.html | 20 +-
docs/MessageMedia.html | 6 +-
docs/Order.html | 6 +-
docs/PrivateChat.html | 9 +-
docs/PrivateContact.html | 6 +-
docs/Product.html | 6 +-
docs/Util.html | 15 +-
docs/global.html | 341 +++++++++++++++++++++-
docs/index.html | 116 +++++++-
docs/structures_Base.js.html | 6 +-
docs/structures_BusinessContact.js.html | 6 +-
docs/structures_Buttons.js.html | 28 +-
docs/structures_Call.js.html | 6 +-
docs/structures_Chat.js.html | 34 ++-
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 | 14 +-
docs/structures_MessageMedia.js.html | 6 +-
docs/structures_Order.js.html | 6 +-
docs/structures_Payment.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/util_Constants.js.html | 25 +-
docs/util_InterfaceController.js.html | 6 +-
docs/util_Util.js.html | 6 +-
package.json | 2 +-
48 files changed, 743 insertions(+), 228 deletions(-)
diff --git a/docs/Base.html b/docs/Base.html
index f82b9d5..53e96d3 100644
--- a/docs/Base.html
+++ b/docs/Base.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Base
+ whatsapp-web.js 1.15.5 » Class: Base
@@ -15,7 +15,7 @@
@@ -50,7 +50,7 @@
diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html
index 35359d5..27444b8 100644
--- a/docs/BusinessContact.html
+++ b/docs/BusinessContact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: BusinessContact
+ whatsapp-web.js 1.15.5 » Class: BusinessContact
@@ -15,7 +15,7 @@
@@ -314,7 +314,7 @@
diff --git a/docs/Buttons.html b/docs/Buttons.html
index 185feb7..782fd95 100644
--- a/docs/Buttons.html
+++ b/docs/Buttons.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Buttons
+ whatsapp-web.js 1.15.5 » Class: Buttons
@@ -15,7 +15,7 @@
@@ -26,7 +26,7 @@
@@ -424,7 +426,8 @@
Returns
- Promise containing Message
Message that was just sent
+ Promise containing Message
+
Message that was just sent
@@ -434,7 +437,8 @@
Returns
- Promise containing Boolean
result
+ Promise containing Boolean
+
result
@@ -464,7 +468,8 @@
Returns
- Promise containing boolean
New pin state
+ Promise containing boolean
+
New pin state
@@ -478,7 +483,7 @@
diff --git a/docs/Client.html b/docs/Client.html
index 59c8448..377d2a5 100644
--- a/docs/Client.html
+++ b/docs/Client.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Client
+ whatsapp-web.js 1.15.5 » Class: Client
@@ -15,7 +15,7 @@
@@ -617,7 +617,8 @@
Returns
- Promise containing string
Id of the joined Chat
+ Promise containing string
+
Id of the joined Chat
@@ -679,15 +680,18 @@
Returns
- Object
createRes
+ Object
+
createRes
- string
createRes.gid - ID for the group that was just created
+ string
+
createRes.gid - ID for the group that was just created
- Object with string properties
createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.
+ Object with string properties
+
createRes.missingParticipants - participants that were not added to the group. Keys represent the ID for participant that was not added and its value is a status code that represents the reason why participant could not be added. This is usually 403 if the user's privacy settings don't allow you to add them to groups.
@@ -981,7 +985,8 @@
Returns
- Promise containing object
Invite information
+ Promise containing object
+
Invite information
@@ -1263,7 +1268,8 @@
Returns
- Promise containing boolean
New pin state. Could be false if the max number of pinned chats was reached.
+ Promise containing boolean
+
New pin state. Could be false if the max number of pinned chats was reached.
@@ -1435,7 +1441,8 @@
Returns
- Promise containing Message
Message that was just sent
+ Promise containing Message
+
Message that was just sent
@@ -1478,7 +1485,8 @@
Returns
- Promise containing boolean
result
+ Promise containing boolean
+
result
@@ -1600,7 +1608,8 @@
Returns
- Promise containing boolean
New pin state
+ Promise containing boolean
+
New pin state
@@ -2407,7 +2416,7 @@
diff --git a/docs/Client.js.html b/docs/Client.js.html
index 0380311..af18091 100644
--- a/docs/Client.js.html
+++ b/docs/Client.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: Client.js
+ whatsapp-web.js 1.15.5 » Source: Client.js
@@ -15,7 +15,7 @@
@@ -107,7 +107,7 @@ class Client extends EventEmitter {
page = (await browser.pages())[0];
}
- page.setUserAgent(this.options.userAgent);
+ await page.setUserAgent(this.options.userAgent);
this.pupBrowser = browser;
this.pupPage = page;
@@ -140,7 +140,7 @@ class Client extends EventEmitter {
const KEEP_PHONE_CONNECTED_IMG_SELECTOR = '[data-icon="intro-md-beta-logo-dark"], [data-icon="intro-md-beta-logo-light"], [data-asset-intro-image-light="true"], [data-asset-intro-image-dark="true"]';
if (this.options.session) {
- // Check if session restore was successfull
+ // Check if session restore was successful
try {
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs });
} catch (err) {
@@ -199,10 +199,22 @@ class Client extends EventEmitter {
this._qrRefreshInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs);
// Wait for code scan
- await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
- clearInterval(this._qrRefreshInterval);
- this._qrRefreshInterval = undefined;
+ try {
+ await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 });
+ clearInterval(this._qrRefreshInterval);
+ this._qrRefreshInterval = undefined;
+ } catch(error) {
+ if (
+ error.name === 'ProtocolError' &&
+ error.message &&
+ error.message.match(/Target closed/)
+ ) {
+ // something has called .destroy() while waiting
+ return;
+ }
+ throw error;
+ }
}
await page.evaluate(ExposeStore, moduleRaid.toString());
@@ -258,8 +270,6 @@ class Client extends EventEmitter {
// Register events
await page.exposeFunction('onAddMessageEvent', msg => {
- if (!msg.isNewMsg) return;
-
if (msg.type === 'gp2') {
const notification = new GroupNotification(this, msg);
if (msg.subtype === 'add' || msg.subtype === 'invite') {
@@ -444,7 +454,6 @@ class Client extends EventEmitter {
});
await page.evaluate(() => {
- window.Store.Msg.on('add', (msg) => { if (msg.isNewMsg) window.onAddMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change:type', (msg) => { window.onChangeMessageTypeEvent(window.WWebJS.getMessageModel(msg)); });
window.Store.Msg.on('change:ack', (msg,ack) => { window.onMessageAckEvent(window.WWebJS.getMessageModel(msg), ack); });
@@ -453,6 +462,16 @@ class Client extends EventEmitter {
window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); });
window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); });
window.Store.Call.on('add', (call) => { window.onIncomingCall(call); });
+ window.Store.Msg.on('add', (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.WWebJS.getMessageModel(_msg)));
+ } else {
+ window.onAddMessageEvent(window.WWebJS.getMessageModel(msg));
+ }
+ }
+ });
});
/**
@@ -461,11 +480,13 @@ class Client extends EventEmitter {
*/
this.emit(Events.READY);
- // Disconnect when navigating away
- // Because WhatsApp Web now reloads when logging out from the device, this also covers that case
+ // Disconnect when navigating away when in PAIRING state (detect logout)
this.pupPage.on('framenavigated', async () => {
- this.emit(Events.DISCONNECTED, 'NAVIGATION');
- await this.destroy();
+ const appState = await this.getState();
+ if(appState === WAState.PAIRING) {
+ this.emit(Events.DISCONNECTED, 'NAVIGATION');
+ await this.destroy();
+ }
});
}
@@ -550,7 +571,7 @@ class Client extends EventEmitter {
quotedMessageId: options.quotedMessageId,
parseVCards: options.parseVCards === false ? false : true,
mentionedJidList: Array.isArray(options.mentions) ? options.mentions.map(contact => contact.id._serialized) : [],
- ...options.extra
+ extraOptions: options.extra
};
const sendSeen = typeof options.sendSeen === 'undefined' ? true : options.sendSeen;
@@ -758,7 +779,7 @@ class Client extends EventEmitter {
return await this.pupPage.evaluate(async chatId => {
let chat = await window.Store.Chat.get(chatId);
await window.Store.Cmd.archiveChat(chat, true);
- return chat.archive;
+ return true;
}, chatId);
}
@@ -770,7 +791,7 @@ class Client extends EventEmitter {
return await this.pupPage.evaluate(async chatId => {
let chat = await window.Store.Chat.get(chatId);
await window.Store.Cmd.archiveChat(chat, false);
- return chat.archive;
+ return false;
}, chatId);
}
@@ -1044,7 +1065,7 @@ module.exports = Client;
diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html
index acfbe0a..ebd3915 100644
--- a/docs/ClientInfo.html
+++ b/docs/ClientInfo.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: ClientInfo
+ whatsapp-web.js 1.15.5 » Class: ClientInfo
@@ -15,7 +15,7 @@
@@ -213,15 +213,18 @@
Returns
- object
batteryStatus
+ object
+
batteryStatus
- number
batteryStatus.battery - The current battery percentage
+ number
+
batteryStatus.battery - The current battery percentage
- boolean
batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
+ boolean
+
batteryStatus.plugged - Indicates if the phone is plugged in (true) or not (false)
@@ -235,7 +238,7 @@
diff --git a/docs/Contact.html b/docs/Contact.html
index 0230a6c..fefc8a4 100644
--- a/docs/Contact.html
+++ b/docs/Contact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Contact
+ whatsapp-web.js 1.15.5 » Class: Contact
@@ -15,7 +15,7 @@
@@ -281,7 +281,7 @@
diff --git a/docs/GroupChat.html b/docs/GroupChat.html
index 632c96b..77840d8 100644
--- a/docs/GroupChat.html
+++ b/docs/GroupChat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: GroupChat
+ whatsapp-web.js 1.15.5 » Class: GroupChat
@@ -15,7 +15,7 @@
@@ -405,7 +405,8 @@
Returns
- Promise containing {status: number}
Object with status code indicating if the operation was successful
+ Promise containing {status: number}
+
Object with status code indicating if the operation was successful
@@ -458,8 +459,7 @@
Yes
- The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
- Defaults to 50.
+ The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
@@ -490,7 +490,8 @@
Returns
- Promise containing string
Group's invite code
+ Promise containing string
+
Group's invite code
@@ -601,7 +602,8 @@
Returns
- Promise containing {status: number}
Object with status code indicating if the operation was successful
+ Promise containing {status: number}
+
Object with status code indicating if the operation was successful
@@ -801,7 +803,8 @@
Returns
- Promise containing boolean
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
+ Promise containing boolean
+
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
@@ -841,7 +844,8 @@
Returns
- Promise containing boolean
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
+ Promise containing boolean
+
Returns true if the setting was properly updated. This can return false if the user does not have the necessary permissions.
@@ -917,7 +921,7 @@
diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html
index 1b3e807..014b483 100644
--- a/docs/GroupNotification.html
+++ b/docs/GroupNotification.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: GroupNotification
+ whatsapp-web.js 1.15.5 » Class: GroupNotification
@@ -15,7 +15,7 @@
@@ -233,7 +233,7 @@
diff --git a/docs/InterfaceController.html b/docs/InterfaceController.html
index 70d7fe2..16ef127 100644
--- a/docs/InterfaceController.html
+++ b/docs/InterfaceController.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: InterfaceController
+ whatsapp-web.js 1.15.5 » Class: InterfaceController
@@ -15,7 +15,7 @@
@@ -382,7 +382,7 @@
diff --git a/docs/Label.html b/docs/Label.html
index 31e1df1..8393b50 100644
--- a/docs/Label.html
+++ b/docs/Label.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Label
+ whatsapp-web.js 1.15.5 » Class: Label
@@ -15,7 +15,7 @@
@@ -163,7 +163,7 @@
diff --git a/docs/List.html b/docs/List.html
index bfbc4d6..2e26fb1 100644
--- a/docs/List.html
+++ b/docs/List.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: List
+ whatsapp-web.js 1.15.5 » Class: List
@@ -15,7 +15,7 @@
@@ -256,7 +256,7 @@ Returns: [{'title':'sectionTitle','rows':[{'r
diff --git a/docs/Location.html b/docs/Location.html
index 97d1cb2..1c7447b 100644
--- a/docs/Location.html
+++ b/docs/Location.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Location
+ whatsapp-web.js 1.15.5 » Class: Location
@@ -15,7 +15,7 @@
@@ -149,7 +149,7 @@
diff --git a/docs/Message.html b/docs/Message.html
index e9c746b..72da777 100644
--- a/docs/Message.html
+++ b/docs/Message.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Message
+ whatsapp-web.js 1.15.5 » Class: Message
@@ -15,7 +15,7 @@
@@ -79,6 +79,9 @@
inviteV4
+ isEphemeral
+
+
isForwarded
@@ -94,13 +97,13 @@
links
- location
-
-
+ location
+
+
mediaKey
@@ -260,6 +263,11 @@
Group Invite Data
+ isEphemeral
+ boolean
+ Indicates if the message will disappear after it expires
+
+
isForwarded
boolean
Indicates if the message was forwarded
@@ -572,7 +580,7 @@
diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html
index 6bab41c..c8e2222 100644
--- a/docs/MessageMedia.html
+++ b/docs/MessageMedia.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: MessageMedia
+ whatsapp-web.js 1.15.5 » Class: MessageMedia
@@ -15,7 +15,7 @@
@@ -343,7 +343,7 @@
diff --git a/docs/Order.html b/docs/Order.html
index ba94b62..1286a62 100644
--- a/docs/Order.html
+++ b/docs/Order.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Order
+ whatsapp-web.js 1.15.5 » Class: Order
@@ -15,7 +15,7 @@
@@ -102,7 +102,7 @@
diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html
index 0c133cc..f7fd2bc 100644
--- a/docs/PrivateChat.html
+++ b/docs/PrivateChat.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: PrivateChat
+ whatsapp-web.js 1.15.5 » Class: PrivateChat
@@ -15,7 +15,7 @@
@@ -318,8 +318,7 @@
Yes
- The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
- Defaults to 50.
+ The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
@@ -520,7 +519,7 @@
diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html
index bfb5bbf..b43118f 100644
--- a/docs/PrivateContact.html
+++ b/docs/PrivateContact.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: PrivateContact
+ whatsapp-web.js 1.15.5 » Class: PrivateContact
@@ -15,7 +15,7 @@
@@ -307,7 +307,7 @@
diff --git a/docs/Product.html b/docs/Product.html
index d8847d7..8cc011b 100644
--- a/docs/Product.html
+++ b/docs/Product.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Product
+ whatsapp-web.js 1.15.5 » Class: Product
@@ -15,7 +15,7 @@
@@ -127,7 +127,7 @@
diff --git a/docs/Util.html b/docs/Util.html
index 06fac76..03f11e2 100644
--- a/docs/Util.html
+++ b/docs/Util.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Class: Util
+ whatsapp-web.js 1.15.5 » Class: Util
@@ -15,7 +15,7 @@
@@ -104,7 +104,8 @@
Returns
- Promise containing MessageMedia
media in webp format
+ Promise containing MessageMedia
+
media in webp format
@@ -155,7 +156,8 @@
Returns
- Promise containing MessageMedia
media in webp format
+ Promise containing MessageMedia
+
media in webp format
@@ -193,7 +195,8 @@
Returns
- Promise containing MessageMedia
media in webp format
+ Promise containing MessageMedia
+
media in webp format
@@ -240,7 +243,7 @@
diff --git a/docs/global.html b/docs/global.html
index 7e20759..dd44936 100644
--- a/docs/global.html
+++ b/docs/global.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Globals
+ whatsapp-web.js 1.15.5 » Globals
@@ -15,7 +15,7 @@
@@ -68,16 +68,22 @@
+ GroupParticipant
+
+
MessageInfo
@@ -862,6 +868,19 @@
+
+
+ LIST_RESPONSE
+
+
+
+
+
+
+
+
+
+
BUTTONS_RESPONSE
@@ -888,6 +907,214 @@
+
+
+ BROADCAST_NOTIFICATION
+
+
+
+
+
+
+
+
+
+
+
+
+ CALL_LOG
+
+
+
+
+
+
+
+
+
+
+
+
+ CIPHERTEXT
+
+
+
+
+
+
+
+
+
+
+
+
+ DEBUG
+
+
+
+
+
+
+
+
+
+
+
+
+ E2E_NOTIFICATION
+
+
+
+
+
+
+
+
+
+
+
+
+ GP2
+
+
+
+
+
+
+
+
+
+
+
+
+ GROUP_NOTIFICATION
+
+
+
+
+
+
+
+
+
+
+
+
+ HSM
+
+
+
+
+
+
+
+
+
+
+
+
+ INTERACTIVE
+
+
+
+
+
+
+
+
+
+
+
+
+ NATIVE_FLOW
+
+
+
+
+
+
+
+
+
+
+
+
+ NOTIFICATION
+
+
+
+
+
+
+
+
+
+
+
+
+ NOTIFICATION_TEMPLATE
+
+
+
+
+
+
+
+
+
+
+
+
+ OVERSIZED
+
+
+
+
+
+
+
+
+
+
+
+
+ PROTOCOL
+
+
+
+
+
+
+
+
+
+
+
+
+ REACTION
+
+
+
+
+
+
+
+
+
+
+
+
+ TEMPLATE_BUTTON_REPLY
+
+
+
+
+
+
+
+
+
+
@@ -1133,6 +1360,54 @@
Abstract types
+
+ Button spec used in Buttons constructor
+
+ Properties
+
+
+
+ Name
+ Type
+ Optional
+ Description
+
+
+
+
+
+ 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.
+
+
+
+
+
+
+
ID that represents a contact
@@ -1192,6 +1467,64 @@
+
+
+ Properties
+
+
+
+ Name
+ Type
+ Optional
+ Description
+
+
+
+
+
+ buttonId
+
+
+ string
+
+
+
+
+
+
+
+
+
+ type
+
+
+ number
+
+
+
+
+
+
+
+
+
+ buttonText
+
+
+ Object
+
+
+
+
+
+
+
+
+
+
+
+
GroupParticipant
Object
Group participant information
@@ -1647,7 +1980,7 @@
diff --git a/docs/index.html b/docs/index.html
index ae60120..00df7b1 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Home
+ whatsapp-web.js 1.15.5 » Home
@@ -15,7 +15,7 @@
@@ -27,11 +27,11 @@
+
-
+
-
-
+
+ MessageTypes.PROTOCOL
+
+
+
+
+ MessageTypes.REACTION
+
+
+
MessageTypes.REVOKED
@@ -2266,6 +2351,11 @@ client.initialize();
+
+ MessageTypes.TEMPLATE_BUTTON_REPLY
+
+
+
MessageTypes.TEXT
@@ -2941,7 +3031,7 @@ client.initialize();
diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html
index 1734407..49d7a9c 100644
--- a/docs/structures_Base.js.html
+++ b/docs/structures_Base.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Base.js
+ whatsapp-web.js 1.15.5 » Source: structures/Base.js
@@ -15,7 +15,7 @@
@@ -60,7 +60,7 @@ module.exports = Base;
diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html
index 0107e07..f857e70 100644
--- a/docs/structures_BusinessContact.js.html
+++ b/docs/structures_BusinessContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/BusinessContact.js
+ whatsapp-web.js 1.15.5 » Source: structures/BusinessContact.js
@@ -15,7 +15,7 @@
@@ -59,7 +59,7 @@ module.exports = BusinessContact;
diff --git a/docs/structures_Buttons.js.html b/docs/structures_Buttons.js.html
index 1cd7a29..603fa19 100644
--- a/docs/structures_Buttons.js.html
+++ b/docs/structures_Buttons.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Buttons.js
+ whatsapp-web.js 1.15.5 » Source: structures/Buttons.js
@@ -15,7 +15,7 @@
@@ -34,13 +34,27 @@
const MessageMedia = require('./MessageMedia');
const Util = require('../util/Util');
+/**
+ * Button spec used in Buttons constructor
+ * @typedef {Object} ButtonSpec
+ * @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
+ * @property {string} body - The text to show on the button.
+ */
+
+/**
+ * @typedef {Object} FormattedButtonSpec
+ * @property {string} buttonId
+ * @property {number} type
+ * @property {Object} buttonText
+ */
+
/**
* Message type buttons
*/
class Buttons {
/**
* @param {string|MessageMedia} body
- * @param {Array<Array<string>>} buttons
+ * @param {ButtonSpec[]} buttons - See {@link ButtonSpec}
* @param {string?} title
* @param {string?} footer
*/
@@ -72,7 +86,7 @@ class Buttons {
/**
* buttons of message
- * @type {Array<Array<string>>}
+ * @type {FormattedButtonSpec[]}
*/
this.buttons = this._format(buttons);
if(!this.buttons.length){ throw '[BT01] No buttons';}
@@ -81,8 +95,8 @@ class Buttons {
/**
* Creates button array from simple array
- * @param {Array<Array<string>>} buttons
- * @returns {Array<Array<string>>}
+ * @param {ButtonSpec[]} buttons
+ * @returns {FormattedButtonSpec[]}
* @example
* Input: [{id:'customId',body:'button1'},{body:'button2'},{body:'button3'},{body:'button4'}]
* Returns: [{ buttonId:'customId',buttonText:{'displayText':'button1'},type: 1 },{buttonId:'n3XKsL',buttonText:{'displayText':'button2'},type:1},{buttonId:'NDJk0a',buttonText:{'displayText':'button3'},type:1}]
@@ -106,7 +120,7 @@ module.exports = Buttons;
diff --git a/docs/structures_Call.js.html b/docs/structures_Call.js.html
index d3e4b3b..0169422 100644
--- a/docs/structures_Call.js.html
+++ b/docs/structures_Call.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Call.js
+ whatsapp-web.js 1.15.5 » Source: structures/Call.js
@@ -15,7 +15,7 @@
@@ -106,7 +106,7 @@ module.exports = Call;
diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html
index f02e790..1bd0a93 100644
--- a/docs/structures_Chat.js.html
+++ b/docs/structures_Chat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Chat.js
+ whatsapp-web.js 1.15.5 » Source: structures/Chat.js
@@ -15,7 +15,7 @@
@@ -96,7 +96,7 @@ class Chat extends Base {
/**
* Indicates if the chat is muted or not
- * @type {number}
+ * @type {boolean}
*/
this.isMuted = data.isMuted;
@@ -202,30 +202,32 @@ class Chat extends Base {
/**
* Loads chat messages, sorted from earliest to latest.
* @param {Object} searchOptions Options for searching messages. Right now only limit is supported.
- * @param {Number} [searchOptions.limit=50] The amount of messages to return. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
+ * @param {Number} [searchOptions.limit] The amount of messages to return. If no limit is specified, the available messages will be returned. Note that the actual number of returned messages may be smaller if there aren't enough messages in the conversation. Set this to Infinity to load all messages.
* @returns {Promise<Array<Message>>}
*/
async fetchMessages(searchOptions) {
- if (!searchOptions || !searchOptions.limit) {
- searchOptions = { limit: 50 };
- }
- let messages = await this.client.pupPage.evaluate(async (chatId, limit) => {
+ let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
const msgFilter = m => !m.isNotification; // dont include notification messages
const chat = window.Store.Chat.get(chatId);
let msgs = chat.msgs.models.filter(msgFilter);
- while (msgs.length < limit) {
- const loadedMessages = await chat.loadEarlierMsgs();
- if (!loadedMessages) break;
- msgs = [...loadedMessages.filter(msgFilter), ...msgs];
+ if (searchOptions && searchOptions.limit > 0) {
+ while (msgs.length < searchOptions.limit) {
+ const loadedMessages = await chat.loadEarlierMsgs();
+ if (!loadedMessages) break;
+ msgs = [...loadedMessages.filter(msgFilter), ...msgs];
+ }
+
+ if (msgs.length > searchOptions.limit) {
+ msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
+ msgs = msgs.splice(msgs.length - searchOptions.limit);
+ }
}
- msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
- if (msgs.length > limit) msgs = msgs.splice(msgs.length - limit);
return msgs.map(m => window.WWebJS.getMessageModel(m));
- }, this.id._serialized, searchOptions.limit);
+ }, this.id._serialized, searchOptions);
return messages.map(m => new Message(this.client, m));
}
@@ -288,7 +290,7 @@ module.exports = Chat;
diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html
index 152d87e..27594ea 100644
--- a/docs/structures_ClientInfo.js.html
+++ b/docs/structures_ClientInfo.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/ClientInfo.js
+ whatsapp-web.js 1.15.5 » Source: structures/ClientInfo.js
@@ -15,7 +15,7 @@
@@ -108,7 +108,7 @@ module.exports = ClientInfo;
diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html
index 7b3f383..203c3ea 100644
--- a/docs/structures_Contact.js.html
+++ b/docs/structures_Contact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Contact.js
+ whatsapp-web.js 1.15.5 » Source: structures/Contact.js
@@ -15,7 +15,7 @@
@@ -236,7 +236,7 @@ module.exports = Contact;
diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html
index 3b25141..94e206f 100644
--- a/docs/structures_GroupChat.js.html
+++ b/docs/structures_GroupChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/GroupChat.js
+ whatsapp-web.js 1.15.5 » Source: structures/GroupChat.js
@@ -15,7 +15,7 @@
@@ -239,7 +239,7 @@ module.exports = GroupChat;
diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html
index 7eae0cf..0911156 100644
--- a/docs/structures_GroupNotification.js.html
+++ b/docs/structures_GroupNotification.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/GroupNotification.js
+ whatsapp-web.js 1.15.5 » Source: structures/GroupNotification.js
@@ -15,7 +15,7 @@
@@ -143,7 +143,7 @@ module.exports = GroupNotification;
diff --git a/docs/structures_Label.js.html b/docs/structures_Label.js.html
index b4e3a2a..223cc7a 100644
--- a/docs/structures_Label.js.html
+++ b/docs/structures_Label.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Label.js
+ whatsapp-web.js 1.15.5 » Source: structures/Label.js
@@ -15,7 +15,7 @@
@@ -88,7 +88,7 @@ module.exports = Label;
diff --git a/docs/structures_List.js.html b/docs/structures_List.js.html
index 7ec83c2..dfbdb35 100644
--- a/docs/structures_List.js.html
+++ b/docs/structures_List.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/List.js
+ whatsapp-web.js 1.15.5 » Source: structures/List.js
@@ -15,7 +15,7 @@
@@ -118,7 +118,7 @@ module.exports = List;
diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html
index 8f3baed..9479935 100644
--- a/docs/structures_Location.js.html
+++ b/docs/structures_Location.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Location.js
+ whatsapp-web.js 1.15.5 » Source: structures/Location.js
@@ -15,7 +15,7 @@
@@ -71,7 +71,7 @@ module.exports = Location;
diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html
index 01057f0..d25e780 100644
--- a/docs/structures_Message.js.html
+++ b/docs/structures_Message.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Message.js
+ whatsapp-web.js 1.15.5 » Source: structures/Message.js
@@ -15,7 +15,7 @@
@@ -216,6 +216,12 @@ class Message extends Base {
*/
this.isGif = Boolean(data.isGif);
+ /**
+ * Indicates if the message will disappear after it expires
+ * @type {boolean}
+ */
+ this.isEphemeral = data.isEphemeral;
+
/** Title */
if (data.title) {
this.title = data.title;
@@ -413,7 +419,7 @@ class Message extends Base {
await this.client.pupPage.evaluate((msgId, everyone) => {
let msg = window.Store.Msg.get(msgId);
- if (everyone && msg.id.fromMe && msg.canRevoke()) {
+ if (everyone && msg.id.fromMe && msg._canRevoke()) {
return window.Store.Cmd.sendRevokeMsgs(msg.chat, [msg], true);
}
@@ -519,7 +525,7 @@ module.exports = Message;
diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html
index ca61004..1c20f5a 100644
--- a/docs/structures_MessageMedia.js.html
+++ b/docs/structures_MessageMedia.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/MessageMedia.js
+ whatsapp-web.js 1.15.5 » Source: structures/MessageMedia.js
@@ -15,7 +15,7 @@
@@ -142,7 +142,7 @@ module.exports = MessageMedia;
diff --git a/docs/structures_Order.js.html b/docs/structures_Order.js.html
index 75524f3..b6f6fd7 100644
--- a/docs/structures_Order.js.html
+++ b/docs/structures_Order.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Order.js
+ whatsapp-web.js 1.15.5 » Source: structures/Order.js
@@ -15,7 +15,7 @@
@@ -90,7 +90,7 @@ module.exports = Order;
diff --git a/docs/structures_Payment.js.html b/docs/structures_Payment.js.html
index 589f606..c5a8dcc 100644
--- a/docs/structures_Payment.js.html
+++ b/docs/structures_Payment.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Payment.js
+ whatsapp-web.js 1.15.5 » Source: structures/Payment.js
@@ -15,7 +15,7 @@
@@ -118,7 +118,7 @@ module.exports = Payment;
diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html
index dea4e78..b651081 100644
--- a/docs/structures_PrivateChat.js.html
+++ b/docs/structures_PrivateChat.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/PrivateChat.js
+ whatsapp-web.js 1.15.5 » Source: structures/PrivateChat.js
@@ -15,7 +15,7 @@
@@ -51,7 +51,7 @@ module.exports = PrivateChat;
diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html
index 82e09c8..c5c5519 100644
--- a/docs/structures_PrivateContact.js.html
+++ b/docs/structures_PrivateContact.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/PrivateContact.js
+ whatsapp-web.js 1.15.5 » Source: structures/PrivateContact.js
@@ -15,7 +15,7 @@
@@ -51,7 +51,7 @@ module.exports = PrivateContact;
diff --git a/docs/structures_Product.js.html b/docs/structures_Product.js.html
index 469726f..c0cd2d4 100644
--- a/docs/structures_Product.js.html
+++ b/docs/structures_Product.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/Product.js
+ whatsapp-web.js 1.15.5 » Source: structures/Product.js
@@ -15,7 +15,7 @@
@@ -106,7 +106,7 @@ module.exports = Product;
diff --git a/docs/structures_ProductMetadata.js.html b/docs/structures_ProductMetadata.js.html
index 2f0ab6b..ed19db0 100644
--- a/docs/structures_ProductMetadata.js.html
+++ b/docs/structures_ProductMetadata.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: structures/ProductMetadata.js
+ whatsapp-web.js 1.15.5 » Source: structures/ProductMetadata.js
@@ -15,7 +15,7 @@
@@ -63,7 +63,7 @@ module.exports = ProductMetadata;
diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html
index f6dd416..1d8d37d 100644
--- a/docs/util_Constants.js.html
+++ b/docs/util_Constants.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: util/Constants.js
+ whatsapp-web.js 1.15.5 » Source: util/Constants.js
@@ -15,7 +15,7 @@
@@ -108,8 +108,25 @@ exports.MessageTypes = {
UNKNOWN: 'unknown',
GROUP_INVITE: 'groups_v4_invite',
LIST: 'list',
+ LIST_RESPONSE: 'list_response',
BUTTONS_RESPONSE: 'buttons_response',
- PAYMENT: 'payment'
+ PAYMENT: 'payment',
+ BROADCAST_NOTIFICATION: 'broadcast_notification',
+ CALL_LOG: 'call_log',
+ CIPHERTEXT: 'ciphertext',
+ DEBUG: 'debug',
+ E2E_NOTIFICATION: 'e2e_notification',
+ GP2: 'gp2',
+ GROUP_NOTIFICATION: 'group_notification',
+ HSM: 'hsm',
+ INTERACTIVE: 'interactive',
+ NATIVE_FLOW: 'native_flow',
+ NOTIFICATION: 'notification',
+ NOTIFICATION_TEMPLATE: 'notification_template',
+ OVERSIZED: 'oversized',
+ PROTOCOL: 'protocol',
+ REACTION: 'reaction',
+ TEMPLATE_BUTTON_REPLY: 'template_button_reply',
};
/**
@@ -183,7 +200,7 @@ exports.MessageAck = {
diff --git a/docs/util_InterfaceController.js.html b/docs/util_InterfaceController.js.html
index fbbe312..81233f6 100644
--- a/docs/util_InterfaceController.js.html
+++ b/docs/util_InterfaceController.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: util/InterfaceController.js
+ whatsapp-web.js 1.15.5 » Source: util/InterfaceController.js
@@ -15,7 +15,7 @@
@@ -160,7 +160,7 @@ module.exports = InterfaceController;
diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html
index dae5c54..4edf4c1 100644
--- a/docs/util_Util.js.html
+++ b/docs/util_Util.js.html
@@ -4,7 +4,7 @@
- whatsapp-web.js 1.15.4 » Source: util/Util.js
+ whatsapp-web.js 1.15.5 » Source: util/Util.js
@@ -15,7 +15,7 @@
@@ -242,7 +242,7 @@ module.exports = Util;
diff --git a/package.json b/package.json
index 4d9331f..f325999 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "whatsapp-web.js",
- "version": "1.15.4",
+ "version": "1.15.5",
"description": "Library for interacting with the WhatsApp Web API ",
"main": "./index.js",
"typings": "./index.d.ts",