@wppconnect/wa-js 2.14.0 → 2.15.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.14.0 (2022-10-30)
1
+ # 2.15.0 (2022-11-07)
2
2
 
3
3
  ### Features
4
4
 
5
- - Added WPP.conn.isRegistered function ([44c4664](https://github.com/wppconnect-team/wa-js/commit/44c46649047464c230565ca143418e72417bea99))
5
+ - Added WPP.chat.getMessageACK function (close [#697](https://github.com/wppconnect-team/wa-js/issues/697)) ([ffc378f](https://github.com/wppconnect-team/wa-js/commit/ffc378f9ea5b8a2be31e7fa1846381dff6ef9cd6))
@@ -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
@@ -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 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;
@@ -0,0 +1,24 @@
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 { MsgInfoParticipantModel } from '../models';
17
+ import { Collection } from './Collection';
18
+ /**
19
+ * @whatsapp 738482 >= 2.2242.6
20
+ */
21
+ export declare class MsgInfoParticipantCollection extends Collection<MsgInfoParticipantModel> {
22
+ static model: MsgInfoParticipantModel;
23
+ static comparator(): any;
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';
@@ -0,0 +1,28 @@
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, MsgLoad } from '../misc';
17
+ import { ChatModel, MsgModel } from '../models';
18
+ /**
19
+ * @whatsapp 738599 >= 2.2242.5
20
+ */
21
+ export declare function getSearchContext(chat: ChatModel, msg: MsgModel | MsgKey, options?: {
22
+ isQuotedMsgAvailable: boolean;
23
+ }): {
24
+ collection: MsgLoad;
25
+ msg?: MsgModel;
26
+ key?: MsgKey;
27
+ highlightMsg: true;
28
+ };
@@ -32,13 +32,16 @@ export * from './genMinimalLinkPreview';
32
32
  export * from './getFanOutList';
33
33
  export * from './getGroupSenderKeyList';
34
34
  export * from './getOrGenerate';
35
+ export * from './getSearchContext';
35
36
  export * from './groupParticipants';
36
37
  export * from './handleAck';
38
+ export * from './isAnimatedWebp';
37
39
  export * from './isAuthenticated';
38
40
  export * from './isRegistered';
39
41
  export * from './markSeen';
40
42
  export * from './mediaTypeFromProtobuf';
41
43
  export * from './msgFindQuery';
44
+ export * from './processRawSticker';
42
45
  export * from './products';
43
46
  export * from './productVisibilitySet';
44
47
  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
+ }>;
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ChatModel } from '..';
17
+ import { getSearchContext } from '../functions';
17
18
  import { MsgModel } from '../models';
18
19
  import { EventEmitter } from '.';
19
20
  /** @whatsapp 88102
@@ -49,15 +50,15 @@ export declare class CmdClass extends EventEmitter {
49
50
  openMediaViewerForAlbumMedia(e?: any): void;
50
51
  productImageViewerModal(e?: any, t?: any): void;
51
52
  ephemeralDrawer(e?: any, t?: any): void;
52
- sendStarMsgs(e?: any, t?: any, r?: any, n?: any): void;
53
- sendUnstarMsgs(e?: any, t?: any, r?: any, n?: any): void;
53
+ sendStarMsgs(chat: ChatModel, msgs: MsgModel[], id?: any, toastPosition?: any): void;
54
+ sendUnstarMsgs(chat: ChatModel, msgs: MsgModel[], id?: any, toastPosition?: any): void;
54
55
  sendDeleteMsgs(chat: ChatModel, msgs: MsgModel[], clearMedia?: boolean, toastPosition?: any): void;
55
56
  sendRevokeMsgs(chat: ChatModel, msgs: MsgModel[], options?: {
56
57
  clearMedia?: boolean;
57
58
  toastPosition?: any;
58
59
  }): void;
59
60
  _openChat(e?: any, t?: any): void;
60
- openChatAt(chat: ChatModel, context: ReturnType<ChatModel['getSearchContext']>): Promise<boolean>;
61
+ openChatAt(chat: ChatModel, context: ReturnType<typeof getSearchContext>): Promise<boolean>;
61
62
  openChatFromUnread(chat: ChatModel): Promise<boolean>;
62
63
  openChatBottom(chat: ChatModel): Promise<boolean>;
63
64
  scrollToPtt(e?: any): void;
@@ -131,7 +131,7 @@ export declare class ChatModel extends ModelChatBase {
131
131
  loadEarlierMsgs(e?: any, t?: any): any;
132
132
  isMostRecentCMC(e?: any): boolean;
133
133
  loadRecentMsgs(e?: any): any;
134
- getSearchContext(msg: MsgModel | MsgKey, options?: {
134
+ getSearchContext?(msg: MsgModel | MsgKey, options?: {
135
135
  isQuotedMsgAvailable: boolean;
136
136
  }): {
137
137
  collection: MsgLoad;
@@ -139,7 +139,6 @@ export declare class ChatModel extends ModelChatBase {
139
139
  key?: MsgKey;
140
140
  highlightMsg: true;
141
141
  };
142
- sendStarMsgs(msgs: MsgModel[], star: boolean): any;
143
142
  sendRevokeMsgs(messages: MsgModel[], deleteMediaInDevice?: boolean): Promise<SendMsgResult>;
144
143
  sendRevokeMsgs(messages: MsgModel[], sender: string, deleteMediaInDevice?: boolean): Promise<SendMsgResult>;
145
144
  sendDeleteMsgs(messages: MsgModel[], deleteMediaInDevice?: boolean): Promise<SendMsgResult>;
@@ -155,7 +154,7 @@ export declare class ChatModel extends ModelChatBase {
155
154
  getWebcChatType(): any;
156
155
  deregisterExpiredViewOnceBulkMessages(e?: any): any;
157
156
  sendGroupInviteMessage(e?: any, t?: any, r?: any, a?: any, i?: any, n?: any): any;
158
- forwardMessages(e?: any, t?: boolean): any;
157
+ forwardMessages(msgs: MsgModel[], multicast?: any, displayCaptionText?: boolean): any;
159
158
  updateReadOnly(): any;
160
159
  updateIsAnnounceGrpRestrict(): any;
161
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';