queenruva-sockets 5.6.23

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 (205) hide show
  1. package/LICENSE +31 -0
  2. package/README.md +1082 -0
  3. package/WAProto/GenerateStatics.sh +3 -0
  4. package/WAProto/WAProto.proto +5479 -0
  5. package/WAProto/fix-imports.js +85 -0
  6. package/WAProto/index.d.ts +14017 -0
  7. package/WAProto/index.js +97691 -0
  8. package/engine-requirements.js +11 -0
  9. package/lib/Defaults/index.d.ts +75 -0
  10. package/lib/Defaults/index.js +129 -0
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/ciphertext-message.js +12 -0
  13. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  14. package/lib/Signal/Group/group-session-builder.js +30 -0
  15. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  16. package/lib/Signal/Group/group_cipher.js +82 -0
  17. package/lib/Signal/Group/index.d.ts +12 -0
  18. package/lib/Signal/Group/index.js +12 -0
  19. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  20. package/lib/Signal/Group/keyhelper.js +18 -0
  21. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  22. package/lib/Signal/Group/sender-chain-key.js +26 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  24. package/lib/Signal/Group/sender-key-distribution-message.js +63 -0
  25. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  26. package/lib/Signal/Group/sender-key-message.js +66 -0
  27. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  28. package/lib/Signal/Group/sender-key-name.js +48 -0
  29. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  30. package/lib/Signal/Group/sender-key-record.js +41 -0
  31. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  32. package/lib/Signal/Group/sender-key-state.js +84 -0
  33. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  34. package/lib/Signal/Group/sender-message-key.js +26 -0
  35. package/lib/Signal/libsignal.d.ts +5 -0
  36. package/lib/Signal/libsignal.js +431 -0
  37. package/lib/Signal/lid-mapping.d.ts +23 -0
  38. package/lib/Signal/lid-mapping.js +277 -0
  39. package/lib/Socket/Client/index.d.ts +3 -0
  40. package/lib/Socket/Client/index.js +3 -0
  41. package/lib/Socket/Client/types.d.ts +16 -0
  42. package/lib/Socket/Client/types.js +11 -0
  43. package/lib/Socket/Client/websocket.d.ts +13 -0
  44. package/lib/Socket/Client/websocket.js +54 -0
  45. package/lib/Socket/business.d.ts +217 -0
  46. package/lib/Socket/business.js +379 -0
  47. package/lib/Socket/chats.d.ts +124 -0
  48. package/lib/Socket/chats.js +1193 -0
  49. package/lib/Socket/communities.d.ts +273 -0
  50. package/lib/Socket/communities.js +431 -0
  51. package/lib/Socket/groups.d.ts +161 -0
  52. package/lib/Socket/groups.js +347 -0
  53. package/lib/Socket/index.d.ts +260 -0
  54. package/lib/Socket/index.js +12 -0
  55. package/lib/Socket/messages-recv.d.ts +203 -0
  56. package/lib/Socket/messages-recv.js +1772 -0
  57. package/lib/Socket/messages-send.d.ts +199 -0
  58. package/lib/Socket/messages-send.js +1160 -0
  59. package/lib/Socket/mex.d.ts +3 -0
  60. package/lib/Socket/mex.js +42 -0
  61. package/lib/Socket/newsletter.d.ts +170 -0
  62. package/lib/Socket/newsletter.js +181 -0
  63. package/lib/Socket/socket.d.ts +59 -0
  64. package/lib/Socket/socket.js +1029 -0
  65. package/lib/Types/Auth.d.ts +117 -0
  66. package/lib/Types/Auth.js +2 -0
  67. package/lib/Types/Bussines.d.ts +25 -0
  68. package/lib/Types/Bussines.js +2 -0
  69. package/lib/Types/Call.d.ts +15 -0
  70. package/lib/Types/Call.js +2 -0
  71. package/lib/Types/Chat.d.ts +124 -0
  72. package/lib/Types/Chat.js +8 -0
  73. package/lib/Types/Contact.d.ts +26 -0
  74. package/lib/Types/Contact.js +2 -0
  75. package/lib/Types/Events.d.ts +256 -0
  76. package/lib/Types/Events.js +2 -0
  77. package/lib/Types/GroupMetadata.d.ts +71 -0
  78. package/lib/Types/GroupMetadata.js +2 -0
  79. package/lib/Types/Label.d.ts +47 -0
  80. package/lib/Types/Label.js +25 -0
  81. package/lib/Types/LabelAssociation.d.ts +30 -0
  82. package/lib/Types/LabelAssociation.js +7 -0
  83. package/lib/Types/Message.d.ts +320 -0
  84. package/lib/Types/Message.js +11 -0
  85. package/lib/Types/Mex.d.ts +141 -0
  86. package/lib/Types/Mex.js +37 -0
  87. package/lib/Types/Product.d.ts +79 -0
  88. package/lib/Types/Product.js +2 -0
  89. package/lib/Types/Signal.d.ts +87 -0
  90. package/lib/Types/Signal.js +2 -0
  91. package/lib/Types/Socket.d.ts +136 -0
  92. package/lib/Types/Socket.js +3 -0
  93. package/lib/Types/State.d.ts +97 -0
  94. package/lib/Types/State.js +56 -0
  95. package/lib/Types/USync.d.ts +26 -0
  96. package/lib/Types/USync.js +2 -0
  97. package/lib/Types/index.d.ts +65 -0
  98. package/lib/Types/index.js +26 -0
  99. package/lib/Utils/auth-utils.d.ts +24 -0
  100. package/lib/Utils/auth-utils.js +302 -0
  101. package/lib/Utils/browser-utils.d.ts +4 -0
  102. package/lib/Utils/browser-utils.js +28 -0
  103. package/lib/Utils/business.d.ts +23 -0
  104. package/lib/Utils/business.js +231 -0
  105. package/lib/Utils/chat-utils.d.ts +100 -0
  106. package/lib/Utils/chat-utils.js +872 -0
  107. package/lib/Utils/companion-reg-client-utils.d.ts +17 -0
  108. package/lib/Utils/companion-reg-client-utils.js +35 -0
  109. package/lib/Utils/crypto.d.ts +37 -0
  110. package/lib/Utils/crypto.js +118 -0
  111. package/lib/Utils/decode-wa-message.d.ts +66 -0
  112. package/lib/Utils/decode-wa-message.js +311 -0
  113. package/lib/Utils/event-buffer.d.ts +36 -0
  114. package/lib/Utils/event-buffer.js +622 -0
  115. package/lib/Utils/generics.d.ts +91 -0
  116. package/lib/Utils/generics.js +378 -0
  117. package/lib/Utils/history.d.ts +24 -0
  118. package/lib/Utils/history.js +134 -0
  119. package/lib/Utils/identity-change-handler.d.ts +44 -0
  120. package/lib/Utils/identity-change-handler.js +50 -0
  121. package/lib/Utils/index.d.ts +22 -0
  122. package/lib/Utils/index.js +22 -0
  123. package/lib/Utils/link-preview.d.ts +21 -0
  124. package/lib/Utils/link-preview.js +85 -0
  125. package/lib/Utils/logger.d.ts +12 -0
  126. package/lib/Utils/logger.js +3 -0
  127. package/lib/Utils/lt-hash.d.ts +8 -0
  128. package/lib/Utils/lt-hash.js +8 -0
  129. package/lib/Utils/make-mutex.d.ts +9 -0
  130. package/lib/Utils/make-mutex.js +33 -0
  131. package/lib/Utils/message-retry-manager.d.ts +115 -0
  132. package/lib/Utils/message-retry-manager.js +265 -0
  133. package/lib/Utils/messages-media.d.ts +133 -0
  134. package/lib/Utils/messages-media.js +786 -0
  135. package/lib/Utils/messages.d.ts +91 -0
  136. package/lib/Utils/messages.js +893 -0
  137. package/lib/Utils/noise-handler.d.ts +20 -0
  138. package/lib/Utils/noise-handler.js +201 -0
  139. package/lib/Utils/offline-node-processor.d.ts +17 -0
  140. package/lib/Utils/offline-node-processor.js +40 -0
  141. package/lib/Utils/pre-key-manager.d.ts +28 -0
  142. package/lib/Utils/pre-key-manager.js +106 -0
  143. package/lib/Utils/process-message.d.ts +60 -0
  144. package/lib/Utils/process-message.js +597 -0
  145. package/lib/Utils/reporting-utils.d.ts +11 -0
  146. package/lib/Utils/reporting-utils.js +258 -0
  147. package/lib/Utils/signal.d.ts +47 -0
  148. package/lib/Utils/signal.js +201 -0
  149. package/lib/Utils/stanza-ack.d.ts +11 -0
  150. package/lib/Utils/stanza-ack.js +38 -0
  151. package/lib/Utils/sync-action-utils.d.ts +19 -0
  152. package/lib/Utils/sync-action-utils.js +49 -0
  153. package/lib/Utils/tc-token-utils.d.ts +37 -0
  154. package/lib/Utils/tc-token-utils.js +163 -0
  155. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  156. package/lib/Utils/use-multi-file-auth-state.js +121 -0
  157. package/lib/Utils/validate-connection.d.ts +11 -0
  158. package/lib/Utils/validate-connection.js +203 -0
  159. package/lib/WABinary/constants.d.ts +28 -0
  160. package/lib/WABinary/constants.js +1301 -0
  161. package/lib/WABinary/decode.d.ts +7 -0
  162. package/lib/WABinary/decode.js +262 -0
  163. package/lib/WABinary/encode.d.ts +3 -0
  164. package/lib/WABinary/encode.js +220 -0
  165. package/lib/WABinary/generic-utils.d.ts +15 -0
  166. package/lib/WABinary/generic-utils.js +113 -0
  167. package/lib/WABinary/index.d.ts +6 -0
  168. package/lib/WABinary/index.js +6 -0
  169. package/lib/WABinary/jid-utils.d.ts +48 -0
  170. package/lib/WABinary/jid-utils.js +96 -0
  171. package/lib/WABinary/types.d.ts +19 -0
  172. package/lib/WABinary/types.js +2 -0
  173. package/lib/WAM/BinaryInfo.d.ts +9 -0
  174. package/lib/WAM/BinaryInfo.js +10 -0
  175. package/lib/WAM/constants.d.ts +40 -0
  176. package/lib/WAM/constants.js +22853 -0
  177. package/lib/WAM/encode.d.ts +3 -0
  178. package/lib/WAM/encode.js +150 -0
  179. package/lib/WAM/index.d.ts +4 -0
  180. package/lib/WAM/index.js +4 -0
  181. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  182. package/lib/WAUSync/Protocols/USyncContactProtocol.js +52 -0
  183. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  184. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +54 -0
  185. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  186. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +27 -0
  187. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  188. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +38 -0
  189. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +10 -0
  190. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +25 -0
  191. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  192. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +51 -0
  193. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  194. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +29 -0
  195. package/lib/WAUSync/Protocols/index.d.ts +6 -0
  196. package/lib/WAUSync/Protocols/index.js +6 -0
  197. package/lib/WAUSync/USyncQuery.d.ts +30 -0
  198. package/lib/WAUSync/USyncQuery.js +98 -0
  199. package/lib/WAUSync/USyncUser.d.ts +17 -0
  200. package/lib/WAUSync/USyncUser.js +31 -0
  201. package/lib/WAUSync/index.d.ts +4 -0
  202. package/lib/WAUSync/index.js +4 -0
  203. package/lib/index.d.ts +12 -0
  204. package/lib/index.js +11 -0
  205. package/package.json +160 -0
