@wppconnect-team/wppconnect 1.14.2 → 1.14.5

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,20 @@
1
+ ## 1.14.5 (2022-07-11)
2
+
3
+
4
+
5
+ ## 1.14.4 (2022-06-20)
6
+
7
+
8
+
9
+ ## 1.14.3 (2022-06-17)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * **deps:** update dependency @wppconnect/wa-js to ^2.7.2 ([#1181](https://github.com/wppconnect-team/wppconnect/issues/1181)) ([5208e62](https://github.com/wppconnect-team/wppconnect/commit/5208e621cf79ca5d80cca5ecf3c7b9068ca44e91))
15
+
16
+
17
+
1
18
  ## 1.14.2 (2022-06-11)
2
19
 
3
20
 
package/README.md CHANGED
@@ -13,9 +13,9 @@
13
13
  > WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination... 😀🤔💭
14
14
 
15
15
  <p align="center">
16
- <a href="https://wppconnect-team.github.io/wppconnect/pages/Getting%20Started/installation.html">Getting Started</a> •
17
- <a href="https://wppconnect-team.github.io/wppconnect/pages/Getting%20Started/basic-functions.html">Basic Function</a> •
18
- <a href="https://wppconnect-team.github.io/wppconnect/">Documentation</a>
16
+ <a href="https://wppconnect.io/wppconnect/pages/Getting%20Started/installation.html">Getting Started</a> •
17
+ <a href="https://wppconnect.io/wppconnect/pages/Getting%20Started/basic-functions.html">Basic Function</a> •
18
+ <a href="https://wppconnect.io/wppconnect/">Documentation</a>
19
19
  </p>
20
20
 
21
21
  ## Our online channels
@@ -42,7 +42,7 @@
42
42
  | Send _location_ | ✔ |
43
43
  | **and much more** | ✔ |
44
44
 
45
- See more at <a href="https://wppconnect-team.github.io/wppconnect/classes/Whatsapp.html">WhatsApp methods</a>
45
+ See more at <a href="https://wppconnect.io/wppconnect/classes/Whatsapp.html">WhatsApp methods</a>
46
46
 
47
47
  ## Installation
48
48
 
@@ -52,7 +52,7 @@ The first thing that you had to do is install the `npm package` :
52
52
  npm i --save @wppconnect-team/wppconnect
