From 3cbf1e9c2fc37a90dc3fc9c9648814e37e2aa2fd Mon Sep 17 00:00:00 2001 From: Pedro Lopez Date: Sun, 5 Apr 2020 23:39:22 -0400 Subject: [PATCH] chore: mark version v1.4.0 --- docs/Base.html | 6 +- docs/BusinessContact.html | 6 +- docs/Chat.html | 6 +- docs/Client.html | 161 ++++++++++++++++++++-- docs/Client.js.html | 73 ++++++++-- docs/ClientInfo.html | 6 +- docs/Contact.html | 6 +- docs/GroupChat.html | 6 +- docs/GroupNotification.html | 6 +- docs/Location.html | 6 +- docs/Message.html | 6 +- docs/MessageMedia.html | 6 +- docs/PrivateChat.html | 6 +- docs/PrivateContact.html | 6 +- docs/Util.html | 6 +- docs/global.html | 19 ++- docs/index.html | 47 ++++--- docs/structures_Base.js.html | 6 +- docs/structures_BusinessContact.js.html | 6 +- docs/structures_Chat.js.html | 6 +- docs/structures_ClientInfo.js.html | 6 +- docs/structures_Contact.js.html | 6 +- docs/structures_GroupChat.js.html | 6 +- docs/structures_GroupNotification.js.html | 8 +- docs/structures_Location.js.html | 6 +- docs/structures_Message.js.html | 6 +- docs/structures_MessageMedia.js.html | 6 +- docs/structures_PrivateChat.js.html | 6 +- docs/structures_PrivateContact.js.html | 6 +- docs/util_Constants.js.html | 12 +- docs/util_Util.js.html | 6 +- package.json | 2 +- 32 files changed, 349 insertions(+), 123 deletions(-) diff --git a/docs/Base.html b/docs/Base.html index 569cb25..ff9ef3d 100644 --- a/docs/Base.html +++ b/docs/Base.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Base + whatsapp-web.js 1.4.0 » Class: Base @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -50,7 +50,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/BusinessContact.html b/docs/BusinessContact.html index 95c5032..4aa1b9e 100644 --- a/docs/BusinessContact.html +++ b/docs/BusinessContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: BusinessContact + whatsapp-web.js 1.4.0 » Class: BusinessContact @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -227,7 +227,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Chat.html b/docs/Chat.html index 862c6aa..8fa57e7 100644 --- a/docs/Chat.html +++ b/docs/Chat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Chat + whatsapp-web.js 1.4.0 » Class: Chat @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -350,7 +350,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Client.html b/docs/Client.html index eba7f9c..8aa8100 100644 --- a/docs/Client.html +++ b/docs/Client.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Client + whatsapp-web.js 1.4.0 » Class: Client @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -26,7 +26,7 @@
class

Client

-

Source: Client.js:34

+

Source: Client.js:35

Starting point for interacting with the WhatsApp Web API

@@ -45,6 +45,9 @@
archiveChat()
+
createGroup(name, participants)
+
+
destroy()
@@ -73,13 +76,13 @@
isRegisteredUser()
+
resetState()
+
+
-
resetState()
-
-
sendMessage(chatId, content, options)
@@ -107,6 +110,9 @@
authenticated
+
change_battery
+
+
change_state
@@ -135,13 +141,13 @@
message_ack
+
message_create
+
+
-
message_create
-
-
message_revoke_everyone
@@ -180,6 +186,7 @@
Client#event:group_update
Client#event:disconnected
Client#event:change_state
+
Client#event:change_battery
@@ -229,6 +236,67 @@
async
+

createGroup(name, participants) → (Object, string, or Object with string properties)

+

Create a new group

+
+

Parameters

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

name

+
+

string

+
+

 

+
+

group title

+
+

participants

+
+

Array of (Contact or string)

+
+

 

+
+

an array of Contacts or contact IDs to add to the group

+
+
+
+
Returns
+
+

Object 

createRes

+

+
+
+

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.

+

+
+
+
async

destroy()

Closes the client

@@ -566,6 +634,79 @@
+

change_battery

+