@@ -0,0 +1,379 @@
1
+ import { getRawMediaUploadData } from '../Utils/index.js';
2
+ import { parseCatalogNode, parseCollectionsNode, parseOrderDetailsNode, parseProductNode, toProductNode, uploadingNecessaryImagesOfProduct } from '../Utils/business.js';
3
+ import { jidNormalizedUser, S_WHATSAPP_NET } from '../WABinary/index.js';
4
+ import { getBinaryNodeChild } from '../WABinary/generic-utils.js';
5
+ import { makeMessagesRecvSocket } from './messages-recv.js';
6
+ export const makeBusinessSocket = (config) => {
7
+ const sock = makeMessagesRecvSocket(config);
8
+ const { authState, query, waUploadToServer } = sock;
9
+ const updateBussinesProfile = async (args) => {
10
+ const node = [];
11
+ const simpleFields = ['address', 'email', 'description'];
12
+ node.push(...simpleFields
13
+ .filter(key => args[key] !== undefined && args[key] !== null)
14
+ .map(key => ({
15
+ tag: key,
16
+ attrs: {},
17
+ content: args[key]
18
+ })));
19
+ if (args.websites !== undefined) {
20
+ node.push(...args.websites.map(website => ({
21
+ tag: 'website',
22
+ attrs: {},
23
+ content: website
24
+ })));
25
+ }
26
+ if (args.hours !== undefined) {
27
+ node.push({
28
+ tag: 'business_hours',
29
+ attrs: { timezone: args.hours.timezone },
30
+ content: args.hours.days.map(dayConfig => {
31
+ const base = {
32
+ tag: 'business_hours_config',
33
+ attrs: {
34
+ day_of_week: dayConfig.day,
35
+ mode: dayConfig.mode
36
+ }
37
+ };
38
+ if (dayConfig.mode === 'specific_hours') {
39
+ return {
40
+ ...base,
41
+ attrs: {
42
+ ...base.attrs,
43
+ open_time: dayConfig.openTimeInMinutes,
44
+ close_time: dayConfig.closeTimeInMinutes
45
+ }
46
+ };
47
+ }
48
+ return base;
49
+ })
50
+ });
51
+ }
52
+ const result = await query({
53
+ tag: 'iq',
54
+ attrs: {
55
+ to: S_WHATSAPP_NET,
56
+ type: 'set',
57
+ xmlns: 'w:biz'
58
+ },
59
+ content: [
60
+ {
61
+ tag: 'business_profile',
62
+ attrs: {
63
+ v: '3',
64
+ mutation_type: 'delta'
65
+ },
66
+ content: node
67
+ }
68
+ ]
69
+ });
70
+ return result;
71
+ };
72
+ const updateCoverPhoto = async (photo) => {
73
+ const { fileSha256, filePath } = await getRawMediaUploadData(photo, 'biz-cover-photo');
74
+ const fileSha256B64 = fileSha256.toString('base64');
75
+ const { meta_hmac, fbid, ts } = await waUploadToServer(filePath, {
76
+ fileEncSha256B64: fileSha256B64,
77
+ mediaType: 'biz-cover-photo'
78
+ });
79
+ await query({
80
+ tag: 'iq',
81
+ attrs: {
82
+ to: S_WHATSAPP_NET,
83
+ type: 'set',
84
+ xmlns: 'w:biz'
85
+ },
86
+ content: [
87
+ {
88
+ tag: 'business_profile',
89
+ attrs: {
90
+ v: '3',
91
+ mutation_type: 'delta'
92
+ },
93
+ content: [
94
+ {
95
+ tag: 'cover_photo',
96
+ attrs: { id: String(fbid), op: 'update', token: meta_hmac, ts: String(ts) }
97
+ }
98
+ ]
99
+ }
100
+ ]
101
+ });
102
+ return fbid;
103
+ };
104
+ const removeCoverPhoto = async (id) => {
105
+ return await query({
106
+ tag: 'iq',
107
+ attrs: {
108
+ to: S_WHATSAPP_NET,
109
+ type: 'set',
110
+ xmlns: 'w:biz'
111
+ },
112
+ content: [
113
+ {
114
+ tag: 'business_profile',
115
+ attrs: {
116
+ v: '3',
117
+ mutation_type: 'delta'
118
+ },
119
+ content: [
120
+ {
121
+ tag: 'cover_photo',
122
+ attrs: { op: 'delete', id }
123
+ }
124
+ ]
125
+ }
126
+ ]
127
+ });
128
+ };
129
+ const getCatalog = async ({ jid, limit, cursor }) => {
130
+ jid = jid || authState.creds.me?.id;
131
+ jid = jidNormalizedUser(jid);
132
+ const queryParamNodes = [
133
+ {
134
+ tag: 'limit',
135
+ attrs: {},
136
+ content: Buffer.from((limit || 10).toString())
137
+ },
138
+ {
139
+ tag: 'width',
140
+ attrs: {},
141
+ content: Buffer.from('100')
142
+ },
143
+ {
144
+ tag: 'height',
145
+ attrs: {},
146
+ content: Buffer.from('100')
147
+ }
148
+ ];
149
+ if (cursor) {
150
+ queryParamNodes.push({
151
+ tag: 'after',
152
+ attrs: {},
153
+ content: cursor
154
+ });
155
+ }
156
+ const result = await query({
157
+ tag: 'iq',
158
+ attrs: {
159
+ to: S_WHATSAPP_NET,
160
+ type: 'get',
161
+ xmlns: 'w:biz:catalog'
162
+ },
163
+ content: [
164
+ {
165
+ tag: 'product_catalog',
166
+ attrs: {
167
+ jid,
168
+ allow_shop_source: 'true'
169
+ },
170
+ content: queryParamNodes
171
+ }
172
+ ]
173
+ });
174
+ return parseCatalogNode(result);
175
+ };
176
+ const getCollections = async (jid, limit = 51) => {
177
+ jid = jid || authState.creds.me?.id;
178
+ jid = jidNormalizedUser(jid);
179
+ const result = await query({
180
+ tag: 'iq',
181
+ attrs: {
182
+ to: S_WHATSAPP_NET,
183
+ type: 'get',
184
+ xmlns: 'w:biz:catalog',
185
+ smax_id: '35'
186
+ },
187
+ content: [
188
+ {
189
+ tag: 'collections',
190
+ attrs: {
191
+ biz_jid: jid
192
+ },
193
+ content: [
194
+ {
195
+ tag: 'collection_limit',
196
+ attrs: {},
197
+ content: Buffer.from(limit.toString())
198
+ },
199
+ {
200
+ tag: 'item_limit',
201
+ attrs: {},
202
+ content: Buffer.from(limit.toString())
203
+ },
204
+ {
205
+ tag: 'width',
206
+ attrs: {},
207
+ content: Buffer.from('100')
208
+ },
209
+ {
210
+ tag: 'height',
211
+ attrs: {},
212
+ content: Buffer.from('100')
213
+ }
214
+ ]
215
+ }
216
+ ]
217
+ });
218
+ return parseCollectionsNode(result);
219
+ };
220
+ const getOrderDetails = async (orderId, tokenBase64) => {
221
+ const result = await query({
222
+ tag: 'iq',
223
+ attrs: {
224
+ to: S_WHATSAPP_NET,
225
+ type: 'get',
226
+ xmlns: 'fb:thrift_iq',
227
+ smax_id: '5'
228
+ },
229
+ content: [
230
+ {
231
+ tag: 'order',
232
+ attrs: {
233
+ op: 'get',
234
+ id: orderId
235
+ },
236
+ content: [
237
+ {
238
+ tag: 'image_dimensions',
239
+ attrs: {},
240
+ content: [
241
+ {
242
+ tag: 'width',
243
+ attrs: {},
244
+ content: Buffer.from('100')
245
+ },
246
+ {
247
+ tag: 'height',
248
+ attrs: {},
249
+ content: Buffer.from('100')
250
+ }
251
+ ]
252
+ },
253
+ {
254
+ tag: 'token',
255
+ attrs: {},
256
+ content: Buffer.from(tokenBase64)
257
+ }
258
+ ]
259
+ }
260
+ ]
261
+ });
262
+ return parseOrderDetailsNode(result);
263
+ };
264
+ const productUpdate = async (productId, update) => {
265
+ update = await uploadingNecessaryImagesOfProduct(update, waUploadToServer);
266
+ const editNode = toProductNode(productId, update);
267
+ const result = await query({
268
+ tag: 'iq',
269
+ attrs: {
270
+ to: S_WHATSAPP_NET,
271
+ type: 'set',
272
+ xmlns: 'w:biz:catalog'
273
+ },
274
+ content: [
275
+ {
276
+ tag: 'product_catalog_edit',
277
+ attrs: { v: '1' },
278
+ content: [
279
+ editNode,
280
+ {
281
+ tag: 'width',
282
+ attrs: {},
283
+ content: '100'
284
+ },
285
+ {
286
+ tag: 'height',
287
+ attrs: {},
288
+ content: '100'
289
+ }
290
+ ]
291
+ }
292
+ ]
293
+ });
294
+ const productCatalogEditNode = getBinaryNodeChild(result, 'product_catalog_edit');
295
+ const productNode = getBinaryNodeChild(productCatalogEditNode, 'product');
296
+ return parseProductNode(productNode);
297
+ };
298
+ const productCreate = async (create) => {
299
+ // ensure isHidden is defined
300
+ create.isHidden = !!create.isHidden;
301
+ create = await uploadingNecessaryImagesOfProduct(create, waUploadToServer);
302
+ const createNode = toProductNode(undefined, create);
303
+ const result = await query({
304
+ tag: 'iq',
305
+ attrs: {
306
+ to: S_WHATSAPP_NET,
307
+ type: 'set',
308
+ xmlns: 'w:biz:catalog'
309
+ },
310
+ content: [
311
+ {
312
+ tag: 'product_catalog_add',
313
+ attrs: { v: '1' },
314
+ content: [
315
+ createNode,
316
+ {
317
+ tag: 'width',
318
+ attrs: {},
319
+ content: '100'
320
+ },
321
+ {
322
+ tag: 'height',
323
+ attrs: {},
324
+ content: '100'
325
+ }
326
+ ]
327
+ }
328
+ ]
329
+ });
330
+ const productCatalogAddNode = getBinaryNodeChild(result, 'product_catalog_add');
331
+ const productNode = getBinaryNodeChild(productCatalogAddNode, 'product');
332
+ return parseProductNode(productNode);
333
+ };
334
+ const productDelete = async (productIds) => {
335
+ const result = await query({
336
+ tag: 'iq',
337
+ attrs: {
338
+ to: S_WHATSAPP_NET,
339
+ type: 'set',
340
+ xmlns: 'w:biz:catalog'
341
+ },
342
+ content: [
343
+ {
344
+ tag: 'product_catalog_delete',
345
+ attrs: { v: '1' },
346
+ content: productIds.map(id => ({
347
+ tag: 'product',
348
+ attrs: {},
349
+ content: [
350
+ {
351
+ tag: 'id',
352
+ attrs: {},
353
+ content: Buffer.from(id)
354
+ }
355
+ ]
356
+ }))
357
+ }
358
+ ]
359
+ });
360
+ const productCatalogDelNode = getBinaryNodeChild(result, 'product_catalog_delete');
361
+ return {
362
+ deleted: +(productCatalogDelNode?.attrs.deleted_count || 0)
363
+ };
364
+ };
365
+ return {
366
+ ...sock,
367
+ logger: config.logger,
368
+ getOrderDetails,
369
+ getCatalog,
370
+ getCollections,
371
+ productCreate,
372
+ productDelete,
373
+ productUpdate,
374
+ updateBussinesProfile,
375
+ updateCoverPhoto,
376
+ removeCoverPhoto
377
+ };
378
+ };
379
+ //# sourceMappingURL=business.js.map
@@ -0,0 +1,124 @@
1
+ import { Boom } from '@hapi/boom';
2
+ import { proto } from '../../WAProto/index.js';
3
+ import type { BotListInfo, CacheStore, ChatModification, MessageUpsertType, SocketConfig, WABusinessProfile, WAMediaUpload, WAMessage, WAPatchCreate, WAPresence, WAPrivacyCallValue, WAPrivacyGroupAddValue, WAPrivacyMessagesValue, WAPrivacyOnlineValue, WAPrivacyValue, WAReadReceiptsValue } from '../Types/index.js';
4
+ import type { QuickReplyAction } from '../Types/Bussines.js';
5
+ import type { LabelActionBody } from '../Types/Label.js';
6
+ import { type BinaryNode } from '../WABinary/index.js';
7
+ import { USyncQuery } from '../WAUSync/index.js';
8
+ export declare const makeChatsSocket: (config: SocketConfig) => {
9
+ serverProps: {
10
+ /** AB prop 10518: gate tctoken on 1:1 messages. Default true (safe: avoids 463). */
11
+ privacyTokenOn1to1: boolean;
12
+ /** AB prop 9666: gate tctoken on profile picture IQs. WA Web default: true. */
13
+ profilePicPrivacyToken: boolean;
14
+ /** AB prop 14303: issue tctokens to LID instead of PN. WA Web default: false. */
15
+ lidTrustedTokenIssueToLid: boolean;
16
+ };
17
+ createCallLink: (type: "audio" | "video", event?: {
18
+ startTime: number;
19
+ }, timeoutMs?: number) => Promise<string | undefined>;
20
+ getBotListV2: () => Promise<BotListInfo[]>;
21
+ messageMutex: {
22
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
23
+ };
24
+ receiptMutex: {
25
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
26
+ };
27
+ appStatePatchMutex: {
28
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
29
+ };
30
+ notificationMutex: {
31
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
32
+ };
33
+ fetchPrivacySettings: (force?: boolean) => Promise<{
34
+ [_: string]: string;
35
+ }>;
36
+ upsertMessage: (msg: WAMessage, type: MessageUpsertType) => Promise<void>;
37
+ appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
38
+ sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
39
+ presenceSubscribe: (toJid: string) => Promise<void>;
40
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
41
+ fetchBlocklist: () => Promise<(string | undefined)[]>;
42
+ fetchStatus: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
43
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
44
+ updateProfilePicture: (jid: string, content: WAMediaUpload, dimensions?: {
45
+ width: number;
46
+ height: number;
47
+ }) => Promise<void>;
48
+ removeProfilePicture: (jid: string) => Promise<void>;
49
+ updateProfileStatus: (status: string) => Promise<void>;
50
+ updateProfileName: (name: string) => Promise<void>;
51
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
52
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
53
+ updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>;
54
+ updateMessagesPrivacy: (value: WAPrivacyMessagesValue) => Promise<void>;
55
+ updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>;
56
+ updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>;
57
+ updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>;
58
+ updateStatusPrivacy: (value: WAPrivacyValue) => Promise<void>;
59
+ updateReadReceiptsPrivacy: (value: WAReadReceiptsValue) => Promise<void>;
60
+ updateGroupsAddPrivacy: (value: WAPrivacyGroupAddValue) => Promise<void>;
61
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>;
62
+ getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
63
+ resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
64
+ chatModify: (mod: ChatModification, jid: string) => Promise<void>;
65
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
66
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
67
+ removeContact: (jid: string) => Promise<void>;
68
+ placeholderResendCache: CacheStore;
69
+ addLabel: (jid: string, labels: LabelActionBody) => Promise<void>;
70
+ addChatLabel: (jid: string, labelId: string) => Promise<void>;
71
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>;
72
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
73
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
74
+ star: (jid: string, messages: {
75
+ id: string;
76
+ fromMe?: boolean;
77
+ }[], star: boolean) => Promise<void>;
78
+ addOrEditQuickReply: (quickReply: QuickReplyAction) => Promise<void>;
79
+ removeQuickReply: (timestamp: string) => Promise<void>;
80
+ type: "md";
81
+ ws: import("./Client/websocket.js").WebSocketClient;
82
+ ev: import("../Types/index.js").BaileysEventEmitter & {
83
+ process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
84
+ buffer(): void;
85
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
86
+ flush(): boolean;
87
+ isBuffering(): boolean;
88
+ destroy(): void;
89
+ };
90
+ authState: {
91
+ creds: import("../Types/index.js").AuthenticationCreds;
92
+ keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
93
+ };
94
+ signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
95
+ user: import("../Types/index.js").Contact | undefined;
96
+ generateMessageTag: () => string;
97
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
98
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
99
+ waitForSocketOpen: () => Promise<void>;
100
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
101
+ sendNode: (frame: BinaryNode) => Promise<void>;
102
+ logout: (msg?: string) => Promise<void>;
103
+ end: (error: Error | undefined) => Promise<void>;
104
+ registerSocketEndHandler: (handler: (error: Error | undefined) => void | Promise<void>) => void;
105
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
106
+ uploadPreKeys: (count?: number) => Promise<void>;
107
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
108
+ digestKeyBundle: () => Promise<void>;
109
+ rotateSignedPreKey: () => Promise<void>;
110
+ requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
111
+ updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
112
+ sendUnifiedSession: () => Promise<void>;
113
+ wamBuffer: import("../index.js").BinaryInfo;
114
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
115
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
116
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync/index.js").USyncQueryResult | undefined>;
117
+ onWhatsApp: (...phoneNumber: string[]) => Promise<{
118
+ jid: string;
119
+ exists: boolean;
120
+ }[] | undefined>;
121
+ fetchAccountReachoutTimelock: () => Promise<import("../Types/index.js").ReachoutTimelockState>;
122
+ fetchNewChatMessageCap: () => Promise<import("../Types/index.js").NewChatMessageCapInfo>;
123
+ };
124
+ //# sourceMappingURL=chats.d.ts.map