@wppconnect/wa-js 3.19.0 → 3.19.2

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.19.0 (2025-11-25)
1
+ ## 3.19.2 (2025-11-25)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * contact save and remove functions ([#3093](https://github.com/wppconnect-team/wa-js/issues/3093)) ([285c88b](https://github.com/wppconnect-team/wa-js/commit/285c88b3b2feeb21dccb493d5f7301b5f7fa901f))
2
7
 
3
8
 
4
9
 
@@ -13,6 +13,20 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export interface BuildConstants {
17
+ VERSION_STR: string;
18
+ VERSION_BASE: string;
19
+ VERSION_PRIMARY: string;
20
+ VERSION_SECONDARY: string;
21
+ VERSION_TERTIARY: string;
22
+ WINDOWS_BUILD: string | null;
23
+ PARSED: {
24
+ PRIMARY: number;
25
+ SECONDARY: number;
26
+ TERTIARY: number;
27
+ };
28
+ [key: string]: any;
29
+ }
16
30
  /**
17
31
  * Get the WhatsApp Web build constants
18
32
  * Retrieves the internal WAWebBuildConstants module from WhatsApp source
@@ -25,7 +39,7 @@
25
39
  * console.log('Windows Build:', buildConstants.WINDOWS_BUILD);
26
40
  * ```
27
41
  *
28
- * @returns {object|null} Object containing version constants or null if not available
42
+ * @returns {BuildConstants|null} Object containing version constants or null if not available
29
43
  * - VERSION_STR: Full version string (e.g., "2.3000.1234567")
30
44
  * - VERSION_BASE: Base version (e.g., "2.3000.1234567")
31
45
  * - VERSION_PRIMARY: Primary version number
@@ -34,4 +48,19 @@
34
48
  * - WINDOWS_BUILD: Windows build number (if applicable)
35
49
  * - And other build-related constants
36
50
  */
37
- export declare function getBuildConstants(): string | null;
51
+ export declare function getBuildConstants(): BuildConstants | null;
52
+ /**
53
+ * Check if the current WhatsApp version is greater than or equal to a specified version
54
+ *
55
+ * @example
56
+ * ```javascript
57
+ * // Check if version is >= 2.3000.1030110621
58
+ * if (WPP.conn.isWhatsAppVersionGTE('2.3000.1030110621')) {
59
+ * console.log('Using new API');
60
+ * }
61
+ * ```
62
+ *
63
+ * @param version - Version string to compare against (e.g., "2.3000.1029")
64
+ * @returns {boolean} True if current version is >= specified version
65
+ */
66
+ export declare function isWhatsAppVersionGTE(version: string): boolean;
@@ -16,7 +16,7 @@
16
16
  export { changeEnviromentDevice } from './changeEnviromentDevice';
17
17
  export { genLinkDeviceCodeForPhoneNumber } from './genLinkDeviceCodeForPhoneNumber';
18
18
  export { getAuthCode } from './getAuthCode';
19
- export { getBuildConstants } from './getBuildConstants';
19
+ export { BuildConstants, getBuildConstants, isWhatsAppVersionGTE, } from './getBuildConstants';
20
20
  export { getHistorySyncProgress, HistorySyncProgress, } from './getHistorySyncProgress';
21
21
  export { getMigrationState, MigrationState } from './getMigrationState';
22
22
  export { getMyDeviceId } from './getMyDeviceId';
@@ -21,13 +21,17 @@ import { ContactModel } from '../../whatsapp';
21
21
  * ```javascript
22
22
  * await WPP.contact.save('5533999999999@c.us', 'John', {
23
23
  * surname: 'Doe',
24
- * syncAdressBook: true,
24
+ * syncAddressBook: true,
25
25
  * });
26
26
  * ```
27
27
  *
28
28
  * @category Contact
29
29
  */
