@wppconnect-team/wppconnect 2.4.0 → 2.4.6
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/dist/api/helpers/evaluate-with-error-code.d.ts +10 -0
- package/dist/api/helpers/evaluate-with-error-code.js +49 -0
- package/dist/api/helpers/exposed.enum.d.ts +9 -1
- package/dist/api/helpers/exposed.enum.js +8 -0
- package/dist/api/helpers/index.d.ts +1 -0
- package/dist/api/helpers/index.js +3 -1
- package/dist/api/helpers/listen-incoming-call.d.ts +12 -0
- package/dist/api/helpers/listen-incoming-call.js +98 -0
- package/dist/api/layers/business.layer.d.ts +2 -2
- package/dist/api/layers/business.layer.js +2 -2
- package/dist/api/layers/call.layer.d.ts +264 -0
- package/dist/api/layers/call.layer.js +426 -0
- package/dist/api/layers/listener.layer.d.ts +114 -1
- package/dist/api/layers/listener.layer.js +217 -3
- package/dist/api/model/call.d.ts +124 -0
- package/dist/api/model/call.js +18 -0
- package/dist/api/model/incoming-call.d.ts +6 -0
- package/dist/api/model/index.d.ts +1 -0
- package/dist/api/model/index.js +1 -0
- package/dist/api/whatsapp.d.ts +0 -6
- package/dist/api/whatsapp.js +0 -10
- package/dist/controllers/browser.js +13 -9
- package/package.json +7 -3
- package/CHANGELOG.md +0 -1711
- package/documentation/readme-reference.md +0 -118
- package/eslint.config.mjs +0 -130
- package/img/wppconnect-banner.jpeg +0 -0
- package/scripts/docs-redirects.mjs +0 -70
- package/scripts/typedoc-canonical.mjs +0 -49
- package/test.mp4 +0 -0
|
@@ -20,6 +20,7 @@ exports.ListenerLayer = void 0;
|
|
|
20
20
|
const events_1 = require("events");
|
|
21
21
|
const helpers_1 = require("../helpers");
|
|
22
22
|
const exposed_enum_1 = require("../helpers/exposed.enum");
|
|
23
|
+
const listen_incoming_call_1 = require("../helpers/listen-incoming-call");
|
|
23
24
|
const profile_layer_1 = require("./profile.layer");
|
|
24
25
|
class ListenerLayer extends profile_layer_1.ProfileLayer {
|
|
25
26
|
page;
|
|
@@ -185,10 +186,78 @@ class ListenerLayer extends profile_layer_1.ProfileLayer {
|
|
|
185
186
|
catch (error) {
|
|
186
187
|
console.error(error);
|
|
187
188
|
}
|
|
189
|
+
// Wid objects do not cross to Node, send them as strings
|
|
190
|
+
const wid = (w) => (w ? w._serialized || w.toString() : undefined);
|
|
191
|
+
const toCallEvent = (data) => ({
|
|
192
|
+
...data,
|
|
193
|
+
peerJid: wid(data.peerJid),
|
|
194
|
+
groupJid: wid(data.groupJid),
|
|
195
|
+
});
|
|
196
|
+
// WA-JS with native call support emits call.* events
|
|
197
|
+
const hasCallEvents = typeof WPP.call?.enableAudioInjection === 'function';
|
|
198
|
+
try {
|
|
199
|
+
const callEvents = {
|
|
200
|
+
onCallOutgoing: 'call.outgoing_call',
|
|
201
|
+
onCallRinging: 'call.ringing',
|
|
202
|
+
onCallAccepted: 'call.accepted',
|
|
203
|
+
onCallStateChanged: 'call.state_changed',
|
|
204
|
+
onCallEnded: 'call.ended',
|
|
205
|
+
onCallVideoState: 'call.video_state',
|
|
206
|
+
};
|
|
207
|
+
for (const [name, event] of Object.entries(callEvents)) {
|
|
208
|
+
if (hasCallEvents && !window[name]?.exposed) {
|
|
209
|
+
WPP.on(event, (data) => {
|
|
210
|
+
const payload = toCallEvent(data);
|
|
211
|
+
if ('jid' in data) {
|
|
212
|
+
payload.jid = wid(data.jid);
|
|
213
|
+
}
|
|
214
|
+
window[name](payload);
|
|
215
|
+
});
|
|
216
|
+
window[name].exposed = true;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
console.error(error);
|
|
222
|
+
}
|
|
188
223
|
try {
|
|
189
|
-
if (!window['
|
|
190
|
-
|
|
191
|
-
|
|
224
|
+
if (hasCallEvents && !window['onCallMuteState']?.exposed) {
|
|
225
|
+
WPP.on('call.mute_state', (data) => {
|
|
226
|
+
window['onCallMuteState']({
|
|
227
|
+
...data,
|
|
228
|
+
participants: (data.participants || []).map((p) => ({
|
|
229
|
+
...p,
|
|
230
|
+
jid: wid(p.jid),
|
|
231
|
+
})),
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
window['onCallMuteState'].exposed = true;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error(error);
|
|
239
|
+
}
|
|
240
|
+
try {
|
|
241
|
+
if (hasCallEvents && !window['onCallAudioFrame']?.exposed) {
|
|
242
|
+
// Capture is only enabled while Node has listeners
|
|
243
|
+
// (window.__wppconnectCallFrames), and is armed for a single
|
|
244
|
+
// call, so it is armed again for the next one
|
|
245
|
+
const arm = () => {
|
|
246
|
+
if (window.__wppconnectCallFrames) {
|
|
247
|
+
WPP.call.enableAudioCapture({
|
|
248
|
+
format: 'int16-base64',
|
|
249
|
+
source: 'both',
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
WPP.on('call.audio_frame', (frame) => {
|
|
254
|
+
if (window.__wppconnectCallFrames &&
|
|
255
|
+
frame.format === 'int16-base64') {
|
|
256
|
+
window['onCallAudioFrame'](frame);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
WPP.on('call.ended', () => setTimeout(arm, 0));
|
|
260
|
+
window['onCallAudioFrame'].exposed = true;
|
|
192
261
|
}
|
|
193
262
|
}
|
|
194
263
|
catch (error) {
|
|
@@ -356,6 +425,24 @@ class ListenerLayer extends profile_layer_1.ProfileLayer {
|
|
|
356
425
|
}
|
|
357
426
|
})
|
|
358
427
|
.catch(() => { });
|
|
428
|
+
await this.page.evaluate(listen_incoming_call_1.listenIncomingCall).catch((error) => {
|
|
429
|
+
this.log('debug', `Incoming call listener: ${error}`);
|
|
430
|
+
});
|
|
431
|
+
// The page was reloaded, restore the call audio capture
|
|
432
|
+
if (this.listenerEmitter.listenerCount(exposed_enum_1.ExposedFn.onCallAudioFrame) > 0) {
|
|
433
|
+
await this.setCallAudioCapture(true);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Enables or disables the call audio capture used by {@link onCallAudioFrame}
|
|
438
|
+
*/
|
|
439
|
+
async setCallAudioCapture(enabled) {
|
|
440
|
+
await this.page
|
|
441
|
+
.evaluate((enabled) => {
|
|
442
|
+
window.__wppconnectCallFrames = enabled;
|
|
443
|
+
WPP.call.enableAudioCapture(enabled ? { format: 'int16-base64', source: 'both' } : false);
|
|
444
|
+
}, enabled)
|
|
445
|
+
.catch((error) => this.log('debug', `Call audio capture: ${error}`));
|
|
359
446
|
}
|
|
360
447
|
/**
|
|
361
448
|
* Register the event and create a disposable object to stop the listening
|
|
@@ -510,6 +597,133 @@ class ListenerLayer extends profile_layer_1.ProfileLayer {
|
|
|
510
597
|
onIncomingCall(callback) {
|
|
511
598
|
return this.registerEvent('onIncomingCall', callback);
|
|
512
599
|
}
|
|
600
|
+
/**
|
|
601
|
+
* @event Listens to calls started by this session
|
|
602
|
+
* @category Call
|
|
603
|
+
* @example
|
|
604
|
+
* ```javascript
|
|
605
|
+
* client.onCallOutgoing((call) => console.log('Calling', call.peerJid));
|
|
606
|
+
* ```
|
|
607
|
+
* @returns Disposable object to stop listening
|
|
608
|
+
*/
|
|
609
|
+
onCallOutgoing(callback) {
|
|
610
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallOutgoing, callback);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* @event Listens to calls ringing on the other side
|
|
614
|
+
* @category Call
|
|
615
|
+
* @example
|
|
616
|
+
* ```javascript
|
|
617
|
+
* client.onCallRinging((call) => console.log('Ringing', call.id));
|
|
618
|
+
* ```
|
|
619
|
+
* @returns Disposable object to stop listening
|
|
620
|
+
*/
|
|
621
|
+
onCallRinging(callback) {
|
|
622
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallRinging, callback);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* @event Listens to calls being connected, incoming or outgoing
|
|
626
|
+
* @category Call
|
|
627
|
+
* @example
|
|
628
|
+
* ```javascript
|
|
629
|
+
* client.onCallAccepted(() => client.playCallAudio('./welcome.mp3'));
|
|
630
|
+
* ```
|
|
631
|
+
* @returns Disposable object to stop listening
|
|
632
|
+
*/
|
|
633
|
+
onCallAccepted(callback) {
|
|
634
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallAccepted, callback);
|
|
635
|
+
}
|
|
636
|
+
/**
|
|
637
|
+
* @event Listens to every call state change
|
|
638
|
+
* @category Call
|
|
639
|
+
* @example
|
|
640
|
+
* ```javascript
|
|
641
|
+
* client.onCallStateChanged((call) => console.log(call.id, call.stateName));
|
|
642
|
+
* ```
|
|
643
|
+
* @returns Disposable object to stop listening
|
|
644
|
+
*/
|
|
645
|
+
onCallStateChanged(callback) {
|
|
646
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallStateChanged, callback);
|
|
647
|
+
}
|
|
648
|
+
/**
|
|
649
|
+
* @event Listens to calls ending, with the result and duration
|
|
650
|
+
* @category Call
|
|
651
|
+
* @example
|
|
652
|
+
* ```javascript
|
|
653
|
+
* client.onCallEnded((call) => {
|
|
654
|
+
* console.log(call.resultName, call.duration);
|
|
655
|
+
* });
|
|
656
|
+
* ```
|
|
657
|
+
* @returns Disposable object to stop listening
|
|
658
|
+
*/
|
|
659
|
+
onCallEnded(callback) {
|
|
660
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallEnded, callback);
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* @event Listens to microphone mute changes of the call participants
|
|
664
|
+
* @category Call
|
|
665
|
+
* @example
|
|
666
|
+
* ```javascript
|
|
667
|
+
* client.onCallMuteState((state) => console.log(state.peerMuted));
|
|
668
|
+
* ```
|
|
669
|
+
* @returns Disposable object to stop listening
|
|
670
|
+
*/
|
|
671
|
+
onCallMuteState(callback) {
|
|
672
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallMuteState, callback);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* @event Listens to camera changes of the call participants
|
|
676
|
+
* @category Call
|
|
677
|
+
* @example
|
|
678
|
+
* ```javascript
|
|
679
|
+
* client.onCallVideoState((state) => console.log(state.stateName));
|
|
680
|
+
* ```
|
|
681
|
+
* @returns Disposable object to stop listening
|
|
682
|
+
*/
|
|
683
|
+
onCallVideoState(callback) {
|
|
684
|
+
return this.registerEvent(exposed_enum_1.ExposedFn.onCallVideoState, callback);
|
|
685
|
+
}
|
|
686
|
+
/**
|
|
687
|
+
* Listens to the call audio, in frames of 60 ms of 16 kHz mono PCM
|
|
688
|
+
* (about 16 frames per second for each side).
|
|
689
|
+
*
|
|
690
|
+
* The capture is only enabled while there is a listener, and is armed again
|
|
691
|
+
* for each call. Register it before the call starts to get every frame.
|
|
692
|
+
*
|
|
693
|
+
* @event Listens to the call audio
|
|
694
|
+
* @category Call
|
|
695
|
+
* @example
|
|
696
|
+
* ```javascript
|
|
697
|
+
* client.onCallAudioFrame(
|
|
698
|
+
* (frame) => {
|
|
699
|
+
* const pcm = Buffer.from(frame.samples, 'base64'); // Int16 LE
|
|
700
|
+
* },
|
|
701
|
+
* { source: 'remote' }
|
|
702
|
+
* );
|
|
703
|
+
* ```
|
|
704
|
+
* @returns Disposable object to stop listening
|
|
705
|
+
*/
|
|
706
|
+
onCallAudioFrame(callback, options = {}) {
|
|
707
|
+
const source = options.source || 'both';
|
|
708
|
+
const listener = (frame) => {
|
|
709
|
+
if (source === 'both' || frame.source === source) {
|
|
710
|
+
return callback(frame);
|
|
711
|
+
}
|
|
712
|
+
};
|
|
713
|
+
const isFirst = this.listenerEmitter.listenerCount(exposed_enum_1.ExposedFn.onCallAudioFrame) === 0;
|
|
714
|
+
const subscription = this.registerEvent(exposed_enum_1.ExposedFn.onCallAudioFrame, listener);
|
|
715
|
+
if (isFirst) {
|
|
716
|
+
this.setCallAudioCapture(true);
|
|
717
|
+
}
|
|
718
|
+
return {
|
|
719
|
+
dispose: () => {
|
|
720
|
+
subscription.dispose();
|
|
721
|
+
if (this.listenerEmitter.listenerCount(exposed_enum_1.ExposedFn.onCallAudioFrame) === 0) {
|
|
722
|
+
this.setCallAudioCapture(false);
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
};
|
|
726
|
+
}
|
|
513
727
|
onPresenceChanged(id, callback) {
|
|
514
728
|
const ids = [];
|
|
515
729
|
if (typeof id === 'function') {
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which side of the call audio to capture or record.
|
|
3
|
+
* `local` is what this session sends, `remote` is what the other side sends.
|
|
4
|
+
*/
|
|
5
|
+
export type CallAudioSource = 'both' | 'remote' | 'local';
|
|
6
|
+
/**
|
|
7
|
+
* Plain snapshot of a call, safe to use outside the browser
|
|
8
|
+
*/
|
|
9
|
+
export interface CallInfo {
|
|
10
|
+
id: string;
|
|
11
|
+
peerJid?: string;
|
|
12
|
+
groupJid?: string;
|
|
13
|
+
isGroup: boolean;
|
|
14
|
+
isVideo: boolean;
|
|
15
|
+
isOutgoing: boolean;
|
|
16
|
+
/** Whether the call was started from a call link */
|
|
17
|
+
isCallLink?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Common payload of the call events
|
|
21
|
+
*/
|
|
22
|
+
export interface CallEvent {
|
|
23
|
+
id: string;
|
|
24
|
+
peerJid?: string;
|
|
25
|
+
groupJid?: string;
|
|
26
|
+
isGroup: boolean;
|
|
27
|
+
isVideo: boolean;
|
|
28
|
+
isOutgoing: boolean;
|
|
29
|
+
}
|
|
30
|
+
export interface CallStateChangedEvent extends CallEvent {
|
|
31
|
+
state: number;
|
|
32
|
+
stateName: string;
|
|
33
|
+
previousState?: number;
|
|
34
|
+
}
|
|
35
|
+
export interface CallEndedEvent extends CallEvent {
|
|
36
|
+
wasConnected: boolean;
|
|
37
|
+
endedByMe?: boolean;
|
|
38
|
+
result?: number;
|
|
39
|
+
/**
|
|
40
|
+
* One of: canceled, missed, unavailable, rejected, connected,
|
|
41
|
+
* accepted_elsewhere, failed, connected_lonely
|
|
42
|
+
*/
|
|
43
|
+
resultName?: string;
|
|
44
|
+
/** Total call duration in milliseconds */
|
|
45
|
+
duration?: number;
|
|
46
|
+
/** Connected time in milliseconds */
|
|
47
|
+
activeDuration?: number;
|
|
48
|
+
}
|
|
49
|
+
export interface CallMuteStateEvent {
|
|
50
|
+
id: string;
|
|
51
|
+
selfMuted?: boolean;
|
|
52
|
+
peerMuted?: boolean;
|
|
53
|
+
participants: {
|
|
54
|
+
jid?: string;
|
|
55
|
+
isSelf: boolean;
|
|
56
|
+
isMuted: boolean;
|
|
57
|
+
}[];
|
|
58
|
+
}
|
|
59
|
+
export interface CallVideoStateEvent {
|
|
60
|
+
id: string;
|
|
61
|
+
isSelf: boolean;
|
|
62
|
+
jid?: string;
|
|
63
|
+
state: number;
|
|
64
|
+
stateName?: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* One frame of call audio: 60 ms of 16 kHz mono PCM
|
|
68
|
+
*/
|
|
69
|
+
export interface CallAudioFrame {
|
|
70
|
+
id?: string;
|
|
71
|
+
source: 'remote' | 'local';
|
|
72
|
+
sampleRate: number;
|
|
73
|
+
format: 'int16-base64';
|
|
74
|
+
/** Base64 of little-endian Int16 PCM samples */
|
|
75
|
+
samples: string;
|
|
76
|
+
timestamp: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CallOptions {
|
|
79
|
+
/** Start a video call (default: false), uses the real camera */
|
|
80
|
+
isVideo?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Enable audio injection for this call before starting it,
|
|
83
|
+
* so {@link CallLayer.playCallAudio} and {@link CallLayer.pushCallAudio} can be used
|
|
84
|
+
*/
|
|
85
|
+
audioInjection?: boolean;
|
|
86
|
+
}
|
|
87
|
+
export interface AcceptCallOptions {
|
|
88
|
+
/** Send audio (default: true) */
|
|
89
|
+
audio?: boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Send video (default: same as the call), uses the real camera.
|
|
92
|
+
* Use `false` on machines without a camera
|
|
93
|
+
*/
|
|
94
|
+
video?: boolean;
|
|
95
|
+
/** Enable audio injection for this call before accepting it */
|
|
96
|
+
audioInjection?: boolean;
|
|
97
|
+
}
|
|
98
|
+
export interface CreateCallLinkOptions {
|
|
99
|
+
isVideo?: boolean;
|
|
100
|
+
requireApproval?: boolean;
|
|
101
|
+
}
|
|
102
|
+
export interface JoinCallLinkOptions {
|
|
103
|
+
/** Join with video; when omitted, use the call link's voice or video type */
|
|
104
|
+
isVideo?: boolean;
|
|
105
|
+
/** Enable audio injection for this call before joining it */
|
|
106
|
+
audioInjection?: boolean;
|
|
107
|
+
}
|
|
108
|
+
export interface PlayCallAudioOptions {
|
|
109
|
+
loop?: boolean;
|
|
110
|
+
/** Volume from 0 to 1 (default: 1) */
|
|
111
|
+
volume?: number;
|
|
112
|
+
}
|
|
113
|
+
export interface PushCallAudioOptions {
|
|
114
|
+
/** Sample rate of the PCM data (default: 16000) */
|
|
115
|
+
sampleRate?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface CallRecordingOptions {
|
|
118
|
+
/** Which side to record (default: both, mixed) */
|
|
119
|
+
source?: CallAudioSource;
|
|
120
|
+
}
|
|
121
|
+
export interface CallAudioFrameOptions {
|
|
122
|
+
/** Which side to capture (default: both) */
|
|
123
|
+
source?: CallAudioSource;
|
|
124
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of WPPConnect.
|
|
4
|
+
*
|
|
5
|
+
* WPPConnect is free software: you can redistribute it and/or modify
|
|
6
|
+
* it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
* the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
* (at your option) any later version.
|
|
9
|
+
*
|
|
10
|
+
* WPPConnect is distributed in the hope that it will be useful,
|
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
* GNU Lesser General Public License for more details.
|
|
14
|
+
*
|
|
15
|
+
* You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
* along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -13,5 +13,11 @@ export interface IncomingCall {
|
|
|
13
13
|
isSilenced: boolean;
|
|
14
14
|
offerReceivedWhileOffline: boolean;
|
|
15
15
|
webClientShouldHandle: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Group call participants. Newer WhatsApp versions send `{ jid, state }`,
|
|
18
|
+
* older ones the serialized participant models
|
|
19
|
+
*/
|
|
16
20
|
participants: any[];
|
|
21
|
+
/** Other serializable fields of the WhatsApp call model */
|
|
22
|
+
[key: string]: any;
|
|
17
23
|
}
|
package/dist/api/model/index.js
CHANGED
package/dist/api/whatsapp.d.ts
CHANGED
|
@@ -96,10 +96,4 @@ export declare class Whatsapp extends BusinessLayer {
|
|
|
96
96
|
decryptFile(message: Message): Promise<Buffer<ArrayBufferLike>>;
|
|
97
97
|
decryptAndSaveFile(message: Message, savePath: string): Promise<void>;
|
|
98
98
|
downloadEncryptedFile: (url: string, outputPath: string, retries?: number) => Promise<void>;
|
|
99
|
-
/**
|
|
100
|
-
* Rejects a call received via WhatsApp
|
|
101
|
-
* @param callId string Call ID, if not passed, all calls will be rejected
|
|
102
|
-
* @returns Number of rejected calls
|
|
103
|
-
*/
|
|
104
|
-
rejectCall(callId?: string): Promise<boolean>;
|
|
105
99
|
}
|
package/dist/api/whatsapp.js
CHANGED
|
@@ -331,15 +331,5 @@ class Whatsapp extends business_layer_1.BusinessLayer {
|
|
|
331
331
|
}
|
|
332
332
|
}
|
|
333
333
|
};
|
|
334
|
-
/**
|
|
335
|
-
* Rejects a call received via WhatsApp
|
|
336
|
-
* @param callId string Call ID, if not passed, all calls will be rejected
|
|
337
|
-
* @returns Number of rejected calls
|
|
338
|
-
*/
|
|
339
|
-
async rejectCall(callId) {
|
|
340
|
-
return await (0, helpers_1.evaluateAndReturn)(this.page, ({ callId }) => WPP.call.rejectCall(callId), {
|
|
341
|
-
callId,
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
334
|
}
|
|
345
335
|
exports.Whatsapp = Whatsapp;
|
|
@@ -188,22 +188,26 @@ async function onLoadingScreen(page, onLoadingScreenCallBack) {
|
|
|
188
188
|
let progressMessage = window2.getElementByXpath(selectors.PROGRESS_MESSAGE);
|
|
189
189
|
let progressMessageNewTheme = window2.getElementByXpath(selectors.PROGRESS_MESSAGE_NEW_THEME);
|
|
190
190
|
if (progressBar) {
|
|
191
|
+
// The progress node and the message node live in sibling subtrees;
|
|
192
|
+
// either lookup can miss while the page is still mounting
|
|
193
|
+
const progressMsg = progressMessage ? progressMessage.innerText : '';
|
|
191
194
|
if (this.lastPercent !== progressBar.value ||
|
|
192
|
-
this.lastPercentMessage !==
|
|
193
|
-
window2.loadingScreen(progressBar.value,
|
|
195
|
+
this.lastPercentMessage !== progressMsg) {
|
|
196
|
+
window2.loadingScreen(progressBar.value, progressMsg);
|
|
194
197
|
this.lastPercent = progressBar.value;
|
|
195
|
-
this.lastPercentMessage =
|
|
198
|
+
this.lastPercentMessage = progressMsg;
|
|
196
199
|
}
|
|
197
200
|
}
|
|
198
201
|
else if (progressBarNewTheme) {
|
|
202
|
+
const progressMsgNew = progressMessageNewTheme &&
|
|
203
|
+
progressMessageNewTheme.innerText != 'WhatsApp'
|
|
204
|
+
? progressMessageNewTheme.innerText
|
|
205
|
+
: '';
|
|
199
206
|
if (this.lastPercent !== progressBarNewTheme.value ||
|
|
200
|
-
this.lastPercentMessage !==
|
|
201
|
-
|
|
202
|
-
? progressMessageNewTheme.innerText
|
|
203
|
-
: '';
|
|
204
|
-
window2.loadingScreen(progressBarNewTheme.value, progressMsg);
|
|
207
|
+
this.lastPercentMessage !== progressMsgNew) {
|
|
208
|
+
window2.loadingScreen(progressBarNewTheme.value, progressMsgNew);
|
|
205
209
|
this.lastPercent = progressBarNewTheme.value;
|
|
206
|
-
this.lastPercentMessage =
|
|
210
|
+
this.lastPercentMessage = progressMsgNew;
|
|
207
211
|
}
|
|
208
212
|
}
|
|
209
213
|
});
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wppconnect-team/wppconnect",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.6",
|
|
4
4
|
"description": "WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination... 😀🤔💭",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
7
10
|
"scripts": {
|
|
8
11
|
"build:client": "tsc",
|
|
9
12
|
"build:wapi": "cd src/lib/wapi/ && webpack",
|
|
@@ -24,6 +27,7 @@
|
|
|
24
27
|
"release": "release-it",
|
|
25
28
|
"start": "npm run build:client && tsc app.ts && node app.js",
|
|
26
29
|
"test": "mocha -r ts-node/register src/tests/**/*.test.ts",
|
|
30
|
+
"test:startup-security": "node --experimental-vm-modules --test test/startup-security.test.cjs",
|
|
27
31
|
"watch": "concurrently \"npm run build:wapi -- --mode=development -w -d eval-source-map\" \"npm run build:client -- -w --sourceMap\""
|
|
28
32
|
},
|
|
29
33
|
"config": {
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
"@babel/core": "^7.29.13",
|
|
59
63
|
"@babel/eslint-parser": "^7.29.13",
|
|
60
64
|
"@babel/eslint-plugin": "^7.29.7",
|
|
61
|
-
"@babel/preset-env": "^7.29.
|
|
65
|
+
"@babel/preset-env": "^7.29.14",
|
|
62
66
|
"@commitlint/cli": "^21.2.4",
|
|
63
67
|
"@commitlint/config-conventional": "^21.2.4",
|
|
64
68
|
"@commitlint/cz-commitlint": "^21.2.4",
|
|
@@ -94,7 +98,7 @@
|
|
|
94
98
|
"webpack-cli": "^6.0.1"
|
|
95
99
|
},
|
|
96
100
|
"dependencies": {
|
|
97
|
-
"@wppconnect/wa-js": "^4.8.
|
|
101
|
+
"@wppconnect/wa-js": "^4.8.2",
|
|
98
102
|
"@wppconnect/wa-version": "^1.5.4472",
|
|
99
103
|
"atob": "^2.1.2",
|
|
100
104
|
"axios": "^1.21.0",
|