@wppconnect-team/wppconnect 1.32.3 → 1.33.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.
Files changed (39) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/api/helpers/base64-mimetype.js +1 -2
  3. package/dist/api/helpers/decrypt.d.ts +0 -1
  4. package/dist/api/helpers/download-file.js +1 -2
  5. package/dist/api/helpers/evaluate-and-return.js +1 -2
  6. package/dist/api/helpers/file-to-base64.js +2 -3
  7. package/dist/api/helpers/filename-from-mimetype.js +1 -2
  8. package/dist/api/helpers/scrape-img-qr.js +1 -2
  9. package/dist/api/helpers/scrape-login.js +1 -2
  10. package/dist/api/helpers/select-sticker.d.ts +0 -1
  11. package/dist/api/helpers/select-sticker.js +2 -3
  12. package/dist/api/layers/catalog.layer.d.ts +24 -1
  13. package/dist/api/layers/group.layer.d.ts +15 -11
  14. package/dist/api/layers/group.layer.js +8 -4
  15. package/dist/api/layers/host.layer.d.ts +0 -1
  16. package/dist/api/layers/profile.layer.d.ts +5 -0
  17. package/dist/api/layers/profile.layer.js +7 -0
  18. package/dist/api/layers/sender.layer.d.ts +8 -3
  19. package/dist/api/layers/sender.layer.js +8 -3
  20. package/dist/api/layers/ui.layer.d.ts +6 -0
  21. package/dist/api/layers/ui.layer.js +12 -0
  22. package/dist/api/model/contact.d.ts +1 -2
  23. package/dist/api/model/group-metadata.d.ts +25 -0
  24. package/dist/api/model/message.d.ts +40 -3
  25. package/dist/api/whatsapp.d.ts +11 -12
  26. package/dist/api/whatsapp.js +11 -11
  27. package/dist/config/create-config.js +1 -1
  28. package/dist/controllers/auth.js +2 -2
  29. package/dist/controllers/browser.js +7 -8
  30. package/dist/controllers/initializer.js +1 -2
  31. package/dist/controllers/welcome.js +2 -3
  32. package/dist/lib/wapi/wapi.js +1 -1
  33. package/dist/token-store/fileTokenStore.d.ts +0 -1
  34. package/dist/token-store/isValidSessionToken.js +1 -2
  35. package/dist/token-store/isValidTokenStore.js +1 -2
  36. package/dist/utils/ffmpeg.js +2 -3
  37. package/dist/utils/semver.js +1 -2
  38. package/dist/utils/sleep.js +1 -2
  39. package/package.json +20 -20
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 1.33.0 (2024-08-05)
2
+
3
+ - feat: Added client.closeChat function (close #2271) (#2290) ([539e5d9](https://github.com/wppconnect-team/wppconnect/commit/539e5d9)), closes [#2271](https://github.com/wppconnect-team/wppconnect/issues/2271) [#2290](https://github.com/wppconnect-team/wppconnect/issues/2290)
4
+
5
+ ## <small>1.32.4 (2024-07-16)</small>
6
+
7
+ - fix(deps): update dependency @wppconnect/wa-js to ^3.6.0 (#2275) ([4d56011](https://github.com/wppconnect-team/wppconnect/commit/4d56011)), closes [#2275](https://github.com/wppconnect-team/wppconnect/issues/2275)
8
+
1
9
  ## <small>1.32.3 (2024-06-24)</small>
2
10
 
3
11
  - chore: upgrade @wppconnect/wa-js ([50775a8](https://github.com/wppconnect-team/wppconnect/commit/50775a8))
@@ -16,7 +16,7 @@
16
16
  * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
17
17
  */
18
18
  Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.base64MimeType = void 0;
19
+ exports.base64MimeType = base64MimeType;
20
20
  function base64MimeType(encoded) {
21
21
  var result = null;
22
22
  if (typeof encoded !== 'string') {
@@ -28,4 +28,3 @@ function base64MimeType(encoded) {
28
28
  }
29
29
  return result;
30
30
  }
31
- exports.base64MimeType = base64MimeType;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { ResponseType } from 'axios';
3
2
  export declare const makeOptions: (useragentOverride: string) => {
4
3
  responseType: ResponseType;
@@ -55,7 +55,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55
55
  return (mod && mod.__esModule) ? mod : { "default": mod };
56
56
  };
57
57
  Object.defineProperty(exports, "__esModule", { value: true });
58
- exports.downloadFileToBase64 = void 0;
58
+ exports.downloadFileToBase64 = downloadFileToBase64;
59
59
  var axios_1 = __importDefault(require("axios"));
60
60
  function downloadFileToBase64(_path_1) {
61
61
  return __awaiter(this, arguments, void 0, function (_path, _mines) {
@@ -103,4 +103,3 @@ function downloadFileToBase64(_path_1) {
103
103
  });
104
104
  });
105
105
  }
106
- exports.downloadFileToBase64 = downloadFileToBase64;
@@ -61,7 +61,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
61
61
  return to.concat(ar || Array.prototype.slice.call(from));
62
62
  };
63
63
  Object.defineProperty(exports, "__esModule", { value: true });
64
- exports.evaluateAndReturn = void 0;
64
+ exports.evaluateAndReturn = evaluateAndReturn;
65
65
  //EvaluateFn, EvaluateFnReturnType, SerializableOrJSHandle //
66
66
  function evaluateAndReturn(page, pageFunction) {
67
67
  var args = [];
@@ -115,4 +115,3 @@ function evaluateAndReturn(page, pageFunction) {
115
115
  });
116
116
  });
117
117
  }
