whatsapp-web.js 1.16.6 → 1.16.7

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.2212.8](https://img.shields.io/badge/WhatsApp_Web-2.2212.8-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.2220.8](https://img.shields.io/badge/WhatsApp_Web-2.2220.8-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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whatsapp-web.js",
3
- "version": "1.16.6",
3
+ "version": "1.16.7",
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
@@ -809,8 +809,9 @@ class Client extends EventEmitter {
809
809
  return true;
810
810
  }
811
811
  const MAX_PIN_COUNT = 3;
812
- if (window.Store.Chat.models.length > MAX_PIN_COUNT) {
813
- let maxPinned = window.Store.Chat.models[MAX_PIN_COUNT - 1].pin;
812
+ const chatModels = window.Store.Chat.getModelsArray();
813
+ if (chatModels.length > MAX_PIN_COUNT) {
814
+ let maxPinned = chatModels[MAX_PIN_COUNT - 1].pin;
814
815
  if (maxPinned) {
815
816
  return false;
816
817
  }
@@ -1056,7 +1057,7 @@ class Client extends EventEmitter {
1056
1057
  async getChatsByLabelId(labelId) {
1057
1058
  const chatIds = await this.pupPage.evaluate(async (labelId) => {
1058
1059
  const label = window.Store.Label.get(labelId);
1059
- const labelItems = label.labelItemCollection.models;
1060
+ const labelItems = label.labelItemCollection.getModelsArray();
1060
1061
  return labelItems.reduce((result, item) => {
1061
1062
  if (item.parentType === 'Chat') {
1062
1063
  result.push(item.parentId);
@@ -1074,7 +1075,7 @@ class Client extends EventEmitter {
1074
1075
  */
1075
1076
  async getBlockedContacts() {
1076
1077
  const blockedContacts = await this.pupPage.evaluate(() => {
1077
- let chatIds = window.Store.Blocklist.models.map(a => a.id._serialized);
1078
+ let chatIds = window.Store.Blocklist.getModelsArray().map(a => a.id._serialized);
1078
1079
  return Promise.all(chatIds.map(id => window.WWebJS.getContact(id)));
1079
1080
  });
1080
1081
 
@@ -179,11 +179,11 @@ class Chat extends Base {
179
179
  const msgFilter = m => !m.isNotification; // dont include notification messages
180
180
 
181
181
  const chat = window.Store.Chat.get(chatId);
182
- let msgs = chat.msgs.models.filter(msgFilter);
182
+ let msgs = chat.msgs.getModelsArray().filter(msgFilter);
183
183
 
184
184
  if (searchOptions && searchOptions.limit > 0) {
185
185
  while (msgs.length < searchOptions.limit) {
186
- const loadedMessages = await chat.loadEarlierMsgs();
186
+ const loadedMessages = await window.Store.ConversationMsgs.loadEarlierMsgs(chat);
187
187
  if (!loadedMessages) break;
188
188
  msgs = [...loadedMessages.filter(msgFilter), ...msgs];
189
189
  }
@@ -48,6 +48,7 @@ exports.ExposeStore = (moduleRaidStr) => {
48
48
  window.Store.JoinInviteV4 = window.mR.findModule('sendJoinGroupViaInviteV4')[0];
49
49
  window.Store.findCommonGroups = window.mR.findModule('findCommonGroups')[0].findCommonGroups;
50
50
  window.Store.StatusUtils = window.mR.findModule('setMyStatus')[0];
51
+ window.Store.ConversationMsgs = window.mR.findModule('loadEarlierMsgs')[0];
51
52
  window.Store.StickerTools = {
52
53
  ...window.mR.findModule('toWebpSticker')[0],
53
54
  ...window.mR.findModule('addWebpMetadata')[0]
@@ -416,7 +417,7 @@ exports.LoadUtils = () => {
416
417
  };
417
418
 
418
419
  window.WWebJS.getChats = async () => {
419
- const chats = window.Store.Chat.models;
420
+ const chats = window.Store.Chat.getModelsArray();
420
421
 
421
422
  const chatPromises = chats.map(chat => window.WWebJS.getChatModel(chat));
422
423
  return await Promise.all(chatPromises);
@@ -448,7 +449,7 @@ exports.LoadUtils = () => {
448
449
  };
449
450
 
450
451
  window.WWebJS.getContacts = () => {
451
- const contacts = window.Store.Contact.models;
452
+ const contacts = window.Store.Contact.getModelsArray();
452
453
  return contacts.map(contact => window.WWebJS.getContactModel(contact));
453
454
  };
454
455
 
@@ -541,7 +542,7 @@ exports.LoadUtils = () => {
541
542
  };
542
543
 
543
544
  window.WWebJS.getLabels = () => {
544
- const labels = window.Store.Label.models;
545
+ const labels = window.Store.Label.getModelsArray();
545
546
  return labels.map(label => window.WWebJS.getLabelModel(label));
546
547
  };
547
548