@wppconnect-team/wppconnect 1.12.4 → 1.12.7

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 CHANGED
@@ -1,3 +1,25 @@
1
+ ## 1.12.7 (2022-03-03)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * Fixed onParticipantsChanged and onPresenceChanged function (fix [#864](https://github.com/wppconnect-team/wppconnect/issues/864), fix [#911](https://github.com/wppconnect-team/wppconnect/issues/911)) ([aff7f6c](https://github.com/wppconnect-team/wppconnect/commit/aff7f6cd34c22c086789ca4871c3113d8d8b2bb8))
7
+
8
+
9
+
10
+ ## 1.12.6 (2022-02-22)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * Fixed getGroupMembersIds and getGroupMembers for large chats (fix [#892](https://github.com/wppconnect-team/wppconnect/issues/892)) ([9cc34a5](https://github.com/wppconnect-team/wppconnect/commit/9cc34a5fddef52b01feba6194fff31aa19b388f0))
16
+
17
+
18
+
19
+ ## 1.12.5 (2022-02-06)
20
+
21
+
22
+
1
23
  ## 1.12.4 (2022-01-22)
2
24
 
3
25
 
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -11,7 +11,7 @@ export declare class GroupLayer extends RetrieverLayer {
11
11
  * @category Group
12
12
  * @param groupId group id
13
13
  */
14
- leaveGroup(groupId: string): Promise<any>;
14
+ leaveGroup(groupId: string): Promise<void>;
15
15
  /**
16
16
  * Retrieves group members as [Id] objects
17
17
  * @category Group
@@ -44,7 +44,37 @@ export declare class GroupLayer extends RetrieverLayer {
44
44
  * @param inviteCode
45
45
  * @returns Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED
46
46
  */
47
- getGroupInfoFromInviteLink(inviteCode: string): Promise<string | boolean>;
47
+ getGroupInfoFromInviteLink(inviteCode: string): Promise<{
48
+ descOwner: string;
49
+ id: string;
50
+ owner: string;
51
+ participants: {
52
+ id: string;
53
+ isAdmin: boolean;
54
+ isSuperAdmin: boolean;
55
+ }[];
56
+ subjectOwner: string;
57
+ announce: boolean;
58
+ creation: number;
59
+ desc: string;
60
+ descId: string;
61
+ descTime: number;
62
+ /**
63
+ * Removes the host device from the group
64
+ * @category Group
65
+ * @param groupId group id
66
+ */
67
+ noFrequentlyForwarded: boolean;
68
+ parent: boolean;
69
+ pvId?: string;
70
+ restrict: boolean;
71
+ size: number;
72
+ status: number;
73
+ subject: string;
74
+ subjectTime: number;
75
+ support: boolean;
76
+ suspended: boolean;
77
+ }>;
48
78
  /**
49
79
  * Creates a new chat group
50
80
  * @category Group
@@ -93,13 +123,15 @@ export declare class GroupLayer extends RetrieverLayer {
93
123
  * @category Group
94
124
  * @param chatId Group/Chat id ('0000000000-00000000@g.us')
95
125
  */
96
- getGroupAdmins(chatId: string): Promise<import("../model").Contact[]>;
126
+ getGroupAdmins(chatId: string): Promise<import("@wppconnect/wa-js/dist/whatsapp").Wid[]>;
97
127
  /**
98
128
  * Join a group with invite code
99
129
  * @category Group
100
130
  * @param inviteCode
101
131
  */
102
- joinGroup(inviteCode: string): Promise<string | boolean>;
132
+ joinGroup(inviteCode: string): Promise<{
133
+ id: string;
134
+ }>;
103
135
  /**
104
136
  * Set group description (if allowed)
105
137
  * @category Group
@@ -107,7 +139,7 @@ export declare class GroupLayer extends RetrieverLayer {
107
139
  * @param description New group description
108
140
  * @returns empty object
109
141
  */
110
- setGroupDescription(groupId: string, description: string): Promise<object>;
142
+ setGroupDescription(groupId: string, description: string): Promise<boolean>;
111
143
  /**
112
144
  * Set group subject (if allowed)
113
145
  * @category Group
@@ -115,7 +147,7 @@ export declare class GroupLayer extends RetrieverLayer {
115
147
  * @param title New group subject
116
148
  * @returns empty object
117
149
  */
118
- setGroupSubject(groupId: string, title: string): Promise<object>;
150
+ setGroupSubject(groupId: string, title: string): Promise<boolean>;
119
151
  /**
120
152
  * Enable or disable group properties, see {@link GroupProperty for details}
121
153
  * @category Group
@@ -124,5 +156,5 @@ export declare class GroupLayer extends RetrieverLayer {
124
156
  * @param value true or false
125
157
  * @returns empty object
126
158
  */
127
- setGroupProperty(groupId: string, property: GroupProperty, value: boolean): Promise<object>;
159
+ setGroupProperty(groupId: string, property: GroupProperty, value: boolean): Promise<boolean>;
128
160
  }