118
- exports.evaluateAndReturn = evaluateAndReturn;
@@ -75,7 +75,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
75
75
  }
76
76
  };
77
77
  Object.defineProperty(exports, "__esModule", { value: true });
78
- exports.Mine = exports.fileToBase64 = void 0;
78
+ exports.fileToBase64 = fileToBase64;
79
+ exports.Mine = Mine;
79
80
  var mimeTypes = __importStar(require("mime-types"));
80
81
  var fileType = __importStar(require("file-type"));
81
82
  var fs = __importStar(require("fs"));
@@ -112,7 +113,6 @@ function fileToBase64(path, mime) {
112
113
  });
113
114
  });
114
115
  }
115
- exports.fileToBase64 = fileToBase64;
116
116
  function Mine(path) {
117
117
  return __awaiter(this, void 0, void 0, function () {
118
118
  var mime;
@@ -129,4 +129,3 @@ function Mine(path) {
129
129
  });
130
130
  });
131
131
  }
132
- exports.Mine = Mine;
@@ -39,7 +39,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
39
39
  return result;
40
40
  };
41
41
  Object.defineProperty(exports, "__esModule", { value: true });
42
- exports.filenameFromMimeType = void 0;
42
+ exports.filenameFromMimeType = filenameFromMimeType;
43
43
  var path = __importStar(require("path"));
44
44
  var mime = __importStar(require("mime-types"));
45
45
  function filenameFromMimeType(filename, mimeType) {
@@ -50,4 +50,3 @@ function filenameFromMimeType(filename, mimeType) {
50
50
  }
51
51
  return path.basename(filename, filenameExtension) + '.' + mimeExtension;
52
52
  }
53
- exports.filenameFromMimeType = filenameFromMimeType;
@@ -52,7 +52,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
52
52
  }
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.scrapeImg = void 0;
55
+ exports.scrapeImg = scrapeImg;
56
56
  function scrapeImg(page) {
57
57
  return __awaiter(this, void 0, void 0, function () {
58
58
  var click, result;
@@ -105,4 +105,3 @@ function scrapeImg(page) {
105
105
  });
106
106
  });
107
107
  }
108
- exports.scrapeImg = scrapeImg;
@@ -52,7 +52,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
52
52
  }
53
53
  };
54
54
  Object.defineProperty(exports, "__esModule", { value: true });
55
- exports.scrapeLogin = void 0;
55
+ exports.scrapeLogin = scrapeLogin;
56
56
  function scrapeLogin(page) {
57
57
  return __awaiter(this, void 0, void 0, function () {
58
58
  var result;
@@ -77,4 +77,3 @@ function scrapeLogin(page) {
77
77
  });
78
78
  });
79
79
  }
