jagproject 26.3.22 → 26.3.25

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 (206) hide show
  1. package/WAProto/GenerateStatics.sh +3 -4
  2. package/WAProto/WAProto.proto +1215 -511
  3. package/WAProto/fix-imports.js +73 -0
  4. package/WAProto/index.d.ts +14017 -0
  5. package/WAProto/index.js +64857 -145167
  6. package/engine-requirements.js +4 -7
  7. package/lib/Defaults/index.d.ts +74 -0
  8. package/lib/Defaults/index.js +51 -33
  9. package/lib/Defaults/phonenumber-mcc.json +223 -0
  10. package/lib/Defaults/wileys-version.json +2 -2
  11. package/lib/Signal/Group/ciphertext-message.d.ts +10 -0
  12. package/lib/Signal/Group/group-session-builder.d.ts +15 -0
  13. package/lib/Signal/Group/group-session-builder.js +5 -3
  14. package/lib/Signal/Group/group_cipher.d.ts +17 -0
  15. package/lib/Signal/Group/group_cipher.js +35 -46
  16. package/lib/Signal/Group/index.d.ts +12 -0
  17. package/lib/Signal/Group/index.js +21 -21
  18. package/lib/Signal/Group/keyhelper.d.ts +11 -0
  19. package/lib/Signal/Group/keyhelper.js +2 -2
  20. package/lib/Signal/Group/sender-chain-key.d.ts +14 -0
  21. package/lib/Signal/Group/sender-chain-key.js +5 -10
  22. package/lib/Signal/Group/sender-key-distribution-message.d.ts +17 -0
  23. package/lib/Signal/Group/sender-key-distribution-message.js +7 -7
  24. package/lib/Signal/Group/sender-key-message.d.ts +19 -0
  25. package/lib/Signal/Group/sender-key-message.js +8 -8
  26. package/lib/Signal/Group/sender-key-name.d.ts +18 -0
  27. package/lib/Signal/Group/sender-key-record.d.ts +31 -0
  28. package/lib/Signal/Group/sender-key-record.js +7 -16
  29. package/lib/Signal/Group/sender-key-state.d.ts +39 -0
  30. package/lib/Signal/Group/sender-key-state.js +25 -37
  31. package/lib/Signal/Group/sender-message-key.d.ts +12 -0
  32. package/lib/Signal/Group/sender-message-key.js +2 -2
  33. package/lib/Signal/libsignal.d.ts +5 -0
  34. package/lib/Signal/libsignal.js +358 -54
  35. package/lib/Signal/lid-mapping.d.ts +19 -0
  36. package/lib/Signal/lid-mapping.js +274 -0
  37. package/lib/Socket/Client/index.d.ts +3 -0
  38. package/lib/Socket/Client/index.js +2 -2
  39. package/lib/Socket/Client/types.d.ts +16 -0
  40. package/lib/Socket/Client/types.js +1 -0
  41. package/lib/Socket/Client/websocket.d.ts +13 -0
  42. package/lib/Socket/Client/websocket.js +18 -30
  43. package/lib/Socket/business.d.ts +202 -0
  44. package/lib/Socket/business.js +160 -38
  45. package/lib/Socket/chats.d.ts +111 -0
  46. package/lib/Socket/chats.js +497 -314
  47. package/lib/Socket/communities.d.ts +258 -0
  48. package/lib/Socket/communities.js +438 -0
  49. package/lib/Socket/community.js +333 -0
  50. package/lib/Socket/groups.d.ts +150 -0
  51. package/lib/Socket/groups.js +229 -91
  52. package/lib/Socket/index.d.ts +245 -0
  53. package/lib/Socket/index.js +9 -6
  54. package/lib/Socket/messages-recv.d.ts +187 -0
  55. package/lib/Socket/messages-recv.js +1105 -501
  56. package/lib/Socket/messages-send.d.ts +183 -0
  57. package/lib/Socket/messages-send.js +1184 -501
  58. package/lib/Socket/mex.d.ts +3 -0
  59. package/lib/Socket/mex.js +45 -0
  60. package/lib/Socket/newsletter.d.ts +160 -0
  61. package/lib/Socket/newsletter.js +227 -200
  62. package/lib/Socket/socket.d.ts +55 -0
  63. package/lib/Socket/socket.js +507 -206
  64. package/lib/Socket/usync.js +6 -6
  65. package/lib/Store/index.js +17 -5
  66. package/lib/Store/make-cache-manager-store.js +83 -0
  67. package/lib/Store/make-in-memory-store.js +48 -89
  68. package/lib/Store/make-ordered-dictionary.js +1 -1
  69. package/lib/Types/Auth.d.ts +116 -0
  70. package/lib/Types/Bussines.d.ts +25 -0
  71. package/lib/Types/Bussines.js +2 -0
  72. package/lib/Types/Call.d.ts +15 -0
  73. package/lib/Types/Chat.d.ts +123 -0
  74. package/lib/Types/Chat.js +7 -1
  75. package/lib/Types/Contact.d.ts +24 -0
  76. package/lib/Types/Events.d.ts +237 -0
  77. package/lib/Types/Events.js +1 -0
  78. package/lib/Types/GroupMetadata.d.ts +67 -0
  79. package/lib/Types/Label.d.ts +47 -0
  80. package/lib/Types/Label.js +1 -3
  81. package/lib/Types/LabelAssociation.d.ts +30 -0
  82. package/lib/Types/LabelAssociation.js +1 -3
  83. package/lib/Types/Message.d.ts +305 -0
  84. package/lib/Types/Message.js +9 -5
  85. package/lib/Types/MexUpdates.js +11 -0
  86. package/lib/Types/Newsletter.d.ts +135 -0
  87. package/lib/Types/Newsletter.js +36 -11
  88. package/lib/Types/Product.d.ts +79 -0
  89. package/lib/Types/Signal.d.ts +76 -0
  90. package/lib/Types/Signal.js +1 -0
  91. package/lib/Types/Socket.d.ts +133 -0
  92. package/lib/Types/Socket.js +1 -0
  93. package/lib/Types/State.d.ts +39 -0
  94. package/lib/Types/State.js +12 -0
  95. package/lib/Types/USync.d.ts +26 -0
  96. package/lib/Types/USync.js +1 -0
  97. package/lib/Types/index.d.ts +65 -0
  98. package/lib/Types/index.js +14 -14
  99. package/lib/Utils/audioToBuffer.js +31 -0
  100. package/lib/Utils/auth-utils.d.ts +19 -0
  101. package/lib/Utils/auth-utils.js +222 -123
  102. package/lib/Utils/baileys-event-stream.js +60 -0
  103. package/lib/Utils/browser-utils.d.ts +4 -0
  104. package/lib/Utils/browser-utils.js +38 -29
  105. package/lib/Utils/business.d.ts +23 -0
  106. package/lib/Utils/business.js +54 -48
  107. package/lib/Utils/chat-utils.d.ts +70 -0
  108. package/lib/Utils/chat-utils.js +284 -189
  109. package/lib/Utils/crypto.d.ts +37 -0
  110. package/lib/Utils/crypto.js +16 -41
  111. package/lib/Utils/decode-wa-message.d.ts +48 -0
  112. package/lib/Utils/decode-wa-message.js +128 -48
  113. package/lib/Utils/event-buffer.d.ts +34 -0
  114. package/lib/Utils/event-buffer.js +124 -62
  115. package/lib/Utils/generics.d.ts +91 -0
  116. package/lib/Utils/generics.js +154 -138
  117. package/lib/Utils/history.d.ts +22 -0
  118. package/lib/Utils/history.js +77 -34
  119. package/lib/Utils/identity-change-handler.d.ts +37 -0
  120. package/lib/Utils/identity-change-handler.js +54 -0
  121. package/lib/Utils/index.d.ts +22 -0
  122. package/lib/Utils/index.js +32 -19
  123. package/lib/Utils/link-preview.d.ts +21 -0
  124. package/lib/Utils/link-preview.js +12 -17
  125. package/lib/Utils/logger.d.ts +13 -0
  126. package/lib/Utils/lt-hash.d.ts +8 -0
  127. package/lib/Utils/lt-hash.js +2 -43
  128. package/lib/Utils/make-mutex.d.ts +9 -0
  129. package/lib/Utils/make-mutex.js +21 -27
  130. package/lib/Utils/message-retry-manager.d.ts +110 -0
  131. package/lib/Utils/message-retry-manager.js +143 -45
  132. package/lib/Utils/messages-media.d.ts +130 -0
  133. package/lib/Utils/messages-media.js +429 -502
  134. package/lib/Utils/messages-newsletter.d.ts +84 -0
  135. package/lib/Utils/messages-newsletter.js +295 -0
  136. package/lib/Utils/messages.d.ts +92 -0
  137. package/lib/Utils/messages.js +1099 -400
  138. package/lib/Utils/noise-handler.d.ts +20 -0
  139. package/lib/Utils/noise-handler.js +145 -91
  140. package/lib/Utils/pre-key-manager.d.ts +28 -0
  141. package/lib/Utils/pre-key-manager.js +112 -0
  142. package/lib/Utils/process-message.d.ts +60 -0
  143. package/lib/Utils/process-message.js +316 -184
  144. package/lib/Utils/reporting-utils.d.ts +11 -0
  145. package/lib/Utils/reporting-utils.js +262 -0
  146. package/lib/Utils/resolve-jid.d.ts +43 -0
  147. package/lib/Utils/resolve-jid.js +95 -0
  148. package/lib/Utils/serial-task-queue.js +29 -0
  149. package/lib/Utils/signal.d.ts +34 -0
  150. package/lib/Utils/signal.js +56 -39
  151. package/lib/Utils/streamToBuffer.js +17 -0
  152. package/lib/Utils/sync-action-utils.d.ts +19 -0
  153. package/lib/Utils/sync-action-utils.js +52 -0
  154. package/lib/Utils/tc-token-utils.d.ts +12 -0
  155. package/lib/Utils/tc-token-utils.js +20 -0
  156. package/lib/Utils/use-mongo-file-auth-state.js +71 -0
  157. package/lib/Utils/use-multi-file-auth-state.d.ts +13 -0
  158. package/lib/Utils/use-multi-file-auth-state.js +11 -12
  159. package/lib/Utils/use-single-file-auth-state.js +73 -0
  160. package/lib/Utils/validate-connection.d.ts +11 -0
  161. package/lib/Utils/validate-connection.js +59 -82
  162. package/lib/Utils/wileys-event-stream.js +1 -61
  163. package/lib/WABinary/constants.d.ts +28 -0
  164. package/lib/WABinary/decode.d.ts +7 -0
  165. package/lib/WABinary/decode.js +39 -4
  166. package/lib/WABinary/encode.d.ts +3 -0
  167. package/lib/WABinary/encode.js +17 -11
  168. package/lib/WABinary/generic-utils.d.ts +15 -0
  169. package/lib/WABinary/generic-utils.js +46 -18
  170. package/lib/WABinary/index.d.ts +6 -0
  171. package/lib/WABinary/index.js +9 -5
  172. package/lib/WABinary/jid-utils.d.ts +48 -0
  173. package/lib/WABinary/jid-utils.js +67 -37
  174. package/lib/WABinary/types.d.ts +19 -0
  175. package/lib/WABinary/types.js +34 -0
  176. package/lib/WAM/BinaryInfo.d.ts +9 -0
  177. package/lib/WAM/constants.d.ts +40 -0
  178. package/lib/WAM/constants.js +19183 -11678
  179. package/lib/WAM/encode.d.ts +3 -0
  180. package/lib/WAM/encode.js +15 -17
  181. package/lib/WAM/index.d.ts +4 -0
  182. package/lib/WAM/index.js +3 -3
  183. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +10 -0
  184. package/lib/WAUSync/Protocols/USyncContactProtocol.js +6 -6
  185. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +23 -0
  186. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +9 -9
  187. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +13 -0
  188. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +6 -6
  189. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +13 -0
  190. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +7 -8
  191. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +26 -0
  192. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +18 -17
  193. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +10 -0
  194. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +11 -3
  195. package/lib/WAUSync/Protocols/index.d.ts +5 -0
  196. package/lib/WAUSync/Protocols/index.js +6 -4
  197. package/lib/WAUSync/USyncQuery.d.ts +29 -0
  198. package/lib/WAUSync/USyncQuery.js +38 -30
  199. package/lib/WAUSync/USyncUser.d.ts +13 -0
  200. package/lib/WAUSync/index.d.ts +4 -0
  201. package/lib/WAUSync/index.js +3 -3
  202. package/lib/index.d.ts +12 -0
  203. package/lib/index.js +3 -5
  204. package/package.json +10 -6
  205. package/readme.md +97 -0
  206. package/LICENSE +0 -21
