@wppconnect/wa-js 2.20.2 → 2.22.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,5 +1,5 @@
1
- ## 2.20.2 (2023-02-28)
1
+ # 2.22.0 (2023-03-09)
2
2
 
3
- ### Bug Fixes
3
+ ### Features
4
4
 
5
- - Fixed link-preview function ([2fc38b1](https://github.com/wppconnect-team/wa-js/commit/2fc38b1d10f7723cce07201473446b32cb7d32d0))
5
+ - Added support to string, blob and file formats to WPP.chat.sendFileMessage ([8a6626a](https://github.com/wppconnect-team/wa-js/commit/8a6626aeae85f76a53627221f81e73cbe6958de0))
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2023 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 type { AudioMessageOptions } from './sendFileMessage';
17
+ /**
18
+ * Prepare waveform form message audio file
19
+ *
20
+ * @category Message
21
+ * @internal
22
+ */
23
+ export declare function prepareAudioWaveform(options: AudioMessageOptions, file: File): Promise<undefined | {
24
+ duration: number;
25
+ waveform: Uint8Array;
26
+ }>;
@@ -25,9 +25,53 @@ export interface FileMessageOptions extends SendMessageOptions {
25
25
  export interface AutoDetectMessageOptions extends FileMessageOptions {
26
26
  type: 'auto-detect';
27
27
  }
28
+ /**
29
+ * Send an audio message as a PTT, like a recorded message
30
+ *
31
+ * @example
32
+ * ```javascript
33
+ * // PTT audio
34
+ * WPP.chat.sendFileMessage(
35
+ * '[number]@c.us',
36
+ * 'data:audio/mp3;base64,<a long base64 file...>',
37
+ * {
38
+ * type: 'audio',
39
+ * isPtt: true // false for common audio
40
+ * }
41
+ * );
42
+ * ```
43
+ */
28
44
  export interface AudioMessageOptions extends FileMessageOptions {
29
45
  type: 'audio';
30
46
  isPtt?: boolean;
47
+ /**
48
+ * Send an audio message as a PTT with waveform
49
+ *
50
+ * @example
51
+ * ```javascript
52
+ * // Enable waveform
53
+ * WPP.chat.sendFileMessage(
54
+ * '[number]@c.us',
55
+ * 'data:audio/mp3;base64,<a long base64 file...>',
56
+ * {
57
+ * type: 'audio',
58
+ * isPtt: true,
59
+ * waveform: true // false to disable
60
+ * }
61
+ * );
62
+ * // Disable waveform
63
+ * WPP.chat.sendFileMessage(
64
+ * '[number]@c.us',
65
+ * 'data:audio/mp3;base64,<a long base64 file...>',
66
+ * {
67
+ * type: 'audio',
68
+ * isPtt: true,
69
+ * waveform: false
70
+ * }
71
+ * );
72
+ * ```
73
+ */
74
+ waveform?: boolean;
31
75
  }
32
76
  export interface DocumentMessageOptions extends FileMessageOptions, MessageButtonsOptions {
33
77
  type: 'document';
@@ -114,4 +158,4 @@ export interface VideoMessageOptions extends FileMessageOptions, MessageButtonsO
114
158
  * @category Message
115
159
  * @return {SendMessageReturn} The result
116
160
  */
117
- export declare function sendFileMessage(chatId: any, content: any, options: AutoDetectMessageOptions | AudioMessageOptions | DocumentMessageOptions | ImageMessageOptions | VideoMessageOptions | StickerMessageOptions): Promise<SendMessageReturn>;
161
+ export declare function sendFileMessage(chatId: any, content: string | Blob | File, options: AutoDetectMessageOptions | AudioMessageOptions | DocumentMessageOptions | ImageMessageOptions | VideoMessageOptions | StickerMessageOptions): Promise<SendMessageReturn>;
@@ -34,6 +34,7 @@ export { iAmSuperAdmin } from './iAmSuperAdmin';
34
34
  export { join } from './join';
35
35
  export { leave } from './leave';
36
36
  export { promoteParticipants } from './promoteParticipants';
37
+ export { removeIcon } from './removeIcon';
37
38
  export { removeParticipants } from './removeParticipants';
38
39
  export { revokeInviteCode } from './revokeInviteCode';
39
40
  export { setDescription } from './setDescription';
@@ -0,0 +1,27 @@
1
+ /*!
2
+ * Copyright 2023 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 { Wid } from '../../whatsapp';
17
+ /**
18
+ * Remove the group icon (group profile picture)
19
+ *
20
+ * @example
21
+ * ```javascript
22
+ * await WPP.group.removeIcon('[group@g.us]');
23
+ * ```
24
+ *
25
+ * @category Group
26
+ */
27
+ export declare function removeIcon(groupId: string | Wid): Promise<boolean>;
@@ -21,6 +21,6 @@
21
21
  * await WPP.profile.getMyStatus();
22
22
  * ```
23
23
  *
24
- * @category Chat
24
+ * @category Profile
25
25
  */
26
26
  export declare function getMyStatus(): Promise<string | undefined>;
@@ -16,5 +16,7 @@
16
16
  export { editBusinessProfile } from './editBusinessProfile';
17
17
  export { getMyStatus } from './getMyStatus';
18
18
  export { isBusiness } from './isBusiness';
19
+ export { removeMyProfilePicture } from './removeMyProfilePicture';
20
+ export { setMyProfileName } from './setMyProfileName';
19
21
  export { setMyProfilePicture } from './setMyProfilePicture';
20
22
  export { setMyStatus } from './setMyStatus';
@@ -20,5 +20,6 @@
20
20
  * ```javascript
21
21
  * WPP.profile.isBusiness();
22
22
  * ```
23
+ * @category Profile
23
24
  */
24
25
  export declare function isBusiness(): boolean | undefined;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2023 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
+ * Remove your profile picture
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * await WPP.profile.removeMyProfilePicture();
22
+ * ```
23
+ *
24
+ * @category Profile
25
+ */
26
+ export declare function removeMyProfilePicture(): Promise<boolean>;
@@ -0,0 +1,26 @@
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
+ * Update your current profile name
18
+ *
19
+ * @example
20
+ * ```javascript
21
+ * await WPP.profile.setMyProfileName('My new name');
22
+ * ```
23
+ *
24
+ * @category Profile
25
+ */
26
+ export declare function setMyProfileName(name: string): Promise<boolean>;
@@ -21,7 +21,7 @@
21
21
  * await WPP.profile.setMyProfilePicture('data:image/jpeg;base64,.....');
22
22
  * ```
23
23
  *
24
- * @category Chat
24
+ * @category Profile
25
25
  */
26
26
  export declare function setMyProfilePicture(content: string): Promise<{
27
27
  eurl: string;
@@ -21,6 +21,6 @@
21
21
  * await WPP.profile.setMyStatus('Example text');
22
22
  * ```
23
23
  *
24
- * @category Chat
24
+ * @category Profile
25
25
  */
26
26
  export declare function setMyStatus(statusText: string): Promise<boolean>;
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Copyright 2021 WPPConnect Team
2
+ * Copyright 2023 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.
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare function convertToFile(data: string, mimetype?: string, filename?: string): Promise<File>;
16
+ export declare function convertToFile(data: string | Blob | File, mimetype?: string, filename?: string): Promise<File>;
@@ -76,6 +76,7 @@ export * from './sendTextMsgToChat';
76
76
  export * from './setArchive';
77
77
  export * from './setGroup';
78
78
  export * from './setPin';
79
+ export * from './setPushname';
79
80
  export * from './status';
80
81
  export * from './typeAttributeFromProtobuf';
81
82
  export * from './unixTime';
@@ -26,3 +26,11 @@ export declare function sendSetPicture(chat: Wid, previewBase64: string, picture
26
26
  token: string;
27
27
  _duplicate: boolean;
28
28
  }>;
29
+ /**
30
+ * This function can be used to delete a group picture or self profile
31
+ * @whatsapp 78426
32
+ * @whatsapp 5018 >= 2.2204.13
33
+ */
34
+ export declare function requestDeletePicture(chat: Wid): Promise<{
35
+ status: number;
36
+ }>;
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2023 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 135963 >= 2.2310.5
18
+ */
19
+ export declare function setPushname(name: string): Promise<void>;
@@ -14,135 +14,26 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Wid } from './Wid';
17
- /** @whatsapp 99234
18
- * @whatsapp 11362 >= 2.2212.5
19
- * @whatsapp 78820 >= 2.2218.4
20
- * @whatsapp 978820 >= 2.2222.8
17
+ /**
18
+ * @whatsapp 459857 >= 2.2310.5
21
19
  */
22
20
  export declare namespace UserPrefs {
23
- function setMe(wid: Wid): void;
24
- function getMe(): Wid;
25
21
  function assertGetMe(): Wid;
26
22
  function assertGetMeUser(): Wid;
27
- function getMeUser(): Wid;
23
+ function clearGetMaybeMeUserCache(...args: any[]): any;
24
+ function getMaybeMeDisplayName(...args: any[]): any;
25
+ function getMaybeMeLid(...args: any[]): any;
26
+ function getMaybeMeLidUser(...args: any[]): any;
28
27
  function getMaybeMeUser(): Wid;
29
- function setPushname(name: string): void;
30
- function getPushname(): string;
31
- function getLoginTokens(): {
32
- client: string;
33
- server: string;
34
- };
35
- function setLoginTokens(token: {
36
- client: string;
37
- server: string;
38
- }): void;
39
- function knowsPhone(): boolean;
40
- function setRefTok(e?: any, t?: any): void;
41
- function clearDeprecatedKeys(...args: any[]): any;
42
- function mdOptedIn(...args: any[]): any;
43
- function setMdOptedIn(...args: any[]): any;
44
- function getSecretBundle(...args: any[]): any;
45
- function clearTokens(...args: any[]): any;
46
- function shouldShowNUX(...args: any[]): any;
47
- function viewNUX(...args: any[]): any;
48
- function getNUX(...args: any[]): any;
49
- function setNUX(...args: any[]): any;
50
- function removeNUX(...args: any[]): any;
51
- function getUnknownId(...args: any[]): any;
52
- function setUnknownId(...args: any[]): any;
53
- function getBrowserId(...args: any[]): any;
54
- function setBrowserId(...args: any[]): any;
55
- function getLastMobilePlatform(...args: any[]): any;
56
- function setLastMobilePlatform(...args: any[]): any;
57
- function setLastChatMuteDuration(...args: any[]): any;
58
- function getLastChatMuteDuration(...args: any[]): any;
59
- function setTheme(...args: any[]): any;
60
- function getTheme(...args: any[]): any;
61
- function setSystemThemeMode(...args: any[]): any;
62
- function getSystemThemeMode(...args: any[]): any;
63
- function setLastComposeBoxPanel(...args: any[]): any;
64
- function getLastComposeBoxPanel(...args: any[]): any;
65
- function setSeenGroupDesc(...args: any[]): any;
66
- function getSeenGroupDesc(...args: any[]): any;
67
- function getGlobalSounds(...args: any[]): any;
68
- function setGlobalSounds(...args: any[]): any;
69
- function getGlobalNotifications(...args: any[]): any;
70
- function setGlobalNotifications(...args: any[]): any;
71
- function getGlobalSecurityNotifications(...args: any[]): any;
72
- function setGlobalSecurityNotifications(...args: any[]): any;
73
- function getUserPrivacySettings(...args: any[]): any;
74
- function setUserPrivacySettings(...args: any[]): any;
75
- function getGlobalPreviews(...args: any[]): any;
76
- function setGlobalPreviews(...args: any[]): any;
77
- function getCollapseMuted(...args: any[]): any;
78
- function setCollapseMuted(...args: any[]): any;
79
- function getAutoDownloadPhotos(...args: any[]): any;
80
- function setAutoDownloadPhotos(...args: any[]): any;
81
- function getAutoDownloadAudio(...args: any[]): any;
82
- function setAutoDownloadAudio(...args: any[]): any;
83
- function getAutoDownloadVideos(...args: any[]): any;
84
- function setAutoDownloadVideos(...args: any[]): any;
85
- function setAutoDownloadDocuments(...args: any[]): any;
86
- function getGeocoderLocation(...args: any[]): any;
87
- function setGeocoderLocation(...args: any[]): any;
88
- function getMapsOverQuota(...args: any[]): any;
89
- function setMapsOverQuota(...args: any[]): any;
90
- function setSmbLabelPalette(...args: any[]): any;
91
- function getSmbLabelPalette(...args: any[]): any;
92
- function getGroupParticipantAssignedColor(...args: any[]): any;
93
- function setGroupParticipantAssignedColor(...args: any[]): any;
94
- function getMutex(...args: any[]): any;
95
- function setMutex(...args: any[]): any;
96
- function removeMutex(...args: any[]): any;
97
- function parseMutex(...args: any[]): any;
98
- function mutexFilter(...args: any[]): any;
99
- function localTakeoverSuccess(...args: any[]): any;
100
- function parseTakeover(...args: any[]): any;
101
- function takeoverFilter(...args: any[]): any;
102
- function getLangPref(...args: any[]): any;
103
- function setLangPref(...args: any[]): any;
104
- function getLogoutToken(...args: any[]): any;
105
- function setLogoutToken(...args: any[]): any;
106
- function getOldLogoutCreds(...args: any[]): any;
107
- function setOldLogoutCreds(...args: any[]): any;
108
- function setNoTakeover(...args: any[]): any;
109
- function getNoTakeover(...args: any[]): any;
110
- function getWamBuffer(...args: any[]): any;
111
- function setWamBuffer(...args: any[]): any;
112
- function getWamInfo(...args: any[]): any;
113
- function setWamInfo(...args: any[]): any;
114
- function setVideoVolumeSettings(...args: any[]): any;
115
- function setVideoVolumeSetting(...args: any[]): any;
116
- function setVideoMutedSetting(...args: any[]): any;
117
- function getVideoVolumeSettings(...args: any[]): any;
118
- function setComposeContents(...args: any[]): any;
119
- function getComposeContents(...args: any[]): any;
120
- function deleteComposeContents(...args: any[]): any;
121
- function setVersion(...args: any[]): any;
122
- function getVersion(...args: any[]): any;
123
- function setContactChecksum(...args: any[]): any;
124
- function getContactChecksum(...args: any[]): any;
125
- function getNoticeBannerClosedAt(...args: any[]): any;
126
- function setNoticeBannerClosedAt(...args: any[]): any;
127
- function getNoticeId(...args: any[]): any;
128
- function setNoticeId(...args: any[]): any;
129
- function getPttPlaybackRate(...args: any[]): any;
130
- function setPttPlaybackRate(...args: any[]): any;
131
- function getLastStatusUsage(...args: any[]): any;
132
- function setLastStatusUsage(...args: any[]): any;
133
- function getOutgoingMessageSound(...args: any[]): any;
134
- function setOutgoingMessageSound(...args: any[]): any;
135
- function getHistorySyncEarliestDate(...args: any[]): any;
136
- function setHistorySyncEarliestDate(...args: any[]): any;
137
- function setShouldPreemptivelyCleanupLogs(...args: any[]): any;
138
- function getShouldPreemptivelyCleanupLogs(...args: any[]): any;
139
- const getRememberMe: any;
140
- const setRememberMe: any;
141
- const clearAllLocalState: any;
142
- const clearAllTemporaryStorageData: any;
143
- const _setAllKeyValues: any;
144
- const getCollection: any;
145
- const setCollection: any;
146
- const updatePreservedUserKeys: any;
147
- const thisTabId: string;
28
+ function getMe(...args: any[]): any;
29
+ function getMePNandLIDWids(...args: any[]): any;
30
+ function getMeUser(): Wid;
31
+ function isMeAccount(...args: any[]): any;
32
+ function isMeDevice(...args: any[]): any;
33
+ function isMePrimary(...args: any[]): any;
34
+ function isMePrimaryNonLid(...args: any[]): any;
35
+ function isSerializedWidMe(...args: any[]): any;
36
+ function setMe(...args: any[]): any;
37
+ function setMeDisplayName(...args: any[]): any;
38
+ function setMeLid(...args: any[]): any;
148
39
  }
@@ -62,7 +62,8 @@ interface Props {
62
62
  deprecatedMms3Url?: any;
63
63
  directPath?: any;
64
64
  mimetype?: any;
65
- duration?: any;
65
+ waveform?: any;
66
+ duration?: number;
66
67
  filehash?: any;
67
68
  encFilehash?: any;
68
69
  size?: any;