@wppconnect-team/wppconnect 1.29.0 → 1.30.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.
@@ -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 (chatId, url, text) {
129
- if (text === void 0) { text = ''; }
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 messageId = _a.messageId;
198
- return __awaiter(_this, void 0, void 0, function () {
199
- var _b, _c, _d, _e;
200
- return __generator(this, function (_f) {
201
- switch (_f.label) {
202
- case 0:
203
- _c = (_b = JSON).parse;
204
- _e = (_d = JSON).stringify;
205
- return [4 /*yield*/, WAPI.getMessageById(messageId)];
206
- case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
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 to = _a.to, base64 = _a.base64, filename = _a.filename, caption = _a.caption, quotedMessageId = _a.quotedMessageId, isViewOnce = _a.isViewOnce;
332
- return __awaiter(_this, void 0, void 0, function () {
333
- var result;
334
- var _b;
335
- return __generator(this, function (_c) {
336
- switch (_c.label) {
337
- case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
338
- type: 'image',
339
- isViewOnce: isViewOnce,
340
- filename: filename,
341
- caption: caption,
342
- quotedMsg: quotedMessageId,
343
- waitForAck: true,
344
- })];
345
- case 1:
346
- result = _c.sent();
347
- _b = {
348
- ack: result.ack,
349
- id: result.id
350
- };
351
- return [4 /*yield*/, result.sendMsgResult];
352
- case 2: return [2 /*return*/, (_b.sendMsgResult = _c.sent(),
353
- _b)];
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 to = _a.to, base64 = _a.base64, filename = _a.filename, caption = _a.caption, quotedMessageId = _a.quotedMessageId, messageId = _a.messageId;
501
- return __awaiter(_this, void 0, void 0, function () {
502
- var result;
503
- var _b;
504
- return __generator(this, function (_c) {
505
- switch (_c.label) {
506
- case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
507
- type: 'audio',
508
- isPtt: true,
509
- filename: filename,
510
- caption: caption,
511
- quotedMsg: quotedMessageId,
512
- waitForAck: true,
513
- messageId: messageId,
514
- })];
515
- case 1:
516
- result = _c.sent();
517
- _b = {
518
- ack: result.ack,
519
- id: result.id
520
- };
521
- return [4 /*yield*/, result.sendMsgResult];
522
- case 2: return [2 /*return*/, (_b.sendMsgResult = _c.sent(),
523
- _b)];
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 to = _a.to, base64 = _a.base64, options = _a.options;
648
- return __awaiter(_this, void 0, void 0, function () {
649
- var result;
650
- var _b;
651
- return __generator(this, function (_c) {
652
- switch (_c.label) {
653
- case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, options)];
654
- case 1:
655
- result = _c.sent();
656
- _b = {
657
- ack: result.ack,
658
- id: result.id
659
- };
660
- return [4 /*yield*/, result.sendMsgResult];
661
- case 2: return [2 /*return*/, (_b.sendMsgResult = _c.sent(),
662
- _b)];
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 to = _a.to, base64 = _a.base64, filename = _a.filename, caption = _a.caption, quotedMessageId = _a.quotedMessageId;
725
- return __awaiter(_this, void 0, void 0, function () {
726
- var result;
727
- var _b;
728
- return __generator(this, function (_c) {
729
- switch (_c.label) {
730
- case 0: return [4 /*yield*/, WPP.chat.sendFileMessage(to, base64, {
731
- type: 'video',
732
- isGif: true,
733
- filename: filename,
734
- caption: caption,
735
- quotedMsg: quotedMessageId,
736
- waitForAck: true,
737
- })];
738
- case 1:
739
- result = _c.sent();
740
- _b = {
741
- ack: result.ack,
742
- id: result.id
743
- };
744
- return [4 /*yield*/, result.sendMsgResult];
745
- case 2: return [2 /*return*/, (_b.sendMsgResult = _c.sent(),
746
- _b)];
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 to = _a.to, options = _a.options;
1043
- return __awaiter(_this, void 0, void 0, function () {
1044
- var result;
1045
- var _b;
1046
- return __generator(this, function (_c) {
1047
- switch (_c.label) {
1048
- case 0: return [4 /*yield*/, WPP.chat.sendLocationMessage(to, options)];
1049
- case 1:
1050
- result = _c.sent();
1051
- _b = {
1052
- ack: result.ack,
1053
- id: result.id
1054
- };
1055
- return [4 /*yield*/, result.sendMsgResult];
1056
- case 2: return [2 /*return*/, (_b.sendMsgResult = _c.sent(),
1057
- _b)];
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 (online) {
1186
- if (online === void 0) { online = true; }
1187
- return __awaiter(this, void 0, void 0, function () {
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 messageId = _a.messageId;
1265
- return __awaiter(_this, void 0, void 0, function () {
1266
- var _b, _c, _d, _e;
1267
- return __generator(this, function (_f) {
1268
- switch (_f.label) {
1269
- case 0:
1270
- _c = (_b = JSON).parse;
1271
- _e = (_d = JSON).stringify;
1272
- return [4 /*yield*/, WAPI.getMessageById(messageId)];
1273
- case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
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 messageId = _a.messageId;
1334
- return __awaiter(_this, void 0, void 0, function () {
1335
- var _b, _c, _d, _e;
1336
- return __generator(this, function (_f) {
1337
- switch (_f.label) {
1338
- case 0:
1339
- _c = (_b = JSON).parse;
1340
- _e = (_d = JSON).stringify;
1341
- return [4 /*yield*/, WAPI.getMessageById(messageId)];
1342
- case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
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 messageId = _a.messageId;
1450
- return __awaiter(_this, void 0, void 0, function () {
1451
- var _b, _c, _d, _e;
1452
- return __generator(this, function (_f) {
1453
- switch (_f.label) {
1454
- case 0:
1455
- _c = (_b = JSON).parse;
1456
- _e = (_d = JSON).stringify;
1457
- return [4 /*yield*/, WAPI.getMessageById(messageId)];
1458
- case 1: return [2 /*return*/, _c.apply(_b, [_e.apply(_d, [_f.sent()])])];
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): Promise<void>;
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): Promise<void>;
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
  */
@@ -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 (chatId, params) {
302
- if (params === void 0) { params = {}; }
303
- return __awaiter(this, void 0, void 0, function () {
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(page, token, clear, version, log) {
190
- if (clear === void 0) { clear = true; }
191
- return __awaiter(this, void 0, void 0, function () {
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)];