whatsapp-web.js 1.16.3 → 1.16.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2206.5](https://img.shields.io/badge/WhatsApp_Web-2.2206.5-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4)
1
+ [![npm](https://img.shields.io/npm/v/whatsapp-web.js.svg)](https://www.npmjs.com/package/whatsapp-web.js) [![Depfu](https://badges.depfu.com/badges/4a65a0de96ece65fdf39e294e0c8dcba/overview.svg)](https://depfu.com/github/pedroslopez/whatsapp-web.js?project_id=9765) ![WhatsApp_Web 2.2210.9](https://img.shields.io/badge/WhatsApp_Web-2.2210.9-brightgreen.svg) [![Discord Chat](https://img.shields.io/discord/698610475432411196.svg?logo=discord)](https://discord.gg/H7DqQs4)
2
2
 
3
3
  # whatsapp-web.js
4
4
  A WhatsApp API client that connects through the WhatsApp Web browser app
package/index.d.ts CHANGED
@@ -304,7 +304,7 @@ declare namespace WAWebJS {
304
304
  * @default 0 */
305
305
  authTimeoutMs?: number,
306
306
  /** Puppeteer launch options. View docs here: https://github.com/puppeteer/puppeteer/ */
307
- puppeteer?: puppeteer.LaunchOptions & puppeteer.BrowserLaunchArgumentOptions & puppeteer.BrowserConnectOptions
307
+ puppeteer?: puppeteer.PuppeteerNodeLaunchOptions & puppeteer.ConnectOptions
308
308
  /** Determines how to save and restore sessions. Will use LegacySessionAuth if options.session is set. Otherwise, NoAuth will be used. */
309
309
  authStrategy?: AuthStrategy,
310
310
  /** How many times should the qrcode be refreshed before giving up
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-web.js",
3
- "version": "1.16.3",
3
+ "version": "1.16.5",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
package/src/Client.js CHANGED
@@ -877,19 +877,15 @@ class Client extends EventEmitter {
877
877
  */
878
878
  async getProfilePicUrl(contactId) {
879
879
  const profilePic = await this.pupPage.evaluate(async contactId => {
880
- let asyncPic;
881
- if (window.Store.Features.features.MD_BACKEND) {
880
+ try {
882
881
  const chatWid = window.Store.WidFactory.createWid(contactId);
883
- asyncPic = await window.Store.getProfilePicFull(chatWid).catch(() => {
884
- return undefined;
885
- });
886
- } else {
887
- asyncPic = await window.Store.Wap.profilePicFind(contactId).catch(() => {
888
- return undefined;
889
- });
882
+ return await window.Store.ProfilePic.profilePicFind(chatWid);
883
+ } catch (err) {
884
+ if(err.name === 'ServerStatusCodeError') return undefined;
885
+ throw err;
890
886
  }
891
- return asyncPic;
892
887
  }, contactId);
888
+
893
889
  return profilePic ? profilePic.eurl : undefined;
894
890
  }
895
891
 
@@ -999,7 +995,7 @@ class Client extends EventEmitter {
999
995
 
1000
996
  const createRes = await this.pupPage.evaluate(async (name, participantIds) => {
1001
997
  const participantWIDs = participantIds.map(p => window.Store.WidFactory.createWid(p));
1002
- const id = window.Store.genId();
998
+ const id = window.Store.MsgKey.newId();
1003
999
  const res = await window.Store.GroupUtils.sendCreateGroup(name, participantWIDs, undefined, id);
1004
1000
  return res;
1005
1001
  }, name, participants);
@@ -136,7 +136,7 @@ class GroupChat extends Chat {
136
136
  const chatWid = window.Store.WidFactory.createWid(chatId);
137
137
  let descId = window.Store.GroupMetadata.get(chatWid).descId;
138
138
  try {
139
- return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.genId(), descId);
139
+ return await window.Store.GroupUtils.sendSetGroupDescription(chatWid, description, window.Store.MsgKey.newId(), descId);
140
140
  } catch (err) {
141
141
  if(err.name === 'ServerStatusCodeError') return false;
142
142
  throw err;
@@ -43,7 +43,7 @@ class GroupNotification extends Base {
43
43
  *
44
44
  * @type {string}
45
45
  */
46
- this.chatId = typeof (data.to) === 'object' ? data.to._serialized : data.to;
46
+ this.chatId = typeof (data.id.remote) === 'object' ? data.id.remote._serialized : data.id.remote;
47
47
 
48
48
  /**
49
49
  * ContactId for the user that produced the GroupNotification.
@@ -14,7 +14,6 @@ exports.ExposeStore = (moduleRaidStr) => {
14
14
  window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
15
15
  window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
16
16
  window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].GK;
17
- window.Store.genId = window.mR.findModule('newTag')[0].newTag;
18
17
  window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
19
18
  window.Store.Invite = window.mR.findModule('sendJoinGroupViaInvite')[0];
20
19
  window.Store.InviteInfo = window.mR.findModule('sendQueryGroupInvite')[0];
@@ -27,14 +26,13 @@ exports.ExposeStore = (moduleRaidStr) => {
27
26
  window.Store.MsgKey = window.mR.findModule((module) => module.default && module.default.fromString)[0].default;
28
27
  window.Store.MessageInfo = window.mR.findModule('sendQueryMsgInfo')[0];
29
28
  window.Store.OpaqueData = window.mR.findModule(module => module.default && module.default.createFromData)[0].default;
30
- window.Store.QueryExist = window.mR.findModule(module => typeof module.default === 'function' && module.default.toString().includes('Should not reach queryExists MD'))[0].default;
29
+ window.Store.QueryExist = window.mR.findModule('queryExists')[0].queryExists;
31
30
  window.Store.QueryProduct = window.mR.findModule('queryProduct')[0];
32
31
  window.Store.QueryOrder = window.mR.findModule('queryOrder')[0];
33
32
  window.Store.SendClear = window.mR.findModule('sendClear')[0];
34
33
  window.Store.SendDelete = window.mR.findModule('sendDelete')[0];
35
34
  window.Store.SendMessage = window.mR.findModule('addAndSendMsgToChat')[0];
36
35
  window.Store.SendSeen = window.mR.findModule('sendSeen')[0];
37
- window.Store.Sticker = window.mR.findModule('Sticker')[0].Sticker;
38
36
  window.Store.User = window.mR.findModule('getMaybeMeUser')[0];
39
37
  window.Store.UploadUtils = window.mR.findModule((module) => (module.default && module.default.encryptAndUpload) ? module.default : null)[0].default;
40
38
  window.Store.UserConstructor = window.mR.findModule((module) => (module.default && module.default.prototype && module.default.prototype.isServer && module.default.prototype.isUser) ? module.default : null)[0].default;
@@ -42,7 +40,7 @@ exports.ExposeStore = (moduleRaidStr) => {
42
40
  window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
43
41
  window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default;
44
42
  window.Store.WidFactory = window.mR.findModule('createWid')[0];
45
- window.Store.getProfilePicFull = window.mR.findModule('getProfilePicFull')[0].getProfilePicFull;
43
+ window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0];
46
44
  window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0];
47
45
  window.Store.ChatState = window.mR.findModule('sendChatStateComposing')[0];
48
46
  window.Store.GroupParticipants = window.mR.findModule('sendPromoteParticipants')[0];
@@ -218,7 +216,7 @@ exports.LoadUtils = () => {
218
216
  const newMsgId = new window.Store.MsgKey({
219
217
  from: meUser,
220
218
  to: chat.id,
221
- id: window.Store.genId(),
219
+ id: window.Store.MsgKey.newId(),
222
220
  participant: isMD && chat.id.isGroup() ? meUser : undefined,
223
221
  selfDir: 'out',
224
222
  });