@wppconnect/wa-js 2.14.1 → 2.15.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,5 +1 @@
1
- ## 2.14.1 (2022-11-01)
2
-
3
- ### Bug Fixes
4
-
5
- - Fixed WPP.chat.starMessage function (fix [#729](https://github.com/wppconnect-team/wa-js/issues/729)) ([bfa6969](https://github.com/wppconnect-team/wa-js/commit/bfa69697e8adbc8e2da82b4a9984d46daf01d79f))
1
+ ## 2.15.1 (2022-11-08)
@@ -0,0 +1,33 @@
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, Wid } from '../../whatsapp';
17
+ import { RawMessage } from '..';
18
+ export interface ForwardMessagesOptions {
19
+ displayCaptionText?: boolean;
20
+ multicast?: boolean;
21
+ }
22
+ /**
23
+ * Forward messages to a chat
24
+ *
25
+ * @example
26
+ * ```javascript
27
+ * // Forward messages
28
+ * WPP.chat.forwardMessage('[number]@c.us', 'true_[number]@c.us_ABCDEF');
29
+ * ```
30
+ * @category Message
31
+ * @return {any} Any
32
+ */
33
+ export declare function forwardMessage(toChatId: string | Wid, msgId: string | MsgKey, options?: ForwardMessagesOptions): Promise<RawMessage[]>;
@@ -0,0 +1,60 @@
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, Wid } from '../../whatsapp';
17
+ import { ACK } from '../../whatsapp/enums';
18
+ export interface ParticipantStatusACK {
19
+ id: string;
20
+ wid: Wid;
21
+ deliveredAt?: number;
22
+ readAt?: number;
23
+ playedAt?: number;
24
+ }
25
+ /**
26
+ * Get message ACK from a message
27
+ *
28
+ * @example
29
+ * ```javascript
30
+ * // Get message ACK
31
+ * const ackInfo = await WPP.chat.getMessageACK('true_[number]@c.us_ABCDEF');
32
+ *
33
+ * console.log(ackInfo.deliveryRemaining); // Delivery Remaining
34
+ * console.log(ackInfo.readRemaining); // Read Remaining
35
+ * console.log(ackInfo.playedRemaining); // PlayedRemaining, for audio(ptt) only
36
+ *
37
+ * console.log(ackInfo.participants[0].deliveredAt); // Delivered At, in timestamp format
38
+ * console.log(ackInfo.participants[0].readAt); // Read At, in timestamp format
39
+ * console.log(ackInfo.participants[0].playedAt); // Played At, in timestamp format, for audio(ptt) only
40
+ *
41
+ * //To get only how was received
42
+ * const received = ackInfo.participants.filter(p => p.deliveredAt || p.readAt || p.playedAt);
43
+ *
44
+ * //To get only how was read
45
+ * const read = ackInfo.participants.filter(p => p.readAt || p.playedAt);
46
+ *
47
+ * //To get only how was played
48
+ * const played = ackInfo.participants.filter(p => p.playedAt);
49
+ * ```
50
+ * @category Message
51
+ * @return {any} Any
52
+ */
53
+ export declare function getMessageACK(msgId: string | MsgKey): Promise<{
54
+ ack: ACK;
55
+ fromMe: boolean;
56
+ deliveryRemaining: number;
57
+ readRemaining: number;
58
+ playedRemaining: number;
59
+ participants: ParticipantStatusACK[];
60
+ }>;
@@ -22,9 +22,11 @@ export { delete } from './delete';
22
22
  export { deleteMessage, DeleteMessageReturn } from './deleteMessage';
23
23
  export { downloadMedia } from './downloadMedia';
24
24
  export { find } from './find';
25
+ export { forwardMessage, ForwardMessagesOptions } from './forwardMessage';
25
26
  export { generateMessageID } from './generateMessageID';
26
27
  export { get } from './get';
27
28
  export { getLastSeen } from './getLastSeen';
