whatsapp-web.js 1.18.0 → 1.18.2

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.2240.7](https://img.shields.io/badge/WhatsApp_Web-2.2240.7-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.2241.6](https://img.shields.io/badge/WhatsApp_Web-2.2241.6-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.18.0",
3
+ "version": "1.18.2",
4
4
  "description": "Library for interacting with the WhatsApp Web API ",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",
@@ -13,7 +13,6 @@ exports.ExposeStore = (moduleRaidStr) => {
13
13
  window.Store.Cmd = window.mR.findModule('Cmd')[0].Cmd;
14
14
  window.Store.CryptoLib = window.mR.findModule('decryptE2EMedia')[0];
15
15
  window.Store.DownloadManager = window.mR.findModule('downloadManager')[0].downloadManager;
16
- window.Store.MDBackend = window.mR.findModule('isMDBackend')[0].isMDBackend();
17
16
  window.Store.Features = window.mR.findModule('FEATURE_CHANGE_EVENT')[0].LegacyPhoneFeatures;
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];
@@ -39,7 +38,6 @@ exports.ExposeStore = (moduleRaidStr) => {
39
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;
40
39
  window.Store.Validators = window.mR.findModule('findLinks')[0];
41
40
  window.Store.VCard = window.mR.findModule('vcardFromContactModel')[0];
42
- window.Store.Wap = window.mR.findModule('queryLinkPreview')[0].default;
43
41
  window.Store.WidFactory = window.mR.findModule('createWid')[0];
44
42
  window.Store.ProfilePic = window.mR.findModule('profilePicResync')[0];
45
43
  window.Store.PresenceUtils = window.mR.findModule('sendPresenceAvailable')[0];
@@ -52,6 +50,7 @@ exports.ExposeStore = (moduleRaidStr) => {
52
50
  window.Store.sendReactionToMsg = window.mR.findModule('sendReactionToMsg')[0].sendReactionToMsg;
53
51
  window.Store.createOrUpdateReactionsModule = window.mR.findModule('createOrUpdateReactions')[0];
54
52
  window.Store.EphemeralFields = window.mR.findModule('getEphemeralFields')[0];
53
+ window.Store.ReplyUtils = window.mR.findModule('canReplyMsg').length > 0 && window.mR.findModule('canReplyMsg')[0];
55
54
  window.Store.StickerTools = {
56
55
  ...window.mR.findModule('toWebpSticker')[0],
57
56
  ...window.mR.findModule('addWebpMetadata')[0]
@@ -71,6 +70,19 @@ exports.ExposeStore = (moduleRaidStr) => {
71
70
  });
72
71
  };
73
72
  }
73
+
74
+ // TODO remove these once everybody has been updated to WWebJS with legacy sessions removed
75
+ const _linkPreview = window.mR.findModule('queryLinkPreview');
76
+ if (_linkPreview && _linkPreview[0] && _linkPreview[0].default) {
77
+ window.Store.Wap = _linkPreview[0].default;
78
+ }
79
+
80
+ const _isMDBackend = window.mR.findModule('isMDBackend');
81
+ if(_isMDBackend && _isMDBackend[0] && _isMDBackend[0].isMDBackend) {
82
+ window.Store.MDBackend = _isMDBackend[0].isMDBackend();
83
+ } else {
84
+ window.Store.MDBackend = true;
85
+ }
74
86
  };
75
87
 
76
88
  exports.LoadUtils = () => {
@@ -105,7 +117,13 @@ exports.LoadUtils = () => {
105
117
  let quotedMsgOptions = {};
106
118
  if (options.quotedMessageId) {
107
119
  let quotedMessage = window.Store.Msg.get(options.quotedMessageId);
108
- if (quotedMessage.canReply()) {
120
+
121
+ // TODO remove .canReply() once all clients are updated to >= v2.2241.6
122
+ const canReply = window.Store.ReplyUtils ?
123
+ window.Store.ReplyUtils.canReplyMsg(quotedMessage.unsafe()) :
124
+ quotedMessage.canReply();
125
+
126
+ if (canReply) {
109
127
  quotedMsgOptions = quotedMessage.msgContextInfo(chat);
110
128
  }
111
129
  delete options.quotedMessageId;