@wppconnect-team/wppconnect 1.24.0 → 1.26.0
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/CHANGELOG.md +8 -0
- package/dist/api/helpers/exposed.enum.js +1 -1
- package/dist/api/layers/controls.layer.d.ts +22 -0
- package/dist/api/layers/controls.layer.js +34 -0
- package/dist/api/layers/group.layer.d.ts +37 -2
- package/dist/api/layers/group.layer.js +60 -1
- package/dist/api/layers/host.layer.d.ts +11 -0
- package/dist/api/layers/host.layer.js +29 -0
- package/dist/api/layers/listener.layer.d.ts +13 -0
- package/dist/api/layers/listener.layer.js +25 -0
- package/dist/api/layers/sender.layer.d.ts +4 -2
- package/dist/api/layers/sender.layer.js +8 -5
- package/dist/api/model/enum/ack-type.js +1 -1
- package/dist/api/model/enum/chat-state.js +1 -1
- package/dist/api/model/enum/group-notification-type.js +1 -1
- package/dist/api/model/enum/group-property.js +1 -1
- package/dist/api/model/enum/interface-mode.js +1 -1
- package/dist/api/model/enum/interface-state.js +1 -1
- package/dist/api/model/enum/message-type.js +2 -2
- package/dist/api/model/enum/socket-state.js +2 -2
- package/dist/api/model/enum/status-find.js +1 -1
- package/dist/api/model/label.d.ts +7 -0
- package/dist/api/model/label.js +2 -0
- package/dist/api/whatsapp.d.ts +5 -0
- package/dist/api/whatsapp.js +17 -0
- package/dist/controllers/browser.js +1 -1
- package/package.json +19 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# 1.26.0 (2023-06-01)
|
|
2
|
+
|
|
3
|
+
# 1.25.0 (2023-05-30)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- **deps:** update dependency @wppconnect/wa-version to ^1.2.42 ([#1700](https://github.com/wppconnect-team/wppconnect/issues/1700)) ([1c07a4b](https://github.com/wppconnect-team/wppconnect/commit/1c07a4b410037dbb748749e9faefde0fc4f04903))
|
|
8
|
+
|
|
1
9
|
# 1.24.0 (2023-04-29)
|
|
2
10
|
|
|
3
11
|
## 1.23.2 (2023-04-03)
|
|
@@ -30,4 +30,4 @@ var ExposedFn;
|
|
|
30
30
|
ExposedFn["onInterfaceChange"] = "onInterfaceChange";
|
|
31
31
|
ExposedFn["onPresenceChanged"] = "onPresenceChanged";
|
|
32
32
|
ExposedFn["onLiveLocation"] = "onLiveLocation";
|
|
33
|
-
})(ExposedFn
|
|
33
|
+
})(ExposedFn || (exports.ExposedFn = ExposedFn = {}));
|
|
@@ -94,4 +94,26 @@ export declare class ControlsLayer extends UILayer {
|
|
|
94
94
|
* @returns boolean
|
|
95
95
|
*/
|
|
96
96
|
setTemporaryMessages(chatOrGroupId: string, value: boolean): Promise<boolean>;
|
|
97
|
+
/**
|
|
98
|
+
* Change limits of whatsapp web
|
|
99
|
+
* * @example
|
|
100
|
+
* ```javascript
|
|
101
|
+
* //Change the maximum size (bytes) for uploading media (max 70MB)
|
|
102
|
+
* WPP.conn.setLimit('maxMediaSize',16777216);
|
|
103
|
+
*
|
|
104
|
+
* //Change the maximum size (bytes) for uploading files (max 1GB)
|
|
105
|
+
* WPP.conn.setLimit('maxFileSize',104857600);
|
|
106
|
+
*
|
|
107
|
+
* //Change the maximum number of contacts that can be selected when sharing (Default 5)
|
|
108
|
+
* WPP.conn.setLimit('maxShare',100);
|
|
109
|
+
*
|
|
110
|
+
* //Change the maximum time (seconds) of a video status
|
|
111
|
+
* WPP.conn.setLimit('statusVideoMaxDuration',120);
|
|
112
|
+
*
|
|
113
|
+
* //Remove pinned conversation limit (only whatsapp web) (Default 3)
|
|
114
|
+
* WPP.conn.setLimit('unlimitedPin',true);
|
|
115
|
+
* ```
|
|
116
|
+
* @category Chat
|
|
117
|
+
*/
|
|
118
|
+
setLimit(key: 'maxMediaSize' | 'maxFileSize' | 'maxShare' | 'statusVideoMaxDuration' | 'unlimitedPin', value: boolean | number): Promise<number>;
|
|
97
119
|
}
|
|
@@ -303,6 +303,40 @@ var ControlsLayer = /** @class */ (function (_super) {
|
|
|
303
303
|
});
|
|
304
304
|
});
|
|
305
305
|
};
|
|
306
|
+
/**
|
|
307
|
+
* Change limits of whatsapp web
|
|
308
|
+
* * @example
|
|
309
|
+
* ```javascript
|
|
310
|
+
* //Change the maximum size (bytes) for uploading media (max 70MB)
|
|
311
|
+
* WPP.conn.setLimit('maxMediaSize',16777216);
|
|
312
|
+
*
|
|
313
|
+
* //Change the maximum size (bytes) for uploading files (max 1GB)
|
|
314
|
+
* WPP.conn.setLimit('maxFileSize',104857600);
|
|
315
|
+
*
|
|
316
|
+
* //Change the maximum number of contacts that can be selected when sharing (Default 5)
|
|
317
|
+
* WPP.conn.setLimit('maxShare',100);
|
|
318
|
+
*
|
|
319
|
+
* //Change the maximum time (seconds) of a video status
|
|
320
|
+
* WPP.conn.setLimit('statusVideoMaxDuration',120);
|
|
321
|
+
*
|
|
322
|
+
* //Remove pinned conversation limit (only whatsapp web) (Default 3)
|
|
323
|
+
* WPP.conn.setLimit('unlimitedPin',true);
|
|
324
|
+
* ```
|
|
325
|
+
* @category Chat
|
|
326
|
+
*/
|
|
327
|
+
ControlsLayer.prototype.setLimit = function (key, value) {
|
|
328
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
329
|
+
return __generator(this, function (_a) {
|
|
330
|
+
switch (_a.label) {
|
|
331
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
332
|
+
var key = _a.key, value = _a.value;
|
|
333
|
+
return WPP.conn.setLimit(key, value);
|
|
334
|
+
}, { key: key, value: value })];
|
|
335
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
336
|
+
}
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
};
|
|
306
340
|
return ControlsLayer;
|
|
307
341
|
}(ui_layer_1.UILayer));
|
|
308
342
|
exports.ControlsLayer = ControlsLayer;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Page } from 'puppeteer';
|
|
2
2
|
import { CreateConfig } from '../../config/create-config';
|
|
3
|
-
import { Id } from '../model';
|
|
3
|
+
import { Id, Wid } from '../model';
|
|
4
4
|
import { GroupProperty } from '../model/enum';
|
|
5
5
|
import { RetrieverLayer } from './retriever.layer';
|
|
6
6
|
export declare class GroupLayer extends RetrieverLayer {
|
|
@@ -163,7 +163,7 @@ export declare class GroupLayer extends RetrieverLayer {
|
|
|
163
163
|
*/
|
|
164
164
|
setGroupProperty(groupId: string, property: GroupProperty, value: boolean): Promise<boolean>;
|
|
165
165
|
/**
|
|
166
|
-
* Set group
|
|
166
|
+
* Set group icon
|
|
167
167
|
* @category Group
|
|
168
168
|
* @param groupId Group ID ('000000-000000@g.us')
|
|
169
169
|
* @param base64 Image in base64 ( data:image/jpeg;base64,..... )
|
|
@@ -189,4 +189,39 @@ export declare class GroupLayer extends RetrieverLayer {
|
|
|
189
189
|
* @returns number
|
|
190
190
|
*/
|
|
191
191
|
getGroupSizeLimit(): Promise<number>;
|
|
192
|
+
/**
|
|
193
|
+
* Approve a membership request to group
|
|
194
|
+
* @category Group
|
|
195
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
196
|
+
* @param wid <number>@c.us
|
|
197
|
+
* @returns Promise
|
|
198
|
+
*/
|
|
199
|
+
approveGroupMembershipRequest(groupId: string, membershipIds: string | string[]): Promise<{
|
|
200
|
+
error: any;
|
|
201
|
+
wid: Wid;
|
|
202
|
+
}[]>;
|
|
203
|
+
/**
|
|
204
|
+
* Reject a membership request to group
|
|
205
|
+
* @category Group
|
|
206
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
207
|
+
* @param wid <number>@c.us
|
|
208
|
+
* @returns Promise
|
|
209
|
+
*/
|
|
210
|
+
rejectGroupMembershipRequest(groupId: string, membershipIds: string | string[]): Promise<{
|
|
211
|
+
error: any;
|
|
212
|
+
wid: Wid;
|
|
213
|
+
}[]>;
|
|
214
|
+
/**
|
|
215
|
+
* Retrieve a list of a membership approval requests
|
|
216
|
+
* @category Group
|
|
217
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
218
|
+
* @returns Promise
|
|
219
|
+
*/
|
|
220
|
+
getGroupMembershipRequests(groupId: string): Promise<{
|
|
221
|
+
addedBy: Wid;
|
|
222
|
+
id: Wid;
|
|
223
|
+
parentGroupId?: Wid;
|
|
224
|
+
requestMethod: 'InviteLink' | 'LinkedGroupJoin' | 'NonAdminAdd';
|
|
225
|
+
t: number;
|
|
226
|
+
}[]>;
|
|
192
227
|
}
|
|
@@ -385,7 +385,7 @@ var GroupLayer = /** @class */ (function (_super) {
|
|
|
385
385
|
});
|
|
386
386
|
};
|
|
387
387
|
/**
|
|
388
|
-
* Set group
|
|
388
|
+
* Set group icon
|
|
389
389
|
* @category Group
|
|
390
390
|
* @param groupId Group ID ('000000-000000@g.us')
|
|
391
391
|
* @param base64 Image in base64 ( data:image/jpeg;base64,..... )
|
|
@@ -485,6 +485,65 @@ var GroupLayer = /** @class */ (function (_super) {
|
|
|
485
485
|
});
|
|
486
486
|
});
|
|
487
487
|
};
|
|
488
|
+
/**
|
|
489
|
+
* Approve a membership request to group
|
|
490
|
+
* @category Group
|
|
491
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
492
|
+
* @param wid <number>@c.us
|
|
493
|
+
* @returns Promise
|
|
494
|
+
*/
|
|
495
|
+
GroupLayer.prototype.approveGroupMembershipRequest = function (groupId, membershipIds) {
|
|
496
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
497
|
+
return __generator(this, function (_a) {
|
|
498
|
+
switch (_a.label) {
|
|
499
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
500
|
+
var groupId = _a.groupId, membershipIds = _a.membershipIds;
|
|
501
|
+
return WPP.group.approve(groupId, membershipIds);
|
|
502
|
+
}, { groupId: groupId, membershipIds: membershipIds })];
|
|
503
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
});
|
|
507
|
+
};
|
|
508
|
+
/**
|
|
509
|
+
* Reject a membership request to group
|
|
510
|
+
* @category Group
|
|
511
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
512
|
+
* @param wid <number>@c.us
|
|
513
|
+
* @returns Promise
|
|
514
|
+
*/
|
|
515
|
+
GroupLayer.prototype.rejectGroupMembershipRequest = function (groupId, membershipIds) {
|
|
516
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
517
|
+
return __generator(this, function (_a) {
|
|
518
|
+
switch (_a.label) {
|
|
519
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
520
|
+
var groupId = _a.groupId, membershipIds = _a.membershipIds;
|
|
521
|
+
return WPP.group.reject(groupId, membershipIds);
|
|
522
|
+
}, { groupId: groupId, membershipIds: membershipIds })];
|
|
523
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
524
|
+
}
|
|
525
|
+
});
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Retrieve a list of a membership approval requests
|
|
530
|
+
* @category Group
|
|
531
|
+
* @param groupId Group ID ('000000-000000@g.us')
|
|
532
|
+
* @returns Promise
|
|
533
|
+
*/
|
|
534
|
+
GroupLayer.prototype.getGroupMembershipRequests = function (groupId) {
|
|
535
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
536
|
+
return __generator(this, function (_a) {
|
|
537
|
+
switch (_a.label) {
|
|
538
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
539
|
+
var groupId = _a.groupId;
|
|
540
|
+
return WPP.group.getMembershipRequests(groupId);
|
|
541
|
+
}, { groupId: groupId })];
|
|
542
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
});
|
|
546
|
+
};
|
|
488
547
|
return GroupLayer;
|
|
489
548
|
}(retriever_layer_1.RetrieverLayer));
|
|
490
549
|
exports.GroupLayer = GroupLayer;
|
|
@@ -71,6 +71,11 @@ export declare class HostLayer {
|
|
|
71
71
|
* @category Host
|
|
72
72
|
*/
|
|
73
73
|
isConnected(): Promise<boolean>;
|
|
74
|
+
/**
|
|
75
|
+
* Check is online
|
|
76
|
+
* @category Host
|
|
77
|
+
*/
|
|
78
|
+
isOnline(): Promise<boolean>;
|
|
74
79
|
/**
|
|
75
80
|
* Retrieves if the phone is online. Please note that this may not be real time.
|
|
76
81
|
* @category Host
|
|
@@ -118,4 +123,10 @@ export declare class HostLayer {
|
|
|
118
123
|
* @category Host
|
|
119
124
|
*/
|
|
120
125
|
isMainInit(): Promise<boolean>;
|
|
126
|
+
/**
|
|
127
|
+
* Join or leave of WhatsApp Web beta program.
|
|
128
|
+
* Will return the value seted
|
|
129
|
+
* @category Host
|
|
130
|
+
*/
|
|
131
|
+
joinWebBeta(value: boolean): Promise<boolean>;
|
|
121
132
|
}
|
|
@@ -597,6 +597,20 @@ var HostLayer = /** @class */ (function () {
|
|
|
597
597
|
});
|
|
598
598
|
});
|
|
599
599
|
};
|
|
600
|
+
/**
|
|
601
|
+
* Check is online
|
|
602
|
+
* @category Host
|
|
603
|
+
*/
|
|
604
|
+
HostLayer.prototype.isOnline = function () {
|
|
605
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
606
|
+
return __generator(this, function (_a) {
|
|
607
|
+
switch (_a.label) {
|
|
608
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.conn.isOnline(); })];
|
|
609
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
});
|
|
613
|
+
};
|
|
600
614
|
/**
|
|
601
615
|
* Retrieves if the phone is online. Please note that this may not be real time.
|
|
602
616
|
* @category Host
|
|
@@ -726,6 +740,21 @@ var HostLayer = /** @class */ (function () {
|
|
|
726
740
|
});
|
|
727
741
|
});
|
|
728
742
|
};
|
|
743
|
+
/**
|
|
744
|
+
* Join or leave of WhatsApp Web beta program.
|
|
745
|
+
* Will return the value seted
|
|
746
|
+
* @category Host
|
|
747
|
+
*/
|
|
748
|
+
HostLayer.prototype.joinWebBeta = function (value) {
|
|
749
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
750
|
+
return __generator(this, function (_a) {
|
|
751
|
+
switch (_a.label) {
|
|
752
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (value) { return WPP.conn.joinWebBeta(value); }, value)];
|
|
753
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
754
|
+
}
|
|
755
|
+
});
|
|
756
|
+
});
|
|
757
|
+
};
|
|
729
758
|
return HostLayer;
|
|
730
759
|
}());
|
|
731
760
|
exports.HostLayer = HostLayer;
|
|
@@ -5,6 +5,7 @@ import { SocketState, SocketStream } from '../model/enum';
|
|
|
5
5
|
import { InterfaceMode } from '../model/enum/interface-mode';
|
|
6
6
|
import { InterfaceState } from '../model/enum/interface-state';
|
|
7
7
|
import { ProfileLayer } from './profile.layer';
|
|
8
|
+
import { Label } from '../model/label';
|
|
8
9
|
declare global {
|
|
9
10
|
interface Window {
|
|
10
11
|
onMessage: any;
|
|
@@ -225,4 +226,16 @@ export declare class ListenerLayer extends ProfileLayer {
|
|
|
225
226
|
}) => any): {
|
|
226
227
|
dispose: () => void;
|
|
227
228
|
};
|
|
229
|
+
/**
|
|
230
|
+
* @event Listens to update label
|
|
231
|
+
* @returns Disposable object to stop the listening
|
|
232
|
+
*/
|
|
233
|
+
onUpdateLabel(callback: (data: {
|
|
234
|
+
chat: Chat;
|
|
235
|
+
ids: string[];
|
|
236
|
+
labels: Label[];
|
|
237
|
+
type: 'add' | 'remove';
|
|
238
|
+
}) => any): {
|
|
239
|
+
dispose: () => void;
|
|
240
|
+
};
|
|
228
241
|
}
|
|
@@ -125,6 +125,7 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
125
125
|
'onRevokedMessage',
|
|
126
126
|
'onReactionMessage',
|
|
127
127
|
'onPollResponse',
|
|
128
|
+
'onUpdateLabel',
|
|
128
129
|
], false);
|
|
129
130
|
_loop_1 = function (func) {
|
|
130
131
|
var has;
|
|
@@ -343,6 +344,23 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
343
344
|
catch (error) {
|
|
344
345
|
console.error(error);
|
|
345
346
|
}
|
|
347
|
+
try {
|
|
348
|
+
if (!window['onUpdateLabel'].exposed) {
|
|
349
|
+
WPP.on('chat.update_label', function (data) {
|
|
350
|
+
var eventData = {
|
|
351
|
+
chat: data.chat,
|
|
352
|
+
ids: data.ids,
|
|
353
|
+
labels: data.labels,
|
|
354
|
+
type: data.type,
|
|
355
|
+
};
|
|
356
|
+
window['onUpdateLabel'](eventData);
|
|
357
|
+
});
|
|
358
|
+
window['onUpdateLabel'].exposed = true;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
console.error(error);
|
|
363
|
+
}
|
|
346
364
|
try {
|
|
347
365
|
if (!window['onParticipantsChanged'].exposed) {
|
|
348
366
|
WPP.on('group.participant_changed', function (participantChangedEvent) {
|
|
@@ -575,6 +593,13 @@ var ListenerLayer = /** @class */ (function (_super) {
|
|
|
575
593
|
ListenerLayer.prototype.onPollResponse = function (callback) {
|
|
576
594
|
return this.registerEvent('onPollResponse', callback);
|
|
577
595
|
};
|
|
596
|
+
/**
|
|
597
|
+
* @event Listens to update label
|
|
598
|
+
* @returns Disposable object to stop the listening
|
|
599
|
+
*/
|
|
600
|
+
ListenerLayer.prototype.onUpdateLabel = function (callback) {
|
|
601
|
+
return this.registerEvent('onUpdateLabel', callback);
|
|
602
|
+
};
|
|
578
603
|
return ListenerLayer;
|
|
579
604
|
}(profile_layer_1.ProfileLayer));
|
|
580
605
|
exports.ListenerLayer = ListenerLayer;
|
|
@@ -132,8 +132,9 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
132
132
|
* @param filename
|
|
133
133
|
* @param caption
|
|
134
134
|
* @param quotedMessageId Quoted message id
|
|
135
|
+
* @param messageId Set the id for this message
|
|
135
136
|
*/
|
|
136
|
-
sendPttFromBase64(to: string, base64: string, filename: string, caption?: string, quotedMessageId?: string): Promise<{
|
|
137
|
+
sendPttFromBase64(to: string, base64: string, filename: string, caption?: string, quotedMessageId?: string, messageId?: string): Promise<{
|
|
137
138
|
ack: number;
|
|
138
139
|
id: string;
|
|
139
140
|
sendMsgResult: import("@wppconnect/wa-js/dist/whatsapp/enums").SendMsgResult;
|
|
@@ -146,8 +147,9 @@ export declare class SenderLayer extends ListenerLayer {
|
|
|
146
147
|
* @param filename
|
|
147
148
|
* @param caption
|
|
148
149
|
* @param quotedMessageId Quoted message id
|
|
150
|
+
* @param messageId Set the id for this message
|
|
149
151
|
*/
|
|
150
|
-
sendPtt(to: string, filePath: string, filename?: string, caption?: string, quotedMessageId?: string): Promise<unknown>;
|
|
152
|
+
sendPtt(to: string, filePath: string, filename?: string, caption?: string, quotedMessageId?: string, messageId?: string): Promise<unknown>;
|
|
151
153
|
/**
|
|
152
154
|
* Sends file
|
|
153
155
|
* base64 parameter should have mime type already defined
|
|
@@ -488,15 +488,16 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
488
488
|
* @param filename
|
|
489
489
|
* @param caption
|
|
490
490
|
* @param quotedMessageId Quoted message id
|
|
491
|
+
* @param messageId Set the id for this message
|
|
491
492
|
*/
|
|
492
|
-
SenderLayer.prototype.sendPttFromBase64 = function (to, base64, filename, caption, quotedMessageId) {
|
|
493
|
+
SenderLayer.prototype.sendPttFromBase64 = function (to, base64, filename, caption, quotedMessageId, messageId) {
|
|
493
494
|
return __awaiter(this, void 0, void 0, function () {
|
|
494
495
|
var result;
|
|
495
496
|
var _this = this;
|
|
496
497
|
return __generator(this, function (_a) {
|
|
497
498
|
switch (_a.label) {
|
|
498
499
|
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
499
|
-
var to = _a.to, base64 = _a.base64, filename = _a.filename, caption = _a.caption, quotedMessageId = _a.quotedMessageId;
|
|
500
|
+
var to = _a.to, base64 = _a.base64, filename = _a.filename, caption = _a.caption, quotedMessageId = _a.quotedMessageId, messageId = _a.messageId;
|
|
500
501
|
return __awaiter(_this, void 0, void 0, function () {
|
|
501
502
|
var result;
|
|
502
503
|
var _b;
|
|
@@ -509,6 +510,7 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
509
510
|
caption: caption,
|
|
510
511
|
quotedMsg: quotedMessageId,
|
|
511
512
|
waitForAck: true,
|
|
513
|
+
messageId: messageId,
|
|
512
514
|
})];
|
|
513
515
|
case 1:
|
|
514
516
|
result = _c.sent();
|
|
@@ -522,7 +524,7 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
522
524
|
}
|
|
523
525
|
});
|
|
524
526
|
});
|
|
525
|
-
}, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId })];
|
|
527
|
+
}, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId, messageId: messageId })];
|
|
526
528
|
case 1:
|
|
527
529
|
result = _a.sent();
|
|
528
530
|
return [2 /*return*/, result];
|
|
@@ -538,8 +540,9 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
538
540
|
* @param filename
|
|
539
541
|
* @param caption
|
|
540
542
|
* @param quotedMessageId Quoted message id
|
|
543
|
+
* @param messageId Set the id for this message
|
|
541
544
|
*/
|
|
542
|
-
SenderLayer.prototype.sendPtt = function (to, filePath, filename, caption, quotedMessageId) {
|
|
545
|
+
SenderLayer.prototype.sendPtt = function (to, filePath, filename, caption, quotedMessageId, messageId) {
|
|
543
546
|
return __awaiter(this, void 0, void 0, function () {
|
|
544
547
|
var _this = this;
|
|
545
548
|
return __generator(this, function (_a) {
|
|
@@ -567,7 +570,7 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
567
570
|
if (!filename) {
|
|
568
571
|
filename = path.basename(filePath);
|
|
569
572
|
}
|
|
570
|
-
return [2 /*return*/, this.sendPttFromBase64(to, base64, filename, caption, quotedMessageId)
|
|
573
|
+
return [2 /*return*/, this.sendPttFromBase64(to, base64, filename, caption, quotedMessageId, messageId)
|
|
571
574
|
.then(resolve)
|
|
572
575
|
.catch(reject)];
|
|
573
576
|
}
|
|
@@ -22,4 +22,4 @@ var ChatState;
|
|
|
22
22
|
ChatState[ChatState["Typing"] = 0] = "Typing";
|
|
23
23
|
ChatState[ChatState["Recording"] = 1] = "Recording";
|
|
24
24
|
ChatState[ChatState["Paused"] = 2] = "Paused";
|
|
25
|
-
})(ChatState
|
|
25
|
+
})(ChatState || (exports.ChatState = ChatState = {}));
|
|
@@ -28,4 +28,4 @@ var GroupNotificationType;
|
|
|
28
28
|
GroupNotificationType["Picture"] = "picture";
|
|
29
29
|
GroupNotificationType["Announce"] = "announce";
|
|
30
30
|
GroupNotificationType["Restrict"] = "restrict";
|
|
31
|
-
})(GroupNotificationType
|
|
31
|
+
})(GroupNotificationType || (exports.GroupNotificationType = GroupNotificationType = {}));
|
|
@@ -51,4 +51,4 @@ var InterfaceState;
|
|
|
51
51
|
* When the whatsapp web couldn't connect to smartphone.
|
|
52
52
|
*/
|
|
53
53
|
InterfaceState["TIMEOUT"] = "TIMEOUT";
|
|
54
|
-
})(InterfaceState
|
|
54
|
+
})(InterfaceState || (exports.InterfaceState = InterfaceState = {}));
|
|
@@ -54,7 +54,7 @@ var MessageType;
|
|
|
54
54
|
MessageType["LIST_RESPONSE"] = "list_response";
|
|
55
55
|
MessageType["BUTTONS_RESPONSE"] = "buttons_response";
|
|
56
56
|
MessageType["UNKNOWN"] = "unknown";
|
|
57
|
-
})(MessageType
|
|
57
|
+
})(MessageType || (exports.MessageType = MessageType = {}));
|
|
58
58
|
var MediaType;
|
|
59
59
|
(function (MediaType) {
|
|
60
60
|
MediaType["IMAGE"] = "Image";
|
|
@@ -63,4 +63,4 @@ var MediaType;
|
|
|
63
63
|
MediaType["PTT"] = "Audio";
|
|
64
64
|
MediaType["DOCUMENT"] = "Document";
|
|
65
65
|
MediaType["STICKER"] = "Image";
|
|
66
|
-
})(MediaType
|
|
66
|
+
})(MediaType || (exports.MediaType = MediaType = {}));
|
|
@@ -70,7 +70,7 @@ var SocketState;
|
|
|
70
70
|
* Disconnected page with expired QRCode
|
|
71
71
|
*/
|
|
72
72
|
SocketState["UNPAIRED_IDLE"] = "UNPAIRED_IDLE";
|
|
73
|
-
})(SocketState
|
|
73
|
+
})(SocketState || (exports.SocketState = SocketState = {}));
|
|
74
74
|
/**
|
|
75
75
|
* SocketStream are the possible states of connection between WhatsApp page and WhatsApp servers.
|
|
76
76
|
*/
|
|
@@ -92,4 +92,4 @@ var SocketStream;
|
|
|
92
92
|
* Receiving data from WhatsApp servers
|
|
93
93
|
*/
|
|
94
94
|
SocketStream["SYNCING"] = "SYNCING";
|
|
95
|
-
})(SocketStream
|
|
95
|
+
})(SocketStream || (exports.SocketStream = SocketStream = {}));
|
package/dist/api/whatsapp.d.ts
CHANGED
|
@@ -25,6 +25,11 @@ export declare class Whatsapp extends BusinessLayer {
|
|
|
25
25
|
* @returns The Whatsapp page
|
|
26
26
|
*/
|
|
27
27
|
get waPage(): Page;
|
|
28
|
+
/**
|
|
29
|
+
* Get the puppeteer page screenshot
|
|
30
|
+
* @returns The Whatsapp page screenshot encoded in base64
|
|
31
|
+
*/
|
|
32
|
+
takeScreenshot(): Promise<string>;
|
|
28
33
|
/**
|
|
29
34
|
* Clicks on 'use here' button (When it get unlaunched)
|
|
30
35
|
* This method tracks the class of the button
|
package/dist/api/whatsapp.js
CHANGED
|
@@ -198,6 +198,23 @@ var Whatsapp = /** @class */ (function (_super) {
|
|
|
198
198
|
enumerable: false,
|
|
199
199
|
configurable: true
|
|
200
200
|
});
|
|
201
|
+
/**
|
|
202
|
+
* Get the puppeteer page screenshot
|
|
203
|
+
* @returns The Whatsapp page screenshot encoded in base64
|
|
204
|
+
*/
|
|
205
|
+
Whatsapp.prototype.takeScreenshot = function () {
|
|
206
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
207
|
+
return __generator(this, function (_a) {
|
|
208
|
+
switch (_a.label) {
|
|
209
|
+
case 0:
|
|
210
|
+
if (!this.page) return [3 /*break*/, 2];
|
|
211
|
+
return [4 /*yield*/, this.page.screenshot({ encoding: 'base64' })];
|
|
212
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
213
|
+
case 2: return [2 /*return*/];
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
};
|
|
201
218
|
/**
|
|
202
219
|
* Clicks on 'use here' button (When it get unlaunched)
|
|
203
220
|
* This method tracks the class of the button
|
|
@@ -378,7 +378,7 @@ function initBrowser(session, options, logger) {
|
|
|
378
378
|
case 2:
|
|
379
379
|
browser = _a.sent();
|
|
380
380
|
return [3 /*break*/, 5];
|
|
381
|
-
case 3: return [4 /*yield*/, puppeteer_extra_1.default.launch(__assign({ headless: options.headless, devtools: options.devtools, args: options.browserArgs
|
|
381
|
+
case 3: return [4 /*yield*/, puppeteer_extra_1.default.launch(__assign({ headless: options.headless ? 'new' : false, devtools: options.devtools, args: options.browserArgs
|
|
382
382
|
? options.browserArgs
|
|
383
383
|
: __spreadArray([], puppeteer_config_1.puppeteerConfig.chromiumArgs, true) }, options.puppeteerOptions))];
|
|
384
384
|
case 4:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wppconnect-team/wppconnect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.0",
|
|
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",
|
|
@@ -54,30 +54,30 @@
|
|
|
54
54
|
},
|
|
55
55
|
"homepage": "https://github.com/wppconnect-team/wppconnect#readme",
|
|
56
56
|
"devDependencies": {
|
|
57
|
-
"@babel/core": "^7.
|
|
58
|
-
"@babel/eslint-parser": "^7.21.
|
|
57
|
+
"@babel/core": "^7.22.1",
|
|
58
|
+
"@babel/eslint-parser": "^7.21.8",
|
|
59
59
|
"@babel/eslint-plugin": "^7.19.1",
|
|
60
|
-
"@babel/preset-env": "^7.
|
|
61
|
-
"@commitlint/cli": "^17.6.
|
|
62
|
-
"@commitlint/config-conventional": "^17.6.
|
|
60
|
+
"@babel/preset-env": "^7.22.4",
|
|
61
|
+
"@commitlint/cli": "^17.6.5",
|
|
62
|
+
"@commitlint/config-conventional": "^17.6.5",
|
|
63
63
|
"@commitlint/cz-commitlint": "^17.5.0",
|
|
64
64
|
"@knodes/typedoc-plugin-pages": "^0.23.4",
|
|
65
65
|
"@types/atob": "^2.1.2",
|
|
66
66
|
"@types/mime-types": "^2.1.1",
|
|
67
67
|
"@types/mocha": "^10.0.1",
|
|
68
|
-
"@types/node": "^18.16.
|
|
68
|
+
"@types/node": "^18.16.16",
|
|
69
69
|
"@types/rimraf": "^3.0.2",
|
|
70
70
|
"@types/sharp": "^0.31.1",
|
|
71
71
|
"@types/shelljs": "^0.8.12",
|
|
72
72
|
"@types/tmp": "^0.2.3",
|
|
73
73
|
"@types/ws": "^8.5.4",
|
|
74
|
-
"@typescript-eslint/eslint-plugin": "^5.59.
|
|
75
|
-
"@typescript-eslint/parser": "^5.59.
|
|
74
|
+
"@typescript-eslint/eslint-plugin": "^5.59.8",
|
|
75
|
+
"@typescript-eslint/parser": "^5.59.8",
|
|
76
76
|
"babel-loader": "^9.1.2",
|
|
77
77
|
"commitizen": "^4.3.0",
|
|
78
|
-
"concurrently": "^8.0
|
|
78
|
+
"concurrently": "^8.1.0",
|
|
79
79
|
"conventional-changelog-cli": "^2.2.2",
|
|
80
|
-
"eslint": "^8.
|
|
80
|
+
"eslint": "^8.41.0",
|
|
81
81
|
"eslint-config-prettier": "^8.8.0",
|
|
82
82
|
"eslint-plugin-header": "^3.1.1",
|
|
83
83
|
"eslint-plugin-prettier": "^4.2.1",
|
|
@@ -86,17 +86,17 @@
|
|
|
86
86
|
"prettier": "^2.8.8",
|
|
87
87
|
"pretty-quick": "^3.1.3",
|
|
88
88
|
"regenerator-runtime": "^0.13.11",
|
|
89
|
-
"release-it": "^15.10.
|
|
89
|
+
"release-it": "^15.10.3",
|
|
90
90
|
"shx": "^0.3.4",
|
|
91
91
|
"ts-node": "^10.9.1",
|
|
92
92
|
"typedoc": "^0.23.28",
|
|
93
|
-
"typescript": "^5.
|
|
94
|
-
"webpack": "^5.
|
|
95
|
-
"webpack-cli": "^5.
|
|
93
|
+
"typescript": "^5.1.3",
|
|
94
|
+
"webpack": "^5.85.0",
|
|
95
|
+
"webpack-cli": "^5.1.1"
|
|
96
96
|
},
|
|
97
97
|
"dependencies": {
|
|
98
|
-
"@wppconnect/wa-js": "^2.
|
|
99
|
-
"@wppconnect/wa-version": "^1.2.
|
|
98
|
+
"@wppconnect/wa-js": "^2.24.2",
|
|
99
|
+
"@wppconnect/wa-version": "^1.2.43",
|
|
100
100
|
"atob": "^2.1.2",
|
|
101
101
|
"axios": "^1.4.0",
|
|
102
102
|
"boxen": "^5.1.2",
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"logform": "^2.5.1",
|
|
111
111
|
"lookpath": "^1.2.2",
|
|
112
112
|
"mime-types": "^2.1.35",
|
|
113
|
-
"puppeteer": "^
|
|
113
|
+
"puppeteer": "^20.5.0",
|
|
114
114
|
"puppeteer-extra": "^3.3.6",
|
|
115
115
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
116
116
|
"puppeteer-extra-plugin-user-data-dir": "^2.4.1",
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"sharp": "^0.32.1",
|
|
123
123
|
"tmp": "^0.2.1",
|
|
124
124
|
"tree-kill": "^1.2.2",
|
|
125
|
-
"winston": "^3.
|
|
125
|
+
"winston": "^3.9.0",
|
|
126
126
|
"ws": "^8.13.0"
|
|
127
127
|
},
|
|
128
128
|
"optionalDependencies": {
|