80
- exports.scrapeLogin = scrapeLogin;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  interface selectOutput {
3
2
  webpBase64: string;
4
3
  metadata: {
@@ -55,7 +55,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
55
55
  return (mod && mod.__esModule) ? mod : { "default": mod };
56
56
  };
57
57
  Object.defineProperty(exports, "__esModule", { value: true });
58
- exports.resizeImg = exports.stickerSelect = void 0;
58
+ exports.stickerSelect = stickerSelect;
59
+ exports.resizeImg = resizeImg;
59
60
  var sharp_1 = __importDefault(require("sharp"));
60
61
  function stickerSelect(_B, _t) {
61
62
  return __awaiter(this, void 0, void 0, function () {
@@ -104,7 +105,6 @@ function stickerSelect(_B, _t) {
104
105
  });
105
106
  });
106
107
  }
107
- exports.stickerSelect = stickerSelect;
108
108
  function resizeImg(buff, size) {
109
109
  return __awaiter(this, void 0, void 0, function () {
110
110
  var _ins, _w, _webb64;
@@ -123,4 +123,3 @@ function resizeImg(buff, size) {
123
123
  });
124
124
  });
125
125
  }
126
- exports.resizeImg = resizeImg;
@@ -39,7 +39,30 @@ export declare class CatalogLayer extends CommunityLayer {
39
39
  * @param id Buisness profile id ('00000@c.us')
40
40
  * @param productId ID of Product
41
41
  */
42
- getProductById(id: string, productId: string): Promise<import("@wppconnect/wa-js/dist/whatsapp").ProductModel>;
42
+ getProductById(id: string, productId: string): Promise<{
43
+ id: string;
44
+ retailer_id: string;
45
+ name: string;
46
+ description: string;
47
+ url: string;
48
+ currency: string;
49
+ price: string;
50
+ is_hidden: boolean;
51
+ max_available: number;
52
+ availability: string;
53
+ checkmark: boolean;
54
+ image_hashes_for_whatsapp: string[];
55
+ image_cdn_urls: {
56
+ key: "requested" | "full";
57
+ value: string;
58
+ }[];
59
+ additional_image_cdn_urls: any[];
60
+ whatsapp_product_can_appeal: boolean;
61
+ capability_to_review_status: {
62
+ key: "WHATSAPP";
63
+ value: "APPROVED";
64
+ }[];
65
+ }>;
43
66
  /**
44
67
  * Edit product on catalog
45
68
  * @param productId Product ID
@@ -32,28 +32,30 @@ export declare class GroupLayer extends RetrieverLayer {
32
32
  */
33
33
  getGroupInviteLink(chatId: string): Promise<string>;
34
34
  /**
35
- * Revokes group-invite link and generate new one.
35
+ * Revokes group-invite link and generates a new one.
36
36
  * @category Group
37
37
  * @param chatId
38
38
  * @returns Invitation link
39
39
  */
40
40
  revokeGroupInviteLink(chatId: string): Promise<string>;
41
41
  /**
42
- * Generates group-invite link
42
+ * Displays group info from an invitation link (or invitation ID)
43
43
  * @category Group
44
44
  * @param inviteCode
45
- * @returns Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED
45
+ * @returns Invite code or group link. Example: CMJYfPFqRyE2GxrnkldYED
46
+ * @example getGroupInfoFromInviteLink('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
47
+ * @example getGroupInfoFromInviteLink('CMJYfPFqRyE2GxrnkldYED')
46
48
  */
47
49
  getGroupInfoFromInviteLink(inviteCode: string): Promise<{
48
- descOwner: string;
50
+ descOwner: string | undefined;
49
51
  id: string;
50
- owner: string;
52
+ owner: string | undefined;
51
53
  participants: {
52
54
  id: string;
53
55
  isAdmin: boolean;
54
56
  isSuperAdmin: boolean;
55
57
  }[];
56
- subjectOwner: string;
58
+ subjectOwner: string | undefined;
57
59
  announce: boolean;
58
60
  creation: number;
59
61
  desc: string;
@@ -82,8 +84,8 @@ export declare class GroupLayer extends RetrieverLayer {
82
84
  [key: `${number}@c.us`]: {
83
85
  wid: string;
84
86
  code: number;
85
- invite_code: string;
86
- invite_code_exp: number;
87
+ invite_code: string | null;
88
+ invite_code_exp: number | null;
87
89
  };
88
90
  };
89
91
  }>;
@@ -105,8 +107,8 @@ export declare class GroupLayer extends RetrieverLayer {
105
107
  wid: string;
106
108
  code: number;
107
109
  message: string;
108
- invite_code: string;
109
- invite_code_exp: number;
110
+ invite_code: string | null;
111
+ invite_code_exp: number | null;
110
112
  };
111
113
  }>;
