@wppconnect/wa-js 2.21.0 → 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 +1,5 @@
1
- # 2.21.0 (2023-03-04)
1
+ # 2.22.0 (2023-03-09)
2
+
3
+ ### Features
4
+
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>;
@@ -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>;
@@ -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;