@pney/whatsapp-web 1.34.6 → 1.34.7-1
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/.env.example +0 -1
- package/.gitattributes +4 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +1 -0
- package/.lintstagedrc.json +6 -0
- package/.prettierignore +8 -0
- package/.prettierrc.json +10 -0
- package/README.md +83 -80
- package/commitlint.config.js +29 -0
- package/eslint.config.mjs +67 -0
- package/example.js +151 -71
- package/index.d.ts +982 -734
- package/index.js +4 -4
- package/package.json +3 -3
- package/shell.js +4 -4
- package/src/Client.js +1860 -920
- package/src/authStrategies/BaseAuthStrategy.js +4 -2
- package/src/authStrategies/LocalAuth.js +25 -12
- package/src/authStrategies/NoAuth.js +3 -4
- package/src/authStrategies/RemoteAuth.js +92 -43
- package/src/factories/ChatFactory.js +1 -1
- package/src/factories/ContactFactory.js +2 -2
- package/src/structures/Base.js +5 -3
- package/src/structures/Broadcast.js +1 -2
- package/src/structures/BusinessContact.js +1 -2
- package/src/structures/Buttons.js +14 -10
- package/src/structures/Call.js +10 -6
- package/src/structures/Channel.js +171 -91
- package/src/structures/Chat.js +57 -41
- package/src/structures/ClientInfo.js +1 -1
- package/src/structures/Contact.js +37 -16
- package/src/structures/GroupChat.js +425 -228
- package/src/structures/GroupNotification.js +21 -12
- package/src/structures/Label.js +6 -6
- package/src/structures/List.js +22 -14
- package/src/structures/Location.js +5 -4
- package/src/structures/Message.js +412 -168
- package/src/structures/MessageMedia.js +31 -18
- package/src/structures/Order.js +4 -4
- package/src/structures/Payment.js +6 -3
- package/src/structures/Poll.js +2 -2
- package/src/structures/PollVote.js +9 -6
- package/src/structures/PrivateChat.js +2 -4
- package/src/structures/PrivateContact.js +2 -4
- package/src/structures/Product.js +1 -1
- package/src/structures/ProductMetadata.js +1 -2
- package/src/structures/Reaction.js +2 -4
- package/src/structures/ScheduledEvent.js +22 -10
- package/src/util/Constants.js +8 -6
- package/src/util/Injected/AuthStore/AuthStore.js +7 -3
- package/src/util/Injected/Utils.js +753 -345
- package/src/util/InterfaceController.js +72 -25
- package/src/util/Puppeteer.js +1 -1
- package/src/util/Util.js +28 -15
- package/src/webCache/LocalWebCache.js +7 -5
- package/src/webCache/RemoteWebCache.js +10 -4
- package/src/webCache/WebCache.js +8 -5
- package/src/webCache/WebCacheFactory.js +9 -9
- package/CODE_OF_CONDUCT.md +0 -133
|
@@ -18,7 +18,7 @@ class Contact extends Base {
|
|
|
18
18
|
constructor(client, data) {
|
|
19
19
|
super(client);
|
|
20
20
|
|
|
21
|
-
if(data) this._patch(data);
|
|
21
|
+
if (data) this._patch(data);
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
_patch(data) {
|
|
@@ -108,7 +108,7 @@ class Contact extends Base {
|
|
|
108
108
|
* @type {boolean}
|
|
109
109
|
*/
|
|
110
110
|
this.isBlocked = data.isBlocked;
|
|
111
|
-
|
|
111
|
+
|
|
112
112
|
return super._patch(data);
|
|
113
113
|
}
|
|
114
114
|
|
|
@@ -127,7 +127,7 @@ class Contact extends Base {
|
|
|
127
127
|
async getFormattedNumber() {
|
|
128
128
|
return await this.client.getFormattedNumber(this.id._serialized);
|
|
129
129
|
}
|
|
130
|
-
|
|
130
|
+
|
|
131
131
|
/**
|
|
132
132
|
* Returns the contact's countrycode, (1541859685@c.us) => (1)
|
|
133
133
|
* @returns {Promise<string>}
|
|
@@ -135,14 +135,14 @@ class Contact extends Base {
|
|
|
135
135
|
async getCountryCode() {
|
|
136
136
|
return await this.client.getCountryCode(this.id._serialized);
|
|
137
137
|
}
|
|
138
|
-
|
|
138
|
+
|
|
139
139
|
/**
|
|
140
|
-
* Returns the Chat that corresponds to this Contact.
|
|
140
|
+
* Returns the Chat that corresponds to this Contact.
|
|
141
141
|
* Will return null when getting chat for currently logged in user.
|
|
142
142
|
* @returns {Promise<Chat>}
|
|
143
143
|
*/
|
|
144
144
|
async getChat() {
|
|
145
|
-
if(this.isMe) return null;
|
|
145
|
+
if (this.isMe) return null;
|
|
146
146
|
|
|
147
147
|
return await this.client.getChatById(this.id._serialized);
|
|
148
148
|
}
|
|
@@ -152,11 +152,21 @@ class Contact extends Base {
|
|
|
152
152
|
* @returns {Promise<boolean>}
|
|
153
153
|
*/
|
|
154
154
|
async block() {
|
|
155
|
-
if(this.isGroup) return false;
|
|
155
|
+
if (this.isGroup) return false;
|
|
156
156
|
|
|
157
157
|
await this.client.pupPage.evaluate(async (contactId) => {
|
|
158
|
-
const contact =
|
|
159
|
-
|
|
158
|
+
const contact = await window
|
|
159
|
+
.require('WAWebCollections')
|
|
160
|
+
.Contact.find(contactId);
|
|
161
|
+
const resolved = window
|
|
162
|
+
.require('WAWebBlockContactUtils')
|
|
163
|
+
.getContactToBlockOnlyUseIfNoAssociatedChat(
|
|
164
|
+
contact,
|
|
165
|
+
'ChatListBlock',
|
|
166
|
+
);
|
|
167
|
+
await window
|
|
168
|
+
.require('WAWebBlockContactAction')
|
|
169
|
+
.blockContact({ contact: resolved });
|
|
160
170
|
}, this.id._serialized);
|
|
161
171
|
|
|
162
172
|
this.isBlocked = true;
|
|
@@ -168,11 +178,21 @@ class Contact extends Base {
|
|
|
168
178
|
* @returns {Promise<boolean>}
|
|
169
179
|
*/
|
|
170
180
|
async unblock() {
|
|
171
|
-
if(this.isGroup) return false;
|
|
181
|
+
if (this.isGroup) return false;
|
|
172
182
|
|
|
173
183
|
await this.client.pupPage.evaluate(async (contactId) => {
|
|
174
|
-
const contact =
|
|
175
|
-
|
|
184
|
+
const contact = await window
|
|
185
|
+
.require('WAWebCollections')
|
|
186
|
+
.Contact.find(contactId);
|
|
187
|
+
const resolved = window
|
|
188
|
+
.require('WAWebBlockContactUtils')
|
|
189
|
+
.getContactToBlockOnlyUseIfNoAssociatedChat(
|
|
190
|
+
contact,
|
|
191
|
+
'ChatListBlock',
|
|
192
|
+
);
|
|
193
|
+
await window
|
|
194
|
+
.require('WAWebBlockContactAction')
|
|
195
|
+
.unblockContact(resolved);
|
|
176
196
|
}, this.id._serialized);
|
|
177
197
|
|
|
178
198
|
this.isBlocked = false;
|
|
@@ -186,11 +206,12 @@ class Contact extends Base {
|
|
|
186
206
|
async getAbout() {
|
|
187
207
|
const about = await this.client.pupPage.evaluate(async (contactId) => {
|
|
188
208
|
const wid = window.require('WAWebWidFactory').createWid(contactId);
|
|
189
|
-
return
|
|
209
|
+
return window
|
|
210
|
+
.require('WAWebContactStatusBridge')
|
|
211
|
+
.getStatus({ token: '', wid: wid });
|
|
190
212
|
}, this.id._serialized);
|
|
191
213
|
|
|
192
|
-
if (typeof about.status !== 'string')
|
|
193
|
-
return null;
|
|
214
|
+
if (typeof about.status !== 'string') return null;
|
|
194
215
|
|
|
195
216
|
return about.status;
|
|
196
217
|
}
|
|
@@ -206,7 +227,7 @@ class Contact extends Base {
|
|
|
206
227
|
/**
|
|
207
228
|
* Gets the Contact's current status broadcast.
|
|
208
229
|
* @returns {Promise<Broadcast>}
|
|
209
|
-
|
|
230
|
+
*/
|
|
210
231
|
async getBroadcast() {
|
|
211
232
|
return await this.client.getBroadcastById(this.id._serialized);
|
|
212
233
|
}
|