112
114
  /**
@@ -130,9 +132,11 @@ export declare class GroupLayer extends RetrieverLayer {
130
132
  */
131
133
  getGroupAdmins(chatId: string): Promise<import("@wppconnect/wa-js/dist/whatsapp").Wid[]>;
132
134
  /**
133
- * Join a group with invite code
135
+ * Join a group with an invite code or link
134
136
  * @category Group
135
137
  * @param inviteCode
138
+ * @example joinGroup('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
139
+ * @example joinGroup('CMJYfPFqRyE2GxrnkldYED')
136
140
  */
137
141
  joinGroup(inviteCode: string): Promise<{
138
142
  id: string;
@@ -145,7 +145,7 @@ var GroupLayer = /** @class */ (function (_super) {
145
145
  });
146
146
  };
147
147
  /**
148
- * Revokes group-invite link and generate new one.
148
+ * Revokes group-invite link and generates a new one.
149
149
  * @category Group
150
150
  * @param chatId
151
151
  * @returns Invitation link
@@ -164,10 +164,12 @@ var GroupLayer = /** @class */ (function (_super) {
164
164
  });
165
165
  };
166
166
  /**
167
- * Generates group-invite link
167
+ * Displays group info from an invitation link (or invitation ID)
168
168
  * @category Group
169
169
  * @param inviteCode
170
- * @returns Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED
170
+ * @returns Invite code or group link. Example: CMJYfPFqRyE2GxrnkldYED
171
+ * @example getGroupInfoFromInviteLink('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
172
+ * @example getGroupInfoFromInviteLink('CMJYfPFqRyE2GxrnkldYED')
171
173
  */
