@wppconnect-team/wppconnect 2.4.0 → 2.4.6
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/dist/api/helpers/evaluate-with-error-code.d.ts +10 -0
- package/dist/api/helpers/evaluate-with-error-code.js +49 -0
- package/dist/api/helpers/exposed.enum.d.ts +9 -1
- package/dist/api/helpers/exposed.enum.js +8 -0
- package/dist/api/helpers/index.d.ts +1 -0
- package/dist/api/helpers/index.js +3 -1
- package/dist/api/helpers/listen-incoming-call.d.ts +12 -0
- package/dist/api/helpers/listen-incoming-call.js +98 -0
- package/dist/api/layers/business.layer.d.ts +2 -2
- package/dist/api/layers/business.layer.js +2 -2
- package/dist/api/layers/call.layer.d.ts +264 -0
- package/dist/api/layers/call.layer.js +426 -0
- package/dist/api/layers/listener.layer.d.ts +114 -1
- package/dist/api/layers/listener.layer.js +217 -3
- package/dist/api/model/call.d.ts +124 -0
- package/dist/api/model/call.js +18 -0
- package/dist/api/model/incoming-call.d.ts +6 -0
- package/dist/api/model/index.d.ts +1 -0
- package/dist/api/model/index.js +1 -0
- package/dist/api/whatsapp.d.ts +0 -6
- package/dist/api/whatsapp.js +0 -10
- package/dist/controllers/browser.js +13 -9
- package/package.json +7 -3
- package/CHANGELOG.md +0 -1711
- package/documentation/readme-reference.md +0 -118
- package/eslint.config.mjs +0 -130
- package/img/wppconnect-banner.jpeg +0 -0
- package/scripts/docs-redirects.mjs +0 -70
- package/scripts/typedoc-canonical.mjs +0 -49
- package/test.mp4 +0 -0
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
# Retained README reference / Referência preservada do README
|
|
2
|
-
|
|
3
|
-
This document preserves the previous `README.md` for technical details, acknowledgments and history. Start with [README.md](../README.md) or [README.pt-BR.md](../README.pt-BR.md) for the current verified entry path. Older commands, release claims, third-party examples and API signatures here may need migration; consult the current source and linked guides.
|
|
4
|
-
|
|
5
|
-
Este documento preserva o `README.md` anterior com detalhes técnicos, agradecimentos e histórico. Comece pelo [README em português](../README.pt-BR.md) para as instruções iniciais conferidas. Comandos antigos, afirmações sobre releases, exemplos de terceiros e assinaturas de API podem exigir migração; consulte os fontes e guias atuais.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
<!-- wppconnect-official-brand -->
|
|
10
|
-
<p align="center">
|
|
11
|
-
<a href="https://wppconnect-team.github.io/">
|
|
12
|
-
<picture>
|
|
13
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://wppconnect-team.github.io/brand/wppconnect-dark.png" />
|
|
14
|
-
<img src="https://wppconnect-team.github.io/brand/wppconnect-light.png" alt="WPPConnect" width="220" height="121" />
|
|
15
|
-
</picture>
|
|
16
|
-
</a>
|
|
17
|
-
</p>
|
|
18
|
-
<!-- /wppconnect-official-brand -->
|
|
19
|
-
|
|
20
|
-
# WPPConnect 📞
|
|
21
|
-
|
|
22
|
-
[](https://www.npmjs.com/package/@wppconnect-team/wppconnect)
|
|
23
|
-
[](https://www.npmjs.com/package/@wppconnect-team/wppconnect)
|
|
24
|
-
[](https://isitmaintained.com/project/wppconnect-team/wppconnect 'Average time to resolve an issue')
|
|
25
|
-
[](https://isitmaintained.com/project/wppconnect-team/wppconnect 'Percentage of issues still open')
|
|
26
|
-
[](https://github.com/wppconnect-team/wppconnect/actions)
|
|
27
|
-
[](https://github.com/wppconnect-team/wppconnect/actions)
|
|
28
|
-
[](https://github.com/release-it/release-it)
|
|
29
|
-
|
|
30
|
-
> 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... 😀🤔💭
|
|
31
|
-
|
|
32
|
-
<p align="center">
|
|
33
|
-
<a target="_blank" href="https://wppconnect.io/docs/tutorial/basics/installation">Getting Started</a> •
|
|
34
|
-
<a target="_blank" href="https://wppconnect.io/docs/tutorial/basics/basic-functions">Basic Function</a> •
|
|
35
|
-
<a target="_blank" href="https://wppconnect.io/wppconnect">Documentation</a>
|
|
36
|
-
</p>
|
|
37
|
-
|
|
38
|
-
## Our online channels
|
|
39
|
-
|
|
40
|
-
[](https://discord.gg/JU5JGGKGNG)
|
|
41
|
-
[](https://t.me/wppconnect)
|
|
42
|
-
[](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
|
|
43
|
-
[](https://www.youtube.com/c/wppconnect)
|
|
44
|
-
|
|
45
|
-
## Functions
|
|
46
|
-
|
|
47
|
-
| | |
|
|
48
|
-
| ---------------------------------------------------------- | --- |
|
|
49
|
-
| Automatic QR Refresh | ✔ |
|
|
50
|
-
| Send **text, image, video, audio and docs** | ✔ |
|
|
51
|
-
| Get **contacts, chats, groups, group members, Block List** | ✔ |
|
|
52
|
-
| Send contacts | ✔ |
|
|
53
|
-
| Send stickers | ✔ |
|
|
54
|
-
| Send stickers GIF | ✔ |
|
|
55
|
-
| Multiple Sessions | ✔ |
|
|
56
|
-
| Forward Messages | ✔ |
|
|
57
|
-
| Receive message | ✔ |
|
|
58
|
-
| insert user section | ✔ |
|
|
59
|
-
| Send _location_ | ✔ |
|
|
60
|
-
| **and much more** | ✔ |
|
|
61
|
-
|
|
62
|
-
See more at <a target="_blank" href="https://wppconnect.io/wppconnect/classes/Whatsapp.html">WhatsApp methods</a>
|
|
63
|
-
|
|
64
|
-
## Installation
|
|
65
|
-
|
|
66
|
-
The first thing that you had to do is install the `npm package` :
|
|
67
|
-
|
|
68
|
-
```bash
|
|
69
|
-
npm i --save @wppconnect-team/wppconnect
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
See more at <a target="_blank" href="https://wppconnect.io/docs/tutorial/basics/installation">Getting Started</a>
|
|
73
|
-
|
|
74
|
-
## Development
|
|
75
|
-
|
|
76
|
-
Building WPPConnect is really simple, to build the entire project just run
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
> npm run build
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
# Update checking
|
|
83
|
-
|
|
84
|
-
Whatsapp is in constant change. In order to tackle this issue, we suggest always keeping your Wppconnect package up-to-date.
|
|
85
|
-
|
|
86
|
-
The method/function names won't change, only their core algorithm. This way you won't have to makes changes in your code at every update.
|
|
87
|
-
They will remain the same forever but might experience deprecation.
|
|
88
|
-
|
|
89
|
-
## Maintainers
|
|
90
|
-
|
|
91
|
-
Maintainers are needed, I cannot keep with all the updates by myself. If you are
|
|
92
|
-
interested please open a Pull Request.
|
|
93
|
-
|
|
94
|
-
## Contributing
|
|
95
|
-
|
|
96
|
-
Pull requests are welcome. For major changes, please open an issue first to
|
|
97
|
-
discuss what you would like to change.
|
|
98
|
-
|
|
99
|
-
## Star History
|
|
100
|
-
|
|
101
|
-
[](https://star-history.dera.page/#wppconnect-team/wppconnect&wppconnect-team/wa-js&Date)
|
|
102
|
-
|
|
103
|
-
## License
|
|
104
|
-
|
|
105
|
-
This file is part of WPPConnect.
|
|
106
|
-
|
|
107
|
-
WPPConnect is free software: you can redistribute it and/or modify
|
|
108
|
-
it under the terms of the GNU Lesser General Public License as published by
|
|
109
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
110
|
-
(at your option) any later version.
|
|
111
|
-
|
|
112
|
-
WPPConnect is distributed in the hope that it will be useful,
|
|
113
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
114
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
115
|
-
GNU Lesser General Public License for more details.
|
|
116
|
-
|
|
117
|
-
You should have received a copy of the GNU Lesser General Public License
|
|
118
|
-
along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
|
package/eslint.config.mjs
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
// @ts-check
|
|
2
|
-
import js from '@eslint/js';
|
|
3
|
-
import tseslint from 'typescript-eslint';
|
|
4
|
-
import headerPlugin from '@tony.ganchev/eslint-plugin-header';
|
|
5
|
-
import prettierPlugin from 'eslint-plugin-prettier';
|
|
6
|
-
import prettierConfig from 'eslint-config-prettier';
|
|
7
|
-
import globals from 'globals';
|
|
8
|
-
|
|
9
|
-
const licenseHeader = [
|
|
10
|
-
'',
|
|
11
|
-
' * This file is part of WPPConnect.',
|
|
12
|
-
' *',
|
|
13
|
-
' * WPPConnect is free software: you can redistribute it and/or modify',
|
|
14
|
-
' * it under the terms of the GNU Lesser General Public License as published by',
|
|
15
|
-
' * the Free Software Foundation, either version 3 of the License, or',
|
|
16
|
-
' * (at your option) any later version.',
|
|
17
|
-
' *',
|
|
18
|
-
' * WPPConnect is distributed in the hope that it will be useful,',
|
|
19
|
-
' * but WITHOUT ANY WARRANTY; without even the implied warranty of',
|
|
20
|
-
' * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the',
|
|
21
|
-
' * GNU Lesser General Public License for more details.',
|
|
22
|
-
' *',
|
|
23
|
-
' * You should have received a copy of the GNU Lesser General Public License',
|
|
24
|
-
' * along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.',
|
|
25
|
-
' ',
|
|
26
|
-
];
|
|
27
|
-
|
|
28
|
-
export default tseslint.config(
|
|
29
|
-
// ─── Global ignores ────────────────────────────────────────────────────────
|
|
30
|
-
{
|
|
31
|
-
ignores: ['dist/**', 'node_modules/**', 'tokens/**'],
|
|
32
|
-
},
|
|
33
|
-
|
|
34
|
-
// ─── Base rules for all files ──────────────────────────────────────────────
|
|
35
|
-
{
|
|
36
|
-
extends: [js.configs.recommended],
|
|
37
|
-
plugins: {
|
|
38
|
-
header: headerPlugin,
|
|
39
|
-
prettier: prettierPlugin,
|
|
40
|
-
},
|
|
41
|
-
rules: {
|
|
42
|
-
'no-async-promise-executor': 'off',
|
|
43
|
-
'no-constant-condition': 'off',
|
|
44
|
-
'no-empty': ['error', { allowEmptyCatch: true }],
|
|
45
|
-
'no-unused-vars': 'off',
|
|
46
|
-
'no-useless-assignment': 'off',
|
|
47
|
-
'no-useless-catch': 'off',
|
|
48
|
-
'no-useless-escape': 'off',
|
|
49
|
-
'prefer-const': 'off',
|
|
50
|
-
'preserve-caught-error': 'off',
|
|
51
|
-
'header/header': [2, 'block', licenseHeader, 1],
|
|
52
|
-
'prettier/prettier': ['error', { endOfLine: 'auto' }],
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
|
|
56
|
-
// ─── TypeScript source files ───────────────────────────────────────────────
|
|
57
|
-
{
|
|
58
|
-
files: ['src/**/*.ts'],
|
|
59
|
-
extends: [...tseslint.configs.recommended],
|
|
60
|
-
rules: {
|
|
61
|
-
'@typescript-eslint/ban-ts-comment': 'off',
|
|
62
|
-
'@typescript-eslint/ban-types': 'off',
|
|
63
|
-
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
|
64
|
-
'@typescript-eslint/no-duplicate-enum-values': 'off',
|
|
65
|
-
'@typescript-eslint/no-empty-function': 'off',
|
|
66
|
-
'@typescript-eslint/no-explicit-any': 'off',
|
|
67
|
-
'@typescript-eslint/no-inferrable-types': 'off',
|
|
68
|
-
'@typescript-eslint/no-namespace': 'off',
|
|
69
|
-
'@typescript-eslint/no-require-imports': 'off',
|
|
70
|
-
'@typescript-eslint/no-unsafe-function-type': 'off',
|
|
71
|
-
'@typescript-eslint/no-unused-expressions': 'off',
|
|
72
|
-
'@typescript-eslint/no-unused-vars': 'off',
|
|
73
|
-
'@typescript-eslint/no-var-requires': 'off',
|
|
74
|
-
'@typescript-eslint/no-wrapper-object-types': 'off',
|
|
75
|
-
'@typescript-eslint/prefer-namespace-keyword': 'off',
|
|
76
|
-
'prefer-const': 'off',
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
|
|
80
|
-
// ─── Lib JS files (browser + custom globals) ──────────────────────────────
|
|
81
|
-
{
|
|
82
|
-
files: ['src/lib/**/*.js'],
|
|
83
|
-
ignores: ['src/lib/**/webpack.*.js', 'src/lib/**/gulpfile.js'],
|
|
84
|
-
languageOptions: {
|
|
85
|
-
ecmaVersion: 2022,
|
|
86
|
-
sourceType: 'module',
|
|
87
|
-
globals: {
|
|
88
|
-
...globals.browser,
|
|
89
|
-
...globals.commonjs,
|
|
90
|
-
...globals.amd,
|
|
91
|
-
...globals.es2015,
|
|
92
|
-
axios: 'readonly',
|
|
93
|
-
Debug: 'readonly',
|
|
94
|
-
Store: 'readonly',
|
|
95
|
-
WAPI: 'readonly',
|
|
96
|
-
WPP: 'readonly',
|
|
97
|
-
webpackJsonp: 'readonly',
|
|
98
|
-
WWebJS: 'readonly',
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
rules: {
|
|
102
|
-
'no-array-constructor': 'off',
|
|
103
|
-
'no-prototype-builtins': 'off',
|
|
104
|
-
'no-redeclare': 'off',
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
|
|
108
|
-
// ─── Webpack / gulpfile (Node env, no browser globals) ────────────────────
|
|
109
|
-
{
|
|
110
|
-
files: ['src/lib/**/webpack.*.js', 'src/lib/**/gulpfile.js'],
|
|
111
|
-
languageOptions: {
|
|
112
|
-
globals: globals.node,
|
|
113
|
-
},
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
// ─── Examples ──────────────────────────────────────────────────────────────
|
|
117
|
-
{
|
|
118
|
-
files: ['examples/**/*.js'],
|
|
119
|
-
languageOptions: {
|
|
120
|
-
globals: {
|
|
121
|
-
...globals.node,
|
|
122
|
-
...globals.commonjs,
|
|
123
|
-
...globals.es2015,
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
|
|
128
|
-
// ─── Prettier (disable conflicting rules — must be last) ───────────────────
|
|
129
|
-
prettierConfig
|
|
130
|
-
);
|
|
Binary file
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { dirname, resolve } from 'node:path';
|
|
3
|
-
|
|
4
|
-
const output = resolve('api-docs');
|
|
5
|
-
const base = 'https://wppconnect.io/wppconnect/';
|
|
6
|
-
const redirects = {
|
|
7
|
-
'variables/WAJS.webpack.isInjected.html': 'variables/WAJS.isInjected.html',
|
|
8
|
-
'variables/WAJS.webpack.__debug.html': 'variables/WAJS.loader.__debug.html',
|
|
9
|
-
'variables/WAJS.webpack.webpackRequire.html':
|
|
10
|
-
'variables/WAJS.loader.moduleRequire.html',
|
|
11
|
-
'modules/WAJS.webpack.html': 'modules/WAJS.loader.html',
|
|
12
|
-
'functions/WAJS.webpack.onReady.html': 'functions/WAJS.loader.onReady.html',
|
|
13
|
-
'interfaces/WAJS.ev.WebpackEvents.html':
|
|
14
|
-
'interfaces/WAJS.ev.LoaderEvents.html',
|
|
15
|
-
'pages/getting-started/installation.html':
|
|
16
|
-
'https://wppconnect.io/docs/tutorial/basics/installation/',
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
for (const [oldPath, target] of Object.entries(redirects)) {
|
|
20
|
-
const destination = new URL(target, base);
|
|
21
|
-
if (destination.href.startsWith(base)) {
|
|
22
|
-
await access(resolve(output, target));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const file = resolve(output, oldPath);
|
|
26
|
-
await mkdir(dirname(file), { recursive: true });
|
|
27
|
-
const html = [
|
|
28
|
-
'<!doctype html><html lang="en"><meta charset="utf-8">',
|
|
29
|
-
'<title>Documentation moved</title>',
|
|
30
|
-
'<link rel="canonical" href="' + destination.href + '">',
|
|
31
|
-
'<meta http-equiv="refresh" content="0; url=' + destination.href + '">',
|
|
32
|
-
'<p>Documentation moved. <a href="' +
|
|
33
|
-
destination.href +
|
|
34
|
-
'">Open the current reference</a>.</p></html>',
|
|
35
|
-
].join('\n');
|
|
36
|
-
await writeFile(file, html, { flag: 'wx' });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// TypeDoc uses the directory URL in the home page's canonical link.
|
|
40
|
-
const sitemap = resolve(output, 'sitemap.xml');
|
|
41
|
-
const xml = await readFile(sitemap, 'utf8');
|
|
42
|
-
const canonicalXml = xml.replace(
|
|
43
|
-
'<loc>' + base + 'index.html</loc>',
|
|
44
|
-
'<loc>' + base + '</loc>'
|
|
45
|
-
);
|
|
46
|
-
const locations = Array.from(
|
|
47
|
-
canonicalXml.matchAll(/<loc>([^<]+)<\/loc>/g),
|
|
48
|
-
(match) => match[1]
|
|
49
|
-
);
|
|
50
|
-
if (!locations.some((location) => location === base))
|
|
51
|
-
throw new Error('Missing API reference home in sitemap');
|
|
52
|
-
for (const url of locations) {
|
|
53
|
-
const { origin, pathname } = new URL(url);
|
|
54
|
-
const root = new URL(base);
|
|
55
|
-
if (origin !== root.origin || !pathname.startsWith(root.pathname)) {
|
|
56
|
-
throw new Error('Unexpected sitemap URL: ' + url);
|
|
57
|
-
}
|
|
58
|
-
const path = pathname.slice(root.pathname.length) || 'index.html';
|
|
59
|
-
const html = await readFile(resolve(output, path), 'utf8');
|
|
60
|
-
const canonicals =
|
|
61
|
-
html.split('</head>', 1)[0].match(/<link\b[^>]*\brel="canonical"[^>]*>/g) ??
|
|
62
|
-
[];
|
|
63
|
-
if (
|
|
64
|
-
canonicals.length !== 1 ||
|
|
65
|
-
!canonicals[0].includes('href="' + url + '"')
|
|
66
|
-
) {
|
|
67
|
-
throw new Error('Invalid canonical on ' + url);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
await writeFile(sitemap, canonicalXml);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { JSX } from 'typedoc';
|
|
3
|
-
|
|
4
|
-
export function load(app) {
|
|
5
|
-
const base = app.options.getValue('hostedBaseUrl');
|
|
6
|
-
app.renderer.hooks.on('head.end', ({ page }) => {
|
|
7
|
-
// TypeDoc supplies the home page canonical through its sitemap plugin.
|
|
8
|
-
if (page.url === 'index.html') return;
|
|
9
|
-
return JSX.createElement('link', {
|
|
10
|
-
rel: 'canonical',
|
|
11
|
-
href: new URL(page.url, base).href,
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const manifest = new URL(
|
|
16
|
-
'../node_modules/@wppconnect/wa-js/package.json',
|
|
17
|
-
import.meta.url
|
|
18
|
-
);
|
|
19
|
-
const { version } = JSON.parse(readFileSync(manifest, 'utf8'));
|
|
20
|
-
app.renderer.hooks.on('content.begin', ({ page }) => {
|
|
21
|
-
if (!/\/WAJS\./.test(page.url)) return;
|
|
22
|
-
return JSX.createElement(
|
|
23
|
-
'p',
|
|
24
|
-
null,
|
|
25
|
-
'The Node.js SDK re-exports the WAJS namespace for TypeScript. This reference describes types from ',
|
|
26
|
-
JSX.createElement(
|
|
27
|
-
'a',
|
|
28
|
-
{
|
|
29
|
-
href:
|
|
30
|
-
'https://github.com/wppconnect-team/wa-js/releases/tag/v' + version,
|
|
31
|
-
},
|
|
32
|
-
'WA-JS ' + version
|
|
33
|
-
),
|
|
34
|
-
'. For operations available on a connected Node.js client, see ',
|
|
35
|
-
JSX.createElement(
|
|
36
|
-
'a',
|
|
37
|
-
{ href: new URL('classes/Whatsapp.html', base).href },
|
|
38
|
-
'Whatsapp'
|
|
39
|
-
),
|
|
40
|
-
'. For functions running inside WhatsApp Web, see the ',
|
|
41
|
-
JSX.createElement(
|
|
42
|
-
'a',
|
|
43
|
-
{ href: 'https://wppconnect.io/wa-js/' },
|
|
44
|
-
'WA-JS browser API'
|
|
45
|
-
),
|
|
46
|
-
'.'
|
|
47
|
-
);
|
|
48
|
-
});
|
|
49
|
-
}
|
package/test.mp4
DELETED
|
Binary file
|