@wppconnect/wa-js 2.1.2 → 2.2.1

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,25 @@
1
+ ## 2.2.1 (2022-05-10)
2
+
3
+
4
+ ### Features
5
+
6
+ * Added new server for link-preview (https://wajsapi.titanwhats.com.br) ([f5b0027](https://github.com/wppconnect-team/wa-js/commit/f5b00271c0b7c83467e180c9c97be8ee6be51aa3))
7
+
8
+
9
+
10
+ # 2.2.0 (2022-05-09)
11
+
12
+
13
+ ### Features
14
+
15
+ * Added support to link preview for Multi Devices ([2ef2249](https://github.com/wppconnect-team/wa-js/commit/2ef22496a8cbc112781d033626e91a6e616b13d1))
16
+
17
+
18
+
19
+ ## 2.1.3 (2022-04-30)
20
+
21
+
22
+
1
23
  ## 2.1.2 (2022-04-29)
2
24
 
3
25
 
@@ -31,5 +31,3 @@ import { MsgKey, MsgModel } from '../../whatsapp';
31
31
  */
32
32
  export declare function getMessageById(id: string | MsgKey): Promise<MsgModel>;
33
33
  export declare function getMessageById(ids: (string | MsgKey)[]): Promise<MsgModel[]>;
34
- export declare function getMessageById(notUsed: any, id: string): Promise<MsgModel>;
35
- export declare function getMessageById(notUsed: any, ids: string[]): Promise<MsgModel[]>;
@@ -39,6 +39,7 @@ export { AudioMessageOptions, AutoDetectMessageOptions, DocumentMessageOptions,
39
39
  export { ListMessageOptions, sendListMessage } from './sendListMessage';
40
40
  export { LocationMessageOptions, sendLocationMessage, } from './sendLocationMessage';
41
41
  export { sendRawMessage } from './sendRawMessage';
42
+ export { sendReactionToMessage } from './sendReactionToMessage';
42
43
  export { sendTextMessage, TextMessageOptions } from './sendTextMessage';
43
44
  export { sendVCardContactMessage, VCardContact, } from './sendVCardContactMessage';
44
45
  export { starMessage, StarMessageReturn } from './starMessage';
@@ -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
+ import { Stringable } from '../../types';
17
+ import { MsgKey, MsgModel } from '../../whatsapp';
18
+ /**
19
+ * Send a reaction to a message
20
+ *
21
+ * Full Emoji List: https://unicode.org/emoji/charts/full-emoji-list.html
22
+ *
23
+ * @example
24
+ * ```javascript
25
+ * // to react a message
26
+ * WPP.chat.sendReactionMessage('[message_id]', '🤯');
27
+ *
28
+ * // to remove
29
+ * WPP.chat.sendReactionMessage('[message_id]', false);
30
+ *
31
+ * ```
32
+ * @category Message
33
+ */
34
+ export declare function sendReactionToMessage(messageId: string | MsgKey | MsgModel | Stringable, reaction: string | false | null): Promise<{
35
+ sendMsgResult: string;
36
+ }>;
@@ -18,4 +18,5 @@ export interface Label {
18
18
  name: string;
19
19
  color: number;
20
20
  count: number;
21
+ hexColor: string;
21
22
  }
@@ -0,0 +1,20 @@
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
+ export declare function downloadImage(url: string, type?: string, quality?: any): Promise<{
17
+ data: string;
18
+ height: number;
19
+ width: number;
20
+ }>;
@@ -0,0 +1,16 @@
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
+ export declare function fetchDataFromPNG(url: string): Promise<Uint8Array>;
@@ -16,7 +16,9 @@
16
16
  export * from './blobToBase64';
17
17
  export * from './convertToFile';
18
18
  export * from './createWid';
19
+ export * from './downloadImage';
19
20
  export * from './errors';
21
+ export * from './fetchDataFromPNG';
20
22
  export * from './isBase64';
21
23
  export * from './types';
22
24
  export * from './wrapFunction';
@@ -0,0 +1,51 @@
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
+ * Fetch preview link data from a remote server
18
+ */
19
+ export declare function fetchRemoteLinkPreviewData(url: string): Promise<{
20
+ title: any;
21
+ description: any;
22
+ canonicalUrl: any;
23
+ matchedText: string;
24
+ richPreviewType: number;
25
+ doNotPlayInline: boolean;
26
+ imageUrl: any;
27
+ } | null>;
28
+ /**
29
+ * Generate the preview link thumbnail data
30
+ */
31
+ export declare function generateThumbnailLinkPreviewData(url: string): Promise<{
32
+ thumbnail: unknown;
33
+ thumbnailHQ?: undefined;
34
+ mediaKey?: undefined;
35
+ mediaKeyTimestamp?: undefined;
36
+ thumbnailDirectPath?: undefined;
37
+ thumbnailSha256?: undefined;
38
+ thumbnailEncSha256?: undefined;
39
+ thumbnailWidth?: undefined;
40
+ thumbnailHeight?: undefined;
41
+ } | {
42
+ thumbnail: unknown;
43
+ thumbnailHQ: string;
44
+ mediaKey: any;
45
+ mediaKeyTimestamp: any;
46
+ thumbnailDirectPath: any;
47
+ thumbnailSha256: string;
48
+ thumbnailEncSha256: any;
49
+ thumbnailWidth: number;
50
+ thumbnailHeight: number;
51
+ } | null>;
@@ -14,9 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ChatModel, LabelModel } from '../models';
17
- import { Collection } from './Collection';
17
+ import { BaseCollection } from './BaseCollection';
18
18
  /** @whatsapp 16770 */
19
- export declare class LabelCollection extends Collection<LabelModel> {
19
+ export declare class LabelCollection extends BaseCollection<LabelModel> {
20
20
  static model: LabelModel;
21
21
  static staleCollection?: any;
22
22
  static resumeOnAvailable?: any;
@@ -31,8 +31,6 @@ export declare class LabelCollection extends Collection<LabelModel> {
31
31
  getNewLabelColor(): any;
32
32
  getLabelColorPalette(): any;
33
33
  handleRemove(e?: any): any;
34
- onResume(): any;
35
- sync(e?: any): any;
36
34
  updateChecksum(e?: any): any;
37
35
  getLabelsForModel(e?: any, t?: any): any;
38
36
  _find(): any;
@@ -0,0 +1,34 @@
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 { LinkPreviewResult } from './fetchLinkPreview';
17
+ /**
18
+ * @whatsapp 92375
19
+ */
20
+ export declare function genMinimalLinkPreview(data: {
21
+ anchor: undefined;
22
+ domain?: string;
23
+ href: string;
24
+ index: number;
25
+ input: string;
26
+ isHttp: boolean;
27
+ params?: string;
28
+ path?: string;
29
+ port?: number;
30
+ scheme: string;
31
+ suspiciousCharacters?: string;
32
+ url: string;
33
+ username?: string;
34
+ }): Promise<null | LinkPreviewResult>;
@@ -19,6 +19,7 @@ export * from './createMsgProtobuf';
19
19
  export * from './fetchLinkPreview';
20
20
  export * from './findChat';
21
21
  export * from './findFirstWebLink';
22
+ export * from './genMinimalLinkPreview';
22
23
  export * from './getOrGenerate';
23
24
  export * from './groupParticipants';
24
25
  export * from './handleAck';
@@ -38,9 +39,11 @@ export * from './sendExitGroup';
38
39
  export * from './sendJoinGroupViaInvite';
39
40
  export * from './sendQueryExists';
40
41
  export * from './sendQueryGroupInvite';
42
+ export * from './sendReactionToMsg';
41
43
  export * from './sendRevokeGroupInviteCode';
42
44
  export * from './sendTextMsgToChat';
43
45
  export * from './setGroup';
44
46
  export * from './status';
45
47
  export * from './typeAttributeFromProtobuf';
46
48
  export * from './uploadProductImage';
49
+ export * from './uploadThumbnail';
@@ -0,0 +1,18 @@
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 { MsgModel } from '../models';
17
+ /** @whatsapp 21357 */
18
+ export declare function sendReactionToMsg(msg: MsgModel, reactionText: string): Promise<string>;
@@ -0,0 +1,37 @@
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 { MediaEntry, OpaqueData } from '../misc';
17
+ export interface ThumbnailData {
18
+ thumbnail: OpaqueData;
19
+ mediaType: string;
20
+ mediaKeyInfo: {
21
+ key: string;
22
+ timestamp: number;
23
+ };
24
+ uploadOrigin: number;
25
+ forwardedFromWeb: boolean;
26
+ signal?: AbortSignal;
27
+ timeout: number;
28
+ isViewOnce: boolean;
29
+ }
30
+ /**
31
+ * @whatsapp 74460
32
+ */
33
+ export declare function uploadThumbnail(data: ThumbnailData): Promise<{
34
+ kind: string;
35
+ mediaEntry: MediaEntry;
36
+ filehash: string;
37
+ }>;
@@ -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
+ * @whatsapp 80923
18
+ * */
19
+ export declare class MediaEntry {
20
+ useBackupUrl: boolean;
21
+ deprecatedMms3Url?: string;
22
+ mediaKey: any;
23
+ mediaKeyTimestamp: any;
24
+ encFilehash: any;
25
+ serverStatus: any;
26
+ sidecar: any;
27
+ directPath: any;
28
+ firstFrameSidecar: any;
29
+ type: any;
30
+ scansSidecar: any;
31
+ scanLengths: any;
32
+ staticUrl: any;
33
+ url(e: any): any;
34
+ canReuseMediaKey(): void;
35
+ markWhetherOnServer(e: any): any;
36
+ }
@@ -25,6 +25,7 @@ export * from './Features';
25
25
  export * from './ImageUtils';
26
26
  export * from './Locale';
27
27
  export * from './MediaBlobCache';
28
+ export * from './MediaEntry';
28
29
  export * from './MediaObject';
29
30
  export * from './MediaObjectUtil';
30
31
  export * from './MediaPrep';
@@ -15,16 +15,17 @@
15
15
  */
16
16
  import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
17
17
  interface Props {
18
- id?: any;
19
- colorIndex?: any;
20
- color?: any;
18
+ id: string;
19
+ name: string;
20
+ colorIndex?: number;
21
+ color?: number;
21
22
  count?: any;
22
23
  }
23
24
  interface Session {
24
25
  stale?: any;
25
26
  }
26
27
  interface Derived {
27
- hexColor?: any;
28
+ hexColor: string;
28
29
  }
29
30
  /** @whatsapp 8803 */
30
31
  export declare interface LabelModel extends ModelProxy<Props, Session, Derived> {