@@ -85,7 +85,7 @@ var GroupLayer = /** @class */ (function (_super) {
85
85
  GroupLayer.prototype.leaveGroup = function (groupId) {
86
86
  return __awaiter(this, void 0, void 0, function () {
87
87
  return __generator(this, function (_a) {
88
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (groupId) { return WAPI.leaveGroup(groupId); }, groupId)];
88
+ return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (groupId) { return WPP.group.leave(groupId); }, groupId)];
89
89
  });
90
90
  });
91
91
  };
@@ -97,7 +97,9 @@ var GroupLayer = /** @class */ (function (_super) {
97
97
  GroupLayer.prototype.getGroupMembersIds = function (groupId) {
98
98
  return __awaiter(this, void 0, void 0, function () {
99
99
  return __generator(this, function (_a) {
100
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (groupId) { return WAPI.getGroupParticipantIDs(groupId); }, groupId)];
100
+ return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (groupId) {
101
+ return Promise.resolve(WPP.group.getParticipants(groupId)).then(function (participants) { return participants.map(function (p) { return p.id; }); });
102
+ }, groupId)];
101
103
  });
102
104
  });
103
105
  };
@@ -131,10 +133,13 @@ var GroupLayer = /** @class */ (function (_super) {
131
133
  */
132
134
  GroupLayer.prototype.getGroupInviteLink = function (chatId) {
133
135
  return __awaiter(this, void 0, void 0, function () {
136
+ var code;
134
137
  return __generator(this, function (_a) {
135
138
  switch (_a.label) {
136
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WAPI.getGroupInviteLink(chatId); }, chatId)];
137
- case 1: return [2 /*return*/, _a.sent()];
139
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WPP.group.getInviteCode(chatId); }, chatId)];
140
+ case 1:
141
+ code = _a.sent();
142
+ return [2 /*return*/, "https://chat.whatsapp.com/".concat(code)];
138
143
  }
139
144
  });
140
145
  });
@@ -147,10 +152,13 @@ var GroupLayer = /** @class */ (function (_super) {
147
152
  */
148
153
  GroupLayer.prototype.revokeGroupInviteLink = function (chatId) {
149
154
  return __awaiter(this, void 0, void 0, function () {
155
+ var code;
150
156
  return __generator(this, function (_a) {
151
157
  switch (_a.label) {
152
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WAPI.revokeGroupInviteLink(chatId); }, chatId)];
153
- case 1: return [2 /*return*/, _a.sent()];
158
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WPP.group.revokeInviteCode(chatId); }, chatId)];
159
+ case 1:
160
+ code = _a.sent();
161
+ return [2 /*return*/, "https://chat.whatsapp.com/".concat(code)];
154
162
  }
155
163
  });
156
164
  });
@@ -170,7 +178,7 @@ var GroupLayer = /** @class */ (function (_super) {
170
178
  inviteCode = inviteCode.replace('invite/', '');
171
179
  inviteCode = inviteCode.replace('https://', '');
172
180
  inviteCode = inviteCode.replace('http://', '');
173
- return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (inviteCode) { return WAPI.getGroupInfoFromInviteLink(inviteCode); }, inviteCode)];
181
+ return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (inviteCode) { return WPP.group.getGroupInfoFromInviteCode(inviteCode); }, inviteCode)];
174
182
  case 1: return [2 /*return*/, _a.sent()];
175
183
  }
