@wppconnect/wa-js 3.19.5 → 3.19.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/CHANGELOG.md +1 -1
- package/README.md +22 -0
- package/dist/conn/functions/getABProps.d.ts +83 -0
- package/dist/conn/functions/index.d.ts +1 -0
- package/dist/whatsapp/functions/abPropsCache.d.ts +36 -0
- package/dist/whatsapp/functions/index.d.ts +1 -0
- package/dist/whatsapp/functions/markSeen.d.ts +13 -4
- package/dist/whatsapp/functions/toUserLid.d.ts +6 -0
- package/dist/wppconnect-wa.js +1 -1
- package/dist/wppconnect-wa.js.LICENSE.txt +1 -1
- package/package.json +8 -8
- package/scripts/compare-wa-versions.sh +85 -0
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -169,6 +169,28 @@ To debug or inspect `wa-source` folder, format the files to be easier to underst
|
|
|
169
169
|
npm run wa-source:format
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
+
### Comparing WhatsApp Web Versions
|
|
173
|
+
|
|
174
|
+
To compare changes between two WhatsApp Web versions, use the helper script:
|
|
175
|
+
|
|
176
|
+
Note: You need to run locally in multiple versions to download the scripts to wa-source folder, otherwise will not have anything to compare. To do it use: `WA_VERSION="<version-here>" npm run launch:local`
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Compare two versions (overview of module differences)
|
|
180
|
+
./scripts/compare-wa-versions.sh 2.3000.1031980585 2.3000.1031992593
|
|
181
|
+
|
|
182
|
+
# Compare a specific module between versions
|
|
183
|
+
./scripts/compare-wa-versions.sh 2.3000.1031980585 2.3000.1031992593 WAWebUpdateUnreadChatAction
|
|
184
|
+
|
|
185
|
+
# List available versions
|
|
186
|
+
./scripts/compare-wa-versions.sh
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
This is useful for:
|
|
190
|
+
- Tracking API changes between WhatsApp Web updates
|
|
191
|
+
- Identifying when function signatures changed
|
|
192
|
+
- Finding new or removed modules
|
|
193
|
+
|
|
172
194
|
## How to use this project
|
|
173
195
|
|
|
174
196
|
Basically, you need to inject the `wppconnect-wa.js` file into the browser after WhatsApp page load.
|
|
@@ -0,0 +1,83 @@
|
|
|
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 { RawABPropConfig } from '../../whatsapp/functions/abPropsCache';
|
|
17
|
+
/**
|
|
18
|
+
* A/B test property configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface ABPropConfig extends RawABPropConfig {
|
|
21
|
+
/** The human-readable config name (e.g., "web_pwa_background_sync") */
|
|
22
|
+
name: string | null;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Get all A/B test property configurations for the current session
|
|
26
|
+
* These are experimental flags that WhatsApp uses for feature testing
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```javascript
|
|
30
|
+
* // Get all A/B props as an array
|
|
31
|
+
* const abProps = WPP.conn.getABProps();
|
|
32
|
+
* console.log('Total A/B props:', abProps.length);
|
|
33
|
+
*
|
|
34
|
+
* // Log each prop with its name
|
|
35
|
+
* abProps.forEach(prop => {
|
|
36
|
+
* console.log(`${prop.name}: ${prop.configValue}`);
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @returns {ABPropConfig[]} Array of A/B property configurations with names
|
|
41
|
+
*/
|
|
42
|
+
export declare function getABProps(): ABPropConfig[];
|
|
43
|
+
/**
|
|
44
|
+
* Get all A/B test property configurations as a Map
|
|
45
|
+
* The map is keyed by the config code for easier lookup
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```javascript
|
|
49
|
+
* // Get all A/B props as a Map
|
|
50
|
+
* const abPropsMap = WPP.conn.getABPropsMap();
|
|
51
|
+
*
|
|
52
|
+
* // Check a specific config by code
|
|
53
|
+
* const specificProp = abPropsMap.get('12345');
|
|
54
|
+
* if (specificProp) {
|
|
55
|
+
* console.log('Name:', specificProp.name);
|
|
56
|
+
* console.log('Value:', specificProp.configValue);
|
|
57
|
+
* }
|
|
58
|
+
*
|
|
59
|
+
* // Convert to object for easy viewing
|
|
60
|
+
* const result = {};
|
|
61
|
+
* abPropsMap.forEach((value, key) => {
|
|
62
|
+
* result[value.name || key] = value.configValue;
|
|
63
|
+
* });
|
|
64
|
+
* console.table(result);
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @returns {Map<string, ABPropConfig>} Map of config code to A/B property configuration with names
|
|
68
|
+
*/
|
|
69
|
+
export declare function getABPropsMap(): Map<string, ABPropConfig>;
|
|
70
|
+
/**
|
|
71
|
+
* Get the human-readable name of an A/B config from its code
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```javascript
|
|
75
|
+
* // Get name from config code
|
|
76
|
+
* const name = WPP.conn.getABPropName('12345');
|
|
77
|
+
* console.log('Config name:', name);
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* @param configCode - The numeric config code
|
|
81
|
+
* @returns {string|null} The human-readable config name or null if not found
|
|
82
|
+
*/
|
|
83
|
+
export declare function getABPropName(configCode: string): string | null;
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
export { changeEnviromentDevice } from './changeEnviromentDevice';
|
|
17
17
|
export { genLinkDeviceCodeForPhoneNumber } from './genLinkDeviceCodeForPhoneNumber';
|
|
18
|
+
export { ABPropConfig, getABPropName, getABProps, getABPropsMap, } from './getABProps';
|
|
18
19
|
export { getAuthCode } from './getAuthCode';
|
|
19
20
|
export { BuildConstants, getBuildConstants, isWhatsAppVersionGTE, } from './getBuildConstants';
|
|
20
21
|
export { getHistorySyncProgress, HistorySyncProgress, } from './getHistorySyncProgress';
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
* Raw A/B test property configuration from WhatsApp
|
|
18
|
+
*/
|
|
19
|
+
export interface RawABPropConfig {
|
|
20
|
+
/** The internal config code (numeric key) */
|
|
21
|
+
configCode: string;
|
|
22
|
+
/** The actual value of the config (string, number, boolean) */
|
|
23
|
+
configValue: any;
|
|
24
|
+
/** Exposure key for analytics tracking */
|
|
25
|
+
configExpoKey?: string;
|
|
26
|
+
/** Whether this config has been accessed during this session */
|
|
27
|
+
hasAccessed?: boolean;
|
|
28
|
+
/** Override value if set via URL parameter */
|
|
29
|
+
overriddenConfigValue?: any;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* @whatsapp WAWebABPropsCache
|
|
33
|
+
*/
|
|
34
|
+
export declare function getAllABPropConfigs(): RawABPropConfig[];
|
|
35
|
+
export declare function getAllABPropsMap(): Map<string, RawABPropConfig>;
|
|
36
|
+
export declare function getABPropConfigNameFromCode(configCode: number | string): string | undefined;
|
|
@@ -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
|
+
export * from './abPropsCache';
|
|
16
17
|
export * from './addAndSendMessageEdit';
|
|
17
18
|
export * from './addAndSendMsgToChat';
|
|
18
19
|
export * from './addProductToCart';
|
|
@@ -14,14 +14,23 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { ChatModel, MsgModel } from '../models';
|
|
17
|
-
/**
|
|
18
|
-
* @whatsapp
|
|
17
|
+
/**
|
|
18
|
+
* @whatsapp WAWebUpdateUnreadChatAction >= 2.3000.1031992593
|
|
19
19
|
*/
|
|
20
|
-
export declare function markUnread(chat: ChatModel, whenAvailable: boolean): Promise<ChatModel>;
|
|
21
|
-
/**
|
|
20
|
+
export declare function markUnread(chat: ChatModel, whenAvailable: boolean, showToast?: boolean): Promise<ChatModel>;
|
|
21
|
+
/**
|
|
22
22
|
* @whatsapp 561498 >= 2.2228.4
|
|
23
|
+
* @deprecated Use sendSeen({chat}) for versions >= 2.3000.1031992593
|
|
23
24
|
*/
|
|
24
25
|
export declare function sendSeen(chat: ChatModel, whenAvailable: boolean): Promise<ChatModel>;
|
|
26
|
+
/**
|
|
27
|
+
* @whatsapp WAWebUpdateUnreadChatAction >= 2.3000.1031992593
|
|
28
|
+
*/
|
|
29
|
+
export declare function sendSeen(options: {
|
|
30
|
+
chat: ChatModel;
|
|
31
|
+
threadId?: string | null;
|
|
32
|
+
afterAvailable?: boolean;
|
|
33
|
+
}): Promise<void>;
|
|
25
34
|
/** @whatsapp 30734
|
|
26
35
|
* @whatsapp 730734 >= 2.2222.8
|
|
27
36
|
* @whatsapp 242050 >= 2.2228.4
|
|
@@ -15,6 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { Wid } from '../misc';
|
|
17
17
|
/**
|
|
18
|
+
* @deprecated Use toUserLidOrThrow instead. This function will be removed in future versions.
|
|
19
|
+
* This function was removed from WhatsApp Web since (2.3000.1031992593~) but is still available here for backward compatibility.
|
|
18
20
|
* @whatsapp WAWebLidMigrationUtils >= 2.3000.x
|
|
19
21
|
*/
|
|
20
22
|
export declare function toUserLid(wid: Wid): Wid;
|
|
23
|
+
/**
|
|
24
|
+
* @whatsapp WAWebLidMigrationUtils >= 2.3000.1032013519
|
|
25
|
+
*/
|
|
26
|
+
export declare function toUserLidOrThrow(wid: Wid): Wid;
|