@wppconnect/wa-js 4.1.2-alpha.0 → 4.2.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,3 +1,3 @@
1
- ## <small>4.1.2-alpha.0 (2026-05-14)</small>
1
+ ## 4.2.0 (2026-05-15)
2
2
 
3
- * Merge branch 'manfe/attempt-to-fix-disconnections-1' of github.com:wppconnect-team/wa-js into manfe/attempt-to-fix-disconnections-1 ([1dc5afb8efa912eb468355ab056ab29c38ce2958](https://github.com/wppconnect-team/wa-js/commit/1dc5afb8efa912eb468355ab056ab29c38ce2958))
3
+ * fix: remove outdated pre-lid release patches (#3425) ([aadc862253d4c4989d6a9e404c349889d55fa0d1](https://github.com/wppconnect-team/wa-js/commit/aadc862253d4c4989d6a9e404c349889d55fa0d1)), closes [#3425](https://github.com/wppconnect-team/wa-js/issues/3425)
package/README.md CHANGED
@@ -132,6 +132,194 @@ For the most up-to-date list of available functions, launch the project locally
132
132
 
133
133
  `Object.keys(WPP.group).sort()`
134
134
 
135
+ ### Newsletter (Channels) Functions
136
+
137
+ `WPP.newsletter.create` - Create a new newsletter (WhatsApp Channel)
138
+
139
+ `WPP.newsletter.edit` - Edit an existing newsletter (name, description, picture)
140
+
141
+ `WPP.newsletter.destroy` - Delete a newsletter you own
142
+
143
+ `WPP.newsletter.follow` / `WPP.newsletter.unfollow` - Follow or unfollow a newsletter
144
+
145
+ `WPP.newsletter.mute` - Mute notifications from a newsletter
146
+
147
+ `WPP.newsletter.search` - Search newsletters by name or country
148
+
149
+ `WPP.newsletter.getSubscribers` - Get the subscriber list of a newsletter you own
150
+
151
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
152
+
153
+ `Object.keys(WPP.newsletter).sort()`
154
+
155
+ ### Community Functions
156
+
157
+ `WPP.community.create` - Create a new community
158
+
159
+ `WPP.community.deactivate` - Deactivate (delete) a community
160
+
161
+ `WPP.community.addSubgroups` - Add existing groups as subgroups of a community
162
+
163
+ `WPP.community.removeSubgroups` - Remove subgroups from a community
164
+
165
+ `WPP.community.getSubgroups` - Get all subgroups of a community
166
+
167
+ `WPP.community.getParticipants` - Get all participants across the community
168
+
169
+ `WPP.community.getAnnouncementGroup` - Get the announcement group of a community
170
+
171
+ `WPP.community.promoteParticipants` / `WPP.community.demoteParticipants` - Promote or demote community admins
172
+
173
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
174
+
175
+ `Object.keys(WPP.community).sort()`
176
+
177
+ ### Catalog Functions
178
+
179
+ `WPP.catalog.getMyCatalog` - Get the catalog of the connected business account
180
+
181
+ `WPP.catalog.getProducts` - Get products of any business contact
182
+
183
+ `WPP.catalog.getProductById` - Get a single product by id
184
+
185
+ `WPP.catalog.createProduct` - Create a new product in your catalog
186
+
187
+ `WPP.catalog.editProduct` - Edit an existing product
188
+
189
+ `WPP.catalog.delProducts` - Delete one or more products
190
+
191
+ `WPP.catalog.addProductImage` / `WPP.catalog.changeProductImage` / `WPP.catalog.removeProductImage` - Manage product images
192
+
193
+ `WPP.catalog.setProductVisibility` - Show or hide a product
194
+
195
+ `WPP.catalog.createCollection` / `WPP.catalog.editCollection` / `WPP.catalog.deleteCollection` / `WPP.catalog.getCollections` - Manage product collections
196
+
197
+ `WPP.catalog.updateCartEnabled` - Enable or disable cart for the catalog
198
+
199
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
200
+
201
+ `Object.keys(WPP.catalog).sort()`
202
+
203
+ ### Cart Functions
204
+
205
+ `WPP.cart.add` - Add a product to the cart of a business chat
206
+
207
+ `WPP.cart.update` - Update the quantity of an item in the cart
208
+
209
+ `WPP.cart.remove` - Remove an item from the cart
210
+
211
+ `WPP.cart.get` - Get the current cart for a business chat
212
+
213
+ `WPP.cart.clear` - Empty the cart
214
+
215
+ `WPP.cart.submit` - Submit the cart and send the order
216
+
217
+ `WPP.cart.getThumbFromCart` - Get the cart thumbnail preview
218
+
219
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
220
+
221
+ `Object.keys(WPP.cart).sort()`
222
+
223
+ ### Order Functions
224
+
225
+ `WPP.order.get` - Get the details of an order received in a chat
226
+
227
+ `WPP.order.accept` - Accept an order
228
+
229
+ `WPP.order.decline` - Decline an order
230
+
231
+ `WPP.order.update` - Update an order (e.g. change status)
232
+
233
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
234
+
235
+ `Object.keys(WPP.order).sort()`
236
+
237
+ ### Status Functions
238
+
239
+ `WPP.status.sendTextStatus` - Post a text status
240
+
241
+ `WPP.status.sendImageStatus` - Post an image status
242
+
243
+ `WPP.status.sendVideoStatus` - Post a video status
244
+
245
+ `WPP.status.sendReadStatus` - Mark a status as seen
246
+
247
+ `WPP.status.get` - Get the status feed of a contact
248
+
249
+ `WPP.status.getMyStatus` - Get your own status feed
250
+
251
+ `WPP.status.remove` - Remove one of your statuses
252
+
253
+ `WPP.status.updateParticipants` - Update who can see your statuses
254
+
255
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
256
+
257
+ `Object.keys(WPP.status).sort()`
258
+
259
+ ### Labels Functions
260
+
261
+ `WPP.labels.getAllLabels` - Get every label defined in the account
262
+
263
+ `WPP.labels.getLabelById` - Get a label by id
264
+
265
+ `WPP.labels.addNewLabel` - Create a new label
266
+
267
+ `WPP.labels.editLabel` - Rename or recolor a label
268
+
269
+ `WPP.labels.deleteLabel` - Delete a single label
270
+
271
+ `WPP.labels.deleteAllLabels` - Delete every label in the account
272
+
273
+ `WPP.labels.addOrRemoveLabels` - Apply or remove labels on chats / messages in bulk
274
+
275
+ `WPP.labels.getLabelColorPalette` / `WPP.labels.getNewLabelColor` - Helpers for label colors
276
+
277
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
278
+
279
+ `Object.keys(WPP.labels).sort()`
280
+
281
+ ### Profile Functions
282
+
283
+ `WPP.profile.getMyProfileName` / `WPP.profile.setMyProfileName` - Read or change your profile name
284
+
285
+ `WPP.profile.getMyStatus` / `WPP.profile.setMyStatus` - Read or change your "about" text
286
+
287
+ `WPP.profile.getMyProfilePicture` - Get your current profile picture
288
+
289
+ `WPP.profile.setMyProfilePicture` / `WPP.profile.removeMyProfilePicture` - Set or remove your profile picture
290
+
291
+ `WPP.profile.isBusiness` - Check whether the connected account is a Business account
292
+
293
+ `WPP.profile.editBusinessProfile` - Edit business profile fields (description, address, etc.)
294
+
295
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
296
+
297
+ `Object.keys(WPP.profile).sort()`
298
+
299
+ ### Privacy Functions
300
+
301
+ `WPP.privacy.get` - Get the current privacy settings as an object
302
+
303
+ `WPP.privacy.setLastSeen` - Configure who can see your "last seen"
304
+
305
+ `WPP.privacy.setOnline` - Configure who can see when you are online
306
+
307
+ `WPP.privacy.setProfilePic` - Configure who can see your profile picture
308
+
309
+ `WPP.privacy.setReadReceipts` - Enable or disable read receipts
310
+
311
+ `WPP.privacy.setStatus` - Configure who can see your status updates
312
+
313
+ `WPP.privacy.setAbout` - Configure who can see your "about" text
314
+
315
+ `WPP.privacy.setAddGroup` - Configure who can add you to groups
316
+
317
+ `WPP.privacy.getDisallowedList` - Get the disallowed list (used together with `setAddGroup` / `setStatus` when set to `contact_blacklist`)
318
+
319
+ For the most up-to-date list of available functions, launch the project locally and run this in your browser console:
320
+
321
+ `Object.keys(WPP.privacy).sort()`
322
+
135
323
  ### Events
136
324
 
137
325
  #### Connection Events
@@ -215,6 +403,33 @@ To debug or inspect `wa-source` folder, format the files to be easier to underst
215
403
  npm run wa-source:format
216
404
  ```
217
405
 
406
+ ### Testing
407
+
408
+ The project ships a Playwright suite under `tests/`. Two flavours are available:
409
+
410
+ ```bash
411
+ # Smoke tests — no QR scan needed.
412
+ # Loads the live wppconnect-wa.js bundle on web.whatsapp.com and verifies
413
+ # every public WPP module still exposes the functions documented above.
414
+ # Useful as an early-warning when WhatsApp Web ships an update that breaks
415
+ # our patches.
416
+ npm test -- tests/smoke.spec.ts
417
+
418
+ # Full test project (smoke + any other *.spec.ts)
419
+ npm test
420
+ ```
421
+
422
+ Tests that need an authenticated session use the `loggedPage` fixture from
423
+ `tests/wpp-test.ts`. To bootstrap that session once (this opens a real
424
+ browser so you can scan the QR), run:
425
+
426
+ ```bash
427
+ npm run test:prepare
428
+ ```
429
+
430
+ The session is cached under your OS temp dir (`wa-js-test-<browser>`) and
431
+ reused by subsequent runs.
432
+
218
433
  ### Comparing WhatsApp Web Versions
219
434
 
220
435
  To compare changes between two WhatsApp Web versions, use the helper script:
@@ -31,13 +31,27 @@ export declare enum LogoutReason {
31
31
  ClientVersionOutdated = "client_version_outdated",
32
32
  SyncdErrorDuringBootstrap = "syncd_error_during_bootstrap",
33
33
  AccountSyncError = "account_sync_error",
34
- ClientFatalError = "client_fatal_error",
35
34
  StorageQuotaExceeded = "storage_quota_exceeded",
36
35
  PrimaryIdentityKeyChange = "primary_identity_key_change",
37
36
  MissingEncSalt = "missing_enc_salt",
38
37
  MissingScreenLockSalt = "missing_screen_lock_salt",
39
38
  AccountLocked = "account_locked",
40
- UNKNOWN = "unknown"
39
+ LidMigrationSplitThreadMismatch = "lid_migration_split_thread_mismatch",
40
+ LidMigrationNoLidAvailiable = "lid_migration_no_lid_available",
41
+ LidMigrationPrimaryMappingsObsolete = "lid_migration_primary_mappings_obsolete",
42
+ LidMigrationPeerMappingsNotReceived = "lid_migration_peer_mapping_not_received",
43
+ LidMigrationStateDiscrepancy = "lid_migration_state_discrepancy",
44
+ LidMigrationPeerMappingsMalformed = "lid_migration_peer_mapping_malformed",
45
+ LidMigrationFailedToParseMapping = "lid_migration_failed_to_parse_mapping",
46
+ LidMigrationCompanionIncompatibleKillswitch = "lid_migration_companion_incompatible_killswitch",
47
+ LidMigrationOneOnOneThreadMigrationInternalError = "lid_migration_one_on_one_thread_migration_internal_error",
48
+ LidBlocklistPnWhenMigrated = "lid_blocklist_pn_when_migrated",
49
+ LidBlocklistChatDbUnmigrated = "lid_blocklist_chat_db_unmigrated",
50
+ WebFailAddChat = "web_fail_add_chat",
51
+ WebFailOfflineResume = "web_fail_offline_resume",
52
+ WebFailStorageInitialization = "web_fail_storage_initialization",
53
+ WebFailEncSalt = "web_fail_enc_salt",
54
+ CacheStorageOpenFailed = "cache_storage_open_failed"
41
55
  }
42
56
  export declare enum LOGOUT_REASON_CODE {
43
57
  CLIENT_FATAL = "0",
@@ -0,0 +1,19 @@
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 '../misc';
17
+ import { ChatModel, MsgModel } from '../models';
18
+ import { getSearchContext } from './getSearchContext';
19
+ export declare function callGetSearchContext(chat: ChatModel | string, msgKey: MsgModel | MsgKey | string): ReturnType<typeof getSearchContext>;
@@ -26,3 +26,14 @@ export declare function getSearchContext(chat: ChatModel | string, msg: MsgModel
26
26
  key?: MsgKey;
27
27
  highlightMsg: true;
28
28
  };
29
+ export declare function getSearchContext(params: {
30
+ chat: ChatModel | string;
31
+ msgKey: MsgModel | MsgKey | string;
32
+ rootMsg?: MsgModel;
33
+ threadId?: string;
34
+ }): {
35
+ collection: MsgLoad;
36
+ msg?: MsgModel;
37
+ key?: MsgKey;
38
+ highlightMsg: true;
39
+ };
@@ -70,7 +70,6 @@ export * from './getCountryShortcodeByPhone';
70
70
  export * from './getCurrentLid';
71
71
  export * from './getEnforceCurrentLid';
72
72
  export * from './getEphemeralFields';
73
- export * from './getErrorCodeFromLogoutReason';
74
73
  export * from './getExisting';
75
74
  export * from './getFanOutList';
76
75
  export * from './getGroupSenderKeyList';
@@ -109,6 +108,7 @@ export * from './isWid';
109
108
  export * from './joinGroupViaInvite';
110
109
  export * from './keepMessage';
111
110
  export * from './labelAddAction';
111
+ export * from './logoutReason';
112
112
  export * from './markSeen';
113
113
  export * from './mediaTypeFromProtobuf';
114
114
  export * from './membershipApprovalRequestAction';
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright 2021 WPPConnect Team
2
+ * Copyright 2026 WPPConnect Team
3
3
  *
4
4
  * Licensed under the Apache License, Version 2.0 (the "License");
5
5
  * you may not use this file except in compliance with the License.
@@ -18,3 +18,7 @@ import { LOGOUT_REASON_CODE, LogoutReason } from '../enums';
18
18
  * @whatsapp WAWebLogoutReason >= 2.3000.x
19
19
  */
20
20
  export declare function getErrorCodeFromLogoutReason(type: LogoutReason): LOGOUT_REASON_CODE | null;
21
+ export declare function setPrevLogoutReasonCode(code: LOGOUT_REASON_CODE | null): void;
22
+ export declare function setPrevCustomLogoutMessage(message: string | null): void;
23
+ export declare function getPrevLogoutReasonCode(): LOGOUT_REASON_CODE | null;
24
+ export declare function getPrevCustomLogoutMessage(): string | null;