Emitted when the battery percentage for the attached device changes

+
+

Parameters

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

batteryInfo

+
+

object

+
+

 

+
+

Values in batteryInfo have the following properties:

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

battery

+
+

number

+
+

 

+
+

The current battery percentage

+
+

plugged

+
+

boolean

+
+

 

+
+

Indicates if the phone is plugged in (true) or not (false)

+
+
+
+
+

change_state

Emitted when the connection state changes

@@ -1006,7 +1147,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Client.js.html b/docs/Client.js.html index 7ea8371..9403030 100644 --- a/docs/Client.js.html +++ b/docs/Client.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: Client.js + whatsapp-web.js 1.4.0 » Source: Client.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -41,7 +41,7 @@ const { WhatsWebURL, UserAgent, DefaultOptions, Events, WAState } = require const { ExposeStore, LoadUtils } = require('./util/Injected'); const ChatFactory = require('./factories/ChatFactory'); const ContactFactory = require('./factories/ContactFactory'); -const { ClientInfo, Message, MessageMedia, Location, GroupNotification } = require('./structures'); +const { ClientInfo, Message, MessageMedia, Contact, Location, GroupNotification } = require('./structures'); /** * Starting point for interacting with the WhatsApp Web API * @extends {EventEmitter} @@ -60,6 +60,7 @@ const { ClientInfo, Message, MessageMedia, Location, GroupNotification } = * @fires Client#group_update * @fires Client#disconnected * @fires Client#change_state + * @fires Client#change_battery */ class Client extends EventEmitter { constructor(options = {}) { @@ -79,6 +80,9 @@ class Client extends EventEmitter { const page = (await browser.pages())[0]; page.setUserAgent(UserAgent); + this.pupBrowser = browser; + this.pupPage = page; + if (this.options.session) { await page.evaluateOnNewDocument( session => { @@ -97,7 +101,7 @@ class Client extends EventEmitter { if (this.options.session) { // Check if session restore was successfull try { - await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 45000 }); + await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: this.options.authTimeoutMs }); } catch (err) { if (err.name === 'TimeoutError') { /** @@ -130,7 +134,7 @@ class Client extends EventEmitter { // Wait for QR Code const QR_CANVAS_SELECTOR = 'canvas'; - await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: 45000 }); + await page.waitForSelector(QR_CANVAS_SELECTOR, { timeout: this.options.qrTimeoutMs }); const qrImgData = await page.$eval(QR_CANVAS_SELECTOR, canvas => [].slice.call(canvas.getContext('2d').getImageData(0, 0, 264, 264).data)); const qr = jsQR(qrImgData, 264, 264).data; /** @@ -141,7 +145,7 @@ class Client extends EventEmitter { this.emit(Events.QR_RECEIVED, qr); }; getQrCode(); - let retryInterval = setInterval(getQrCode, 20000); // check for qr code every 20 seconds + let retryInterval = setInterval(getQrCode, this.options.qrRefreshIntervalMs); // Wait for code scan await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 0 }); @@ -324,6 +328,20 @@ class Client extends EventEmitter { } }); + await page.exposeFunction('onBatteryStateChangedEvent', (state) => { + + const { battery, plugged } = state; + + /** + * Emitted when the battery percentage for the attached device changes + * @event Client#change_battery + * @param {object} batteryInfo + * @param {number} batteryInfo.battery - The current battery percentage + * @param {boolean} batteryInfo.plugged - Indicates if the phone is plugged in (true) or not (false) + */ + this.emit(Events.BATTERY_CHANGED, { battery, plugged }); + }); + await page.evaluate(() => { window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg); }); window.Store.Msg.on('change', (msg) => { window.onChangeMessageEvent(msg); }); @@ -332,11 +350,9 @@ class Client extends EventEmitter { window.Store.Msg.on('change:isUnsentMedia', (msg, unsent) => { if(msg.id.fromMe && !unsent) window.onMessageMediaUploadedEvent(msg); }); window.Store.Msg.on('remove', (msg) => { if(msg.isNewMsg) window.onRemoveMessageEvent(msg); }); window.Store.AppState.on('change:state', (_AppState, state) => { window.onAppStateChangedEvent(state); }); + window.Store.Conn.on('change:battery', (state) => { window.onBatteryStateChangedEvent(state); }); }); - this.pupBrowser = browser; - this.pupPage = page; - /** * Emitted when the client has initialized and is ready to receive messages. * @event Client#ready @@ -549,6 +565,43 @@ class Client extends EventEmitter { }, id); } + /** + * Create a new group + * @param {string} name group title + * @param {Array<Contact|string>} participants an array of Contacts or contact IDs to add to the group + * @returns {Object} createRes + * @returns {string} createRes.gid - ID for the group that was just created + * @returns {Object.<string,string>} 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. + */ + async createGroup(name, participants) { + if(!Array.isArray(participants) || participants.length == 0) { + throw 'You need to add at least one other participant to the group'; + } + + if(participants.every(c => c instanceof Contact)) { + participants = participants.map(c => c.id._serialized); + } + + const createRes = await this.pupPage.evaluate(async (name, participantIds) => { + const res = await window.Store.Wap.createGroup(name, participantIds); + console.log(res); + if(!res.status === 200) { + throw 'An error occurred while creating the group!'; + } + + return res; + }, name, participants); + + const missingParticipants = createRes.participants.reduce(((missing, c) => { + const id = Object.keys(c)[0]; + const statusCode = c[id].code; + if(statusCode != 200) return Object.assign(missing, {[id]: statusCode}); + return missing; + }), {}); + + return { gid: createRes.gid, missingParticipants}; + } + } module.exports = Client; @@ -562,7 +615,7 @@ module.exports = Client;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/ClientInfo.html b/docs/ClientInfo.html index 3a3f7f5..66a7550 100644 --- a/docs/ClientInfo.html +++ b/docs/ClientInfo.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: ClientInfo + whatsapp-web.js 1.4.0 » Class: ClientInfo @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -187,7 +187,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Contact.html b/docs/Contact.html index 8ee8b9f..31bd0fd 100644 --- a/docs/Contact.html +++ b/docs/Contact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Contact + whatsapp-web.js 1.4.0 » Class: Contact @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -196,7 +196,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/GroupChat.html b/docs/GroupChat.html index 0378a19..bd08829 100644 --- a/docs/GroupChat.html +++ b/docs/GroupChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: GroupChat + whatsapp-web.js 1.4.0 » Class: GroupChat @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -726,7 +726,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/GroupNotification.html b/docs/GroupNotification.html index 566dbe1..ff7c13b 100644 --- a/docs/GroupNotification.html +++ b/docs/GroupNotification.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: GroupNotification + whatsapp-web.js 1.4.0 » Class: GroupNotification @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -233,7 +233,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Location.html b/docs/Location.html index eb62cf5..6024929 100644 --- a/docs/Location.html +++ b/docs/Location.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Location + whatsapp-web.js 1.4.0 » Class: Location @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -149,7 +149,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Message.html b/docs/Message.html index 1226b6b..cd72dbb 100644 --- a/docs/Message.html +++ b/docs/Message.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Message + whatsapp-web.js 1.4.0 » Class: Message @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -379,7 +379,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/MessageMedia.html b/docs/MessageMedia.html index 46c31bb..867796b 100644 --- a/docs/MessageMedia.html +++ b/docs/MessageMedia.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: MessageMedia + whatsapp-web.js 1.4.0 » Class: MessageMedia @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -152,7 +152,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/PrivateChat.html b/docs/PrivateChat.html index b94ec46..e22102a 100644 --- a/docs/PrivateChat.html +++ b/docs/PrivateChat.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: PrivateChat + whatsapp-web.js 1.4.0 » Class: PrivateChat @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -378,7 +378,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/PrivateContact.html b/docs/PrivateContact.html index 7bd95f3..cc0088c 100644 --- a/docs/PrivateContact.html +++ b/docs/PrivateContact.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: PrivateContact + whatsapp-web.js 1.4.0 » Class: PrivateContact @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -220,7 +220,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/Util.html b/docs/Util.html index bc52d48..e518854 100644 --- a/docs/Util.html +++ b/docs/Util.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Class: Util + whatsapp-web.js 1.4.0 » Class: Util @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -50,7 +50,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/global.html b/docs/global.html index 0302f5b..9b4f3e8 100644 --- a/docs/global.html +++ b/docs/global.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Globals + whatsapp-web.js 1.4.0 » Globals @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -338,6 +338,19 @@ + + +

BATTERY_CHANGED

+ + +

 

+ + +

 

+ + + +
@@ -1004,7 +1017,7 @@

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/index.html b/docs/index.html index 75f4910..81aabef 100644 --- a/docs/index.html +++ b/docs/index.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Home + whatsapp-web.js 1.4.0 » Home @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -27,7 +27,7 @@

- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0

@@ -460,6 +460,11 @@ client.initialize();
+
+ Client#createGroup(name, participants) +
+
+
Client#destroy()
@@ -475,6 +480,11 @@ client.initialize();
+
+ Client#event:change_battery +
+
+
Client#event:change_state
@@ -490,6 +500,10 @@ client.initialize();
+ +
+
+
Client#event:group_leave
@@ -500,10 +514,6 @@ client.initialize();
-
-
-
-
Client#event:media_uploaded
@@ -549,6 +559,10 @@ client.initialize();
+
+
+
+
Client#getChats()
@@ -559,10 +573,6 @@ client.initialize();
-
-
-
-
Client#getContacts()
@@ -762,6 +772,11 @@ client.initialize();
+
+ Events.BATTERY_CHANGED +
+
+
Events.DISCONNECTED
@@ -806,15 +821,15 @@ client.initialize();
-
-
-
-
Events.MESSAGE_REVOKED_EVERYONE
+
+
+
+
Events.MESSAGE_REVOKED_ME
@@ -1851,7 +1866,7 @@ client.initialize();

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_Base.js.html b/docs/structures_Base.js.html index 19aa102..41dc78c 100644 --- a/docs/structures_Base.js.html +++ b/docs/structures_Base.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/Base.js + whatsapp-web.js 1.4.0 » Source: structures/Base.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -60,7 +60,7 @@ module.exports = Base;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_BusinessContact.js.html b/docs/structures_BusinessContact.js.html index 09294e3..c597ce1 100644 --- a/docs/structures_BusinessContact.js.html +++ b/docs/structures_BusinessContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/BusinessContact.js + whatsapp-web.js 1.4.0 » Source: structures/BusinessContact.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -59,7 +59,7 @@ module.exports = BusinessContact;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_Chat.js.html b/docs/structures_Chat.js.html index 355adf9..d573be3 100644 --- a/docs/structures_Chat.js.html +++ b/docs/structures_Chat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/Chat.js + whatsapp-web.js 1.4.0 » Source: structures/Chat.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -215,7 +215,7 @@ module.exports = Chat;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_ClientInfo.js.html b/docs/structures_ClientInfo.js.html index b301e14..9b05585 100644 --- a/docs/structures_ClientInfo.js.html +++ b/docs/structures_ClientInfo.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/ClientInfo.js + whatsapp-web.js 1.4.0 » Source: structures/ClientInfo.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -89,7 +89,7 @@ module.exports = ClientInfo;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_Contact.js.html b/docs/structures_Contact.js.html index ff4ccab..54bc15d 100644 --- a/docs/structures_Contact.js.html +++ b/docs/structures_Contact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/Contact.js + whatsapp-web.js 1.4.0 » Source: structures/Contact.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -153,7 +153,7 @@ module.exports = Contact;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_GroupChat.js.html b/docs/structures_GroupChat.js.html index 01ac8b3..5868229 100644 --- a/docs/structures_GroupChat.js.html +++ b/docs/structures_GroupChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/GroupChat.js + whatsapp-web.js 1.4.0 » Source: structures/GroupChat.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -209,7 +209,7 @@ module.exports = GroupChat;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_GroupNotification.js.html b/docs/structures_GroupNotification.js.html index 29a7232..08351d4 100644 --- a/docs/structures_GroupNotification.js.html +++ b/docs/structures_GroupNotification.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/GroupNotification.js + whatsapp-web.js 1.4.0 » Source: structures/GroupNotification.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -74,7 +74,7 @@ class GroupNotification extends Base { * * @type {string} */ - this.chatId = typeof (data.to) === 'object' ? data.to._serialized : data.to; + this.chatId = typeof (data.from) === 'object' ? data.from._serialized : data.from; /** * ContactId for the user that produced the GroupNotification. @@ -143,7 +143,7 @@ module.exports = GroupNotification;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_Location.js.html b/docs/structures_Location.js.html index 1eecbdc..b01f60d 100644 --- a/docs/structures_Location.js.html +++ b/docs/structures_Location.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/Location.js + whatsapp-web.js 1.4.0 » Source: structures/Location.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -71,7 +71,7 @@ module.exports = Location;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_Message.js.html b/docs/structures_Message.js.html index 252e124..f0623f4 100644 --- a/docs/structures_Message.js.html +++ b/docs/structures_Message.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/Message.js + whatsapp-web.js 1.4.0 » Source: structures/Message.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -280,7 +280,7 @@ module.exports = Message;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_MessageMedia.js.html b/docs/structures_MessageMedia.js.html index ded3141..f2b5555 100644 --- a/docs/structures_MessageMedia.js.html +++ b/docs/structures_MessageMedia.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/MessageMedia.js + whatsapp-web.js 1.4.0 » Source: structures/MessageMedia.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -69,7 +69,7 @@ module.exports = MessageMedia;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_PrivateChat.js.html b/docs/structures_PrivateChat.js.html index 67e72c2..3d6f452 100644 --- a/docs/structures_PrivateChat.js.html +++ b/docs/structures_PrivateChat.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/PrivateChat.js + whatsapp-web.js 1.4.0 » Source: structures/PrivateChat.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -51,7 +51,7 @@ module.exports = PrivateChat;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/structures_PrivateContact.js.html b/docs/structures_PrivateContact.js.html index 505bc91..f4aa8a8 100644 --- a/docs/structures_PrivateContact.js.html +++ b/docs/structures_PrivateContact.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: structures/PrivateContact.js + whatsapp-web.js 1.4.0 » Source: structures/PrivateContact.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -51,7 +51,7 @@ module.exports = PrivateContact;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/util_Constants.js.html b/docs/util_Constants.js.html index 66bd99c..1009f13 100644 --- a/docs/util_Constants.js.html +++ b/docs/util_Constants.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: util/Constants.js + whatsapp-web.js 1.4.0 » Source: util/Constants.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -39,7 +39,10 @@ exports.DefaultOptions = { puppeteer: { headless: true }, - session: false + session: false, + qrTimeoutMs: 45000, + qrRefreshIntervalMs: 20000, + authTimeoutMs: 45000, }; /** @@ -74,6 +77,7 @@ exports.Events = { QR_RECEIVED: 'qr', DISCONNECTED: 'disconnected', STATE_CHANGED: 'change_state', + BATTERY_CHANGED: 'change_battery' }; /** @@ -167,7 +171,7 @@ exports.MessageAck = {

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/docs/util_Util.js.html b/docs/util_Util.js.html index 9143ce6..9689499 100644 --- a/docs/util_Util.js.html +++ b/docs/util_Util.js.html @@ -4,7 +4,7 @@ - whatsapp-web.js 1.3.1 » Source: util/Util.js + whatsapp-web.js 1.4.0 » Source: util/Util.js @@ -15,7 +15,7 @@
- whatsapp-web.js 1.3.1 + whatsapp-web.js 1.4.0
@@ -73,7 +73,7 @@ module.exports = Util;

- Generated by JSDoc 3.6.3 on April 2, 2020. + Generated by JSDoc 3.6.3 on April 5, 2020.

diff --git a/package.json b/package.json index 2cb7bfe..e51116b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "whatsapp-web.js", - "version": "1.3.1-post", + "version": "1.4.0", "description": "Library for interacting with the WhatsApp Web API ", "main": "./index.js", "scripts": {