@wppconnect-team/wppconnect 2.0.0 → 2.0.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/api/helpers/base64-mimetype.js +2 -2
  3. package/dist/api/helpers/decrypt.js +65 -72
  4. package/dist/api/helpers/download-file.js +31 -81
  5. package/dist/api/helpers/evaluate-and-return.js +98 -93
  6. package/dist/api/helpers/file-to-base64.js +30 -81
  7. package/dist/api/helpers/filename-from-mimetype.js +4 -4
  8. package/dist/api/helpers/scrape-img-qr.js +37 -86
  9. package/dist/api/helpers/scrape-login.js +12 -57
  10. package/dist/api/helpers/select-sticker.js +35 -100
  11. package/dist/api/layers/business.layer.js +29 -134
  12. package/dist/api/layers/catalog.layer.js +59 -210
  13. package/dist/api/layers/community.layer.js +29 -120
  14. package/dist/api/layers/controls.layer.js +62 -262
  15. package/dist/api/layers/group.layer.js +126 -391
  16. package/dist/api/layers/host.layer.js +348 -702
  17. package/dist/api/layers/labels.layer.js +35 -131
  18. package/dist/api/layers/listener.layer.js +386 -504
  19. package/dist/api/layers/newsletter.layer.js +20 -89
  20. package/dist/api/layers/profile.layer.js +73 -184
  21. package/dist/api/layers/retriever.layer.js +161 -468
  22. package/dist/api/layers/sender.layer.js +554 -1094
  23. package/dist/api/layers/status.layer.js +80 -179
  24. package/dist/api/layers/ui.layer.js +32 -129
  25. package/dist/api/model/enum/definitions.js +1 -1
  26. package/dist/api/whatsapp.js +200 -437
  27. package/dist/config/WAuserAgente.js +1 -1
  28. package/dist/config/create-config.js +1 -1
  29. package/dist/config/puppeteer.config.js +1 -1
  30. package/dist/controllers/auth.js +42 -110
  31. package/dist/controllers/browser.js +251 -411
  32. package/dist/controllers/initializer.js +171 -265
  33. package/dist/controllers/websocket.js +29 -28
  34. package/dist/controllers/welcome.js +38 -88
  35. package/dist/token-store/fileTokenStore.js +83 -173
  36. package/dist/token-store/isValidSessionToken.js +2 -2
  37. package/dist/token-store/isValidTokenStore.js +2 -2
  38. package/dist/token-store/memoryTokenStore.js +11 -14
  39. package/dist/utils/ffmpeg.js +75 -131
  40. package/dist/utils/logger.js +5 -5
  41. package/dist/utils/semver.js +6 -6
  42. package/dist/utils/sleep.js +1 -1
  43. package/package.json +6 -6
@@ -15,67 +15,15 @@
15
15
  * You should have received a copy of the GNU Lesser General Public License
16
16
  * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
- var __extends = (this && this.__extends) || (function () {
19
- var extendStatics = function (d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
- return function (d, b) {
26
- if (typeof b !== "function" && b !== null)
27
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28
- extendStatics(d, b);
29
- function __() { this.constructor = d; }
30
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31
- };
32
- })();
33
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
34
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
- return new (P || (P = Promise))(function (resolve, reject) {
36
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
- step((generator = generator.apply(thisArg, _arguments || [])).next());
40
- });
41
- };
42
- var __generator = (this && this.__generator) || function (thisArg, body) {
43
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
44
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
45
- function verb(n) { return function (v) { return step([n, v]); }; }
46
- function step(op) {
47
- if (f) throw new TypeError("Generator is already executing.");
48
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
49
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
50
- if (y = 0, t) op = [op[0] & 2, t.value];
51
- switch (op[0]) {
52
- case 0: case 1: t = op; break;
53
- case 4: _.label++; return { value: op[1], done: false };
54
- case 5: _.label++; y = op[1]; op = [0]; continue;
55
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
56
- default:
57
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
58
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
60
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
61
- if (t[2]) _.ops.pop();
62
- _.trys.pop(); continue;
63
- }
64
- op = body.call(thisArg, _);
65
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
66
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67
- }
68
- };
69
18
  Object.defineProperty(exports, "__esModule", { value: true });
70
19
  exports.StatusLayer = void 0;