176
184
  });
@@ -284,10 +292,15 @@ var GroupLayer = /** @class */ (function (_super) {
284
292
  */
285
293
  GroupLayer.prototype.getGroupAdmins = function (chatId) {
286
294
  return __awaiter(this, void 0, void 0, function () {
295
+ var participants;
287
296
  return __generator(this, function (_a) {
288
297
  switch (_a.label) {
289
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WAPI.getGroupAdmins(chatId); }, chatId)];
290
- case 1: return [2 /*return*/, _a.sent()];
298
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) {
299
+ return Promise.resolve(WPP.group.getParticipants(chatId)).then(function (participants) { return participants.map(function (p) { return p.toJSON(); }); });
300
+ }, chatId)];
301
+ case 1:
302
+ participants = _a.sent();
303
+ return [2 /*return*/, participants.filter(function (p) { return p.isAdmin; }).map(function (p) { return p.id; })];
291
304
  }
292
305
  });
293
306
  });
@@ -306,7 +319,7 @@ var GroupLayer = /** @class */ (function (_super) {
306
319
  inviteCode = inviteCode.replace('invite/', '');
307
320
  inviteCode = inviteCode.replace('https://', '');
308
321
  inviteCode = inviteCode.replace('http://', '');
309
- return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (inviteCode) { return WAPI.joinGroup(inviteCode); }, inviteCode)];
322
+ return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (inviteCode) { return WPP.group.join(inviteCode); }, inviteCode)];
310
323
  case 1: return [2 /*return*/, _a.sent()];
311
324
  }
312
325
  });
@@ -325,7 +338,7 @@ var GroupLayer = /** @class */ (function (_super) {
325
338
  switch (_a.label) {
326
339
  case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
327
340
  var groupId = _a.groupId, description = _a.description;
328
- return WAPI.setGroupDescription(groupId, description);
341
+ return WPP.group.setDescription(groupId, description);
329
342
  }, { groupId: groupId, description: description })];
330
343
  case 1: return [2 /*return*/, _a.sent()];
331
344
  }
@@ -345,7 +358,7 @@ var GroupLayer = /** @class */ (function (_super) {
345
358
  switch (_a.label) {
346
359
  case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
347
360
  var groupId = _a.groupId, title = _a.title;
348
- return WAPI.setGroupSubject(groupId, title);
361
+ return WPP.group.setSubject(groupId, title);
349
362
  }, { groupId: groupId, title: title })];
350
363
  case 1: return [2 /*return*/, _a.sent()];
351
364
  }
@@ -366,7 +379,7 @@ var GroupLayer = /** @class */ (function (_super) {
366
379
  switch (_a.label) {
367
380
  case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
368
381
  var groupId = _a.groupId, property = _a.property, value = _a.value;
369
- return WAPI.setGroupProperty(groupId, property, value);
382
+ return WPP.group.setProperty(groupId, property, value);
370
383
  }, { groupId: groupId, property: property, value: value })];
371
384
  case 1: return [2 /*return*/, _a.sent()];
372
385
  }
@@ -27,16 +27,6 @@ export declare class HostLayer {
27
27
  waitForInChat(): Promise<true>;
28
28
  waitForPageLoad(): Promise<void>;
29
29
  waitForLogin(catchQR?: CatchQRCallback, statusFind?: StatusFindCallback): Promise<boolean>;
30
- /**
31
- * Delete the Service Workers
32
- * @category Host
33
- */
34
- killServiceWorker(): Promise<boolean>;
35
- /**
36
- * Load the service again
37
- * @category Host
38
- */
39
- restartService(): Promise<boolean>;
40
30
  /**
41
31
  * @category Host
42
32
  * @returns Current host device details
@@ -430,34 +430,6 @@ var HostLayer = /** @class */ (function () {
430
430
  });
431
431
  });
432
432
  };