29
+ export { getMessageACK } from './getMessageACK';
28
30
  export { getMessageById } from './getMessageById';
29
31
  export { getMessages, GetMessagesOptions } from './getMessages';
30
32
  export { getPlatformFromMessage } from './getPlatformFromMessage';
@@ -19,7 +19,7 @@ import { Wid } from '../../whatsapp';
19
19
  *
20
20
  * @example
21
21
  * ```javascript
22
- * const url = await WPP.contact.getProfilePicture('[number]@c.us');
22
+ * const url = await WPP.contact.getProfilePictureUrl('[number]@c.us');
23
23
  * ```
24
24
  *
25
25
  * @category Chat
@@ -13,9 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /** @whatsapp 98250
17
- * @whatsapp 16413 >= 2.2204.13
18
- * @whatsapp 66333 >= 2.2218.4
19
- * @whatsapp 266333 >= 2.2222.8
20
- */
21
- export declare function getOrGenerate(): string;
16
+ export declare function blobToArrayBuffer(blob: Blob): Promise<ArrayBuffer>;
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ export * from './blobToArrayBuffer';
16
17
  export * from './blobToBase64';
17
18
  export * from './convertToFile';
18
19
  export * from './createWid';
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { ChatModel } from '../models';
16
+ import { ChatModel, MsgModel } from '../models';
17
17
  import { BaseCollection } from './BaseCollection';
18
18
  /** @whatsapp 69951
19
19
  * @whatsapp 669951 >= 2.2222.8
@@ -31,5 +31,5 @@ export declare class ChatCollection extends BaseCollection<ChatModel> {
31
31
  getKeysForResyncMsgs(): any;
32
32
  resyncMessages(): any;
33
33
  unstarAllMessages(e?: any, t?: any): any;
34
- forwardMessagesToChats(e?: any, t?: any): any;
34
+ forwardMessagesToChats(msgs: MsgModel[], chats: ChatModel[], displayCaptionText?: boolean): any;
35
35
  }
@@ -14,11 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { MsgInfoModel } from '../models';
17
- import { Collection } from './Collection';
18
- /** @whatsapp 17972
17
+ import { BaseCollection } from './BaseCollection';
18
+ /**
19
19
  * @whatsapp 617972 >= 2.2222.8
20
+ * @whatsapp 739245 >= 2.2242.6
20
21
  */