@@ -1,17 +1,137 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.makeBusinessSocket = void 0;
4
- const business_1 = require("../Utils/business");
5
- const WABinary_1 = require("../WABinary");
6
- const generic_utils_1 = require("../WABinary/generic-utils");
7
- const messages_recv_1 = require("./messages-recv");
4
+ const index_js_1 = require("../Utils/index.js");
5
+ const business_js_1 = require("../Utils/business.js");
6
+ const index_js_2 = require("../WABinary/index.js");
7
+ const generic_utils_js_1 = require("../WABinary/generic-utils.js");
8
+ const messages_recv_js_1 = require("./messages-recv.js");
8
9
  const makeBusinessSocket = (config) => {
9
- const sock = (0, messages_recv_1.makeMessagesRecvSocket)(config);
10
+ const sock = (0, messages_recv_js_1.makeMessagesRecvSocket)(config);
10
11
  const { authState, query, waUploadToServer } = sock;
12
+ const updateBussinesProfile = async (args) => {
13
+ const node = [];
14
+ const simpleFields = ['address', 'email', 'description'];
15
+ node.push(...simpleFields
16
+ .filter(key => args[key] !== undefined && args[key] !== null)
17
+ .map(key => ({
18
+ tag: key,
19
+ attrs: {},
20
+ content: args[key]
21
+ })));
22
+ if (args.websites !== undefined) {
23
+ node.push(...args.websites.map(website => ({
24
+ tag: 'website',
25
+ attrs: {},
26
+ content: website
27
+ })));
28
+ }
29
+ if (args.hours !== undefined) {
30
+ node.push({
31
+ tag: 'business_hours',
32
+ attrs: { timezone: args.hours.timezone },
33
+ content: args.hours.days.map(dayConfig => {
34
+ const base = {
35
+ tag: 'business_hours_config',
36
+ attrs: {
37
+ day_of_week: dayConfig.day,
38
+ mode: dayConfig.mode
39
+ }
40
+ };
41
+ if (dayConfig.mode === 'specific_hours') {
42
+ return {
43
+ ...base,
44
+ attrs: {
45
+ ...base.attrs,
46
+ open_time: dayConfig.openTimeInMinutes,
47
+ close_time: dayConfig.closeTimeInMinutes
48
+ }
49
+ };
50
+ }
51
+ return base;
52
+ })
53
+ });
54
+ }
55
+ const result = await query({
56
+ tag: 'iq',
57
+ attrs: {
58
+ to: index_js_2.S_WHATSAPP_NET,
59
+ type: 'set',
60
+ xmlns: 'w:biz'
61
+ },
62
+ content: [
63
+ {
64
+ tag: 'business_profile',
65
+ attrs: {
66
+ v: '3',
67
+ mutation_type: 'delta'
68
+ },
69
+ content: node
70
+ }
71
+ ]
72
+ });
73
+ return result;
74
+ };
75
+ const updateCoverPhoto = async (photo) => {
76
+ const { fileSha256, filePath } = await (0, index_js_1.getRawMediaUploadData)(photo, 'biz-cover-photo');
77
+ const fileSha256B64 = fileSha256.toString('base64');
78
+ const { meta_hmac, fbid, ts } = await waUploadToServer(filePath, {
79
+ fileEncSha256B64: fileSha256B64,
80
+ mediaType: 'biz-cover-photo'
81
+ });
82
+ await query({
83
+ tag: 'iq',
84
+ attrs: {
85
+ to: index_js_2.S_WHATSAPP_NET,
86
+ type: 'set',
87
+ xmlns: 'w:biz'
88
+ },
89
+ content: [
90
+ {
91
+ tag: 'business_profile',
92
+ attrs: {
93
+ v: '3',
94
+ mutation_type: 'delta'
95
+ },
96
+ content: [
97
+ {
98
+ tag: 'cover_photo',
99
+ attrs: { id: String(fbid), op: 'update', token: meta_hmac, ts: String(ts) }
100
+ }
101
+ ]
102
+ }
103
+ ]
104
+ });
105
+ return fbid;
106
+ };
107
+ const removeCoverPhoto = async (id) => {
108
+ return await query({
109
+ tag: 'iq',
110
+ attrs: {
111
+ to: index_js_2.S_WHATSAPP_NET,
112
+ type: 'set',
113
+ xmlns: 'w:biz'
114
+ },
115
+ content: [
116
+ {
117
+ tag: 'business_profile',
118
+ attrs: {
119
+ v: '3',
120
+ mutation_type: 'delta'
121
+ },
122
+ content: [
123
+ {
124
+ tag: 'cover_photo',
125
+ attrs: { op: 'delete', id }
126
+ }
127
+ ]
128
+ }
129
+ ]
130
+ });
131
+ };
11
132
  const getCatalog = async ({ jid, limit, cursor }) => {
12
- var _a;
13
- jid = jid || ((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id);
14
- jid = (0, WABinary_1.jidNormalizedUser)(jid);
133
+ jid = jid || authState.creds.me?.id;
134
+ jid = (0, index_js_2.jidNormalizedUser)(jid);
15
135
  const queryParamNodes = [
16
136
  {
17
137
  tag: 'limit',
@@ -27,7 +147,7 @@ const makeBusinessSocket = (config) => {
27
147
  tag: 'height',
28
148
  attrs: {},
29
149
  content: Buffer.from('100')
30
- },
150
+ }
31
151
  ];
32
152
  if (cursor) {
33
153
  queryParamNodes.push({
@@ -39,7 +159,7 @@ const makeBusinessSocket = (config) => {
39
159
  const result = await query({
40
160
  tag: 'iq',
41
161
  attrs: {
42
- to: WABinary_1.S_WHATSAPP_NET,
162
+ to: index_js_2.S_WHATSAPP_NET,
43
163
  type: 'get',
44
164
  xmlns: 'w:biz:catalog'
45
165
  },
@@ -48,31 +168,30 @@ const makeBusinessSocket = (config) => {
48
168
  tag: 'product_catalog',
49
169
  attrs: {
50
170
  jid,
51
- 'allow_shop_source': 'true'
171
+ allow_shop_source: 'true'
52
172
  },
53
173
  content: queryParamNodes
54
174
  }
55
175
  ]
56
176
  });
57
- return (0, business_1.parseCatalogNode)(result);
177
+ return (0, business_js_1.parseCatalogNode)(result);
58
178
  };
59
179
  const getCollections = async (jid, limit = 51) => {
60
- var _a;
61
- jid = jid || ((_a = authState.creds.me) === null || _a === void 0 ? void 0 : _a.id);
62
- jid = (0, WABinary_1.jidNormalizedUser)(jid);
180
+ jid = jid || authState.creds.me?.id;
181
+ jid = (0, index_js_2.jidNormalizedUser)(jid);
63
182
  const result = await query({
64
183
  tag: 'iq',
65
184
  attrs: {
66
- to: WABinary_1.S_WHATSAPP_NET,
185
+ to: index_js_2.S_WHATSAPP_NET,
67
186
  type: 'get',
68
187
  xmlns: 'w:biz:catalog',
69
- 'smax_id': '35'
188
+ smax_id: '35'
70
189
  },
71
190
  content: [
72
191
  {
73
192
  tag: 'collections',
74
193
  attrs: {
75
- 'biz_jid': jid,
194
+ biz_jid: jid
76
195
  },
77
196
  content: [
78
197
  {
@@ -99,16 +218,16 @@ const makeBusinessSocket = (config) => {
99
218
  }
100
219
  ]
101
220
  });
102
- return (0, business_1.parseCollectionsNode)(result);
221
+ return (0, business_js_1.parseCollectionsNode)(result);
103
222
  };
104
223
  const getOrderDetails = async (orderId, tokenBase64) => {
105
224
  const result = await query({
106
225
  tag: 'iq',
107
226
  attrs: {
108
- to: WABinary_1.S_WHATSAPP_NET,
227
+ to: index_js_2.S_WHATSAPP_NET,
109
228
  type: 'get',
110
229
  xmlns: 'fb:thrift_iq',
111
- 'smax_id': '5'
230
+ smax_id: '5'
112
231
  },
113
232
  content: [
114
233
  {
@@ -143,15 +262,15 @@ const makeBusinessSocket = (config) => {
143
262
  }
144
263
  ]
145
264
  });
146
- return (0, business_1.parseOrderDetailsNode)(result);
265
+ return (0, business_js_1.parseOrderDetailsNode)(result);
147
266
  };
148
267
  const productUpdate = async (productId, update) => {
149
- update = await (0, business_1.uploadingNecessaryImagesOfProduct)(update, waUploadToServer);
150
- const editNode = (0, business_1.toProductNode)(productId, update);
268
+ update = await (0, business_js_1.uploadingNecessaryImagesOfProduct)(update, waUploadToServer);
269
+ const editNode = (0, business_js_1.toProductNode)(productId, update);
151
270
  const result = await query({
152
271
  tag: 'iq',
153
272
  attrs: {
154
- to: WABinary_1.S_WHATSAPP_NET,
273
+ to: index_js_2.S_WHATSAPP_NET,
155
274
  type: 'set',
156
275
  xmlns: 'w:biz:catalog'
157
276
  },
@@ -175,19 +294,19 @@ const makeBusinessSocket = (config) => {
175
294
  }
176
295
  ]
177
296
  });
178
- const productCatalogEditNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_edit');
179
- const productNode = (0, generic_utils_1.getBinaryNodeChild)(productCatalogEditNode, 'product');
180
- return (0, business_1.parseProductNode)(productNode);
297
+ const productCatalogEditNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_edit');
298
+ const productNode = (0, generic_utils_js_1.getBinaryNodeChild)(productCatalogEditNode, 'product');
299
+ return (0, business_js_1.parseProductNode)(productNode);
181
300
  };
182
301
  const productCreate = async (create) => {
183
302
  // ensure isHidden is defined
184
303
  create.isHidden = !!create.isHidden;
185
- create = await (0, business_1.uploadingNecessaryImagesOfProduct)(create, waUploadToServer);
186
- const createNode = (0, business_1.toProductNode)(undefined, create);
304
+ create = await (0, business_js_1.uploadingNecessaryImagesOfProduct)(create, waUploadToServer);
305
+ const createNode = (0, business_js_1.toProductNode)(undefined, create);
187
306
  const result = await query({
188
307
  tag: 'iq',
189
308
  attrs: {
190
- to: WABinary_1.S_WHATSAPP_NET,
309
+ to: index_js_2.S_WHATSAPP_NET,
191
310
  type: 'set',
192
311
  xmlns: 'w:biz:catalog'
193
312
  },
@@ -211,15 +330,15 @@ const makeBusinessSocket = (config) => {
211
330
  }
212
331
  ]
213
332
  });
214
- const productCatalogAddNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_add');
215
- const productNode = (0, generic_utils_1.getBinaryNodeChild)(productCatalogAddNode, 'product');
216
- return (0, business_1.parseProductNode)(productNode);
333
+ const productCatalogAddNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_add');
334
+ const productNode = (0, generic_utils_js_1.getBinaryNodeChild)(productCatalogAddNode, 'product');
335
+ return (0, business_js_1.parseProductNode)(productNode);
217
336
  };
218
337
  const productDelete = async (productIds) => {
219
338
  const result = await query({
220
339
  tag: 'iq',
221
340
  attrs: {
222
- to: WABinary_1.S_WHATSAPP_NET,
341
+ to: index_js_2.S_WHATSAPP_NET,
223
342
  type: 'set',
224
343
  xmlns: 'w:biz:catalog'
225
344
  },
@@ -241,9 +360,9 @@ const makeBusinessSocket = (config) => {
241
360
  }
242
361
  ]
243
362
  });
244
- const productCatalogDelNode = (0, generic_utils_1.getBinaryNodeChild)(result, 'product_catalog_delete');
363
+ const productCatalogDelNode = (0, generic_utils_js_1.getBinaryNodeChild)(result, 'product_catalog_delete');
245
364
  return {
246
- deleted: +((productCatalogDelNode === null || productCatalogDelNode === void 0 ? void 0 : productCatalogDelNode.attrs.deleted_count) || 0)
365
+ deleted: +(productCatalogDelNode?.attrs.deleted_count || 0)
247
366
  };
248
367
  };
249
368
  return {
@@ -254,7 +373,10 @@ const makeBusinessSocket = (config) => {
254
373
  getCollections,
255
374
  productCreate,
256
375
  productDelete,
257
- productUpdate
376
+ productUpdate,
377
+ updateBussinesProfile,
378
+ updateCoverPhoto,
379
+ removeCoverPhoto
258
380
  };
259
381
  };
260
382
  exports.makeBusinessSocket = makeBusinessSocket;
@@ -0,0 +1,111 @@
1
+ import { Boom } from '@hapi/boom';
2
+ import { proto } from '../../WAProto/index.js';
3
+ import type { BotListInfo, 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
+ createCallLink: (type: "audio" | "video", event?: {
10
+ startTime: number;
11
+ }, timeoutMs?: number) => Promise<string | undefined>;
12
+ getBotListV2: () => Promise<BotListInfo[]>;
13
+ messageMutex: {
14
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
15
+ };
16
+ receiptMutex: {
17
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
18
+ };
19
+ appStatePatchMutex: {
20
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
21
+ };
22
+ notificationMutex: {
23
+ mutex<T>(code: () => Promise<T> | T): Promise<T>;
24
+ };
25
+ fetchPrivacySettings: (force?: boolean) => Promise<{
26
+ [_: string]: string;
27
+ }>;
28
+ upsertMessage: (msg: WAMessage, type: MessageUpsertType) => Promise<void>;
29
+ appPatch: (patchCreate: WAPatchCreate) => Promise<void>;
30
+ sendPresenceUpdate: (type: WAPresence, toJid?: string) => Promise<void>;
31
+ presenceSubscribe: (toJid: string) => Promise<void>;
32
+ profilePictureUrl: (jid: string, type?: "preview" | "image", timeoutMs?: number) => Promise<string | undefined>;
33
+ fetchBlocklist: () => Promise<(string | undefined)[]>;
34
+ fetchStatus: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
35
+ fetchDisappearingDuration: (...jids: string[]) => Promise<import("../WAUSync/index.js").USyncQueryResultList[] | undefined>;
36
+ updateProfilePicture: (jid: string, content: WAMediaUpload, dimensions?: {
37
+ width: number;
38
+ height: number;
39
+ }) => Promise<void>;
40
+ removeProfilePicture: (jid: string) => Promise<void>;
41
+ updateProfileStatus: (status: string) => Promise<void>;
42
+ updateProfileName: (name: string) => Promise<void>;
43
+ updateBlockStatus: (jid: string, action: "block" | "unblock") => Promise<void>;
44
+ updateDisableLinkPreviewsPrivacy: (isPreviewsDisabled: boolean) => Promise<void>;
45
+ updateCallPrivacy: (value: WAPrivacyCallValue) => Promise<void>;
46
+ updateMessagesPrivacy: (value: WAPrivacyMessagesValue) => Promise<void>;
47
+ updateLastSeenPrivacy: (value: WAPrivacyValue) => Promise<void>;
48
+ updateOnlinePrivacy: (value: WAPrivacyOnlineValue) => Promise<void>;
49
+ updateProfilePicturePrivacy: (value: WAPrivacyValue) => Promise<void>;
50
+ updateStatusPrivacy: (value: WAPrivacyValue) => Promise<void>;
51
+ updateReadReceiptsPrivacy: (value: WAReadReceiptsValue) => Promise<void>;
52
+ updateGroupsAddPrivacy: (value: WAPrivacyGroupAddValue) => Promise<void>;
53
+ updateDefaultDisappearingMode: (duration: number) => Promise<void>;
54
+ getBusinessProfile: (jid: string) => Promise<WABusinessProfile | void>;
55
+ resyncAppState: (collections: readonly ("critical_unblock_low" | "regular_high" | "regular_low" | "critical_block" | "regular")[], isInitialSync: boolean) => Promise<void>;
56
+ chatModify: (mod: ChatModification, jid: string) => Promise<void>;
57
+ cleanDirtyBits: (type: "account_sync" | "groups", fromTimestamp?: number | string) => Promise<void>;
58
+ addOrEditContact: (jid: string, contact: proto.SyncActionValue.IContactAction) => Promise<void>;
59
+ removeContact: (jid: string) => Promise<void>;
60
+ addLabel: (jid: string, labels: LabelActionBody) => Promise<void>;
61
+ addChatLabel: (jid: string, labelId: string) => Promise<void>;
62
+ removeChatLabel: (jid: string, labelId: string) => Promise<void>;
63
+ addMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
64
+ removeMessageLabel: (jid: string, messageId: string, labelId: string) => Promise<void>;
65
+ star: (jid: string, messages: {
66
+ id: string;
67
+ fromMe?: boolean;
68
+ }[], star: boolean) => Promise<void>;
69
+ addOrEditQuickReply: (quickReply: QuickReplyAction) => Promise<void>;
70
+ removeQuickReply: (timestamp: string) => Promise<void>;
71
+ type: "md";
72
+ ws: import("./Client/websocket.js").WebSocketClient;
73
+ ev: import("../Types/index.js").BaileysEventEmitter & {
74
+ process(handler: (events: Partial<import("../Types/index.js").BaileysEventMap>) => void | Promise<void>): () => void;
75
+ buffer(): void;
76
+ createBufferedFunction<A extends any[], T>(work: (...args: A) => Promise<T>): (...args: A) => Promise<T>;
77
+ flush(): boolean;
78
+ isBuffering(): boolean;
79
+ };
80
+ authState: {
81
+ creds: import("../Types/index.js").AuthenticationCreds;
82
+ keys: import("../Types/index.js").SignalKeyStoreWithTransaction;
83
+ };
84
+ signalRepository: import("../Types/index.js").SignalRepositoryWithLIDStore;
85
+ user: import("../Types/index.js").Contact | undefined;
86
+ generateMessageTag: () => string;
87
+ query: (node: BinaryNode, timeoutMs?: number) => Promise<any>;
88
+ waitForMessage: <T>(msgId: string, timeoutMs?: number | undefined) => Promise<T | undefined>;
89
+ waitForSocketOpen: () => Promise<void>;
90
+ sendRawMessage: (data: Uint8Array | Buffer) => Promise<void>;
91
+ sendNode: (frame: BinaryNode) => Promise<void>;
92
+ logout: (msg?: string) => Promise<void>;
93
+ end: (error: Error | undefined) => Promise<void>;
94
+ onUnexpectedError: (err: Error | Boom, msg: string) => void;
95
+ uploadPreKeys: (count?: number, retryCount?: number) => Promise<void>;
96
+ uploadPreKeysToServerIfRequired: () => Promise<void>;
97
+ digestKeyBundle: () => Promise<void>;
98
+ rotateSignedPreKey: () => Promise<void>;
99
+ requestPairingCode: (phoneNumber: string, customPairingCode?: string) => Promise<string>;
100
+ updateServerTimeOffset: ({ attrs }: BinaryNode) => void;
101
+ sendUnifiedSession: () => Promise<void>;
102
+ wamBuffer: import("../index.js").BinaryInfo;
103
+ waitForConnectionUpdate: (check: (u: Partial<import("../Types/index.js").ConnectionState>) => Promise<boolean | undefined>, timeoutMs?: number) => Promise<void>;
104
+ sendWAMBuffer: (wamBuffer: Buffer) => Promise<any>;
105
+ executeUSyncQuery: (usyncQuery: USyncQuery) => Promise<import("../WAUSync/index.js").USyncQueryResult | undefined>;
106
+ onWhatsApp: (...phoneNumber: string[]) => Promise<{
107
+ jid: string;
108
+ exists: boolean;
109
+ }[] | undefined>;
110
+ };
111
+ //# sourceMappingURL=chats.d.ts.map