433
- /**
434
- * Delete the Service Workers
435
- * @category Host
436
- */
437
- HostLayer.prototype.killServiceWorker = function () {
438
- return __awaiter(this, void 0, void 0, function () {
439
- return __generator(this, function (_a) {
440
- switch (_a.label) {
441
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WAPI.killServiceWorker(); })];
442
- case 1: return [2 /*return*/, _a.sent()];
443
- }
444
- });
445
- });
446
- };
447
- /**
448
- * Load the service again
449
- * @category Host
450
- */
451
- HostLayer.prototype.restartService = function () {
452
- return __awaiter(this, void 0, void 0, function () {
453
- return __generator(this, function (_a) {
454
- switch (_a.label) {
455
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WAPI.restartService(); })];
456
- case 1: return [2 /*return*/, _a.sent()];
457
- }
458
- });
459
- });
460
- };
461
433
  /**
462
434
  * @category Host
463
435
  * @returns Current host device details
@@ -531,7 +503,7 @@ var HostLayer = /** @class */ (function () {
531
503
  return __generator(this, function (_a) {
532
504
  switch (_a.label) {
533
505
  case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () {
534
- return WPP.whatsapp.State.state;
506
+ return WPP.whatsapp.Socket.state;
535
507
  })];
536
508
  case 1: return [2 /*return*/, _a.sent()];
537
509
  }
@@ -619,7 +591,7 @@ var HostLayer = /** @class */ (function () {
619
591
  return __awaiter(this, void 0, void 0, function () {
620
592
  return __generator(this, function (_a) {
621
593
  switch (_a.label) {
622
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.auth.isMultiDevice(); })];
594
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.conn.isMultiDevice(); })];
623
595
  case 1: return [2 /*return*/, _a.sent()];
624
596
  }
625
597
  });
