@vanzxysenpai/baileys 0.0.0-stage → 0.0.2

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 (431) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/LICENSE +25 -0
  3. package/NOTICE.md +158 -0
  4. package/README.md +5294 -2
  5. package/VanzxyBanner.js +134 -0
  6. package/WAProto/index.d.ts +13317 -0
  7. package/WAProto/index.js +147553 -0
  8. package/lib/Builders/A2UI.d.ts +131 -0
  9. package/lib/Builders/A2UI.js +343 -0
  10. package/lib/Builders/AIRich.d.ts +1021 -0
  11. package/lib/Builders/AIRich.js +2889 -0
  12. package/lib/Builders/Album.d.ts +51 -0
  13. package/lib/Builders/Album.js +99 -0
  14. package/lib/Builders/Button.d.ts +137449 -0
  15. package/lib/Builders/Button.js +1054 -0
  16. package/lib/Builders/ButtonV2.d.ts +43 -0
  17. package/lib/Builders/ButtonV2.js +175 -0
  18. package/lib/Builders/ButtonV3.d.ts +35 -0
  19. package/lib/Builders/ButtonV3.js +189 -0
  20. package/lib/Builders/Carousel.d.ts +68 -0
  21. package/lib/Builders/Carousel.js +161 -0
  22. package/lib/Builders/Event.d.ts +61 -0
  23. package/lib/Builders/Event.js +118 -0
  24. package/lib/Builders/Expiring.d.ts +17 -0
  25. package/lib/Builders/Expiring.js +27 -0
  26. package/lib/Builders/Poll.d.ts +63 -0
  27. package/lib/Builders/Poll.js +139 -0
  28. package/lib/Builders/VanzxyBaileys.d.ts +42 -0
  29. package/lib/Builders/VanzxyBaileys.js +110 -0
  30. package/lib/Builders/errors.d.ts +25 -0
  31. package/lib/Builders/errors.js +29 -0
  32. package/lib/Builders/index.d.ts +14 -0
  33. package/lib/Builders/index.js +23 -0
  34. package/lib/Builders/shared.d.ts +395 -0
  35. package/lib/Builders/shared.js +738 -0
  36. package/lib/Defaults/bot-jid.d.ts +1 -0
  37. package/lib/Defaults/bot-jid.js +1 -0
  38. package/lib/Defaults/index.d.ts +161 -0
  39. package/lib/Defaults/index.js +165 -0
  40. package/lib/Defaults/version.d.ts +1 -0
  41. package/lib/Defaults/version.js +1 -0
  42. package/lib/Framework/Bot.d.ts +865 -0
  43. package/lib/Framework/Bot.js +230 -0
  44. package/lib/Framework/Context.d.ts +17 -0
  45. package/lib/Framework/Context.js +90 -0
  46. package/lib/Framework/MediaManager.d.ts +15 -0
  47. package/lib/Framework/MediaManager.js +154 -0
  48. package/lib/Framework/SessionManager.d.ts +10 -0
  49. package/lib/Framework/SessionManager.js +34 -0
  50. package/lib/Framework/StatsManager.d.ts +20 -0
  51. package/lib/Framework/StatsManager.js +117 -0
  52. package/lib/Framework/Store/SQLiteStore.d.ts +13 -0
  53. package/lib/Framework/Store/SQLiteStore.js +68 -0
  54. package/lib/Framework/index.d.ts +6 -0
  55. package/lib/Framework/index.js +11 -0
  56. package/lib/Signal/Group/ciphertext-message.d.ts +9 -0
  57. package/lib/Signal/Group/ciphertext-message.js +11 -0
  58. package/lib/Signal/Group/group-session-builder.d.ts +7 -0
  59. package/lib/Signal/Group/group-session-builder.js +29 -0
  60. package/lib/Signal/Group/group_cipher.d.ts +10 -0
  61. package/lib/Signal/Group/group_cipher.js +81 -0
  62. package/lib/Signal/Group/index.d.ts +11 -0
  63. package/lib/Signal/Group/index.js +11 -0
  64. package/lib/Signal/Group/keyhelper.d.ts +6 -0
  65. package/lib/Signal/Group/keyhelper.js +17 -0
  66. package/lib/Signal/Group/sender-chain-key.d.ts +13 -0
  67. package/lib/Signal/Group/sender-chain-key.js +25 -0
  68. package/lib/Signal/Group/sender-key-distribution-message.d.ts +16 -0
  69. package/lib/Signal/Group/sender-key-distribution-message.js +62 -0
  70. package/lib/Signal/Group/sender-key-message.d.ts +18 -0
  71. package/lib/Signal/Group/sender-key-message.js +65 -0
  72. package/lib/Signal/Group/sender-key-name.d.ts +11 -0
  73. package/lib/Signal/Group/sender-key-name.js +47 -0
  74. package/lib/Signal/Group/sender-key-record.d.ts +12 -0
  75. package/lib/Signal/Group/sender-key-record.js +40 -0
  76. package/lib/Signal/Group/sender-key-state.d.ts +16 -0
  77. package/lib/Signal/Group/sender-key-state.js +83 -0
  78. package/lib/Signal/Group/sender-message-key.d.ts +11 -0
  79. package/lib/Signal/Group/sender-message-key.js +25 -0
  80. package/lib/Signal/libsignal.d.ts +58 -0
  81. package/lib/Signal/libsignal.js +436 -0
  82. package/lib/Signal/lid-mapping.d.ts +20 -0
  83. package/lib/Signal/lid-mapping.js +276 -0
  84. package/lib/Socket/Client/index.d.ts +2 -0
  85. package/lib/Socket/Client/index.js +2 -0
  86. package/lib/Socket/Client/types.d.ts +5 -0
  87. package/lib/Socket/Client/types.js +10 -0
  88. package/lib/Socket/Client/websocket.d.ts +12 -0
  89. package/lib/Socket/Client/websocket.js +53 -0
  90. package/lib/Socket/business.d.ts +674 -0
  91. package/lib/Socket/business.js +379 -0
  92. package/lib/Socket/chats.d.ts +137 -0
  93. package/lib/Socket/chats.js +1299 -0
  94. package/lib/Socket/communities.d.ts +805 -0
  95. package/lib/Socket/communities.js +454 -0
  96. package/lib/Socket/dugong.d.ts +118 -0
  97. package/lib/Socket/dugong.js +810 -0
  98. package/lib/Socket/groups.d.ts +287 -0
  99. package/lib/Socket/groups.js +386 -0
  100. package/lib/Socket/index.d.ts +826 -0
  101. package/lib/Socket/index.js +35 -0
  102. package/lib/Socket/messages-recv.d.ts +613 -0
  103. package/lib/Socket/messages-recv.js +1851 -0
  104. package/lib/Socket/messages-send.d.ts +608 -0
  105. package/lib/Socket/messages-send.js +1574 -0
  106. package/lib/Socket/mex-fallback.d.ts +51 -0
  107. package/lib/Socket/mex-fallback.js +97 -0
  108. package/lib/Socket/mex.d.ts +1 -0
  109. package/lib/Socket/mex.js +41 -0
  110. package/lib/Socket/newsletter-ext.d.ts +47 -0
  111. package/lib/Socket/newsletter-ext.js +262 -0
  112. package/lib/Socket/newsletter.d.ts +285 -0
  113. package/lib/Socket/newsletter.js +223 -0
  114. package/lib/Socket/socket.d.ts +60 -0
  115. package/lib/Socket/socket.js +1001 -0
  116. package/lib/Socket/username.d.ts +842 -0
  117. package/lib/Socket/username.js +156 -0
  118. package/lib/Store/index.d.ts +3 -0
  119. package/lib/Store/index.js +3 -0
  120. package/lib/Store/make-in-memory-store.d.ts +62 -0
  121. package/lib/Store/make-in-memory-store.js +425 -0
  122. package/lib/Store/make-ordered-dictionary.d.ts +12 -0
  123. package/lib/Store/make-ordered-dictionary.js +78 -0
  124. package/lib/Store/object-repository.d.ts +10 -0
  125. package/lib/Store/object-repository.js +23 -0
  126. package/lib/Types/Auth.d.ts +1 -0
  127. package/lib/Types/Auth.js +1 -0
  128. package/lib/Types/Bussines.d.ts +1 -0
  129. package/lib/Types/Bussines.js +1 -0
  130. package/lib/Types/Call.d.ts +1 -0
  131. package/lib/Types/Call.js +1 -0
  132. package/lib/Types/Chat.d.ts +1 -0
  133. package/lib/Types/Chat.js +7 -0
  134. package/lib/Types/Contact.d.ts +1 -0
  135. package/lib/Types/Contact.js +1 -0
  136. package/lib/Types/Events.d.ts +1 -0
  137. package/lib/Types/Events.js +1 -0
  138. package/lib/Types/GroupMetadata.d.ts +1 -0
  139. package/lib/Types/GroupMetadata.js +1 -0
  140. package/lib/Types/Label.d.ts +2 -0
  141. package/lib/Types/Label.js +24 -0
  142. package/lib/Types/LabelAssociation.d.ts +2 -0
  143. package/lib/Types/LabelAssociation.js +6 -0
  144. package/lib/Types/Message.d.ts +11 -0
  145. package/lib/Types/Message.js +17 -0
  146. package/lib/Types/Mex.d.ts +2 -0
  147. package/lib/Types/Mex.js +38 -0
  148. package/lib/Types/Product.d.ts +1 -0
  149. package/lib/Types/Product.js +1 -0
  150. package/lib/Types/RichType.d.ts +2 -0
  151. package/lib/Types/RichType.js +22 -0
  152. package/lib/Types/Signal.d.ts +1 -0
  153. package/lib/Types/Signal.js +1 -0
  154. package/lib/Types/Socket.d.ts +1 -0
  155. package/lib/Types/Socket.js +1 -0
  156. package/lib/Types/State.d.ts +5 -0
  157. package/lib/Types/State.js +55 -0
  158. package/lib/Types/USync.d.ts +1 -0
  159. package/lib/Types/USync.js +1 -0
  160. package/lib/Types/index.d.ts +15 -0
  161. package/lib/Types/index.js +27 -0
  162. package/lib/Utils/PersistentStore.d.ts +83 -0
  163. package/lib/Utils/PersistentStore.js +592 -0
  164. package/lib/Utils/anchor-guard.d.ts +31 -0
  165. package/lib/Utils/anchor-guard.js +329 -0
  166. package/lib/Utils/android-stanza-id.d.ts +4 -0
  167. package/lib/Utils/android-stanza-id.js +21 -0
  168. package/lib/Utils/anti-delete.d.ts +62 -0
  169. package/lib/Utils/anti-delete.js +212 -0
  170. package/lib/Utils/auth-secure.d.ts +180 -0
  171. package/lib/Utils/auth-secure.js +791 -0
  172. package/lib/Utils/auth-utils.d.ts +59 -0
  173. package/lib/Utils/auth-utils.js +326 -0
  174. package/lib/Utils/auto-reconnect.d.ts +8 -0
  175. package/lib/Utils/auto-reconnect.js +204 -0
  176. package/lib/Utils/auto-reply.d.ts +35 -0
  177. package/lib/Utils/auto-reply.js +152 -0
  178. package/lib/Utils/bad-mac-handler.d.ts +59 -0
  179. package/lib/Utils/bad-mac-handler.js +119 -0
  180. package/lib/Utils/baileys-event-stream.d.ts +5 -0
  181. package/lib/Utils/baileys-event-stream.js +62 -0
  182. package/lib/Utils/browser-utils.d.ts +9 -0
  183. package/lib/Utils/browser-utils.js +29 -0
  184. package/lib/Utils/business.d.ts +49 -0
  185. package/lib/Utils/business.js +236 -0
  186. package/lib/Utils/button-helper-utils.d.ts +59 -0
  187. package/lib/Utils/button-helper-utils.js +266 -0
  188. package/lib/Utils/button-sender.d.ts +164 -0
  189. package/lib/Utils/button-sender.js +845 -0
  190. package/lib/Utils/chat-control.d.ts +98 -0
  191. package/lib/Utils/chat-control.js +231 -0
  192. package/lib/Utils/chat-history-helpers.d.ts +4 -0
  193. package/lib/Utils/chat-history-helpers.js +70 -0
  194. package/lib/Utils/chat-utils.d.ts +408 -0
  195. package/lib/Utils/chat-utils.js +879 -0
  196. package/lib/Utils/companion-reg-client-utils.d.ts +4 -0
  197. package/lib/Utils/companion-reg-client-utils.js +39 -0
  198. package/lib/Utils/connection-watchdog.d.ts +10 -0
  199. package/lib/Utils/connection-watchdog.js +74 -0
  200. package/lib/Utils/crypto.d.ts +41 -0
  201. package/lib/Utils/crypto.js +145 -0
  202. package/lib/Utils/decode-wa-message.d.ts +83 -0
  203. package/lib/Utils/decode-wa-message.js +315 -0
  204. package/lib/Utils/disconnect-reason.d.ts +13 -0
  205. package/lib/Utils/disconnect-reason.js +36 -0
  206. package/lib/Utils/event-buffer.d.ts +12 -0
  207. package/lib/Utils/event-buffer.js +640 -0
  208. package/lib/Utils/fetch-timeout.d.ts +4 -0
  209. package/lib/Utils/fetch-timeout.js +14 -0
  210. package/lib/Utils/ffmpeg-path.d.ts +5 -0
  211. package/lib/Utils/ffmpeg-path.js +130 -0
  212. package/lib/Utils/generics.d.ts +79 -0
  213. package/lib/Utils/generics.js +426 -0
  214. package/lib/Utils/group-metadata-cache.d.ts +3 -0
  215. package/lib/Utils/group-metadata-cache.js +25 -0
  216. package/lib/Utils/group-status-detection.d.ts +5 -0
  217. package/lib/Utils/group-status-detection.js +114 -0
  218. package/lib/Utils/history.d.ts +91 -0
  219. package/lib/Utils/history.js +144 -0
  220. package/lib/Utils/html-app.d.ts +14 -0
  221. package/lib/Utils/html-app.js +97 -0
  222. package/lib/Utils/html-multiplayer.d.ts +8 -0
  223. package/lib/Utils/html-multiplayer.js +90 -0
  224. package/lib/Utils/humanizer.d.ts +8 -0
  225. package/lib/Utils/humanizer.js +74 -0
  226. package/lib/Utils/identity-change-handler.d.ts +13 -0
  227. package/lib/Utils/identity-change-handler.js +49 -0
  228. package/lib/Utils/index.d.ts +88 -0
  229. package/lib/Utils/index.js +93 -0
  230. package/lib/Utils/jid-tools.d.ts +3 -0
  231. package/lib/Utils/jid-tools.js +78 -0
  232. package/lib/Utils/link-preview-metadata.d.ts +47 -0
  233. package/lib/Utils/link-preview-metadata.js +90 -0
  234. package/lib/Utils/link-preview.d.ts +12 -0
  235. package/lib/Utils/link-preview.js +84 -0
  236. package/lib/Utils/lock-manager.d.ts +5 -0
  237. package/lib/Utils/lock-manager.js +50 -0
  238. package/lib/Utils/logger.d.ts +2 -0
  239. package/lib/Utils/logger.js +2 -0
  240. package/lib/Utils/lt-hash.d.ts +12 -0
  241. package/lib/Utils/lt-hash.js +26 -0
  242. package/lib/Utils/make-mutex.d.ts +6 -0
  243. package/lib/Utils/make-mutex.js +32 -0
  244. package/lib/Utils/media-messages.d.ts +35 -0
  245. package/lib/Utils/media-messages.js +70 -0
  246. package/lib/Utils/media-processor.d.ts +6 -0
  247. package/lib/Utils/media-processor.js +174 -0
  248. package/lib/Utils/media-set.d.ts +6 -0
  249. package/lib/Utils/media-set.js +169 -0
  250. package/lib/Utils/message-kind.d.ts +26 -0
  251. package/lib/Utils/message-kind.js +138 -0
  252. package/lib/Utils/message-retry-manager.d.ts +79 -0
  253. package/lib/Utils/message-retry-manager.js +264 -0
  254. package/lib/Utils/message-search.d.ts +40 -0
  255. package/lib/Utils/message-search.js +181 -0
  256. package/lib/Utils/messages-media.d.ts +136 -0
  257. package/lib/Utils/messages-media.js +867 -0
  258. package/lib/Utils/messages.d.ts +66 -0
  259. package/lib/Utils/messages.js +2271 -0
  260. package/lib/Utils/meta-ai-msmsg.d.ts +3 -0
  261. package/lib/Utils/meta-ai-msmsg.js +132 -0
  262. package/lib/Utils/meta-ai.d.ts +4 -0
  263. package/lib/Utils/meta-ai.js +75 -0
  264. package/lib/Utils/migrate-auth-state.d.ts +23 -0
  265. package/lib/Utils/migrate-auth-state.js +126 -0
  266. package/lib/Utils/mini-app.d.ts +20 -0
  267. package/lib/Utils/mini-app.js +215 -0
  268. package/lib/Utils/mock-socket.d.ts +67 -0
  269. package/lib/Utils/mock-socket.js +254 -0
  270. package/lib/Utils/modern-messages.d.ts +64 -0
  271. package/lib/Utils/modern-messages.js +497 -0
  272. package/lib/Utils/native-flow.d.ts +19 -0
  273. package/lib/Utils/native-flow.js +112 -0
  274. package/lib/Utils/newsletter-status.d.ts +157 -0
  275. package/lib/Utils/newsletter-status.js +652 -0
  276. package/lib/Utils/noise-handler.d.ts +20 -0
  277. package/lib/Utils/noise-handler.js +200 -0
  278. package/lib/Utils/offline-node-processor.d.ts +9 -0
  279. package/lib/Utils/offline-node-processor.js +39 -0
  280. package/lib/Utils/pairing-utils.d.ts +5 -0
  281. package/lib/Utils/pairing-utils.js +29 -0
  282. package/lib/Utils/passkey.d.ts +4 -0
  283. package/lib/Utils/passkey.js +11 -0
  284. package/lib/Utils/past-participants.d.ts +2 -0
  285. package/lib/Utils/past-participants.js +40 -0
  286. package/lib/Utils/payment-detection.d.ts +40 -0
  287. package/lib/Utils/payment-detection.js +213 -0
  288. package/lib/Utils/payment-guard.d.ts +28 -0
  289. package/lib/Utils/payment-guard.js +143 -0
  290. package/lib/Utils/payment-messages.d.ts +42 -0
  291. package/lib/Utils/payment-messages.js +161 -0
  292. package/lib/Utils/payment-utils.d.ts +75 -0
  293. package/lib/Utils/payment-utils.js +145 -0
  294. package/lib/Utils/phone-utils.d.ts +3 -0
  295. package/lib/Utils/phone-utils.js +29 -0
  296. package/lib/Utils/pre-key-manager.d.ts +25 -0
  297. package/lib/Utils/pre-key-manager.js +105 -0
  298. package/lib/Utils/process-message.d.ts +103 -0
  299. package/lib/Utils/process-message.js +868 -0
  300. package/lib/Utils/qr-terminal.d.ts +1 -0
  301. package/lib/Utils/qr-terminal.js +16 -0
  302. package/lib/Utils/reconnect-backoff.d.ts +25 -0
  303. package/lib/Utils/reconnect-backoff.js +47 -0
  304. package/lib/Utils/reporting-utils.d.ts +12 -0
  305. package/lib/Utils/reporting-utils.js +257 -0
  306. package/lib/Utils/rich-message-utils.d.ts +54 -0
  307. package/lib/Utils/rich-message-utils.js +435 -0
  308. package/lib/Utils/rich-messages.d.ts +298 -0
  309. package/lib/Utils/rich-messages.js +1145 -0
  310. package/lib/Utils/scheduled-message.d.ts +81 -0
  311. package/lib/Utils/scheduled-message.js +101 -0
  312. package/lib/Utils/scheduling.d.ts +59 -0
  313. package/lib/Utils/scheduling.js +139 -0
  314. package/lib/Utils/signal.d.ts +82 -0
  315. package/lib/Utils/signal.js +200 -0
  316. package/lib/Utils/stanza-ack.d.ts +16 -0
  317. package/lib/Utils/stanza-ack.js +37 -0
  318. package/lib/Utils/status-stickers.d.ts +79 -0
  319. package/lib/Utils/status-stickers.js +261 -0
  320. package/lib/Utils/status.d.ts +107 -0
  321. package/lib/Utils/status.js +131 -0
  322. package/lib/Utils/sticker-pack-maker.d.ts +20 -0
  323. package/lib/Utils/sticker-pack-maker.js +112 -0
  324. package/lib/Utils/stickerpack.d.ts +18 -0
  325. package/lib/Utils/stickerpack.js +316 -0
  326. package/lib/Utils/sync-action-utils.d.ts +2 -0
  327. package/lib/Utils/sync-action-utils.js +48 -0
  328. package/lib/Utils/tag.d.ts +8 -0
  329. package/lib/Utils/tag.js +45 -0
  330. package/lib/Utils/tc-token-utils.d.ts +29 -0
  331. package/lib/Utils/tc-token-utils.js +162 -0
  332. package/lib/Utils/templates.d.ts +86 -0
  333. package/lib/Utils/templates.js +148 -0
  334. package/lib/Utils/text-format.d.ts +13 -0
  335. package/lib/Utils/text-format.js +81 -0
  336. package/lib/Utils/text-tools.d.ts +3 -0
  337. package/lib/Utils/text-tools.js +38 -0
  338. package/lib/Utils/ttl-cache.d.ts +29 -0
  339. package/lib/Utils/ttl-cache.js +123 -0
  340. package/lib/Utils/use-cache-manager-auth-state.d.ts +22 -0
  341. package/lib/Utils/use-cache-manager-auth-state.js +86 -0
  342. package/lib/Utils/use-multi-file-auth-state.d.ts +20 -0
  343. package/lib/Utils/use-multi-file-auth-state.js +201 -0
  344. package/lib/Utils/use-single-file-auth-state.d.ts +10 -0
  345. package/lib/Utils/use-single-file-auth-state.js +111 -0
  346. package/lib/Utils/use-sqlite-auth-state.d.ts +13 -0
  347. package/lib/Utils/use-sqlite-auth-state.js +171 -0
  348. package/lib/Utils/username.d.ts +22 -0
  349. package/lib/Utils/username.js +59 -0
  350. package/lib/Utils/validate-connection.d.ts +43 -0
  351. package/lib/Utils/validate-connection.js +197 -0
  352. package/lib/Utils/vcard.d.ts +40 -0
  353. package/lib/Utils/vcard.js +92 -0
  354. package/lib/Utils/voice-note.d.ts +13 -0
  355. package/lib/Utils/voice-note.js +47 -0
  356. package/lib/VoIP/audio-feeder.d.ts +15 -0
  357. package/lib/VoIP/audio-feeder.js +132 -0
  358. package/lib/VoIP/index.d.ts +22 -0
  359. package/lib/VoIP/index.js +277 -0
  360. package/lib/VoIP/relay-transport.d.ts +16 -0
  361. package/lib/VoIP/relay-transport.js +559 -0
  362. package/lib/VoIP/signaling.d.ts +16 -0
  363. package/lib/VoIP/signaling.js +624 -0
  364. package/lib/VoIP/types.d.ts +11 -0
  365. package/lib/VoIP/types.js +17 -0
  366. package/lib/VoIP/wasm-engine.d.ts +28 -0
  367. package/lib/VoIP/wasm-engine.js +1214 -0
  368. package/lib/VoIP/worker-bootstrap.d.ts +1 -0
  369. package/lib/VoIP/worker-bootstrap.js +1042 -0
  370. package/lib/WABinary/constants.d.ts +61 -0
  371. package/lib/WABinary/constants.js +1466 -0
  372. package/lib/WABinary/decode.d.ts +9 -0
  373. package/lib/WABinary/decode.js +261 -0
  374. package/lib/WABinary/encode.d.ts +2 -0
  375. package/lib/WABinary/encode.js +219 -0
  376. package/lib/WABinary/generic-utils.d.ts +45 -0
  377. package/lib/WABinary/generic-utils.js +285 -0
  378. package/lib/WABinary/index.d.ts +5 -0
  379. package/lib/WABinary/index.js +5 -0
  380. package/lib/WABinary/jid-utils.d.ts +32 -0
  381. package/lib/WABinary/jid-utils.js +102 -0
  382. package/lib/WABinary/types.d.ts +1 -0
  383. package/lib/WABinary/types.js +1 -0
  384. package/lib/WAM/BinaryInfo.d.ts +7 -0
  385. package/lib/WAM/BinaryInfo.js +9 -0
  386. package/lib/WAM/constants.d.ts +34926 -0
  387. package/lib/WAM/constants.js +22852 -0
  388. package/lib/WAM/encode.d.ts +1 -0
  389. package/lib/WAM/encode.js +149 -0
  390. package/lib/WAM/index.d.ts +3 -0
  391. package/lib/WAM/index.js +3 -0
  392. package/lib/WAUSync/Protocols/USyncBusinessProtocol.d.ts +43 -0
  393. package/lib/WAUSync/Protocols/USyncBusinessProtocol.js +32 -0
  394. package/lib/WAUSync/Protocols/USyncContactProtocol.d.ts +36 -0
  395. package/lib/WAUSync/Protocols/USyncContactProtocol.js +51 -0
  396. package/lib/WAUSync/Protocols/USyncDeviceProtocol.d.ts +29 -0
  397. package/lib/WAUSync/Protocols/USyncDeviceProtocol.js +60 -0
  398. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.d.ts +12 -0
  399. package/lib/WAUSync/Protocols/USyncDisappearingModeProtocol.js +26 -0
  400. package/lib/WAUSync/Protocols/USyncFeatureProtocol.d.ts +13 -0
  401. package/lib/WAUSync/Protocols/USyncFeatureProtocol.js +28 -0
  402. package/lib/WAUSync/Protocols/USyncPictureProtocol.d.ts +22 -0
  403. package/lib/WAUSync/Protocols/USyncPictureProtocol.js +28 -0
  404. package/lib/WAUSync/Protocols/USyncSidelistProtocol.d.ts +20 -0
  405. package/lib/WAUSync/Protocols/USyncSidelistProtocol.js +23 -0
  406. package/lib/WAUSync/Protocols/USyncStatusProtocol.d.ts +12 -0
  407. package/lib/WAUSync/Protocols/USyncStatusProtocol.js +37 -0
  408. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.d.ts +14 -0
  409. package/lib/WAUSync/Protocols/USyncTextStatusProtocol.js +24 -0
  410. package/lib/WAUSync/Protocols/USyncUsernameProtocol.d.ts +9 -0
  411. package/lib/WAUSync/Protocols/USyncUsernameProtocol.js +24 -0
  412. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.d.ts +38 -0
  413. package/lib/WAUSync/Protocols/UsyncBotProfileProtocol.js +49 -0
  414. package/lib/WAUSync/Protocols/UsyncLIDProtocol.d.ts +14 -0
  415. package/lib/WAUSync/Protocols/UsyncLIDProtocol.js +28 -0
  416. package/lib/WAUSync/Protocols/index.d.ts +12 -0
  417. package/lib/WAUSync/Protocols/index.js +12 -0
  418. package/lib/WAUSync/USyncQuery.d.ts +25 -0
  419. package/lib/WAUSync/USyncQuery.js +140 -0
  420. package/lib/WAUSync/USyncUser.d.ts +24 -0
  421. package/lib/WAUSync/USyncUser.js +47 -0
  422. package/lib/WAUSync/index.d.ts +3 -0
  423. package/lib/WAUSync/index.js +3 -0
  424. package/lib/assets/wasm/loader.js +5 -0
  425. package/lib/assets/wasm/whatsapp.wasm +0 -0
  426. package/lib/assets/wasm/worker-modules.js +273 -0
  427. package/lib/exports-extra.d.ts +45 -0
  428. package/lib/exports-extra.js +47 -0
  429. package/lib/index.d.ts +16 -0
  430. package/lib/index.js +24 -0
  431. package/package.json +161 -4
