@wppconnect/wa-js 1.0.7 → 1.0.11

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.
Files changed (150) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/chat/Chat.d.ts +76 -10
  3. package/dist/chat/types.d.ts +88 -1
  4. package/dist/contact/Contact.d.ts +26 -0
  5. package/dist/contact/index.d.ts +20 -0
  6. package/dist/contact/types.d.ts +18 -0
  7. package/dist/{whatsapp/enums/TextFontStyle.d.ts → enums.d.ts} +0 -3
  8. package/dist/group/Group.d.ts +9 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/internal.d.ts +1 -0
  11. package/dist/status/Status.d.ts +1 -6
  12. package/dist/status/types.d.ts +1 -1
  13. package/dist/{whatsapp/misc/Stringable.d.ts → types.d.ts} +0 -0
  14. package/dist/util/errors.d.ts +3 -1
  15. package/dist/whatsapp/collections/BlocklistCollection.d.ts +1 -1
  16. package/dist/whatsapp/collections/BusinessCategoriesResultCollection.d.ts +1 -1
  17. package/dist/whatsapp/collections/BusinessProfileCollection.d.ts +1 -1
  18. package/dist/whatsapp/collections/ButtonCollection.d.ts +1 -1
  19. package/dist/whatsapp/collections/CallCollection.d.ts +1 -1
  20. package/dist/whatsapp/collections/CartCollection.d.ts +1 -1
  21. package/dist/whatsapp/collections/CartItemCollection.d.ts +1 -1
  22. package/dist/whatsapp/collections/CatalogCollection.d.ts +1 -1
  23. package/dist/whatsapp/collections/ChatCollection.d.ts +1 -1
  24. package/dist/whatsapp/collections/ChatstateCollection.d.ts +1 -1
  25. package/dist/whatsapp/collections/Collection.d.ts +4 -3
  26. package/dist/whatsapp/collections/CollectionCache.d.ts +2 -2
  27. package/dist/whatsapp/collections/ContactCollection.d.ts +1 -1
  28. package/dist/whatsapp/collections/EmojiVariantCollection.d.ts +1 -1
  29. package/dist/whatsapp/collections/GroupMetadataCollection.d.ts +1 -1
  30. package/dist/whatsapp/collections/LabelCollection.d.ts +1 -1
  31. package/dist/whatsapp/collections/LabelItemCollection.d.ts +1 -1
  32. package/dist/whatsapp/collections/LiveLocationCollection.d.ts +1 -1
  33. package/dist/whatsapp/collections/MsgCollection.d.ts +1 -1
  34. package/dist/whatsapp/collections/MsgInfoCollection.d.ts +1 -1
  35. package/dist/whatsapp/collections/MuteCollection.d.ts +1 -1
  36. package/dist/whatsapp/collections/OrderCollection.d.ts +1 -1
  37. package/dist/whatsapp/collections/OrderItemCollection.d.ts +1 -1
  38. package/dist/whatsapp/collections/ParticipantCollection.d.ts +1 -1
  39. package/dist/whatsapp/collections/PresenceCollection.d.ts +1 -1
  40. package/dist/whatsapp/collections/ProductCollCollection.d.ts +1 -1
  41. package/dist/whatsapp/collections/ProductCollection.d.ts +1 -1
  42. package/dist/whatsapp/collections/ProductImageCollection.d.ts +1 -1
  43. package/dist/whatsapp/collections/ProductMessageListCollection.d.ts +1 -1
  44. package/dist/whatsapp/collections/ProfilePicThumbCollection.d.ts +1 -1
  45. package/dist/whatsapp/collections/QuickReplyCollection.d.ts +1 -1
  46. package/dist/whatsapp/collections/RecentEmojiCollection.d.ts +1 -1
  47. package/dist/whatsapp/collections/RecentStickerCollection.d.ts +1 -1
  48. package/dist/whatsapp/collections/StarredMsgCollection.d.ts +1 -1
  49. package/dist/whatsapp/collections/StarredStickerCollection.d.ts +1 -1
  50. package/dist/whatsapp/collections/StatusCollection.d.ts +1 -1
  51. package/dist/whatsapp/collections/StatusV3Collection.d.ts +1 -1
  52. package/dist/whatsapp/collections/StickerCollection.d.ts +1 -1
  53. package/dist/whatsapp/collections/StickerPackCollection.d.ts +1 -1
  54. package/dist/whatsapp/collections/StickerSearchCollection.d.ts +1 -1
  55. package/dist/whatsapp/collections/TemplateButtonCollection.d.ts +1 -1
  56. package/dist/whatsapp/enums/LogoutReason.d.ts +1 -1
  57. package/dist/whatsapp/enums/OUTWARD_TYPES.d.ts +26 -0
  58. package/dist/whatsapp/enums/SendMsgResult.d.ts +1 -1
  59. package/dist/whatsapp/enums/index.d.ts +1 -1
  60. package/dist/whatsapp/functions/addAndSendMsgToChat.d.ts +1 -1
  61. package/dist/whatsapp/functions/blockContact.d.ts +2 -2
  62. package/dist/whatsapp/functions/findChat.d.ts +1 -1
  63. package/dist/whatsapp/functions/getOrGenerate.d.ts +1 -1
  64. package/dist/whatsapp/functions/groupParticipants.d.ts +4 -4
  65. package/dist/whatsapp/functions/index.d.ts +2 -0
  66. package/dist/whatsapp/functions/isAuthenticated.d.ts +1 -1
  67. package/dist/whatsapp/functions/msgFindQuery.d.ts +1 -1
  68. package/dist/whatsapp/functions/randomId.d.ts +2 -2
  69. package/dist/whatsapp/functions/sendClear.d.ts +1 -1
  70. package/dist/whatsapp/functions/sendCreateGroup.d.ts +26 -0
  71. package/dist/whatsapp/functions/sendDelete.d.ts +1 -1
  72. package/dist/whatsapp/functions/sendQueryExists.d.ts +21 -0
  73. package/dist/whatsapp/functions/sendTextMsgToChat.d.ts +1 -1
  74. package/dist/whatsapp/misc/Base64.d.ts +1 -1
  75. package/dist/whatsapp/misc/Browser.d.ts +1 -1
  76. package/dist/whatsapp/misc/ClockSkew.d.ts +1 -1
  77. package/dist/whatsapp/misc/Cmd.d.ts +2 -5
  78. package/dist/whatsapp/misc/Conn.d.ts +1 -1
  79. package/dist/whatsapp/misc/Constants.d.ts +1 -1
  80. package/dist/whatsapp/misc/EventEmitter.d.ts +1 -1
  81. package/dist/whatsapp/misc/Features.d.ts +1 -1
  82. package/dist/whatsapp/misc/ImageUtils.d.ts +1 -1
  83. package/dist/whatsapp/misc/Locale.d.ts +20 -0
  84. package/dist/whatsapp/misc/MediaObject.d.ts +64 -0
  85. package/dist/whatsapp/misc/MediaObjectUtil.d.ts +20 -0
  86. package/dist/whatsapp/misc/MediaPrep.d.ts +45 -0
  87. package/dist/whatsapp/misc/MediaUtils.d.ts +1 -1
  88. package/dist/whatsapp/misc/MsgKey.d.ts +1 -1
  89. package/dist/whatsapp/misc/MsgLoadState.d.ts +2 -2
  90. package/dist/whatsapp/misc/OpaqueData.d.ts +39 -0
  91. package/dist/whatsapp/misc/State.d.ts +1 -1
  92. package/dist/whatsapp/misc/UserPrefs.d.ts +1 -1
  93. package/dist/whatsapp/misc/Wid.d.ts +1 -1
  94. package/dist/whatsapp/misc/WidFactory.d.ts +1 -1
  95. package/dist/whatsapp/misc/index.d.ts +5 -1
  96. package/dist/whatsapp/models/AttachMediaModel.d.ts +2 -2
  97. package/dist/whatsapp/models/BlocklistModel.d.ts +2 -2
  98. package/dist/whatsapp/models/BusinessCategoriesResultModel.d.ts +2 -2
  99. package/dist/whatsapp/models/BusinessProfileModel.d.ts +2 -2
  100. package/dist/whatsapp/models/CallModel.d.ts +2 -2
  101. package/dist/whatsapp/models/CallParticipantModel.d.ts +2 -2
  102. package/dist/whatsapp/models/CartItemModel.d.ts +2 -2
  103. package/dist/whatsapp/models/CartModel.d.ts +2 -2
  104. package/dist/whatsapp/models/CatalogModel.d.ts +2 -2
  105. package/dist/whatsapp/models/ChatModel.d.ts +12 -6
  106. package/dist/whatsapp/models/ChatPreferenceModel.d.ts +2 -2
  107. package/dist/whatsapp/models/ChatstateModel.d.ts +2 -2
  108. package/dist/whatsapp/models/ConnModel.d.ts +2 -2
  109. package/dist/whatsapp/models/ContactModel.d.ts +2 -2
  110. package/dist/whatsapp/models/ConversionTupleModel.d.ts +2 -2
  111. package/dist/whatsapp/models/EmojiVariantModel.d.ts +2 -2
  112. package/dist/whatsapp/models/GroupMetadataModel.d.ts +2 -2
  113. package/dist/whatsapp/models/LabelItemModel.d.ts +2 -2
  114. package/dist/whatsapp/models/LabelModel.d.ts +2 -2
  115. package/dist/whatsapp/models/LiveLocationModel.d.ts +2 -2
  116. package/dist/whatsapp/models/LiveLocationParticipantModel.d.ts +2 -2
  117. package/dist/whatsapp/models/MediaDataModel.d.ts +4 -3
  118. package/dist/whatsapp/models/Model.d.ts +3 -2
  119. package/dist/whatsapp/models/ModelChatBase.d.ts +1 -1
  120. package/dist/whatsapp/models/MsgButtonReplyMsgModel.d.ts +2 -2
  121. package/dist/whatsapp/models/MsgInfoModel.d.ts +2 -2
  122. package/dist/whatsapp/models/MsgModel.d.ts +6 -6
  123. package/dist/whatsapp/models/MuteModel.d.ts +2 -2
  124. package/dist/whatsapp/models/OrderItemModel.d.ts +2 -2
  125. package/dist/whatsapp/models/OrderModel.d.ts +2 -2
  126. package/dist/whatsapp/models/ParticipantModel.d.ts +2 -2
  127. package/dist/whatsapp/models/ProductCollModel.d.ts +2 -2
  128. package/dist/whatsapp/models/ProductImageModel.d.ts +2 -2
  129. package/dist/whatsapp/models/ProductModel.d.ts +2 -2
  130. package/dist/whatsapp/models/Product_listModel.d.ts +2 -2
  131. package/dist/whatsapp/models/ProfilePicThumbModel.d.ts +2 -2
  132. package/dist/whatsapp/models/QuickReplyModel.d.ts +2 -2
  133. package/dist/whatsapp/models/RecentEmojiModel.d.ts +2 -2
  134. package/dist/whatsapp/models/RecentStickerModel.d.ts +2 -2
  135. package/dist/whatsapp/models/ReplyButtonModel.d.ts +2 -2
  136. package/dist/whatsapp/models/StateModel.d.ts +2 -2
  137. package/dist/whatsapp/models/StatusModel.d.ts +2 -2
  138. package/dist/whatsapp/models/StatusV3Model.d.ts +2 -2
  139. package/dist/whatsapp/models/StickerModel.d.ts +2 -2
  140. package/dist/whatsapp/models/StickerPackModel.d.ts +2 -2
  141. package/dist/whatsapp/models/TemplateButtonModel.d.ts +2 -2
  142. package/dist/whatsapp/models/UnreadMentionModel.d.ts +2 -2
  143. package/dist/whatsapp/models/WebCallModel.d.ts +2 -2
  144. package/dist/whatsapp/multidevice/adv.d.ts +1 -1
  145. package/dist/whatsapp/multidevice/waNoiseInfo.d.ts +1 -1
  146. package/dist/whatsapp/multidevice/waSignalStore.d.ts +1 -1
  147. package/dist/whatsapp/stores.d.ts +29 -29
  148. package/dist/wppconnect-wa.js +1 -1
  149. package/dist/wppconnect-wa.js.LICENSE.txt +9 -0
  150. package/package.json +17 -13