@@ -150,66 +150,126 @@ var ListenerLayer = /** @class */ (function (_super) {
150
150
  return [3 /*break*/, 2];
151
151
  case 5: return [4 /*yield*/, this.page
152
152
  .evaluate(function () {
153
- if (!window['onMessage'].exposed) {
154
- window.WAPI.waitNewMessages(false, function (data) {
155
- data.forEach(function (message) {
156
- window['onMessage'](message);
153
+ try {
154
+ if (!window['onMessage'].exposed) {
155
+ window.WAPI.waitNewMessages(false, function (data) {
156
+ data.forEach(function (message) {
157
+ window['onMessage'](message);
158
+ });
157
159
  });
158
- });
159
- window['onMessage'].exposed = true;
160
+ window['onMessage'].exposed = true;
161
+ }
160
162
  }
161
- if (!window['onAck'].exposed) {
162
- window.WAPI.waitNewAcknowledgements(window['onAck']);
163
- window['onAck'].exposed = true;
163
+ catch (error) {
164
+ console.error(error);
164
165
  }
165
- if (!window['onAnyMessage'].exposed) {
166
- window.WAPI.allNewMessagesListener(window['onAnyMessage']);
167
- window['onAnyMessage'].exposed = true;
166
+ try {
167
+ if (!window['onAck'].exposed) {
168
+ window.WAPI.waitNewAcknowledgements(window['onAck']);
169
+ window['onAck'].exposed = true;
170
+ }
168
171
  }
169
- if (!window['onStateChange'].exposed) {
170
- window.WAPI.onStateChange(window['onStateChange']);
171
- window['onStateChange'].exposed = true;
172
+ catch (error) {
173
+ console.error(error);
172
174
  }
173
- if (!window['onStreamChange'].exposed) {
174
- window.WAPI.onStreamChange(window['onStreamChange']);
175
- window['onStreamChange'].exposed = true;
175
+ try {
176
+ if (!window['onAnyMessage'].exposed) {
177
+ window.WAPI.allNewMessagesListener(window['onAnyMessage']);
178
+ window['onAnyMessage'].exposed = true;
179
+ }
176
180
  }
177
- if (!window['onAddedToGroup'].exposed) {
178
- window.WAPI.onAddedToGroup(window['onAddedToGroup']);
179
- window['onAddedToGroup'].exposed = true;
181
+ catch (error) {
182
+ console.error(error);
180
183
  }
181
- if (!window['onIncomingCall'].exposed) {
182
- window.WAPI.onIncomingCall(window['onIncomingCall']);
183
- window['onIncomingCall'].exposed = true;
184
+ try {
185
+ if (!window['onStateChange'].exposed) {
186
+ window.WAPI.onStateChange(window['onStateChange']);
187
+ window['onStateChange'].exposed = true;
188
+ }
184
189
  }
185
- if (!window['onInterfaceChange'].exposed) {
186
- window.WAPI.onInterfaceChange(window['onInterfaceChange']);
187
- window['onInterfaceChange'].exposed = true;
190
+ catch (error) {
191
+ console.error(error);
188
192
  }
189
- if (!window['onNotificationMessage'].exposed) {
190
- window.WAPI.onNotificationMessage(window['onNotificationMessage']);
191
- window['onNotificationMessage'].exposed = true;
193
+ try {
194
+ if (!window['onStreamChange'].exposed) {
195
+ window.WAPI.onStreamChange(window['onStreamChange']);
196
+ window['onStreamChange'].exposed = true;
197
+ }
198
+ }
199
+ catch (error) {
200
+ console.error(error);
192
201
  }
193
- if (!window['onPresenceChanged'].exposed) {
194
- window.WAPI.onPresenceChanged(window['onPresenceChanged']);
195
- window['onPresenceChanged'].exposed = true;
202
+ try {
203
+ if (!window['onAddedToGroup'].exposed) {
204
+ window.WAPI.onAddedToGroup(window['onAddedToGroup']);
205
+ window['onAddedToGroup'].exposed = true;
206
+ }
207
+ }
208
+ catch (error) {
209
+ console.error(error);
210
+ }
211
+ try {
212
+ if (!window['onIncomingCall'].exposed) {
213
+ window.WAPI.onIncomingCall(window['onIncomingCall']);
214
+ window['onIncomingCall'].exposed = true;
215
+ }
216
+ }
217
+ catch (error) {
218
+ console.error(error);
219
+ }
220
+ try {
221
+ if (!window['onInterfaceChange'].exposed) {
222
+ window.WAPI.onInterfaceChange(window['onInterfaceChange']);
223
+ window['onInterfaceChange'].exposed = true;
224
+ }
196
225
  }
197
- if (!window['onLiveLocation'].exposed) {
198
- window.WAPI.onLiveLocation(window['onLiveLocation']);
199
- window['onLiveLocation'].exposed = true;
226
+ catch (error) {
227
+ console.error(error);
228
+ }
229
+ try {
230
+ if (!window['onNotificationMessage'].exposed) {
231
+ window.WAPI.onNotificationMessage(window['onNotificationMessage']);
232
+ window['onNotificationMessage'].exposed = true;
233
+ }
234
+ }
235
+ catch (error) {
236
+ console.error(error);
237
+ }
238
+ try {
239
+ if (!window['onPresenceChanged'].exposed) {
240
+ window.WAPI.onPresenceChanged(window['onPresenceChanged']);
241
+ window['onPresenceChanged'].exposed = true;
242
+ }
243
+ }
244
+ catch (error) {
245
+ console.error(error);
246
+ }
247
+ try {
248
+ if (!window['onLiveLocation'].exposed) {
249
+ window.WAPI.onLiveLocation(window['onLiveLocation']);
250
+ window['onLiveLocation'].exposed = true;
251
+ }
252
+ }
253
+ catch (error) {
254
+ console.error(error);
255
+ }
256
+ try {
257
+ if (!window['onRevokedMessage'].exposed) {
258
+ WPP.chat.on('msg_revoke', function (data) {
259
+ var eventData = {
260
+ author: data.author,
261
+ from: data.from,
262
+ to: data.to,
263
+ id: data.id._serialized,
264
+ refId: data.refId._serialized,
265
+ };
266
+ window['onRevokedMessage'](eventData);
267
+ });
268
+ window['onRevokedMessage'].exposed = true;
269
+ }
200
270
  }
201
- if (!window['onRevokedMessage'].exposed) {
202
- WPP.chat.on('msg_revoke', function (data) {
203
- var eventData = {
204
- author: data.author,
205
- from: data.from,
206
- to: data.to,
207
- id: data.id._serialized,
208
- refId: data.refId._serialized,
209
- };
210
- window['onRevokedMessage'](eventData);
211
- });
212
- window['onRevokedMessage'].exposed = true;
271
+ catch (error) {
272
+ console.error(error);
213
273
  }
214
274
  })
215
275
  .catch(function () { })];
@@ -314,6 +374,7 @@ var ListenerLayer = /** @class */ (function (_super) {
314
374
  }
315
375
  var subtypeEvents = ['invite', 'add', 'remove', 'leave'];
316
376
  return this.registerEvent(exposed_enum_1.ExposedFn.onNotificationMessage, function (message) {
377
+ console.log('notification', message);
317
378
  // Only group events
318
379
  if (message.type !== enum_1.MessageType.GP2 ||
319
380
  !subtypeEvents.includes(message.subtype)) {
@@ -43,7 +43,11 @@ var __assign = (this && this.__assign) || function () {
43
43
  };
44
44
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
45
45
  if (k2 === undefined) k2 = k;
46
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
46
+ var desc = Object.getOwnPropertyDescriptor(m, k);
47
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
48
+ desc = { enumerable: true, get: function() { return m[k]; } };
49
+ }
50
+ Object.defineProperty(o, k2, desc);
47
51
  }) : (function(o, m, k, k2) {
48
52
  if (k2 === undefined) k2 = k;
49
53
  o[k2] = m[k];
@@ -17,8 +17,5 @@ export declare class UILayer extends GroupLayer {
17
17
  * @param chatId Chat id
18
18
  * @param messageId Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030')
19
19
  */
20
- openChatAt(chatId: string, messageId: string): Promise<{
21
- wasVisible: boolean;
22
- alignAt: string;
23
- }>;
20
+ openChatAt(chatId: string, messageId: string): Promise<boolean>;
24
21
  }
@@ -86,7 +86,7 @@ var UILayer = /** @class */ (function (_super) {
86
86
  UILayer.prototype.openChat = function (chatId) {
87
87
  return __awaiter(this, void 0, void 0, function () {
88
88
  return __generator(this, function (_a) {
89
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WAPI.openChat(chatId); }, chatId)];
89
+ return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WPP.chat.openChatBottom(chatId); }, chatId)];
90
90
  });
91
91
  });
92
92
  };
@@ -99,7 +99,7 @@ var UILayer = /** @class */ (function (_super) {
99
99
  UILayer.prototype.openChatAt = function (chatId, messageId) {
100
100
  return __awaiter(this, void 0, void 0, function () {
101
101
  return __generator(this, function (_a) {
102
- return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WAPI.openChatAt(chatId, messageId); }, chatId)];
102
+ return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function (chatId) { return WPP.chat.openChatAt(chatId, messageId); }, chatId)];
103
103
  });
104
104
  });
105
105
  };
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -253,7 +253,7 @@ var Whatsapp = /** @class */ (function (_super) {
253
253
  return __awaiter(this, void 0, void 0, function () {
254
254
  return __generator(this, function (_a) {
255
255
  switch (_a.label) {
256
- case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.auth.logout(); })];
256
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.conn.logout(); })];
257
257
  case 1: return [2 /*return*/, _a.sent()];
258
258
  }
259
259
  });
@@ -19,6 +19,6 @@ exports.defaultOptions = {
19
19
  waitForLogin: true,
20
20
  logger: logger_1.defaultLogger,
21
21
  tokenStore: 'file',
22
- whatsappVersion: '2.2144.x',
22
+ whatsappVersion: '2.2204.x',
23
23
  deviceName: false,
24
24
  };
@@ -17,7 +17,11 @@
17
17
  */
18
18
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
19
19
  if (k2 === undefined) k2 = k;
20
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
20
+ var desc = Object.getOwnPropertyDescriptor(m, k);
21
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
22
+ desc = { enumerable: true, get: function() { return m[k]; } };
23
+ }
24
+ Object.defineProperty(o, k2, desc);
21
25
  }) : (function(o, m, k, k2) {
22
26
  if (k2 === undefined) k2 = k;
23
27
  o[k2] = m[k];
@@ -239,6 +243,7 @@ function injectSessionToken(page, token, clear) {
239
243
  Object.keys(session).forEach(function (key) {
240
244
  localStorage.setItem(key, session[key]);
241
245
  });
246
+ localStorage.setItem('remember-me', 'true');
242
247
  }, token)];
243
248
  case 5:
244
249
  _a.sent();