71
- var labels_layer_1 = require("./labels.layer");
72
- var helpers_1 = require("../helpers");
73
- var StatusLayer = /** @class */ (function (_super) {
74
- __extends(StatusLayer, _super);
75
- function StatusLayer(page, session, options) {
76
- var _this = _super.call(this, page, session, options) || this;
77
- _this.page = page;
78
- return _this;
20
+ const labels_layer_1 = require("./labels.layer");
21
+ const helpers_1 = require("../helpers");
22
+ class StatusLayer extends labels_layer_1.LabelsLayer {
23
+ page;
24
+ constructor(page, session, options) {
25
+ super(page, session, options);
26
+ this.page = page;
79
27
  }
80
28
  /**
81
29
  * Send a image message to status stories
@@ -93,60 +41,45 @@ var StatusLayer = /** @class */ (function (_super) {
93
41
  * ```
94
42
  * @param pathOrBase64 Path or base 64 image
95
43
  */
96
- StatusLayer.prototype.sendImageStatus = function (pathOrBase64, options) {
97
- return __awaiter(this, void 0, void 0, function () {
98
- var base64, fileContent, error, mimeInfo, error;
99
- return __generator(this, function (_a) {
100
- switch (_a.label) {
101
- case 0:
102
- base64 = '';
103
- if (!pathOrBase64.startsWith('data:')) return [3 /*break*/, 1];
104
- base64 = pathOrBase64;
105
- return [3 /*break*/, 5];
106
- case 1: return [4 /*yield*/, (0, helpers_1.downloadFileToBase64)(pathOrBase64, [
107
- 'image/gif',
108
- 'image/png',
109
- 'image/jpg',
110
- 'image/jpeg',
111
- 'image/webp',
112
- ])];
113
- case 2:
114
- fileContent = _a.sent();
115
- if (!!fileContent) return [3 /*break*/, 4];
116
- return [4 /*yield*/, (0, helpers_1.fileToBase64)(pathOrBase64)];
117
- case 3:
118
- fileContent = _a.sent();
119
- _a.label = 4;
120
- case 4:
121
- if (fileContent) {
122
- base64 = fileContent;
123
- }
124
- _a.label = 5;
125
- case 5:
126
- if (!base64) {
127
- error = new Error('Empty or invalid file or base64');
128
- Object.assign(error, {
129
- code: 'empty_file',
130
- });
131
- throw error;
132
- }
133
- mimeInfo = (0, helpers_1.base64MimeType)(base64);
134
- if (!mimeInfo || !mimeInfo.includes('image')) {
135
- error = new Error('Not an image, allowed formats png, jpeg and webp');
136
- Object.assign(error, {
137
- code: 'invalid_image',
138
- });
139
- throw error;
140
- }
141
- return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
142
- var base64 = _a.base64, options = _a.options;
143
- WPP.status.sendImageStatus(base64, options);
144
- }, { base64: base64, options: options })];
145
- case 6: return [2 /*return*/, _a.sent()];
146
- }
44
+ async sendImageStatus(pathOrBase64, options) {
45
+ let base64 = '';
46
+ if (pathOrBase64.startsWith('data:')) {
47
+ base64 = pathOrBase64;
48
+ }
49
+ else {
50
+ let fileContent = await (0, helpers_1.downloadFileToBase64)(pathOrBase64, [
51
+ 'image/gif',
52
+ 'image/png',
53
+ 'image/jpg',
54
+ 'image/jpeg',
55
+ 'image/webp',
56
+ ]);
57
+ if (!fileContent) {
58
+ fileContent = await (0, helpers_1.fileToBase64)(pathOrBase64);
59
+ }
60
+ if (fileContent) {
61
+ base64 = fileContent;
62
+ }
63
+ }
64
+ if (!base64) {
65
+ const error = new Error('Empty or invalid file or base64');
66
+ Object.assign(error, {
67
+ code: 'empty_file',
147
68
  });
148
- });
149
- };
69
+ throw error;
70
+ }
71
+ const mimeInfo = (0, helpers_1.base64MimeType)(base64);
72
+ if (!mimeInfo || !mimeInfo.includes('image')) {
73
+ const error = new Error('Not an image, allowed formats png, jpeg and webp');
74
+ Object.assign(error, {
75
+ code: 'invalid_image',
76
+ });
77
+ throw error;
78
+ }
79
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ base64, options }) => {
80
+ WPP.status.sendImageStatus(base64, options);
81
+ }, { base64, options });
82
+ }
150
83
  /**
151
84
  * Send a video message to status stories
152
85
  * @category Status
@@ -162,46 +95,31 @@ var StatusLayer = /** @class */ (function (_super) {
162
95
  * ```
163
96
  * @param pathOrBase64 Path or base 64 image
164
97
  */
165
- StatusLayer.prototype.sendVideoStatus = function (pathOrBase64, options) {
166
- return __awaiter(this, void 0, void 0, function () {
167
- var base64, fileContent, error;
168
- return __generator(this, function (_a) {
169
- switch (_a.label) {
170
- case 0:
171
- base64 = '';
172
- if (!pathOrBase64.startsWith('data:')) return [3 /*break*/, 1];
173
- base64 = pathOrBase64;
174
- return [3 /*break*/, 5];
175
- case 1: return [4 /*yield*/, (0, helpers_1.downloadFileToBase64)(pathOrBase64)];
176
- case 2:
177
- fileContent = _a.sent();
178
- if (!!fileContent) return [3 /*break*/, 4];
179
- return [4 /*yield*/, (0, helpers_1.fileToBase64)(pathOrBase64)];
180
- case 3:
181
- fileContent = _a.sent();
182
- _a.label = 4;
183
- case 4:
184
- if (fileContent) {
185
- base64 = fileContent;
186
- }
187
- _a.label = 5;
188
- case 5:
189
- if (!base64) {
190
- error = new Error('Empty or invalid file or base64');
191
- Object.assign(error, {
192
- code: 'empty_file',
193
- });
194
- throw error;
195
- }
196
- return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
197
- var base64 = _a.base64, options = _a.options;
198
- WPP.status.sendVideoStatus(base64, options);
199
- }, { base64: base64, options: options })];
200
- case 6: return [2 /*return*/, _a.sent()];
201
- }
98
+ async sendVideoStatus(pathOrBase64, options) {
99
+ let base64 = '';
100
+ if (pathOrBase64.startsWith('data:')) {
101
+ base64 = pathOrBase64;
102
+ }
103
+ else {
104
+ let fileContent = await (0, helpers_1.downloadFileToBase64)(pathOrBase64);
105
+ if (!fileContent) {
106
+ fileContent = await (0, helpers_1.fileToBase64)(pathOrBase64);
107
+ }
108
+ if (fileContent) {
109
+ base64 = fileContent;
110
+ }
111
+ }
112
+ if (!base64) {
113
+ const error = new Error('Empty or invalid file or base64');
114
+ Object.assign(error, {
115
+ code: 'empty_file',
202
116
  });
203
- });
204
- };
117
+ throw error;
118
+ }
119
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ base64, options }) => {
120
+ WPP.status.sendVideoStatus(base64, options);
121
+ }, { base64, options });
122
+ }
205
123
  /**
206
124
  * Send a text to status stories
207
125
  * @category Status
@@ -212,19 +130,11 @@ var StatusLayer = /** @class */ (function (_super) {
212
130
  * ```
213
131
  * @param pathOrBase64 Path or base 64 image
214
132
  */
215
- StatusLayer.prototype.sendTextStatus = function (text, options) {
216
- return __awaiter(this, void 0, void 0, function () {
217
- return __generator(this, function (_a) {
218
- switch (_a.label) {
219
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
220
- var text = _a.text, options = _a.options;
221
- WPP.status.sendTextStatus(text, options);
222
- }, { text: text, options: options })];
223
- case 1: return [2 /*return*/, _a.sent()];
224
- }
225
- });
226
- });
227
- };
133
+ async sendTextStatus(text, options) {
134
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ text, options }) => {
135
+ WPP.status.sendTextStatus(text, options);
136
+ }, { text, options });
137
+ }
228
138
  /**
229
139
  * Mark status as read/seen
230
140
  * @category Status
@@ -236,19 +146,10 @@ var StatusLayer = /** @class */ (function (_super) {
236
146
  * @param chatId Chat ID of contact
237
147
  * @param statusId ID of status msg
238
148
  */
239
- StatusLayer.prototype.sendReadStatus = function (chatId, statusId) {
240
- return __awaiter(this, void 0, void 0, function () {
241
- return __generator(this, function (_a) {
242
- switch (_a.label) {
243
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
244
- var chatId = _a.chatId, statusId = _a.statusId;
245
- WPP.status.sendReadStatus(chatId, statusId);
246
- }, { chatId: chatId, statusId: statusId })];
247
- case 1: return [2 /*return*/, _a.sent()];
248
- }
249
- });
250
- });
251
- };
252
- return StatusLayer;
253
- }(labels_layer_1.LabelsLayer));
149
+ async sendReadStatus(chatId, statusId) {
150
+ return await (0, helpers_1.evaluateAndReturn)(this.page, ({ chatId, statusId }) => {
151
+ WPP.status.sendReadStatus(chatId, statusId);
152
+ }, { chatId, statusId });
153
+ }
154
+ }
254
155
  exports.StatusLayer = StatusLayer;
@@ -15,67 +15,15 @@
15
15
  * You should have received a copy of the GNU Lesser General Public License
16
16
  * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
- var __extends = (this && this.__extends) || (function () {
19
- var extendStatics = function (d, b) {
20
- extendStatics = Object.setPrototypeOf ||
21
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
22
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
23
- return extendStatics(d, b);
24
- };
25
- return function (d, b) {
26
- if (typeof b !== "function" && b !== null)
27
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
28
- extendStatics(d, b);
29
- function __() { this.constructor = d; }
30
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
31
- };
32
- })();
33
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
34
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
35
- return new (P || (P = Promise))(function (resolve, reject) {
36
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
37
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
38
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
39
- step((generator = generator.apply(thisArg, _arguments || [])).next());
40
- });
41
- };
42
- var __generator = (this && this.__generator) || function (thisArg, body) {
43
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
44
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
45
- function verb(n) { return function (v) { return step([n, v]); }; }
46
- function step(op) {
47
- if (f) throw new TypeError("Generator is already executing.");
48
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
49
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
50
- if (y = 0, t) op = [op[0] & 2, t.value];
51
- switch (op[0]) {
52
- case 0: case 1: t = op; break;
53
- case 4: _.label++; return { value: op[1], done: false };
54
- case 5: _.label++; y = op[1]; op = [0]; continue;
55
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
56
- default:
57
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
58
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
59
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
60
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
61
- if (t[2]) _.ops.pop();
62
- _.trys.pop(); continue;
63
- }
64
- op = body.call(thisArg, _);
65
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
66
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
67
- }
68
- };
69
18
  Object.defineProperty(exports, "__esModule", { value: true });
70
19
  exports.UILayer = void 0;
71
- var helpers_1 = require("../helpers");
72
- var group_layer_1 = require("./group.layer");
73
- var UILayer = /** @class */ (function (_super) {
74
- __extends(UILayer, _super);
75
- function UILayer(page, session, options) {
76
- var _this = _super.call(this, page, session, options) || this;
77
- _this.page = page;
78
- return _this;
20
+ const helpers_1 = require("../helpers");
21
+ const group_layer_1 = require("./group.layer");
22
+ class UILayer extends group_layer_1.GroupLayer {
23
+ page;
24
+ constructor(page, session, options) {
25
+ super(page, session, options);
26
+ this.page = page;
79
27
  }
80
28
  /**
81
29
  * Opens given chat at last message (bottom)
@@ -83,62 +31,41 @@ var UILayer = /** @class */ (function (_super) {
83
31
  * @category UI
84
32
  * @param chatId
85
33
  */
86
- UILayer.prototype.openChat = function (chatId) {
87
- return __awaiter(this, void 0, void 0, function () {
88
- return __generator(this, function (_a) {
89
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WPP.chat.openChatBottom(chatId, undefined); }, chatId)];
90
- });
91
- });
92
- };
34
+ async openChat(chatId) {
35
+ return (0, helpers_1.evaluateAndReturn)(this.page, (chatId) => WPP.chat.openChatBottom(chatId, undefined), chatId);
36
+ }
93
37
  /**
94
38
  * Opens chat at given message position
95
39
  * @category UI
96
40
  * @param chatId Chat id
97
41
  * @param messageId Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030')
98
42
  */
99
- UILayer.prototype.openChatAt = function (chatId, messageId) {
100
- return __awaiter(this, void 0, void 0, function () {
101
- return __generator(this, function (_a) {
102
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId, messageId) {
103
- return WPP.chat.openChatAt(chatId, messageId, undefined);
104
- }, chatId, messageId)];
105
- });
106
- });
107
- };
43
+ async openChatAt(chatId, messageId) {
44
+ return (0, helpers_1.evaluateAndReturn)(this.page, (chatId, messageId) => WPP.chat.openChatAt(chatId, messageId, undefined), chatId, messageId);
45
+ }
108
46
  /**
109
47
  * Closes the currently opened chat (if any).
110
48
  * The boolean result reflects if there was any chat that got closed.
111
49
  * @category UI
112
50
  */
113
- UILayer.prototype.closeChat = function () {
114
- return __awaiter(this, void 0, void 0, function () {
115
- return __generator(this, function (_a) {
116
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.chat.closeChat(); })];
117
- });
118
- });
119
- };
51
+ async closeChat() {
52
+ return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.chat.closeChat());
53
+ }
120
54
  /**
121
55
  * Return the currently active chat (visually open)
122
56
  * @category UI
123
57
  */
124
- UILayer.prototype.getActiveChat = function () {
125
- return (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.chat.getActiveChat(); });
126
- };
58
+ getActiveChat() {
59
+ return (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.chat.getActiveChat());
60
+ }
127
61
  /**
128
62
  * Get current theme
129
63
  * @category UI
130
64
  * @returns Current theme ('dark' or 'light')
131
65
  */
132
- UILayer.prototype.getTheme = function () {
133
- return __awaiter(this, void 0, void 0, function () {
134
- return __generator(this, function (_a) {
135
- switch (_a.label) {
136
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.conn.getTheme(); })];
137
- case 1: return [2 /*return*/, _a.sent()];
138
- }
139
- });
140
- });
141
- };
66
+ async getTheme() {
67
+ return await (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.conn.getTheme());
68
+ }
142
69
  /**
143
70
  * Set theme
144
71
  * Note: This will force a reload of WhatsApp Web to take effect
@@ -146,33 +73,17 @@ var UILayer = /** @class */ (function (_super) {
146
73
  * @param theme Theme to set ('dark' or 'light')
147
74
  * @returns void
148
75
  */
149
- UILayer.prototype.setTheme = function (theme) {
150
- return __awaiter(this, void 0, void 0, function () {
151
- return __generator(this, function (_a) {
152
- switch (_a.label) {
153
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (theme) { return WPP.conn.setTheme(theme); }, theme)];
154
- case 1: return [2 /*return*/, _a.sent()];
155
- }
156
- });
157
- });
158
- };
76
+ async setTheme(theme) {
77
+ return await (0, helpers_1.evaluateAndReturn)(this.page, (theme) => WPP.conn.setTheme(theme), theme);
78
+ }
159
79
  /**
160
80
  * Get auto download settings
161
81
  * @category UI
162
82
  * @returns Auto download settings
163
83
  */
164
- UILayer.prototype.getAutoDownloadSettings = function () {
165
- return __awaiter(this, void 0, void 0, function () {
166
- return __generator(this, function (_a) {
167
- switch (_a.label) {
168
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () {
169
- return WPP.conn.getAutoDownloadSettings();
170
- })];
171
- case 1: return [2 /*return*/, _a.sent()];
172
- }
173
- });
174
- });
175
- };
84
+ async getAutoDownloadSettings() {
85
+ return await (0, helpers_1.evaluateAndReturn)(this.page, () => WPP.conn.getAutoDownloadSettings());
86
+ }
176
87
  /**
177
88
  * Set auto download settings
178
89
  * Note: This will force a reload of WhatsApp Web to take effect
@@ -180,16 +91,8 @@ var UILayer = /** @class */ (function (_super) {
180
91
  * @param settings Auto download settings to set
181
92
  * @returns void
182
93
  */
183
- UILayer.prototype.setAutoDownloadSettings = function (settings) {
184
- return __awaiter(this, void 0, void 0, function () {
185
- return __generator(this, function (_a) {
186
- switch (_a.label) {
187
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (settings) { return WPP.conn.setAutoDownloadSettings(settings); }, settings)];
188
- case 1: return [2 /*return*/, _a.sent()];
189
- }
190
- });
191
- });
192
- };
193
- return UILayer;
194
- }(group_layer_1.GroupLayer));
94
+ async setAutoDownloadSettings(settings) {
95
+ return await (0, helpers_1.evaluateAndReturn)(this.page, (settings) => WPP.conn.setAutoDownloadSettings(settings), settings);
96
+ }
97
+ }
195
98
  exports.UILayer = UILayer;
@@ -14,7 +14,7 @@
14
14
  * You should have received a copy of the GNU Lesser General Public License
15
15
  * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
16
16
  */
17
- var defs = {
17
+ const defs = {
18
18
  MAX_GROUP_SIZE: 101,
19
19
  MAX_SUBJECT_LENGTH: 25,
20
20
  IMG_MAX_EDGE: 1600,