package/CHANGELOG.md CHANGED
@@ -1,3 +1,29 @@
1
+ ## 1.0.11 (2021-11-11)
2
+
3
+
4
+
5
+ ## 1.0.10 (2021-11-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Fixed getMessages for non multidevices (fix wppconnect-team/wppconnect[#629](https://github.com/wppconnect-team/wa-js/issues/629)) ([c43b2cb](https://github.com/wppconnect-team/wa-js/commit/c43b2cb9f1e7cd0bebd8754f9f1458f56f778091))
11
+
12
+
13
+
14
+ ## 1.0.9 (2021-11-02)
15
+
16
+
17
+ ### Features
18
+
19
+ * Added quotedMsg option for send message ([1a6aacd](https://github.com/wppconnect-team/wa-js/commit/1a6aacd68a408049cfd2bb034626f0e0bd5f62bf))
20
+
21
+
22
+
23
+ ## 1.0.8 (2021-10-30)
24
+
25
+
26
+
1
27
  ## 1.0.7 (2021-10-20)
2
28
 
3
29
 
@@ -14,7 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import Emittery from 'emittery';
17
- import { ChatModel, Wid } from '../whatsapp';
17
+ import { ChatModel, MsgKey, MsgModel, Wid } from '../whatsapp';
18
+ import { AudioMessageOptions, DeleteMessageReturn, DocumentMessageOptions, ImageMessageOptions, SendMessageReturn, VideoMessageOptions } from '.';
18
19
  import { ChatEventTypes, GetMessagesOptions, ListMessageOptions, MessageButtonsOptions, RawMessage, SendMessageOptions, TextMessageOptions } from './types';
19
20
  export declare class Chat extends Emittery<ChatEventTypes> {
20
21
  defaultSendMessageOptions: SendMessageOptions;
@@ -58,14 +59,15 @@ export declare class Chat extends Emittery<ChatEventTypes> {
58
59
  * @return {RawMessage[]} List of raw messages
59
60
  */
60
61
  getMessages(chatId: string | Wid, options?: GetMessagesOptions): Promise<RawMessage[]>;
61
- prepareMessageButtons(message: RawMessage, options: MessageButtonsOptions): RawMessage;
62
- sendRawMessage(chatId: any, message: RawMessage, options?: SendMessageOptions): Promise<{
63
- id: string;
64
- ack: number | undefined;
65
- message: Promise<import("../whatsapp").MsgModel>;
66
- sendMsgResult: Promise<import("../whatsapp/enums").SendMsgResult>;
67
- }>;
68
- sendTextMessage(chatId: any, content: any, options?: TextMessageOptions): Promise<any>;
62
+ getMessageById(chatId: string | Wid, id: string): Promise<MsgModel>;
63
+ getMessageById(chatId: string | Wid, ids: string[]): Promise<MsgModel[]>;
64
+ deleteMessage(chatId: string | Wid, id: string, deleteMediaInDevice: boolean, revoke: boolean): Promise<DeleteMessageReturn>;
65
+ deleteMessage(chatId: string | Wid, ids: string[], deleteMediaInDevice: boolean, revoke: boolean): Promise<DeleteMessageReturn[]>;
66
+ generateMessageID(chat: string | ChatModel | Wid): MsgKey;
67
+ prepareMessageButtons<T extends RawMessage>(message: T, options: MessageButtonsOptions): T;
68
+ prepareRawMessage<T extends RawMessage>(chat: ChatModel, message: T, options?: SendMessageOptions): Promise<T>;
69
+ sendRawMessage(chatId: any, rawMessage: RawMessage, options?: SendMessageOptions): Promise<SendMessageReturn>;
70
+ sendTextMessage(chatId: any, content: any, options?: TextMessageOptions): Promise<SendMessageReturn>;
69
71
  /**
70
72
  * Send a list message
71
73
  *
@@ -89,5 +91,69 @@ export declare class Chat extends Emittery<ChatEventTypes> {
89
91
  * });
90
92
  * ```
91
93
  */
92
- sendListMessage(chatId: any, options: ListMessageOptions): Promise<any>;
94
+ sendListMessage(chatId: any, options: ListMessageOptions): Promise<SendMessageReturn>;
95
+ protected convertToFile(data: string, mimetype?: string, filename?: string): Promise<File>;
96
+ /**
97
+ * Send a file message, that can be an audio, document, image or video
98
+ *
99
+ * @example
100
+ * ```javascript
101
+ * // Single document
102
+ * WPP.chat.sendFileMessage(
103
+ * '<number>@c.us', {
104
+ * 'data:image/jpeg;base64,<a long base64 file...>',
105
+ * {
106
+ * type: 'document',
107
+ * caption: 'My document', // Optional
108
+ * filename: 'myfile.doc', // Optional
109
+ * mimetype: 'application/msword' // Optional
110
+ * }
111
+ * });
112
+ *
113
+ * // Image with view once
114
+ * WPP.chat.sendFileMessage(
115
+ * '<number>@c.us', {
116
+ * 'data:image/jpeg;base64,<a long base64 file...>',
117
+ * {
118
+ * type: 'image',
119
+ * caption: 'My image', // Optional
120
+ * isViewOnce: true
121
+ * }
122
+ * });
123
+ *
124
+ * // PTT audio
125
+ * WPP.chat.sendFileMessage(
126
+ * '<number>@c.us', {
127
+ * 'data:audio/mp3;base64,<a long base64 file...>',
128
+ * {
129
+ * type: 'audio',
130
+ * isPtt: true // false for common audio
131
+ * }
132
+ * });
133
+ *
134
+ * // Image with view buttons
135
+ * WPP.chat.sendFileMessage(
136
+ * '<number>@c.us', {
137
+ * 'data:image/jpeg;base64,<a long base64 file...>',
138
+ * {
139
+ * type: 'image',
140
+ * caption: 'My image'
141
+ * buttons: [
142
+ * {
143
+ * id: 'your custom id 1',
144
+ * text: 'Some text'
145
+ * },
146
+ * {
147
+ * id: 'another id 2',
148
+ * text: 'Another text'
149
+ * }
150
+ * ],
151
+ * footer: 'Footer text' // Optional
152
+ * }
153
+ * });
154
+ * ```
155
+ *
156
+ * @return {SendMessageReturn} The result
157
+ */
158
+ sendFileMessage(chatId: any, content: any, options: AudioMessageOptions | DocumentMessageOptions | ImageMessageOptions | VideoMessageOptions): Promise<SendMessageReturn>;
93
159
  }
@@ -14,6 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { ModelPropertiesContructor, MsgKey, MsgModel, Wid } from '../whatsapp';
17
+ import { SendMsgResult } from '../whatsapp/enums';
17
18
  export interface ChatEventTypes {
18
19
  change: string;
19
20
  idle: undefined;
@@ -39,16 +40,81 @@ export interface GetMessagesOptions {
39
40
  direction?: 'after' | 'before';
40
41
  id?: string;
41
42
  }
43
+ export interface DeleteMessageReturn {
44
+ id: string;
45
+ sendMsgResult: Promise<SendMsgResult>;
46
+ isRevoked: boolean;
47
+ isDeleted: boolean;
48
+ }
42
49
  export interface SendMessageOptions {
43
- waitForAck?: boolean;
44
50
  createChat?: boolean;
51
+ /**
52
+ * Automatic detect and add the mentioned contacts with @<number>
53
+ *
54
+ * @example
55
+ * ```javascript
56
+ * WPP.chat.sendTextMessage('<number>@c.us', 'Hello @123 and @456', {
57
+ * detectMentioned: true
58
+ * });
59
+ * ```
60
+ */
61
+ detectMentioned?: boolean;
62
+ messageId?: string | MsgKey;
63
+ /**
64
+ * Define a mentioned list for a message
65
+ * This option work better with a message with mension
66
+ *
67
+ * @example
68
+ * ```javascript
69
+ * WPP.chat.sendTextMessage('<number>@c.us', 'Hello @123 and @456', {
70
+ * mentionedList: ['123@c.us', '456@c.us']
71
+ * })
72
+ * ```
73
+ */
74
+ mentionedList?: (string | Wid)[];
75
+ /**
76
+ * Quote a message, like a reply message
77
+ *
78
+ * @example
79
+ * ```javascript
80
+ * WPP.chat.sendTextMessage('<number>@c.us', 'This is a reply', {
81
+ * quotedMsg: 'true_<number>@c.us_3EB0F435D95D32C4C638'
82
+ * })
83
+ * ```
84
+ */
85
+ quotedMsg?: string | MsgKey | MsgModel;
86
+ /**
87
+ * Wait for send while the ACK of message is SENT(1)
88
+ *
89
+ * @example
90
+ * ```javascript
91
+ * WPP.chat.sendTextMessage('<number>@c.us', 'Wait for sent', {
92
+ * waitForAck: true
93
+ * })
94
+ * ```
95
+ */
96
+ waitForAck?: boolean;
97
+ }
98
+ export interface SendMessageReturn {
99
+ id: string;
100
+ ack: number;
101
+ sendMsgResult: Promise<SendMsgResult>;
45
102
  }
46
103
  export interface MessageButtonsOptions {
104
+ /**
105
+ * List of buttons, with at least 1 option and a maximum of 3
106
+ */
47
107
  buttons?: Array<{
48
108
  id: string;
49
109
  text: string;
50
110
  }>;
111
+ /**
112
+ * Title for buttons, only for text message
113
+ */
51
114
  title?: string;
115
+ /**
116
+ * Footer text for buttons
117
+ */
52
118
  footer?: string;
53
119
  }
54
120
  export interface ListMessageOptions extends SendMessageOptions {
@@ -64,5 +130,26 @@ export interface ListMessageOptions extends SendMessageOptions {
64
130
  }>;
65
131
  }
66
132
  export declare type TextMessageOptions = SendMessageOptions & MessageButtonsOptions;
133
+ export interface FileMessageOptions extends SendMessageOptions {
134
+ type: string;
135
+ caption?: string;
136
+ filename?: string;
137
+ mimetype?: string;
138
+ }
139
+ export interface AudioMessageOptions extends FileMessageOptions {
140
+ type: 'audio';
141
+ isPtt?: boolean;
142
+ }
143
+ export interface DocumentMessageOptions extends FileMessageOptions, MessageButtonsOptions {
144
+ type: 'document';
145
+ }
146
+ export interface ImageMessageOptions extends FileMessageOptions, MessageButtonsOptions {
147
+ type: 'image';
148
+ isViewOnce?: boolean;
149
+ }
150
+ export interface VideoMessageOptions extends FileMessageOptions, MessageButtonsOptions {
151
+ type: 'video';
152
+ isGif?: boolean;
153
+ }
67
154
  export declare type AllMessageOptions = SendMessageOptions & MessageButtonsOptions & Partial<ListMessageOptions>;
68
155
  export declare type RawMessage = ModelPropertiesContructor<MsgModel>;
@@ -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
+ import Emittery from 'emittery';
17
+ import { Wid } from '../whatsapp';
18
+ import { ContactEventTypes } from './types';
19
+ export declare class Contact extends Emittery<ContactEventTypes> {
20
+ constructor();
21
+ initialize(): Promise<void>;
22
+ queryExists(contactId: string | Wid): Promise<{
23
+ wid: Wid;
24
+ biz: boolean;
25
+ } | null>;
26
+ }
@@ -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
+ import { Contact } from './Contact';
17
+ export * from './Contact';
18
+ export * from './types';
19
+ declare const _default: Contact;
20
+ export default _default;
@@ -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
+ export interface ContactEventTypes {
17
+ idle: undefined;
18
+ }
@@ -13,9 +13,6 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- /**
17
- * @whatsapp 2.2136.10:57528
18
- */
19
16
  export declare enum TextFontStyle {
20
17
  SANS_SERIF = 0,
21
18
  SERIF = 1,
@@ -33,4 +33,13 @@ export declare class Group extends Emittery<GroupEventTypes> {
33
33
  removeParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
34
34
  promoteParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
35
35
  demoteParticipants(groupId: string | Wid, participantsIds: (string | Wid) | (string | Wid)[]): Promise<void>;
36
+ create(groupName: string, participantsIds: (string | Wid) | (string | Wid)[]): Promise<{
37
+ gid: Wid;
38
+ participants: {
39
+ [key: string]: {
40
+ code: string;
41
+ };
42
+ }[];
43
+ status: number;
44
+ }>;
36
45
  }
package/dist/index.d.ts CHANGED
@@ -24,6 +24,7 @@ export * as internal from './internal';
24
24
  export { default as auth } from './auth';
25
25
  export { default as blocklist } from './blocklist';
26
26
  export { default as chat } from './chat';
27
+ export { default as contact } from './contact';
27
28
  export { default as group } from './group';
28
29
  export { default as status } from './status';
29
30
  export * as whatsapp from './whatsapp';
@@ -16,5 +16,6 @@
16
16
  export * as auth from './auth';
17
17
  export * as blocklist from './blocklist';
18
18
  export * as chat from './chat';
19
+ export * as contact from './contact';
19
20
  export * as group from './group';
20
21
  export * as status from './status';
@@ -24,12 +24,7 @@ export declare class Status extends Emittery<StatusEventTypes> {
24
24
  initialize(): Promise<void>;
25
25
  get(chatId: string | Wid): StatusV3Model | undefined;
26
26
  getMyStatus(): Promise<StatusV3Model>;
27
- sendRawStatus(message: RawMessage, options?: SendStatusOptions): Promise<{
28
- id: string;
29
- ack: number | undefined;
30
- message: Promise<import("../whatsapp").MsgModel>;
31
- sendMsgResult: Promise<import("../whatsapp/enums").SendMsgResult>;
32
- }>;
27
+ sendRawStatus(message: RawMessage, options?: SendStatusOptions): Promise<import("../chat").SendMessageReturn>;
33
28
  /**
34
29
  * Send a text message to status stories
35
30
  *
@@ -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 { TextFontStyle } from '../whatsapp/enums';
16
+ import { TextFontStyle } from '../enums';
17
17
  export interface StatusEventTypes {
18
18
  sync: undefined;
19
19
  }
@@ -15,5 +15,7 @@
15
15
  */
16
16
  export declare class WPPError extends Error {
17
17
  readonly code: string;
18
- constructor(code: string, message: string);
18
+ constructor(code: string, message: string, extra?: {
19
+ [key: string]: any;
20
+ });
19
21
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { BlocklistModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:15701 */
18
+ /** @whatsapp 2.2144.8:15701 */
19
19
  export declare class BlocklistCollection extends Collection<BlocklistModel> {
20
20
  static model: BlocklistModel;
21
21
  blockContact(e?: any): any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { BusinessCategoriesResultModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:54100 */
18
+ /** @whatsapp 2.2144.8:54100 */
19
19
  export declare class BusinessCategoriesResultCollection extends Collection<BusinessCategoriesResultModel> {
20
20
  static model: BusinessCategoriesResultModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { BusinessProfileModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:8581 */
18
+ /** @whatsapp 2.2144.8:8581 */
19
19
  export declare class BusinessProfileCollection extends Collection<BusinessProfileModel> {
20
20
  static model: BusinessProfileModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ReplyButtonModel } from '../models';
17
17
  import { CollectionCache } from './CollectionCache';
18
- /** @whatsapp 2.2140.7:84142 */
18
+ /** @whatsapp 2.2144.8:84142 */
19
19
  export declare class ButtonCollection extends CollectionCache<ReplyButtonModel> {
20
20
  static model: ReplyButtonModel;
21
21
  static comparator(): any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { CallModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:15971 */
18
+ /** @whatsapp 2.2144.8:15971 */
19
19
  export declare class CallCollection extends Collection<CallModel> {
20
20
  static model: CallModel;
21
21
  pendingOffers?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { CartModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:25523 */
18
+ /** @whatsapp 2.2144.8:25523 */
19
19
  export declare class CartCollection extends Collection<CartModel> {
20
20
  static model: CartModel;
21
21
  static cachePolicy?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { CartItemModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:29844 */
18
+ /** @whatsapp 2.2144.8:29844 */
19
19
  export declare class CartItemCollection extends Collection<CartItemModel> {
20
20
  static model: CartItemModel;
21
21
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { CatalogModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:60028 */
18
+ /** @whatsapp 2.2144.8:60028 */
19
19
  export declare class CatalogCollection extends Collection<CatalogModel> {
20
20
  static model: CatalogModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ChatModel } from '../models';
17
17
  import { CollectionCache } from './CollectionCache';
18
- /** @whatsapp 2.2140.7:84758 */
18
+ /** @whatsapp 2.2144.8:84758 */
19
19
  export declare class ChatCollection extends CollectionCache<ChatModel> {
20
20
  static model: ChatModel;
21
21
  static comparator(): any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ChatstateModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:42165 */
18
+ /** @whatsapp 2.2144.8:42165 */
19
19
  export declare class ChatstateCollection extends Collection<ChatstateModel> {
20
20
  static model: ChatstateModel;
21
21
  }
@@ -13,16 +13,17 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { EventEmitter, Stringable } from '../misc';
16
+ import { Stringable } from '../../types';
17
+ import { EventEmitter } from '../misc';
17
18
  interface Option {
18
19
  add: boolean;
19
20
  merge: boolean;
20
21
  remove: boolean;
21
22
  }
22
- /** @whatsapp 2.2140.7:85392 */
23
+ /** @whatsapp 2.2144.8:85392 */
23
24
  export declare interface Collection<M> extends EventEmitter, Pick<Array<M>, 'indexOf' | 'lastIndexOf' | 'every' | 'some' | 'forEach' | 'map' | 'filter' | 'reduce' | 'slice'> {
24
25
  }
25
- /** @whatsapp 2.2140.7:85392 */
26
+ /** @whatsapp 2.2144.8:85392 */
26
27
  export declare class Collection<M, A = M | M[]> extends EventEmitter {
27
28
  static model: any;
28
29
  static comparator: (a: any, b: any) => number;
@@ -13,9 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { Stringable } from '../misc';
16
+ import { Stringable } from '../../types';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:36513 */
18
+ /** @whatsapp 2.2144.8:36513 */
19
19
  export declare class CollectionCache<C, A = C | C[]> extends Collection<C> {
20
20
  static cachePolicy: {
21
21
  id: string;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ContactModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:17025 */
18
+ /** @whatsapp 2.2144.8:17025 */
19
19
  export declare class ContactCollection extends Collection<ContactModel> {
20
20
  static model: ContactModel;
21
21
  static cachePolicy?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { EmojiVariantModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:41098 */
18
+ /** @whatsapp 2.2144.8:41098 */
19
19
  export declare class EmojiVariantCollection extends Collection<EmojiVariantModel> {
20
20
  static model: EmojiVariantModel;
21
21
  static cachePolicy?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { GroupMetadataModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:75798 */
18
+ /** @whatsapp 2.2144.8:75798 */
19
19
  export declare class GroupMetadataCollection extends Collection<GroupMetadataModel> {
20
20
  static model: GroupMetadataModel;
21
21
  static cachePolicy?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { ChatModel, LabelModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:59606 */
18
+ /** @whatsapp 2.2144.8:59606 */
19
19
  export declare class LabelCollection extends Collection<LabelModel> {
20
20
  static model: LabelModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { LabelItemModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:42745 */
18
+ /** @whatsapp 2.2144.8:42745 */
19
19
  export declare class LabelItemCollection extends Collection<LabelItemModel> {
20
20
  static model: LabelItemModel;
21
21
  }
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { LiveLocationModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:31104 */
18
+ /** @whatsapp 2.2144.8:31104 */
19
19
  export declare class LiveLocationCollection extends Collection<LiveLocationModel> {
20
20
  static model: LiveLocationModel;
21
21
  static staleCollection?: any;
@@ -16,7 +16,7 @@
16
16
  import { Wid } from '..';
17
17
  import { ModelPropertiesContructor, MsgModel } from '../models';
18
18
  import { CollectionCache } from './CollectionCache';
19
- /** @whatsapp 2.2140.7:45472 */
19
+ /** @whatsapp 2.2144.8:45472 */
20
20
  export declare class MsgCollection extends CollectionCache<MsgModel> {
21
21
  static model: MsgModel;
22
22
  lastReceivedReceipt?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { MsgInfoModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:57636 */
18
+ /** @whatsapp 2.2144.8:57636 */
19
19
  export declare class MsgInfoCollection extends Collection<MsgInfoModel> {
20
20
  static model: MsgInfoModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { MuteModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:80959 */
18
+ /** @whatsapp 2.2144.8:80959 */
19
19
  export declare class MuteCollection extends Collection<MuteModel> {
20
20
  static model: MuteModel;
21
21
  static cachePolicy?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { OrderModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:98052 */
18
+ /** @whatsapp 2.2144.8:98052 */
19
19
  export declare class OrderCollection extends Collection<OrderModel> {
20
20
  static model: OrderModel;
21
21
  static staleCollection?: any;
@@ -15,7 +15,7 @@
15
15
  */
16
16
  import { OrderItemModel } from '../models';
17
17
  import { Collection } from './Collection';
18
- /** @whatsapp 2.2140.7:2414 */
18
+ /** @whatsapp 2.2144.8:2414 */
19
19
  export declare class OrderItemCollection extends Collection<OrderItemModel> {
20
20
  static model: OrderItemModel;
21
21
  }