@@ -0,0 +1,131 @@
1
+ export class A2UI {
2
+ constructor(opts25?: { [key: string]: any;
3
+ catalogId?: string;
4
+ version?: string;
5
+ });
6
+ _version: string;
7
+ _catalogId: string;
8
+ _components: Map<any, any>;
9
+ _counter: number;
10
+ _rootChildren: any[];
11
+ /** Set the A2UI spec version string. */
12
+ setVersion(version: any): this;
13
+ /** Set the component catalog url. */
14
+ setCatalogId(catalogId: any): this;
15
+ text(text: any, opts1?: { [key: string]: any;
16
+ variant?: string;
17
+ }): any;
18
+ image(url: any, opts2?: { [key: string]: any;
19
+ fit?: string;
20
+ }): any;
21
+ /** Merge extra props into an already-registered component (Go `a2uiComponent.Extra`). Returns the id. */
22
+ extend(id: any, extra?: {}): any;
23
+ /** Component tree as plain JSON (Go `MarshalJSON`): `{ version, catalogId, components }`, with the implicit root first when `root()` was called. */
24
+ toJSON(): {
25
+ version: string;
26
+ catalogId: string;
27
+ components: any[];
28
+ };
29
+ /** Image with an explicit fit (`cover` | `none`). Same as `image(url, { fit })`. */
30
+ imageFit(url: any, fit: any, opts3?: { [key: string]: any; }): any;
31
+ /** Header-variant image for card headers (`variant: "header"`, `fit: "none"`). */
32
+ imageHeader(url: any, opts4?: { [key: string]: any; }): any;
33
+ /** `text()` with the variant as a positional argument (Go `TextVariant`). */
34
+ textVariant(text: any, variant: any, opts5?: { [key: string]: any; }): any;
35
+ /** `textField()` with the variant as a positional argument (Go `TextFieldVariant`). */
36
+ textFieldVariant(label: any, variant: any, opts6?: { [key: string]: any; }): any;
37
+ /** `choicePicker()` with `filterable: true` (Go `ChoicePickerFilterable`). */
38
+ choicePickerFilterable(label: any, options: any, o?: {}): any;
39
+ video(url: any, opts7?: { [key: string]: any; }): any;
40
+ checkbox(label: any, opts8?: { [key: string]: any;
41
+ value?: boolean;
42
+ }): any;
43
+ textField(label: any, opts9?: { [key: string]: any;
44
+ variant?: string;
45
+ }): any;
46
+ button(childId: any, opts10?: { [key: string]: any;
47
+ variant?: string;
48
+ }): any;
49
+ card(childId: any, opts11?: { [key: string]: any; }): any;
50
+ modal(triggerId: any, contentId: any, opts12?: { [key: string]: any; }): any;
51
+ raw(component: any, props?: {}, opts13?: { [key: string]: any; }): any;
52
+ column(children?: any[], opts14?: { [key: string]: any; }): any;
53
+ row(children?: any[], opts15?: { [key: string]: any; }): any;
54
+ divider(opts26?: { [key: string]: any; }): any;
55
+ slider(opts27?: { [key: string]: any;
56
+ value?: number;
57
+ min?: number;
58
+ max?: number;
59
+ step?: number;
60
+ }): any;
61
+ dateTimeInput(label: any, opts16?: { [key: string]: any;
62
+ value?: string;
63
+ enableDate?: boolean;
64
+ enableTime?: boolean;
65
+ }): any;
66
+ switch(label: any, opts17?: { [key: string]: any;
67
+ value?: boolean;
68
+ }): any;
69
+ list(children?: any[], opts18?: { [key: string]: any; }): any;
70
+ progressBar(value: any, opts19?: { [key: string]: any;
71
+ min?: number;
72
+ max?: number;
73
+ variant?: string;
74
+ }): any;
75
+ avatar(url: any, opts20?: { [key: string]: any;
76
+ variant?: string;
77
+ size?: number;
78
+ }): any;
79
+ badge(childId: any, opts21?: { [key: string]: any; }): any;
80
+ spacer(opts28?: { [key: string]: any;
81
+ height?: number;
82
+ }): any;
83
+ tabs(items?: any[], opts22?: { [key: string]: any;
84
+ activeTab?: number;
85
+ }): any;
86
+ choicePicker(label: any, options: any, opts23?: { [key: string]: any;
87
+ variant?: string;
88
+ displayStyle?: string;
89
+ filterable?: boolean;
90
+ }): any;
91
+ root(children: any): this;
92
+ listCard(opts29?: { [key: string]: any;
93
+ uuid?: any;
94
+ }): this;
95
+ _listCardPayload: {
96
+ uuid: any;
97
+ data: string;
98
+ type: string;
99
+ fallback: any;
100
+ };
101
+ send(client: any, jid: any, opts?: {}): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
102
+ build(opts30?: { [key: string]: any;
103
+ uuid?: any;
104
+ type?: string;
105
+ wrapped?: boolean;
106
+ }): {
107
+ uuid: any;
108
+ data: string;
109
+ type: string;
110
+ fallback: any;
111
+ } | {
112
+ uuid: any;
113
+ data: string;
114
+ type: string;
115
+ };
116
+ #private;
117
+ }
118
+ /**
119
+ * Build + send an A2UI/Bloks widget as an interactiveMessage.
120
+ * @param {import('../../WAProto/index.js').WASocket} client Active Baileys socket.
121
+ * @param {string} jid Destination chat/group jid.
122
+ */
123
+ export function sendA2UIWidget(client: any, jid: string, opts24?: { [key: string]: any;
124
+ bodyText?: string;
125
+ footer?: string;
126
+ buttons?: any[];
127
+ contextInfo?: {};
128
+ type?: string;
129
+ wrapped?: boolean;
130
+ singleScreen?: boolean;
131
+ }): Promise<import("../../WAProto/index.js").proto.WebMessageInfo>;
@@ -0,0 +1,343 @@
1
+ /**
2
+ * lib/Builders/A2UI.js — A2UI (Bloks) widget builder + sender
3
+ *
4
+ * Part of @vanzxysenpai/baileys. Builds the flat `components` array A2UI/Bloks
5
+ * expects (id-referencing tree: Column/Row hold `children`, Card/Button hold
6
+ * `child`, Modal holds `trigger`/`content`) and sends it as an
7
+ * `interactiveMessage.bloksWidget` via the same `getBizBinaryNode()` path
8
+ * Button/ButtonV2 use, so the wire-level <biz>/<native_flow> node always
9
+ * matches the actual button names sent — no more hand-rolled duplicate of
10
+ * that logic living outside the library.
11
+ *
12
+ * See Button.js's `Button.setBloksWidget()` for the declarative
13
+ * (nested-tree) alternative to this imperative (id-returning-factory) API;
14
+ * both produce the same wire format and can be mixed freely.
15
+ */
16
+ "use strict";
17
+
18
+ import crypto from "crypto";
19
+ import { generateWAMessageFromContent, prepareWAMessageMedia } from "../Utils/messages.js";
20
+ import { getBizBinaryNode } from "../WABinary/index.js";
21
+
22
+ class A2UI {
23
+ constructor({ catalogId = "https://a2ui.org/specification/v0_9/catalogs/basic/catalog.json", version = "v0.9" } = {}) {
24
+ this._version = version;
25
+ this._catalogId = catalogId;
26
+ this._components = new Map();
27
+ this._counter = 0;
28
+ this._rootChildren = [];
29
+ }
30
+ /** Set the A2UI spec version string. */
31
+ setVersion(version) {
32
+ if (typeof version !== "string" || !version) throw new TypeError("setVersion(version) requires a non-empty string");
33
+ this._version = version;
34
+ return this;
35
+ }
36
+ /** Set the component catalog url. */
37
+ setCatalogId(catalogId) {
38
+ if (typeof catalogId !== "string" || !catalogId) throw new TypeError("setCatalogId(catalogId) requires a non-empty string");
39
+ this._catalogId = catalogId;
40
+ return this;
41
+ }
42
+ #nextId(prefix) {
43
+ return `${prefix}_${(this._counter++).toString(36)}`;
44
+ }
45
+ #reg(id, component, extra = {}) {
46
+ id ??= this.#nextId(component.toLowerCase());
47
+ if (id === "root") throw new Error(`Component id "root" is reserved for the implicit root wrapper`);
48
+ if (this._components.has(id)) throw new Error(`Component id "${id}" already used`);
49
+ this._components.set(id, { id, component, ...extra });
50
+ return id;
51
+ }
52
+ text(text, { id, variant = "body" } = {}) {
53
+ return this.#reg(id, "Text", { text, variant });
54
+ }
55
+ image(url, { id, variant, fit = "cover" } = {}) {
56
+ return this.#reg(id, "Image", { url, ...(variant ? { variant } : {}), fit });
57
+ }
58
+ /** Merge extra props into an already-registered component (Go `a2uiComponent.Extra`). Returns the id. */
59
+ extend(id, extra = {}) {
60
+ const c = this._components.get(id);
61
+ if (!c) throw new Error(`A2UI: no component registered with id "${id}"`);
62
+ if (!extra || typeof extra !== "object" || Array.isArray(extra)) throw new TypeError("extend(id, extra) requires a plain object");
63
+ Object.assign(c, extra, { id: c.id, component: c.component });
64
+ return id;
65
+ }
66
+ /** Component tree as plain JSON (Go `MarshalJSON`): `{ version, catalogId, components }`, with the implicit root first when `root()` was called. */
67
+ toJSON() {
68
+ const root = this._rootChildren.length ? [{ id: "root", component: "Column", children: this._rootChildren }] : [];
69
+ return { version: this._version, catalogId: this._catalogId, components: [...root, ...this._components.values()] };
70
+ }
71
+ /** Image with an explicit fit (`cover` | `none`). Same as `image(url, { fit })`. */
72
+ imageFit(url, fit, { id } = {}) {
73
+ return this.image(url, { id, fit });
74
+ }
75
+ /** Header-variant image for card headers (`variant: "header"`, `fit: "none"`). */
76
+ imageHeader(url, { id } = {}) {
77
+ return this.image(url, { id, variant: "header", fit: "none" });
78
+ }
79
+ /** `text()` with the variant as a positional argument (Go `TextVariant`). */
80
+ textVariant(text, variant, { id } = {}) {
81
+ return this.text(text, { id, variant });
82
+ }
83
+ /** `textField()` with the variant as a positional argument (Go `TextFieldVariant`). */
84
+ textFieldVariant(label, variant, { id } = {}) {
85
+ return this.textField(label, { id, variant });
86
+ }
87
+ /** `choicePicker()` with `filterable: true` (Go `ChoicePickerFilterable`). */
88
+ choicePickerFilterable(label, options, o = {}) {
89
+ return this.choicePicker(label, options, { ...o, filterable: true });
90
+ }
91
+ video(url, { id } = {}) {
92
+ return this.#reg(id, "Video", { url });
93
+ }
94
+ checkbox(label, { id, value = false } = {}) {
95
+ return this.#reg(id, "CheckBox", { label, value });
96
+ }
97
+ textField(label, { id, variant = "text" } = {}) {
98
+ return this.#reg(id, "TextField", { label, variant });
99
+ }
100
+ button(childId, { id, variant = "primary", action } = {}) {
101
+ if (!childId) throw new TypeError("button(childId) requires the id of a child component (e.g. from .text())");
102
+ return this.#reg(id, "Button", { child: childId, variant, ...(action ? { action } : {}) });
103
+ }
104
+ card(childId, { id } = {}) {
105
+ return this.#reg(id, "Card", { child: childId });
106
+ }
107
+ // trigger: id of the component that opens the modal (e.g. a Button); content: id of the
108
+ // component shown inside it. Both are ids of already-registered SIBLING components, not
109
+ // nested children — that's how the wire format expects Modal to reference them.
110
+ modal(triggerId, contentId, { id } = {}) {
111
+ if (!triggerId) throw new TypeError("modal(triggerId, contentId) requires the id of the trigger component");
112
+ if (!contentId) throw new TypeError("modal(triggerId, contentId) requires the id of the content component");
113
+ return this.#reg(id, "Modal", { trigger: triggerId, content: contentId });
114
+ }
115
+ // Escape hatch for any catalog component without a dedicated method yet (Divider, Slider,
116
+ // Switch, List, etc). props is merged as-is into the registered node.
117
+ raw(component, props = {}, { id } = {}) {
118
+ if (typeof component !== "string" || !component) throw new TypeError("raw(component, props) requires a non-empty component type string");
119
+ return this.#reg(id, component, props);
120
+ }
121
+ column(children = [], { id } = {}) {
122
+ if (!children.length) throw new TypeError("column(children) requires at least one child id");
123
+ return this.#reg(id, "Column", { children });
124
+ }
125
+ row(children = [], { id } = {}) {
126
+ if (!children.length) throw new TypeError("row(children) requires at least one child id");
127
+ return this.#reg(id, "Row", { children });
128
+ }
129
+ divider({ id } = {}) {
130
+ return this.#reg(id, "Divider", {});
131
+ }
132
+ slider({ id, value = 0, min = 0, max = 100, step = 1, label } = {}) {
133
+ return this.#reg(id, "Slider", { value, min, max, step, ...(label !== undefined ? { label } : {}) });
134
+ }
135
+ dateTimeInput(label, { id, value = "", enableDate = true, enableTime = false } = {}) {
136
+ if (typeof label !== "string" || !label) throw new TypeError("dateTimeInput(label) requires a non-empty string");
137
+ if (!enableDate && !enableTime) throw new TypeError("dateTimeInput needs enableDate and/or enableTime");
138
+ return this.#reg(id, "DateTimeInput", { label, value, enableDate, enableTime });
139
+ }
140
+ switch(label, { id, value = false } = {}) {
141
+ return this.#reg(id, "Switch", { label, value });
142
+ }
143
+ list(children = [], { id } = {}) {
144
+ if (!children.length) throw new TypeError("list(children) requires at least one child id");
145
+ return this.#reg(id, "List", { children });
146
+ }
147
+ progressBar(value, { id, min = 0, max = 100, variant = "linear" } = {}) {
148
+ if (typeof value !== "number") throw new TypeError("progressBar(value) requires a number");
149
+ return this.#reg(id, "ProgressBar", { value, min, max, variant });
150
+ }
151
+ avatar(url, { id, variant = "circle", size = 40 } = {}) {
152
+ if (!url) throw new TypeError("avatar(url) requires an image url");
153
+ return this.#reg(id, "Avatar", { url, variant, size });
154
+ }
155
+ badge(childId, { id, label } = {}) {
156
+ if (!childId) throw new TypeError("badge(childId) requires the id of a child component");
157
+ return this.#reg(id, "Badge", { child: childId, ...(label !== undefined ? { label } : {}) });
158
+ }
159
+ spacer({ id, height = 16 } = {}) {
160
+ return this.#reg(id, "Spacer", { height });
161
+ }
162
+ // tabs([{ title, child }]) -> official `tabItems` shape; tabs(["id1","id2"]) -> japofc `children` shape.
163
+ tabs(items = [], { id, activeTab = 0 } = {}) {
164
+ if (!items.length) throw new TypeError("tabs(items) requires at least one tab");
165
+ if (typeof items[0] === "object") {
166
+ for (const it of items) if (!it?.title || !it?.child) throw new TypeError("tabs(items): each item needs { title, child }");
167
+ return this.#reg(id, "Tabs", { tabItems: items.map(({ title, child }) => ({ title, child })) });
168
+ }
169
+ return this.#reg(id, "Tabs", { children: items, activeTab });
170
+ }
171
+ choicePicker(label, options, { id, variant = "mutuallyExclusive", value, displayStyle = "checkbox", filterable = false } = {}) {
172
+ if (!Array.isArray(options) || !options.length) {
173
+ throw new TypeError("choicePicker(label, options) requires a non-empty options array of {label, value}");
174
+ }
175
+ return this.#reg(id, "ChoicePicker", {
176
+ label,
177
+ variant,
178
+ ...(value !== undefined ? { value } : {}),
179
+ options,
180
+ displayStyle,
181
+ filterable
182
+ });
183
+ }
184
+ root(children) {
185
+ if (!Array.isArray(children) || !children.length) {
186
+ throw new TypeError("root(children) requires a non-empty array of top-level component ids");
187
+ }
188
+ this._rootChildren = children;
189
+ return this;
190
+ }
191
+ listCard({ title, items, fallbackText, uuid = crypto.randomUUID() } = {}) {
192
+ if (!title) throw new TypeError("listCard requires a title");
193
+ if (!Array.isArray(items) || !items.length) {
194
+ throw new TypeError("listCard requires a non-empty items array");
195
+ }
196
+ this._listCardPayload = {
197
+ uuid,
198
+ data: JSON.stringify({
199
+ type: "list_card",
200
+ title,
201
+ fallback_text: fallbackText ?? "",
202
+ items: items.map((it) => ({
203
+ asset_id: it.assetId ?? crypto.randomUUID().replace(/-/g, "").slice(0, 17),
204
+ asset_type: it.assetType ?? "PRODUCT_ITEM",
205
+ title: it.title,
206
+ trailing_label: it.price ?? it.trailingLabel ?? "",
207
+ trailing_emphasis: it.emphasis ?? "strong"
208
+ }))
209
+ }),
210
+ type: "im_a2ui",
211
+ fallback: fallbackText ?? ""
212
+ };
213
+ return this;
214
+ }
215
+ async send(client, jid, opts = {}) {
216
+ return sendA2UIWidget(client, jid, { ...opts, a2ui: this });
217
+ }
218
+ #validateRefs(components) {
219
+ const validIds = new Set(components.map((c) => c.id));
220
+ for (const c of components) {
221
+ for (const key of ["child", "trigger", "content"]) {
222
+ if (c[key] !== undefined && !validIds.has(c[key])) {
223
+ throw new Error(`A2UI: component "${c.id}" (${c.component}) references unknown id "${c[key]}" via "${key}"`);
224
+ }
225
+ }
226
+ if (Array.isArray(c.tabItems)) {
227
+ for (const t of c.tabItems) {
228
+ if (!validIds.has(t.child)) throw new Error(`A2UI: component "${c.id}" (${c.component}) references unknown id "${t.child}" in "tabItems"`);
229
+ }
230
+ }
231
+ if (Array.isArray(c.children)) {
232
+ for (const childId of c.children) {
233
+ if (!validIds.has(childId)) {
234
+ throw new Error(`A2UI: component "${c.id}" (${c.component}) references unknown id "${childId}" in "children"`);
235
+ }
236
+ }
237
+ }
238
+ }
239
+ }
240
+ build({ uuid = crypto.randomUUID(), surfaceId, type = "im_a2ui", wrapped = true } = {}) {
241
+ if (this._listCardPayload) return this._listCardPayload;
242
+ if (!this._rootChildren.length) throw new Error("Call root([...ids]) before build()");
243
+ const root = { id: "root", component: "Column", children: this._rootChildren };
244
+ const components = [root, ...this._components.values()];
245
+ this.#validateRefs(components);
246
+ const data = wrapped
247
+ ? {
248
+ version: this._version,
249
+ createSurface: {
250
+ surfaceId: surfaceId ?? `starcore-widget=${uuid}`,
251
+ catalogId: this._catalogId,
252
+ components
253
+ }
254
+ }
255
+ : { components };
256
+ return {
257
+ uuid,
258
+ data: JSON.stringify(data),
259
+ type
260
+ };
261
+ }
262
+ }
263
+
264
+ /**
265
+ * Build + send an A2UI/Bloks widget as an interactiveMessage.
266
+ * @param {import('../../WAProto/index.js').WASocket} client Active Baileys socket.
267
+ * @param {string} jid Destination chat/group jid.
268
+ */
269
+ async function sendA2UIWidget(client, jid, {
270
+ a2ui,
271
+ bodyText = "",
272
+ footer = "",
273
+ buttons = [],
274
+ contextInfo = {},
275
+ expiration,
276
+ quoted,
277
+ type = "im_a2ui",
278
+ wrapped = true,
279
+ singleScreen = false,
280
+ header
281
+ } = {}) {
282
+ if (!client) throw new Error("Socket is required");
283
+ if (!(a2ui instanceof A2UI)) throw new TypeError("a2ui must be an A2UI instance");
284
+
285
+ const nativeFlowMessage = buttons && buttons.length
286
+ ? {
287
+ buttons: buttons.map((b) => ({
288
+ name: b.name ?? "cta_url",
289
+ buttonParamsJson: typeof b.params === "string" ? b.params : JSON.stringify(b.params ?? {}),
290
+ })),
291
+ messageParamsJson: "{}",
292
+ messageVersion: 1
293
+ }
294
+ : { messageParamsJson: "" };
295
+
296
+ const headerMediaData = header?.image
297
+ ? { image: header.image }
298
+ : header?.video
299
+ ? { video: header.video }
300
+ : header?.document
301
+ ? { document: header.document }
302
+ : null;
303
+
304
+ const headerBlock = {
305
+ ...(header?.title !== undefined ? { title: header.title } : {}),
306
+ ...(header?.subtitle !== undefined ? { subtitle: header.subtitle } : {}),
307
+ hasMediaAttachment: !!headerMediaData,
308
+ ...(headerMediaData
309
+ ? await prepareWAMessageMedia(headerMediaData, { upload: client.waUploadToServer }).catch((e) => {
310
+ if (String(e).includes("Invalid media type")) return headerMediaData;
311
+ throw e;
312
+ })
313
+ : {})
314
+ };
315
+
316
+ const interactiveMessage = singleScreen
317
+ ? {
318
+ nativeFlowMessage,
319
+ bloksWidget: a2ui.build({ type, wrapped }),
320
+ ...(expiration || Object.keys(contextInfo).length ? { contextInfo: { ...(expiration ? { expiration } : {}), ...contextInfo } } : {})
321
+ }
322
+ : {
323
+ header: headerBlock,
324
+ body: { text: bodyText },
325
+ ...(footer ? { footer: { text: footer } } : {}),
326
+ nativeFlowMessage,
327
+ bloksWidget: a2ui.build({ type, wrapped }),
328
+ ...(expiration || Object.keys(contextInfo).length ? { contextInfo: { ...(expiration ? { expiration } : {}), ...contextInfo } } : {})
329
+ };
330
+
331
+ const msg = generateWAMessageFromContent(jid, {
332
+ messageContextInfo: { messageSecret: crypto.randomBytes(32) },
333
+ interactiveMessage
334
+ }, { quoted });
335
+
336
+ await client.relayMessage(msg.key.remoteJid, msg.message, {
337
+ messageId: msg.key.id,
338
+ additionalNodes: [getBizBinaryNode(msg.message)]
339
+ });
340
+ return msg;
341
+ }
342
+
343
+ export { A2UI, sendA2UIWidget };