21
- export declare class MsgInfoCollection extends Collection<MsgInfoModel> {
22
+ export declare class MsgInfoCollection extends BaseCollection<MsgInfoModel> {
22
23
  static model: MsgInfoModel;
23
24
  static staleCollection?: any;
24
25
  updateInfo(e?: any, t?: any, r?: any, a?: any, i?: any, n?: any): any;
@@ -13,15 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { StickerModel } from '../models';
16
+ import { MsgInfoParticipantModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 16774 */
19
- export declare class StarredStickerCollection extends Collection<StickerModel> {
20
- static model: StickerModel;
21
- syncNextPage(): any;
22
- sync(e?: any): any;
23
- isSynced(): boolean;
24
- canLoadMore(): boolean;
25
- getRemaining(): any;
18
+ /**
19
+ * @whatsapp 738482 >= 2.2242.6
20
+ */
21
+ export declare class MsgInfoParticipantCollection extends Collection<MsgInfoParticipantModel> {
22
+ static model: MsgInfoParticipantModel;
26
23
  static comparator(): any;
27
24
  }
@@ -15,9 +15,11 @@
15
15
  */
16
16
  import { ParticipantModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 96091
18
+ /**
19
+ * @whatsapp 96091
19
20
  * @whatsapp 54311 >= 2.2212.8
20
21
  * @whatsapp 754311 >= 2.2222.8
22
+ * @whatsapp 164560 >= 2.2242.6
21
23
  */
22
24
  export declare class ParticipantCollection extends Collection<ParticipantModel> {
23
25
  static model: ParticipantModel;
@@ -36,6 +36,7 @@ export * from './LabelItemCollection';
36
36
  export * from './LiveLocationCollection';
37
37
  export * from './MsgCollection';
38
38
  export * from './MsgInfoCollection';
39
+ export * from './MsgInfoParticipantCollection';
39
40
  export * from './MuteCollection';
40
41
  export * from './OrderCollection';
41
42
  export * from './OrderItemCollection';
@@ -52,7 +53,6 @@ export * from './ReactionsSendersCollection';
52
53
  export * from './RecentEmojiCollection';
53
54
  export * from './RecentStickerCollection';
54
55
  export * from './StarredMsgCollection';
55
- export * from './StarredStickerCollection';
56
56
  export * from './StatusCollection';
57
57
  export * from './StatusV3Collection';
58
58
  export * from './StickerCollection';
@@ -31,15 +31,16 @@ export * from './generateVideoThumbsAndDuration';
31
31
  export * from './genMinimalLinkPreview';
32
32
  export * from './getFanOutList';
33
33
  export * from './getGroupSenderKeyList';
34
- export * from './getOrGenerate';
35
34
  export * from './getSearchContext';
36
35
  export * from './groupParticipants';
37
36
  export * from './handleAck';
37
+ export * from './isAnimatedWebp';
38
38
  export * from './isAuthenticated';
39
39
  export * from './isRegistered';
40
40
  export * from './markSeen';
41
41
  export * from './mediaTypeFromProtobuf';
42
42
  export * from './msgFindQuery';
43
+ export * from './processRawSticker';
43
44
  export * from './products';
44
45
  export * from './productVisibilitySet';
45
46
  export * from './profilePic';
@@ -0,0 +1,19 @@
1
+ /*!
2
+ * Copyright 2022 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 176819 >= 2.2242.6
18
+ */
19
+ export declare function isAnimatedWebp(data: ArrayBuffer): boolean;
@@ -0,0 +1,26 @@
1
+ /*!
2
+ * Copyright 2022 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 { OpaqueData } from '../misc';
17
+ /**
18
+ * @whatsapp 232294 >= 2.2242.6
19
+ */
20
+ export declare function processRawSticker(data: OpaqueData): Promise<{
21
+ type: 'sticker';
22
+ mediaBlob: OpaqueData;
23
+ mimetype: string;
24
+ fullWidth: number;
25
+ fullHeight: number;
26
+ }>;
@@ -154,7 +154,7 @@ export declare class ChatModel extends ModelChatBase {
154
154
  getWebcChatType(): any;
155
155
  deregisterExpiredViewOnceBulkMessages(e?: any): any;
156
156
  sendGroupInviteMessage(e?: any, t?: any, r?: any, a?: any, i?: any, n?: any): any;
157
- forwardMessages(e?: any, t?: boolean): any;
157
+ forwardMessages(msgs: MsgModel[], multicast?: any, displayCaptionText?: boolean): any;
158
158
  updateReadOnly(): any;
159
159
  updateIsAnnounceGrpRestrict(): any;
160
160
  sortMsgs(e?: any): any;
@@ -13,15 +13,15 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { MsgInfoCollection } from '../collections';
16
+ import { MsgInfoCollection, MsgInfoParticipantCollection } from '../collections';
17
17
  import { MsgKey } from '../misc';
18
18
  import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
19
19
  interface Props {
20
20
  id: MsgKey;
21
21
  usePlayReceipt?: any;
22
- playedRemaining?: any;
23
- readRemaining?: any;
24
- deliveryRemaining?: any;
22
+ playedRemaining: number;
23
+ readRemaining: number;
24
+ deliveryRemaining: number;
25
25
  deliveryPrivacyMode?: any;
26
26
  }
27
27
  interface Session {
@@ -30,16 +30,22 @@ interface Session {
30
30
  interface Derived {
31
31
  settled?: any;
32
32
  }
33
- /** @whatsapp 54311
33
+ /**
34
+ * @whatsapp 54311
34
35
  * @whatsapp 754311 >= 2.2222.8
36
+ * @whatsapp 738482 >= 2.2242.6
35
37
  */
36
38
  export declare interface MsgInfoModel extends ModelProxy<Props, Session, Derived> {
37
39
  }
38
- /** @whatsapp 54311
39
- * @whatsapp 754311 >= 2.2222.8
40
+ /**
41
+ * @whatsapp 54311
42
+ * @whatsapp 738482 >= 2.2222.8
40
43
  */
41
44
  export declare class MsgInfoModel extends Model<MsgInfoCollection> {
42
45
  idClass: typeof MsgKey;
46
+ played: MsgInfoParticipantCollection;
47
+ read: MsgInfoParticipantCollection;
48
+ delivery: MsgInfoParticipantCollection;
43
49
  constructor(proterties?: ModelPropertiesContructor<MsgInfoModel>, options?: ModelOptions);
44
50
  getCollection(): MsgInfoCollection;
45
51
  }
@@ -0,0 +1,41 @@
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 { MsgInfoCollection } from '../collections';
17
+ import { Wid } from '../misc';
18
+ import { ContactModel } from './ContactModel';
19
+ import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
20
+ interface Props {
21
+ id: Wid;
22
+ t: number;
23
+ }
24
+ interface Session {
25
+ contact: ContactModel;
26
+ }
27
+ interface Derived {
28
+ }
29
+ /**
30
+ * @whatsapp 738482 >= 2.2242.6
31
+ */
32
+ export declare interface MsgInfoParticipantModel extends ModelProxy<Props, Session, Derived> {
33
+ }
34
+ /**
35
+ * @whatsapp 738482 >= 2.2242.6
36
+ */
37
+ export declare class MsgInfoParticipantModel extends Model<MsgInfoCollection> {
38
+ constructor(proterties?: ModelPropertiesContructor<MsgInfoParticipantModel>, options?: ModelOptions);
39
+ getCollection(): MsgInfoCollection;
40
+ }
41
+ export {};
@@ -15,6 +15,7 @@
15
15
  */
16
16
  import { TextFontStyle } from '../../enums';
17
17
  import { ButtonCollection, MsgCollection, TemplateButtonCollection } from '../collections';
18
+ import { ACK } from '../enums';
18
19
  import { MediaObject, MsgKey, Wid } from '../misc';
19
20
  import { ChatModel, MediaDataModel } from '.';
20
21
  import { Model, ModelOptions, ModelPropertiesContructor, ModelProxy } from './Model';
@@ -33,7 +34,7 @@ interface Props {
33
34
  /**
34
35
  * See {@link Constants}
35
36
  */
36
- ack?: number;
37
+ ack?: ACK;
37
38
  invis?: any;
38
39
  isNewMsg: boolean;
39
40
  star?: any;
@@ -40,6 +40,7 @@ export * from './Model';
40
40
  export * from './ModelChatBase';
41
41
  export * from './MsgButtonReplyMsgModel';
42
42
  export * from './MsgInfoModel';
43
+ export * from './MsgInfoParticipantModel';
43
44
  export * from './MsgModel';
44
45
  export * from './MuteModel';
45
46
  export * from './OrderItemModel';
@@ -107,8 +107,6 @@ export declare const RecentStickerStore: collections.RecentStickerCollection;
107
107
  * @whatsapp 719011 >= 2.2222.8
108
108
  */
109
109
  export declare const StarredMsgStore: collections.StarredMsgCollection;
110
- /** @whatsapp 16774 */
111
- export declare const StarredStickerStore: collections.StarredStickerCollection;
112
110
  /** @whatsapp 46133 */
113
111
  export declare const StatusStore: collections.StatusCollection;
114
112
  /** @whatsapp 59387