172
174
  GroupLayer.prototype.getGroupInfoFromInviteLink = function (inviteCode) {
173
175
  return __awaiter(this, void 0, void 0, function () {
@@ -302,9 +304,11 @@ var GroupLayer = /** @class */ (function (_super) {
302
304
  });
303
305
  };
304
306
  /**
305
- * Join a group with invite code
307
+ * Join a group with an invite code or link
306
308
  * @category Group
307
309
  * @param inviteCode
310
+ * @example joinGroup('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
311
+ * @example joinGroup('CMJYfPFqRyE2GxrnkldYED')
308
312
  */
309
313
  GroupLayer.prototype.joinGroup = function (inviteCode) {
310
314
  return __awaiter(this, void 0, void 0, function () {
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Page } from 'puppeteer';
3
2
  import { Logger } from 'winston';
4
3
  import { CreateConfig } from '../../config/create-config';
@@ -36,6 +36,11 @@ export declare class ProfileLayer extends StatusLayer {
36
36
  * @param name
37
37
  */
38
38
  setProfileName(name: string): Promise<boolean>;
39
+ /**
40
+ * Gets the current user profile name
41
+ * @category Profile
42
+ */
43
+ getProfileName(): Promise<string>;
39
44
  /**
40
45
  * Remove your profile picture
41
46
  * @category Profile
@@ -214,6 +214,13 @@ var ProfileLayer = /** @class */ (function (_super) {
214
214
  });
215
215
  });
216
216
  };
217
+ /**
218
+ * Gets the current user profile name
219
+ * @category Profile
220
+ */
221
+ ProfileLayer.prototype.getProfileName = function () {
222
+ return (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.profile.getMyProfileName(); });
223
+ };
217
224
  /**
218
225
  * Remove your profile picture
219
226
  * @category Profile
@@ -4,7 +4,7 @@ import { CreateConfig } from '../../config/create-config';
4
4
  import { Message } from '../model';
5
5
  import { ChatState } from '../model/enum';
6
6
  import { ListenerLayer } from './listener.layer';
7
- import { OrderItems, OrderMessageOptions } from '@wppconnect/wa-js/dist/chat/functions/sendOrderMessage';
7
+ import { OrderItems, OrderMessageOptions } from '@wppconnect/wa-js/dist/chat/functions/sendChargeMessage';
8
8
  export declare class SenderLayer extends ListenerLayer {
9
9
  page: Page;
10
10
  constructor(page: Page, session?: string, options?: CreateConfig);
@@ -90,13 +90,18 @@ export declare class SenderLayer extends ListenerLayer {
90
90
  /**
91
91
  * Sends image message
92
92
  * @category Chat
93
- * @param to Chat id
94
- * @param base64 File path, http link or base64Encoded
93
+ * @param to ID of the chat to send the image to
94
+ * @param base64 A base64-encoded data URI (with mime type)
95
95
  * @param filename
96
96
  * @param caption
97
97
  * @param quotedMessageId Quoted message id
98
98
  * @param isViewOnce Enable single view
99
99
  * @param mentionedList
100
+ * @example
101
+ * ```javascript
102
+ * const base64picture = "/9j/4AA[...]VZoCn9Lp//Z"
103
+ * await client.sendImageFromBase64("120[...]381@g.us'", "data:image/png;base64," + base64picture, "picture.png")
104
+ * ```
100
105
  */
101
106
  sendImageFromBase64(to: string, base64: string, filename: string, caption?: string, quotedMessageId?: string, isViewOnce?: boolean, mentionedList?: any): Promise<{
102
107
  ack: number;
@@ -298,13 +298,18 @@ var SenderLayer = /** @class */ (function (_super) {
298
298
  /**
299
299
  * Sends image message
300
300
  * @category Chat
301
- * @param to Chat id
302
- * @param base64 File path, http link or base64Encoded
301
+ * @param to ID of the chat to send the image to
302
+ * @param base64 A base64-encoded data URI (with mime type)
303
303
  * @param filename
304
304
  * @param caption
305
305
  * @param quotedMessageId Quoted message id
306
306
  * @param isViewOnce Enable single view
307
307
  * @param mentionedList
308
+ * @example
309
+ * ```javascript
310
+ * const base64picture = "/9j/4AA[...]VZoCn9Lp//Z"
311
+ * await client.sendImageFromBase64("120[...]381@g.us'", "data:image/png;base64," + base64picture, "picture.png")
312
+ * ```
308
313
  */
309
314
  SenderLayer.prototype.sendImageFromBase64 = function (to, base64, filename, caption, quotedMessageId, isViewOnce, mentionedList) {
310
315
  return __awaiter(this, void 0, void 0, function () {
@@ -1460,7 +1465,7 @@ var SenderLayer = /** @class */ (function (_super) {
1460
1465
  switch (_a.label) {
1461
1466
  case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
1462
1467
  var to = _a.to, items = _a.items, options = _a.options;
1463
- return WPP.chat.sendOrderMessage(to, items, options);
1468
+ return WPP.chat.sendChargeMessage(to, items, options);
1464
1469
  }, {
1465
1470
  to: to,
1466
1471
  items: items,
@@ -18,6 +18,12 @@ export declare class UILayer extends GroupLayer {
18
18
  * @param messageId Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030')
19
19
  */
20
20
  openChatAt(chatId: string, messageId: string): Promise<boolean>;
21
+ /**
22
+ * Closes the currently opened chat (if any).
23
+ * The boolean result reflects if there was any chat that got closed.
24
+ * @category UI
25
+ */
26
+ closeChat(): Promise<boolean>;
21
27
  /**
22
28
  * Return the current active chat
23
29
  * @category UI
@@ -103,6 +103,18 @@ var UILayer = /** @class */ (function (_super) {
103
103
  });
104
104
  });
105
105
  };
106
+ /**
107
+ * Closes the currently opened chat (if any).
108
+ * The boolean result reflects if there was any chat that got closed.
109
+ * @category UI
110
+ */
111
+ UILayer.prototype.closeChat = function () {
112
+ return __awaiter(this, void 0, void 0, function () {
113
+ return __generator(this, function (_a) {
114
+ return [2 /*return*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WPP.chat.closeChat(); })];
115
+ });
116
+ });
117
+ };
106
118
  /**
107
119
  * Return the current active chat
108
120
  * @category UI
@@ -1,11 +1,10 @@
1
- import { Wid } from './wid';
2
1
  import { ProfilePicThumbObj } from './profile-pic-thumb';
3
2
  /**
4
3
  * Data info of contact
5
4
  */
6
5
  export interface Contact {
7
6
  formattedName: string;
8
- id: Wid;
7
+ id: string;
9
8
  isBusiness: boolean;
10
9
  isEnterprise: boolean;
11
10
  isHighLevelVerified: any;
@@ -1,8 +1,14 @@
1
1
  import { Wid } from './wid';
2
2
  export interface GroupMetadata {
3
+ /** unique identifier for the group */
3
4
  id: Wid;
5
+ /** timestamp of when the group was created */
4
6
  creation: number;
5
7
  owner: Wid;
8
+ /** title/name of the group */
9
+ subject: string;
10
+ subjectTime: number;
11
+ /** description of the group */
6
12
  desc: string;
7
13
  descId: string;
8
14
  descTime: number;
@@ -11,13 +17,32 @@ export interface GroupMetadata {
11
17
  announce: boolean;
12
18
  noFrequentlyForwarded: boolean;
13
19
  ephemeralDuration: number;
20
+ membershipApprovalMode: boolean;
21
+ memberAddMode: 'admin_add' | string;
22
+ reportToAdminMode: boolean;
23
+ /** current amount of members including admins */
14
24
  size: number;
15
25
  support: boolean;
16
26
  suspended: boolean;
17
27
  terminated: boolean;
28
+ uniqueShortNameMap: Object;
29
+ isLidAddressingMode: boolean;
18
30
  isParentGroup: boolean;
31
+ isParentGroupClosed: boolean;
19
32
  defaultSubgroup: boolean;
33
+ generalSubgroup: boolean;
34
+ generalChatAutoAddDisabled: boolean;
35
+ allowNonAdminSubGroupCreation: boolean;
36
+ lastActivityTimestamp: number;
37
+ lastSeenActivityTimestamp: number;
38
+ incognito: boolean;
39
+ hasCapi: boolean;
20
40
  displayCadminPromotion: boolean;
21
41
  participants: any[];
42
+ /** members who applied for membership but still need admin approval */
22
43
  pendingParticipants: any[];
44
+ /** former members who left the group or were kicked out */
45
+ pastParticipants: any[];
46
+ membershipApprovalRequests: any[];
47
+ subgroupSuggestions: any[];
23
48
  }
@@ -1,3 +1,4 @@
1
+ import { Wid } from './wid';
1
2
  import { Chat } from './chat';
2
3
  import { Contact } from './contact';
3
4
  import { MessageType } from './enum';
@@ -12,6 +13,7 @@ export interface Message {
12
13
  */
13
14
  subtype: string;
14
15
  t: number;
16
+ /** profile alias chosen by the sender */
15
17
  notifyName: string;
16
18
  from: string;
17
19
  to: string;
@@ -21,6 +23,7 @@ export interface Message {
21
23
  invis: boolean;
22
24
  isNewMsg: boolean;
23
25
  star: boolean;
26
+ kicNotified: boolean;
24
27
  recvFresh: boolean;
25
28
  interactiveAnnotations: any[];
26
29
  clientUrl: string;
@@ -35,9 +38,39 @@ export interface Message {
35
38
  width: number;
36
39
  height: number;
37
40
  broadcast: boolean;
38
- mentionedJidList: any[];
41
+ /** array of the users who were mentioned in this message; given in the serialized format: "xxxxxxxxxx@c.us" / "xxxxxxxxxx@g.us" */
42
+ mentionedJidList: string[];
43
+ isVcardOverMmsDocument: boolean;
44
+ /** exists when `type` is set to {@link MessageType.VCARD}; it is the name of the sent contact */
45
+ vcardFormattedName?: string;
39
46
  isForwarded: boolean;
40
- labels: any[];
47
+ hasReaction: boolean;
48
+ productHeaderImageRejected: boolean;
49
+ lastPlaybackProgress: number;
50
+ isDynamicReplyButtonsMsg: boolean;
51
+ isCarouselCard: boolean;
52
+ parentMsgId: any;
53
+ isMdHistoryMsg: boolean;
54
+ stickerSentTs: number;
55
+ isAvatar: boolean;
56
+ lastUpdateFromServerTs: number;
57
+ invokedBotWid: null | Wid;
58
+ bizBotType: null;
59
+ botResponseTargetId: null;
60
+ botPluginType: null;
61
+ botPluginReferenceIndex: null;
62
+ botPluginSearchProvider: null;
63
+ botPluginSearchUrl: null;
64
+ botPluginSearchQuery: null;
65
+ botPluginMaybeParent: boolean;
66
+ botReelPluginThumbnailCdnUrl: null;
67
+ botMsgBodyType: null;
68
+ requiresDirectConnection: null;
69
+ bizContentPlaceholderType: null;
70
+ hostedBizEncStateMismatch: boolean;
71
+ senderOrRecipientAccountTypeHosted: boolean;
72
+ placeholderCreatedWhenAccountIsHosted: boolean;
73
+ labels?: any[];
41
74
  sender: Contact;
42
75
  timestamp: number;
43
76
  content: string;
@@ -51,7 +84,9 @@ export interface Message {
51
84
  */
52
85
  chat: Chat;
53
86
  lastSeen: null | number | boolean;
54
- chatId: string;
87
+ /** if `string`, it is serialized: `"user@server"` */
88
+ chatId: string | Wid;
89
+ fromMe: boolean;
55
90
  /**
56
91
  * @deprecated Use the `quotedMsgId` attribute in `getMessageById` to get the message details
57
92
  */
@@ -59,6 +94,8 @@ export interface Message {
59
94
  quotedMsgId: null;
60
95
  mediaData: MediaData;
61
96
  recipients?: string[];
97
+ /** exists for image and video types {@link GroupNotificationType} */
98
+ caption?: string;
62
99
  }
63
100
  export interface MediaData {
64
101
  type: string;
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Page } from 'puppeteer';
3
2
  import { CreateConfig } from '../config/create-config';
4
3
  import { BusinessLayer } from './layers/business.layer';
@@ -27,18 +26,18 @@ export declare class Whatsapp extends BusinessLayer {
27
26
  get waPage(): Page;
28
27
  /**
29
28
  * Get the puppeteer page screenshot
30
- * @returns The Whatsapp page screenshot encoded in base64
29
+ * @returns The Whatsapp page screenshot as a PNG encoded in base64 (not the full data URI, just the base64 section)
31
30
  */
32
31
  takeScreenshot(): Promise<string>;
33
32
  /**
34
- * Clicks on 'use here' button (When it get unlaunched)
33
+ * Clicks on 'use here' button (When it gets unlaunched)
35
34
  * This method tracks the class of the button
36
- * Whatsapp web might change this class name over the time
37
- * Dont rely on this method
35
+ * WhatsApp Web might change this class name over time
36
+ * Don't rely on this method
38
37
  */
39
38
  useHere(): Promise<boolean>;
40
39
  /**
41
- * Logout whastapp
40
+ * Logout WhatsApp
42
41
  * @returns boolean
43
42
  */
44
43
  logout(): Promise<boolean>;
@@ -59,9 +58,9 @@ export declare class Whatsapp extends BusinessLayer {
59
58
  */
60
59
  getMessageById(messageId: string): Promise<Message>;
61
60
  /**
62
- * Retorna uma lista de mensagens de um chat
63
- * @param chatId string ID da conversa ou do grupo
64
- * @param params GetMessagesParam Opções de filtragem de resultados (count, id, direction) veja {@link GetMessagesParam}.
61
+ * Returns a list of messages from a chat
62
+ * @param chatId string ID of the conversation or group
63
+ * @param params GetMessagesParam Result filtering options (count, id, direction) see {@link GetMessagesParam}.
65
64
  * @returns Message object
66
65
  */
67
66
  getMessages(chatId: string, params?: GetMessagesParam): Promise<Message[]>;
@@ -72,9 +71,9 @@ export declare class Whatsapp extends BusinessLayer {
72
71
  */
73
72
  decryptFile(message: Message): Promise<Buffer>;
74
73
  /**
75
- * Rejeita uma ligação recebida pelo WhatsApp
76
- * @param callId string ID da ligação, caso não passado, todas ligações serão rejeitadas
77
- * @returns Número de ligações rejeitadas
74
+ * Rejects a call received via WhatsApp
75
+ * @param callId string Call ID, if not passed, all calls will be rejected
76
+ * @returns Number of rejected calls
78
77
  */
79
78
  rejectCall(callId?: string): Promise<boolean>;
80
79
  }