@wppconnect/wa-js 3.4.2 → 3.6.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 +1 -1
- package/README.md +57 -0
- package/dist/chat/functions/closeChat.d.ts +26 -0
- package/dist/chat/functions/index.d.ts +1 -0
- package/dist/conn/events/eventTypes.d.ts +2 -0
- package/dist/conn/events/index.d.ts +1 -0
- package/dist/conn/events/registerLogoutReasonEvent.d.ts +16 -0
- package/dist/whatsapp/enums/LogoutReason.d.ts +25 -8
- package/dist/whatsapp/functions/getErrorCodeFromLogoutReason.d.ts +20 -0
- package/dist/whatsapp/functions/index.d.ts +1 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -19,6 +19,13 @@
|
|
|
19
19
|
[](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
|
|
20
20
|
[](https://www.youtube.com/c/wppconnect)
|
|
21
21
|
|
|
22
|
+
|
|
23
|
+
### Top Contributors (last 45 days) widget
|
|
24
|
+
---
|
|
25
|
+

|
|
26
|
+
---
|
|
27
|
+
<sup><sub>Check also our [Public Dashboard](https://app.devactivity.com/public/?organizationLogin=wppconnect-team) powered by [devActivity](https://devactivity.com/?ref=public_widget)</sub></sup>
|
|
28
|
+
|
|
22
29
|
## How does it work
|
|
23
30
|
|
|
24
31
|
This project extract some functions of WhatsApp sources, that uses webpack.
|
|
@@ -40,6 +47,56 @@ There are a convection name for some exported modules:
|
|
|
40
47
|
- `...Collection` - Class for collection of models (`ChatCollection`, `MsgCollection`)
|
|
41
48
|
- `...Store` - Default and global instance of a collection (`ChatStore`, `MsgStore`)
|
|
42
49
|
|
|
50
|
+
## Some Available functions
|
|
51
|
+
### General Functions
|
|
52
|
+
`WPP.conn.connect` - Connect to WhatsApp Web
|
|
53
|
+
|
|
54
|
+
`WPP.conn.isAuthenticated` - Check if the connection is authenticated
|
|
55
|
+
|
|
56
|
+
`WPP.conn.logout` - Logout from WhatsApp Web
|
|
57
|
+
|
|
58
|
+
### Chat Functions
|
|
59
|
+
`WPP.chat.sendTextMessage` - Send a text message
|
|
60
|
+
|
|
61
|
+
`WPP.chat.sendImageMessage` - Send an image message
|
|
62
|
+
|
|
63
|
+
`WPP.chat.sendVideoMessage` - Send a video message
|
|
64
|
+
|
|
65
|
+
`WPP.chat.sendFileMessage` - Send a file message
|
|
66
|
+
|
|
67
|
+
`WPP.chat.sendAudioMessage` - Send an audio message
|
|
68
|
+
|
|
69
|
+
`WPP.chat.getChat` - Get chat details
|
|
70
|
+
|
|
71
|
+
`WPP.chat.deleteMessage` - Delete a message
|
|
72
|
+
|
|
73
|
+
### Contact Functions
|
|
74
|
+
`WPP.contact.getContact` - Get contact details
|
|
75
|
+
|
|
76
|
+
`WPP.contact.blockContact` - Block a contact
|
|
77
|
+
|
|
78
|
+
`WPP.contact.unblockContact` - Unblock a contact
|
|
79
|
+
|
|
80
|
+
`WPP.contact.getAllContacts` - Get all contacts
|
|
81
|
+
|
|
82
|
+
### Group Functions
|
|
83
|
+
`WPP.group.createGroup` - Create a new group
|
|
84
|
+
|
|
85
|
+
`WPP.group.addParticipant` - Add a participant to a group
|
|
86
|
+
|
|
87
|
+
`WPP.group.removeParticipant` - Remove a participant from a group.
|
|
88
|
+
|
|
89
|
+
`WPP.group.promoteParticipant` - Promote a participant to admin
|
|
90
|
+
|
|
91
|
+
`WPP.group.demoteParticipant` - Demote a participant from admin.
|
|
92
|
+
|
|
93
|
+
`WPP.group.getGroupInfo` - Get group information.
|
|
94
|
+
|
|
95
|
+
### Events
|
|
96
|
+
`WPP.chat.on('chat.new_message')` - Event to dispatch on receive a new message
|
|
97
|
+
|
|
98
|
+
To see all events, check: [https://wppconnect.io/wa-js/types/ev.EventTypes.html](https://wppconnect.io/wa-js/types/ev.EventTypes.html)
|
|
99
|
+
|
|
43
100
|
## Development
|
|
44
101
|
|
|
45
102
|
Steps to run locally:
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 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
|
+
* Close the chat tab
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```javascript
|
|
21
|
+
* await WPP.chat.closeChat();
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @category Chat
|
|
25
|
+
*/
|
|
26
|
+
export declare function closeChat(): Promise<boolean>;
|
|
@@ -18,6 +18,7 @@ export { canMarkPlayed } from './canMarkPlayed';
|
|
|
18
18
|
export { canMute } from './canMute';
|
|
19
19
|
export { canReply } from './canReply';
|
|
20
20
|
export { clear } from './clear';
|
|
21
|
+
export { closeChat } from './closeChat';
|
|
21
22
|
export { delete } from './delete';
|
|
22
23
|
export { deleteMessage, DeleteMessageReturn } from './deleteMessage';
|
|
23
24
|
export { downloadMedia } from './downloadMedia';
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { LogoutReason } from '../../whatsapp/enums';
|
|
16
17
|
import { AuthCode } from '../types';
|
|
17
18
|
export interface ConnEventTypes {
|
|
18
19
|
'conn.auth_code_change': AuthCode | null;
|
|
@@ -28,6 +29,7 @@ export interface ConnEventTypes {
|
|
|
28
29
|
*/
|
|
29
30
|
'conn.authenticated': undefined;
|
|
30
31
|
'conn.logout': undefined;
|
|
32
|
+
'conn.logout_reason': LogoutReason;
|
|
31
33
|
/**
|
|
32
34
|
* Triggered when the interface is booting
|
|
33
35
|
*
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
import './registerAuthCodeChangeEvent';
|
|
17
17
|
import './registerAuthenticatedEvent';
|
|
18
18
|
import './registerLogoutEvent';
|
|
19
|
+
import './registerLogoutReasonEvent';
|
|
19
20
|
import './registerMainInit';
|
|
20
21
|
import './registerMainLoadedEvent';
|
|
21
22
|
import './registerMainReadyEvent';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright 2024 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
|
+
export {};
|
|
@@ -16,15 +16,32 @@
|
|
|
16
16
|
/** @whatsapp 83578
|
|
17
17
|
* @whatsapp 88950 >= 2.2218.4
|
|
18
18
|
* @whatsapp 788950 >= 2.2222.8
|
|
19
|
+
* @whatsapp WAWebLogoutReasonConstants >= 2.3000.x
|
|
19
20
|
*/
|
|
20
21
|
export declare enum LogoutReason {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
UserInitiated = "user_initiated",
|
|
23
|
+
SyncdFailure = "syncd_failure",
|
|
24
|
+
InvalidAdvStatus = "invalid_adv_status",
|
|
25
|
+
CriticalSyncTimeout = "critical_sync_timeout",
|
|
26
|
+
SyncdTimeout = "syncd_timeout",
|
|
27
|
+
HistorySyncTimeout = "history_sync_timeout",
|
|
28
|
+
AccountSyncTimeout = "account_sync_timeout",
|
|
29
|
+
MDOptOut = "md_opt_out",
|
|
30
|
+
UnknownCompanion = "unknown_companion",
|
|
31
|
+
ClientVersionOutdated = "client_version_outdated",
|
|
32
|
+
SyncdErrorDuringBootstrap = "syncd_error_during_bootstrap",
|
|
33
|
+
AccountSyncError = "account_sync_error",
|
|
34
|
+
ClientFatalError = "client_fatal_error",
|
|
35
|
+
StorageQuotaExceeded = "storage_quota_exceeded",
|
|
36
|
+
PrimaryIdentityKeyChange = "primary_identity_key_change",
|
|
37
|
+
MissingEncSalt = "missing_enc_salt",
|
|
38
|
+
MissingScreenLockSalt = "missing_screen_lock_salt",
|
|
39
|
+
AccountLocked = "account_locked",
|
|
29
40
|
UNKNOWN = "unknown"
|
|
30
41
|
}
|
|
42
|
+
export declare enum LOGOUT_REASON_CODE {
|
|
43
|
+
CLIENT_FATAL = "0",
|
|
44
|
+
SYNC_FAIL = "1",
|
|
45
|
+
INITIAL_HISTORY_SYNC_TIMEOUT = "2",
|
|
46
|
+
ACCOUNT_LOCKED = "3"
|
|
47
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
import { LOGOUT_REASON_CODE, LogoutReason } from '../enums';
|
|
17
|
+
/**
|
|
18
|
+
* @whatsapp WAWebLogoutReason >= 2.3000.x
|
|
19
|
+
*/
|
|
20
|
+
export declare function getErrorCodeFromLogoutReason(type: LogoutReason): LOGOUT_REASON_CODE | null;
|
|
@@ -55,6 +55,7 @@ export * from './getCommunityParticipants';
|
|
|
55
55
|
export * from './getCountryShortcodeByPhone';
|
|
56
56
|
export * from './getCurrentLid';
|
|
57
57
|
export * from './getEphemeralFields';
|
|
58
|
+
export * from './getErrorCodeFromLogoutReason';
|
|
58
59
|
export * from './getFanOutList';
|
|
59
60
|
export * from './getGroupSenderKeyList';
|
|
60
61
|
export * from './getGroupSizeLimit';
|