53
53
  ```
54
54
 
55
- See more at <a href="https://wppconnect-team.github.io/wppconnect/pages/Getting%20Started/installation.html">Getting Started</a>
55
+ See more at <a href="https://wppconnect.io/wppconnect/pages/Getting%20Started/installation.html">Getting Started</a>
56
56
 
57
57
  ## Development
58
58
 
@@ -163,6 +163,10 @@ var HostLayer = /** @class */ (function () {
163
163
  this.log('verbose', 'Injecting wapi.js');
164
164
  options = {
165
165
  deviceName: this.options.deviceName,
166
+ disableGoogleAnalytics: this.options.disableGoogleAnalytics,
167
+ googleAnalyticsId: this.options.googleAnalyticsId,
168
+ linkPreviewApiServers: this.options.linkPreviewApiServers,
169
+ poweredBy: this.options.poweredBy,
166
170
  };
167
171
  return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (options) {
168
172
  window.WPPConfig = options;
@@ -169,10 +169,14 @@ var ListenerLayer = /** @class */ (function (_super) {
169
169
  .evaluate(function () {
170
170
  try {
171
171
  if (!window['onMessage'].exposed) {
172
- window.WAPI.waitNewMessages(false, function (data) {
173
- data.forEach(function (message) {
174
- window['onMessage'](message);
175
- });
172
+ WPP.on('chat.new_message', function (msg) {
173
+ if (msg.isSentByMe || msg.isStatusV3) {
174
+ return;
175
+ }
176
+ var serialized = WAPI.processMessageObj(msg, false, false);
177
+ if (serialized) {
178
+ window['onMessage'](serialized);
179
+ }
176
180
  });
177
181
  window['onMessage'].exposed = true;
178
182
  }
@@ -191,7 +195,12 @@ var ListenerLayer = /** @class */ (function (_super) {
191
195
  }
192
196
  try {
193
197
  if (!window['onAnyMessage'].exposed) {
194
- window.WAPI.allNewMessagesListener(window['onAnyMessage']);
198
+ WPP.on('chat.new_message', function (msg) {
199
+ var serialized = WAPI.processMessageObj(msg, true, false);
200
+ if (serialized) {
201
+ window['onAnyMessage'](serialized);
202
+ }
203
+ });
195
204
  window['onAnyMessage'].exposed = true;
196
205
  }
197
206
  }
@@ -254,7 +263,7 @@ var ListenerLayer = /** @class */ (function (_super) {
254
263
  }
255
264
  try {
256
265
  if (!window['onPresenceChanged'].exposed) {
257
- window.WAPI.onPresenceChanged(window['onPresenceChanged']);
266
+ WPP.on('chat.presence_change', window['onPresenceChanged']);
258
267
  window['onPresenceChanged'].exposed = true;
259
268
  }
260
269
  }
@@ -235,21 +235,30 @@ var RetrieverLayer = /** @class */ (function (_super) {
235
235
  RetrieverLayer.prototype.getAllGroups = function (withNewMessagesOnly) {
236
236
  if (withNewMessagesOnly === void 0) { withNewMessagesOnly = false; }
237
237
  return __awaiter(this, void 0, void 0, function () {
238
- var chats, chats;
238
+ var _this = this;
239
239
  return __generator(this, function (_a) {
240
240
  switch (_a.label) {
241
- case 0:
242
- if (!withNewMessagesOnly) return [3 /*break*/, 2];
243
- return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () { return WAPI.getAllChatsWithNewMsg(); })];
244
- case 1:
245
- chats = _a.sent();
246
- return [2 /*return*/, chats.filter(function (chat) { return chat.isGroup; })];
247
- case 2: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function () {
248
- return WAPI.getAllChats();
249
- })];
250
- case 3:
251
- chats = _a.sent();
252
- return [2 /*return*/, chats.filter(function (chat) { return chat.isGroup; })];
241
+ case 0: return [4 /*yield*/, (0, helpers_1.evaluateAndReturn)(this.page, function (_a) {
242
+ var withNewMessagesOnly = _a.withNewMessagesOnly;
243
+ return __awaiter(_this, void 0, void 0, function () {
244
+ var chats, groups;
245
+ return __generator(this, function (_b) {
246
+ switch (_b.label) {
247
+ case 0: return [4 /*yield*/, WPP.chat.list({
248
+ onlyGroups: true,
249
+ onlyWithUnreadMessage: withNewMessagesOnly,
250
+ })];
251
+ case 1:
252
+ chats = _b.sent();
253
+ return [4 /*yield*/, Promise.all(chats.map(function (c) { return WPP.group.ensureGroup(c.id); }))];
254
+ case 2:
255
+ groups = _b.sent();
256
+ return [2 /*return*/, groups.map(function (g) { return WAPI._serializeChatObj(g); })];
257
+ }
258
+ });
259
+ });
260
+ }, { withNewMessagesOnly: withNewMessagesOnly })];
261
+ case 1: return [2 /*return*/, _a.sent()];
253
262
  }
254
263
  });
255
264
  });
@@ -374,8 +383,8 @@ var RetrieverLayer = /** @class */ (function (_super) {
374
383
  case 1:
375
384
  status = _a.sent();
376
385
  return [2 /*return*/, {
377
- id: status.id.toString(),
378
- status: status.status,
386
+ id: contactId,
387
+ status: (status === null || status === void 0 ? void 0 : status.status) || status,
379
388
  }];
380
389
  }
381
390
  });
@@ -35,7 +35,7 @@ export declare class SenderLayer extends ListenerLayer {
35
35
  * useTemplateButtons: true, // False for legacy
36
36
  * buttons: [
37
37
  * {
38
- * url: 'https://wppconnect-team.github.io/',
38
+ * url: 'https://wppconnect.io/',
39
39
  * text: 'WPPConnect Site'
40
40
  * },
41
41
  * {
@@ -176,7 +176,7 @@ export declare class SenderLayer extends ListenerLayer {
176
176
  * useTemplateButtons: true, // False for legacy
177
177
  * buttons: [
178
178
  * {
179
- * url: 'https://wppconnect-team.github.io/',
179
+ * url: 'https://wppconnect.io/',
180
180
  * text: 'WPPConnect Site'
181
181
  * },
182
182
  * {
@@ -160,7 +160,7 @@ var SenderLayer = /** @class */ (function (_super) {
160
160
  * useTemplateButtons: true, // False for legacy
161
161
  * buttons: [
162
162
  * {
163
- * url: 'https://wppconnect-team.github.io/',
163
+ * url: 'https://wppconnect.io/',
164
164
  * text: 'WPPConnect Site'
165
165
  * },
166
166
  * {
@@ -16,6 +16,12 @@ export interface Chat {
16
16
  pin: number;
17
17
  msgs: null;
18
18
  kind: string;
19
+ isAnnounceGrpRestrict: boolean;
20
+ ephemeralDuration: number;
21
+ hasChatBeenOpened: boolean;
22
+ unreadMentionCount: number;
23
+ hasUnreadMention: boolean;
24
+ archiveAtMentionViewedInDrawer: boolean;
19
25
  isBroadcast: boolean;
20
26
  isGroup: boolean;
21
27
  isReadOnly: boolean;
@@ -3,6 +3,21 @@ export interface GroupMetadata {
3
3
  id: Wid;
4
4
  creation: number;
5
5
  owner: Wid;
6
+ desc: string;
7
+ descId: string;
8
+ descTime: number;
9
+ descOwner: Wid;
10
+ restrict: boolean;
11
+ announce: boolean;
12
+ noFrequentlyForwarded: boolean;
13
+ ephemeralDuration: number;
14
+ size: number;
15
+ support: boolean;
16
+ suspended: boolean;
17
+ terminated: boolean;
18
+ isParentGroup: boolean;
19
+ defaultSubgroup: boolean;
20
+ displayCadminPromotion: boolean;
6
21
  participants: any[];
7
22
  pendingParticipants: any[];
8
23
  }
@@ -110,5 +110,26 @@ export interface CreateConfig {
110
110
  * @default 'WPPConnect'
111
111
  */
112
112
  deviceName?: string | false;
113
+ /**
114
+ * Set custom Link Preview API servers
115
+ * @default null
116
+ */
117
+ linkPreviewApiServers?: string[] | null;
118
+ /**
119
+ * Disable custom Google Analytics
120
+ * @default true
121
+ */
122
+ disableGoogleAnalytics?: boolean;
123
+ /**
124
+ * Custom Google Analytics Tracker Id, like 'G-XXXXXXXXXX'
125
+ * collect analytics data to your GA account
126
+ * @default null
127
+ */
128
+ googleAnalyticsId?: string | null;
129
+ /**
130
+ * Custom variable for Google Analytics
131
+ * @default 'WPPConnect'
132
+ */
133
+ poweredBy?: string;
113
134
  }
114
135
  export declare const defaultOptions: CreateConfig;
@@ -21,4 +21,8 @@ exports.defaultOptions = {
21
21
  tokenStore: 'file',
22
22
  whatsappVersion: '2.2220.x',
23
23
  deviceName: false,
24
+ linkPreviewApiServers: null,
25
+ disableGoogleAnalytics: true,
26
+ googleAnalyticsId: null,
27
+ poweredBy: 'WPPConnect',
24
28
  };
@@ -147,7 +147,7 @@ function create(sessionOrOption, catchQR, statusFind, options, browserSessionTok
147
147
  mergedOptions = __assign(__assign({}, create_config_1.defaultOptions), options);
148
148
  logger = mergedOptions.logger;
149
149
  if (usingDeprecatedCreate) {
150
- logger.warn('You are using deprecated create method, please use create({options}) See: https://wppconnect-team.github.io/wppconnect/pages/Getting%20Started/creating-client.html#passing-options-on-create');
150
+ logger.warn('You are using deprecated create method, please use create({options}) See: https://wppconnect.io/wppconnect/pages/Getting%20Started/creating-client.html#passing-options-on-create');
151
151
  }
152
152
  if (!mergedOptions.disableWelcome) {
153
153
  (0, welcome_1.welcomeScreen)();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wppconnect-team/wppconnect",
3
- "version": "1.14.2",
3
+ "version": "1.14.5",
4
4
  "description": "WPPConnect is an open source project developed by the JavaScript community with the aim of exporting functions from WhatsApp Web to the node, which can be used to support the creation of any interaction, such as customer service, media sending, intelligence recognition based on phrases artificial and many other things, use your imagination... 😀🤔💭",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -58,51 +58,51 @@
58
58
  },
59
59
  "homepage": "https://github.com/wppconnect-team/wppconnect#readme",
60
60
  "devDependencies": {
61
- "@babel/core": "^7.18.2",
61
+ "@babel/core": "^7.18.6",
62
62
  "@babel/eslint-parser": "^7.18.2",
63
63
  "@babel/eslint-plugin": "^7.17.7",
64
- "@babel/preset-env": "^7.18.2",
65
- "@commitlint/cli": "^17.0.2",
66
- "@commitlint/config-conventional": "^17.0.2",
67
- "@commitlint/cz-commitlint": "^17.0.0",
64
+ "@babel/preset-env": "^7.18.6",
65
+ "@commitlint/cli": "^17.0.3",
66
+ "@commitlint/config-conventional": "^17.0.3",
67
+ "@commitlint/cz-commitlint": "^17.0.3",
68
68
  "@types/atob": "^2.1.2",
69
69
  "@types/mime-types": "^2.1.1",
70
70
  "@types/mocha": "^9.1.1",
71
- "@types/node": "^16.11.39",
71
+ "@types/node": "^16.11.43",
72
72
  "@types/rimraf": "^3.0.2",
73
- "@types/sharp": "^0.30.2",
73
+ "@types/sharp": "^0.30.4",
74
74
  "@types/shelljs": "^0.8.11",
75
75
  "@types/tmp": "^0.2.3",
76
76
  "@types/ws": "^8.5.3",
77
- "@typescript-eslint/eslint-plugin": "^5.27.0",
78
- "@typescript-eslint/parser": "^5.27.0",
77
+ "@typescript-eslint/eslint-plugin": "^5.29.0",
78
+ "@typescript-eslint/parser": "^5.29.0",
79
79
  "babel-loader": "^8.2.5",
80
80
  "commitizen": "^4.2.4",
81
- "concurrently": "^7.2.1",
81
+ "concurrently": "^7.2.2",
82
82
  "conventional-changelog-cli": "^2.2.2",
83
83
  "copy-webpack-plugin": "^11.0.0",
84
- "eslint": "^8.17.0",
84
+ "eslint": "^8.18.0",
85
85
  "eslint-config-prettier": "^8.5.0",
86
86
  "eslint-plugin-prettier": "^4.0.0",
87
87
  "gulp": "^4.0.2",
88
88
  "husky": "^8.0.1",
89
89
  "license-check-and-add": "^4.0.5",
90
90
  "mocha": "^10.0.0",
91
- "prettier": "^2.6.2",
91
+ "prettier": "^2.7.1",
92
92
  "pretty-quick": "^3.1.3",
93
93
  "regenerator-runtime": "^0.13.9",
94
- "release-it": "^15.0.0",
94
+ "release-it": "^15.1.1",
95
95
  "shx": "^0.3.4",
96
- "ts-node": "^10.8.1",
96
+ "ts-node": "^10.8.2",
97
97
  "typedoc": "^0.21.10",
98
98
  "typedoc-plugin-pages": "^1.1.0",
99
- "typescript": "^4.7.3",
99
+ "typescript": "^4.7.4",
100
100
  "webpack": "^5.73.0",
101
- "webpack-cli": "^4.9.2"
101
+ "webpack-cli": "^4.10.0"
102
102
  },
103
103
  "dependencies": {
104
- "@wppconnect/wa-js": "^2.6.0",
105
- "@wppconnect/wa-version": "^1.1.92",
104
+ "@wppconnect/wa-js": "^2.8.1",
105
+ "@wppconnect/wa-version": "^1.1.104",
106
106
  "atob": "^2.1.2",
107
107
  "axios": "^0.27.2",
108
108
  "boxen": "^5.1.2",
@@ -113,23 +113,23 @@
113
113
  "file-type": "~16.5.3",
114
114
  "futoin-hkdf": "^1.5.1",
115
115
  "latest-version": "^5.1.0",
116
- "logform": "^2.4.0",
116
+ "logform": "^2.4.2",
117
117
  "lookpath": "^1.2.2",
118
118
  "mime-types": "^2.1.35",
119
119
  "puppeteer": "*",
120
- "puppeteer-extra": "^3.2.3",
121
- "puppeteer-extra-plugin-stealth": "^2.9.0",
120
+ "puppeteer-extra": "^3.3.4",
121
+ "puppeteer-extra-plugin-stealth": "^2.10.1",
122
122
  "puppeteer-extra-plugin-user-data-dir": "^2.3.1",
123
123
  "puppeteer-extra-plugin-user-preferences": "^2.3.1",
124
124
  "qrcode-terminal": "^0.12.0",
125
125
  "reflect-metadata": "^0.1.13",
126
126
  "rimraf": "^3.0.2",
127
127
  "sanitize-filename": "^1.6.3",
128
- "sharp": "^0.30.6",
128
+ "sharp": "^0.30.7",
129
129
  "tmp": "^0.2.1",
130
130
  "tree-kill": "^1.2.2",
131
- "winston": "^3.7.2",
132
- "ws": "^8.7.0"
131
+ "winston": "^3.8.1",
132
+ "ws": "^8.8.0"
133
133
  },
134
134
  "optionalDependencies": {
135
135
  "fsevents": "^2.3.2"