@wppconnect/wa-js 4.1.3-alpha.0 → 4.3.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.
- package/CHANGELOG.md +2 -2
- package/CLAUDE.md +124 -0
- package/README.md +246 -0
- package/dist/index.d.ts +1 -0
- package/dist/lists/functions/addChats.d.ts +27 -0
- package/dist/lists/functions/create.d.ts +29 -0
- package/dist/lists/functions/index.d.ts +21 -0
- package/dist/lists/functions/list.d.ts +34 -0
- package/dist/{whatsapp/functions/getErrorCodeFromLogoutReason.d.ts → lists/functions/remove.d.ts} +10 -4
- package/dist/lists/functions/removeChats.d.ts +27 -0
- package/dist/lists/functions/rename.d.ts +26 -0
- package/dist/lists/index.d.ts +16 -0
- package/dist/whatsapp/collections/ButtonCollection.d.ts +3 -1
- package/dist/whatsapp/enums/LogoutReason.d.ts +16 -2
- package/dist/whatsapp/functions/callGetSearchContext.d.ts +19 -0
- package/dist/whatsapp/functions/getSearchContext.d.ts +11 -0
- package/dist/whatsapp/functions/index.d.ts +1 -1
- package/dist/whatsapp/functions/logoutReason.d.ts +24 -0
- package/dist/whatsapp/functions/subscribePresence.d.ts +14 -0
- package/dist/whatsapp/models/CallModel.d.ts +4 -2
- package/dist/whatsapp/models/LabelModel.d.ts +2 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +3 -3
- package/package.json +22 -21
- package/tests/smoke.spec.ts +171 -0
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Compressor.js v1.
|
|
2
|
+
* Compressor.js v1.3.0
|
|
3
3
|
* https://fengyuanchen.github.io/compressorjs
|
|
4
4
|
*
|
|
5
5
|
* Copyright 2018-present Chen Fengyuan
|
|
6
6
|
* Released under the MIT license
|
|
7
7
|
*
|
|
8
|
-
* Date:
|
|
8
|
+
* Date: 2026-04-06T07:12:45.816Z
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
/*!
|
|
@@ -121,4 +121,4 @@
|
|
|
121
121
|
|
|
122
122
|
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
123
123
|
|
|
124
|
-
/*! wppconnect-team/wa-js v4.
|
|
124
|
+
/*! wppconnect-team/wa-js v4.3.0 */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wppconnect/wa-js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "WPPConnect/WA-JS is an open-source project with the aim of exporting functions from WhatsApp Web",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": {
|
|
@@ -41,30 +41,31 @@
|
|
|
41
41
|
"update-module-id": "ts-node ./src/tools/updateModuleID.ts",
|
|
42
42
|
"wa-source:clean": "shx rm -rf wa-source",
|
|
43
43
|
"wa-source:format": "sh -c 'prettier --ignore-path .prettierignore --write ./wa-source/$1' --",
|
|
44
|
+
"wa-source:populate": "ts-node ./src/tools/populateWaSources.ts",
|
|
44
45
|
"watch": "webpack watch --devtool inline-source-map --mode development"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
|
-
"@commitlint/cli": "^20.5.
|
|
48
|
-
"@commitlint/config-conventional": "^20.5.
|
|
49
|
-
"@commitlint/prompt-cli": "^20.5.
|
|
48
|
+
"@commitlint/cli": "^20.5.3",
|
|
49
|
+
"@commitlint/config-conventional": "^20.5.3",
|
|
50
|
+
"@commitlint/prompt-cli": "^20.5.3",
|
|
50
51
|
"@eslint/js": "^10.0.1",
|
|
51
|
-
"@playwright/test": "^1.
|
|
52
|
-
"@tony.ganchev/eslint-plugin-header": "^3.
|
|
52
|
+
"@playwright/test": "^1.60.0",
|
|
53
|
+
"@tony.ganchev/eslint-plugin-header": "^3.4.4",
|
|
53
54
|
"@types/debug": "^4.1.13",
|
|
54
55
|
"@types/node": "^16.18.126",
|
|
55
56
|
"@types/node-fetch": "^2.6.13",
|
|
56
57
|
"@types/parse-data-url": "^3.0.2",
|
|
57
58
|
"@types/shelljs": "^0.10.0",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
59
|
-
"@typescript-eslint/parser": "^8.
|
|
60
|
-
"@wppconnect/wa-version": "^1.5.
|
|
59
|
+
"@typescript-eslint/eslint-plugin": "^8.59.4",
|
|
60
|
+
"@typescript-eslint/parser": "^8.59.4",
|
|
61
|
+
"@wppconnect/wa-version": "^1.5.3967",
|
|
61
62
|
"buffer": "^6.0.3",
|
|
62
63
|
"compare-versions": "^6.1.1",
|
|
63
|
-
"compressorjs": "^1.
|
|
64
|
-
"conventional-changelog-angular": "^8.3.
|
|
64
|
+
"compressorjs": "^1.3.0",
|
|
65
|
+
"conventional-changelog-angular": "^8.3.1",
|
|
65
66
|
"conventional-changelog-cli": "^5.0.0",
|
|
66
67
|
"debug": "^4.4.3",
|
|
67
|
-
"eslint": "^10.
|
|
68
|
+
"eslint": "^10.4.0",
|
|
68
69
|
"eslint-config-prettier": "^10.1.8",
|
|
69
70
|
"eslint-plugin-import": "^2.32.0",
|
|
70
71
|
"eslint-plugin-prettier": "^5.5.5",
|
|
@@ -75,22 +76,22 @@
|
|
|
75
76
|
"lint-staged": "^16.4.0",
|
|
76
77
|
"node-fetch": "^2.7.0",
|
|
77
78
|
"parse-data-url": "^6.0.0",
|
|
78
|
-
"playwright-chromium": "^1.
|
|
79
|
-
"prettier": "^3.8.
|
|
79
|
+
"playwright-chromium": "^1.60.0",
|
|
80
|
+
"prettier": "^3.8.3",
|
|
80
81
|
"release-it": "^19.2.4",
|
|
81
82
|
"shx": "^0.4.0",
|
|
82
|
-
"terser-webpack-plugin": "^5.
|
|
83
|
-
"ts-loader": "^9.5.
|
|
83
|
+
"terser-webpack-plugin": "^5.6.0",
|
|
84
|
+
"ts-loader": "^9.5.7",
|
|
84
85
|
"ts-morph": "^27.0.2",
|
|
85
86
|
"ts-node": "^10.9.2",
|
|
86
|
-
"typedoc": "^0.28.
|
|
87
|
+
"typedoc": "^0.28.19",
|
|
87
88
|
"typedoc-plugin-mdn-links": "^5.1.1",
|
|
88
|
-
"typedoc-plugin-missing-exports": "^4.1.
|
|
89
|
+
"typedoc-plugin-missing-exports": "^4.1.3",
|
|
89
90
|
"typescript": "^5.9.3",
|
|
90
91
|
"typescript-debounce-decorator": "^0.0.18",
|
|
91
|
-
"typescript-eslint": "^8.
|
|
92
|
-
"webpack": "^5.
|
|
93
|
-
"webpack-cli": "^
|
|
92
|
+
"typescript-eslint": "^8.59.4",
|
|
93
|
+
"webpack": "^5.106.2",
|
|
94
|
+
"webpack-cli": "^7.0.2"
|
|
94
95
|
},
|
|
95
96
|
"engines": {
|
|
96
97
|
"whatsapp-web": ">=2.2326.10-beta"
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2021 WPPConnect Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
// Smoke tests: validate the WPP bundle loads against the live WhatsApp Web
|
|
18
|
+
// page and that every public module still exposes the functions we ship in
|
|
19
|
+
// the README. They run unauthenticated (no QR scan needed) — the WhatsApp
|
|
20
|
+
// bundle resolves modules before login, and the loader flips `WPP.isReady`
|
|
21
|
+
// as soon as that is done. These tests catch the most common breakage:
|
|
22
|
+
// WhatsApp Web ships an update and one of our patched modules disappears
|
|
23
|
+
// or is renamed.
|
|
24
|
+
|
|
25
|
+
import { expect, test } from './wpp-test';
|
|
26
|
+
|
|
27
|
+
const expectedFunctions: Record<string, string[]> = {
|
|
28
|
+
blocklist: ['all', 'blockContact', 'isBlocked', 'unblockContact'],
|
|
29
|
+
cart: ['add', 'clear', 'get', 'remove', 'submit', 'update'],
|
|
30
|
+
catalog: [
|
|
31
|
+
'createProduct',
|
|
32
|
+
'delProducts',
|
|
33
|
+
'editProduct',
|
|
34
|
+
'getMyCatalog',
|
|
35
|
+
'getProductById',
|
|
36
|
+
'getProducts',
|
|
37
|
+
],
|
|
38
|
+
chat: ['deleteMessage', 'get', 'sendFileMessage', 'sendTextMessage'],
|
|
39
|
+
community: [
|
|
40
|
+
'addSubgroups',
|
|
41
|
+
'create',
|
|
42
|
+
'deactivate',
|
|
43
|
+
'getParticipants',
|
|
44
|
+
'getSubgroups',
|
|
45
|
+
'removeSubgroups',
|
|
46
|
+
],
|
|
47
|
+
conn: [
|
|
48
|
+
'getBuildConstants',
|
|
49
|
+
'getStreamData',
|
|
50
|
+
'isAuthenticated',
|
|
51
|
+
'logout',
|
|
52
|
+
],
|
|
53
|
+
contact: [
|
|
54
|
+
'get',
|
|
55
|
+
'getCommonGroups',
|
|
56
|
+
'getStatus',
|
|
57
|
+
'list',
|
|
58
|
+
'queryWidExists',
|
|
59
|
+
],
|
|
60
|
+
group: [
|
|
61
|
+
'addParticipants',
|
|
62
|
+
'canAdd',
|
|
63
|
+
'canDemote',
|
|
64
|
+
'canPromote',
|
|
65
|
+
'create',
|
|
66
|
+
'demoteParticipants',
|
|
67
|
+
'getAllGroups',
|
|
68
|
+
'getGroupInfoFromInviteCode',
|
|
69
|
+
'promoteParticipants',
|
|
70
|
+
'removeParticipants',
|
|
71
|
+
],
|
|
72
|
+
labels: [
|
|
73
|
+
'addNewLabel',
|
|
74
|
+
'addOrRemoveLabels',
|
|
75
|
+
'deleteLabel',
|
|
76
|
+
'editLabel',
|
|
77
|
+
'getAllLabels',
|
|
78
|
+
'getLabelById',
|
|
79
|
+
],
|
|
80
|
+
newsletter: [
|
|
81
|
+
'create',
|
|
82
|
+
'destroy',
|
|
83
|
+
'edit',
|
|
84
|
+
'follow',
|
|
85
|
+
'getSubscribers',
|
|
86
|
+
'mute',
|
|
87
|
+
'search',
|
|
88
|
+
'unfollow',
|
|
89
|
+
],
|
|
90
|
+
order: ['accept', 'decline', 'get', 'update'],
|
|
91
|
+
privacy: [
|
|
92
|
+
'get',
|
|
93
|
+
'setAbout',
|
|
94
|
+
'setAddGroup',
|
|
95
|
+
'setLastSeen',
|
|
96
|
+
'setOnline',
|
|
97
|
+
'setProfilePic',
|
|
98
|
+
'setReadReceipts',
|
|
99
|
+
'setStatus',
|
|
100
|
+
],
|
|
101
|
+
profile: [
|
|
102
|
+
'getMyProfileName',
|
|
103
|
+
'getMyProfilePicture',
|
|
104
|
+
'getMyStatus',
|
|
105
|
+
'isBusiness',
|
|
106
|
+
'setMyProfileName',
|
|
107
|
+
'setMyProfilePicture',
|
|
108
|
+
'setMyStatus',
|
|
109
|
+
],
|
|
110
|
+
status: [
|
|
111
|
+
'get',
|
|
112
|
+
'getMyStatus',
|
|
113
|
+
'sendImageStatus',
|
|
114
|
+
'sendReadStatus',
|
|
115
|
+
'sendTextStatus',
|
|
116
|
+
'sendVideoStatus',
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
test.describe('smoke: bundle injection', () => {
|
|
121
|
+
test('WPP global is exposed and reports ready', async ({ page }) => {
|
|
122
|
+
const probe = await page.evaluate(() => ({
|
|
123
|
+
hasWPP: typeof (window as any).WPP === 'object',
|
|
124
|
+
isReady: (window as any).WPP?.isReady === true,
|
|
125
|
+
isInjected: (window as any).WPP?.isInjected === true,
|
|
126
|
+
version: (window as any).WPP?.version,
|
|
127
|
+
license: (window as any).WPP?.license,
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
expect(probe.hasWPP).toBe(true);
|
|
131
|
+
expect(probe.isInjected).toBe(true);
|
|
132
|
+
expect(probe.isReady).toBe(true);
|
|
133
|
+
expect(probe.version).toMatch(/^\d+\.\d+\.\d+/);
|
|
134
|
+
expect(probe.license).toBe('Apache-2.0');
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
test('event emitter helpers are wired on WPP', async ({ page }) => {
|
|
138
|
+
const eventApi = await page.evaluate(() => {
|
|
139
|
+
const wpp = (window as any).WPP;
|
|
140
|
+
return ['on', 'off', 'once', 'emit', 'waitFor'].map(
|
|
141
|
+
(name) => typeof wpp?.[name]
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
expect(eventApi).toEqual(['function', 'function', 'function', 'function', 'function']);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
test.describe('smoke: module surface', () => {
|
|
150
|
+
for (const [moduleName, fns] of Object.entries(expectedFunctions)) {
|
|
151
|
+
test(`WPP.${moduleName} exposes its public functions`, async ({ page }) => {
|
|
152
|
+
const result = await page.evaluate(
|
|
153
|
+
({ moduleName, fns }) => {
|
|
154
|
+
const mod = (window as any).WPP?.[moduleName];
|
|
155
|
+
if (!mod) {
|
|
156
|
+
return { exists: false, missing: fns };
|
|
157
|
+
}
|
|
158
|
+
const missing = fns.filter((fn) => typeof mod[fn] !== 'function');
|
|
159
|
+
return { exists: true, missing };
|
|
160
|
+
},
|
|
161
|
+
{ moduleName, fns }
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
expect(result.exists, `WPP.${moduleName} is missing`).toBe(true);
|
|
165
|
+
expect(
|
|
166
|
+
result.missing,
|
|
167
|
+
`WPP.${moduleName} is missing functions: ${result.missing.join(', ')}`
|
|
168
|
+
).toEqual([]);
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
});
|