@wppconnect-team/wppconnect 1.29.0 → 1.30.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 +4 -0
- package/dist/api/helpers/download-file.js +3 -3
- package/dist/api/layers/business.layer.js +24 -28
- package/dist/api/layers/controls.layer.js +28 -30
- package/dist/api/layers/group.layer.d.ts +1 -1
- package/dist/api/layers/group.layer.js +1 -3
- package/dist/api/layers/host.layer.d.ts +3 -1
- package/dist/api/layers/host.layer.js +59 -12
- package/dist/api/layers/retriever.layer.js +42 -46
- package/dist/api/layers/sender.layer.js +166 -184
- package/dist/api/layers/status.layer.d.ts +18 -2
- package/dist/api/layers/status.layer.js +15 -4
- package/dist/api/model/initializer.d.ts +8 -0
- package/dist/api/whatsapp.js +3 -3
- package/dist/config/create-config.d.ts +5 -1
- package/dist/config/puppeteer.config.js +2 -0
- package/dist/controllers/browser.js +3 -3
- package/dist/controllers/initializer.d.ts +2 -2
- package/dist/controllers/initializer.js +4 -2
- package/dist/lib/wapi/wapi.js +1 -1
- package/package.json +20 -19
|
@@ -125,10 +125,10 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
125
125
|
* @param url string A link, for example for youtube. e.g https://www.youtube.com/watch?v=Zi_XLOBDo_Y&list=RDEMe12_MlgO8mGFdeeftZ2nOQ&start_radio=1
|
|
126
126
|
* @param text custom text as the message body, this includes the link or will be attached after the link
|
|
127
127
|
*/
|
|
128
|
-
SenderLayer.prototype.sendLinkPreview = function (
|
|
129
|
-
|
|
130
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
128
|
+
SenderLayer.prototype.sendLinkPreview = function (chatId_1, url_1) {
|
|
129
|
+
return __awaiter(this, arguments, void 0, function (chatId, url, text) {
|
|
131
130
|
var message, result;
|
|
131
|
+
if (text === void 0) { text = ''; }
|
|
132
132
|
return __generator(this, function (_a) {
|
|
133
133
|
switch (_a.label) {
|
|
134
134
|
case 0:
|
|
@@ -193,21 +193,19 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
193
193
|
}, { to: to, content: content, options: options })];
|
|
194
194
|
case 1:
|
|
195
195
|
sendResult = _a.sent();
|
|
196
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
197
|
-
var
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
208
|
-
});
|
|
196
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
197
|
+
var _c, _d, _e, _f;
|
|
198
|
+
var messageId = _b.messageId;
|
|
199
|
+
return __generator(this, function (_g) {
|
|
200
|
+
switch (_g.label) {
|
|
201
|
+
case 0:
|
|
202
|
+
_d = (_c = JSON).parse;
|
|
203
|
+
_f = (_e = JSON).stringify;
|
|
204
|
+
return [4 /*yield*/, WAPI.getMessageById(messageId)];
|
|
205
|
+
case 1: return [2 /*return*/, _d.apply(_c, [_f.apply(_e, [_g.sent()])])];
|
|
206
|
+
}
|
|
209
207
|
});
|
|
210
|
-
}, { messageId: sendResult.id })];
|
|
208
|
+
}); }, { messageId: sendResult.id })];
|
|
211
209
|
case 2:
|
|
212
210
|
result = (_a.sent());
|
|
213
211
|
if (result['erro'] == true) {
|
|
@@ -327,34 +325,32 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
327
325
|
throw obj;
|
|
328
326
|
}
|
|
329
327
|
filename = (0, filename_from_mimetype_1.filenameFromMimeType)(filename, mimeType);
|
|
330
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
331
|
-
var
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
}
|
|
355
|
-
});
|
|
328
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
329
|
+
var result;
|
|
330
|
+
var _c;
|
|
331
|
+
var to = _b.to, base64 = _b.base64, filename = _b.filename, caption = _b.caption, quotedMessageId = _b.quotedMessageId, isViewOnce = _b.isViewOnce;
|
|
332
|
+
return __generator(this, function (_d) {
|
|
333
|
+
switch (_d.label) {
|
|
334
|
+
case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
|
|
335
|
+
type: 'image',
|
|
336
|
+
isViewOnce: isViewOnce,
|
|
337
|
+
filename: filename,
|
|
338
|
+
caption: caption,
|
|
339
|
+
quotedMsg: quotedMessageId,
|
|
340
|
+
waitForAck: true,
|
|
341
|
+
})];
|
|
342
|
+
case 1:
|
|
343
|
+
result = _d.sent();
|
|
344
|
+
_c = {
|
|
345
|
+
ack: result.ack,
|
|
346
|
+
id: result.id
|
|
347
|
+
};
|
|
348
|
+
return [4 /*yield*/, result.sendMsgResult];
|
|
349
|
+
case 2: return [2 /*return*/, (_c.sendMsgResult = _d.sent(),
|
|
350
|
+
_c)];
|
|
351
|
+
}
|
|
356
352
|
});
|
|
357
|
-
}, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId, isViewOnce: isViewOnce })];
|
|
353
|
+
}); }, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId, isViewOnce: isViewOnce })];
|
|
358
354
|
case 1:
|
|
359
355
|
result = _a.sent();
|
|
360
356
|
return [2 /*return*/, result];
|
|
@@ -496,35 +492,33 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
496
492
|
var _this = this;
|
|
497
493
|
return __generator(this, function (_a) {
|
|
498
494
|
switch (_a.label) {
|
|
499
|
-
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
500
|
-
var
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
}
|
|
525
|
-
});
|
|
495
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
496
|
+
var result;
|
|
497
|
+
var _c;
|
|
498
|
+
var to = _b.to, base64 = _b.base64, filename = _b.filename, caption = _b.caption, quotedMessageId = _b.quotedMessageId, messageId = _b.messageId;
|
|
499
|
+
return __generator(this, function (_d) {
|
|
500
|
+
switch (_d.label) {
|
|
501
|
+
case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
|
|
502
|
+
type: 'audio',
|
|
503
|
+
isPtt: true,
|
|
504
|
+
filename: filename,
|
|
505
|
+
caption: caption,
|
|
506
|
+
quotedMsg: quotedMessageId,
|
|
507
|
+
waitForAck: true,
|
|
508
|
+
messageId: messageId,
|
|
509
|
+
})];
|
|
510
|
+
case 1:
|
|
511
|
+
result = _d.sent();
|
|
512
|
+
_c = {
|
|
513
|
+
ack: result.ack,
|
|
514
|
+
id: result.id
|
|
515
|
+
};
|
|
516
|
+
return [4 /*yield*/, result.sendMsgResult];
|
|
517
|
+
case 2: return [2 /*return*/, (_c.sendMsgResult = _d.sent(),
|
|
518
|
+
_c)];
|
|
519
|
+
}
|
|
526
520
|
});
|
|
527
|
-
}, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId, messageId: messageId })];
|
|
521
|
+
}); }, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId, messageId: messageId })];
|
|
528
522
|
case 1:
|
|
529
523
|
result = _a.sent();
|
|
530
524
|
return [2 /*return*/, result];
|
|
@@ -643,27 +637,25 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
643
637
|
});
|
|
644
638
|
throw error;
|
|
645
639
|
}
|
|
646
|
-
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
647
|
-
var
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
}
|
|
664
|
-
});
|
|
640
|
+
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
641
|
+
var result;
|
|
642
|
+
var _c;
|
|
643
|
+
var to = _b.to, base64 = _b.base64, options = _b.options;
|
|
644
|
+
return __generator(this, function (_d) {
|
|
645
|
+
switch (_d.label) {
|
|
646
|
+
case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, options)];
|
|
647
|
+
case 1:
|
|
648
|
+
result = _d.sent();
|
|
649
|
+
_c = {
|
|
650
|
+
ack: result.ack,
|
|
651
|
+
id: result.id
|
|
652
|
+
};
|
|
653
|
+
return [4 /*yield*/, result.sendMsgResult];
|
|
654
|
+
case 2: return [2 /*return*/, (_c.sendMsgResult = _d.sent(),
|
|
655
|
+
_c)];
|
|
656
|
+
}
|
|
665
657
|
});
|
|
666
|
-
}, { to: to, base64: base64, options: options })];
|
|
658
|
+
}); }, { to: to, base64: base64, options: options })];
|
|
667
659
|
}
|
|
668
660
|
});
|
|
669
661
|
});
|
|
@@ -720,34 +712,32 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
720
712
|
var _this = this;
|
|
721
713
|
return __generator(this, function (_a) {
|
|
722
714
|
switch (_a.label) {
|
|
723
|
-
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
724
|
-
var
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
}
|
|
748
|
-
});
|
|
715
|
+
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
716
|
+
var result;
|
|
717
|
+
var _c;
|
|
718
|
+
var to = _b.to, base64 = _b.base64, filename = _b.filename, caption = _b.caption, quotedMessageId = _b.quotedMessageId;
|
|
719
|
+
return __generator(this, function (_d) {
|
|
720
|
+
switch (_d.label) {
|
|
721
|
+
case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
|
|
722
|
+
type: 'video',
|
|
723
|
+
isGif: true,
|
|
724
|
+
filename: filename,
|
|
725
|
+
caption: caption,
|
|
726
|
+
quotedMsg: quotedMessageId,
|
|
727
|
+
waitForAck: true,
|
|
728
|
+
})];
|
|
729
|
+
case 1:
|
|
730
|
+
result = _d.sent();
|
|
731
|
+
_c = {
|
|
732
|
+
ack: result.ack,
|
|
733
|
+
id: result.id
|
|
734
|
+
};
|
|
735
|
+
return [4 /*yield*/, result.sendMsgResult];
|
|
736
|
+
case 2: return [2 /*return*/, (_c.sendMsgResult = _d.sent(),
|
|
737
|
+
_c)];
|
|
738
|
+
}
|
|
749
739
|
});
|
|
750
|
-
}, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId })];
|
|
740
|
+
}); }, { to: to, base64: base64, filename: filename, caption: caption, quotedMessageId: quotedMessageId })];
|
|
751
741
|
case 1:
|
|
752
742
|
result = _a.sent();
|
|
753
743
|
return [2 /*return*/, result];
|
|
@@ -1038,27 +1028,25 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
1038
1028
|
title: title,
|
|
1039
1029
|
}
|
|
1040
1030
|
: latitudeOrOptions;
|
|
1041
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
}
|
|
1059
|
-
});
|
|
1031
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
1032
|
+
var result;
|
|
1033
|
+
var _c;
|
|
1034
|
+
var to = _b.to, options = _b.options;
|
|
1035
|
+
return __generator(this, function (_d) {
|
|
1036
|
+
switch (_d.label) {
|
|
1037
|
+
case 0: return [4 /*yield*/, WPP.chat.sendLocationMessage(to, options)];
|
|
1038
|
+
case 1:
|
|
1039
|
+
result = _d.sent();
|
|
1040
|
+
_c = {
|
|
1041
|
+
ack: result.ack,
|
|
1042
|
+
id: result.id
|
|
1043
|
+
};
|
|
1044
|
+
return [4 /*yield*/, result.sendMsgResult];
|
|
1045
|
+
case 2: return [2 /*return*/, (_c.sendMsgResult = _d.sent(),
|
|
1046
|
+
_c)];
|
|
1047
|
+
}
|
|
1060
1048
|
});
|
|
1061
|
-
}, { to: to, options: options })];
|
|
1049
|
+
}); }, { to: to, options: options })];
|
|
1062
1050
|
case 1: return [2 /*return*/, _a.sent()];
|
|
1063
1051
|
}
|
|
1064
1052
|
});
|
|
@@ -1182,9 +1170,9 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
1182
1170
|
* @category Chat
|
|
1183
1171
|
* @param online true for available presence and false for unavailable
|
|
1184
1172
|
*/
|
|
1185
|
-
SenderLayer.prototype.setOnlinePresence = function (
|
|
1186
|
-
|
|
1187
|
-
|
|
1173
|
+
SenderLayer.prototype.setOnlinePresence = function () {
|
|
1174
|
+
return __awaiter(this, arguments, void 0, function (online) {
|
|
1175
|
+
if (online === void 0) { online = true; }
|
|
1188
1176
|
return __generator(this, function (_a) {
|
|
1189
1177
|
return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
1190
1178
|
var online = _a.online;
|
|
@@ -1260,21 +1248,19 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
1260
1248
|
})];
|
|
1261
1249
|
case 1:
|
|
1262
1250
|
sendResult = _a.sent();
|
|
1263
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
1264
|
-
var
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
}
|
|
1275
|
-
});
|
|
1251
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
1252
|
+
var _c, _d, _e, _f;
|
|
1253
|
+
var messageId = _b.messageId;
|
|
1254
|
+
return __generator(this, function (_g) {
|
|
1255
|
+
switch (_g.label) {
|
|
1256
|
+
case 0:
|
|
1257
|
+
_d = (_c = JSON).parse;
|
|
1258
|
+
_f = (_e = JSON).stringify;
|
|
1259
|
+
return [4 /*yield*/, WAPI.getMessageById(messageId)];
|
|
1260
|
+
case 1: return [2 /*return*/, _d.apply(_c, [_f.apply(_e, [_g.sent()])])];
|
|
1261
|
+
}
|
|
1276
1262
|
});
|
|
1277
|
-
}, { messageId: sendResult.id })];
|
|
1263
|
+
}); }, { messageId: sendResult.id })];
|
|
1278
1264
|
case 2:
|
|
1279
1265
|
result = (_a.sent());
|
|
1280
1266
|
if (result['erro'] == true) {
|
|
@@ -1329,21 +1315,19 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
1329
1315
|
})];
|
|
1330
1316
|
case 1:
|
|
1331
1317
|
sendResult = _a.sent();
|
|
1332
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
1333
|
-
var
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
}
|
|
1344
|
-
});
|
|
1318
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
1319
|
+
var _c, _d, _e, _f;
|
|
1320
|
+
var messageId = _b.messageId;
|
|
1321
|
+
return __generator(this, function (_g) {
|
|
1322
|
+
switch (_g.label) {
|
|
1323
|
+
case 0:
|
|
1324
|
+
_d = (_c = JSON).parse;
|
|
1325
|
+
_f = (_e = JSON).stringify;
|
|
1326
|
+
return [4 /*yield*/, WAPI.getMessageById(messageId)];
|
|
1327
|
+
case 1: return [2 /*return*/, _d.apply(_c, [_f.apply(_e, [_g.sent()])])];
|
|
1328
|
+
}
|
|
1345
1329
|
});
|
|
1346
|
-
}, { messageId: sendResult.id })];
|
|
1330
|
+
}); }, { messageId: sendResult.id })];
|
|
1347
1331
|
case 2:
|
|
1348
1332
|
result = (_a.sent());
|
|
1349
1333
|
if (result['erro'] == true) {
|
|
@@ -1445,21 +1429,19 @@ var SenderLayer = /** @class */ (function (_super) {
|
|
|
1445
1429
|
})];
|
|
1446
1430
|
case 1:
|
|
1447
1431
|
sendResult = _a.sent();
|
|
1448
|
-
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
1449
|
-
var
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
}
|
|
1460
|
-
});
|
|
1432
|
+
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
1433
|
+
var _c, _d, _e, _f;
|
|
1434
|
+
var messageId = _b.messageId;
|
|
1435
|
+
return __generator(this, function (_g) {
|
|
1436
|
+
switch (_g.label) {
|
|
1437
|
+
case 0:
|
|
1438
|
+
_d = (_c = JSON).parse;
|
|
1439
|
+
_f = (_e = JSON).stringify;
|
|
1440
|
+
return [4 /*yield*/, WAPI.getMessageById(messageId)];
|
|
1441
|
+
case 1: return [2 /*return*/, _d.apply(_c, [_f.apply(_e, [_g.sent()])])];
|
|
1442
|
+
}
|
|
1461
1443
|
});
|
|
1462
|
-
}, { messageId: sendResult.id })];
|
|
1444
|
+
}); }, { messageId: sendResult.id })];
|
|
1463
1445
|
case 2:
|
|
1464
1446
|
result = (_a.sent());
|
|
1465
1447
|
if (result['erro'] == true) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Page } from 'puppeteer';
|
|
2
2
|
import { CreateConfig } from '../../config/create-config';
|
|
3
3
|
import { LabelsLayer } from './labels.layer';
|
|
4
|
+
import { SendStatusOptions } from '@wppconnect/wa-js/dist/status';
|
|
4
5
|
export declare class StatusLayer extends LabelsLayer {
|
|
5
6
|
page: Page;
|
|
6
7
|
constructor(page: Page, session?: string, options?: CreateConfig);
|
|
@@ -12,9 +13,17 @@ export declare class StatusLayer extends LabelsLayer {
|
|
|
12
13
|
* ```javascript
|
|
13
14
|
* client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>');
|
|
14
15
|
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```javascript
|
|
19
|
+
* // Send with caption
|
|
20
|
+
* client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>', { caption: 'example test' } );
|
|
21
|
+
* ```
|
|
15
22
|
* @param pathOrBase64 Path or base 64 image
|
|
16
23
|
*/
|
|
17
|
-
sendImageStatus(pathOrBase64: string
|
|
24
|
+
sendImageStatus(pathOrBase64: string, options?: SendStatusOptions & {
|
|
25
|
+
caption?: string;
|
|
26
|
+
}): Promise<void>;
|
|
18
27
|
/**
|
|
19
28
|
* Send a video message to status stories
|
|
20
29
|
* @category Status
|
|
@@ -23,9 +32,16 @@ export declare class StatusLayer extends LabelsLayer {
|
|
|
23
32
|
* ```javascript
|
|
24
33
|
* client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>');
|
|
25
34
|
* ```
|
|
35
|
+
* @example
|
|
36
|
+
* ```javascript
|
|
37
|
+
* // Send with caption
|
|
38
|
+
* client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>', { caption: 'example test' } );
|
|
39
|
+
* ```
|
|
26
40
|
* @param pathOrBase64 Path or base 64 image
|
|
27
41
|
*/
|
|
28
|
-
sendVideoStatus(pathOrBase64: string
|
|
42
|
+
sendVideoStatus(pathOrBase64: string, options?: SendStatusOptions & {
|
|
43
|
+
caption?: string;
|
|
44
|
+
}): Promise<void>;
|
|
29
45
|
/**
|
|
30
46
|
* Send a text to status stories
|
|
31
47
|
* @category Status
|
|
@@ -85,9 +85,15 @@ var StatusLayer = /** @class */ (function (_super) {
|
|
|
85
85
|
* ```javascript
|
|
86
86
|
* client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>');
|
|
87
87
|
* ```
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```javascript
|
|
91
|
+
* // Send with caption
|
|
92
|
+
* client.sendImageStatus('data:image/jpeg;base64,<a long base64 file...>', { caption: 'example test' } );
|
|
93
|
+
* ```
|
|
88
94
|
* @param pathOrBase64 Path or base 64 image
|
|
89
95
|
*/
|
|
90
|
-
StatusLayer.prototype.sendImageStatus = function (pathOrBase64) {
|
|
96
|
+
StatusLayer.prototype.sendImageStatus = function (pathOrBase64, options) {
|
|
91
97
|
return __awaiter(this, void 0, void 0, function () {
|
|
92
98
|
var base64, fileContent, error, mimeInfo, error;
|
|
93
99
|
return __generator(this, function (_a) {
|
|
@@ -134,7 +140,7 @@ var StatusLayer = /** @class */ (function (_super) {
|
|
|
134
140
|
}
|
|
135
141
|
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
136
142
|
var base64 = _a.base64;
|
|
137
|
-
WPP.status.sendImageStatus(base64);
|
|
143
|
+
WPP.status.sendImageStatus(base64, options);
|
|
138
144
|
}, { base64: base64 })];
|
|
139
145
|
case 6: return [2 /*return*/, _a.sent()];
|
|
140
146
|
}
|
|
@@ -149,9 +155,14 @@ var StatusLayer = /** @class */ (function (_super) {
|
|
|
149
155
|
* ```javascript
|
|
150
156
|
* client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>');
|
|
151
157
|
* ```
|
|
158
|
+
* @example
|
|
159
|
+
* ```javascript
|
|
160
|
+
* // Send with caption
|
|
161
|
+
* client.sendVideoStatus('data:video/mp4;base64,<a long base64 file...>', { caption: 'example test' } );
|
|
162
|
+
* ```
|
|
152
163
|
* @param pathOrBase64 Path or base 64 image
|
|
153
164
|
*/
|
|
154
|
-
StatusLayer.prototype.sendVideoStatus = function (pathOrBase64) {
|
|
165
|
+
StatusLayer.prototype.sendVideoStatus = function (pathOrBase64, options) {
|
|
155
166
|
return __awaiter(this, void 0, void 0, function () {
|
|
156
167
|
var base64, fileContent, error;
|
|
157
168
|
return __generator(this, function (_a) {
|
|
@@ -184,7 +195,7 @@ var StatusLayer = /** @class */ (function (_super) {
|
|
|
184
195
|
}
|
|
185
196
|
return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
186
197
|
var base64 = _a.base64;
|
|
187
|
-
WPP.status.sendVideoStatus(base64);
|
|
198
|
+
WPP.status.sendVideoStatus(base64, options);
|
|
188
199
|
}, { base64: base64 })];
|
|
189
200
|
case 6: return [2 /*return*/, _a.sent()];
|
|
190
201
|
}
|
|
@@ -13,6 +13,10 @@ export type StatusFindCallback = (status: StatusFind | keyof typeof StatusFind,
|
|
|
13
13
|
* A callback will be received, informing data as percentage and loading screen message
|
|
14
14
|
*/
|
|
15
15
|
export type LoadingScreenCallback = (percent: number, message: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* A callback will be received, informing a code to you connect
|
|
18
|
+
*/
|
|
19
|
+
export type LinkByCodeCallback = (code: string) => void;
|
|
16
20
|
export interface CreateOptions extends CreateConfig {
|
|
17
21
|
/**
|
|
18
22
|
* You must pass a string type parameter, this parameter will be the name of the client's session. If the parameter is not passed, the section name will be "session".
|
|
@@ -22,6 +26,10 @@ export interface CreateOptions extends CreateConfig {
|
|
|
22
26
|
* A callback will be received, informing the status of the qrcode
|
|
23
27
|
*/
|
|
24
28
|
catchQR?: CatchQRCallback;
|
|
29
|
+
/**
|
|
30
|
+
* A callback will be received, informing a code to you connect
|
|
31
|
+
*/
|
|
32
|
+
catchLinkCode?: LinkByCodeCallback;
|
|
25
33
|
/**
|
|
26
34
|
* A callback will be received, informing the customer's status
|
|
27
35
|
*/
|
package/dist/api/whatsapp.js
CHANGED
|
@@ -298,9 +298,9 @@ var Whatsapp = /** @class */ (function (_super) {
|
|
|
298
298
|
* @param params GetMessagesParam Opções de filtragem de resultados (count, id, direction) veja {@link GetMessagesParam}.
|
|
299
299
|
* @returns Message object
|
|
300
300
|
*/
|
|
301
|
-
Whatsapp.prototype.getMessages = function (
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
Whatsapp.prototype.getMessages = function (chatId_1) {
|
|
302
|
+
return __awaiter(this, arguments, void 0, function (chatId, params) {
|
|
303
|
+
if (params === void 0) { params = {}; }
|
|
304
304
|
return __generator(this, function (_a) {
|
|
305
305
|
switch (_a.label) {
|
|
306
306
|
case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
|
|
@@ -6,7 +6,7 @@ export interface CreateConfig {
|
|
|
6
6
|
* Headless chrome
|
|
7
7
|
* @default true
|
|
8
8
|
*/
|
|
9
|
-
headless?: boolean;
|
|
9
|
+
headless?: boolean | 'shell';
|
|
10
10
|
/**
|
|
11
11
|
* Open devtools by default
|
|
12
12
|
* @default false
|
|
@@ -138,5 +138,9 @@ export interface CreateConfig {
|
|
|
138
138
|
* @default 'WPPConnect'
|
|
139
139
|
*/
|
|
140
140
|
poweredBy?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Insert the phone number for connect by link phone, qr code not wil generate
|
|
143
|
+
*/
|
|
144
|
+
phoneNumber?: string;
|
|
141
145
|
}
|
|
142
146
|
export declare const defaultOptions: CreateConfig;
|
|
@@ -55,6 +55,8 @@ var puppeteerConfig = {
|
|
|
55
55
|
'--disable-app-list-dismiss-on-blur',
|
|
56
56
|
'--disable-accelerated-video-decode',
|
|
57
57
|
'--disable-dev-shm-usage',
|
|
58
|
+
'--autoplay-policy=no-user-gesture-required',
|
|
59
|
+
'--disable-blink-features=AutomationControlled',
|
|
58
60
|
],
|
|
59
61
|
};
|
|
60
62
|
exports.puppeteerConfig = puppeteerConfig;
|
|
@@ -186,9 +186,9 @@ function setWhatsappVersion(page, version, log) {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
exports.setWhatsappVersion = setWhatsappVersion;
|
|
189
|
-
function initWhatsapp(
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
function initWhatsapp(page_1, token_1) {
|
|
190
|
+
return __awaiter(this, arguments, void 0, function (page, token, clear, version, log) {
|
|
191
|
+
if (clear === void 0) { clear = true; }
|
|
192
192
|
return __generator(this, function (_a) {
|
|
193
193
|
switch (_a.label) {
|
|
194
194
|
case 0: return [4 /*yield*/, page.setUserAgent(WAuserAgente_1.useragentOverride)];
|