@wppconnect/wa-js 3.4.1 → 3.5.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 CHANGED
@@ -1,4 +1,9 @@
1
- ## 3.4.1 (2024-06-24)
1
+ # 3.5.0 (2024-07-12)
2
+
3
+
4
+ ### Features
5
+
6
+ * Added 'conn.logout_reason' event (close [#1899](https://github.com/wppconnect-team/wa-js/issues/1899)) ([2466c30](https://github.com/wppconnect-team/wa-js/commit/2466c30cad19eaa14c2119e476d44b2e2e61d265))
2
7
 
3
8
 
4
9
 
package/README.md CHANGED
@@ -19,6 +19,13 @@
19
19
  [![WhatsApp Group](https://img.shields.io/badge/WhatsApp-Group-25D366?logo=whatsapp)](https://chat.whatsapp.com/LJaQu6ZyNvnBPNAVRbX00K)
20
20
  [![YouTube](https://img.shields.io/youtube/channel/subscribers/UCD7J9LG08PmGQrF5IS7Yv9A?label=YouTube)](https://www.youtube.com/c/wppconnect)
21
21
 
22
+
23
+ ### Top Contributors (last 45 days) widget
24
+ ---
25
+ ![Top Contributors (Last 45 days) widget](https://embeddables.devactivity.com/orgs/wppconnect-team/508ecbcd-e55e-4e31-a647-6674f134b5bf.svg)
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.
@@ -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 {};
@@ -15,6 +15,7 @@
15
15
  */
16
16
  export { get } from './get';
17
17
  export { getMyStatus } from './getMyStatus';
18
+ export { remove } from './remove';
18
19
  export { ImageStatusOptions, sendImageStatus } from './sendImageStatus';
19
20
  export { sendRawStatus, SendStatusOptions } from './sendRawStatus';
20
21
  export { sendReadStatus } from './sendReadStatus';
@@ -0,0 +1,17 @@
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 { MsgKey } from '../../whatsapp';
17
+ export declare function remove(msgId: string | MsgKey): Promise<boolean>;
@@ -18,5 +18,6 @@ import { MsgKey } from '../../whatsapp';
18
18
  export interface SendStatusOptions {
19
19
  waitForAck?: boolean;
20
20
  messageId?: string | MsgKey;
21
+ caption?: string;
21
22
  }
22
23
  export declare function sendRawStatus(message: Chat.RawMessage, options?: SendStatusOptions): Promise<Chat.SendMessageReturn>;
@@ -18,7 +18,6 @@ import { SendStatusOptions } from './sendRawStatus';
18
18
  export interface TextStatusOptions extends SendStatusOptions {
19
19
  font?: TextFontStyle;
20
20
  backgroundColor?: string | number;
21
- textColor?: string | number;
22
21
  }
23
22
  /**
24
23
  * Send a text message to status stories
@@ -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
- USER_INITIATED = "user_initiated",
22
- SYNCD_FAILURE = "syncd_failure",
23
- CRITICAL_SYNC_TIMEOUT = "critical_sync_timeout",
24
- UNKNOWN_COMPANION = "unknown_companion",
25
- CLIENT_VERSION_OUTDATED = "client_version_outdated",
26
- SYNCD_ERROR_DURING_BOOTSTRAP = "syncd_error_during_bootstrap",
27
- ACCOUNT_SYNC_ERROR = "account_sync_error",
28
- CLIENT_FATAL_ERROR = "client_fatal_error",
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,19 @@
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
+ * @whatsapp WAJids
18
+ */
19
+ export declare const STATUS_JID: string;
@@ -26,3 +26,20 @@ export declare function createGroup(groupName: string, participants: Wid[], ephe
26
26
  invite_code_exp: string | null;
27
27
  }[];
28
28
  }>;
29
+ export declare function createGroup(options: {
30
+ title: string;
31
+ ephemeralDuration: number;
32
+ restrict: boolean;
33
+ announce: boolean;
34
+ membershipApprovalMode: boolean;
35
+ memberAddMode: boolean;
36
+ parentGroupId?: Wid;
37
+ }, participants: Wid[]): Promise<{
38
+ wid: Wid;
39
+ participants: {
40
+ wid: Wid;
41
+ error: string;
42
+ invite_code: string | null;
43
+ invite_code_exp: string | null;
44
+ }[];
45
+ }>;
@@ -0,0 +1,35 @@
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 { MsgKey, Wid } from '../misc';
17
+ import { MsgModel } from '../models';
18
+ /**
19
+ * @whatsapp WAWebEncryptAndSendStatusMsg
20
+ */
21
+ export declare function encryptAndSendStatusMsg(msg: {
22
+ msg: {
23
+ type: string;
24
+ data: MsgModel;
25
+ };
26
+ data: {
27
+ ack: number;
28
+ author?: Wid;
29
+ from: Wid;
30
+ id: MsgKey;
31
+ subtype?: string;
32
+ to: Wid;
33
+ type: string;
34
+ };
35
+ }, proto: any, report: any): Promise<any>;
@@ -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;
@@ -38,6 +38,7 @@ export * from './encodeMaybeMediaType';
38
38
  export * from './encryptAndSendGroupMsg';
39
39
  export * from './encryptAndSendMsg';
40
40
  export * from './encryptAndSendSenderKeyMsg';
41
+ export * from './encryptAndSendStatusMsg';
41
42
  export * from './encryptMsgProtobuf';
42
43
  export * from './fetchLinkPreview';
43
44
  export * from './findChat';
@@ -54,6 +55,7 @@ export * from './getCommunityParticipants';
54
55
  export * from './getCountryShortcodeByPhone';
55
56
  export * from './getCurrentLid';
56
57
  export * from './getEphemeralFields';
58
+ export * from './getErrorCodeFromLogoutReason';
57
59
  export * from './getFanOutList';
58
60
  export * from './getGroupSenderKeyList';
59
61
  export * from './getGroupSizeLimit';
@@ -105,6 +107,7 @@ export * from './queryOrder';
105
107
  export * from './randomHex';
106
108
  export * from './randomId';
107
109
  export * from './resetGroupInviteCode';
110
+ export * from './revokeStatus';
108
111
  export * from './sendClear';
109
112
  export * from './sendCreateCommunity';
110
113
  export * from './sendCreateGroup';
@@ -125,6 +128,8 @@ export * from './setGroup';
125
128
  export * from './setPin';
126
129
  export * from './setPushname';
127
130
  export * from './status';
131
+ export * from './STATUS_JID';
132
+ export * from './statusEnable';
128
133
  export * from './syncABPropsTask';
129
134
  export * from './typeAttributeFromProtobuf';
130
135
  export * from './unixTime';
@@ -0,0 +1,20 @@
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
+ import { ChatModel, MsgModel } from '../models';
17
+ /**
18
+ * @whatsapp WAWebRevokeStatusAction
19
+ */
20
+ export declare function revokeStatus(chat: ChatModel, msg: MsgModel): Promise<any>;
@@ -0,0 +1,19 @@
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
+ * @whatsapp WAWebStatusSendGatingUtils >= 2.3000.0
18
+ */
19
+ export declare function primaryFeatureEnabled(key: string): boolean;
@@ -38,6 +38,7 @@ export declare class Wid {
38
38
  isPSA(): boolean;
39
39
  isServer(): boolean;
40
40
  isStatusV3(): boolean;
41
+ isStatus(): boolean;
41
42
  isUser(): boolean;
42
43
  isLid(): boolean;
43
44
  isUserNotPSA(): boolean;
@@ -60,6 +61,7 @@ export declare class Wid {
60
61
  static isPSA(wid: string | Wid): boolean;
61
62
  static isServer(wid: string | Wid): boolean;
62
63
  static isStatusV3(wid: string | Wid): boolean;
64
+ static isStatus(wid: string | Wid): boolean;
63
65
  static isUser(wid: string | Wid): boolean;
64
66
  static isLid(wid: string | Wid): boolean;
65
67
  static isWid(wid: string | Wid): boolean;