30
- export declare function save(contactId: string | any, name: string, options?: {
30
+ export declare function save(contactId: string | any, firstName: string, options?: {
31
+ /** @deprecated Use lastName instead */
31
32
  surname?: string;
33
+ /** @deprecated Use syncAddressBook instead, this one with typo was updated */
32
34
  syncAdressBook?: boolean;
35
+ lastName?: string;
36
+ syncAddressBook?: boolean;
33
37
  }): Promise<ContactModel | undefined>;
@@ -13,7 +13,46 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import { Wid } from '../misc';
16
17
  /**
18
+ * Deletes a contact from the contact list (legacy API).
19
+ *
17
20
  * @whatsapp WAWebDeleteContactAction >= 2.3000.0
21
+ * @whatsapp ~2.3000.1030040369
22
+ *
23
+ * @param number - Phone number string
24
+ *
25
+ * @deprecated Since around WhatsApp version 2.3000.1030110621. Use the new object-based API instead.
26
+ * Use `deleteContactActionV2({ phoneNumber: wid })` for regular contacts
27
+ * or `deleteContactActionV2({ username, lid })` for username contacts.
28
+ *
29
+ * @example
30
+ * // Deprecated usage
31
+ * await deleteContactAction('5511999999999');
32
+ *
33
+ * // Use this instead
34
+ * await deleteContactActionV2({ phoneNumber: wid });
18
35
  */
19
36
  export declare function deleteContactAction(number: string): Promise<void>;
37
+ /**
38
+ * Deletes a contact from the contact list.
39
+ *
40
+ * @whatsapp WAWebDeleteContactAction >= 2.3000.1030110621
41
+ *
42
+ * @param params - Object with contact identifiers
43
+ * @param params.phoneNumber - Contact phone number as Wid (for regular contacts)
44
+ * @param params.username - Contact username (for username contacts)
45
+ * @param params.lid - Contact LID (for username contacts)
46
+ *
47
+ * @example
48
+ * // Delete regular contact by phone number
49
+ * await deleteContactActionV2({ phoneNumber: wid });
50
+ *
51
+ * // Delete username contact
52
+ * await deleteContactActionV2({ username: 'john', lid: '123' });
53
+ */
54
+ export declare function deleteContactActionV2(params: {
55
+ phoneNumber?: Wid;
56
+ username?: string;
57
+ lid?: string;
58
+ }): Promise<void>;
@@ -14,9 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /**
17
+ * Save contact action (legacy positional parameters API)
17
18
  * @whatsapp WAWebSaveContactAction >= 2.3000.0
18
- */
19
- /**
19
+ * @deprecated Use saveContactActionV2 instead for versions >= 2.3000.1030209354
20
+ * @whatsapp WAWebSaveContactAction >= 2.3000.0, < 2.3000.1030209354
20
21
  * @param user 5521980809090
21
22
  * @param userToDelete 5521980809090
22
23
  * @param e_fullName Contact Full Name
@@ -26,3 +27,21 @@
26
27
  * @param syncToAddressbook Sync to Addressbook boolean
27
28
  */
28
29
  export declare function saveContactAction(userToCreate: string, userToDelete: string | null, e_fullName?: any, f_firstName?: any, name?: any, surname?: any, syncToAddressbook?: boolean): Promise<undefined>;
30
+ /**
31
+ * Object parameter interface for saveContactActionV2 (>= 2.3000.1030209354)
32
+ */
33
+ export interface SaveContactActionParamsV2 {
34
+ phoneNumber?: string | null;
35
+ prevPhoneNumber?: string | null;
36
+ lid?: string | null;
37
+ username?: string | null;
38
+ firstName: string;
39
+ lastName: string;
40
+ syncToAddressbook?: boolean;
41
+ }
42
+ /**
43
+ * Save contact action (new object parameter API)
44
+ * @whatsapp WAWebSaveContactAction >= 2.3000.1030209354
45
+ * @param params Contact parameters object
46
+ */
47
+ export declare function saveContactActionV2(params: SaveContactActionParamsV2): Promise<undefined>;
@@ -32,6 +32,7 @@ interface Props {
32
32
  labels?: string[];
33
33
  disappearingModeDuration?: any;
34
34
  disappearingModeSettingTimestamp?: any;
35
+ username?: string;
35
36
  }
36
37
  interface Session {
37
38
  stale?: any;